mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 17:55:50 +00:00
Bug 1611133 - Fix print preview close handler. r=bgrins
For HTML documents the onclose event is not dispatched to the root <html> element. Differential Revision: https://phabricator.services.mozilla.com/D62605 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
556504ff93
commit
011b986e6d
@ -638,15 +638,15 @@ var PrintUtils = {
|
||||
}
|
||||
|
||||
// copy the window close handler
|
||||
if (document.documentElement.hasAttribute("onclose")) {
|
||||
this._closeHandlerPP = document.documentElement.getAttribute("onclose");
|
||||
if (window.onclose) {
|
||||
this._closeHandlerPP = window.onclose;
|
||||
} else {
|
||||
this._closeHandlerPP = null;
|
||||
}
|
||||
document.documentElement.setAttribute(
|
||||
"onclose",
|
||||
"PrintUtils.exitPrintPreview(); return false;"
|
||||
);
|
||||
window.onclose = function() {
|
||||
PrintUtils.exitPrintPreview();
|
||||
return false;
|
||||
};
|
||||
|
||||
// disable chrome shortcuts...
|
||||
window.addEventListener("keydown", this.onKeyDownPP, true);
|
||||
@ -673,9 +673,9 @@ var PrintUtils = {
|
||||
|
||||
// restore the old close handler
|
||||
if (this._closeHandlerPP) {
|
||||
document.documentElement.setAttribute("onclose", this._closeHandlerPP);
|
||||
window.onclose = this._closeHandlerPP;
|
||||
} else {
|
||||
document.documentElement.removeAttribute("onclose");
|
||||
window.onclose = null;
|
||||
}
|
||||
this._closeHandlerPP = null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user