Bug 860941 - Stop clearing return values on navigation. r=jst

Since this stuff is a property on the browsing context, this only makes sense
as a security check. But now that we're using a DialogValueHolder, the origin
checks are taken care of. So we can kill this off.
This commit is contained in:
Bobby Holley 2013-05-16 23:33:15 -07:00
parent 3072f4271d
commit 6e3c37021b
3 changed files with 4 additions and 20 deletions

View File

@ -11630,21 +11630,6 @@ nsGlobalModalWindow::SetReturnValue(nsIVariant *aRetVal)
return NS_OK;
}
nsresult
nsGlobalModalWindow::SetNewDocument(nsIDocument *aDocument,
nsISupports *aState,
bool aForceReuseInnerWindow)
{
MOZ_ASSERT(aDocument);
// If we're loading a new document into a modal dialog, clear the
// return value that was set, if any, by the current document.
mReturnValue = nullptr;
return nsGlobalWindow::SetNewDocument(aDocument, aState,
aForceReuseInnerWindow);
}
void
nsGlobalWindow::SetHasAudioAvailableEventListeners()
{

View File

@ -1332,10 +1332,6 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGlobalModalWindow, nsGlobalWindow)
virtual NS_HIDDEN_(nsresult) SetNewDocument(nsIDocument *aDocument,
nsISupports *aState,
bool aForceReuseInnerWindow);
protected:
// For use by outer windows only.
nsRefPtr<DialogValueHolder> mReturnValue;

View File

@ -27,7 +27,10 @@ function runTest() {
window.addEventListener("message", onMsgRcv, false);
var result = window.showModalDialog("file_bug504862.html", "my args");
is(result, null, "window sees previous dialog documents return value.");
// NB: We used to clear returnValue on each navigation, but now we do a
// security check on access, so we can safely make returnValue live on
// the browsing context, per spec.
is(result, 3, "window sees previous dialog documents return value.");
result = window.showModalDialog("http://test1.example.com/tests/dom/tests/mochitest/bugs/file_bug504862.html", "my args");