From 43e6a7599d3e8a86618ef65487ffac9fad646d6b Mon Sep 17 00:00:00 2001 From: gorhill Date: Sun, 2 Apr 2017 16:23:13 -0400 Subject: [PATCH] fix #2506 --- platform/firefox/bootstrap.js | 16 +++++++++------- platform/firefox/install.rdf | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/platform/firefox/bootstrap.js b/platform/firefox/bootstrap.js index 7e2dddc9b..f6f85e814 100644 --- a/platform/firefox/bootstrap.js +++ b/platform/firefox/bootstrap.js @@ -1,7 +1,7 @@ /******************************************************************************* - µBlock - a browser extension to block requests. - Copyright (C) 2014 The µBlock authors + uBlock Origin - a browser extension to block requests. + Copyright (C) 2014-2017 The uBlock Origin authors This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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: // var win = Services.appShell.hiddenDOMWindow.document.querySelector('iframe[src*=ublock0]').contentWindow; @@ -85,7 +85,7 @@ function getWindowlessBrowserFrame(appShell) { windowlessBrowser = appShell.createWindowlessBrowser(true); windowlessBrowser.QueryInterface(Ci.nsIInterfaceRequestor); 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 = { QueryInterface: XPCOMUtils.generateQI([ Ci.nsIWebProgressListener, @@ -133,7 +133,8 @@ function waitForHiddenWindow() { // window for the actual background page (windowless browsers are // also what the webextension implementation in Firefox uses for // 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); } else { createBgProcess(hiddenDoc); @@ -242,8 +243,9 @@ function uninstall(aData, aReason) { // To cleanup vAPI.localStorage in vapi-common.js // As I get more familiar with FF API, will find out whetehr there was // a better way to do this. - Components.utils.import('resource://gre/modules/Services.jsm', null) - .Services.prefs.getBranch('extensions.' + hostName + '.').deleteBranch(''); + Cu.import('resource://gre/modules/Services.jsm', null) + .Services.prefs.getBranch('extensions.' + hostName + '.') + .deleteBranch(''); } /******************************************************************************/ diff --git a/platform/firefox/install.rdf b/platform/firefox/install.rdf index dcca93b82..8ead14129 100644 --- a/platform/firefox/install.rdf +++ b/platform/firefox/install.rdf @@ -20,7 +20,7 @@ {{ec8030f7-c20a-464f-9b0e-13a3a9e97384}} - 27.0 + 24.0 *