Browse Source

Firefox: add basic blocking + some fixes

pull/2/head
Deathamns 10 years ago
committed by gorhill
parent
commit
05f174ab97
  1. 12
      platform/firefox/frameScript.js

12
platform/firefox/frameScript.js

@ -24,7 +24,7 @@ let _removeMessageListener = function(id) {
delete listeners[id]; delete listeners[id];
}; };
addMessageListener('µBlock:broadcast', function(msg) {
addMessageListener(appName + ':broadcast', function(msg) {
for (let id in listeners) { for (let id in listeners) {
listeners[id](msg); listeners[id](msg);
} }
@ -63,7 +63,12 @@ let observer = {
lss(contentBaseURI + 'vapi-client.js', win); lss(contentBaseURI + 'vapi-client.js', win);
lss(contentBaseURI + 'contentscript-start.js', win); lss(contentBaseURI + 'contentscript-start.js', win);
if (win.document.readyState === 'loading') {
let readyState = win.document.readyState;
if (readyState === "interactive" || readyState === "complete") {
lss(contentBaseURI + 'contentscript-end.js', win);
}
else {
let docReady = function(e) { let docReady = function(e) {
this.removeEventListener(e.type, docReady, true); this.removeEventListener(e.type, docReady, true);
lss(contentBaseURI + 'contentscript-end.js', win); lss(contentBaseURI + 'contentscript-end.js', win);
@ -71,9 +76,6 @@ let observer = {
win.document.addEventListener('DOMContentLoaded', docReady, true); win.document.addEventListener('DOMContentLoaded', docReady, true);
} }
else {
lss(contentBaseURI + 'contentscript-end.js', win);
}
} }
}; };

Loading…
Cancel
Save