Backout bcb591d32bd6 (bug 809674) on suspicion of breaking B2G marionette-webapi
authorEd Morley <emorley@mozilla.com>
Tue, 13 Nov 2012 13:48:21 +0000
changeset 117721 d56d537a1843c0b5d8e112d1a2dc301e4728e054
parent 117720 246c565c9da975309db53bbf2aa3e67eb74d7366
child 117722 0e14d8bd8aed42b63d3719323e7ef7f3bad7e4f7
child 117730 a38c6f05ba19b931a77c06833ab908d36a01e13f
push idunknown
push userunknown
push dateunknown
bugs809674
milestone19.0a1
backs outbcb591d32bd65872c8ed7fe46fdbc4a3d6467f89
Backout bcb591d32bd6 (bug 809674) on suspicion of breaking B2G marionette-webapi
js/xpconnect/src/XPCWrappedJSClass.cpp
--- a/js/xpconnect/src/XPCWrappedJSClass.cpp
+++ b/js/xpconnect/src/XPCWrappedJSClass.cpp
@@ -1108,28 +1108,27 @@ nsXPCWrappedJSClass::CheckForException(X
             return pending_result;
         }
     }
     return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex,
-                                const XPTMethodDescriptor* info_,
+                                const XPTMethodDescriptor* info,
                                 nsXPTCMiniVariant* nativeParams)
 {
     jsval* sp = nullptr;
     jsval* argv = nullptr;
     uint8_t i;
     nsresult retval = NS_ERROR_FAILURE;
     nsresult pending_result = NS_OK;
     JSBool success;
     JSBool readyToDoTheCall = false;
     nsID  param_iid;
-    const nsXPTMethodInfo* info = static_cast<const nsXPTMethodInfo*>(info_);
     const char* name = info->name;
     jsval fval;
     JSBool foundDependentParam;
 
     // Make sure not to set the callee on ccx until after we've gone through
     // the whole nsIXPCFunctionThisTranslator bit.  That code uses ccx to
     // convert natives to JSObjects, but we do NOT plan to pass those JSObjects
     // to our real callee.
@@ -1139,27 +1138,16 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWra
         return retval;
 
     XPCContext *xpcc = ccx.GetXPCContext();
     JSContext *cx = xpc_UnmarkGrayContext(ccx.GetJSContext());
 
     if (!cx || !xpcc || !IsReflectable(methodIndex))
         return NS_ERROR_FAILURE;
 
-    // [implicit_jscontext] and [optional_argc] have a different calling
-    // convention, which we don't support for JS-implemented components.
-    if (info->WantsOptArgc() || info->WantsContext()) {
-        const char *str = "IDL methods marked with [implicit_jscontext] "
-                          "or [optional_argc] may not be implemented in JS";
-        // Throw and warn for good measure.
-        JS_ReportError(cx, str);
-        NS_WARNING(str);
-        return NS_ERROR_FAILURE;
-    }
-
     JSObject *obj = wrapper->GetJSObject();
     JSObject *thisObj = obj;
 
     JSAutoCompartment ac(cx, obj);
     ccx.SetScopeForNewJSObjects(obj);
 
     JS::AutoValueVector args(cx);
     AutoScriptEvaluate scriptEval(cx);