Bug 1276304 - Remove unused getHiddenWindowAndJSContext function. r=bzbarsky
authorVladan Djeric <vdjeric@mozilla.com>
Wed, 20 Feb 2013 00:15:36 -0500
changeset 340383 826c880607a1e78790b3028383a20f429aa85be9
parent 340382 fcedd1b3ef255d38681ab5e2745e45eaea926fb6
child 340384 322c9a78bd3a9f2b1ed0216b5ba437951d3f2504
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1276304
milestone49.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 1276304 - Remove unused getHiddenWindowAndJSContext function. r=bzbarsky
xpfe/appshell/nsAppShellService.cpp
xpfe/appshell/nsIAppShellService.idl
--- a/xpfe/appshell/nsAppShellService.cpp
+++ b/xpfe/appshell/nsAppShellService.cpp
@@ -24,20 +24,16 @@
 #include "prprf.h"
 
 #include "nsWidgetInitData.h"
 #include "nsWidgetsCID.h"
 #include "nsIWidget.h"
 #include "nsIRequestObserver.h"
 #include "nsIEmbeddingSiteWindow.h"
 
-/* For implementing GetHiddenWindowAndJSContext */
-#include "nsIScriptGlobalObject.h"
-#include "nsIScriptContext.h"
-
 #include "nsAppShellService.h"
 #include "nsContentUtils.h"
 #include "nsThreadUtils.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIChromeRegistry.h"
 #include "nsILoadContext.h"
 #include "nsIWebNavigation.h"
 #include "nsIWindowlessBrowser.h"
@@ -853,66 +849,16 @@ nsAppShellService::GetHasHiddenPrivateWi
 {
   NS_ENSURE_ARG_POINTER(aHasPrivateWindow);
 
   *aHasPrivateWindow = !!mHiddenPrivateWindow;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsAppShellService::GetHiddenWindowAndJSContext(mozIDOMWindowProxy **aWindow,
-                                               JSContext    **aJSContext)
-{
-    nsresult rv = NS_OK;
-    if ( aWindow && aJSContext ) {
-        *aWindow    = nullptr;
-        *aJSContext = nullptr;
-
-        if ( mHiddenWindow ) {
-            // Convert hidden window to nsIDOMWindow and extract its JSContext.
-            do {
-                // 1. Get doc for hidden window.
-                nsCOMPtr<nsIDocShell> docShell;
-                rv = mHiddenWindow->GetDocShell(getter_AddRefs(docShell));
-                if (NS_FAILED(rv)) break;
-                if (!docShell) {
-                  break;
-                }
-
-                // 2. Convert that to an nsPIDOMWindowOuter.
-                nsCOMPtr<nsPIDOMWindowOuter> hiddenDOMWindow(docShell->GetWindow());
-                if(!hiddenDOMWindow) break;
-
-                // 3. Get script global object for the window.
-                nsCOMPtr<nsIScriptGlobalObject> sgo = docShell->GetScriptGlobalObject();
-                if (!sgo) { rv = NS_ERROR_FAILURE; break; }
-
-                // 4. Get script context from that.
-                nsIScriptContext *scriptContext = sgo->GetContext();
-                if (!scriptContext) { rv = NS_ERROR_FAILURE; break; }
-
-                // 5. Get JSContext from the script context.
-                JSContext *jsContext = scriptContext->GetNativeContext();
-                if (!jsContext) { rv = NS_ERROR_FAILURE; break; }
-
-                // Now, give results to caller.
-                *aWindow    = hiddenDOMWindow.get();
-                NS_IF_ADDREF( *aWindow );
-                *aJSContext = jsContext;
-            } while (0);
-        } else {
-            rv = NS_ERROR_FAILURE;
-        }
-    } else {
-        rv = NS_ERROR_NULL_POINTER;
-    }
-    return rv;
-}
-
-NS_IMETHODIMP
 nsAppShellService::GetApplicationProvidedHiddenWindow(bool* aAPHW)
 {
     *aAPHW = mApplicationProvidedHiddenWindow;
     return NS_OK;
 }
 
 /*
  * Register a new top level window (created elsewhere)
--- a/xpfe/appshell/nsIAppShellService.idl
+++ b/xpfe/appshell/nsIAppShellService.idl
@@ -100,27 +100,16 @@ interface nsIAppShellService : nsISuppor
    * created and maintained by this AppShellService.  This window is created
    * in private browsing mode.
    * @param aResult the hidden private window.  Do not unhide hidden window.
    *                Do not taunt hidden window.
    */
   readonly attribute mozIDOMWindowProxy hiddenPrivateDOMWindow;
 
   /**
-   * Return the (singleton) application hidden window as an nsIDOMWindow,
-   * and, the corresponding JavaScript context pointer.  This is useful
-   * if you'd like to subsequently call OpenDialog on the hidden window.
-   * @aHiddenDOMWindow the hidden window QI'd to type nsIDOMWindow
-   * @aJSContext       the corresponding JavaScript context
-   */
-  [noscript]
-  void getHiddenWindowAndJSContext(out mozIDOMWindowProxy aHiddenDOMWindow,
-                                   out JSContext aJSContext);
-
-  /**
    * Return true if the application hidden window was provided by the
    * application. If it wasn't, the default hidden window was used. This will
    * usually be false on all non-mac platforms.
    */
   readonly attribute boolean applicationProvidedHiddenWindow;
 
   /**
    * Add a window to the application's registry of windows.  These windows