Bug 411327 - nsIXPCNativeCallContext should not inherit from nsISupports, r=mrbkap, a=schrep
This commit is contained in:
Родитель
9179558822
Коммит
c996c2f665
|
@ -426,7 +426,7 @@ private:
|
|||
|
||||
nsresult
|
||||
CheckPropertyAccessImpl(PRUint32 aAction,
|
||||
nsIXPCNativeCallContext* aCallContext,
|
||||
nsAXPCNativeCallContext* aCallContext,
|
||||
JSContext* cx, JSObject* aJSObject,
|
||||
nsISupports* aObj, nsIURI* aTargetURI,
|
||||
nsIClassInfo* aClassInfo,
|
||||
|
|
|
@ -726,7 +726,7 @@ nsScriptSecurityManager::CheckSameOriginPrincipal(nsIPrincipal* aSourcePrincipal
|
|||
|
||||
nsresult
|
||||
nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
|
||||
nsIXPCNativeCallContext* aCallContext,
|
||||
nsAXPCNativeCallContext* aCallContext,
|
||||
JSContext* cx, JSObject* aJSObject,
|
||||
nsISupports* aObj, nsIURI* aTargetURI,
|
||||
nsIClassInfo* aClassInfo,
|
||||
|
@ -939,8 +939,8 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
|
|||
|
||||
if (sXPConnect)
|
||||
{
|
||||
nsCOMPtr<nsIXPCNativeCallContext> xpcCallContext;
|
||||
sXPConnect->GetCurrentNativeCallContext(getter_AddRefs(xpcCallContext));
|
||||
nsAXPCNativeCallContext *xpcCallContext = nsnull;
|
||||
sXPConnect->GetCurrentNativeCallContext(&xpcCallContext);
|
||||
if (xpcCallContext)
|
||||
xpcCallContext->SetExceptionWasThrown(PR_TRUE);
|
||||
}
|
||||
|
@ -1545,8 +1545,8 @@ nsScriptSecurityManager::ReportError(JSContext* cx, const nsAString& messageTag,
|
|||
// Tell XPConnect that an exception was thrown, if appropriate
|
||||
if (sXPConnect)
|
||||
{
|
||||
nsCOMPtr<nsIXPCNativeCallContext> xpcCallContext;
|
||||
sXPConnect->GetCurrentNativeCallContext(getter_AddRefs(xpcCallContext));
|
||||
nsAXPCNativeCallContext* xpcCallContext = nsnull;
|
||||
sXPConnect->GetCurrentNativeCallContext(&xpcCallContext);
|
||||
if (xpcCallContext)
|
||||
xpcCallContext->SetExceptionWasThrown(PR_TRUE);
|
||||
}
|
||||
|
@ -3123,7 +3123,7 @@ nsScriptSecurityManager::CanGetService(JSContext *cx,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsScriptSecurityManager::CanAccess(PRUint32 aAction,
|
||||
nsIXPCNativeCallContext* aCallContext,
|
||||
nsAXPCNativeCallContext* aCallContext,
|
||||
JSContext* cx,
|
||||
JSObject* aJSObject,
|
||||
nsISupports* aObj,
|
||||
|
|
|
@ -2669,8 +2669,8 @@ nsContentUtils::NotifyXPCIfExceptionPending(JSContext* aCx)
|
|||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> nccx;
|
||||
XPConnect()->GetCurrentNativeCallContext(getter_AddRefs(nccx));
|
||||
nsAXPCNativeCallContext *nccx = nsnull;
|
||||
XPConnect()->GetCurrentNativeCallContext(&nccx);
|
||||
if (nccx) {
|
||||
// Check to make sure that the JSContext that nccx will mess with is the
|
||||
// same as the JSContext we've set an exception on. If they're not the
|
||||
|
|
|
@ -490,10 +490,10 @@ nsDOMParser::Init()
|
|||
{
|
||||
AttemptedInitMarker marker(&mAttemptedInit);
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(ncc, NS_ERROR_UNEXPECTED);
|
||||
|
||||
|
|
|
@ -628,9 +628,9 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest,
|
|||
context->SetProcessingScriptTag(oldProcessingScriptTag);
|
||||
|
||||
if (stid == nsIProgrammingLanguage::JAVASCRIPT) {
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
|
||||
if (ncc) {
|
||||
NS_ASSERTION(!::JS_IsExceptionPending(cx),
|
||||
|
|
|
@ -1373,10 +1373,10 @@ nsXMLHttpRequest::Open(const nsACString& method, const nsACString& url)
|
|||
PRBool async = PR_TRUE;
|
||||
nsAutoString user, password;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
nsIXPConnect *xpc = nsContentUtils::XPConnect();
|
||||
if (xpc) {
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && cc) {
|
||||
|
|
|
@ -1853,9 +1853,9 @@ nsCanvasRenderingContext2D::DrawImage()
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
@ -2379,9 +2379,9 @@ nsCanvasRenderingContext2D::GetImageData()
|
|||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
@ -2504,9 +2504,9 @@ nsCanvasRenderingContext2D::PutImageData()
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
|
|
@ -287,9 +287,9 @@ nsHTMLCanvasElement::ToDataURL(nsAString& aDataURL)
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
|
|
@ -2485,10 +2485,10 @@ nsHTMLDocument::Writeln(const nsAString& aText)
|
|||
nsresult
|
||||
nsHTMLDocument::ScriptWriteCommon(PRBool aNewlineTerminate)
|
||||
{
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (ncc) {
|
||||
|
|
|
@ -1450,8 +1450,8 @@ txVariable::Convert(nsIVariant *aValue, txAExprResult** aResult)
|
|||
do_GetService(nsIXPConnect::GetCID(), &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSContext* cx;
|
||||
|
|
|
@ -3917,10 +3917,10 @@ nsGlobalWindow::Prompt(nsAString& aReturn)
|
|||
NS_ENSURE_STATE(mDocShell);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
|
||||
rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
@ -4785,10 +4785,10 @@ nsGlobalWindow::Open(nsIDOMWindow **_retval)
|
|||
{
|
||||
*_retval = nsnull;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
@ -4857,9 +4857,9 @@ nsGlobalWindow::OpenDialog(nsIDOMWindow** _retval)
|
|||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
@ -5666,10 +5666,10 @@ nsGlobalWindow::Find(PRBool *aDidFind)
|
|||
|
||||
// We get the arguments passed to the function using the XPConnect native
|
||||
// call context.
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
|
||||
rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ASSERTION(ncc, "No Native Call Context."
|
||||
|
@ -7141,9 +7141,9 @@ nsGlobalWindow::SetTimeoutOrInterval(PRBool aIsInterval, PRInt32 *aReturn)
|
|||
// inner window that's calling window.setTimeout().
|
||||
|
||||
if (IsOuterWindow()) {
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc) {
|
||||
|
@ -7584,10 +7584,10 @@ nsGlobalWindow::ClearTimeoutOrInterval()
|
|||
FORWARD_TO_INNER(ClearTimeoutOrInterval, (), NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
|
||||
rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
@ -8854,9 +8854,9 @@ nsNavigator::sPrefInternal_id = JSVAL_VOID;
|
|||
NS_IMETHODIMP
|
||||
nsNavigator::Preference()
|
||||
{
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
|
|
@ -248,9 +248,9 @@ nsHistory::Go(PRInt32 aDelta)
|
|||
NS_IMETHODIMP
|
||||
nsHistory::Go()
|
||||
{
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
|
|
@ -176,9 +176,9 @@ nsJSScriptTimeoutHandler::Init(nsIScriptContext *aContext, PRBool *aIsInterval,
|
|||
|
||||
mContext = aContext;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
|
|
@ -867,9 +867,9 @@ nsLocation::Reload(PRBool aForceget)
|
|||
NS_IMETHODIMP
|
||||
nsLocation::Reload()
|
||||
{
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
|
|
@ -245,9 +245,9 @@ nsPluginArray::Refresh(PRBool aReloadDocuments)
|
|||
NS_IMETHODIMP
|
||||
nsPluginArray::Refresh()
|
||||
{
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
nsresult rv = nsContentUtils::XPConnect()->
|
||||
GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!ncc)
|
||||
|
|
|
@ -193,8 +193,8 @@ nsJSON::EncodeInternal(nsJSONWriter *writer)
|
|||
if (!xpc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSContext *cx = nsnull;
|
||||
|
@ -581,8 +581,8 @@ nsJSON::DecodeInternal(nsIInputStream *aStream,
|
|||
if (!xpc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
jsval *retvalPtr;
|
||||
|
|
|
@ -272,7 +272,7 @@ protected:
|
|||
class NativeJSContext {
|
||||
public:
|
||||
NativeJSContext() {
|
||||
error = gXPConnect->GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
error = gXPConnect->GetCurrentNativeCallContext(&ncc);
|
||||
if (NS_FAILED(error))
|
||||
return;
|
||||
|
||||
|
@ -361,7 +361,7 @@ public:
|
|||
ncc->SetReturnValueWasSet(PR_TRUE);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext ncc;
|
||||
nsresult error;
|
||||
JSContext *ctx;
|
||||
PRUint32 argc;
|
||||
|
|
|
@ -94,7 +94,7 @@ AutoConfigSecMan::CanGetService(JSContext *aJSContext, const nsCID & aCID)
|
|||
|
||||
NS_IMETHODIMP
|
||||
AutoConfigSecMan::CanAccess(PRUint32 aAction,
|
||||
nsIXPCNativeCallContext *aCallContext,
|
||||
nsAXPCNativeCallContext *aCallContext,
|
||||
JSContext *aJSContext, JSObject *aJSObject,
|
||||
nsISupports *aObj, nsIClassInfo *aClassInfo,
|
||||
jsval aName, void **aPolicy)
|
||||
|
|
|
@ -2267,8 +2267,8 @@ jsdValue::GetWrappedValue()
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -2468,8 +2468,8 @@ jsdService::On (void)
|
|||
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID(), &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
JSContext *cx;
|
||||
|
@ -2938,8 +2938,8 @@ jsdService::WrapValue(jsdIValue **_rval)
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
rv = xpc->GetCurrentNativeCallContext (getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext (&cc);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -40,12 +40,15 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[ptr] native nsAXPCNativeCallContextPtr(nsAXPCNativeCallContext);
|
||||
|
||||
%{ C++
|
||||
#include "jspubtd.h"
|
||||
|
||||
class nsAXPCNativeCallContext;
|
||||
%}
|
||||
|
||||
interface nsIClassInfo;
|
||||
interface nsIXPCNativeCallContext;
|
||||
|
||||
[ptr] native JSContextPtr(JSContext);
|
||||
[ptr] native JSObjectPtr(JSObject);
|
||||
|
@ -100,7 +103,7 @@ interface nsIXPCSecurityManager : nsISupports
|
|||
const PRUint32 ACCESS_SET_PROPERTY = 2;
|
||||
|
||||
void CanAccess(in PRUint32 aAction,
|
||||
in nsIXPCNativeCallContext aCallContext,
|
||||
in nsAXPCNativeCallContextPtr aCallContext,
|
||||
in JSContextPtr aJSContext,
|
||||
in JSObjectPtr aJSObject,
|
||||
in nsISupports aObj,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
@ -54,6 +54,7 @@
|
|||
%{ C++
|
||||
#include "jspubtd.h"
|
||||
#include "xptinfo.h"
|
||||
#include "nsAXPCNativeCallContext.h"
|
||||
%}
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -68,6 +69,7 @@
|
|||
[ptr] native voidPtrPtr(void*);
|
||||
[ptr] native nsScriptObjectTracerPtr(nsScriptObjectTracer);
|
||||
[ref] native nsCCTraversalCallbackRef(nsCycleCollectionTraversalCallback);
|
||||
[ptr] native nsAXPCNativeCallContextPtr(nsAXPCNativeCallContext);
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
@ -254,50 +256,6 @@ interface nsIXPConnectWrappedJS : nsIXPConnectJSObjectHolder
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
/**
|
||||
* This is a somewhat special interface. It is available from the global
|
||||
* nsIXPConnect object when native methods have been called. It is only relevant
|
||||
* to the currently called native method on the given JSContext/thread. Holding
|
||||
* a reference past that time (or while other native methods are being called)
|
||||
* will not assure access to this data.
|
||||
*/
|
||||
|
||||
[uuid(0FA68A60-8289-11d3-BB1A-00805F8A5DD7)]
|
||||
interface nsIXPCNativeCallContext : nsISupports
|
||||
{
|
||||
|
||||
readonly attribute nsISupports Callee;
|
||||
readonly attribute PRUint16 CalleeMethodIndex;
|
||||
readonly attribute nsIXPConnectWrappedNative CalleeWrapper;
|
||||
readonly attribute JSContextPtr JSContext;
|
||||
readonly attribute PRUint32 Argc;
|
||||
readonly attribute JSValPtr ArgvPtr;
|
||||
/**
|
||||
* This may be NULL if the JS caller is ignoring the result of the call.
|
||||
*/
|
||||
readonly attribute JSValPtr RetValPtr;
|
||||
/**
|
||||
* Set this if JS_SetPendingException has been called. Return NS_OK or
|
||||
* else this will be ignored and the native method's nsresult will be
|
||||
* converted into an exception and thrown into JS as is the normal case.
|
||||
*/
|
||||
attribute PRBool ExceptionWasThrown;
|
||||
|
||||
/**
|
||||
* Set this to indicate that the callee has directly set the return value
|
||||
* (using RetValPtr and the JSAPI). If set then xpconnect will not attempt
|
||||
* to overwrite it with the converted retval from the C++ callee.
|
||||
*/
|
||||
attribute PRBool ReturnValueWasSet;
|
||||
|
||||
// Methods added since mozilla 0.6....
|
||||
|
||||
readonly attribute nsIInterfaceInfo CalleeInterface;
|
||||
readonly attribute nsIClassInfo CalleeClassInfo;
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
/**
|
||||
* This is a sort of a placeholder interface. It is not intended to be
|
||||
* implemented. It exists to give the nsIXPCSecurityManager an iid on
|
||||
|
@ -581,7 +539,7 @@ interface nsIXPConnect : nsISupports
|
|||
void syncJSContexts();
|
||||
|
||||
readonly attribute nsIStackFrame CurrentJSStack;
|
||||
readonly attribute nsIXPCNativeCallContext CurrentNativeCallContext;
|
||||
readonly attribute nsAXPCNativeCallContextPtr CurrentNativeCallContext;
|
||||
/* pass nsnull to clear pending exception */
|
||||
attribute nsIException PendingException;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIXPCNativeCallContext;
|
||||
[ptr] native nsAXPCNativeCallContextPtr(nsAXPCNativeCallContext);
|
||||
|
||||
%{C++
|
||||
struct JSObject;
|
||||
|
@ -91,5 +91,5 @@ interface xpcIJSModuleLoader : nsISupports
|
|||
*/
|
||||
[noscript] JSObjectPtr importInto(in AUTF8String aResourceURI,
|
||||
in JSObjectPtr targetObj,
|
||||
in nsIXPCNativeCallContext cc);
|
||||
in nsAXPCNativeCallContextPtr cc);
|
||||
};
|
||||
|
|
|
@ -1310,8 +1310,8 @@ mozJSComponentLoader::Import(const nsACString & registryLocation)
|
|||
do_GetService(kXPConnectServiceContractID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -1392,7 +1392,7 @@ mozJSComponentLoader::Import(const nsACString & registryLocation)
|
|||
NS_IMETHODIMP
|
||||
mozJSComponentLoader::ImportInto(const nsACString & aLocation,
|
||||
JSObject * targetObj,
|
||||
nsIXPCNativeCallContext * cc,
|
||||
nsAXPCNativeCallContext * cc,
|
||||
JSObject * *_retval)
|
||||
{
|
||||
nsresult rv;
|
||||
|
@ -1528,7 +1528,7 @@ mozJSComponentLoader::ImportInto(const nsACString & aLocation,
|
|||
}
|
||||
|
||||
nsresult
|
||||
mozJSComponentLoader::ReportOnCaller(nsIXPCNativeCallContext *cc,
|
||||
mozJSComponentLoader::ReportOnCaller(nsAXPCNativeCallContext *cc,
|
||||
const char *format, ...) {
|
||||
if (!cc) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -119,7 +119,7 @@ class mozJSComponentLoader : public nsIModuleLoader,
|
|||
nsIURI *uri, JSContext *cx);
|
||||
static void CloseFastLoad(nsITimer *timer, void *closure);
|
||||
void CloseFastLoad();
|
||||
nsresult ReportOnCaller(nsIXPCNativeCallContext *cc,
|
||||
nsresult ReportOnCaller(nsAXPCNativeCallContext *cc,
|
||||
const char *format, ...);
|
||||
|
||||
nsCOMPtr<nsIComponentManager> mCompMgr;
|
||||
|
|
|
@ -102,8 +102,8 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * /*url*/
|
|||
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
|
||||
if (!xpc) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
JSContext *cx;
|
||||
|
|
|
@ -46,6 +46,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
MODULE = xpconnect
|
||||
|
||||
EXPORTS = \
|
||||
nsAXPCNativeCallContext.h \
|
||||
xpc_map_end.h \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -970,7 +970,7 @@ FullTrustSecMan::CanGetService(JSContext * aJSContext, const nsCID & aCID)
|
|||
/* void CanAccess (in PRUint32 aAction, in nsIXPCNativeCallContext aCallContext, in JSContextPtr aJSContext, in JSObjectPtr aJSObject, in nsISupports aObj, in nsIClassInfo aClassInfo, in JSVal aName, inout voidPtr aPolicy); */
|
||||
NS_IMETHODIMP
|
||||
FullTrustSecMan::CanAccess(PRUint32 aAction,
|
||||
nsIXPCNativeCallContext *aCallContext,
|
||||
nsAXPCNativeCallContext *aCallContext,
|
||||
JSContext * aJSContext, JSObject * aJSObject,
|
||||
nsISupports *aObj, nsIClassInfo *aClassInfo,
|
||||
jsval aName, void * *aPolicy)
|
||||
|
|
|
@ -1609,16 +1609,14 @@ nsXPConnect::GetCurrentJSStack(nsIStackFrame * *aCurrentJSStack)
|
|||
|
||||
/* readonly attribute nsIXPCNativeCallContext CurrentNativeCallContext; */
|
||||
NS_IMETHODIMP
|
||||
nsXPConnect::GetCurrentNativeCallContext(nsIXPCNativeCallContext * *aCurrentNativeCallContext)
|
||||
nsXPConnect::GetCurrentNativeCallContext(nsAXPCNativeCallContext * *aCurrentNativeCallContext)
|
||||
{
|
||||
NS_ASSERTION(aCurrentNativeCallContext, "bad param");
|
||||
|
||||
XPCPerThreadData* data = XPCPerThreadData::GetData();
|
||||
if(data)
|
||||
{
|
||||
nsIXPCNativeCallContext* temp = data->GetCallContext();
|
||||
NS_IF_ADDREF(temp);
|
||||
*aCurrentNativeCallContext = temp;
|
||||
*aCurrentNativeCallContext = data->GetCallContext();
|
||||
return NS_OK;
|
||||
}
|
||||
//else...
|
||||
|
|
|
@ -50,8 +50,8 @@ nsresult xpcJSWeakReference::Init()
|
|||
nsXPConnect* xpc = nsXPConnect::GetXPConnect();
|
||||
if (!xpc) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSContext *cx = nsnull;
|
||||
|
@ -103,8 +103,8 @@ xpcJSWeakReference::Get()
|
|||
nsXPConnect* xpc = nsXPConnect::GetXPConnect();
|
||||
if (!xpc) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext* cc = nsnull;
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
jsval *retval = nsnull;
|
||||
|
|
|
@ -303,8 +303,6 @@ XPCCallContext::SystemIsBeingShutDown()
|
|||
|
||||
XPCCallContext::~XPCCallContext()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "Someone is holding a bad reference to a XPCCallContext");
|
||||
|
||||
// do cleanup...
|
||||
|
||||
if(mXPCContext)
|
||||
|
@ -432,21 +430,6 @@ XPCCallContext::DeleteString(nsAString *string)
|
|||
delete string;
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE1(XPCCallContext, nsIXPCNativeCallContext)
|
||||
NS_IMPL_ADDREF(XPCCallContext)
|
||||
|
||||
NS_IMETHODIMP_(nsrefcnt)
|
||||
XPCCallContext::Release(void)
|
||||
{
|
||||
NS_PRECONDITION(0 != mRefCnt, "dup release");
|
||||
NS_ASSERT_OWNINGTHREAD(XPCCallContext);
|
||||
--mRefCnt;
|
||||
NS_LOG_RELEASE(this, mRefCnt, "XPCCallContext");
|
||||
// no delete this!
|
||||
return mRefCnt;
|
||||
}
|
||||
|
||||
/* readonly attribute nsISupports Callee; */
|
||||
NS_IMETHODIMP
|
||||
XPCCallContext::GetCallee(nsISupports * *aCallee)
|
||||
|
|
|
@ -2736,8 +2736,8 @@ nsXPCComponents_Utils::LookupMethod()
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
// get the xpconnect native call context
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
xpc->GetCurrentNativeCallContext(&cc);
|
||||
if(!cc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -2864,8 +2864,8 @@ nsXPCComponents_Utils::ReportError()
|
|||
return NS_OK;
|
||||
|
||||
// get the xpconnect native call context
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
xpc->GetCurrentNativeCallContext(&cc);
|
||||
if(!cc)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -3424,8 +3424,8 @@ nsXPCComponents_Utils::EvalInSandbox(const nsAString &source)
|
|||
return rv;
|
||||
|
||||
// get the xpconnect native call context
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
xpc->GetCurrentNativeCallContext(&cc);
|
||||
if(!cc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -3634,8 +3634,8 @@ nsXPCComponents_Utils::ForceGC()
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
// get the xpconnect native call context
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc;
|
||||
nsresult rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
|
||||
nsAXPCNativeCallContext *cc = nsnull;
|
||||
nsresult rv = xpc->GetCurrentNativeCallContext(&cc);
|
||||
if (!cc)
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -773,8 +773,8 @@ nsJSCID::CreateInstance(nsISupports **_retval)
|
|||
if(!xpc)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ccxp;
|
||||
xpc->GetCurrentNativeCallContext(getter_AddRefs(ccxp));
|
||||
nsAXPCNativeCallContext *ccxp = nsnull;
|
||||
xpc->GetCurrentNativeCallContext(&ccxp);
|
||||
if(!ccxp)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
|
@ -846,8 +846,8 @@ nsJSCID::GetService(nsISupports **_retval)
|
|||
if(!xpc)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ccxp;
|
||||
xpc->GetCurrentNativeCallContext(getter_AddRefs(ccxp));
|
||||
nsAXPCNativeCallContext *ccxp = nsnull;
|
||||
xpc->GetCurrentNativeCallContext(&ccxp);
|
||||
if(!ccxp)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
|
|
|
@ -938,11 +938,22 @@ public:
|
|||
//
|
||||
// Note that most accessors are inlined.
|
||||
|
||||
class XPCCallContext : public nsIXPCNativeCallContext
|
||||
class XPCCallContext : public nsAXPCNativeCallContext
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIXPCNATIVECALLCONTEXT
|
||||
NS_IMETHOD GetCallee(nsISupports **aResult);
|
||||
NS_IMETHOD GetCalleeMethodIndex(PRUint16 *aResult);
|
||||
NS_IMETHOD GetCalleeWrapper(nsIXPConnectWrappedNative **aResult);
|
||||
NS_IMETHOD GetJSContext(JSContext **aResult);
|
||||
NS_IMETHOD GetArgc(PRUint32 *aResult);
|
||||
NS_IMETHOD GetArgvPtr(jsval **aResult);
|
||||
NS_IMETHOD GetRetValPtr(jsval **aResult);
|
||||
NS_IMETHOD GetExceptionWasThrown(PRBool *aResult);
|
||||
NS_IMETHOD SetExceptionWasThrown(PRBool aValue);
|
||||
NS_IMETHOD GetReturnValueWasSet(PRBool *aResult);
|
||||
NS_IMETHOD SetReturnValueWasSet(PRBool aValue);
|
||||
NS_IMETHOD GetCalleeInterface(nsIInterfaceInfo **aResult);
|
||||
NS_IMETHOD GetCalleeClassInfo(nsIClassInfo **aResult);
|
||||
|
||||
enum {NO_ARGS = (uintN) -1};
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ MySecMan::CanGetService(JSContext * aJSContext, const nsCID & aCID)
|
|||
|
||||
/* void CanAccess (in PRUint32 aAction, in nsIXPCNativeCallContext aCallContext, in JSContextPtr aJSContext, in JSObjectPtr aJSObject, in nsISupports aObj, in nsIClassInfo aClassInfo, in JSVal aName, inout voidPtr aPolicy); */
|
||||
NS_IMETHODIMP
|
||||
MySecMan::CanAccess(PRUint32 aAction, nsIXPCNativeCallContext *aCallContext, JSContext * aJSContext, JSObject * aJSObject, nsISupports *aObj, nsIClassInfo *aClassInfo, jsval aName, void * *aPolicy)
|
||||
MySecMan::CanAccess(PRUint32 aAction, nsAXPCNativeCallContext *aCallContext, JSContext * aJSContext, JSObject * aJSObject, nsISupports *aObj, nsIClassInfo *aClassInfo, jsval aName, void * *aPolicy)
|
||||
{
|
||||
switch(mMode)
|
||||
{
|
||||
|
|
|
@ -432,10 +432,10 @@ xpctestEcho::SetAString(const char * aAString)
|
|||
|
||||
#define GET_CALL_CONTEXT \
|
||||
nsresult rv; \
|
||||
nsCOMPtr<nsIXPCNativeCallContext> cc; \
|
||||
nsAXPCNativeCallContext *cc = nsnull; \
|
||||
nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID(), &rv)); \
|
||||
if(NS_SUCCEEDED(rv)) \
|
||||
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc)) /* no ';' */
|
||||
rv = xpc->GetCurrentNativeCallContext(&cc) /* no ';' */
|
||||
|
||||
/* void printArgTypes (); */
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -1802,9 +1802,9 @@ nsCrypto::GenerateCRMFRequest(nsIDOMCRMFObject** aReturn)
|
|||
nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID(), &nrv));
|
||||
NS_ENSURE_SUCCESS(nrv, nrv);
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext *ncc = nsnull;
|
||||
|
||||
nrv = xpc->GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
nrv = xpc->GetCurrentNativeCallContext(&ncc);
|
||||
NS_ENSURE_SUCCESS(nrv, nrv);
|
||||
|
||||
if (!ncc)
|
||||
|
@ -2483,10 +2483,10 @@ nsCrypto::SignText(const nsAString& aStringToSign, const nsAString& aCaOption,
|
|||
|
||||
aResult.Truncate();
|
||||
|
||||
nsCOMPtr<nsIXPCNativeCallContext> ncc;
|
||||
nsAXPCNativeCallContext* ncc = nsnull;
|
||||
nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID()));
|
||||
if (xpc) {
|
||||
xpc->GetCurrentNativeCallContext(getter_AddRefs(ncc));
|
||||
xpc->GetCurrentNativeCallContext(&ncc);
|
||||
}
|
||||
|
||||
if (!ncc) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче