Bug 708754 - Use IDL for jsdIDebuggerService::WrapValue and remove WrapJSValue; r=bholley

This commit is contained in:
Ms2ger 2011-12-18 11:12:26 +01:00
parent d0187a210e
commit 0734848acd
3 changed files with 8 additions and 42 deletions

View File

@ -187,8 +187,9 @@ nsEventListenerInfo::GetDebugObject(nsISupports** aRetVal)
jsval v = JSVAL_NULL;
if (GetJSVal(cx, ac, &v)) {
nsCOMPtr<jsdIValue> jsdValue;
jsd->WrapJSValue(v, getter_AddRefs(jsdValue));
*aRetVal = jsdValue.forget().get();
rv = jsd->WrapValue(v, getter_AddRefs(jsdValue));
NS_ENSURE_SUCCESS(rv, rv);
jsdValue.forget(aRetVal);
}
}
stack->Pop(&cx);

View File

@ -1,6 +1,5 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* ***** BEGIN LICENSE BLOCK *****
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** 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
@ -79,7 +78,7 @@ interface jsdIActivationCallback;
* Debugger service. It is not a good idea to have more than one active client
* of the debugger service.
*/
[scriptable, uuid(aa232c7f-855f-4488-a92c-6f89adc668cc)]
[scriptable, uuid(9be5b327-6818-464d-9695-f33885fd8377)]
interface jsdIDebuggerService : nsISupports
{
/** Internal use only. */
@ -375,13 +374,8 @@ interface jsdIDebuggerService : nsISupports
* When called from another language this method returns an xpconnect
* defined error code.
*/
jsdIValue wrapValue(/*in jsvalue value*/);
jsdIValue wrapValue(in jsval value);
/**
* The same as above but to be called from C++.
*/
[noscript] jsdIValue wrapJSValue(in jsval value);
/* XXX these two routines are candidates for refactoring. The only problem
* is that it is not clear where and how they should land.
*/

View File

@ -3052,38 +3052,9 @@ jsdService::ClearAllBreakpoints (void)
}
NS_IMETHODIMP
jsdService::WrapValue(jsdIValue **_rval)
jsdService::WrapValue(const JS::Value &value, jsdIValue **_rval)
{
ASSERT_VALID_CONTEXT;
nsresult rv;
nsCOMPtr<nsIXPConnect> xpc = do_GetService (nsIXPConnect::GetCID(), &rv);
if (NS_FAILED(rv))
return rv;
nsAXPCNativeCallContext *cc = nsnull;
rv = xpc->GetCurrentNativeCallContext (&cc);
if (NS_FAILED(rv))
return rv;
PRUint32 argc;
rv = cc->GetArgc (&argc);
if (NS_FAILED(rv))
return rv;
if (argc < 1)
return NS_ERROR_INVALID_ARG;
jsval *argv;
rv = cc->GetArgvPtr (&argv);
if (NS_FAILED(rv))
return rv;
return WrapJSValue(argv[0], _rval);
}
NS_IMETHODIMP
jsdService::WrapJSValue(const jsval &value, jsdIValue** _rval)
{
JSDValue *jsdv = JSD_NewValue(mCx, value);
if (!jsdv)
return NS_ERROR_FAILURE;