From 3d0e47e04e7eda406358647ab38b398a2ea2e06e Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Thu, 16 May 2013 23:33:15 -0700 Subject: [PATCH] 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. --- dom/base/nsGlobalWindow.cpp | 15 --------------- dom/base/nsGlobalWindow.h | 4 ---- dom/tests/mochitest/bugs/test_bug504862.html | 5 ++++- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 9988c40acfd4..8288978ead53 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -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() { diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 2d42581a9db1..a5d71e571a8d 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -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 mReturnValue; diff --git a/dom/tests/mochitest/bugs/test_bug504862.html b/dom/tests/mochitest/bugs/test_bug504862.html index 63e06e1e241e..5d61a0b4eec2 100644 --- a/dom/tests/mochitest/bugs/test_bug504862.html +++ b/dom/tests/mochitest/bugs/test_bug504862.html @@ -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");