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");