commit 7540556c69566bc5454be354d877d08b98ac5d99 Author: Georg Koppen gk@torproject.org Date: Mon Sep 17 20:25:09 2018 +0000
Bug 27097: Get the event listener scope right --- src/chrome/content/aboutTor/aboutTor-content.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/chrome/content/aboutTor/aboutTor-content.js b/src/chrome/content/aboutTor/aboutTor-content.js index ac552e21..ff5a970b 100644 --- a/src/chrome/content/aboutTor/aboutTor-content.js +++ b/src/chrome/content/aboutTor/aboutTor-content.js @@ -60,15 +60,16 @@ var AboutTorListener = { },
setupBannerClosing: function () { + let that = this; let closer = content.document.getElementById("tornews-banner-closer"); closer.addEventListener("click", function () { - sendAsyncMessage(this.kAboutTorHideTorNewsBanner); + sendAsyncMessage(that.kAboutTorHideTorNewsBanner); }); let link = content.document.querySelector("#tornews-banner-message a"); link.addEventListener("click", function () { // Wait until page unloads so we don't hide banner before that. content.addEventListener("unload", function () { - sendAsyncMessage(this.kAboutTorHideTorNewsBanner); + sendAsyncMessage(that.kAboutTorHideTorNewsBanner); }); }); bindPrefAndInit("extensions.torbutton.tornews_banner_countdown",