Bug 821809 - Part1: Assert for nsEP in DOMWindow. r=bholley
authorGabor Krizsanits <gkrizsanits@mozilla.com>
Thu, 10 Apr 2014 19:52:41 +0200
changeset 178017 4f10a9050474ebc00d9e6f6df92fae38613fd6ca
parent 178016 a9dd8675e77637c04fd1e47b5fd0d016057a4b12
child 178018 47b01425f40c0bd9ee55283981f6dce0be2c7f35
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbholley
bugs821809
milestone31.0a1
Bug 821809 - Part1: Assert for nsEP in DOMWindow. r=bholley
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -2184,16 +2184,21 @@ CreateNativeGlobalForInner(JSContext* aC
                            nsIPrincipal* aPrincipal,
                            JS::MutableHandle<JSObject*> aGlobal)
 {
   MOZ_ASSERT(aCx);
   MOZ_ASSERT(aNewInner);
   MOZ_ASSERT(aNewInner->IsInnerWindow());
   MOZ_ASSERT(aPrincipal);
 
+  // DOMWindow with nsEP is not supported, we have to make sure
+  // no one creates one accidentally.
+  nsCOMPtr<nsIExpandedPrincipal> nsEP = do_QueryInterface(aPrincipal);
+  MOZ_RELEASE_ASSERT(!nsEP, "DOMWindow with nsEP is not supported");
+
   nsGlobalWindow *top = nullptr;
   if (aNewInner->GetOuterWindow()) {
     top = aNewInner->GetTop();
   }
   JS::CompartmentOptions options;
   if (top) {
     if (top->GetGlobalJSObject()) {
       options.setSameZoneAs(top->GetGlobalJSObject());