Bug 1287776 - eliminate assignment from MOZ_ASSERT in EnsureContentXBLScope. r?bholley draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Tue, 19 Jul 2016 21:57:37 +0300
changeset 389652 e8e880fb0ce76a286857ec638ee6925d80c1d426
parent 389550 5a91e5b49be3c1ba401b057e90c92d7488e3647d
child 525814 d62cf35c540eb13cd4ae1812ea1498234dd49f9b
push id23475
push userbmo:bpostelnicu@mozilla.com
push dateTue, 19 Jul 2016 19:04:16 +0000
reviewersbholley
bugs1287776
milestone50.0a1
Bug 1287776 - eliminate assignment from MOZ_ASSERT in EnsureContentXBLScope. r?bholley MozReview-Commit-ID: 47a4XSAiQRP
js/xpconnect/src/XPCWrappedNativeScope.cpp
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -287,21 +287,20 @@ XPCWrappedNativeScope::EnsureContentXBLS
     SandboxOptions options;
     options.wantXrays = false;
     options.wantComponents = true;
     options.proto = global;
     options.sameZoneAs = global;
 
     // Use an nsExpandedPrincipal to create asymmetric security.
     nsIPrincipal* principal = GetPrincipal();
-    nsCOMPtr<nsIExpandedPrincipal> ep;
-    MOZ_ASSERT(!(ep = do_QueryInterface(principal)));
+    MOZ_ASSERT(!nsContentUtils::IsExpandedPrincipal(principal));
     nsTArray< nsCOMPtr<nsIPrincipal> > principalAsArray(1);
     principalAsArray.AppendElement(principal);
-    ep = new nsExpandedPrincipal(principalAsArray);
+    nsCOMPtr<nsIExpandedPrincipal> ep = new nsExpandedPrincipal(principalAsArray);
 
     // Create the sandbox.
     RootedValue v(cx);
     nsresult rv = CreateSandboxObject(cx, &v, ep, options);
     NS_ENSURE_SUCCESS(rv, nullptr);
     mContentXBLScope = &v.toObject();
 
     // Tag it.