Bug 584401 - Prompts are not accessible to child process C++ (2/2) [r=mfinkle]
--- a/mobile/chrome/content/bindings/browser.js
+++ b/mobile/chrome/content/bindings/browser.js
@@ -354,75 +354,8 @@ let ContentScroll = {
content.scrollBy(json.dx, json.dy);
break;
}
}
};
ContentScroll.init();
-
-function PromptRemoter() {
- addEventListener("DOMWindowCreated", this, false);
-}
-
-PromptRemoter.prototype = {
- handleEvent: function handleEvent(aEvent) {
- var window = aEvent.originalTarget.defaultView.content;
- // Need to make sure we are called on what we care about -
- // content windows. DOMWindowCreated is called on *all* HTMLDocuments,
- // some of which belong to ChromeWindows or lack defaultView.content
- // altogether.
- //
- // Note about the syntax used here: |"wrappedJSObject" in window|
- // will silently fail, without even letting us catch it as an
- // exception, and checking in the way that we do check in some
- // cases still throws an exception; see bug 582108 about both.
- try {
- if (!window || !window.wrappedJSObject) {
- return;
- }
- }
- catch(e) {
- return;
- }
-
- function bringTabToFront() {
- let event = window.document.createEvent("Events");
- event.initEvent("DOMWillOpenModalDialog", true, false);
- window.dispatchEvent(event);
- }
-
- function informClosedFrontTab() {
- let event = window.document.createEvent("Events");
- event.initEvent("DOMModalDialogClosed", true, false);
- window.dispatchEvent(event);
- }
-
- window.wrappedJSObject.alert = function(aMessage) {
- bringTabToFront();
- sendSyncMessage("Prompt:Alert", {
- message: aMessage
- });
- informClosedFrontTab();
- }
-
- window.wrappedJSObject.confirm = function(aMessage) {
- bringTabToFront();
- return sendSyncMessage("Prompt:Confirm", {
- message: aMessage
- });
- informClosedFrontTab();
- }
-
- window.wrappedJSObject.prompt = function(aText, aValue) {
- bringTabToFront();
- return sendSyncMessage("Prompt:Prompt", {
- text: aText,
- value: aValue
- });
- informClosedFrontTab();
- }
- },
-};
-
-new PromptRemoter();
-
--- a/mobile/chrome/content/bindings/browser.xml
+++ b/mobile/chrome/content/bindings/browser.xml
@@ -140,26 +140,16 @@
this.mIconURL = iconURI.spec;
}
break;
case "search":
this._searchEngines.push({ title: link.title, href: link.href });
break;
}
break;
-
- case "Prompt:Alert":
- alert(aMessage.json.message);
- break;
-
- case "Prompt:Confirm":
- return confirm(aMessage.json.message);
-
- case "Prompt:Prompt":
- return prompt(aMessage.json.text, aMessage.json.value);
}
]]></body>
</method>
<method name="_getLinkType">
<parameter name="aLink" />
<body><![CDATA[
let type = "";
@@ -389,21 +379,16 @@
this.messageManager.addMessageListener("DOMTitleChanged", this);
this.messageManager.addMessageListener("DOMLinkAdded", this);
// Listen for first load for lazy attachment to form fill controller
this.messageManager.addMessageListener("pageshow", this);
this.messageManager.addMessageListener("pagehide", this);
this.messageManager.addMessageListener("DOMPopupBlocked", this);
- // Prompt remoting
- ["Alert", "Confirm", "Prompt"].forEach(function(name) {
- this.messageManager.addMessageListener("Prompt:" + name, this);
- }, this);
-
this._webProgress._init();
]]>
</constructor>
</implementation>
</binding>