Bug 827976: Part 2 - Remove unused getHiddenWindowAndJSContext function. r=bzbarsky
☠☠ backed out by a77f4a652627 ☠ ☠
authorVladan Djeric <vdjeric@mozilla.com>
Wed, 20 Feb 2013 00:15:36 -0500
changeset 122493 bb4938013af5d92e1f4229b3b91937a6fef76d0c
parent 122492 9bee7d808f97a08de30044dee9d4abbf0dab6a1a
child 122494 851342f5eafe34a1c782c0821f204741f1223650
push id24342
push userryanvm@gmail.com
push dateThu, 21 Feb 2013 13:05:06 +0000
treeherdermozilla-central@702d2814efbf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs827976
milestone22.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 827976: Part 2 - Remove unused getHiddenWindowAndJSContext function. r=bzbarsky
xpfe/appshell/public/nsIAppShellService.idl
xpfe/appshell/src/nsAppShellService.cpp
--- a/xpfe/appshell/public/nsIAppShellService.idl
+++ b/xpfe/appshell/public/nsIAppShellService.idl
@@ -11,17 +11,17 @@ interface nsIDOMWindow;
 interface nsIAppShell;
 
 [ptr] native JSContext(JSContext);
 
 %{C++
 struct JSContext;
 %}
 
-[scriptable, uuid(1ae1e51a-cd69-4c18-805e-ad09b39b1f4c)]
+[scriptable, uuid(1a15727f-ab2e-46cd-ac7f-39f12f30eef5)]
 interface nsIAppShellService : nsISupports
 {
   /**
    * Create a window, which will be initially invisible.
    * @param aParent the parent window.  Can be null.
    * @param aUrl the contents of the new window.
    * @param aChromeMask chrome flags affecting the kind of OS border
    *                    given to the window. see nsIBrowserWindow for
@@ -78,27 +78,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 nsIDOMWindow 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 nsIDOMWindow 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
--- a/xpfe/appshell/src/nsAppShellService.cpp
+++ b/xpfe/appshell/src/nsAppShellService.cpp
@@ -24,21 +24,16 @@
 
 #include "nsIEnumerator.h"
 #include "nsCRT.h"
 #include "prprf.h"    
 
 #include "nsWidgetsCID.h"
 #include "nsIRequestObserver.h"
 
-/* For implementing GetHiddenWindowAndJSContext */
-#include "nsIScriptGlobalObject.h"
-#include "nsIScriptContext.h"
-#include "jsapi.h"
-
 #include "nsAppShellService.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIPlatformCharset.h"
 #include "nsICharsetConverterManager.h"
 #include "nsIUnicodeDecoder.h"
 #include "nsIChromeRegistry.h"
 #include "nsILoadContext.h"
 #include "nsIWebNavigation.h"
@@ -516,64 +511,16 @@ nsAppShellService::GetHasHiddenPrivateWi
 {
   NS_ENSURE_ARG_POINTER(aHasPrivateWindow);
 
   *aHasPrivateWindow = !!mHiddenPrivateWindow;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsAppShellService::GetHiddenWindowAndJSContext(nsIDOMWindow **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;
-
-                // 2. Convert that to an nsIDOMWindow.
-                nsCOMPtr<nsIDOMWindow> hiddenDOMWindow(do_GetInterface(docShell));
-                if(!hiddenDOMWindow) break;
-
-                // 3. Get script global object for the window.
-                nsCOMPtr<nsIScriptGlobalObject> sgo;
-                sgo = do_QueryInterface( hiddenDOMWindow );
-                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)