1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-07-01 12:30:23 +12:00

Firefox: partial vAPI.tabs implementation

This commit is contained in:
Deathamns 2014-12-02 08:35:25 +01:00 committed by gorhill
parent ae36081605
commit 94a47e7d4d

View file

@ -3,44 +3,45 @@
'use strict'; 'use strict';
var bgProcess;
Components.utils['import']('resource://gre/modules/Services.jsm'); Components.utils['import']('resource://gre/modules/Services.jsm');
var bgProcess;
function startup(data, reason) { function startup(data, reason) {
bgProcess = function(ev) { bgProcess = function(ev) {
if (ev) { if (ev) {
this.removeEventListener('load', bgProcess); this.removeEventListener('load', bgProcess);
} }
bgProcess = Services.appShell.hiddenDOMWindow.document; bgProcess = Services.appShell.hiddenDOMWindow.document;
bgProcess = bgProcess.documentElement.appendChild( bgProcess = bgProcess.documentElement.appendChild(
bgProcess.createElementNS('http://www.w3.org/1999/xhtml', 'iframe') bgProcess.createElementNS('http://www.w3.org/1999/xhtml', 'iframe')
); );
bgProcess.setAttribute('src', 'chrome://ublock/content/background.html'); bgProcess.setAttribute('src', 'chrome://ublock/content/background.html');
}; };
if (reason === APP_STARTUP) { if (reason === APP_STARTUP) {
Services.ww.registerNotification({ Services.ww.registerNotification({
observe: function(subject) { observe: function(subject) {
Services.ww.unregisterNotification(this); Services.ww.unregisterNotification(this);
subject.addEventListener('load', bgProcess); subject.addEventListener('load', bgProcess);
} }
}); });
} }
else { else {
bgProcess(); bgProcess();
} }
} }
function shutdown(data, reason) { function shutdown(data, reason) {
if (reason !== APP_SHUTDOWN) { if (reason !== APP_SHUTDOWN) {
bgProcess.parentNode.removeChild(bgProcess); bgProcess.parentNode.removeChild(bgProcess);
} }
} }
function install() { function install() {
// https://bugzil.la/719376 // https://bugzil.la/719376
Services.strings.flushBundles(); Services.strings.flushBundles();
} }
function uninstall() {} function uninstall() {}