Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the data-pdfjsprinting attribute on the <body> when destroying FirefoxPrintService/PDFPrintService instances (issue 10948) #10959

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions web/firefox_print_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,21 @@ function FirefoxPrintService(pdfDocument, pagesOverview, printContainer) {

FirefoxPrintService.prototype = {
layout() {
let pdfDocument = this.pdfDocument;
let printContainer = this.printContainer;
let body = document.querySelector('body');
const { pdfDocument, pagesOverview, printContainer, } = this;

const body = document.querySelector('body');
body.setAttribute('data-pdfjsprinting', true);

for (let i = 0, ii = this.pagesOverview.length; i < ii; ++i) {
composePage(pdfDocument, i + 1, this.pagesOverview[i], printContainer);
for (let i = 0, ii = pagesOverview.length; i < ii; ++i) {
composePage(pdfDocument, i + 1, pagesOverview[i], printContainer);
}
},

destroy() {
this.printContainer.textContent = '';

const body = document.querySelector('body');
body.removeAttribute('data-pdfjsprinting');
},
};

Expand Down
6 changes: 5 additions & 1 deletion web/pdf_print_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ PDFPrintService.prototype = {
layout() {
this.throwIfInactive();

let body = document.querySelector('body');
const body = document.querySelector('body');
body.setAttribute('data-pdfjsprinting', true);

let hasEqualPageSizes = this.pagesOverview.every(function(size) {
Expand Down Expand Up @@ -114,6 +114,10 @@ PDFPrintService.prototype = {
return;
}
this.printContainer.textContent = '';

const body = document.querySelector('body');
body.removeAttribute('data-pdfjsprinting');

if (this.pageStyleSheet) {
this.pageStyleSheet.remove();
this.pageStyleSheet = null;
Expand Down