Bug 708754 - Use IDL for jsdIDebuggerService::WrapValue and remove WrapJSValue; r=bholley
authorMs2ger <ms2ger@gmail.com>
Sun, 18 Dec 2011 11:12:26 +0100
changeset 84523 21fbcd2f27a8db1f37f97463515dcc8dfe16a2f4
parent 84522 515da54158b2018193c797b93859a2f74b7c35ad
child 84524 6b16ef85f2fd0af83c965654964b799a0da76e19
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs708754
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 708754 - Use IDL for jsdIDebuggerService::WrapValue and remove WrapJSValue; r=bholley
content/events/src/nsEventListenerService.cpp
js/jsd/idl/jsdIDebuggerService.idl
js/jsd/jsd_xpc.cpp
--- a/content/events/src/nsEventListenerService.cpp
+++ b/content/events/src/nsEventListenerService.cpp
@@ -182,18 +182,19 @@ nsEventListenerInfo::GetDebugObject(nsIS
     if (cx && NS_SUCCEEDED(stack->Push(cx))) {
       {
         // Extra block to finish the auto request before calling pop
         JSAutoRequest ar(cx);
         JSAutoEnterCompartment ac;
         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);
     }
   }
 #endif
 
   return NS_OK;
--- a/js/jsd/idl/jsdIDebuggerService.idl
+++ b/js/jsd/idl/jsdIDebuggerService.idl
@@ -1,11 +1,10 @@
-/* -*- 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
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
@@ -74,17 +73,17 @@ interface jsdIValue;
 interface jsdIObject;
 interface jsdIProperty;
 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. */
     [noscript] readonly attribute JSDContext        JSDContext;
 
     /**
      * Called when an error or warning occurs.
      */
@@ -370,23 +369,18 @@ interface jsdIDebuggerService : nsISuppo
     void clearAllBreakpoints();
 
     /**
      * When called from JavaScript, this method returns the jsdIValue wrapper
      * for the given value. If a wrapper does not exist one will be created.
      * 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.
      */
 
     /**
      * Push a new network queue, and enter a new UI event loop.
      * @param callback jsdINestCallback instance to be called back after the
      *                 network queue has been pushed, but before the
--- a/js/jsd/jsd_xpc.cpp
+++ b/js/jsd/jsd_xpc.cpp
@@ -3047,48 +3047,19 @@ jsdService::ClearAllBreakpoints (void)
 
     JSD_LockScriptSubsystem(mCx);
     JSD_ClearAllExecutionHooks (mCx);
     JSD_UnlockScriptSubsystem(mCx);
     return NS_OK;
 }
 
 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;
     
     *_rval = jsdValue::FromPtr (mCx, jsdv);
     return NS_OK;
 }