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 = {
|
var contentObserver = {
|
||||||
classDescription: 'content-policy for ' + hostName,
|
classDescription: 'content-policy for ' + hostName,
|
||||||
classID: Components.ID('{7afbd130-cbaf-46c2-b944-f5d24305f484}'),
|
classID: Components.ID('{7afbd130-cbaf-46c2-b944-f5d24305f484}'),
|
||||||
|
@ -242,11 +259,9 @@ var contentObserver = {
|
||||||
wantXHRConstructor: false
|
wantXHRConstructor: false
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( Services.cpmm ) {
|
if ( getChildProcessMessageManager() ) {
|
||||||
sandbox.rpc = function(details) {
|
sandbox.rpc = function(details) {
|
||||||
var svc = Services;
|
var cpmm = getChildProcessMessageManager();
|
||||||
if ( svc === undefined ) { return; }
|
|
||||||
var cpmm = svc.cpmm;
|
|
||||||
if ( !cpmm ) { return; }
|
if ( !cpmm ) { return; }
|
||||||
var r = cpmm.sendSyncMessage(rpcEmitterName, details);
|
var r = cpmm.sendSyncMessage(rpcEmitterName, details);
|
||||||
if ( Array.isArray(r) ) {
|
if ( Array.isArray(r) ) {
|
||||||
|
|
|
@ -1712,16 +1712,24 @@ vAPI.rpcReceiver = (function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( Services.ppmm ) {
|
var ppmm = Services.ppmm;
|
||||||
Services.ppmm.addMessageListener(
|
if ( !ppmm ) {
|
||||||
|
ppmm = Cc['@mozilla.org/parentprocessmessagemanager;1'];
|
||||||
|
if ( ppmm ) {
|
||||||
|
ppmm = ppmm.getService(Ci.nsIMessageListenerManager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ppmm ) {
|
||||||
|
ppmm.addMessageListener(
|
||||||
childProcessMessageName,
|
childProcessMessageName,
|
||||||
onChildProcessMessage
|
onChildProcessMessage
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanupTasks.push(function() {
|
cleanupTasks.push(function() {
|
||||||
if ( Services.ppmm ) {
|
if ( ppmm ) {
|
||||||
Services.ppmm.removeMessageListener(
|
ppmm.removeMessageListener(
|
||||||
childProcessMessageName,
|
childProcessMessageName,
|
||||||
onChildProcessMessage
|
onChildProcessMessage
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue