mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 04:27:37 +00:00
Bug 827976: Part 2 - Remove unused getHiddenWindowAndJSContext function. r=bzbarsky
This commit is contained in:
parent
43c9555e8c
commit
f1f987bc4a
@ -16,7 +16,7 @@ interface nsIAppShell;
|
||||
struct JSContext;
|
||||
%}
|
||||
|
||||
[scriptable, uuid(1ae1e51a-cd69-4c18-805e-ad09b39b1f4c)]
|
||||
[scriptable, uuid(1a15727f-ab2e-46cd-ac7f-39f12f30eef5)]
|
||||
interface nsIAppShellService : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -82,17 +82,6 @@ interface nsIAppShellService : nsISupports
|
||||
*/
|
||||
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
|
||||
|
@ -29,11 +29,6 @@
|
||||
#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"
|
||||
@ -520,54 +515,6 @@ nsAppShellService::GetHasHiddenPrivateWindow(bool* aHasPrivateWindow)
|
||||
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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user