Bug 655098 - Root the jsid stored in NPObjectMemberPrivate.methodName, r=cdleary,mrbkap
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 06 May 2011 11:24:05 -0400
changeset 71373 49e57fa259dc21511d34be89a6f08a10f4ddd832
parent 71372 1a885e035d71b274acca6687b23f26642017e8d7
child 71374 b7502e9fbd30a2992d97e6964a4dc69b5a99f959
push id159
push usereakhgari@mozilla.com
push dateTue, 16 Aug 2011 17:53:11 +0000
treeherdermozilla-beta@8786e3e49240 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscdleary, mrbkap
bugs655098
milestone7.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 655098 - Root the jsid stored in NPObjectMemberPrivate.methodName, r=cdleary,mrbkap
dom/plugins/base/nsJSNPRuntime.cpp
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -2295,16 +2295,21 @@ NPObjectMember_Call(JSContext *cx, uintN
 static void
 NPObjectMember_Trace(JSTracer *trc, JSObject *obj)
 {
   NPObjectMemberPrivate *memberPrivate =
     (NPObjectMemberPrivate *)::JS_GetPrivate(trc->context, obj);
   if (!memberPrivate)
     return;
 
+  // Our NPIdentifier is not always interned, so we must root it explicitly.
+  jsid id = NPIdentifierToJSId(memberPrivate->methodName);
+  if (JSID_IS_STRING(id))
+    JS_CALL_STRING_TRACER(trc, JSID_TO_STRING(id), "NPObjectMemberPrivate.methodName");
+
   if (!JSVAL_IS_PRIMITIVE(memberPrivate->fieldValue)) {
     JS_CALL_VALUE_TRACER(trc, memberPrivate->fieldValue,
                          "NPObject Member => fieldValue");
   }
 
   // There's no strong reference from our private data to the
   // NPObject, so make sure to mark the NPObject wrapper to keep the
   // NPObject alive as long as this NPObjectMember is alive.