Bug 1392352 - Part 1 - Interpose all objects; draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Thu, 05 Oct 2017 15:58:46 -0700
changeset 755809 a0b1511d5db512886bd1b8c7a50026e44ba1686b
parent 755808 d7dd491bb29bc5202a89e4458ed78cd992d49180
child 755810 fac2e8510d18beb8ec11fa3bb99bc50b68a44675
push id99284
push userbgrinstead@mozilla.com
push dateThu, 15 Feb 2018 20:01:29 +0000
bugs1392352, 1412456
milestone60.0a1
Bug 1392352 - Part 1 - Interpose all objects; We used to attempt interposition only for DOM instances and wrapped natives, but now that tests are the only thing still using interposition this removes the optimization. This is needed so that `gBrowser` can continue to be interposed as a plain JS object, until addon interposition is removed entirely (in Bug 1412456). MozReview-Commit-ID: LSAmAg9Lqd5
js/xpconnect/wrappers/AddonWrapper.cpp
--- a/js/xpconnect/wrappers/AddonWrapper.cpp
+++ b/js/xpconnect/wrappers/AddonWrapper.cpp
@@ -37,28 +37,18 @@ ReportASCIIErrorWithId(JSContext* cx, co
         return;
     JS_ReportErrorUTF8(cx, msg, bytes.ptr());
 }
 
 bool
 InterposeProperty(JSContext* cx, HandleObject target, const nsIID* iid, HandleId id,
                   MutableHandle<PropertyDescriptor> descriptor)
 {
-    // We only want to do interpostion on DOM instances and
-    // wrapped natives.
     RootedObject unwrapped(cx, UncheckedUnwrap(target));
-    const js::Class* clasp = js::GetObjectClass(unwrapped);
     bool isCPOW = jsipc::IsWrappedCPOW(unwrapped);
-    if (!mozilla::dom::IsDOMClass(clasp) &&
-        !IS_WN_CLASS(clasp) &&
-        !IS_PROTO_CLASS(clasp) &&
-        clasp != &OuterWindowProxyClass &&
-        !isCPOW) {
-        return true;
-    }
 
     XPCWrappedNativeScope* scope = ObjectScope(CurrentGlobalOrNull(cx));
     MOZ_ASSERT(scope->HasInterposition());
 
     nsCOMPtr<nsIAddonInterposition> interp = scope->GetInterposition();
     InterpositionWhitelist* wl = XPCWrappedNativeScope::GetInterpositionWhitelist(interp);
     // We do InterposeProperty only if the id is on the whitelist of the interpostion
     // or if the target is a CPOW.