| LEFT | RIGHT |
| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 break; | 233 break; |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 if (matched) | 237 if (matched) |
| 238 break; | 238 break; |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 if (matchedSelectors.length > 0) | 242 if (matchedSelectors.length > 0) |
| 243 ext.backgroundPage.sendMessage({type: "trace-elemhide", selectors: matched
Selectors}); | 243 ext.backgroundPage.sendMessage({ |
| 244 type: "trace-elemhide", |
| 245 selectors: matchedSelectors |
| 246 }); |
| 244 }, | 247 }, |
| 245 | 248 |
| 246 onTimeout: function() | 249 onTimeout: function() |
| 247 { | 250 { |
| 248 this.checkNodes(changedNodes); | 251 this.checkNodes(this.changedNodes); |
| 249 this.changedNodes = []; | 252 this.changedNodes = []; |
| 250 this.timeout = null; | 253 this.timeout = null; |
| 251 }, | 254 }, |
| 252 | 255 |
| 253 observe: function(mutations) | 256 observe: function(mutations) |
| 254 { | 257 { |
| 255 // Forget previously changed nodes that are no longer in the DOM. | 258 // Forget previously changed nodes that are no longer in the DOM. |
| 256 for (var i = 0; i < this.changedNodes.length; i++) | 259 for (var i = 0; i < this.changedNodes.length; i++) |
| 257 { | 260 { |
| 258 if (!this.document.contains(this.changedNodes[i])) | 261 if (!this.document.contains(this.changedNodes[i])) |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 tracer = null; | 502 tracer = null; |
| 500 | 503 |
| 501 if (style && style.parentElement) | 504 if (style && style.parentElement) |
| 502 style.parentElement.removeChild(style); | 505 style.parentElement.removeChild(style); |
| 503 style = null; | 506 style = null; |
| 504 | 507 |
| 505 addElemHideSelectors(selectors.selectors); | 508 addElemHideSelectors(selectors.selectors); |
| 506 propertyFilters.apply(); | 509 propertyFilters.apply(); |
| 507 | 510 |
| 508 if (selectors.trace) | 511 if (selectors.trace) |
| 509 tracer = new ElementHidingTracer(document, selectors); | 512 tracer = new ElementHidingTracer(document, selectors.selectors); |
| 510 }; | 513 }; |
| 511 | 514 |
| 512 ext.backgroundPage.sendMessage({type: "get-selectors"}, function(response) | 515 ext.backgroundPage.sendMessage({type: "get-selectors"}, function(response) |
| 513 { | 516 { |
| 514 selectors = response; | 517 selectors = response; |
| 515 checkLoaded(); | 518 checkLoaded(); |
| 516 }); | 519 }); |
| 517 | 520 |
| 518 propertyFilters.load(function() | 521 propertyFilters.load(function() |
| 519 { | 522 { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 549 // document_start content scripts (like this one) don't | 552 // document_start content scripts (like this one) don't |
| 550 // run either in those frames due to https://crbug.com/416907. | 553 // run either in those frames due to https://crbug.com/416907. |
| 551 // So we have to apply element hiding from the parent frame. | 554 // So we have to apply element hiding from the parent frame. |
| 552 if (!("init" in contentWindow)) | 555 if (!("init" in contentWindow)) |
| 553 init(contentDocument); | 556 init(contentDocument); |
| 554 | 557 |
| 555 // Moreover, "load" and "error" events aren't dispatched for elements | 558 // Moreover, "load" and "error" events aren't dispatched for elements |
| 556 // in dynamically created frames due to https://crbug.com/442107. | 559 // in dynamically created frames due to https://crbug.com/442107. |
| 557 // So we also have to apply element collpasing from the parent frame. | 560 // So we also have to apply element collpasing from the parent frame. |
| 558 if (!contentWindow.collapsing) | 561 if (!contentWindow.collapsing) |
| 559 [].forEach.call(contentDocument.querySelectorAll(Object.keys(typeMap
).join(",")), checkCollapse); | 562 Array.prototype.forEach.call( |
| 563 contentDocument.querySelectorAll(Object.keys(typeMap).join(",")), |
| 564 checkCollapse |
| 565 ); |
| 560 } | 566 } |
| 561 } | 567 } |
| 562 } | 568 } |
| 563 }, true); | 569 }, true); |
| 564 | 570 |
| 565 return updateStylesheet; | 571 return updateStylesheet; |
| 566 } | 572 } |
| 567 | 573 |
| 568 if (document instanceof HTMLDocument) | 574 if (document instanceof HTMLDocument) |
| 569 { | 575 { |
| 570 checkSitekey(); | 576 checkSitekey(); |
| 571 window.updateStylesheet = init(document); | 577 window.updateStylesheet = init(document); |
| 572 } | 578 } |
| LEFT | RIGHT |