Bug 1560553 part 2. Improve the assertions in MaybeWrapNonDOMObjectValue. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 27 Jun 2019 16:13:32 +0000
changeset 480392 0b533d8d086e4828cb712061ff95e5ee1527bbd5
parent 480391 1bf78850148bd7dd06e451ae9a60c627c7066b88
child 480393 d718ce2ad6edcd10c926cfde53eb9ce5c829ea42
push id36212
push userrmaries@mozilla.com
push dateFri, 28 Jun 2019 03:45:44 +0000
treeherdermozilla-central@a72f0a08f652 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1560553
milestone69.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 1560553 part 2. Improve the assertions in MaybeWrapNonDOMObjectValue. r=peterv We don't need to worry about JSCLASS_PRIVATE_IS_NSISUPPORTS, because the only work we're really skipping here compared to MaybeWrapObjectValue is the TryToOuterize call, and that only matters for Window objects, which always have a DOM class. Differential Revision: https://phabricator.services.mozilla.com/D35534
dom/bindings/BindingUtils.h
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -911,24 +911,26 @@ bool MaybeWrapObjectOrNullValue(JSContex
                                 JS::MutableHandle<JS::Value> rval) {
   MOZ_ASSERT(rval.isObjectOrNull());
   if (rval.isNull()) {
     return true;
   }
   return MaybeWrapObjectValue(cx, rval);
 }
 
-// Wrapping for objects that are known to not be DOM or XPConnect objects
+// Wrapping for objects that are known to not be DOM objects
 MOZ_ALWAYS_INLINE
 bool MaybeWrapNonDOMObjectValue(JSContext* cx,
                                 JS::MutableHandle<JS::Value> rval) {
   MOZ_ASSERT(rval.isObject());
+  // Compared to MaybeWrapObjectValue we just skip the TryToOuterize call.  The
+  // only reason it would be needed is if we have a Window object, which would
+  // have a DOM class.  Assert that we don't have any DOM-class objects coming
+  // through here.
   MOZ_ASSERT(!GetDOMClass(&rval.toObject()));
-  MOZ_ASSERT(!(js::GetObjectClass(&rval.toObject())->flags &
-               JSCLASS_PRIVATE_IS_NSISUPPORTS));
 
   JSObject* obj = &rval.toObject();
   if (js::GetObjectCompartment(obj) == js::GetContextCompartment(cx)) {
     return true;
   }
   return JS_WrapValue(cx, rval);
 }