Bug 422340 Firefox 3 beta 4 gives unhelpful slowscript warning on leaving gmail, r+sr=mrbkap
authortimeless@mozdev.org
Thu, 15 Jan 2009 20:02:21 -0800
changeset 23779 9d84b77306db41c089f2ad4b15b2b58b5b48b93b
parent 23778 4cae4182a42da945becdfbd50a3f5bfbc49e654d
child 23780 c873dcbffea98dd899fe48e49dbb7e26ff352d60
push id4722
push userphilringnalda@gmail.com
push dateFri, 16 Jan 2009 04:03:22 +0000
treeherdermozilla-central@57e38d817e3f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs422340
milestone1.9.2a1pre
Bug 422340 Firefox 3 beta 4 gives unhelpful slowscript warning on leaving gmail, r+sr=mrbkap
js/src/xpconnect/src/XPCSafeJSObjectWrapper.cpp
--- a/js/src/xpconnect/src/XPCSafeJSObjectWrapper.cpp
+++ b/js/src/xpconnect/src/XPCSafeJSObjectWrapper.cpp
@@ -391,20 +391,21 @@ UnwrapJSValue(jsval val)
 }
 
 // Get a scripted function for use with the safe wrapper (obj) when
 // accessing an unsafe object (unsafeObj). If a scripted function
 // already exists in the reserved slot slotIndex, use it, otherwise
 // create a new one and cache it in that same slot. The source of the
 // script is passed in funScript, and the resulting (new or cached)
 // scripted function is returned through scriptedFunVal.
+/* Keep GetScriptedFunction prototype in sync with corresponding macro */
 static JSBool
 GetScriptedFunction(JSContext *cx, JSObject *obj, JSObject *unsafeObj,
                     uint32 slotIndex, const nsAFlatCString& funScript,
-                    jsval *scriptedFunVal)
+                    jsval *scriptedFunVal, uintN lineno)
 {
   if (!::JS_GetReservedSlot(cx, obj, slotIndex, scriptedFunVal)) {
     return JS_FALSE;
   }
 
   // If we either have no scripted function in the requested slot yet,
   // or if the scope of the unsafeObj changed since we compiled the
   // scripted function, re-compile to make sure the scripted function
@@ -437,17 +438,17 @@ GetScriptedFunction(JSContext *cx, JSObj
     }
 
     JSFunction *scriptedFun =
       ::JS_CompileFunctionForPrincipals(cx,
                                         JS_GetGlobalForObject(cx, unsafeObj),
                                         jsprin, nsnull, 0, nsnull,
                                         funScript.get(), funScript.Length(),
                                         "XPCSafeJSObjectWrapper.cpp",
-                                        __LINE__);
+                                        lineno);
 
     JSPRINCIPALS_DROP(cx, jsprin);
 
     if (!scriptedFun) {
       return ThrowException(NS_ERROR_FAILURE, cx);
     }
 
     *scriptedFunVal = OBJECT_TO_JSVAL(::JS_GetFunctionObject(scriptedFun));
@@ -456,16 +457,18 @@ GetScriptedFunction(JSContext *cx, JSObj
         !::JS_SetReservedSlot(cx, obj, slotIndex, *scriptedFunVal)) {
       return JS_FALSE;
     }
   }
 
   return JS_TRUE;
 }
 
+#define GetScriptedFunction(cx, obj, unsafeObj, slotIndex, funScript, scriptedFunVal) \
+  (GetScriptedFunction)(cx, obj, unsafeObj, slotIndex, funScript, scriptedFunVal, __LINE__)
 
 static JSBool
 XPC_SJOW_AddProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
 {
   // The constructor and toString properties needs to live on the safe
   // wrapper.
   if (id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_CONSTRUCTOR) ||
       id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {