diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 2ad3e874e68..24a5b934057 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -4540,6 +4540,23 @@ NS_IMETHODIMP nsWindowSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj, JSObject **parentObj) { +#ifdef DEBUG + { + nsGlobalWindow *win = nsGlobalWindow::FromSupports(nativeObj); + if (win->IsChromeWindow()) { + nsCOMPtr principal; + nsresult rv = + sSecMan->GetObjectPrincipal(cx, globalObj, getter_AddRefs(principal)); + if (NS_SUCCEEDED(rv)) { + PRBool isSystem; + rv = sSecMan->IsSystemPrincipal(principal, &isSystem); + NS_ASSERTION(NS_SUCCEEDED(rv) && isSystem, + "Why are we wrapping a chrome window in a content scope?"); + } + } + } +#endif + // Normally ::PreCreate() is used to give XPConnect the parent // object for the object that's being wrapped, this parent object is // set as the parent of the wrapper and it's also used to find the