aboutsummaryrefslogtreecommitdiffstats
path: root/platform
diff options
context:
space:
mode:
authorDeathamns <deathamns@gmail.com>2015-01-09 07:58:07 +0100
committerDeathamns <deathamns@gmail.com>2015-01-13 07:30:03 +0100
commita71c967613a2654bd852d7c1d95dc2c245cb9413 (patch)
tree3d729452bf16e0a50c8097da7216ccd82a2a71a0 /platform
parent687d226ce91fac1ebf5c8af971d7f0cc66967e0a (diff)
downloaduBlock-a71c967613a2654bd852d7c1d95dc2c245cb9413.zip
uBlock-a71c967613a2654bd852d7c1d95dc2c245cb9413.tar.gz
uBlock-a71c967613a2654bd852d7c1d95dc2c245cb9413.tar.bz2
Firefox: fixed content scripts?
Diffstat (limited to 'platform')
-rw-r--r--platform/firefox/frameModule.js22
-rw-r--r--platform/firefox/vapi-background.js3
-rw-r--r--platform/firefox/vapi-client.js6
3 files changed, 6 insertions, 25 deletions
diff --git a/platform/firefox/frameModule.js b/platform/firefox/frameModule.js
index 8974839..5b74194 100644
--- a/platform/firefox/frameModule.js
+++ b/platform/firefox/frameModule.js
@@ -30,8 +30,6 @@ const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
const hostName = Services.io.newURI(Components.stack.filename, null, null).host;
let uniqueSandboxId = 1;
-Cu.import('resource://gre/modules/devtools/Console.jsm');
-
/******************************************************************************/
const getMessageManager = function(win) {
@@ -54,7 +52,6 @@ const contentObserver = {
MAIN_FRAME: Ci.nsIContentPolicy.TYPE_DOCUMENT,
contentBaseURI: 'chrome://' + hostName + '/content/js/',
cpMessageName: hostName + ':shouldLoad',
- frameSandboxes: new WeakMap(),
get componentRegistrar() {
return Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
@@ -86,7 +83,6 @@ const contentObserver = {
register: function() {
Services.obs.addObserver(this, 'document-element-inserted', true);
- Services.obs.addObserver(this, 'dom-window-destroyed', true);
this.componentRegistrar.registerFactory(
this.classID,
@@ -105,7 +101,6 @@ const contentObserver = {
unregister: function() {
Services.obs.removeObserver(this, 'document-element-inserted');
- Services.obs.removeObserver(this, 'dom-window-destroyed');
this.componentRegistrar.unregisterFactory(this.classID, this);
this.categoryManager.deleteCategoryEntry(
@@ -196,10 +191,6 @@ const contentObserver = {
sandbox = win;
}
- if ( win !== win.top ) {
- this.frameSandboxes.set(win, sandbox);
- }
-
sandbox._sandboxId_ = sandboxId;
sandbox.sendAsyncMessage = messager.sendAsyncMessage;
sandbox.addMessageListener = function(callback) {
@@ -238,18 +229,7 @@ const contentObserver = {
return sandbox;
},
- observe: function(subject, topic) {
- if ( topic === 'dom-window-destroyed' ) {
- let sandbox = this.frameSandboxes.get(subject);
-
- if ( sandbox ) {
- sandbox.removeMessageListener();
- this.frameSandboxes.delete(subject);
- }
-
- return;
- }
-
+ observe: function(subject) {
let win = subject.defaultView;
if ( !win ) {
diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js
index dbbaeca..2556688 100644
--- a/platform/firefox/vapi-background.js
+++ b/platform/firefox/vapi-background.js
@@ -30,8 +30,7 @@
/******************************************************************************/
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import('resource://gre/modules/Services.jsm');
+const {Services} = Cu.import('resource://gre/modules/Services.jsm', null);
/******************************************************************************/
diff --git a/platform/firefox/vapi-client.js b/platform/firefox/vapi-client.js
index d0a05ed..4886bb6 100644
--- a/platform/firefox/vapi-client.js
+++ b/platform/firefox/vapi-client.js
@@ -149,14 +149,16 @@ vAPI.messaging = {
/******************************************************************************/
var toggleListener = function({type, persisted}) {
- if ( !persisted || !vAPI.messaging.connector ) {
+ if ( !vAPI.messaging.connector ) {
return;
}
if ( type === 'pagehide' ) {
removeMessageListener();
+ return;
}
- else {
+
+ if ( persisted ) {
addMessageListener(vAPI.messaging.connector);
}
};