diff --git a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp index 0495e5e4add9..ab0a5dc1c7cb 100644 --- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp +++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp @@ -79,6 +79,12 @@ WebBrowserPersistLocalDocument::GetPersistFlags(uint32_t* aFlags) { return NS_OK; } +NS_IMETHODIMP +WebBrowserPersistLocalDocument::GetIsClosed(bool* aIsClosed) { + *aIsClosed = false; + return NS_OK; +} + NS_IMETHODIMP WebBrowserPersistLocalDocument::GetIsPrivate(bool* aIsPrivate) { nsCOMPtr privacyContext = mDocument->GetLoadContext(); diff --git a/dom/webbrowserpersist/WebBrowserPersistRemoteDocument.cpp b/dom/webbrowserpersist/WebBrowserPersistRemoteDocument.cpp index 57de9308d065..bf274e56d27b 100644 --- a/dom/webbrowserpersist/WebBrowserPersistRemoteDocument.cpp +++ b/dom/webbrowserpersist/WebBrowserPersistRemoteDocument.cpp @@ -41,6 +41,12 @@ WebBrowserPersistRemoteDocument::~WebBrowserPersistRemoteDocument() { void WebBrowserPersistRemoteDocument::ActorDestroy(void) { mActor = nullptr; } +NS_IMETHODIMP +WebBrowserPersistRemoteDocument::GetIsClosed(bool* aIsClosed) { + *aIsClosed = !mActor; + return NS_OK; +} + NS_IMETHODIMP WebBrowserPersistRemoteDocument::GetIsPrivate(bool* aIsPrivate) { *aIsPrivate = mAttrs.isPrivate(); diff --git a/dom/webbrowserpersist/nsIWebBrowserPersistDocument.idl b/dom/webbrowserpersist/nsIWebBrowserPersistDocument.idl index 694783259772..24925e2fde1f 100644 --- a/dom/webbrowserpersist/nsIWebBrowserPersistDocument.idl +++ b/dom/webbrowserpersist/nsIWebBrowserPersistDocument.idl @@ -59,6 +59,7 @@ interface nsIWebBrowserPersistURIMap : nsISupports [scriptable, builtinclass, uuid(74aa4918-5d15-46b6-9ccf-74f9696d721d)] interface nsIWebBrowserPersistDocument : nsISupports { + readonly attribute boolean isClosed; readonly attribute boolean isPrivate; readonly attribute AUTF8String documentURI; readonly attribute AUTF8String baseURI; diff --git a/dom/webbrowserpersist/nsWebBrowserPersist.cpp b/dom/webbrowserpersist/nsWebBrowserPersist.cpp index ee669bd26258..7e143e230742 100644 --- a/dom/webbrowserpersist/nsWebBrowserPersist.cpp +++ b/dom/webbrowserpersist/nsWebBrowserPersist.cpp @@ -508,10 +508,13 @@ NS_IMETHODIMP nsWebBrowserPersist::SaveDocument(nsISupports* aDocument, rv = NS_ERROR_NO_INTERFACE; } } - if (doc) { + + bool closed = false; + if (doc && NS_SUCCEEDED(doc->GetIsClosed(&closed)) && !closed) { rv = SaveDocumentInternal(doc, fileAsURI, datapathAsURI); } - if (NS_FAILED(rv)) { + + if (NS_FAILED(rv) || closed) { SendErrorStatusChange(true, rv, nullptr, mURI); EndDownload(rv); } diff --git a/toolkit/components/windowcreator/test/browser.ini b/toolkit/components/windowcreator/test/browser.ini index 3bbad0771bbd..5e24f9cba33d 100644 --- a/toolkit/components/windowcreator/test/browser.ini +++ b/toolkit/components/windowcreator/test/browser.ini @@ -1,6 +1,4 @@ [browser_bug1204626.js] -fail-if = fission && !debug -skip-if = fission && os == 'linux' && debug support-files = bug1204626_doc0.html bug1204626_doc1.html