Bug 658909 - Remove GWNOJO from MarkWrappedNative. r=mrbkap
authorBobby Holley <bobbyholley@gmail.com>
Sat, 16 Mar 2013 22:58:15 -0700
changeset 125059 5dbc6f79a2a2b39840851338db0f3737f009110b
parent 125058 b0899c816e8f9049c1fbfc07ff2048661641cdbc
child 125060 06852afa8721257547f926a6343d98c28c03d87f
push id24762
push userbobbyholley@gmail.com
push dateSun, 17 Mar 2013 05:58:40 +0000
treeherdermozilla-inbound@3a5f73a4f816 [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);
 }