1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-05 10:39:39 +02:00

Merge branch 'master' of github.com:gorhill/uBlock into fix-475

This commit is contained in:
gorhill 2015-01-21 12:25:12 -05:00
commit 4b2dced6f4

View File

@ -26,7 +26,7 @@
/******************************************************************************/ /******************************************************************************/
// Accessing the context of the background page from Console (e.g., about:addons): // Accessing the context of the background page:
// var win = Services.appShell.hiddenDOMWindow.document.querySelector('iframe[src*=ublock]').contentWindow; // var win = Services.appShell.hiddenDOMWindow.document.querySelector('iframe[src*=ublock]').contentWindow;
let bgProcess; let bgProcess;
@ -46,17 +46,17 @@ const restartListener = {
/******************************************************************************/ /******************************************************************************/
function startup(data, reason) { function startup(data, reason) {
let appShell = Components.classes['@mozilla.org/appshell/appShellService;1']
.getService(Components.interfaces.nsIAppShellService);
let onReady = function(e) { let onReady = function(e) {
if ( e ) { if ( e ) {
this.removeEventListener(e.type, onReady); this.removeEventListener(e.type, onReady);
} }
let hDoc = Components.classes['@mozilla.org/appshell/appShellService;1'] let hiddenDoc = appShell.hiddenDOMWindow.document;
.getService(Components.interfaces.nsIAppShellService) bgProcess = hiddenDoc.documentElement.appendChild(
.hiddenDOMWindow.document; hiddenDoc.createElementNS('http://www.w3.org/1999/xhtml', 'iframe')
bgProcess = hDoc.documentElement.appendChild(
hDoc.createElementNS('http://www.w3.org/1999/xhtml', 'iframe')
); );
bgProcess.setAttribute( bgProcess.setAttribute(
'src', 'src',
@ -78,7 +78,17 @@ function startup(data, reason) {
.getService(Components.interfaces.nsIWindowWatcher); .getService(Components.interfaces.nsIWindowWatcher);
ww.registerNotification({ ww.registerNotification({
observe: function(win) { observe: function(win, topic) {
if ( topic !== 'domwindowopened' ) {
return;
}
try {
appShell.hiddenDOMWindow;
} catch (ex) {
return;
}
ww.unregisterNotification(this); ww.unregisterNotification(this);
win.addEventListener('DOMContentLoaded', onReady); win.addEventListener('DOMContentLoaded', onReady);
} }
@ -108,7 +118,8 @@ function shutdown(data, reason) {
function install() { function install() {
// https://bugzil.la/719376 // https://bugzil.la/719376
Components.classes['@mozilla.org/intl/stringbundle;1'] Components.classes['@mozilla.org/intl/stringbundle;1']
.getService(Components.interfaces.nsIStringBundleService).flushBundles(); .getService(Components.interfaces.nsIStringBundleService)
.flushBundles();
} }
/******************************************************************************/ /******************************************************************************/