Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
don’t debounce updates because we’ll lose changeInfo
Browse files Browse the repository at this point in the history
auditors @bbondy @darkdh
  • Loading branch information
bridiver committed Jun 16, 2017
1 parent cff02dc commit bf81a5b
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lib/browser/api/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) {
Expand All @@ -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)
Expand Down

0 comments on commit bf81a5b

Please sign in to comment.