Bug 1516691 - use a release assert to prevent this scenario in release builds; r=bzbarsky
authorAlex Gaynor <agaynor@mozilla.com>
Wed, 13 Feb 2019 21:57:26 +0000
changeset 459576 40545233f9fec17e4dfdd766353f1910bb5c9030
parent 459575 60cb2cb96e5e212b34774c04a6a5582d03e07357
child 459577 ddf96b931e4be1fe955bad632a1505a16962d7a4
push id35563
push userccoroiu@mozilla.com
push dateSat, 16 Feb 2019 09:36:04 +0000
treeherdermozilla-central@1cfd69d05aa1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1516691
milestone67.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 1516691 - use a release assert to prevent this scenario in release builds; r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D19505
dom/base/nsINode.cpp
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -2653,20 +2653,21 @@ JSObject* nsINode::WrapObject(JSContext*
   bool hasHadScriptHandlingObject = false;
   if (!OwnerDoc()->GetScriptHandlingObject(hasHadScriptHandlingObject) &&
       !hasHadScriptHandlingObject && !nsContentUtils::IsSystemCaller(aCx)) {
     Throw(aCx, NS_ERROR_UNEXPECTED);
     return nullptr;
   }
 
   JS::Rooted<JSObject*> obj(aCx, WrapNode(aCx, aGivenProto));
-  MOZ_ASSERT_IF(
-      obj && ChromeOnlyAccess(),
-      JS::GetNonCCWObjectGlobal(obj) == xpc::UnprivilegedJunkScope() ||
-          xpc::IsInUAWidgetScope(obj) || xpc::AccessCheck::isChrome(obj));
+  if (obj && ChromeOnlyAccess()) {
+    MOZ_RELEASE_ASSERT(
+        JS::GetNonCCWObjectGlobal(obj) == xpc::UnprivilegedJunkScope() ||
+        xpc::IsInUAWidgetScope(obj) || xpc::AccessCheck::isChrome(obj));
+  }
   return obj;
 }
 
 already_AddRefed<nsINode> nsINode::CloneNode(bool aDeep, ErrorResult& aError) {
   return nsNodeUtils::CloneNodeImpl(this, aDeep, aError);
 }
 
 nsDOMAttributeMap* nsINode::GetAttributes() {