Bug 1041626 - Only define unforgeable attributes on instances, and do a call to XrayEnumerateNativeProps when |type| is still set to eInstance. r=bz, a=sledru
authorBobby Holley <bobbyholley@gmail.com>
Wed, 23 Jul 2014 12:36:21 -0700
changeset 217274 e0a751a852390886dd5877b5955d845c485752b4
parent 217273 4bee07e2ba798d2f311965d73391ef63de0108ff
child 217275 217d09d459e1a5cdc0d87872d1983da1fa89e28b
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, sledru
bugs1041626
milestone33.0a2
Bug 1041626 - Only define unforgeable attributes on instances, and do a call to XrayEnumerateNativeProps when |type| is still set to eInstance. r=bz, a=sledru
dom/bindings/BindingUtils.cpp
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -1379,28 +1379,26 @@ XrayEnumerateAttributesOrMethods(JSConte
 
 bool
 XrayEnumerateProperties(JSContext* cx, JS::Handle<JSObject*> wrapper,
                         JS::Handle<JSObject*> obj,
                         unsigned flags, JS::AutoIdVector& props,
                         DOMObjectType type,
                         const NativeProperties* nativeProperties)
 {
-  if (type == eInterface) {
+  if (type == eInstance) {
+    ENUMERATE_IF_DEFINED(unforgeableMethod);
+    ENUMERATE_IF_DEFINED(unforgeableAttribute);
+  } else if (type == eInterface) {
     ENUMERATE_IF_DEFINED(staticMethod);
-  } else {
-    ENUMERATE_IF_DEFINED(method);
-    ENUMERATE_IF_DEFINED(unforgeableMethod);
-  }
-
-  if (type == eInterface) {
     ENUMERATE_IF_DEFINED(staticAttribute);
   } else {
+    MOZ_ASSERT(type == eInterfacePrototype);
+    ENUMERATE_IF_DEFINED(method);
     ENUMERATE_IF_DEFINED(attribute);
-    ENUMERATE_IF_DEFINED(unforgeableAttribute);
   }
 
   if (nativeProperties->constants) {
     const Prefable<const ConstantSpec>* constant;
     for (constant = nativeProperties->constants; constant->specs; ++constant) {
       if (constant->isEnabled(cx, obj)) {
         // Set i to be the index into our full list of ids/specs that we're
         // looking at now.
@@ -1468,16 +1466,22 @@ XrayEnumerateProperties(JSContext* cx, J
 
   if (type == eInstance) {
     if (nativePropertyHooks->mEnumerateOwnProperties &&
         !nativePropertyHooks->mEnumerateOwnProperties(cx, wrapper, obj,
                                                       props)) {
       return false;
     }
 
+    // Handle Unforgeable properties.
+    if (!XrayEnumerateNativeProperties(cx, wrapper, nativePropertyHooks, type,
+                                       obj, flags, props)) {
+      return false;
+    }
+
     if (flags & JSITER_OWNONLY) {
       return true;
     }
 
     // Force the type to be eInterfacePrototype, since we need to walk the
     // prototype chain.
     type = eInterfacePrototype;
   }