aboutsummaryrefslogtreecommitdiffstats
path: root/frameScript.js
diff options
context:
space:
mode:
Diffstat (limited to 'frameScript.js')
-rw-r--r--frameScript.js43
1 files changed, 16 insertions, 27 deletions
diff --git a/frameScript.js b/frameScript.js
index e4b2dbe..cc1a564 100644
--- a/frameScript.js
+++ b/frameScript.js
@@ -21,54 +21,43 @@
uMatrix Home: https://github.com/gorhill/uMatrix
*/
-/******************************************************************************/
+'use strict';
-var locationChangeListener; // Keep alive while frameScript is alive
-
-(function() {
-
- 'use strict';
+Components.utils.import('chrome://ematrix/content/lib/FrameModule.jsm');
- /******************************************************************************/
-
- let {contentObserver, LocationChangeListener} = Components.utils.import(
- Components.stack.filename.replace('Script', 'Module'),
- null
- );
+var locationChangeListener; // Keep alive while frameScript is alive
- let injectContentScripts = function(win) {
- if ( !win || !win.document ) {
+(function () {
+ let injectContentScripts = function (win) {
+ if (!win || !win.document) {
return;
}
contentObserver.observe(win.document);
- if ( win.frames && win.frames.length ) {
- let i = win.frames.length;
- while ( i-- ) {
+ if (win.frames && win.frames.length) {
+ for (let i = win.frames.length; i>0; --i) {
injectContentScripts(win.frames[i]);
}
}
};
- let onLoadCompleted = function() {
+ let onLoadCompleted = function () {
removeMessageListener('ematrix-load-completed', onLoadCompleted);
injectContentScripts(content);
};
addMessageListener('ematrix-load-completed', onLoadCompleted);
- if ( docShell ) {
+ if (docShell) {
let Ci = Components.interfaces;
- let wp = docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebProgress);
+ let wp = docShell
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebProgress);
let dw = wp.DOMWindow;
- if ( dw === dw.top ) {
+
+ if (dw === dw.top) {
locationChangeListener = new LocationChangeListener(docShell);
}
- };
-
- /******************************************************************************/
-
+ }
})();
-
-/******************************************************************************/