From a9290ef91ec408fa7886b99cc59be40b413a0ce0 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Tue, 21 Jan 2020 20:00:48 -0500 Subject: Issue #1366 - Completely remove showModalDialog --- dom/base/nsDeprecatedOperationList.h | 1 - dom/base/nsGlobalWindow.cpp | 333 +-------------------- dom/base/nsGlobalWindow.h | 61 +--- dom/base/nsPIDOMWindow.h | 10 - dom/base/nsSandboxFlags.h | 3 +- dom/base/test/mochitest.ini | 4 - dom/base/test/mutationobserver_dialog.html | 62 ---- dom/base/test/test_dialogArguments.html | 31 -- dom/base/test/test_mutationobservers.html | 22 -- dom/html/test/file_iframe_sandbox_c_if4.html | 11 +- dom/html/test/file_iframe_sandbox_j_if1.html | 30 -- dom/html/test/file_iframe_sandbox_j_if2.html | 28 -- dom/html/test/file_iframe_sandbox_j_if3.html | 27 -- dom/html/test/mochitest.ini | 10 +- dom/html/test/test_bug391777.html | 25 -- dom/html/test/test_iframe_sandbox_general.html | 2 +- dom/html/test/test_iframe_sandbox_modal.html | 122 -------- dom/locales/en-US/chrome/dom/dom.properties | 2 - .../recognition/test/test_nested_eventloop.html | 4 +- dom/tests/mochitest/bugs/file_bug291653.html | 28 -- dom/tests/mochitest/bugs/file_bug504862.html | 22 -- dom/tests/mochitest/bugs/mochitest.ini | 12 - dom/tests/mochitest/bugs/test_bug291653.html | 56 ---- dom/tests/mochitest/bugs/test_bug406375.html | 37 --- dom/tests/mochitest/bugs/test_bug414291.html | 6 - dom/tests/mochitest/bugs/test_bug437361.html | 72 ----- dom/tests/mochitest/bugs/test_bug479143.html | 44 --- dom/tests/mochitest/bugs/test_bug504862.html | 45 --- dom/tests/mochitest/bugs/test_bug61098.html | 22 -- dom/tests/mochitest/bugs/test_bug735237.html | 38 --- .../mochitest/general/file_showModalDialog.html | 35 --- dom/tests/mochitest/general/mochitest.ini | 3 - .../mochitest/general/test_showModalDialog.html | 60 ---- dom/webidl/Window.webidl | 14 - 34 files changed, 11 insertions(+), 1271 deletions(-) delete mode 100644 dom/base/test/mutationobserver_dialog.html delete mode 100644 dom/base/test/test_dialogArguments.html delete mode 100644 dom/html/test/file_iframe_sandbox_j_if1.html delete mode 100644 dom/html/test/file_iframe_sandbox_j_if2.html delete mode 100644 dom/html/test/file_iframe_sandbox_j_if3.html delete mode 100644 dom/html/test/test_bug391777.html delete mode 100644 dom/html/test/test_iframe_sandbox_modal.html delete mode 100644 dom/tests/mochitest/bugs/file_bug291653.html delete mode 100644 dom/tests/mochitest/bugs/file_bug504862.html delete mode 100644 dom/tests/mochitest/bugs/test_bug291653.html delete mode 100644 dom/tests/mochitest/bugs/test_bug406375.html delete mode 100644 dom/tests/mochitest/bugs/test_bug437361.html delete mode 100644 dom/tests/mochitest/bugs/test_bug479143.html delete mode 100644 dom/tests/mochitest/bugs/test_bug504862.html delete mode 100644 dom/tests/mochitest/bugs/test_bug735237.html delete mode 100644 dom/tests/mochitest/general/file_showModalDialog.html delete mode 100644 dom/tests/mochitest/general/test_showModalDialog.html (limited to 'dom') diff --git a/dom/base/nsDeprecatedOperationList.h b/dom/base/nsDeprecatedOperationList.h index ea4b05289..96a6c3ac0 100644 --- a/dom/base/nsDeprecatedOperationList.h +++ b/dom/base/nsDeprecatedOperationList.h @@ -34,7 +34,6 @@ DEPRECATED_OPERATION(UseOfCaptureEvents) DEPRECATED_OPERATION(UseOfReleaseEvents) DEPRECATED_OPERATION(UseOfDOM3LoadMethod) DEPRECATED_OPERATION(ChromeUseOfDOM3LoadMethod) -DEPRECATED_OPERATION(ShowModalDialog) DEPRECATED_OPERATION(Window_Content) DEPRECATED_OPERATION(SyncXMLHttpRequest) DEPRECATED_OPERATION(DataContainerEvent) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 47b46dda0..0587eb892 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -909,7 +909,6 @@ nsPIDOMWindow::nsPIDOMWindow(nsPIDOMWindowOuter *aOuterWindow) mMayHaveMouseEnterLeaveEventListener(false), mMayHavePointerEnterLeaveEventListener(false), mInnerObjectsFreed(false), - mIsModalContentWindow(false), mIsActive(false), mIsBackground(false), mMediaSuspend(Preferences::GetBool("media.block-autoplay-until-in-foreground", true) ? nsISuspendedTypes::SUSPENDED_BLOCK : nsISuspendedTypes::NONE_SUSPENDED), @@ -1957,7 +1956,6 @@ nsGlobalWindow::CleanUp() } mArguments = nullptr; - mDialogArguments = nullptr; CleanupCachedXBLHandlers(this); @@ -2195,7 +2193,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mControllers) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mArguments) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDialogArguments) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mReturnValue) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNavigator) @@ -2274,7 +2271,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow) NS_IMPL_CYCLE_COLLECTION_UNLINK(mControllers) NS_IMPL_CYCLE_COLLECTION_UNLINK(mArguments) - NS_IMPL_CYCLE_COLLECTION_UNLINK(mDialogArguments) NS_IMPL_CYCLE_COLLECTION_UNLINK(mReturnValue) NS_IMPL_CYCLE_COLLECTION_UNLINK(mNavigator) @@ -3019,8 +3015,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, } else { if (thisChrome) { newInnerWindow = nsGlobalChromeWindow::Create(this); - } else if (mIsModalContentWindow) { - newInnerWindow = nsGlobalModalWindow::Create(this); } else { newInnerWindow = nsGlobalWindow::Create(this); } @@ -3871,31 +3865,16 @@ nsGlobalWindow::SetArguments(nsIArray *aArguments) MOZ_ASSERT(IsOuterWindow()); nsresult rv; - // Historically, we've used the same machinery to handle openDialog arguments - // (exposed via window.arguments) and showModalDialog arguments (exposed via - // window.dialogArguments), even though the former is XUL-only and uses an XPCOM - // array while the latter is web-exposed and uses an arbitrary JS value. - // Moreover, per-spec |dialogArguments| is a property of the browsing context - // (outer), whereas |arguments| lives on the inner. - // // We've now mostly separated them, but the difference is still opaque to // nsWindowWatcher (the caller of SetArguments in this little back-and-forth // embedding waltz we do here). // // So we need to demultiplex the two cases here. nsGlobalWindow *currentInner = GetCurrentInnerWindowInternal(); - if (mIsModalContentWindow) { - // nsWindowWatcher blindly converts the original nsISupports into an array - // of length 1. We need to recover it, and then cast it back to the concrete - // object we know it to be. - nsCOMPtr supports = do_QueryElementAt(aArguments, 0, &rv); - NS_ENSURE_SUCCESS(rv, rv); - mDialogArguments = static_cast(supports.get()); - } else { - mArguments = aArguments; - rv = currentInner->DefineArgumentsProperty(aArguments); - NS_ENSURE_SUCCESS(rv, rv); - } + + mArguments = aArguments; + rv = currentInner->DefineArgumentsProperty(aArguments); + NS_ENSURE_SUCCESS(rv, rv); return NS_OK; } @@ -3904,7 +3883,6 @@ nsresult nsGlobalWindow::DefineArgumentsProperty(nsIArray *aArguments) { MOZ_ASSERT(IsInnerWindow()); - MOZ_ASSERT(!mIsModalContentWindow); // Handled separately. nsIScriptContext *ctx = GetOuterWindowInternal()->mContext; NS_ENSURE_TRUE(aArguments && ctx, NS_ERROR_NOT_INITIALIZED); @@ -5040,21 +5018,6 @@ nsGlobalWindow::IsPrivilegedChromeWindow(JSContext* aCx, JSObject* aObj) nsContentUtils::ObjectPrincipal(aObj) == nsContentUtils::GetSystemPrincipal(); } -/* static */ bool -nsGlobalWindow::IsShowModalDialogEnabled(JSContext*, JSObject*) -{ - static bool sAddedPrefCache = false; - static bool sIsDisabled; - static const char sShowModalDialogPref[] = "dom.disable_window_showModalDialog"; - - if (!sAddedPrefCache) { - Preferences::AddBoolVarCache(&sIsDisabled, sShowModalDialogPref, false); - sAddedPrefCache = true; - } - - return !sIsDisabled && !XRE_IsContentProcess(); -} - nsIDOMOfflineResourceList* nsGlobalWindow::GetApplicationCache(ErrorResult& aError) { @@ -9741,126 +9704,6 @@ nsGlobalWindow::ConvertDialogOptions(const nsAString& aOptions, } } -already_AddRefed -nsGlobalWindow::ShowModalDialogOuter(const nsAString& aUrl, - nsIVariant* aArgument, - const nsAString& aOptions, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - MOZ_RELEASE_ASSERT(IsOuterWindow()); - - if (mDoc) { - mDoc->WarnOnceAbout(nsIDocument::eShowModalDialog); - } - - if (!IsShowModalDialogEnabled()) { - aError.Throw(NS_ERROR_NOT_AVAILABLE); - return nullptr; - } - - RefPtr argHolder = - new DialogValueHolder(&aSubjectPrincipal, aArgument); - - // Before bringing up the window/dialog, unsuppress painting and flush - // pending reflows. - EnsureReflowFlushAndPaint(); - - if (!AreDialogsEnabled()) { - // We probably want to keep throwing here; silently doing nothing is a bit - // weird given the typical use cases of showModalDialog(). - aError.Throw(NS_ERROR_NOT_AVAILABLE); - return nullptr; - } - - if (ShouldPromptToBlockDialogs() && !ConfirmDialogIfNeeded()) { - aError.Throw(NS_ERROR_NOT_AVAILABLE); - return nullptr; - } - - nsCOMPtr dlgWin; - nsAutoString options(NS_LITERAL_STRING("-moz-internal-modal=1,status=1")); - - ConvertDialogOptions(aOptions, options); - - options.AppendLiteral(",scrollbars=1,centerscreen=1,resizable=0"); - - EnterModalState(); - uint32_t oldMicroTaskLevel = nsContentUtils::MicroTaskLevel(); - nsContentUtils::SetMicroTaskLevel(0); - aError = OpenInternal(aUrl, EmptyString(), options, - false, // aDialog - true, // aContentModal - true, // aCalledNoScript - true, // aDoJSFixups - true, // aNavigate - nullptr, argHolder, // args - nullptr, // aLoadInfo - false, // aForceNoOpener - getter_AddRefs(dlgWin)); - nsContentUtils::SetMicroTaskLevel(oldMicroTaskLevel); - LeaveModalState(); - if (aError.Failed()) { - return nullptr; - } - - nsCOMPtr dialog = do_QueryInterface(dlgWin); - if (!dialog) { - return nullptr; - } - - nsCOMPtr retVal; - aError = dialog->GetReturnValue(getter_AddRefs(retVal)); - MOZ_ASSERT(!aError.Failed()); - - return retVal.forget(); -} - -already_AddRefed -nsGlobalWindow::ShowModalDialog(const nsAString& aUrl, nsIVariant* aArgument, - const nsAString& aOptions, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - FORWARD_TO_OUTER_OR_THROW(ShowModalDialogOuter, - (aUrl, aArgument, aOptions, aSubjectPrincipal, - aError), aError, nullptr); -} - -void -nsGlobalWindow::ShowModalDialog(JSContext* aCx, const nsAString& aUrl, - JS::Handle aArgument, - const nsAString& aOptions, - JS::MutableHandle aRetval, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - MOZ_ASSERT(IsInnerWindow()); - - nsCOMPtr args; - aError = nsContentUtils::XPConnect()->JSToVariant(aCx, - aArgument, - getter_AddRefs(args)); - if (aError.Failed()) { - return; - } - - nsCOMPtr retVal = - ShowModalDialog(aUrl, args, aOptions, aSubjectPrincipal, aError); - if (aError.Failed()) { - return; - } - - JS::Rooted result(aCx); - if (retVal) { - aError = nsContentUtils::XPConnect()->VariantToJS(aCx, - FastGetGlobalJSObject(), - retVal, aRetval); - } else { - aRetval.setNull(); - } -} - class ChildCommandDispatcher : public Runnable { public: @@ -14613,174 +14456,6 @@ nsGlobalChromeWindow::TakeOpenerForInitialContentBrowser(mozIDOMWindowProxy** aO return NS_OK; } -// nsGlobalModalWindow implementation - -// QueryInterface implementation for nsGlobalModalWindow -NS_INTERFACE_MAP_BEGIN(nsGlobalModalWindow) - NS_INTERFACE_MAP_ENTRY(nsIDOMModalContentWindow) -NS_INTERFACE_MAP_END_INHERITING(nsGlobalWindow) - -NS_IMPL_ADDREF_INHERITED(nsGlobalModalWindow, nsGlobalWindow) -NS_IMPL_RELEASE_INHERITED(nsGlobalModalWindow, nsGlobalWindow) - - -void -nsGlobalWindow::GetDialogArgumentsOuter(JSContext* aCx, - JS::MutableHandle aRetval, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - MOZ_RELEASE_ASSERT(IsOuterWindow()); - MOZ_ASSERT(IsModalContentWindow(), - "This should only be called on modal windows!"); - - if (!mDialogArguments) { - MOZ_ASSERT(mIsClosed, "This window should be closed!"); - aRetval.setUndefined(); - return; - } - - // This does an internal origin check, and returns undefined if the subject - // does not subsumes the origin of the arguments. - JS::Rooted wrapper(aCx, GetWrapper()); - JSAutoCompartment ac(aCx, wrapper); - mDialogArguments->Get(aCx, wrapper, &aSubjectPrincipal, aRetval, aError); -} - -void -nsGlobalWindow::GetDialogArguments(JSContext* aCx, - JS::MutableHandle aRetval, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - FORWARD_TO_OUTER_OR_THROW(GetDialogArgumentsOuter, - (aCx, aRetval, aSubjectPrincipal, aError), - aError, ); -} - -/* static */ already_AddRefed -nsGlobalModalWindow::Create(nsGlobalWindow *aOuterWindow) -{ - RefPtr window = new nsGlobalModalWindow(aOuterWindow); - window->InitWasOffline(); - return window.forget(); -} - -NS_IMETHODIMP -nsGlobalModalWindow::GetDialogArguments(nsIVariant **aArguments) -{ - FORWARD_TO_OUTER_MODAL_CONTENT_WINDOW(GetDialogArguments, (aArguments), - NS_ERROR_NOT_INITIALIZED); - - // This does an internal origin check, and returns undefined if the subject - // does not subsumes the origin of the arguments. - return mDialogArguments->Get(nsContentUtils::SubjectPrincipal(), aArguments); -} - -/* static */ already_AddRefed -nsGlobalWindow::Create(nsGlobalWindow *aOuterWindow) -{ - RefPtr window = new nsGlobalWindow(aOuterWindow); - window->InitWasOffline(); - return window.forget(); -} - -void -nsGlobalWindow::InitWasOffline() -{ - mWasOffline = NS_IsOffline(); -} - -void -nsGlobalWindow::GetReturnValueOuter(JSContext* aCx, - JS::MutableHandle aReturnValue, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - MOZ_RELEASE_ASSERT(IsOuterWindow()); - MOZ_ASSERT(IsModalContentWindow(), - "This should only be called on modal windows!"); - - if (mReturnValue) { - JS::Rooted wrapper(aCx, GetWrapper()); - JSAutoCompartment ac(aCx, wrapper); - mReturnValue->Get(aCx, wrapper, &aSubjectPrincipal, aReturnValue, aError); - } else { - aReturnValue.setUndefined(); - } -} - -void -nsGlobalWindow::GetReturnValue(JSContext* aCx, - JS::MutableHandle aReturnValue, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - FORWARD_TO_OUTER_OR_THROW(GetReturnValueOuter, - (aCx, aReturnValue, aSubjectPrincipal, aError), - aError, ); -} - -NS_IMETHODIMP -nsGlobalModalWindow::GetReturnValue(nsIVariant **aRetVal) -{ - FORWARD_TO_OUTER_MODAL_CONTENT_WINDOW(GetReturnValue, (aRetVal), NS_OK); - - if (!mReturnValue) { - nsCOMPtr variant = CreateVoidVariant(); - variant.forget(aRetVal); - return NS_OK; - } - return mReturnValue->Get(nsContentUtils::SubjectPrincipal(), aRetVal); -} - -void -nsGlobalWindow::SetReturnValueOuter(JSContext* aCx, - JS::Handle aReturnValue, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - MOZ_RELEASE_ASSERT(IsOuterWindow()); - MOZ_ASSERT(IsModalContentWindow(), - "This should only be called on modal windows!"); - - nsCOMPtr returnValue; - aError = - nsContentUtils::XPConnect()->JSToVariant(aCx, aReturnValue, - getter_AddRefs(returnValue)); - if (!aError.Failed()) { - mReturnValue = new DialogValueHolder(&aSubjectPrincipal, returnValue); - } -} - -void -nsGlobalWindow::SetReturnValue(JSContext* aCx, - JS::Handle aReturnValue, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - FORWARD_TO_OUTER_OR_THROW(SetReturnValueOuter, - (aCx, aReturnValue, aSubjectPrincipal, aError), - aError, ); -} - -NS_IMETHODIMP -nsGlobalModalWindow::SetReturnValue(nsIVariant *aRetVal) -{ - FORWARD_TO_OUTER_MODAL_CONTENT_WINDOW(SetReturnValue, (aRetVal), NS_OK); - - mReturnValue = new DialogValueHolder(nsContentUtils::SubjectPrincipal(), - aRetVal); - return NS_OK; -} - -/* static */ -bool -nsGlobalWindow::IsModalContentWindow(JSContext* aCx, JSObject* aGlobal) -{ - return xpc::WindowOrNull(aGlobal)->IsModalContentWindow(); -} - #if defined(MOZ_WIDGET_ANDROID) int16_t nsGlobalWindow::Orientation(CallerType aCallerType) const diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 1f420895c..5cfd3f056 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -458,9 +458,6 @@ public: static bool IsPrivilegedChromeWindow(JSContext* /* unused */, JSObject* aObj); - static bool IsShowModalDialogEnabled(JSContext* /* unused */ = nullptr, - JSObject* /* unused */ = nullptr); - bool DoResolve(JSContext* aCx, JS::Handle aObj, JS::Handle aId, JS::MutableHandle aDesc); @@ -583,9 +580,6 @@ public: return mIsChrome; } - using nsPIDOMWindow::IsModalContentWindow; - static bool IsModalContentWindow(JSContext* aCx, JSObject* aGlobal); - // GetScrollFrame does not flush. Callers should do it themselves as needed, // depending on which info they actually want off the scrollable frame. nsIScrollableFrame *GetScrollFrame(); @@ -950,12 +944,6 @@ public: mozilla::ErrorResult& aRv); void PrintOuter(mozilla::ErrorResult& aError); void Print(mozilla::ErrorResult& aError); - void ShowModalDialog(JSContext* aCx, const nsAString& aUrl, - JS::Handle aArgument, - const nsAString& aOptions, - JS::MutableHandle aRetval, - nsIPrincipal& aSubjectPrincipal, - mozilla::ErrorResult& aError); void PostMessageMoz(JSContext* aCx, JS::Handle aMessage, const nsAString& aTargetOrigin, const mozilla::dom::Optional >& aTransfer, @@ -1227,12 +1215,6 @@ public: mozilla::dom::Element* aPanel, mozilla::ErrorResult& aError); - void GetDialogArgumentsOuter(JSContext* aCx, JS::MutableHandle aRetval, - nsIPrincipal& aSubjectPrincipal, - mozilla::ErrorResult& aError); - void GetDialogArguments(JSContext* aCx, JS::MutableHandle aRetval, - nsIPrincipal& aSubjectPrincipal, - mozilla::ErrorResult& aError); void GetReturnValueOuter(JSContext* aCx, JS::MutableHandle aReturnValue, nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError); @@ -1681,18 +1663,6 @@ protected: nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError); - already_AddRefed - ShowModalDialogOuter(const nsAString& aUrl, nsIVariant* aArgument, - const nsAString& aOptions, - nsIPrincipal& aSubjectPrincipal, - mozilla::ErrorResult& aError); - - already_AddRefed - ShowModalDialog(const nsAString& aUrl, nsIVariant* aArgument, - const nsAString& aOptions, - nsIPrincipal& aSubjectPrincipal, - mozilla::ErrorResult& aError); - // Ask the user if further dialogs should be blocked, if dialogs are currently // being abused. This is used in the cases where we have no modifiable UI to // show, in that case we show a separate dialog to ask this question. @@ -1832,9 +1802,6 @@ protected: // For |window.arguments|, via |openDialog|. nsCOMPtr mArguments; - // For |window.dialogArguments|, via |showModalDialog|. - RefPtr mDialogArguments; - // Only used in the outer. RefPtr mReturnValue; @@ -2067,40 +2034,14 @@ public: nsCOMPtr mOpenerForInitialContentBrowser; }; -/* - * nsGlobalModalWindow inherits from nsGlobalWindow. It is the global - * object created for a modal content windows only (i.e. not modal - * chrome dialogs). - */ -class nsGlobalModalWindow : public nsGlobalWindow, - public nsIDOMModalContentWindow -{ -public: - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIDOMMODALCONTENTWINDOW - - static already_AddRefed Create(nsGlobalWindow *aOuterWindow); - -protected: - explicit nsGlobalModalWindow(nsGlobalWindow *aOuterWindow) - : nsGlobalWindow(aOuterWindow) - { - mIsModalContentWindow = true; - } - - ~nsGlobalModalWindow() {} -}; - /* factory function */ inline already_AddRefed -NS_NewScriptGlobalObject(bool aIsChrome, bool aIsModalContentWindow) +NS_NewScriptGlobalObject(bool aIsChrome) { RefPtr global; if (aIsChrome) { global = nsGlobalChromeWindow::Create(nullptr); - } else if (aIsModalContentWindow) { - global = nsGlobalModalWindow::Create(nullptr); } else { global = nsGlobalWindow::Create(nullptr); } diff --git a/dom/base/nsPIDOMWindow.h b/dom/base/nsPIDOMWindow.h index 47affbb06..5c07bf4d4 100644 --- a/dom/base/nsPIDOMWindow.h +++ b/dom/base/nsPIDOMWindow.h @@ -303,11 +303,6 @@ public: virtual bool CanClose() = 0; virtual void ForceClose() = 0; - bool IsModalContentWindow() const - { - return mIsModalContentWindow; - } - /** * Call this to indicate that some node (this window, its document, * or content in that document) has a paint event listener. @@ -629,11 +624,6 @@ protected: // This member is only used by inner windows. bool mInnerObjectsFreed; - - // This variable is used on both inner and outer windows (and they - // should match). - bool mIsModalContentWindow; - // Tracks activation state that's used for :-moz-window-inactive. // Only used on outer windows. bool mIsActive; diff --git a/dom/base/nsSandboxFlags.h b/dom/base/nsSandboxFlags.h index d18527597..b8c9ac357 100644 --- a/dom/base/nsSandboxFlags.h +++ b/dom/base/nsSandboxFlags.h @@ -29,8 +29,7 @@ const unsigned long SANDBOXED_NAVIGATION = 0x1; /** * This flag prevents content from creating new auxiliary browsing contexts, - * e.g. using the target attribute, the window.open() method, or the - * showModalDialog() method. + * e.g. using the target attribute, or the window.open() method. */ const unsigned long SANDBOXED_AUXILIARY_NAVIGATION = 0x2; diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index b3b804ce4..3dfd666f8 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -196,7 +196,6 @@ support-files = formReset.html invalid_accesscontrol.resource invalid_accesscontrol.resource^headers^ - mutationobserver_dialog.html orientationcommon.js script-1_bug597345.sjs script-2_bug597345.js @@ -627,9 +626,6 @@ subsuite = clipboard skip-if = toolkit == 'android' #bug 904183 [test_createHTMLDocument.html] [test_declare_stylesheet_obsolete.html] -[test_dialogArguments.html] -tags = openwindow -skip-if = toolkit == 'android' || e10s # showmodaldialog [test_document.all_iteration.html] [test_document.all_unqualified.html] [test_document_constructor.html] diff --git a/dom/base/test/mutationobserver_dialog.html b/dom/base/test/mutationobserver_dialog.html deleted file mode 100644 index 2cc815309..000000000 --- a/dom/base/test/mutationobserver_dialog.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - diff --git a/dom/base/test/test_dialogArguments.html b/dom/base/test/test_dialogArguments.html deleted file mode 100644 index 70a091d00..000000000 --- a/dom/base/test/test_dialogArguments.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - Test for Bug 1019761 - - - - - - - - - diff --git a/dom/base/test/test_mutationobservers.html b/dom/base/test/test_mutationobservers.html index bde07c79c..a6de89595 100644 --- a/dom/base/test/test_mutationobservers.html +++ b/dom/base/test/test_mutationobservers.html @@ -484,28 +484,6 @@ function testSyncXHR() { function testSyncXHR2() { ok(callbackHandled, "Should have called the mutation callback!"); - then(testModalDialog); -} - -function testModalDialog() { - var didHandleCallback = false; - div.innerHTML = "12"; - m = new M(function(records, observer) { - is(records[0].type, "childList", "Should have got childList"); - is(records[0].removedNodes.length, 2, "Should have got removedNodes"); - is(records[0].addedNodes.length, 1, "Should have got addedNodes"); - observer.disconnect(); - m = null; - didHandleCallback = true; - }); - m.observe(div, { childList: true }); - div.innerHTML = "foo"; - try { - window.showModalDialog("mutationobserver_dialog.html"); - ok(didHandleCallback, "Should have called the callback while showing modal dialog!"); - } catch(e) { - todo(false, "showModalDialog not implemented on this platform"); - } then(testTakeRecords); } diff --git a/dom/html/test/file_iframe_sandbox_c_if4.html b/dom/html/test/file_iframe_sandbox_c_if4.html index 53bf49559..828592d63 100644 --- a/dom/html/test/file_iframe_sandbox_c_if4.html +++ b/dom/html/test/file_iframe_sandbox_c_if4.html @@ -12,7 +12,7 @@ } function doStuff() { - // try to open a new window via target="_blank", target="BC341604", window.open(), and showModalDialog() + // try to open a new window via target="_blank", target="BC341604", and window.open() // the window we try to open closes itself once it opens sendMouseEvent({type:'click'}, 'target_blank'); sendMouseEvent({type:'click'}, 'target_BC341604'); @@ -25,15 +25,6 @@ } ok(threw, "window.open threw a JS exception and was not allowed"); - - threw = false; - try { - window.showModalDialog("about:blank"); - } catch(error) { - threw = true; - } - - ok(threw, "window.showModalDialog threw a JS exception and was not allowed"); } diff --git a/dom/html/test/file_iframe_sandbox_j_if1.html b/dom/html/test/file_iframe_sandbox_j_if1.html deleted file mode 100644 index 6d4347dfc..000000000 --- a/dom/html/test/file_iframe_sandbox_j_if1.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - Test for Bug 766282 - - - - - - - I am sandboxed with "allow-scripts allow-popups allow-same-origin allow-forms allow-top-navigation". - - diff --git a/dom/html/test/file_iframe_sandbox_j_if2.html b/dom/html/test/file_iframe_sandbox_j_if2.html deleted file mode 100644 index 9552307ee..000000000 --- a/dom/html/test/file_iframe_sandbox_j_if2.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Test for Bug 766282 - - - - - - - I am sandboxed but with "allow-scripts allow-popups allow-same-origin". - After my initial load, "allow-same-origin" is removed and then I open file_iframe_sandbox_k_if9.html, - which attemps to call a function in my parent. - This should succeed since the new sandbox flags shouldn't have taken affect on me until I'm reloaded. - - diff --git a/dom/html/test/file_iframe_sandbox_j_if3.html b/dom/html/test/file_iframe_sandbox_j_if3.html deleted file mode 100644 index 07c5b66c1..000000000 --- a/dom/html/test/file_iframe_sandbox_j_if3.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Tests for Bug 766282 - - - - - - I am sandboxed but with "allow-popups allow-scripts allow-same-origin" - - diff --git a/dom/html/test/mochitest.ini b/dom/html/test/mochitest.ini index 024de1cd9..4a50a9c3f 100644 --- a/dom/html/test/mochitest.ini +++ b/dom/html/test/mochitest.ini @@ -154,9 +154,6 @@ support-files = file_iframe_sandbox_form_pass.html file_iframe_sandbox_g_if1.html file_iframe_sandbox_h_if1.html - file_iframe_sandbox_j_if1.html - file_iframe_sandbox_j_if2.html - file_iframe_sandbox_j_if3.html file_iframe_sandbox_k_if1.html file_iframe_sandbox_k_if2.html file_iframe_sandbox_k_if3.html @@ -471,9 +468,6 @@ skip-if = toolkit == 'android' # just copy the conditions from the test above tags = openwindow [test_iframe_sandbox_inheritance.html] tags = openwindow -[test_iframe_sandbox_modal.html] -tags = openwindow -skip-if = toolkit == 'android' || e10s #modal tests fail on android [test_iframe_sandbox_navigation.html] tags = openwindow [test_iframe_sandbox_navigation2.html] @@ -540,8 +534,6 @@ skip-if = toolkit == 'android' #bug 811644 [test_bug369370.html] skip-if = toolkit == "android" || toolkit == "windows" # disabled on Windows because of bug 1234520 [test_bug380383.html] -[test_bug391777.html] -skip-if = toolkit == 'android' || e10s [test_bug402680.html] [test_bug403868.html] [test_bug403868.xhtml] @@ -607,4 +599,4 @@ skip-if = os == "android" # up/down arrow keys not supported on android [test_script_module.html] support-files = file_script_module.html - file_script_nomodule.html \ No newline at end of file + file_script_nomodule.html diff --git a/dom/html/test/test_bug391777.html b/dom/html/test/test_bug391777.html deleted file mode 100644 index aa01a45de..000000000 --- a/dom/html/test/test_bug391777.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Test for Bug 391777 - - - - -Mozilla Bug 391777 -

- - - diff --git a/dom/html/test/test_iframe_sandbox_general.html b/dom/html/test/test_iframe_sandbox_general.html index 6d3a190ee..83f0e9045 100644 --- a/dom/html/test/test_iframe_sandbox_general.html +++ b/dom/html/test/test_iframe_sandbox_general.html @@ -41,7 +41,7 @@ function ok_wrapper(result, desc) { passedTests++; } - if (completedTests == 33) { + if (completedTests == 32) { is(passedTests, completedTests, "There are " + completedTests + " general tests that should pass"); SimpleTest.finish(); } diff --git a/dom/html/test/test_iframe_sandbox_modal.html b/dom/html/test/test_iframe_sandbox_modal.html deleted file mode 100644 index 1307ea9a5..000000000 --- a/dom/html/test/test_iframe_sandbox_modal.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - Tests for Bug 766282 - - - - - - - -Mozilla Bug 766282 - implement allow-popups directive for iframe sandbox -

-
- - - -
diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index 0472979d7..6bd3aac94 100644 --- a/dom/locales/en-US/chrome/dom/dom.properties +++ b/dom/locales/en-US/chrome/dom/dom.properties @@ -174,8 +174,6 @@ UseOfCaptureEventsWarning=Use of captureEvents() is deprecated. To upgrade your UseOfReleaseEventsWarning=Use of releaseEvents() is deprecated. To upgrade your code, use the DOM 2 removeEventListener() method. For more help http://developer.mozilla.org/en/docs/DOM:element.removeEventListener # LOCALIZATION NOTE: Do not translate "document.load()" or "XMLHttpRequest" UseOfDOM3LoadMethodWarning=Use of document.load() is deprecated. To upgrade your code, use the DOM XMLHttpRequest object. For more help https://developer.mozilla.org/en/XMLHttpRequest -# LOCALIZATION NOTE: Do not translate "window.showModalDialog()" or "window.open()" -ShowModalDialogWarning=Use of window.showModalDialog() is deprecated. Use window.open() instead. For more help https://developer.mozilla.org/en-US/docs/Web/API/Window.open # LOCALIZATION NOTE: Do not translate "window._content" or "window.content" Window_ContentWarning=window._content is deprecated. Please use window.content instead. # LOCALIZATION NOTE: Do not translate "XMLHttpRequest" diff --git a/dom/media/webspeech/recognition/test/test_nested_eventloop.html b/dom/media/webspeech/recognition/test/test_nested_eventloop.html index bdbed6524..8b4cea6d7 100644 --- a/dom/media/webspeech/recognition/test/test_nested_eventloop.html +++ b/dom/media/webspeech/recognition/test/test_nested_eventloop.html @@ -21,7 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295 SimpleTest.waitForExplicitFinish(); /* - * window.showModalDialog() can be used to spin the event loop, causing + * SpecialPowers.spinEventLoop can be used to spin the event loop, causing * queued SpeechEvents (such as those created by calls to start(), stop() * or abort()) to be processed immediately. * When this is done from inside DOM event handlers, it is possible to @@ -33,7 +33,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295 } function doneFunc() { // Trigger gc now and wait some time to make sure this test gets the blame - // for any assertions caused by showModalDialog + // for any assertions caused by spinning the event loop. // // NB - The assertions should be gone, but this looks too scary to touch // during batch cleanup. diff --git a/dom/tests/mochitest/bugs/file_bug291653.html b/dom/tests/mochitest/bugs/file_bug291653.html deleted file mode 100644 index 4bfc8337e..000000000 --- a/dom/tests/mochitest/bugs/file_bug291653.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - Test for bug 291653 - - diff --git a/dom/tests/mochitest/bugs/file_bug504862.html b/dom/tests/mochitest/bugs/file_bug504862.html deleted file mode 100644 index dc11ced6f..000000000 --- a/dom/tests/mochitest/bugs/file_bug504862.html +++ /dev/null @@ -1,22 +0,0 @@ - - - diff --git a/dom/tests/mochitest/bugs/mochitest.ini b/dom/tests/mochitest/bugs/mochitest.ini index 309aab6e0..3743c6782 100644 --- a/dom/tests/mochitest/bugs/mochitest.ini +++ b/dom/tests/mochitest/bugs/mochitest.ini @@ -10,9 +10,6 @@ support-files = child_bug260264.html devicemotion_inner.html devicemotion_outer.html - file_bug291653.html - file_bug406375.html - file_bug504862.html file_bug593174_1.html file_bug593174_2.html file_bug809290_b1.html @@ -45,7 +42,6 @@ skip-if = toolkit == 'android' [test_bug260264_nested.html] [test_bug265203.html] [test_bug291377.html] -[test_bug291653.html] skip-if = toolkit == 'android' #TIMED_OUT [test_bug304459.html] [test_bug308856.html] @@ -67,28 +63,21 @@ skip-if = toolkit == 'android' #TIMED_OUT [test_bug396843.html] [test_bug400204.html] [test_bug404748.html] -[test_bug406375.html] -skip-if = toolkit == 'android' -[test_bug414291.html] -tags = openwindow [test_bug427744.html] skip-if = toolkit == 'android' [test_bug42976.html] [test_bug430276.html] -[test_bug437361.html] skip-if = toolkit == 'android' [test_bug440572.html] [test_bug456151.html] [test_bug458091.html] [test_bug459848.html] [test_bug465263.html] -[test_bug479143.html] skip-if = toolkit == 'android' [test_bug484775.html] [test_bug492925.html] [test_bug49312.html] [test_bug495219.html] -[test_bug504862.html] skip-if = toolkit == 'android' #RANDOM [test_bug529328.html] [test_bug531176.html] @@ -126,7 +115,6 @@ skip-if = toolkit == 'android' [test_bug698061.html] [test_bug698551.html] [test_bug707749.html] -[test_bug735237.html] [test_bug739038.html] [test_bug740811.html] [test_bug743615.html] diff --git a/dom/tests/mochitest/bugs/test_bug291653.html b/dom/tests/mochitest/bugs/test_bug291653.html deleted file mode 100644 index 1543cdd96..000000000 --- a/dom/tests/mochitest/bugs/test_bug291653.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Test for Bug 291653 - - - - -Mozilla Bug 291653 -

- -
-
-
- - diff --git a/dom/tests/mochitest/bugs/test_bug406375.html b/dom/tests/mochitest/bugs/test_bug406375.html deleted file mode 100644 index 2cd459ffa..000000000 --- a/dom/tests/mochitest/bugs/test_bug406375.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - Test for Bug 406375 - - - - -Mozilla Bug 406375 -

- -
-
-
- - diff --git a/dom/tests/mochitest/bugs/test_bug414291.html b/dom/tests/mochitest/bugs/test_bug414291.html index 883e52bb4..0ee5cb393 100644 --- a/dom/tests/mochitest/bugs/test_bug414291.html +++ b/dom/tests/mochitest/bugs/test_bug414291.html @@ -16,7 +16,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=414291 var result1 = 0; var result2 = 0; -var result3 = 0; window.open("data:text/html,", "w1"); is(result1, 0, "window should not be opened either as modal or loaded synchronously."); @@ -24,11 +23,6 @@ is(result1, 0, "window should not be opened either as modal or loaded synchronou window.open("data:text/html,", "w2", "modal=yes"); is(result2, 0, "window should not be opened either as modal or data loaded synchronously."); -if (window.showModalDialog) { - result3 = window.showModalDialog("data:text/html,"); - is(result3, 3, "window should be opened as modal."); -} - diff --git a/dom/tests/mochitest/bugs/test_bug437361.html b/dom/tests/mochitest/bugs/test_bug437361.html deleted file mode 100644 index ecc2cb08d..000000000 --- a/dom/tests/mochitest/bugs/test_bug437361.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - Test for Bug 437361 - - - - - - -Mozilla Bug 437361 -

- -
-
- - - diff --git a/dom/tests/mochitest/bugs/test_bug479143.html b/dom/tests/mochitest/bugs/test_bug479143.html deleted file mode 100644 index 03db4ddea..000000000 --- a/dom/tests/mochitest/bugs/test_bug479143.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - Test for Bug 411103 - - - - -Mozilla Bug 479143 -

- - -
-
-
- - diff --git a/dom/tests/mochitest/bugs/test_bug504862.html b/dom/tests/mochitest/bugs/test_bug504862.html deleted file mode 100644 index 713165bc3..000000000 --- a/dom/tests/mochitest/bugs/test_bug504862.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - Test for Bug 504862 - - - - -Mozilla Bug 504862 - - - - diff --git a/dom/tests/mochitest/bugs/test_bug61098.html b/dom/tests/mochitest/bugs/test_bug61098.html index 4c6ce967d..ed16e099b 100644 --- a/dom/tests/mochitest/bugs/test_bug61098.html +++ b/dom/tests/mochitest/bugs/test_bug61098.html @@ -306,28 +306,6 @@ function runtestsInner() w.close(); - // Test that showModalDialog() works normally and then gets blocked - // on the second call. - if (window.showModalDialog) { - w = window.open(); - w.showModalDialog("data:text/html,%3Cscript>window.close();%3C/script>") - is (promptState, void(0), "Wrong prompt state"); - - try { - w.showModalDialog("data:text/html,%3Cscript>window.close();%3C/script>") - ok(false, "showModalDialog call should throw an exception"); - } catch(e) { - is(e.name, "NS_ERROR_NOT_AVAILABLE", "Wrong exception"); - } - is (promptState.method, "confirm", "Wrong prompt method called"); - is (promptState.parent, w, "Wrong confirm parent"); - is (promptState.msg, "Prevent this page from creating additional dialogs", - "Wrong confirm message"); - promptState = void(0); - - w.close(); - } - mockPromptFactoryRegisterer.unregister(); mockPromptServiceRegisterer.unregister(); diff --git a/dom/tests/mochitest/bugs/test_bug735237.html b/dom/tests/mochitest/bugs/test_bug735237.html deleted file mode 100644 index e1a25a425..000000000 --- a/dom/tests/mochitest/bugs/test_bug735237.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Test for Bug 735237 - - - - -Mozilla Bug 735237 -

- -
-
-
- - diff --git a/dom/tests/mochitest/general/file_showModalDialog.html b/dom/tests/mochitest/general/file_showModalDialog.html deleted file mode 100644 index 1cae0b1c0..000000000 --- a/dom/tests/mochitest/general/file_showModalDialog.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini index d00ea1d4b..9f2fad785 100755 --- a/dom/tests/mochitest/general/mochitest.ini +++ b/dom/tests/mochitest/general/mochitest.ini @@ -9,7 +9,6 @@ support-files = file_interfaces.xml file_moving_nodeList.html file_moving_xhr.html - file_showModalDialog.html historyframes.html image_50.png image_100.png @@ -116,8 +115,6 @@ support-files = test_offsets.js [test_resource_timing_frameset.html] [test_selectevents.html] skip-if = toolkit == 'android' # bug 1230232 - Mouse doesn't select in the same way -[test_showModalDialog.html] -skip-if = e10s || toolkit == 'android' #Don't run modal tests on Android [test_showModalDialog_e10s.html] run-if = e10s [test_storagePermissionsAccept.html] diff --git a/dom/tests/mochitest/general/test_showModalDialog.html b/dom/tests/mochitest/general/test_showModalDialog.html deleted file mode 100644 index 511c79e63..000000000 --- a/dom/tests/mochitest/general/test_showModalDialog.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - Test for Bug 862918 - - - - - -Mozilla Bug 862918 -

- -
-
- - diff --git a/dom/webidl/Window.webidl b/dom/webidl/Window.webidl index 468f1cc8a..ab03bf40b 100644 --- a/dom/webidl/Window.webidl +++ b/dom/webidl/Window.webidl @@ -78,9 +78,6 @@ typedef any Transferable; [Throws, UnsafeInPrerendering, NeedsSubjectPrincipal] boolean confirm(optional DOMString message = ""); [Throws, UnsafeInPrerendering, NeedsSubjectPrincipal] DOMString? prompt(optional DOMString message = "", optional DOMString default = ""); [Throws, UnsafeInPrerendering] void print(); - //[Throws] any showModalDialog(DOMString url, optional any argument); - [Throws, Func="nsGlobalWindow::IsShowModalDialogEnabled", UnsafeInPrerendering, NeedsSubjectPrincipal] - any showModalDialog(DOMString url, optional any argument, optional DOMString options = ""); [Throws, CrossOriginCallable, NeedsSubjectPrincipal] void postMessage(any message, DOMString targetOrigin, optional sequence transfer); @@ -240,17 +237,6 @@ interface SpeechSynthesisGetter { Window implements SpeechSynthesisGetter; #endif -// http://www.whatwg.org/specs/web-apps/current-work/ -[NoInterfaceObject] -interface WindowModal { - [Throws, Func="nsGlobalWindow::IsModalContentWindow", NeedsSubjectPrincipal] - readonly attribute any dialogArguments; - - [Throws, Func="nsGlobalWindow::IsModalContentWindow", NeedsSubjectPrincipal] - attribute any returnValue; -}; -Window implements WindowModal; - // Mozilla-specific stuff partial interface Window { //[NewObject, Throws] CSSStyleDeclaration getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = ""); -- cgit v1.2.3