| Index: include.preload.js |
| =================================================================== |
| --- a/include.preload.js |
| +++ b/include.preload.js |
| @@ -160,17 +160,17 @@ |
| let mediatype = typeMap.get(element.localName); |
| if (!mediatype) |
| return; |
| let urls = getURLsFromElement(element); |
| if (urls.length == 0) |
| return; |
| - chrome.runtime.sendMessage( |
| + browser.runtime.sendMessage( |
| { |
| type: "filters.collapse", |
| urls, |
| mediatype, |
| baseURL: document.location.href |
| }, |
| collapse => |
| @@ -182,17 +182,17 @@ |
| } |
| ); |
| } |
| function checkSitekey() |
| { |
| let attr = document.documentElement.getAttribute("data-adblockkey"); |
| if (attr) |
| - chrome.runtime.sendMessage({type: "filters.addKey", token: attr}); |
| + browser.runtime.sendMessage({type: "filters.addKey", token: attr}); |
| } |
| function ElementHidingTracer() |
| { |
| this.selectors = []; |
| this.changedNodes = []; |
| this.timeout = null; |
| this.observer = new MutationObserver(this.observe.bind(this)); |
| @@ -243,17 +243,17 @@ |
| break nodes; |
| } |
| } |
| } |
| } |
| if (selectors.length > 0 || filters.length > 0) |
| { |
| - chrome.runtime.sendMessage({ |
| + browser.runtime.sendMessage({ |
| type: "devtools.traceElemHide", |
| selectors, filters |
| }); |
| } |
| }, |
| onTimeout() |
| { |
| @@ -436,55 +436,55 @@ |
| { |
| if (selectors.length == 0) |
| return; |
| if (this.inject) |
| { |
| // Insert the style rules inline if we have been instructed by the |
| // background page to do so. This is usually the case, except on platforms |
| - // that do support user stylesheets via the chrome.tabs.insertCSS API |
| + // that do support user stylesheets via the browser.tabs.insertCSS API |
| // (Firefox 53 onwards for now and possibly Chrome in the near future). |
| // Once all supported platforms have implemented this API, we can remove |
| // the code below. See issue #5090. |
| // Related Chrome and Firefox issues: |
| // https://bugs.chromium.org/p/chromium/issues/detail?id=632009 |
| // https://bugzilla.mozilla.org/show_bug.cgi?id=1310026 |
| this.injectSelectors(selectors, filters); |
| } |
| else |
| { |
| - chrome.runtime.sendMessage({ |
| + browser.runtime.sendMessage({ |
| type: "elemhide.injectSelectors", |
| selectors |
| }); |
| } |
| if (this.tracer) |
| this.tracer.addSelectors(selectors, filters); |
| }, |
| hideElements(elements, filters) |
| { |
| for (let element of elements) |
| hideElement(element); |
| if (this.tracer) |
| { |
| - chrome.runtime.sendMessage({ |
| + browser.runtime.sendMessage({ |
| type: "devtools.traceElemHide", |
| selectors: [], |
| filters |
| }); |
| } |
| }, |
| apply() |
| { |
| - chrome.runtime.sendMessage({type: "elemhide.getSelectors"}, response => |
| + browser.runtime.sendMessage({type: "elemhide.getSelectors"}, response => |
| { |
| if (this.tracer) |
| this.tracer.disconnect(); |
| this.tracer = null; |
| if (this.style && this.style.parentElement) |
| this.style.parentElement.removeChild(this.style); |
| this.style = null; |