Bug 1532025 - Remove support for WrappedNatives from PreserveWrapper, since we don't have DOM objects using WrappedNatives anymore. r=mccr8
authorPeter Van der Beken <peterv@propagandism.org>
Thu, 28 Mar 2019 14:19:53 +0000
changeset 466581 d16eea45675c819581acfeeeb4a755f05de1a0e1
parent 466580 7b6c2f74693d34dc4600fa53332b9ded5f2597c4
child 466582 2c42dfe47d1a0cefcc31a4828477b2d016830282
push id35773
push userncsoregi@mozilla.com
push dateFri, 29 Mar 2019 04:11:36 +0000
treeherdermozilla-central@01c0722546ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1532025
milestone68.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 1532025 - Remove support for WrappedNatives from PreserveWrapper, since we don't have DOM objects using WrappedNatives anymore. r=mccr8 Differential Revision: https://phabricator.services.mozilla.com/D21832
js/src/builtin/WeakMapObject-inl.h
js/xpconnect/src/XPCJSRuntime.cpp
--- a/js/src/builtin/WeakMapObject-inl.h
+++ b/js/src/builtin/WeakMapObject-inl.h
@@ -11,19 +11,17 @@
 
 #include "vm/ProxyObject.h"
 
 #include "gc/WeakMap-inl.h"
 
 namespace js {
 
 static bool TryPreserveReflector(JSContext* cx, HandleObject obj) {
-  if (obj->getClass()->isWrappedNative() || obj->getClass()->isDOMClass() ||
-      (obj->is<ProxyObject>() && obj->as<ProxyObject>().handler()->family() ==
-                                     GetDOMProxyHandlerFamily())) {
+  if (obj->getClass()->isDOMClass()) {
     MOZ_ASSERT(cx->runtime()->preserveWrapperCallback);
     if (!cx->runtime()->preserveWrapperCallback(cx, obj)) {
       JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                                 JSMSG_BAD_WEAKMAP_KEY);
       return false;
     }
   }
   return true;
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -2786,20 +2786,19 @@ static void DestroyRealm(JSFreeOp* fop, 
   // cleanup for us), and null out the private field.
   mozilla::UniquePtr<RealmPrivate> priv(RealmPrivate::Get(realm));
   JS::SetRealmPrivate(realm, nullptr);
 }
 
 static bool PreserveWrapper(JSContext* cx, JS::Handle<JSObject*> obj) {
   MOZ_ASSERT(cx);
   MOZ_ASSERT(obj);
-  MOZ_ASSERT(IS_WN_REFLECTOR(obj) || mozilla::dom::IsDOMObject(obj));
-
-  return mozilla::dom::IsDOMObject(obj) &&
-         mozilla::dom::TryPreserveWrapper(obj);
+  MOZ_ASSERT(mozilla::dom::IsDOMObject(obj));
+
+  return mozilla::dom::TryPreserveWrapper(obj);
 }
 
 static nsresult ReadSourceFromFilename(JSContext* cx, const char* filename,
                                        char16_t** src, size_t* len) {
   nsresult rv;
 
   // mozJSSubScriptLoader prefixes the filenames of the scripts it loads with
   // the filename of its caller. Axe that if present.