mirror of https://github.com/gorhill/uBlock.git
this fixes #940
This commit is contained in:
parent
fd0c09f434
commit
b9475507c8
|
@ -63,6 +63,23 @@ const getMessageManager = function(win) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
const getChildProcessMessageManager = function() {
|
||||
var svc = Services;
|
||||
if ( !svc ) {
|
||||
return;
|
||||
}
|
||||
var cpmm = svc.cpmm;
|
||||
if ( cpmm ) {
|
||||
return cpmm;
|
||||
}
|
||||
cpmm = Components.classes['@mozilla.org/childprocessmessagemanager;1'];
|
||||
if ( cpmm ) {
|
||||
return cpmm.getService(Ci.nsISyncMessageSender);
|
||||
}
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
var contentObserver = {
|
||||
classDescription: 'content-policy for ' + hostName,
|
||||
classID: Components.ID('{7afbd130-cbaf-46c2-b944-f5d24305f484}'),
|
||||
|
@ -242,11 +259,9 @@ var contentObserver = {
|
|||
wantXHRConstructor: false
|
||||
});
|
||||
|
||||
if ( Services.cpmm ) {
|
||||
if ( getChildProcessMessageManager() ) {
|
||||
sandbox.rpc = function(details) {
|
||||
var svc = Services;
|
||||
if ( svc === undefined ) { return; }
|
||||
var cpmm = svc.cpmm;
|
||||
var cpmm = getChildProcessMessageManager();
|
||||
if ( !cpmm ) { return; }
|
||||
var r = cpmm.sendSyncMessage(rpcEmitterName, details);
|
||||
if ( Array.isArray(r) ) {
|
||||
|
|
|
@ -1712,16 +1712,24 @@ vAPI.rpcReceiver = (function() {
|
|||
}
|
||||
};
|
||||
|
||||
if ( Services.ppmm ) {
|
||||
Services.ppmm.addMessageListener(
|
||||
var ppmm = Services.ppmm;
|
||||
if ( !ppmm ) {
|
||||
ppmm = Cc['@mozilla.org/parentprocessmessagemanager;1'];
|
||||
if ( ppmm ) {
|
||||
ppmm = ppmm.getService(Ci.nsIMessageListenerManager);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ppmm ) {
|
||||
ppmm.addMessageListener(
|
||||
childProcessMessageName,
|
||||
onChildProcessMessage
|
||||
);
|
||||
}
|
||||
|
||||
cleanupTasks.push(function() {
|
||||
if ( Services.ppmm ) {
|
||||
Services.ppmm.removeMessageListener(
|
||||
if ( ppmm ) {
|
||||
ppmm.removeMessageListener(
|
||||
childProcessMessageName,
|
||||
onChildProcessMessage
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue