From bf81a5bd38aaa3b20ed19aaefd753a042db4a48d Mon Sep 17 00:00:00 2001 From: bridiver Date: Mon, 12 Jun 2017 21:18:48 -0700 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20debounce=20updates=20because=20?= =?UTF-8?q?we=E2=80=99ll=20lose=20changeInfo=20auditors=20@bbondy=20@darkd?= =?UTF-8?q?h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/browser/api/extensions.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/browser/api/extensions.js b/lib/browser/api/extensions.js index 6b7fff18ec..517f2135ec 100644 --- a/lib/browser/api/extensions.js +++ b/lib/browser/api/extensions.js @@ -364,19 +364,17 @@ app.on('web-contents-created', function (event, tab) { if (tabId === -1) return - const updateTabDebounce = debounce(chromeTabsUpdated, 5) - tab.on('pinned', function () { - updateTabDebounce(tabId) + chromeTabsUpdated(tabId) }) tab.on('page-title-updated', function () { - updateTabDebounce(tabId) + chromeTabsUpdated(tabId) }) tab.on('did-fail-load', function () { - updateTabDebounce(tabId) + chromeTabsUpdated(tabId) }) tab.on('did-fail-provisional-load', function () { - updateTabDebounce(tabId) + chromeTabsUpdated(tabId) }) tab.on('did-attach', function () { createTabValue(tab) @@ -386,21 +384,27 @@ app.on('web-contents-created', function (event, tab) { chromeTabsUpdated(tabId) // immediate }) tab.on('did-start-loading', function () { - updateTabDebounce(tabId) + chromeTabsUpdated(tabId) }) tab.on('did-stop-loading', function () { - updateTabDebounce(tabId) + chromeTabsUpdated(tabId) + }) + tab.on('did-start-navigation', function () { + chromeTabsUpdated(tabId) + }) + tab.on('did-finish-navigation', function () { + chromeTabsUpdated(tabId) }) tab.on('navigation-entry-commited', function (evt, url) { createTabValue(tab) - updateTabDebounce(tabId) + chromeTabsUpdated(tabId) }) tab.on('did-navigate', function (evt, url) { createTabValue(tab) chromeTabsUpdated(tabId) // immediate }) tab.on('did-navigate-in-page', function (evt, url, isMainFrame) { - updateTabDebounce(tabId) + chromeTabsUpdated(tabId) }) tab.on('load-start', function (evt, url, isMainFrame, isErrorPage) { if (isMainFrame) { @@ -410,13 +414,13 @@ app.on('web-contents-created', function (event, tab) { }) tab.on('did-finish-load', function () { createTabValue(tab) - updateTabDebounce(tabId) + chromeTabsUpdated(tabId) }) tab.on('set-active', function (evt, active) { chromeTabsUpdated(tabId) // immediate }) tab.on('set-tab-index', function (evt, index) { - updateTabDebounce(tabId) + chromeTabsUpdated(tabId) }) tab.on('will-destroy', function () { chromeTabsRemoved(tabId)