diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-21 20:00:48 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-21 21:36:54 -0500 |
commit | a9290ef91ec408fa7886b99cc59be40b413a0ce0 (patch) | |
tree | 1fa82c7349a85865717c83dedbba38aae87fe8b9 /dom/base | |
parent | 722161775b9ec9314d1b02f567e42b83115cf993 (diff) | |
download | UXP-a9290ef91ec408fa7886b99cc59be40b413a0ce0.tar UXP-a9290ef91ec408fa7886b99cc59be40b413a0ce0.tar.gz UXP-a9290ef91ec408fa7886b99cc59be40b413a0ce0.tar.lz UXP-a9290ef91ec408fa7886b99cc59be40b413a0ce0.tar.xz UXP-a9290ef91ec408fa7886b99cc59be40b413a0ce0.zip |
Issue #1366 - Completely remove showModalDialog
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/nsDeprecatedOperationList.h | 1 | ||||
-rw-r--r-- | dom/base/nsGlobalWindow.cpp | 333 | ||||
-rw-r--r-- | dom/base/nsGlobalWindow.h | 61 | ||||
-rw-r--r-- | dom/base/nsPIDOMWindow.h | 10 | ||||
-rw-r--r-- | dom/base/nsSandboxFlags.h | 3 | ||||
-rw-r--r-- | dom/base/test/mochitest.ini | 4 | ||||
-rw-r--r-- | dom/base/test/mutationobserver_dialog.html | 62 | ||||
-rw-r--r-- | dom/base/test/test_dialogArguments.html | 31 | ||||
-rw-r--r-- | dom/base/test/test_mutationobservers.html | 22 |
9 files changed, 6 insertions, 521 deletions
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<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 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<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 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 @@ -<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 70a091d00..000000000 --- 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 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 = "<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); } |