Bug 787070 - Expandos on the xray of DOM prototypes should have effect on xrays of DOM nodes, give the WindowNamedPropertiesHandler a DOMIfaceAndProtoJSClass. r=bz.
authorPeter Van der Beken <peterv@propagandism.org>
Fri, 05 Sep 2014 22:09:50 +0200
changeset 207610 591364ca5f0a
parent 207609 666f2599f996
child 207611 024db535ce4d
push id49735
push userpvanderbeken@mozilla.com
push dateMon, 29 Sep 2014 07:58:28 +0000
treeherdermozilla-inbound@090b62fdfd21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs787070
milestone35.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 787070 - Expandos on the xray of DOM prototypes should have effect on xrays of DOM nodes, give the WindowNamedPropertiesHandler a DOMIfaceAndProtoJSClass. r=bz.
dom/base/WindowNamedPropertiesHandler.cpp
--- a/dom/base/WindowNamedPropertiesHandler.cpp
+++ b/dom/base/WindowNamedPropertiesHandler.cpp
@@ -201,32 +201,53 @@ bool
 WindowNamedPropertiesHandler::delete_(JSContext* aCx,
                                       JS::Handle<JSObject*> aProxy,
                                       JS::Handle<jsid> aId, bool* aBp) const
 {
   *aBp = false;
   return true;
 }
 
+const NativePropertyHooks sWindowNamedPropertiesNativePropertyHooks[] = { {
+  nullptr,
+  nullptr,
+  { nullptr, nullptr },
+  prototypes::id::_ID_Count,
+  constructors::id::_ID_Count,
+  nullptr
+} };
+
+static const DOMIfaceAndProtoJSClass WindowNamedPropertiesClass = {
+  PROXY_CLASS_DEF("WindowProperties",
+                  DOM_INTERFACE_PROTO_SLOTS_BASE, /* extra slots */
+                  0),
+  eInterfacePrototype,
+  sWindowNamedPropertiesNativePropertyHooks,
+  "[object WindowProperties]",
+  prototypes::id::_ID_Count,
+  0,
+};
+
 // static
 void
 WindowNamedPropertiesHandler::Install(JSContext* aCx,
                                       JS::Handle<JSObject*> aProto)
 {
   JS::Rooted<JSObject*> protoProto(aCx);
   if (!::JS_GetPrototype(aCx, aProto, &protoProto)) {
     return;
   }
 
   // Note: since the scope polluter proxy lives on the window's prototype
   // chain, it needs a singleton type to avoid polluting type information
   // for properties on the window.
   JS::Rooted<JSObject*> gsp(aCx);
   js::ProxyOptions options;
   options.setSingleton(true);
+  options.setClass(&WindowNamedPropertiesClass.mBase);
   gsp = js::NewProxyObject(aCx, WindowNamedPropertiesHandler::getInstance(),
                            JS::NullHandleValue, protoProto,
                            js::GetGlobalForObjectCrossCompartment(aProto),
                            options);
   if (!gsp) {
     return;
   }