| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 { | 78 { |
| 79 // We are calling getFrames() here because it will consider | 79 // We are calling getFrames() here because it will consider |
| 80 // "inheritance" for about:blank and data: frames. | 80 // "inheritance" for about:blank and data: frames. |
| 81 docDomain = new URL(getFrames(subject)[0].location).hostname; | 81 docDomain = new URL(getFrames(subject)[0].location).hostname; |
| 82 } | 82 } |
| 83 catch (e) | 83 catch (e) |
| 84 { | 84 { |
| 85 // Invalid URL? | 85 // Invalid URL? |
| 86 } | 86 } |
| 87 | 87 |
| 88 for (let filter of filters) | 88 for (let i = 0; i < filters.length; i++) |
| 89 { | 89 { |
| 90 RequestNotifier.addNodeData(subject.document, subject.top, { | 90 RequestNotifier.addNodeData(subject.document, subject.top, { |
| 91 contentType: "ELEMHIDE", | 91 contentType: "ELEMHIDE", |
| 92 docDomain: docDomain, | 92 docDomain: docDomain, |
| 93 thirdParty: false, | 93 thirdParty: false, |
| 94 // TODO: Show the actual matching selector here? | 94 location: "##" + selectors[i], |
| 95 location: filter.replace(/^.*?##/, ""), | 95 filter: filters[i], |
| 96 filter: filter, | |
| 97 filterType: "elemhideemulation" | 96 filterType: "elemhideemulation" |
| 98 }); | 97 }); |
| 99 } | 98 } |
| 100 } | 99 } |
| 101 ); | 100 ); |
| 102 | 101 |
| 103 handler.load(() => handler.apply()); | 102 handler.apply(); |
| 104 }; | 103 }; |
| 105 | 104 |
| 106 subject.addEventListener("load", onReady); | 105 subject.addEventListener("load", onReady); |
| 107 }; | 106 }; |
| 108 | 107 |
| 109 Services.obs.addObserver(onContentWindow, "content-document-global-created", | 108 Services.obs.addObserver(onContentWindow, "content-document-global-created", |
| 110 false); | 109 false); |
| 111 onShutdown.add(() => | 110 onShutdown.add(() => |
| 112 { | 111 { |
| 113 Services.obs.removeObserver(onContentWindow, | 112 Services.obs.removeObserver(onContentWindow, |
| 114 "content-document-global-created"); | 113 "content-document-global-created"); |
| 115 }); | 114 }); |
| 116 } | 115 } |
| 117 | 116 |
| 118 initElemHideEmulation(); | 117 initElemHideEmulation(); |
| 119 })(); | 118 })(); |
| OLD | NEW |