diff options
38 files changed, 14 insertions, 1313 deletions
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index ebaf07bcdf..6104ebfa71 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -13356,24 +13356,9 @@ nsDocShell::EnsureScriptEnvironment() uint32_t chromeFlags; browserChrome->GetChromeFlags(&chromeFlags); - bool isModalContentWindow = - (mItemType == typeContent) && - (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL_CONTENT_WINDOW); - // There can be various other content docshells associated with the - // top-level window, like sidebars. Make sure that we only create an - // nsGlobalModalWindow for the primary content shell. - if (isModalContentWindow) { - nsCOMPtr<nsIDocShellTreeItem> primaryItem; - nsresult rv = - mTreeOwner->GetPrimaryContentShell(getter_AddRefs(primaryItem)); - NS_ENSURE_SUCCESS(rv, rv); - isModalContentWindow = (primaryItem == this); - } - // If our window is modal and we're not opened as chrome, make // this window a modal content window. - mScriptGlobal = - NS_NewScriptGlobalObject(mItemType == typeChrome, isModalContentWindow); + mScriptGlobal = NS_NewScriptGlobalObject(mItemType == typeChrome); MOZ_ASSERT(mScriptGlobal); mScriptGlobal->SetDocShell(this); diff --git a/dom/base/nsDeprecatedOperationList.h b/dom/base/nsDeprecatedOperationList.h index ea4b052890..96a6c3ac01 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 47b46dda06..0587eb8927 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -909,7 +909,6 @@ nsPIDOMWindow<T>::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<nsISupports> supports = do_QueryElementAt(aArguments, 0, &rv); - NS_ENSURE_SUCCESS(rv, rv); - mDialogArguments = static_cast<DialogValueHolder*>(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<nsIVariant> -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<DialogValueHolder> 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<nsPIDOMWindowOuter> 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<nsIDOMModalContentWindow> dialog = do_QueryInterface(dlgWin); - if (!dialog) { - return nullptr; - } - - nsCOMPtr<nsIVariant> retVal; - aError = dialog->GetReturnValue(getter_AddRefs(retVal)); - MOZ_ASSERT(!aError.Failed()); - - return retVal.forget(); -} - -already_AddRefed<nsIVariant> -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<JS::Value> aArgument, - const nsAString& aOptions, - JS::MutableHandle<JS::Value> aRetval, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - MOZ_ASSERT(IsInnerWindow()); - - nsCOMPtr<nsIVariant> args; - aError = nsContentUtils::XPConnect()->JSToVariant(aCx, - aArgument, - getter_AddRefs(args)); - if (aError.Failed()) { - return; - } - - nsCOMPtr<nsIVariant> retVal = - ShowModalDialog(aUrl, args, aOptions, aSubjectPrincipal, aError); - if (aError.Failed()) { - return; - } - - JS::Rooted<JS::Value> 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<JS::Value> 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<JSObject*> wrapper(aCx, GetWrapper()); - JSAutoCompartment ac(aCx, wrapper); - mDialogArguments->Get(aCx, wrapper, &aSubjectPrincipal, aRetval, aError); -} - -void -nsGlobalWindow::GetDialogArguments(JSContext* aCx, - JS::MutableHandle<JS::Value> aRetval, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - FORWARD_TO_OUTER_OR_THROW(GetDialogArgumentsOuter, - (aCx, aRetval, aSubjectPrincipal, aError), - aError, ); -} - -/* static */ already_AddRefed<nsGlobalModalWindow> -nsGlobalModalWindow::Create(nsGlobalWindow *aOuterWindow) -{ - RefPtr<nsGlobalModalWindow> 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> -nsGlobalWindow::Create(nsGlobalWindow *aOuterWindow) -{ - RefPtr<nsGlobalWindow> window = new nsGlobalWindow(aOuterWindow); - window->InitWasOffline(); - return window.forget(); -} - -void -nsGlobalWindow::InitWasOffline() -{ - mWasOffline = NS_IsOffline(); -} - -void -nsGlobalWindow::GetReturnValueOuter(JSContext* aCx, - JS::MutableHandle<JS::Value> aReturnValue, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - MOZ_RELEASE_ASSERT(IsOuterWindow()); - MOZ_ASSERT(IsModalContentWindow(), - "This should only be called on modal windows!"); - - if (mReturnValue) { - JS::Rooted<JSObject*> wrapper(aCx, GetWrapper()); - JSAutoCompartment ac(aCx, wrapper); - mReturnValue->Get(aCx, wrapper, &aSubjectPrincipal, aReturnValue, aError); - } else { - aReturnValue.setUndefined(); - } -} - -void -nsGlobalWindow::GetReturnValue(JSContext* aCx, - JS::MutableHandle<JS::Value> 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<nsIVariant> variant = CreateVoidVariant(); - variant.forget(aRetVal); - return NS_OK; - } - return mReturnValue->Get(nsContentUtils::SubjectPrincipal(), aRetVal); -} - -void -nsGlobalWindow::SetReturnValueOuter(JSContext* aCx, - JS::Handle<JS::Value> aReturnValue, - nsIPrincipal& aSubjectPrincipal, - ErrorResult& aError) -{ - MOZ_RELEASE_ASSERT(IsOuterWindow()); - MOZ_ASSERT(IsModalContentWindow(), - "This should only be called on modal windows!"); - - nsCOMPtr<nsIVariant> 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<JS::Value> 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 1f420895c8..5cfd3f0563 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<JSObject*> aObj, JS::Handle<jsid> aId, JS::MutableHandle<JS::PropertyDescriptor> 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<JS::Value> aArgument, - const nsAString& aOptions, - JS::MutableHandle<JS::Value> aRetval, - nsIPrincipal& aSubjectPrincipal, - mozilla::ErrorResult& aError); void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage, const nsAString& aTargetOrigin, const mozilla::dom::Optional<mozilla::dom::Sequence<JS::Value > >& aTransfer, @@ -1227,12 +1215,6 @@ public: mozilla::dom::Element* aPanel, mozilla::ErrorResult& aError); - void GetDialogArgumentsOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval, - nsIPrincipal& aSubjectPrincipal, - mozilla::ErrorResult& aError); - void GetDialogArguments(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval, - nsIPrincipal& aSubjectPrincipal, - mozilla::ErrorResult& aError); void GetReturnValueOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aReturnValue, nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError); @@ -1681,18 +1663,6 @@ protected: nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError); - already_AddRefed<nsIVariant> - ShowModalDialogOuter(const nsAString& aUrl, nsIVariant* aArgument, - const nsAString& aOptions, - nsIPrincipal& aSubjectPrincipal, - mozilla::ErrorResult& aError); - - already_AddRefed<nsIVariant> - 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<nsIArray> mArguments; - // For |window.dialogArguments|, via |showModalDialog|. - RefPtr<DialogValueHolder> mDialogArguments; - // Only used in the outer. RefPtr<DialogValueHolder> mReturnValue; @@ -2067,40 +2034,14 @@ public: nsCOMPtr<mozIDOMWindowProxy> 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<nsGlobalModalWindow> Create(nsGlobalWindow *aOuterWindow); - -protected: - explicit nsGlobalModalWindow(nsGlobalWindow *aOuterWindow) - : nsGlobalWindow(aOuterWindow) - { - mIsModalContentWindow = true; - } - - ~nsGlobalModalWindow() {} -}; - /* factory function */ inline already_AddRefed<nsGlobalWindow> -NS_NewScriptGlobalObject(bool aIsChrome, bool aIsModalContentWindow) +NS_NewScriptGlobalObject(bool aIsChrome) { RefPtr<nsGlobalWindow> 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 47affbb062..5c07bf4d4d 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 d185275976..b8c9ac3579 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 b3b804ce4f..3dfd666f80 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 2cc8153099..0000000000 --- a/dom/base/test/mutationobserver_dialog.html +++ /dev/null @@ -1,62 +0,0 @@ -<html> - <head> - <title></title> - <script> - - var div = document.createElement("div"); - - var M; - if ("MozMutationObserver" in window) { - M = window.MozMutationObserver; - } else if ("WebKitMutationObserver" in window) { - M = window.WebKitMutationObserver; - } else { - M = window.MutationObserver; - } - - var didCall1 = false; - var didCall2 = false; - function testMutationObserverInDialog() { - div.innerHTML = "<span>1</span><span>2</span>"; - m = new M(function(records, observer) { - opener.is(records[0].type, "childList", "Should have got childList"); - opener.is(records[0].removedNodes.length, 2, "Should have got removedNodes"); - opener.is(records[0].addedNodes.length, 1, "Should have got addedNodes"); - observer.disconnect(); - m = null; - didCall1 = true; - }); - m.observe(div, { childList: true }); - div.innerHTML = "<span><span>foo</span></span>"; - } - - function testMutationObserverInDialog2() { - div.innerHTML = "<span>1</span><span>2</span>"; - m = new M(function(records, observer) { - opener.is(records[0].type, "childList", "Should have got childList"); - opener.is(records[0].removedNodes.length, 2, "Should have got removedNodes"); - opener.is(records[0].addedNodes.length, 1, "Should have got addedNodes"); - observer.disconnect(); - m = null; - didCall2 = true; - }); - m.observe(div, { childList: true }); - div.innerHTML = "<span><span>foo</span></span>"; - } - - window.addEventListener("load", testMutationObserverInDialog); - window.addEventListener("load", testMutationObserverInDialog2); - window.addEventListener("load", - function() { - opener.ok(didCall1, "Should have called 1st mutation callback"); - opener.ok(didCall2, "Should have called 2nd mutation callback"); - window.close(); - }); - </script> - <style> - </style> - </head> - <body> - <input type="button" onclick="window.close()" value="close"> - </body> -</html> diff --git a/dom/base/test/test_dialogArguments.html b/dom/base/test/test_dialogArguments.html deleted file mode 100644 index 70a091d000..0000000000 --- a/dom/base/test/test_dialogArguments.html +++ /dev/null @@ -1,31 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title>Test for Bug 1019761</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> - - <meta http-equiv="content-type" content="text/html; charset=utf-8"> -</head> -<body> -<script type="application/javascript"> - -/* - Tests whether Firefox crashes when accessing the dialogArguments property - of a modal window that has been closed. -*/ -SimpleTest.waitForExplicitFinish(); - -function openModal() { - showModalDialog("javascript:opener.winRef = window; \ - window.opener.setTimeout(\'winRef.dialogArguments;\', 0);\ - window.close();"); - - ok(true, "dialogArguments did not cause a crash."); - SimpleTest.finish(); -} - -window.onload = openModal; -</script> -</body> -</html> diff --git a/dom/base/test/test_mutationobservers.html b/dom/base/test/test_mutationobservers.html index bde07c79cb..a6de89595b 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 = "<span>1</span><span>2</span>"; - 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 = "<span><span>foo</span></span>"; - 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 53bf49559e..828592d630 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"); } </script> <body onLoad="doStuff()"> 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 6d4347dfcf..0000000000 --- a/dom/html/test/file_iframe_sandbox_j_if1.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <meta charset="utf-8"> - <title>Test for Bug 766282</title> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> - -<script type="text/javascript"> - function doStuff() { - // Open a new window via showModalDialog(). - try { - window.showModalDialog("file_iframe_sandbox_k_if5.html"); - } catch(e) { - window.parent.ok_wrapper(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog"); - } - - // Open a new window via showModalDialog(). - try { - window.showModalDialog("file_iframe_sandbox_k_if7.html"); - } catch(e) { - window.parent.ok_wrapper(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog"); - } - } -</script> - -<body onLoad="doStuff()"> - I am sandboxed with "allow-scripts allow-popups allow-same-origin allow-forms allow-top-navigation". -</body> -</html> 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 9552307eed..0000000000 --- a/dom/html/test/file_iframe_sandbox_j_if2.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <meta charset="utf-8"> - <title>Test for Bug 766282</title> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> - -<script type="text/javascript"> - function doSubOpens() { - // Open a new window showModalDialog(). - try { - window.showModalDialog("file_iframe_sandbox_k_if9.html"); - } catch(e) { - window.parent.ok_wrapper(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog"); - } - } - - window.doSubOpens = doSubOpens; -</script> - -<body> - 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. -</body> -</html> 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 07c5b66c18..0000000000 --- a/dom/html/test/file_iframe_sandbox_j_if3.html +++ /dev/null @@ -1,27 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <meta charset="utf-8"> - <title>Tests for Bug 766282</title> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> - -</head> -<script type="text/javascript"> - function ok(result, desc) { - window.parent.ok_wrapper(result, desc); - } - - function doStuff() { - // Try to open a new window via showModalDialog(). - // The window we try to open closes itself once it opens. - try { - window.showModalDialog("file_iframe_sandbox_open_window_pass.html"); - } catch(e) { - ok(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog"); - } - } -</script> -<body onLoad="doStuff()"> - I am sandboxed but with "allow-popups allow-scripts allow-same-origin" -</body> -</html> diff --git a/dom/html/test/mochitest.ini b/dom/html/test/mochitest.ini index 024de1cd91..4a50a9c3f5 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 aa01a45de7..0000000000 --- a/dom/html/test/test_bug391777.html +++ /dev/null @@ -1,25 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=391777 ---> -<head> - <title>Test for Bug 391777</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391777">Mozilla Bug 391777</a> -<p id="display"></p> -<script class="testbody" type="text/javascript"> - -/** Test for Bug 391777 **/ -var arg = {}; -arg.testVal = "foo"; -var result = window.showModalDialog("javascript:window.returnValue = window.dialogArguments.testVal; window.close(); 'This window should close on its own.';", arg); -ok(true, "We should get here without user interaction"); -is(result, "foo", "Unexpected result from showModalDialog"); - -</script> -</body> -</html> diff --git a/dom/html/test/test_iframe_sandbox_general.html b/dom/html/test/test_iframe_sandbox_general.html index 6d3a190eef..83f0e9045d 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 1307ea9a50..0000000000 --- a/dom/html/test/test_iframe_sandbox_modal.html +++ /dev/null @@ -1,122 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=766282 -implement allow-popups directive for iframe sandbox ---> -<head> - <meta charset="utf-8"> - <title>Tests for Bug 766282</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> - -<script> - -SimpleTest.waitForExplicitFinish(); -SimpleTest.requestFlakyTimeout("untriaged"); - -// A postMessage handler that is used by sandboxed iframes without -// 'allow-same-origin' to communicate pass/fail back to this main page. -window.addEventListener("message", receiveMessage, false); - -function receiveMessage(event) { - switch (event.data.type) { - case "attempted": - testAttempted(); - break; - case "ok": - ok_wrapper(event.data.ok, event.data.desc, event.data.addToAttempted); - break; - default: - // allow for old style message - if (event.data.ok != undefined) { - ok_wrapper(event.data.ok, event.data.desc, event.data.addToAttempted); - } - } -} - -var attemptedTests = 0; -var passedTests = 0; -var totalTestsToPass = 5; -var totalTestsToAttempt = 5; - -function ok_wrapper(result, desc, addToAttempted = true) { - ok(result, desc); - - if (result) { - passedTests++; - } - - if (addToAttempted) { - testAttempted(); - } -} - -// Added so that tests that don't register unless they fail, -// can at least notify that they've attempted to run. -function testAttempted() { - attemptedTests++; - if (attemptedTests == totalTestsToAttempt) { - // Make sure all tests have had a chance to complete. - setTimeout(function() {finish();}, 1000); - } -} - -var finishCalled = false; - -function finish() { - if (!finishCalled) { - finishCalled = true; - is(passedTests, totalTestsToPass, "There are " + totalTestsToPass + " modal tests that should pass"); - - SimpleTest.finish(); - } -} - -function doTest() { - // passes if good and fails if bad - // 1) A window opened from inside an iframe that has sandbox = "allow-scripts allow-popups - // allow-same-origin" should not have its origin sandbox flag set and be able to access - // document.cookie. (Done by file_iframe_sandbox_k_if5.html opened from - // file_iframe_sandbox_j_if1.html) using showModalDialog.) - - // passes if good - // 2) A window opened from inside an iframe that has sandbox = "allow-scripts allow-popups - // allow-top-navigation" should not have its top-level navigation sandbox flag set and be able to - // navigate top. (Done by file_iframe_sandbox_k_if5.html (and if6) opened from - // file_iframe_sandbox_j_if1.html) using showModalDialog.) - - // passes if good - // 3) A window opened from inside an iframe that has sandbox = "allow-scripts allow-popups - // all-forms" should not have its forms sandbox flag set and be able to submit forms. - // (Done by file_iframe_sandbox_k_if7.html opened from - // file_iframe_sandbox_j_if1.html) using showModalDialog.) - - // passes if good - // 4) Make sure that the sandbox flags copied to a new browsing context are taken from the - // current active document not the browsing context (iframe / docShell). - // This is done by removing allow-same-origin and calling doSubOpens from file_iframe_sandbox_j_if2.html, - // which opens file_iframe_sandbox_k_if9.html using showModalDialog. - var if_2 = document.getElementById('if_2'); - if_2.sandbox = 'allow-scripts allow-popups'; - if_2.contentWindow.doSubOpens(); - - // passes if good - // 5) Test that a sandboxed iframe with "allow-popups" can open a new window using window.ShowModalDialog. - // This is done via file_iframe_sandbox_j_if3.html which is sandboxed with "allow-popups allow-scripts - // allow-same-origin". The window it attempts to open calls window.opener.ok(true, ...) and - // file_iframe_j_if3.html has an ok() function that calls window.parent.ok_wrapper. -} - -addLoadEvent(doTest); -</script> - -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=766282">Mozilla Bug 766282</a> - implement allow-popups directive for iframe sandbox -<p id="display"></p> -<div id="content"> -<iframe sandbox="allow-scripts allow-popups allow-modals allow-same-origin allow-forms allow-top-navigation" id="if_1" src="file_iframe_sandbox_j_if1.html" height="10" width="10"></iframe> -<iframe sandbox="allow-scripts allow-popups allow-modals allow-same-origin" id="if_2" src="file_iframe_sandbox_j_if2.html" height="10" width="10"></iframe> -<iframe sandbox="allow-popups allow-modals allow-same-origin allow-scripts" id="if_3" src="file_iframe_sandbox_j_if3.html" height="10" width="10"></iframe> -</div> diff --git a/dom/locales/en-US/chrome/dom/dom.properties b/dom/locales/en-US/chrome/dom/dom.properties index 0472979d7b..6bd3aac947 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 bdbed6524b..8b4cea6d78 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 4bfc8337e8..0000000000 --- a/dom/tests/mochitest/bugs/file_bug291653.html +++ /dev/null @@ -1,28 +0,0 @@ -<html> - <head> - <script> - <!-- - function listener1() { - window.showModalDialog("data:text/html,<script>var maintest = opener.opener; opener.location = 'data:text/html,test'; maintest.end(); window.close();</script>"); - } - - function listener2() { - opener.secondListenerDidRun = true; - } - - window.addEventListener("foo", listener1); - window.addEventListener("foo", listener2); - - - function fireFoo() { - var e = document.createEvent("Events"); - e.initEvent("foo", true, true); - window.dispatchEvent(e); - } - //--> - </script> - </head> - <body onload="setTimeout(fireFoo, 0)"> - Test for bug 291653 - </body> -</html> diff --git a/dom/tests/mochitest/bugs/file_bug504862.html b/dom/tests/mochitest/bugs/file_bug504862.html deleted file mode 100644 index dc11ced6ff..0000000000 --- a/dom/tests/mochitest/bugs/file_bug504862.html +++ /dev/null @@ -1,22 +0,0 @@ -<html> -<body> -<script> -window.returnValue = 3; - -if (location.toString().match(/^http:\/\/mochi.test:8888/)) { - // Test that we got the right arguments. - opener.is(window.dialogArguments, "my args", - "dialog did not get the right arguments."); - - // Load a different url, and test that it sees the arguments (since it's same origin). - window.location="data:text/html,<html><body onload=\"opener.is(window.dialogArguments, 'my args', 'subsequent dialog document did not get the right arguments.'); close();\">';"; -} else { - // Post a message containing our arguments to the opener to test - // that this cross origing dialog does *not* see the passed in - // arguments. - opener.postMessage("args: " + window.dialogArguments, - "http://mochi.test:8888"); - - close(); -} -</script> diff --git a/dom/tests/mochitest/bugs/mochitest.ini b/dom/tests/mochitest/bugs/mochitest.ini index 309aab6e02..3743c67822 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 1543cdd96a..0000000000 --- a/dom/tests/mochitest/bugs/test_bug291653.html +++ /dev/null @@ -1,56 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=291653 ---> -<head> - <title>Test for Bug 291653</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=291653">Mozilla Bug 291653</a> -<p id="display"></p> -<div id="content" style="display: none"> - -</div> -<pre id="test"> -<script type="application/javascript"> - -/** Test for Bug 291653 **/ -SimpleTest.waitForExplicitFinish(); -SimpleTest.requestFlakyTimeout("untriaged"); - -var secondListenerDidRun = false; - -var w; -function start() { - if ("showModalDialog" in window) { - w = window.open("file_bug291653.html", "foo", "width=300,height=300"); - } else { - // window.showModalDialog doesn't exist in e10s mode, nothing to do in this test. - ok(true, "nothing to do in e10s mode"); - SimpleTest.finish(); - } -} - -function closeTest() { - w.setTimeout("close()", 0); - setTimeout("finish()", 500); -} - -function finish() { - ok(!secondListenerDidRun, "Shouldn't have run second listener!"); - SimpleTest.finish(); -} - -function end() { - setTimeout("closeTest()", 500); -} - -start(); - -</script> -</pre> -</body> -</html> diff --git a/dom/tests/mochitest/bugs/test_bug406375.html b/dom/tests/mochitest/bugs/test_bug406375.html deleted file mode 100644 index 2cd459ffa4..0000000000 --- a/dom/tests/mochitest/bugs/test_bug406375.html +++ /dev/null @@ -1,37 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=406375 ---> -<head> - <title>Test for Bug 406375</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body onload="runTest()"> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=406375">Mozilla Bug 406375</a> -<p id="display"></p> -<div id="content" style="display: none"> - -</div> -<pre id="test"> -<script type="application/javascript"> - -/** Test for Bug 406375 **/ - - -SimpleTest.waitForExplicitFinish(); - -function runTest() { - if ("showModalDialog" in window) { - window.showModalDialog("file_bug406375.html"); - } - ok(true, "This test should not hang"); - - SimpleTest.finish(); -} - -</script> -</pre> -</body> -</html> diff --git a/dom/tests/mochitest/bugs/test_bug414291.html b/dom/tests/mochitest/bugs/test_bug414291.html index 883e52bb49..0ee5cb393e 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,<html><body onload='close(); opener.result1 = 1;'>", "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,<html><body onload='close(); opener.result2 = 2;'>", "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,<html><body onload='close(); returnValue = 3;'>"); - is(result3, 3, "window should be opened as modal."); -} - </script> </pre> </body> diff --git a/dom/tests/mochitest/bugs/test_bug437361.html b/dom/tests/mochitest/bugs/test_bug437361.html deleted file mode 100644 index ecc2cb08d0..0000000000 --- a/dom/tests/mochitest/bugs/test_bug437361.html +++ /dev/null @@ -1,72 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=437361 ---> -<head> - <title>Test for Bug 437361</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> - - <script class="testbody" type="text/javascript"> - - /** Test for Bug 437361 **/ - - function testModalDialogBlockedCleanly() { - is(true, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check"); - var rv = window.showModalDialog( // should be blocked without exception - "data:text/html,<html><body onload='close(); returnValue = 1;' /></html>"); - is(rv, null, "Modal dialog opened unexpectedly."); - } - - function testModalDialogAllowed() { - is(false, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check"); - var rv = window.showModalDialog( // should not be blocked this time - "data:text/html,<html><body onload='close(); returnValue = 1;' /></html>"); - is(rv, 1, "Problem with modal dialog returnValue."); - } - - function testOtherExceptionsNotTrapped() { - is(false, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check"); - window.showModalDialog('about:config'); // forbidden by SecurityCheckURL - } - - function test(disableOpen, exceptionExpected, testFn, errorMsg) { - if ("showModalDialog" in window) { - var oldPrefVal = SpecialPowers.getBoolPref("dom.disable_open_during_load"); - try { - SpecialPowers.setBoolPref("dom.disable_open_during_load", disableOpen); - testFn(); - ok(!exceptionExpected, errorMsg); - } catch (_) { - ok(exceptionExpected, errorMsg); - } - finally { - SpecialPowers.setBoolPref("dom.disable_open_during_load", oldPrefVal); - } - } else { - ok(true, "nothing to do in e10s mode"); - } - } - - test(true, false, testModalDialogBlockedCleanly, - "Blocked showModalDialog caused an exception."); - - test(false, false, testModalDialogAllowed, - "showModalDialog was blocked even though dom.disable_open_during_load was false."); - - test(false, true, testOtherExceptionsNotTrapped, - "Incorrectly suppressed insecure showModalDialog exception."); - - </script> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=437361">Mozilla Bug 437361</a> -<p id="display"></p> -<div id="content" style="display: none"> -</div> -<pre id="test"> -</pre> -</body> -</html> - diff --git a/dom/tests/mochitest/bugs/test_bug479143.html b/dom/tests/mochitest/bugs/test_bug479143.html deleted file mode 100644 index 03db4ddea4..0000000000 --- a/dom/tests/mochitest/bugs/test_bug479143.html +++ /dev/null @@ -1,44 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=479143 ---> -<head> - <title>Test for Bug 411103</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=479143">Mozilla Bug 479143</a> -<p id="display"></p> -<div id="content" style="display: none"></div> - -<pre id="test"> -<script class="testbody" type="text/javascript"> - - SimpleTest.waitForExplicitFinish(); - - setTimeout(function() { - if ("showModalDialog" in window) { - var interval = setInterval(function() { var i = 0; i++; }, 10); - - var xhr = new XMLHttpRequest(); - xhr.open("GET", "test_bug479143.html", false); - xhr.send(null); - - window.showModalDialog("javascript:" + - "setTimeout(function() { window.close(); }, 1000);", - null); - - clearInterval(interval); - } - - ok(true, "did not crash"); - - SimpleTest.finish(); - }, 0); - -</script> -</pre> -</body> -</html> diff --git a/dom/tests/mochitest/bugs/test_bug504862.html b/dom/tests/mochitest/bugs/test_bug504862.html deleted file mode 100644 index 713165bc3d..0000000000 --- a/dom/tests/mochitest/bugs/test_bug504862.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=504862 ---> -<head> - <title>Test for Bug 504862</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body onload="runTest()"> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=504862">Mozilla Bug 504862</a> -<script class="testbody" type="text/javascript"> - -/** Test for Bug 504862 **/ -SimpleTest.waitForExplicitFinish(); -function onMsgRcv(event) -{ - is(event.data, "args: undefined", "Unexpected cross origin dialog arguments."); -} - -function runTest() { - if ("showModalDialog" in window) { - window.addEventListener("message", onMsgRcv, false); - - var result = window.showModalDialog("file_bug504862.html", "my args"); - // 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"); - - is(result, undefined, "Able to see return value from cross origin dialog."); - } else { - ok(true, "nothing to do in e10s mode"); - } - - SimpleTest.finish(); -} - -</script> -</pre> -</body> -</html> diff --git a/dom/tests/mochitest/bugs/test_bug61098.html b/dom/tests/mochitest/bugs/test_bug61098.html index 4c6ce967da..ed16e099b1 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 e1a25a425e..0000000000 --- a/dom/tests/mochitest/bugs/test_bug735237.html +++ /dev/null @@ -1,38 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=735237 ---> -<head> - <title>Test for Bug 735237</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=735237">Mozilla Bug 735237</a> -<p id="display"></p> -<div id="content" style="display: none"> - -</div> -<pre id="test"> -<script class="testbody" type="text/javascript"> - -/** Test for Bug 735237 **/ - -SimpleTest.waitForExplicitFinish(); - -SpecialPowers.pushPrefEnv({"set": [["dom.disable_window_showModalDialog", true]]}, function() { - var caughtException = false; - try { - window.showModalDialog("http://example.com/"); - } catch (e) { - caughtException = true; - } - ok(caughtException, "showModalDialog should throw an exception"); - SimpleTest.finish(); -}); - -</script> -</pre> -</body> -</html> diff --git a/dom/tests/mochitest/general/file_showModalDialog.html b/dom/tests/mochitest/general/file_showModalDialog.html deleted file mode 100644 index 1cae0b1c08..0000000000 --- a/dom/tests/mochitest/general/file_showModalDialog.html +++ /dev/null @@ -1,35 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script> - function go() { - is(SpecialPowers.wrap(window).location.toString(), location.toString(), "sanity"); - ok("returnValue" in window && "dialogArguments" in window, "We are modal"); - var iwin = document.getElementById('ifr').contentWindow; - is(SpecialPowers.Cu.getClassName(iwin, /* aUnwrap = */ true), "Window", "Descendant frames should not be modal"); - - if (location.origin != "http://mochi.test:8888") { - is(window.dialogArguments, undefined, - "dialogArguments should be undefined cross-origin: " + location.origin); - } - - window.returnValue = "rv: " + window.dialogArguments; - - // Allow for testing navigations in series. - if (location.search == "") { - window.close(); - } else { - var origins = location.search.split('?')[1].split(','); - var newsearch = '?' + origins.splice(1).join(','); - var newurl = location.toString().replace(location.origin, origins[0]) - .replace(location.search, newsearch); - location = newurl; - } - - } -</script> -</head> -<body onload="opener.postMessage('dosetup', '*');"> -<iframe id="ifr"></iframe> -</body> -</html> diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini index d00ea1d4bc..9f2fad7857 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 511c79e639..0000000000 --- a/dom/tests/mochitest/general/test_showModalDialog.html +++ /dev/null @@ -1,60 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=862918 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 862918</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> - <script type="application/javascript"> - - /** Test for window.showModalDialog. **/ - - // The modal window needs to touch Cu, which means that it needs - // SpecialPowers. But given the semantics of modal windows, we have to - // do some funny stuff with postMessage to set this up. - window.onmessage = function(evt) { - is(evt.data, 'dosetup', "message from modal window is correct"); - var win = SpecialPowers.wrap(evt.source); - win.wrappedJSObject.SpecialPowers = SpecialPowers; - SpecialPowers.setWrapped(win.wrappedJSObject, 'is', SpecialPowers.wrap(is)); - SpecialPowers.setWrapped(win.wrappedJSObject, 'ok', SpecialPowers.wrap(ok)); - win.wrappedJSObject.go(); - }; - - var someObj = { foo: 42, bar: "hi"}; - var xurl = location.toString() - .replace('mochi.test:8888', 'example.org') - .replace('test_showModal', 'file_showModal'); - if (xurl.indexOf('?') != -1) - xurl = xurl.substring(0, xurl.indexOf('?')); - is(showModalDialog('file_showModalDialog.html'), "rv: undefined"); - is(showModalDialog(xurl), undefined); - is(showModalDialog('file_showModalDialog.html', 3), "rv: 3"); - is(showModalDialog(xurl, 3), undefined); - is(showModalDialog('file_showModalDialog.html', someObj), "rv: " + someObj); - is(showModalDialog(xurl, someObj), undefined); - - // Test sequential navigations. - is(showModalDialog('file_showModalDialog.html?http://mochi.test:8888', 4), - 'rv: 4'); - is(showModalDialog('file_showModalDialog.html?http://example.com', 4), undefined); - is(showModalDialog('file_showModalDialog.html?http://example.com,http://mochi.test:8888', 4), 'rv: 4'); - - // This test used to assert after gc. Make sure it doesn't. - SpecialPowers.gc(); - - </script> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=862918">Mozilla Bug 862918</a> -<p id="display"></p> -<div id="content" style="display: none"> - -</div> -<pre id="test"> -</pre> -</body> -</html> diff --git a/dom/webidl/Window.webidl b/dom/webidl/Window.webidl index 468f1cc8ad..ab03bf40b0 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<Transferable> 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 = ""); diff --git a/embedding/browser/nsIWebBrowserChrome.idl b/embedding/browser/nsIWebBrowserChrome.idl index 40f03cbe4f..32dba42195 100644 --- a/embedding/browser/nsIWebBrowserChrome.idl +++ b/embedding/browser/nsIWebBrowserChrome.idl @@ -77,9 +77,6 @@ interface nsIWebBrowserChrome : nsISupports const unsigned long CHROME_NON_PRIVATE_WINDOW = 0x00020000; const unsigned long CHROME_PRIVATE_LIFETIME = 0x00040000; - // Whether this was opened by nsGlobalWindow::ShowModalDialog. - const unsigned long CHROME_MODAL_CONTENT_WINDOW = 0x00080000; - // Whether this window should use remote (out-of-process) tabs. const unsigned long CHROME_REMOTE_WINDOW = 0x00100000; diff --git a/embedding/components/windowwatcher/nsWindowWatcher.cpp b/embedding/components/windowwatcher/nsWindowWatcher.cpp index e0e8b4bef6..3732ea66de 100644 --- a/embedding/components/windowwatcher/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp @@ -683,7 +683,6 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent, bool windowNeedsName = false; bool windowIsModal = false; bool uriToLoadIsChrome = false; - bool windowIsModalContentDialog = false; uint32_t chromeFlags; nsAutoString name; // string version of aName @@ -775,30 +774,12 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent, } else { chromeFlags = CalculateChromeFlagsForChild(features); - // Until ShowModalDialog is removed, it's still possible for content to - // request dialogs, but only in single-process mode. if (aDialog) { MOZ_ASSERT(XRE_IsParentProcess()); chromeFlags |= nsIWebBrowserChrome::CHROME_OPENAS_DIALOG; } } - // If we're not called through our JS version of the API, and we got - // our internal modal option, treat the window we're opening as a - // modal content window (and set the modal chrome flag). - if (!aCalledFromJS && aArgv && - WinHasOption(features, "-moz-internal-modal", 0, nullptr)) { - windowIsModalContentDialog = true; - - // CHROME_MODAL gets inherited by dependent windows, which affects various - // platform-specific window state (especially on OSX). So we need some way - // to determine that this window was actually opened by nsGlobalWindow:: - // ShowModalDialog(), and that somebody is actually going to be watching - // for return values and all that. - chromeFlags |= nsIWebBrowserChrome::CHROME_MODAL_CONTENT_WINDOW; - chromeFlags |= nsIWebBrowserChrome::CHROME_MODAL; - } - SizeSpec sizeSpec; CalcSizeSpec(features, sizeSpec); @@ -1079,7 +1060,7 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent, MaybeDisablePersistence(features, newTreeOwner); } - if ((aDialog || windowIsModalContentDialog) && aArgv) { + if (aDialog && aArgv) { // Set the args on the new window. nsCOMPtr<nsPIDOMWindowOuter> piwin(do_QueryInterface(*aResult)); NS_ENSURE_TRUE(piwin, NS_ERROR_UNEXPECTED); @@ -1268,8 +1249,7 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent, SizeOpenedWindow(newTreeOwner, aParent, isCallerChrome, sizeSpec); } - // XXXbz isn't windowIsModal always true when windowIsModalContentDialog? - if (windowIsModal || windowIsModalContentDialog) { + if (windowIsModal) { nsCOMPtr<nsIDocShellTreeOwner> newTreeOwner; newDocShellItem->GetTreeOwner(getter_AddRefs(newTreeOwner)); nsCOMPtr<nsIWebBrowserChrome> newChrome(do_GetInterface(newTreeOwner)); diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 8f7ae0a580..c5daf92131 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1166,7 +1166,6 @@ pref("dom.disable_window_open_feature.menubar", false); pref("dom.disable_window_open_feature.resizable", true); pref("dom.disable_window_open_feature.minimizable", false); pref("dom.disable_window_open_feature.status", true); -pref("dom.disable_window_showModalDialog", true); pref("dom.allow_scripts_to_close_windows", false); |