2014-11-24 20:00:27 +01:00
|
|
|
/* global Services, APP_STARTUP, APP_SHUTDOWN */
|
|
|
|
/* exported startup, shutdown, install, uninstall */
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
Components.utils['import']('resource://gre/modules/Services.jsm');
|
|
|
|
|
2014-12-02 08:35:25 +01:00
|
|
|
var bgProcess;
|
|
|
|
|
2014-11-24 20:00:27 +01:00
|
|
|
function startup(data, reason) {
|
2014-12-02 08:35:25 +01:00
|
|
|
bgProcess = function(ev) {
|
|
|
|
if (ev) {
|
|
|
|
this.removeEventListener('load', bgProcess);
|
|
|
|
}
|
|
|
|
|
|
|
|
bgProcess = Services.appShell.hiddenDOMWindow.document;
|
|
|
|
bgProcess = bgProcess.documentElement.appendChild(
|
|
|
|
bgProcess.createElementNS('http://www.w3.org/1999/xhtml', 'iframe')
|
|
|
|
);
|
|
|
|
bgProcess.setAttribute('src', 'chrome://ublock/content/background.html');
|
|
|
|
};
|
|
|
|
|
|
|
|
if (reason === APP_STARTUP) {
|
|
|
|
Services.ww.registerNotification({
|
|
|
|
observe: function(subject) {
|
|
|
|
Services.ww.unregisterNotification(this);
|
|
|
|
subject.addEventListener('load', bgProcess);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
bgProcess();
|
|
|
|
}
|
2014-11-24 20:00:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function shutdown(data, reason) {
|
2014-12-02 08:35:25 +01:00
|
|
|
if (reason !== APP_SHUTDOWN) {
|
|
|
|
bgProcess.parentNode.removeChild(bgProcess);
|
|
|
|
}
|
2014-11-24 20:00:27 +01:00
|
|
|
}
|
|
|
|
|
2014-12-16 13:44:34 +01:00
|
|
|
// https://bugzil.la/719376
|
|
|
|
function install() Services.strings.flushBundles();
|
2014-11-24 20:00:27 +01:00
|
|
|
|
2014-12-16 13:44:34 +01:00
|
|
|
function uninstall() {}
|