gorhill 8 years ago
parent
commit
12a6978748
  1. 24
      platform/firefox/bootstrap.js
  2. 2
      platform/firefox/install.rdf

24
platform/firefox/bootstrap.js

@ -26,7 +26,7 @@
/******************************************************************************/ /******************************************************************************/
const {classes: Cc, interfaces: Ci} = Components;
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
// Accessing the context of the background page: // Accessing the context of the background page:
// var win = Services.appShell.hiddenDOMWindow.document.querySelector('iframe[src*=umatrix]').contentWindow; // var win = Services.appShell.hiddenDOMWindow.document.querySelector('iframe[src*=umatrix]').contentWindow;
@ -38,8 +38,8 @@ let version;
const hostName = 'umatrix'; const hostName = 'umatrix';
const restartListener = { const restartListener = {
get messageManager() { get messageManager() {
return Components.classes['@mozilla.org/parentprocessmessagemanager;1']
.getService(Components.interfaces.nsIMessageListenerManager);
return Cc['@mozilla.org/parentprocessmessagemanager;1']
.getService(Ci.nsIMessageListenerManager);
}, },
receiveMessage: function() { receiveMessage: function() {
@ -89,7 +89,7 @@ function getWindowlessBrowserFrame(appShell) {
windowlessBrowser = appShell.createWindowlessBrowser(true); windowlessBrowser = appShell.createWindowlessBrowser(true);
windowlessBrowser.QueryInterface(Ci.nsIInterfaceRequestor); windowlessBrowser.QueryInterface(Ci.nsIInterfaceRequestor);
let webProgress = windowlessBrowser.getInterface(Ci.nsIWebProgress); let webProgress = windowlessBrowser.getInterface(Ci.nsIWebProgress);
let XPCOMUtils = Components.utils.import('resource://gre/modules/XPCOMUtils.jsm', null).XPCOMUtils;
let XPCOMUtils = Cu.import('resource://gre/modules/XPCOMUtils.jsm', null).XPCOMUtils;
windowlessBrowserPL = { windowlessBrowserPL = {
QueryInterface: XPCOMUtils.generateQI([ QueryInterface: XPCOMUtils.generateQI([
Ci.nsIWebProgressListener, Ci.nsIWebProgressListener,
@ -140,7 +140,8 @@ function waitForHiddenWindow() {
// window for the actual background page (windowless browsers are // window for the actual background page (windowless browsers are
// also what the webextension implementation in Firefox uses for // also what the webextension implementation in Firefox uses for
// background pages). // background pages).
if ( appShell.createWindowlessBrowser ) {
let { Services } = Cu.import('resource://gre/modules/Services.jsm', null);
if ( Services.vc.compare(Services.appinfo.platformVersion, '27') >= 0 ) {
getWindowlessBrowserFrame(appShell); getWindowlessBrowserFrame(appShell);
} else { } else {
createBgProcess(hiddenDoc); createBgProcess(hiddenDoc);
@ -158,8 +159,8 @@ function waitForHiddenWindow() {
return; return;
} }
let ww = Components.classes['@mozilla.org/embedcomp/window-watcher;1']
.getService(Components.interfaces.nsIWindowWatcher);
let ww = Cc['@mozilla.org/embedcomp/window-watcher;1']
.getService(Ci.nsIWindowWatcher);
ww.registerNotification({ ww.registerNotification({
observe: function(win, topic) { observe: function(win, topic) {
@ -213,8 +214,8 @@ function shutdown(data, reason) {
function install() { function install() {
// https://bugzil.la/719376 // https://bugzil.la/719376
Components.classes['@mozilla.org/intl/stringbundle;1']
.getService(Components.interfaces.nsIStringBundleService)
Cc['@mozilla.org/intl/stringbundle;1']
.getService(Ci.nsIStringBundleService)
.flushBundles(); .flushBundles();
} }
@ -226,9 +227,8 @@ function uninstall(data, aReason) {
} }
// To cleanup vAPI.localStorage in vapi-common.js, aka // To cleanup vAPI.localStorage in vapi-common.js, aka
// "extensions.umatrix.*" in `about:config`. // "extensions.umatrix.*" in `about:config`.
Components.utils.import('resource://gre/modules/Services.jsm', null)
.Services.prefs
.getBranch('extensions.' + hostName + '.')
Cu.import('resource://gre/modules/Services.jsm', null)
.Services.prefs.getBranch('extensions.' + hostName + '.')
.deleteBranch(''); .deleteBranch('');
} }

2
platform/firefox/install.rdf

@ -19,7 +19,7 @@
<targetApplication> <targetApplication>
<r:Description> <r:Description>
<id>{{ec8030f7-c20a-464f-9b0e-13a3a9e97384}}</id> <id>{{ec8030f7-c20a-464f-9b0e-13a3a9e97384}}</id>
<minVersion>27.0</minVersion>
<minVersion>24.0</minVersion>
<maxVersion>*</maxVersion> <maxVersion>*</maxVersion>
</r:Description> </r:Description>
</targetApplication> </targetApplication>

Loading…
Cancel
Save