Index: popup.js |
=================================================================== |
--- a/popup.js |
+++ b/popup.js |
@@ -98,22 +98,40 @@ |
activateClickHide.timeout = null; |
} |
document.body.classList.remove("clickhide-active"); |
browser.tabs.sendMessage(tab.id, {type: "composer.content.finished"}); |
} |
function reportIssue() |
{ |
- browser.tabs.create({ |
- url: browser.runtime.getURL("/issue-reporter.html?" + tab.id) |
- }).then(() => |
- { |
- window.close(); |
- }); |
+ browser.tabs.captureVisibleTab( |
+ null, |
+ {format: "png"}, |
+ screenshot => |
+ { |
+ // setup a listener to provide once tab url |
+ // and base64 screenshot data once asked |
+ browser.runtime.onMessage.addListener( |
+ function onMessage(event) |
+ { |
+ if (event.type == "issue-reporter") |
+ { |
+ browser.runtime.onMessage.removeListener(onMessage); |
+ return Promise.resolve({url: tab.url, screenshot}); |
+ } |
+ } |
+ ); |
+ |
+ browser.tabs.create({ |
+ active: true, |
+ url: browser.runtime.getURL("/issue-reporter.html?" + tab.id) |
+ }); |
+ } |
+ ); |
} |
function toggleCollapse(event) |
{ |
let collapser = event.currentTarget; |
let collapsible = document.getElementById(collapser.dataset.collapsible); |
collapsible.classList.toggle("collapsed"); |
togglePref(collapser.dataset.option); |