1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-06-14 08:15:03 +12:00

Firefox: load content-scripts on extension start

This commit is contained in:
Deathamns 2015-03-12 18:20:48 +01:00 committed by gorhill
parent 9aaee014d4
commit 8c9382d4db

View file

@ -19,13 +19,43 @@
Home: https://github.com/gorhill/uBlock
*/
/******************************************************************************/
(function() {
'use strict';
/******************************************************************************/
Components.utils.import(
let {contentObserver} = Components.utils.import(
Components.stack.filename.replace('Script', 'Module'),
null
);
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-- ) {
injectContentScripts(win.frames[i]);
}
}
};
let onLoadCompleted = function() {
removeMessageListener('ublock-load-completed', onLoadCompleted);
injectContentScripts(content);
};
addMessageListener('ublock-load-completed', onLoadCompleted);
/******************************************************************************/
})();
/******************************************************************************/