mirror of https://github.com/gorhill/uBlock.git
Firefox: better way to get the messageManager
This commit is contained in:
parent
5c2af95c73
commit
7ade0ec7e8
|
@ -28,12 +28,7 @@
|
||||||
this.EXPORTED_SYMBOLS = ['contentPolicy', 'docObserver'];
|
this.EXPORTED_SYMBOLS = ['contentPolicy', 'docObserver'];
|
||||||
|
|
||||||
const {interfaces: Ci, utils: Cu} = Components;
|
const {interfaces: Ci, utils: Cu} = Components;
|
||||||
|
const appName = __URI__.match(/:\/\/([^\/]+)/)[1];
|
||||||
let appName;
|
|
||||||
|
|
||||||
try { throw new Error; } catch (ex) {
|
|
||||||
appName = ex.fileName.match(/:\/\/([^\/]+)/)[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
Cu['import']('resource://gre/modules/Services.jsm');
|
Cu['import']('resource://gre/modules/Services.jsm');
|
||||||
Cu['import']('resource://gre/modules/XPCOMUtils.jsm');
|
Cu['import']('resource://gre/modules/XPCOMUtils.jsm');
|
||||||
|
@ -41,25 +36,11 @@ Cu['import']('resource://gre/modules/XPCOMUtils.jsm');
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
let getMessager = function(win) {
|
const getMessager = win =>
|
||||||
try {
|
win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDocShell)
|
||||||
// e10s
|
.sameTypeRootTreeItem.QueryInterface(Ci.nsIDocShell)
|
||||||
return win
|
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
|
||||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
|
||||||
.rootTreeItem
|
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIContentFrameMessageManager);
|
.getInterface(Ci.nsIContentFrameMessageManager);
|
||||||
} catch (ex) {
|
|
||||||
return win
|
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
|
||||||
.QueryInterface(Ci.nsIDocShell)
|
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
|
||||||
.getInterface(Ci.nsIContentFrameMessageManager);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue