Bug 658909 - Remove GWNOJO from MarkWrappedNative. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Thu, 21 Mar 2013 08:20:43 -0700
changeset 125811 a5d11e2a9602cf238be5fd4df98a8d60cb3b812a
parent 125810 52f0155a3c43359d51c88028959c2fb00aede8dd
child 125812 b2716f274a9484004e681cb8e68d8312c95749ec
push id24464
push useremorley@mozilla.com
push dateFri, 22 Mar 2013 14:00:12 +0000
treeherdermozilla-central@3825fdbcec62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs658909
milestone22.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 658909 - Remove GWNOJO from MarkWrappedNative. r=mrbkap
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -659,29 +659,27 @@ TraceInsideSlimWrapper(JSTracer *trc, JS
 
 static void
 MarkWrappedNative(JSTracer *trc, JSObject *obj)
 {
     js::Class* clazz = js::GetObjectClass(obj);
     if (clazz->flags & JSCLASS_DOM_GLOBAL) {
         mozilla::dom::TraceProtoAndIfaceCache(trc, obj);
     }
-
-    JSObject *obj2;
+    MOZ_ASSERT(IS_WRAPPER_CLASS(clazz));
 
-    // Pass null for the first JSContext* parameter  to skip any security
-    // checks and to avoid potential state change there.
-    XPCWrappedNative* wrapper =
-        XPCWrappedNative::GetWrappedNativeOfJSObject(nullptr, obj, nullptr, &obj2);
-
-    if (wrapper) {
-        if (wrapper->IsValid())
-            wrapper->TraceInside(trc);
-    } else if (obj2) {
-        TraceInsideSlimWrapper(trc, obj2);
+    if (IS_WN_WRAPPER_OBJECT(obj)) {
+        XPCWrappedNative *wrapper = XPCWrappedNative::Get(obj);
+        if (wrapper) {
+            if (wrapper->IsValid())
+                wrapper->TraceInside(trc);
+        }
+    } else {
+        MOZ_ASSERT(IS_SLIM_WRAPPER_OBJECT(obj));
+        TraceInsideSlimWrapper(trc, obj);
     }
 }
 
 static void
 XPC_WN_NoHelper_Trace(JSTracer *trc, JSObject *obj)
 {
     MarkWrappedNative(trc, obj);
 }