Bug 854196 - Don't call GetWindowInternal directly, and make assertions harder to ignore; r=bz

This commit is contained in:
Ms2ger 2013-04-04 09:03:26 +02:00
parent 0d51d547b4
commit 957e2e77af
3 changed files with 6 additions and 8 deletions

View File

@ -4142,8 +4142,8 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
nsIScriptGlobalObject*
nsDocument::GetScriptHandlingObjectInternal() const
{
NS_ASSERTION(!mScriptGlobalObject,
"Do not call this when mScriptGlobalObject is set!");
MOZ_ASSERT(!mScriptGlobalObject,
"Do not call this when mScriptGlobalObject is set!");
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
do_QueryReferent(mScriptObject);
@ -4175,7 +4175,7 @@ nsDocument::SetScriptHandlingObject(nsIScriptGlobalObject* aScriptObject)
nsPIDOMWindow *
nsDocument::GetWindowInternal() const
{
NS_ASSERTION(!mWindow, "This should not be called when mWindow is not null!");
MOZ_ASSERT(!mWindow, "This should not be called when mWindow is not null!");
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(GetScriptGlobalObject()));
@ -4189,8 +4189,8 @@ nsDocument::GetWindowInternal() const
nsPIDOMWindow *
nsDocument::GetInnerWindowInternal()
{
NS_ASSERTION(mRemovedFromDocShell,
"This document should have been removed from docshell!");
MOZ_ASSERT(mRemovedFromDocShell,
"This document should have been removed from docshell!");
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(GetScriptGlobalObject()));

View File

@ -1421,7 +1421,7 @@ nsHTMLDocument::Open(JSContext* /* unused */,
NS_ASSERTION(nsContentUtils::CanCallerAccess(static_cast<nsIDOMHTMLDocument*>(this)),
"XOW should have caught this!");
nsCOMPtr<nsIDOMWindow> window = GetWindowInternal();
nsCOMPtr<nsIDOMWindow> window = GetWindow();
if (!window) {
rv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
return nullptr;

View File

@ -18,8 +18,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=741266
<pre id="test">
<script type="application/javascript">
SimpleTest.expectAssertions(1);
/** Test for Bug 741266 **/
var w = window.open("", "", "width=100,height=100");
is(w.innerHeight, 100, "Popup height should be 100 when opened with window.open");