From 70c1a6b120475033c0f34b1866f79e663fa564b2 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 17 Jan 2017 17:45:46 +0100 Subject: [PATCH] [Bug 1331081] omit addEventListener/removeEventListener's third parameter when it's false Upstream changes from https://bugzilla.mozilla.org/show_bug.cgi?id=1331081; this patch also covers one file, `pdf_print_service.js`, that's not present in mozilla-central. Fixes 7962. --- web/debugger.js | 6 +++--- web/firefoxcom.js | 4 ++-- web/pdf_history.js | 11 +++++------ web/pdf_print_service.js | 4 ++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/web/debugger.js b/web/debugger.js index 8a049f4c676a1..33c2bc4124295 100644 --- a/web/debugger.js +++ b/web/debugger.js @@ -403,13 +403,13 @@ var Stepper = (function StepperClosure() { var listener = function(e) { switch (e.keyCode) { case 83: // step - dom.removeEventListener('keydown', listener, false); + dom.removeEventListener('keydown', listener); self.nextBreakPoint = self.currentIdx + 1; self.goTo(-1); callback(); break; case 67: // continue - dom.removeEventListener('keydown', listener, false); + dom.removeEventListener('keydown', listener); var breakPoint = self.getNextBreakPoint(); self.nextBreakPoint = breakPoint; self.goTo(-1); @@ -417,7 +417,7 @@ var Stepper = (function StepperClosure() { break; } }; - dom.addEventListener('keydown', listener, false); + dom.addEventListener('keydown', listener); self.goTo(idx); }, goTo: function goTo(idx) { diff --git a/web/firefoxcom.js b/web/firefoxcom.js index 0b1a4122f2d09..2dbcd8df9b97f 100644 --- a/web/firefoxcom.js +++ b/web/firefoxcom.js @@ -76,9 +76,9 @@ var FirefoxCom = (function FirefoxComClosure() { document.documentElement.removeChild(node); - document.removeEventListener('pdf.js.response', listener, false); + document.removeEventListener('pdf.js.response', listener); return callback(response); - }, false); + }); } document.documentElement.appendChild(request); diff --git a/web/pdf_history.js b/web/pdf_history.js index 5c72527dbd0b2..7bc2080759607 100644 --- a/web/pdf_history.js +++ b/web/pdf_history.js @@ -114,7 +114,7 @@ } else { updateHistoryWithCurrentHash(); } - }, false); + }); function updateHistoryWithCurrentHash() { @@ -162,18 +162,17 @@ } // Remove the event listener when navigating away from the document, // since 'beforeunload' prevents Firefox from caching the document. - window.removeEventListener('beforeunload', pdfHistoryBeforeUnload, - false); + window.removeEventListener('beforeunload', pdfHistoryBeforeUnload); } - window.addEventListener('beforeunload', pdfHistoryBeforeUnload, false); + window.addEventListener('beforeunload', pdfHistoryBeforeUnload); window.addEventListener('pageshow', function pdfHistoryPageShow(evt) { // If the entire viewer (including the PDF file) is cached in // the browser, we need to reattach the 'beforeunload' event listener // since the 'DOMContentLoaded' event is not fired on 'pageshow'. - window.addEventListener('beforeunload', pdfHistoryBeforeUnload, false); - }, false); + window.addEventListener('beforeunload', pdfHistoryBeforeUnload); + }); self.eventBus.on('presentationmodechanged', function(e) { self.isViewerInPresentationMode = e.active; diff --git a/web/pdf_print_service.js b/web/pdf_print_service.js index 392cdaf9102ef..4b078408e5d74 100644 --- a/web/pdf_print_service.js +++ b/web/pdf_print_service.js @@ -320,8 +320,8 @@ event.stopImmediatePropagation(); } }; - window.addEventListener('beforeprint', stopPropagationIfNeeded, false); - window.addEventListener('afterprint', stopPropagationIfNeeded, false); + window.addEventListener('beforeprint', stopPropagationIfNeeded); + window.addEventListener('afterprint', stopPropagationIfNeeded); } var overlayPromise;