Bug 584401 - Prompts are not accessible to child process C++ (2/2) [r=mfinkle]
authorAlon Zakai <azakai>
Fri, 03 Sep 2010 12:18:00 -0700
changeset 66538 0ab66681dd65554ebc652b0067c20b8fdb70d0f8
parent 66537 7fc8c723f6f72063f858333d6b44fc1a966a8fd4
child 66539 d6712406d5fbf7ec393a53313cd313f76c5668f2
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs584401
Bug 584401 - Prompts are not accessible to child process C++ (2/2) [r=mfinkle]
mobile/chrome/content/bindings/browser.js
mobile/chrome/content/bindings/browser.xml
--- 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>