mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-06 00:10:25 +00:00
Bug 782859 - Add e10s support the ContentHandler component [r=vingtetun]
This commit is contained in:
parent
4ad387b16d
commit
23ce62fbf6
@ -44,6 +44,11 @@ XPCOMUtils.defineLazyGetter(this, 'DebuggerServer', function() {
|
|||||||
return DebuggerServer;
|
return DebuggerServer;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||||
|
return Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||||
|
.getService(Ci.nsIFrameMessageManager);
|
||||||
|
});
|
||||||
|
|
||||||
function getContentWindow() {
|
function getContentWindow() {
|
||||||
return shell.contentBrowser.contentWindow;
|
return shell.contentBrowser.contentWindow;
|
||||||
}
|
}
|
||||||
@ -149,6 +154,8 @@ var shell = {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.contentBrowser.src = homeURL;
|
this.contentBrowser.src = homeURL;
|
||||||
|
|
||||||
|
ppmm.addMessageListener("content-handler", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
stop: function shell_stop() {
|
stop: function shell_stop() {
|
||||||
@ -159,6 +166,7 @@ var shell = {
|
|||||||
window.removeEventListener('mozfullscreenchange', this);
|
window.removeEventListener('mozfullscreenchange', this);
|
||||||
window.removeEventListener('sizemodechange', this);
|
window.removeEventListener('sizemodechange', this);
|
||||||
this.contentBrowser.removeEventListener('mozbrowserloadstart', this, true);
|
this.contentBrowser.removeEventListener('mozbrowserloadstart', this, true);
|
||||||
|
ppmm.removeMessageListener("content-handler", this);
|
||||||
|
|
||||||
#ifndef MOZ_WIDGET_GONK
|
#ifndef MOZ_WIDGET_GONK
|
||||||
delete Services.audioManager;
|
delete Services.audioManager;
|
||||||
@ -298,13 +306,29 @@ var shell = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
sendEvent: function shell_sendEvent(content, type, details) {
|
sendEvent: function shell_sendEvent(content, type, details) {
|
||||||
let event = content.document.createEvent('CustomEvent');
|
let event = content.document.createEvent('CustomEvent');
|
||||||
event.initCustomEvent(type, true, true, details ? details : {});
|
event.initCustomEvent(type, true, true, details ? details : {});
|
||||||
content.dispatchEvent(event);
|
content.dispatchEvent(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
sendChromeEvent: function shell_sendChromeEvent(details) {
|
sendChromeEvent: function shell_sendChromeEvent(details) {
|
||||||
this.sendEvent(getContentWindow(), "mozChromeEvent", details);
|
this.sendEvent(getContentWindow(), "mozChromeEvent", details);
|
||||||
|
},
|
||||||
|
|
||||||
|
receiveMessage: function shell_receiveMessage(message) {
|
||||||
|
if (message.name != 'content-handler') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let handler = message.json;
|
||||||
|
new MozActivity({
|
||||||
|
name: 'view',
|
||||||
|
data: {
|
||||||
|
type: handler.type,
|
||||||
|
url: handler.url
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -602,17 +626,6 @@ window.addEventListener('ContentStart', function ss_onContentStart() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Services.obs.addObserver(function ContentHandler(subject, topic, data) {
|
|
||||||
let handler = JSON.parse(data);
|
|
||||||
new MozActivity({
|
|
||||||
name: 'view',
|
|
||||||
data: {
|
|
||||||
type: handler.type,
|
|
||||||
url: handler.url
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 'content-handler', false);
|
|
||||||
|
|
||||||
(function geolocationStatusTracker() {
|
(function geolocationStatusTracker() {
|
||||||
let gGeolocationActiveCount = 0;
|
let gGeolocationActiveCount = 0;
|
||||||
|
|
||||||
|
@ -13,6 +13,10 @@ const PDF_CONTENT_TYPE = "application/pdf";
|
|||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyGetter(this, "cpmm", function() {
|
||||||
|
return Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
|
||||||
|
});
|
||||||
|
|
||||||
function log(aMsg) {
|
function log(aMsg) {
|
||||||
let msg = "ContentHandler.js: " + (aMsg.join ? aMsg.join("") : aMsg);
|
let msg = "ContentHandler.js: " + (aMsg.join ? aMsg.join("") : aMsg);
|
||||||
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService)
|
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService)
|
||||||
@ -36,7 +40,7 @@ ContentHandler.prototype = {
|
|||||||
"type": aMimetype,
|
"type": aMimetype,
|
||||||
"url": aRequest.URI.spec
|
"url": aRequest.URI.spec
|
||||||
};
|
};
|
||||||
Services.obs.notifyObservers(this, "content-handler", JSON.stringify(detail));
|
cpmm.sendAsyncMessage("content-handler", detail);
|
||||||
|
|
||||||
aRequest.cancel(Cr.NS_BINDING_ABORTED);
|
aRequest.cancel(Cr.NS_BINDING_ABORTED);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user