Skip to content

Commit

Permalink
Removed onRemoved listener
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill13579 committed Apr 25, 2018
1 parent af4b239 commit e5f7146
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
5 changes: 0 additions & 5 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ function tabUpdated(tabId, changeInfo, tab) {
}

function tabRemoved(tabId, removeInfo) {
sendMessage("TAB_REMOVED", {
tabId: tabId,
windowId: removeInfo.windowId,
windowClosing: removeInfo.isWindowClosing
});
if (lastTabId === tabId) {
lastTabId = undefined;
}
Expand Down
17 changes: 9 additions & 8 deletions src/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ function onMessage(request, sender, sendResponse) {
case "TAB_TITLE_CHANGED":
findTabEntryById(request.details.tabId).querySelector(".tab-title").textContent = request.details.title;
break;
case "TAB_REMOVED":
if (!request.details.windowClosing) {
removeTab(request.details.tabId, request.details.windowId);
}
break;
case "WINDOW_REMOVED":
removeWindow(request.details.windowId);
break;
Expand Down Expand Up @@ -120,7 +115,7 @@ function setActiveTab(windowId, tabId) {
// Remove tab
function removeTab(tabId, windowId) {
let tabEntry = findTabEntryById(tabId);
tabEntry.outerHTML = "";
tabEntry.parentElement.removeChild(tabEntry);
browser.tabs.query({
active: true,
windowId: windowId
Expand Down Expand Up @@ -399,15 +394,21 @@ function documentClicked(e) {
} else if (e.target.id === "details-close") {
document.querySelector("#details-placeholder").style.display = "inline-block";
document.querySelector("#tab-details").style.display = "none";
browser.tabs.remove(parseInt(document.querySelector("#tab-details").getAttribute("data-tab_id")));
browser.tabs.get(parseInt(document.querySelector("#tab-details").getAttribute("data-tab_id"))).then(function (tab){
browser.tabs.remove(parseInt(document.querySelector("#tab-details").getAttribute("data-tab_id"))).then(function (){
removeTab(tab.id, tab.windowId);
});
});
} else if (e.target.classList.contains("tab-entry-remove-btn")) {
let tabId = e.target.parentElement.parentElement.getAttribute("data-tab_id");
let tabDetails = document.querySelector("#tab-details");
if (tabDetails.getAttribute("data-tab_id") === tabId) {
tabDetails.style.display = "none";
document.querySelector("#details-placeholder").style.display = "inline-block";
}
browser.tabs.remove(parseInt(tabId));
browser.tabs.remove(parseInt(tabId)).then(function (){
removeTab(parseInt(tabId), parseInt(e.target.parentElement.parentElement.parentElement.parentElement.getAttribute("data-window_id")));
});
} else if (e.target.classList.contains("tab-entry-pin-btn")) {
let tabId = e.target.parentElement.parentElement.getAttribute("data-tab_id");
browser.tabs.get(parseInt(tabId)).then(function (tab){
Expand Down

0 comments on commit e5f7146

Please sign in to comment.