Skip to content

Commit

Permalink
Close create-address window when parent tab is closed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer committed Dec 22, 2017
1 parent fd5967f commit 68f9754
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions create-address/create-address.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ var p2 = browser.storage.local.get(["domains", "real_emails"]);
browser.runtime.onMessage.addListener(function (message) {
if (Array.isArray(message))
[parent_url, parent_id, tab_id] = message;

// Close window if parent tab is closed.
browser.tabs.onRemoved.addListener(function (id) {
if (id == tab_id)
browser.windows.getCurrent().then(function (window) {
browser.windows.remove(window.id);
});
});
});

var login_details = Promise.all([p1, p2]).then(function (result) {
Expand Down

0 comments on commit 68f9754

Please sign in to comment.