Bug 821809 - Part1: Assert for nsEP in DOMWindow. r=bholley a=abillings
authorGabor Krizsanits <gkrizsanits@mozilla.com>
Thu, 10 Apr 2014 19:52:41 +0200
changeset 192783 aa7423a1d83c1f61dd04a951b618949d1c04f26f
parent 192782 e5d8af7e112d43614c78760219a4ab7993b02f0b
child 192784 902765e9c65a81be34361d11eb64c6e5b53eddb8
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley, abillings
bugs821809
milestone30.0a2
Bug 821809 - Part1: Assert for nsEP in DOMWindow. r=bholley a=abillings
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -2181,16 +2181,21 @@ CreateNativeGlobalForInner(JSContext* aC
                            nsIXPConnectJSObjectHolder** aHolder)
 {
   MOZ_ASSERT(aCx);
   MOZ_ASSERT(aNewInner);
   MOZ_ASSERT(aNewInner->IsInnerWindow());
   MOZ_ASSERT(aPrincipal);
   MOZ_ASSERT(aHolder);
 
+  // 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());