Bug 1653961. Stop previous printed doc's title/URL being used for the next doc. r=Gijs

The _originalURL/_originalTitle properties are used during print preview to
work around the simplified-mode doc losing the URL/title of the original
document. This change makes us clear those properties when print preview exits
so that a previously previewed documents title/URL doesn't "leak" to the next
document. It also fixes printWindow() to not assume these properties exist,
since if the print was invoked directly (not via print preview) they will not
have been set.

Differential Revision: https://phabricator.services.mozilla.com/D84674
This commit is contained in:
Jonathan Watt 2020-07-23 14:37:54 +00:00
Родитель 66d2269fb8
Коммит 680162874d
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -173,13 +173,13 @@ var PrintUtils = {
// Set the title so that the print dialog can pick it up and
// use it to generate the filename for save-to-PDF.
printSettings.title = this._originalTitle;
printSettings.title = this._originalTitle || topBrowser.contentTitle;
if (this._shouldSimplify) {
// The generated document for simplified print preview has "about:blank"
// as its URL. We need to set docURL here so that the print header/footer
// can be given the original document's URL.
printSettings.docURL = this._originalURL;
printSettings.docURL = this._originalURL || topBrowser.currentURI.spec;
}
// At some point we should handle the Promise that this returns (report
@ -734,6 +734,9 @@ var PrintUtils = {
this.ensureProgressDialogClosed();
this._listener.onExit();
this._originalTitle = "";
this._originalURL = "";
},
logTelemetry(ID) {