Bug 861495 - Transplant getOuterWindowWithId from nsIDOMWindowUtils to a window-related service: WebConsoleUtils.jsm; r=msucan
authorColby Russell <Sevenspade@gmail.com>
Wed, 08 May 2013 15:05:51 +0300
changeset 142213 55b00015a6605e3274057bc9ce4f8c6c5c33cdb8
parent 142212 db7759b0338925354e5c112c33e6a75f96d15d99
child 142214 1c05e7a9e51ccd5ad1748a538c45673e478a425c
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmsucan
bugs861495
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 861495 - Transplant getOuterWindowWithId from nsIDOMWindowUtils to a window-related service: WebConsoleUtils.jsm; r=msucan
toolkit/devtools/webconsole/WebConsoleUtils.jsm
--- a/toolkit/devtools/webconsole/WebConsoleUtils.jsm
+++ b/toolkit/devtools/webconsole/WebConsoleUtils.jsm
@@ -153,41 +153,16 @@ this.WebConsoleUtils = {
    */
   getOuterWindowId: function WCU_getOuterWindowId(aWindow)
   {
     return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
            getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
   },
 
   /**
-   * Gets the window that has the given outer ID.
-   *
-   * @param integer aOuterId
-   * @param nsIDOMWindow [aHintWindow]
-   *        Optional, the window object used to QueryInterface to
-   *        nsIDOMWindowUtils. If this is not given,
-   *        Services.wm.getMostRecentWindow() is used.
-   * @return nsIDOMWindow|null
-   *         The window object with the given outer ID.
-   */
-  getWindowByOuterId: function WCU_getWindowByOuterId(aOuterId, aHintWindow)
-  {
-    let someWindow = aHintWindow || Services.wm.getMostRecentWindow(null);
-    let content = null;
-
-    if (someWindow) {
-      let windowUtils = someWindow.QueryInterface(Ci.nsIInterfaceRequestor).
-                                   getInterface(Ci.nsIDOMWindowUtils);
-      content = windowUtils.getOuterWindowWithId(aOuterId);
-    }
-
-    return content;
-  },
-
-  /**
    * Abbreviates the given source URL so that it can be displayed flush-right
    * without being too distracting.
    *
    * @param string aSourceURL
    *        The source URL to shorten.
    * @return string
    *         The abbreviated form of the source URL.
    */
@@ -1326,18 +1301,17 @@ PageErrorListener.prototype =
 
     if (this.window) {
       if (!aScriptError.outerWindowID ||
           !this.isCategoryAllowed(aScriptError.category)) {
         return;
       }
 
       let errorWindow =
-        WebConsoleUtils.getWindowByOuterId(aScriptError.outerWindowID,
-                                           this.window);
+        Services.wm.getOuterWindowWithId(aScriptError.outerWindowID);
       if (!errorWindow || errorWindow.top != this.window) {
         return;
       }
     }
 
     this.listener.onPageError(aScriptError);
   },
 
@@ -1466,18 +1440,17 @@ ConsoleAPIListener.prototype =
   observe: function CAL_observe(aMessage, aTopic)
   {
     if (!this.owner) {
       return;
     }
 
     let apiMessage = aMessage.wrappedJSObject;
     if (this.window) {
-      let msgWindow = WebConsoleUtils.getWindowByOuterId(apiMessage.ID,
-                                                         this.window);
+      let msgWindow = Services.wm.getOuterWindowWithId(apiMessage.ID);
       if (!msgWindow || msgWindow.top != this.window) {
         // Not the same window!
         return;
       }
     }
 
     this.owner.onConsoleAPICall(apiMessage);
   },