OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 16 matching lines...) Expand all Loading... |
27 { | 27 { |
28 enum | 28 enum |
29 { | 29 { |
30 TYPE_OTHER = 0x1, | 30 TYPE_OTHER = 0x1, |
31 TYPE_SCRIPT = 0x2, | 31 TYPE_SCRIPT = 0x2, |
32 TYPE_IMAGE = 0x4, | 32 TYPE_IMAGE = 0x4, |
33 TYPE_STYLESHEET = 0x8, | 33 TYPE_STYLESHEET = 0x8, |
34 TYPE_OBJECT = 0x10, | 34 TYPE_OBJECT = 0x10, |
35 TYPE_SUBDOCUMENT = 0x20, | 35 TYPE_SUBDOCUMENT = 0x20, |
36 TYPE_DOCUMENT = 0x40, | 36 TYPE_DOCUMENT = 0x40, |
| 37 TYPE_WEBSOCKET = 0x80, |
| 38 TYPE_WEBRTC = 0x100, |
37 TYPE_PING = 0x400, | 39 TYPE_PING = 0x400, |
38 TYPE_XMLHTTPREQUEST = 0x800, | 40 TYPE_XMLHTTPREQUEST = 0x800, |
39 TYPE_OBJECT_SUBREQUEST = 0x1000, | 41 TYPE_OBJECT_SUBREQUEST = 0x1000, |
40 TYPE_MEDIA = 0x4000, | 42 TYPE_MEDIA = 0x4000, |
41 TYPE_FONT = 0x8000, | 43 TYPE_FONT = 0x8000, |
42 TYPE_POPUP = 0x8000000, | 44 TYPE_POPUP = 0x8000000, |
43 TYPE_GENERICBLOCK = 0x10000000, | 45 TYPE_GENERICBLOCK = 0x10000000, |
44 TYPE_GENERICHIDE = 0x20000000, | 46 TYPE_GENERICHIDE = 0x20000000, |
45 TYPE_ELEMHIDE = 0x40000000, | 47 TYPE_ELEMHIDE = 0x40000000, |
46 }; | 48 }; |
47 | 49 |
48 StringMap<int> typeMap { | 50 const StringMap<int> typeMap { |
49 {u"other"_str, TYPE_OTHER}, | 51 {u"other"_str, TYPE_OTHER}, |
50 {u"script"_str, TYPE_SCRIPT}, | 52 {u"script"_str, TYPE_SCRIPT}, |
51 {u"image"_str, TYPE_IMAGE}, | 53 {u"image"_str, TYPE_IMAGE}, |
52 {u"stylesheet"_str, TYPE_STYLESHEET}, | 54 {u"stylesheet"_str, TYPE_STYLESHEET}, |
53 {u"object"_str, TYPE_OBJECT}, | 55 {u"object"_str, TYPE_OBJECT}, |
54 {u"subdocument"_str, TYPE_SUBDOCUMENT}, | 56 {u"subdocument"_str, TYPE_SUBDOCUMENT}, |
55 {u"document"_str, TYPE_DOCUMENT}, | 57 {u"document"_str, TYPE_DOCUMENT}, |
| 58 {u"websocket"_str, TYPE_WEBSOCKET}, |
| 59 {u"webrtc"_str, TYPE_WEBRTC}, |
56 {u"xbl"_str, TYPE_OTHER}, // Backwards compat | 60 {u"xbl"_str, TYPE_OTHER}, // Backwards compat |
57 {u"ping"_str, TYPE_PING}, | 61 {u"ping"_str, TYPE_PING}, |
58 {u"xmlhttprequest"_str, TYPE_XMLHTTPREQUEST}, | 62 {u"xmlhttprequest"_str, TYPE_XMLHTTPREQUEST}, |
59 {u"object-subrequest"_str, TYPE_OBJECT_SUBREQUEST}, | 63 {u"object-subrequest"_str, TYPE_OBJECT_SUBREQUEST}, |
60 {u"dtd"_str, TYPE_OTHER}, // Backwards compat | 64 {u"dtd"_str, TYPE_OTHER}, // Backwards compat |
61 {u"media"_str, TYPE_MEDIA}, | 65 {u"media"_str, TYPE_MEDIA}, |
62 {u"font"_str, TYPE_FONT}, | 66 {u"font"_str, TYPE_FONT}, |
63 {u"background"_str, TYPE_IMAGE}, // Backwards compat | 67 {u"background"_str, TYPE_IMAGE}, // Backwards compat |
64 | 68 |
65 {u"popup"_str, TYPE_POPUP}, | 69 {u"popup"_str, TYPE_POPUP}, |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 return false; | 384 return false; |
381 } | 385 } |
382 | 386 |
383 if (!mData.RegExpParsingDone()) | 387 if (!mData.RegExpParsingDone()) |
384 { | 388 { |
385 const OwnedString pattern(mData.GetRegExpSource(mText)); | 389 const OwnedString pattern(mData.GetRegExpSource(mText)); |
386 mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase))
; | 390 mData.SetRegExp(GenerateRegExp(RegExpFromSource(pattern), mData.mMatchCase))
; |
387 } | 391 } |
388 return EM_ASM_INT(return regexps.test($0, $1), mData.mRegexpId, &location); | 392 return EM_ASM_INT(return regexps.test($0, $1), mData.mRegexpId, &location); |
389 } | 393 } |
OLD | NEW |