Bug 649603 - Make nsIScriptContext::GetNativeContext return JSContext; r=jst

This commit is contained in:
Ms2ger 2011-09-18 11:22:17 +02:00
parent 2400305c37
commit 09c97f4a38
36 changed files with 67 additions and 83 deletions

View File

@ -320,12 +320,12 @@ static JSFunctionSpec PrivilegeManager_static_methods[] = {
/*
* "Steal" calls to netscape.security.PrivilegeManager.enablePrivilege,
* et. al. so that code that worked with 4.0 can still work.
* et al. so that code that worked with 4.0 can still work.
*/
NS_IMETHODIMP
nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext)
{
JSContext *cx = (JSContext *) aScriptContext->GetNativeContext();
JSContext* cx = aScriptContext->GetNativeContext();
JSObject *global = JS_GetGlobalObject(cx);
OBJ_TO_INNER_OBJECT(cx, global);

View File

@ -1,7 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set ts=2 sw=2 et tw=78:
*
* ***** BEGIN LICENSE BLOCK *****
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 sw=2 et tw=78: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
@ -1286,11 +1285,10 @@ nsContentUtils::GetContextFromDocument(nsIDocument *aDocument)
nsIScriptContext *scx = sgo->GetContext();
if (!scx) {
// No context left in the scope...
return nsnull;
}
return (JSContext *)scx->GetNativeContext();
return scx->GetNativeContext();
}
// static
@ -2559,7 +2557,7 @@ nsCxPusher::Push(nsIDOMEventTarget *aCurrentTarget)
JSContext* cx = nsnull;
if (scx) {
cx = static_cast<JSContext*>(scx->GetNativeContext());
cx = scx->GetNativeContext();
// Bad, no JSContext from script context!
NS_ENSURE_TRUE(cx, PR_FALSE);
}

View File

@ -3813,7 +3813,7 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
if (obj) {
JSObject *newScope = aScriptGlobalObject->GetGlobalJSObject();
nsIScriptContext *scx = aScriptGlobalObject->GetContext();
JSContext *cx = scx ? (JSContext *)scx->GetNativeContext() : nsnull;
JSContext *cx = scx ? scx->GetNativeContext() : nsnull;
if (!cx) {
nsContentUtils::ThreadJSContextStack()->Peek(&cx);
if (!cx) {
@ -6423,7 +6423,7 @@ nsDocument::IsScriptEnabled()
nsIScriptContext *scriptContext = globalObject->GetContext();
NS_ENSURE_TRUE(scriptContext, PR_FALSE);
JSContext* cx = (JSContext *) scriptContext->GetNativeContext();
JSContext* cx = scriptContext->GetNativeContext();
NS_ENSURE_TRUE(cx, PR_FALSE);
PRBool enabled;

View File

@ -1350,7 +1350,7 @@ nsEventSource::DispatchAllMessageEvents()
nsIScriptContext* scriptContext = sgo->GetContext();
NS_ENSURE_TRUE(scriptContext,);
JSContext* cx = (JSContext*)scriptContext->GetNativeContext();
JSContext* cx = scriptContext->GetNativeContext();
NS_ENSURE_TRUE(cx,);
while (mMessagesToDispatch.GetSize() > 0) {

View File

@ -2070,7 +2070,7 @@ nsFrameLoader::EnsureMessageManager()
nsIScriptContext* sctx = mOwnerContent->GetContextForEventHandlers(&rv);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(sctx);
JSContext* cx = static_cast<JSContext*>(sctx->GetNativeContext());
JSContext* cx = sctx->GetNativeContext();
NS_ENSURE_STATE(cx);
nsCOMPtr<nsIDOMChromeWindow> chromeWindow =

View File

@ -910,7 +910,7 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
JSContext *cx = nsnull; // Initialize this to keep GCC happy.
if (stid == nsIProgrammingLanguage::JAVASCRIPT) {
cx = (JSContext *)context->GetNativeContext();
cx = context->GetNativeContext();
::JS_BeginRequest(cx);
NS_ASSERTION(!::JS_IsExceptionPending(cx),
"JS_ReportPendingException wasn't called in EvaluateString");

View File

@ -901,7 +901,7 @@ nsWebSocket::CreateAndDispatchMessageEvent(const nsACString& aData)
nsIScriptContext* scriptContext = sgo->GetContext();
NS_ENSURE_TRUE(scriptContext, NS_ERROR_FAILURE);
JSContext* cx = (JSContext*)scriptContext->GetNativeContext();
JSContext* cx = scriptContext->GetNativeContext();
NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE);
// Now we can turn our string into a jsval

View File

@ -644,8 +644,7 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
}
nsCxPusher pusher;
if (aNeedsCxPush &&
!pusher.Push((JSContext*)context->GetNativeContext())) {
if (aNeedsCxPush && !pusher.Push(context->GetNativeContext())) {
return NS_ERROR_FAILURE;
}

View File

@ -1544,7 +1544,7 @@ IsScriptEnabled(nsIDocument *aDoc, nsIDocShell *aContainer)
nsIScriptContext *scriptContext = globalObject->GetContext();
NS_ENSURE_TRUE(scriptContext, PR_TRUE);
JSContext* cx = (JSContext *) scriptContext->GetNativeContext();
JSContext* cx = scriptContext->GetNativeContext();
NS_ENSURE_TRUE(cx, PR_TRUE);
PRBool enabled = PR_TRUE;

View File

@ -1248,7 +1248,7 @@ nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
if (!context)
return NS_NOINTERFACE;
JSContext* jscontext = (JSContext*)context->GetNativeContext();
JSContext* jscontext = context->GetNativeContext();
if (!jscontext)
return NS_NOINTERFACE;

View File

@ -1062,7 +1062,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
nsCOMPtr<nsIScriptContext> context = global->GetContext();
if (context && scope) {
JSContext *cx = (JSContext *)context->GetNativeContext();
JSContext *cx = context->GetNativeContext();
nsCxPusher pusher;
pusher.Push(cx);
@ -1395,7 +1395,7 @@ nsXBLBinding::AllowScripts()
return PR_FALSE;
}
JSContext* cx = (JSContext*) context->GetNativeContext();
JSContext* cx = context->GetNativeContext();
nsCOMPtr<nsIDocument> ourDocument =
mPrototypeBinding->XBLDocumentInfo()->GetDocument();

View File

@ -318,7 +318,7 @@ nsXBLDocGlobalObject::EnsureScriptEnvironment(PRUint32 aLangID)
NS_ENSURE_SUCCESS(rv, rv);
rv = SetScriptContext(aLangID, newCtx);
JSContext *cx = (JSContext *)mScriptContext->GetNativeContext();
JSContext *cx = mScriptContext->GetNativeContext();
JSAutoRequest ar(cx);
// nsJSEnvironment set the error reporter to NS_ScriptErrorReporter so
@ -372,8 +372,7 @@ nsXBLDocGlobalObject::GetGlobalJSObject()
if (!mScriptContext)
return nsnull;
JSContext* cx = static_cast<JSContext*>
(mScriptContext->GetNativeContext());
JSContext* cx = mScriptContext->GetNativeContext();
if (!cx)
return nsnull;

View File

@ -103,7 +103,7 @@ nsXBLProtoImpl::InstallImplementation(nsXBLPrototypeBinding* aBinding, nsIConten
JSObject * targetScriptObject;
holder->GetJSObject(&targetScriptObject);
JSContext *cx = (JSContext *)context->GetNativeContext();
JSContext *cx = context->GetNativeContext();
AutoVersionChecker avc(cx);
@ -147,7 +147,7 @@ nsXBLProtoImpl::InitTargetObjects(nsXBLPrototypeBinding* aBinding,
// Because our prototype implementation has a class, we need to build up a corresponding
// class for the concrete implementation in the bound document.
JSContext* jscontext = (JSContext*)aContext->GetNativeContext();
JSContext* jscontext = aContext->GetNativeContext();
JSObject* global = sgo->GetGlobalJSObject();
nsCOMPtr<nsIXPConnectJSObjectHolder> wrapper;
jsval v;
@ -185,7 +185,7 @@ nsXBLProtoImpl::CompilePrototypeMembers(nsXBLPrototypeBinding* aBinding)
nsIScriptContext *context = globalObject->GetContext();
NS_ENSURE_TRUE(context, NS_ERROR_OUT_OF_MEMORY);
JSContext *cx = (JSContext *)context->GetNativeContext();
JSContext *cx = context->GetNativeContext();
JSObject *global = globalObject->GetGlobalJSObject();

View File

@ -117,7 +117,7 @@ nsXBLProtoImplField::InstallField(nsIScriptContext* aContext,
nsCAutoString uriSpec;
aBindingDocURI->GetSpec(uriSpec);
JSContext* cx = (JSContext*) aContext->GetNativeContext();
JSContext* cx = aContext->GetNativeContext();
NS_ASSERTION(!::JS_IsExceptionPending(cx),
"Shouldn't get here when an exception is pending!");

View File

@ -128,7 +128,7 @@ nsXBLProtoImplMethod::InstallMember(nsIScriptContext* aContext,
{
NS_PRECONDITION(IsCompiled(),
"Should not be installing an uncompiled method");
JSContext* cx = (JSContext*) aContext->GetNativeContext();
JSContext* cx = aContext->GetNativeContext();
nsIDocument *ownerDoc = aBoundElement->GetOwnerDoc();
nsIScriptGlobalObject *sgo;
@ -294,7 +294,7 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement)
return NS_OK;
}
JSContext* cx = (JSContext*) context->GetNativeContext();
JSContext* cx = context->GetNativeContext();
JSObject* globalObject = global->GetGlobalJSObject();

View File

@ -155,7 +155,7 @@ nsXBLProtoImplProperty::InstallMember(nsIScriptContext* aContext,
{
NS_PRECONDITION(mIsCompiled,
"Should not be installing an uncompiled property");
JSContext* cx = (JSContext*) aContext->GetNativeContext();
JSContext* cx = aContext->GetNativeContext();
nsIDocument *ownerDoc = aBoundElement->GetOwnerDoc();
nsIScriptGlobalObject *sgo;

View File

@ -797,7 +797,7 @@ nsScriptEventHandlerOwnerTearoff::CompileEventHandler(
&argNames);
nsCxPusher pusher;
if (!pusher.Push((JSContext*)context->GetNativeContext())) {
if (!pusher.Push(context->GetNativeContext())) {
return NS_ERROR_FAILURE;
}

View File

@ -728,7 +728,7 @@ nsXULPDGlobalObject::EnsureScriptEnvironment(PRUint32 lang_id)
// attach it as the global for this context. Then, ::SetScriptContext
// will re-fetch the global and set it up in our language globals array.
{
JSContext *cx = (JSContext *)ctxNew->GetNativeContext();
JSContext *cx = ctxNew->GetNativeContext();
JSAutoRequest ar(cx);
nsIPrincipal *principal = GetPrincipal();

View File

@ -1420,7 +1420,7 @@ nsXULTemplateBuilder::InitHTMLTemplateRoot()
if (! context)
return NS_ERROR_UNEXPECTED;
JSContext* jscontext = reinterpret_cast<JSContext*>(context->GetNativeContext());
JSContext* jscontext = context->GetNativeContext();
NS_ASSERTION(context != nsnull, "no jscontext");
if (! jscontext)
return NS_ERROR_UNEXPECTED;

View File

@ -6492,7 +6492,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
if (!my_context) {
my_cx = cx;
} else {
my_cx = (JSContext *)my_context->GetNativeContext();
my_cx = my_context->GetNativeContext();
if (my_cx != cx) {
if (!ac.enter(my_cx, obj)) {
@ -9340,7 +9340,7 @@ public:
{
JSContext* cx = nsnull;
if (mContext) {
cx = (JSContext*)mContext->GetNativeContext();
cx = mContext->GetNativeContext();
} else {
nsCOMPtr<nsIThreadJSContextStack> stack =
do_GetService("@mozilla.org/js/xpc/ContextStack;1");

View File

@ -1261,9 +1261,7 @@ nsGlobalWindow::FreeInnerObjects(PRBool aClearScope)
// Kill all of the workers for this window.
nsIScriptContext *scx = GetContextInternal();
JSContext *cx = scx ?
static_cast<JSContext*>(scx->GetNativeContext()) :
nsnull;
JSContext *cx = scx ? scx->GetNativeContext() : nsnull;
mozilla::dom::workers::CancelWorkersForWindow(cx, this);
// Close all IndexedDB databases for this window.
@ -1864,7 +1862,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
nsIScriptContext *scx = GetContextInternal();
NS_ENSURE_TRUE(scx, NS_ERROR_NOT_INITIALIZED);
JSContext *cx = (JSContext *)scx->GetNativeContext();
JSContext *cx = scx->GetNativeContext();
#ifndef MOZ_DISABLE_DOMCRYPTO
// clear smartcard events, our document has gone away.
if (mCrypto) {
@ -2860,7 +2858,7 @@ nsGlobalWindow::DefineArgumentsProperty(nsIArray *aArguments)
JSContext *cx;
nsIScriptContext *ctx = GetOuterWindowInternal()->mContext;
NS_ENSURE_TRUE(aArguments && ctx &&
(cx = (JSContext *)ctx->GetNativeContext()),
(cx = ctx->GetNativeContext()),
NS_ERROR_NOT_INITIALIZED);
if (mIsModalContentWindow) {
@ -6101,7 +6099,7 @@ PostMessageEvent::Run()
JSContext* cx = nsnull;
nsIScriptContext* scriptContext = mTargetWindow->GetContext();
if (scriptContext) {
cx = (JSContext*)scriptContext->GetNativeContext();
cx = scriptContext->GetNativeContext();
}
if (!cx) {
@ -9805,7 +9803,7 @@ nsGlobalWindow::BuildURIfromBase(const char *aURL, nsIURI **aBuiltURI,
// such a way. This also makes us get the appropriate base URI for
// the below URI resolution code.
cx = (JSContext *)scx->GetNativeContext();
cx = scx->GetNativeContext();
} else {
// get the JSContext from the call stack
nsCOMPtr<nsIThreadJSContextStack> stack(do_GetService(sJSStackContractID));
@ -9908,7 +9906,7 @@ nsGlobalWindow::SaveWindowState(nsISupports **aState)
inner->Freeze();
// Remember the outer window's prototype.
JSContext *cx = (JSContext *)mContext->GetNativeContext();
JSContext *cx = mContext->GetNativeContext();
JSAutoRequest req(cx);
nsIXPConnect *xpc = nsContentUtils::XPConnect();
@ -10001,9 +9999,7 @@ nsGlobalWindow::SuspendTimeouts(PRUint32 aIncrease,
// Suspend all of the workers for this window.
nsIScriptContext *scx = GetContextInternal();
JSContext *cx = scx ?
static_cast<JSContext*>(scx->GetNativeContext()) :
nsnull;
JSContext *cx = scx ? scx->GetNativeContext() : nsnull;
mozilla::dom::workers::SuspendWorkersForWindow(cx, this);
TimeStamp now = TimeStamp::Now();
@ -10079,9 +10075,7 @@ nsGlobalWindow::ResumeTimeouts(PRBool aThawChildren)
// Resume all of the workers for this window.
nsIScriptContext *scx = GetContextInternal();
JSContext *cx = scx ?
static_cast<JSContext*>(scx->GetNativeContext()) :
nsnull;
JSContext *cx = scx ? scx->GetNativeContext() : nsnull;
mozilla::dom::workers::ResumeWorkersForWindow(cx, this);
// Restore all of the timeouts, using the stored time remaining
@ -10529,7 +10523,7 @@ nsGlobalChromeWindow::GetMessageManager(nsIChromeFrameMessageManager** aManager)
if (!mMessageManager) {
nsIScriptContext* scx = GetContextInternal();
NS_ENSURE_STATE(scx);
JSContext* cx = (JSContext *)scx->GetNativeContext();
JSContext* cx = scx->GetNativeContext();
NS_ENSURE_STATE(cx);
nsCOMPtr<nsIChromeFrameMessageManager> globalMM =
do_GetService("@mozilla.org/globalmessagemanager;1");

View File

@ -43,6 +43,7 @@
#include "nsISupports.h"
#include "nsCOMPtr.h"
#include "nsIProgrammingLanguage.h"
#include "jspubtd.h"
class nsIScriptGlobalObject;
class nsIScriptSecurityManager;
@ -73,8 +74,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
#define NS_ISCRIPTCONTEXT_IID \
{ 0xad76079b, 0xd408, 0x4159, \
{0xb7, 0x3f, 0x41, 0x08, 0x77, 0xff, 0x9b, 0x47 } }
{ 0x827d1e82, 0x5aab, 0x4e3a, \
{ 0x88, 0x76, 0x53, 0xf7, 0xed, 0x1e, 0x3f, 0xbe } }
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
know what language we have is a little silly... */
@ -83,9 +84,6 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
/**
* It is used by the application to initialize a runtime and run scripts.
* A script runtime would implement this interface.
* <P><I>It does have a bit too much java script information now, that
* should be removed in a short time. Ideally this interface will be
* language neutral</I>
*/
class nsIScriptContext : public nsIScriptContextPrincipal
{
@ -292,7 +290,7 @@ public:
* Return the native script context
*
**/
virtual void *GetNativeContext() = 0;
virtual JSContext* GetNativeContext() = 0;
/**
* Return the native global object for this context.

View File

@ -2242,7 +2242,7 @@ nsJSContext::ConnectToInner(nsIScriptGlobalObject *aNewInner, void *aOuterGlobal
return NS_OK;
}
void *
JSContext*
nsJSContext::GetNativeContext()
{
return mContext;

View File

@ -34,8 +34,8 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsJSEnvironment_h___
#define nsJSEnvironment_h___
#ifndef nsJSEnvironment_h
#define nsJSEnvironment_h
#include "nsIScriptContext.h"
#include "nsIScriptRuntime.h"
@ -129,7 +129,7 @@ public:
virtual void SetDefaultLanguageVersion(PRUint32 aVersion);
virtual nsIScriptGlobalObject *GetGlobalObject();
virtual void *GetNativeContext();
virtual JSContext* GetNativeContext();
virtual void *GetNativeGlobal();
virtual nsresult CreateNativeGlobalForInner(
nsIScriptGlobalObject *aGlobal,
@ -370,4 +370,4 @@ JSBool NS_DOMWriteStructuredClone(JSContext* cx,
void NS_DOMStructuredCloneError(JSContext* cx, uint32 errorid);
#endif /* nsJSEnvironment_h___ */
#endif /* nsJSEnvironment_h */

View File

@ -143,7 +143,7 @@ IDBRequest::SetDone(AsyncConnectionHelper* aHelper)
}
// Otherwise we need to get the result from the helper.
JSContext* cx = static_cast<JSContext*>(mScriptContext->GetNativeContext());
JSContext* cx = mScriptContext->GetNativeContext();
NS_ASSERTION(cx, "Failed to get a context!");
JSObject* global = static_cast<JSObject*>(mScriptContext->GetNativeGlobal());

View File

@ -361,7 +361,7 @@ GetJSContext(NPP npp)
nsIScriptContext *scx = sgo->GetContext();
NS_ENSURE_TRUE(scx, nsnull);
return (JSContext *)scx->GetNativeContext();
return scx->GetNativeContext();
}
}

View File

@ -718,7 +718,7 @@ GetJSContextFromDoc(nsIDocument *doc)
nsIScriptContext *scx = sgo->GetContext();
NS_ENSURE_TRUE(scx, nsnull);
return (JSContext *)scx->GetNativeContext();
return scx->GetNativeContext();
}
static JSContext *

View File

@ -1263,7 +1263,7 @@ nsNPAPIPluginInstance::GetJSContext(JSContext* *outContext)
nsIScriptContext *context = global->GetContext();
if (context) {
*outContext = (JSContext*) context->GetNativeContext();
*outContext = context->GetNativeContext();
}
}
}

View File

@ -267,7 +267,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
// principal of the context.
nsCOMPtr<nsIPrincipal> objectPrincipal;
rv = securityManager->
GetObjectPrincipal((JSContext*)scriptContext->GetNativeContext(),
GetObjectPrincipal(scriptContext->GetNativeContext(),
globalJSObject,
getter_AddRefs(objectPrincipal));
if (NS_FAILED(rv))
@ -294,7 +294,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
// First check to make sure it's OK to evaluate this script to
// start with. For example, script could be disabled.
JSContext *cx = (JSContext*)scriptContext->GetNativeContext();
JSContext *cx = scriptContext->GetNativeContext();
JSAutoRequest ar(cx);
PRBool ok;
@ -373,7 +373,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
// lose the error), or it might be JS that then proceeds to
// cause an error of its own (which will also make us lose
// this error).
JSContext *cx = (JSContext*)scriptContext->GetNativeContext();
JSContext *cx = scriptContext->GetNativeContext();
JSAutoRequest ar(cx);
::JS_ReportPendingException(cx);
}

View File

@ -2176,8 +2176,7 @@ WorkerPrivateParent<Derived>::ParentJSContext() const
return RuntimeService::AutoSafeJSContext::GetSafeContext();
}
NS_ASSERTION(mParentJSContext ==
static_cast<JSContext*>(mScriptContext->GetNativeContext()),
NS_ASSERTION(mParentJSContext == mScriptContext->GetNativeContext(),
"Native context has changed!");
}
@ -2289,8 +2288,7 @@ WorkerPrivate::Create(JSContext* aCx, JSObject* aObj, WorkerPrivate* aParent,
return nsnull;
}
parentContext =
static_cast<JSContext*>(scriptContext->GetNativeContext());
parentContext = scriptContext->GetNativeContext();
// If we're called from a window then we can dig out the principal and URI
// from the document.

View File

@ -2116,7 +2116,7 @@ nsWindowWatcher::GetJSContextFromWindow(nsIDOMWindow *aWindow)
if (sgo) {
nsIScriptContext *scx = sgo->GetContext();
if (scx)
cx = (JSContext *) scx->GetNativeContext();
cx = scx->GetNativeContext();
}
/* (off-topic note:) the nsIScriptContext can be retrieved by
nsCOMPtr<nsIScriptContext> scx;

View File

@ -2519,7 +2519,7 @@ nsObjectFrame::NotifyContentObjectWrapper()
if (!scx)
return;
JSContext *cx = (JSContext *)scx->GetNativeContext();
JSContext *cx = scx->GetNativeContext();
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
nsContentUtils::XPConnect()->

View File

@ -630,7 +630,7 @@ nsHtml5TreeOpExecutor::IsScriptEnabled()
}
nsIScriptContext *scriptContext = globalObject->GetContext();
NS_ENSURE_TRUE(scriptContext, PR_TRUE);
JSContext* cx = (JSContext *) scriptContext->GetNativeContext();
JSContext* cx = scriptContext->GetNativeContext();
NS_ENSURE_TRUE(cx, PR_TRUE);
PRBool enabled = PR_TRUE;
nsContentUtils::GetSecurityManager()->

View File

@ -451,7 +451,7 @@ nsAppShellService::GetHiddenWindowAndJSContext(nsIDOMWindow **aWindow,
if (!scriptContext) { rv = NS_ERROR_FAILURE; break; }
// 5. Get JSContext from the script context.
JSContext *jsContext = (JSContext*)scriptContext->GetNativeContext();
JSContext *jsContext = scriptContext->GetNativeContext();
if (!jsContext) { rv = NS_ERROR_FAILURE; break; }
// Now, give results to caller.

View File

@ -198,8 +198,7 @@ nsHTTPIndex::OnFTPControlLog(PRBool server, const char *msg)
nsIScriptContext *context = scriptGlobal->GetContext();
NS_ENSURE_TRUE(context, NS_OK);
JSContext* cx = reinterpret_cast<JSContext*>
(context->GetNativeContext());
JSContext* cx = context->GetNativeContext();
NS_ENSURE_TRUE(cx, NS_OK);
JSObject* global = JS_GetGlobalObject(cx);
@ -276,8 +275,7 @@ nsHTTPIndex::OnStartRequest(nsIRequest *request, nsISupports* aContext)
nsIScriptContext *context = scriptGlobal->GetContext();
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
JSContext* cx = reinterpret_cast<JSContext*>
(context->GetNativeContext());
JSContext* cx = context->GetNativeContext();
JSObject* global = JS_GetGlobalObject(cx);
// Using XPConnect, wrap the HTTP index object...

View File

@ -744,7 +744,7 @@ nsresult InitInstallTriggerGlobalClass(JSContext *jscontext, JSObject *global, v
//
nsresult NS_InitInstallTriggerGlobalClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSContext *jscontext = aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
@ -789,7 +789,7 @@ NS_NewScriptInstallTriggerGlobal(nsIScriptContext *aContext,
JSObject *proto;
JSObject *parent = nsnull;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSContext *jscontext = aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMInstallTriggerGlobal *installTriggerGlobal;