Bug 1045646 - Part 3: Replace AutoPushJSContext in nsHTTPIndex::OnFTPControlLog. r=bholley

This commit is contained in:
Bob Owen
2014-08-01 09:11:55 +01:00
parent 6634f51c75
commit 2ec6bc4439
2 changed files with 9 additions and 7 deletions

View File

@@ -44,6 +44,7 @@
#include "nsRect.h"
#include "prenv.h"
#include "nsIDOMWindow.h"
#include "nsIGlobalObject.h"
#include "nsIWebBrowserChrome.h"
#include "nsPoint.h"
#include "nsIObserverService.h"
@@ -1008,6 +1009,7 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink)
*aSink = mContentListener;
}
else if ((aIID.Equals(NS_GET_IID(nsIScriptGlobalObject)) ||
aIID.Equals(NS_GET_IID(nsIGlobalObject)) ||
aIID.Equals(NS_GET_IID(nsPIDOMWindow)) ||
aIID.Equals(NS_GET_IID(nsIDOMWindow)) ||
aIID.Equals(NS_GET_IID(nsIDOMWindowInternal))) &&

View File

@@ -50,6 +50,7 @@
#include "nsXPCOMCID.h"
#include "nsIDocument.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/ScriptSettings.h"
#include "nsCxPusher.h"
using namespace mozilla;
@@ -150,14 +151,13 @@ nsHTTPIndex::OnFTPControlLog(bool server, const char *msg)
{
NS_ENSURE_TRUE(mRequestor, NS_OK);
nsCOMPtr<nsIScriptGlobalObject> scriptGlobal(do_GetInterface(mRequestor));
NS_ENSURE_TRUE(scriptGlobal, NS_OK);
nsCOMPtr<nsIGlobalObject> globalObject = do_GetInterface(mRequestor);
NS_ENSURE_TRUE(globalObject, NS_OK);
nsIScriptContext *context = scriptGlobal->GetContext();
NS_ENSURE_TRUE(context, NS_OK);
AutoPushJSContext cx(context->GetNativeContext());
NS_ENSURE_TRUE(cx, NS_OK);
// We're going to run script via JS_CallFunctionName, so we need an
// AutoEntryScript. This is Gecko specific and not in any spec.
dom::AutoEntryScript aes(globalObject);
JSContext* cx = aes.cx();
JS::Rooted<JSObject*> global(cx, JS::CurrentGlobalOrNull(cx));
NS_ENSURE_TRUE(global, NS_OK);