 Issue 29595588:
  Issue 5952 - Clicking Cancel in the issue reporter doesn't close the tab  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockplusui/
    
  
    Issue 29595588:
  Issue 5952 - Clicking Cancel in the issue reporter doesn't close the tab  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockplusui/| Index: issue-reporter.js | 
| =================================================================== | 
| --- a/issue-reporter.js | 
| +++ b/issue-reporter.js | 
| @@ -27,17 +27,17 @@ let pages = { | 
| commentPage: [initCommentPage, leaveCommentPage], | 
| sendPage: [initSendPage, leaveSendPage] | 
| }; | 
| document.addEventListener("DOMContentLoaded", () => | 
| { | 
| document.getElementById("cancel").addEventListener("click", () => | 
| { | 
| - window.close(); | 
| + closeMe(); | 
| }); | 
| document.getElementById("continue").addEventListener("click", () => | 
| { | 
| if (!document.getElementById("continue").disabled) | 
| pages[getCurrentPage()][1](); | 
| }); | 
| @@ -58,16 +58,24 @@ document.addEventListener("DOMContentLoa | 
| }).then(url => | 
| { | 
| document.getElementById("privacyPolicy").href = url; | 
| }); | 
| initDataCollector(); | 
| }); | 
| +function closeMe() | 
| +{ | 
| + browser.runtime.sendMessage({ | 
| + type: "app.get", | 
| + what: "senderId" | 
| + }).then(tabId => browser.tabs.remove(tabId)); | 
| 
Thomas Greiner
2017/11/02 12:39:51
Wouldn't it make more sense to leave it up to the
 
Wladimir Palant
2017/11/02 13:16:51
That's the approach I chose initially but so far w
 
Thomas Greiner
2017/11/02 14:13:02
Not sure either whether this choice was made inten
 | 
| +} | 
| + | 
| function getCurrentPage() | 
| { | 
| return document.querySelector(".page:not([hidden])").id; | 
| } | 
| function setCurrentPage(pageId) | 
| { | 
| if (!pages.hasOwnProperty(pageId)) | 
| @@ -244,17 +252,17 @@ function initDataCollector() | 
| return Promise.all(handlers); | 
| }).then(() => | 
| { | 
| setCurrentPage("typeSelectorPage"); | 
| }).catch(e => | 
| { | 
| console.error(e); | 
| alert(e); | 
| - window.close(); | 
| + closeMe(); | 
| }); | 
| } | 
| function initTypeSelector() | 
| { | 
| document.getElementById("typeFalsePositive").focus(); | 
| @@ -494,10 +502,10 @@ function initSendPage() | 
| progress.value = event.loaded; | 
| } | 
| }); | 
| request.send(serializeReportData()); | 
| } | 
| function leaveSendPage() | 
| { | 
| - window.close(); | 
| + closeMe(); | 
| } |