diff --git a/dom/base/crashtests/1697525.html b/dom/base/crashtests/1697525.html new file mode 100644 index 000000000000..b8180700d354 --- /dev/null +++ b/dom/base/crashtests/1697525.html @@ -0,0 +1,6 @@ + + diff --git a/dom/base/crashtests/crashtests.list b/dom/base/crashtests/crashtests.list index a7e74ad4ebe7..b56cf0b98bcd 100644 --- a/dom/base/crashtests/crashtests.list +++ b/dom/base/crashtests/crashtests.list @@ -260,3 +260,4 @@ asserts(0-1) load 1623918.html # May hit an assertion if the element's a load 1656925.html skip-if(Android) load 1665792.html # Print preview on android doesn't fly load 1681729.html +load 1697525.html diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index 9e9df2bc3b56..814328932598 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -5241,7 +5241,12 @@ Nullable nsGlobalWindowOuter::Print( if (docToPrint->IsStaticDocument() && (aIsPreview == IsPreview::Yes || StaticPrefs::print_tab_modal_enabled())) { - MOZ_DIAGNOSTIC_ASSERT(aForWindowDotPrint == IsForWindowDotPrint::No); + if (aForWindowDotPrint == IsForWindowDotPrint::Yes) { + aError.ThrowNotSupportedError( + "Calling print() from a print preview is unsupported, did you intend " + "to call printPreview() instead?"); + return nullptr; + } // We're already a print preview window, just reuse our browsing context / // content viewer. bc = sourceBC;