From 57e0d24fecaa9571356159392bc3e1a2ca9e9ab7 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Tue, 26 Mar 2019 19:50:14 +0500 Subject: [PATCH 01/22] Fixed: Preserve tab pinned state on reopening caused by Include/Exclude rules --- src/sidebar/proxy.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sidebar/proxy.js b/src/sidebar/proxy.js index 9df3f2ef..37a48cdd 100644 --- a/src/sidebar/proxy.js +++ b/src/sidebar/proxy.js @@ -18,6 +18,7 @@ export default function reqHandler(info) { url: info.url, cookieStoreId: rule.ctx, active: tab.active, + pinned: tab.pinned, }) browser.tabs.remove(tab.id) return @@ -36,6 +37,7 @@ export default function reqHandler(info) { windowId: State.windowId, url: info.url, active: tab.active, + pinned: tab.pinned, }) browser.tabs.remove(tab.id) return From a32b6f40309cc1b4f141faa3090775a947354cf6 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Tue, 26 Mar 2019 20:12:48 +0500 Subject: [PATCH 02/22] Refactoring --- src/sidebar/actions/panels.js | 2 +- src/sidebar/proxy.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sidebar/actions/panels.js b/src/sidebar/actions/panels.js index 68215385..e60baec2 100644 --- a/src/sidebar/actions/panels.js +++ b/src/sidebar/actions/panels.js @@ -273,7 +273,7 @@ export default { rule = new RegExp(rule.slice(1, rule.length - 1)) } - state.includeHostsRules.push({ ctx: ctr.id, host: rule }) + state.includeHostsRules.push({ ctx: ctr.id, value: rule }) } } diff --git a/src/sidebar/proxy.js b/src/sidebar/proxy.js index 37a48cdd..be466fb9 100644 --- a/src/sidebar/proxy.js +++ b/src/sidebar/proxy.js @@ -1,6 +1,7 @@ import State from './store.state' export default function reqHandler(info) { + if (!State.tabsMap) return let tab = State.tabsMap[info.tabId] if (!tab) return @@ -9,8 +10,8 @@ export default function reqHandler(info) { // Inlude rules for (let rule of State.includeHostsRules) { let ok - if ((typeof rule.host)[0] === 's') ok = info.url.indexOf(rule.host) !== -1 - else ok = rule.host.test(info.url) + if ((typeof rule.value)[0] === 's') ok = info.url.indexOf(rule.value) !== -1 + else ok = rule.value.test(info.url) if (ok && tab.cookieStoreId !== rule.ctx) { browser.tabs.create({ From 21add50e08f36bf293706d6a401a3f78e898eda1 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Tue, 26 Mar 2019 20:27:54 +0500 Subject: [PATCH 03/22] Fixed: Disable request handler in private window --- src/sidebar/actions/panels.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sidebar/actions/panels.js b/src/sidebar/actions/panels.js index e60baec2..47998db9 100644 --- a/src/sidebar/actions/panels.js +++ b/src/sidebar/actions/panels.js @@ -316,7 +316,8 @@ export default { /** * Set request handler */ - turnOnReqHandler() { + turnOnReqHandler({ state }) { + if (state.private) return if (!browser.proxy.onRequest.hasListener(ReqHandler)) { browser.proxy.onRequest.addListener(ReqHandler, { urls: [''] }) } @@ -325,7 +326,8 @@ export default { /** * Unset request handler */ - turnOffReqHandler() { + turnOffReqHandler({ state }) { + if (state.private) return if (browser.proxy.onRequest.hasListener(ReqHandler)) { browser.proxy.onRequest.removeListener(ReqHandler) } From 3a02887550699f8e46c4381160e8d99984de171f Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Tue, 26 Mar 2019 21:06:51 +0500 Subject: [PATCH 04/22] Fixed: Unclickable mute icon of pinned tab --- src/sidebar/components/panels/pinned-tab.vue | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/sidebar/components/panels/pinned-tab.vue b/src/sidebar/components/panels/pinned-tab.vue index c0f220ca..4786800c 100644 --- a/src/sidebar/components/panels/pinned-tab.vue +++ b/src/sidebar/components/panels/pinned-tab.vue @@ -31,9 +31,9 @@ .loading-spinner each n in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] .spinner-stick(class='spinner-stick-' + n) - .audio-badge(@mousedown.stop="", @click="$store.dispatch('remuteTabs', [tab.id])") - svg.-loud: use(xlink:href="#icon_loud") - svg.-mute: use(xlink:href="#icon_mute") + .audio-badge(@mousedown.stop="", @click="$store.dispatch('remuteTabs', [tab.id])") + svg.-loud: use(xlink:href="#icon_loud") + svg.-mute: use(xlink:href="#icon_mute") .ctx(v-if="ctx && ctxColor", :style="{background: ctxColor}") .title(v-if="withTitle") {{tab.title}} @@ -480,6 +480,8 @@ export default { padding-left: 1px .PinnedTab:before box-shadow: 0 -1px 0 0 var(--tabs-update-badge-bg) + .PinnedTab .audio-badge + pos(l: 16px) #root.-pinned-tabs-panel #root.-pinned-tabs-top @@ -634,10 +636,10 @@ export default { fill: var(--false-fg) // --- Audio badge -.PinnedTab .fav > .audio-badge +.PinnedTab .audio-badge box(absolute) size(10px, same) - pos(b: -3px, r: -3px) + pos(calc(50% + 1px), 17px) border-radius: 50% opacity: 0 z-index: -1 @@ -660,17 +662,17 @@ export default { #000000 7.5px, #000000 ) - .fav > .audio-badge - z-index: 2 + .audio-badge + z-index: 200 opacity: 1 transform: scale(1, 1) .PinnedTab[data-audible] - .fav > .audio-badge > svg.-loud + .audio-badge > svg.-loud opacity: 1 .PinnedTab[data-muted] - .fav > .audio-badge > svg.-mute + .audio-badge > svg.-mute opacity: 1 // --- Loaded fx From 3c5b1ac04160dba05d4769bb15ec5e82296e7257 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Tue, 26 Mar 2019 21:18:04 +0500 Subject: [PATCH 05/22] Refactoring --- src/sidebar/components/panels/tabs.tab.vue | 75 +++------------------- 1 file changed, 10 insertions(+), 65 deletions(-) diff --git a/src/sidebar/components/panels/tabs.tab.vue b/src/sidebar/components/panels/tabs.tab.vue index ff45d5a1..2997cb3e 100644 --- a/src/sidebar/components/panels/tabs.tab.vue +++ b/src/sidebar/components/panels/tabs.tab.vue @@ -501,89 +501,24 @@ export default { &[lvl="1"] padding-left: var(--tabs-indent) - > .lvl-wrapper:before - box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg) &[lvl="2"] padding-left: calc(var(--tabs-indent) * 2) - > .lvl-wrapper:before - box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -1.5) 0 0 0 var(--inactive-fg) &[lvl="3"] padding-left: calc(var(--tabs-indent) * 3) - > .lvl-wrapper:before - box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -1.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -2.5) 0 0 0 var(--inactive-fg) &[lvl="4"] padding-left: calc(var(--tabs-indent) * 4) - > .lvl-wrapper:before - box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -1.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -2.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -3.5) 0 0 0 var(--inactive-fg) &[lvl="5"] padding-left: calc(var(--tabs-indent) * 5) - > .lvl-wrapper:before - box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -1.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -2.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -3.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -4.5) 0 0 0 var(--inactive-fg) &[lvl="6"] padding-left: calc(var(--tabs-indent) * 6) - > .lvl-wrapper:before - box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -1.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -2.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -3.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -4.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -5.5) 0 0 0 var(--inactive-fg) &[lvl="7"] padding-left: calc(var(--tabs-indent) * 7) - > .lvl-wrapper:before - box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -1.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -2.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -3.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -4.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -5.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -6.5) 0 0 0 var(--inactive-fg) &[lvl="8"] padding-left: calc(var(--tabs-indent) * 8) - > .lvl-wrapper:before - box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -1.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -2.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -3.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -4.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -5.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -6.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -7.5) 0 0 0 var(--inactive-fg) &[lvl="9"] padding-left: calc(var(--tabs-indent) * 9) - > .lvl-wrapper:before - box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -1.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -2.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -3.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -4.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -5.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -6.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -7.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -8.5) 0 0 0 var(--inactive-fg) &[lvl="10"] padding-left: calc(var(--tabs-indent) * 10) - > .lvl-wrapper:before - box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -1.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -2.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -3.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -4.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -5.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -6.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -7.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -8.5) 0 0 0 var(--inactive-fg), - calc(var(--tabs-indent) * -9.5) 0 0 0 var(--inactive-fg) &[is-parent] .fav:hover > .exp @@ -715,6 +650,16 @@ export default { opacity: .8 #root.-tabs-lvl-marks .Tab .lvl-wrapper:before box(block) + box-shadow: calc(var(--tabs-indent) / -2) 0 0 0 var(--inactive-fg), + calc(var(--tabs-indent) * -1.5) 0 0 0 var(--inactive-fg), + calc(var(--tabs-indent) * -2.5) 0 0 0 var(--inactive-fg), + calc(var(--tabs-indent) * -3.5) 0 0 0 var(--inactive-fg), + calc(var(--tabs-indent) * -4.5) 0 0 0 var(--inactive-fg), + calc(var(--tabs-indent) * -5.5) 0 0 0 var(--inactive-fg), + calc(var(--tabs-indent) * -6.5) 0 0 0 var(--inactive-fg), + calc(var(--tabs-indent) * -7.5) 0 0 0 var(--inactive-fg), + calc(var(--tabs-indent) * -8.5) 0 0 0 var(--inactive-fg), + calc(var(--tabs-indent) * -9.5) 0 0 0 var(--inactive-fg) // --- Drag layer --- .Tab .drag-layer From 0683476a16e10128af7161c7976440d6e1a99637 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Wed, 27 Mar 2019 16:23:40 +0500 Subject: [PATCH 06/22] Cleanup --- src/sidebar/actions/sync.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sidebar/actions/sync.js b/src/sidebar/actions/sync.js index 64693852..14fb2bcf 100644 --- a/src/sidebar/actions/sync.js +++ b/src/sidebar/actions/sync.js @@ -119,7 +119,6 @@ export default { updateSyncPanels({ state, getters }, synced) { if (!synced) return if (synced.id === state.localID) return - // console.log('[DEBUG] SYNC ACTION updateSyncPanels'); // Check if this data already used if (state.synced[synced.id] && state.synced[synced.id] >= synced.time) return From 52402ba3d31986fde937bf92a8d028aa6d758093 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Wed, 27 Mar 2019 19:07:27 +0500 Subject: [PATCH 07/22] Fixed: Preserve tree structure on dropping bookmarks or tabs with groupOnOpen option disabled --- src/sidebar/actions/tabs.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sidebar/actions/tabs.js b/src/sidebar/actions/tabs.js index 4279a944..2dfd42c0 100644 --- a/src/sidebar/actions/tabs.js +++ b/src/sidebar/actions/tabs.js @@ -800,6 +800,9 @@ export default { pinned: pin, }) oldNewMap[node.id] = info.id + if (state.tabsMap[info.id] && opener) { + state.tabsMap[info.id].parentId = opener + } } // Remove source tabs From 7f5023729ba2fee7490d0063e05a850245c36c28 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Wed, 27 Mar 2019 19:53:08 +0500 Subject: [PATCH 08/22] Fixed: Update tab height value after changing it in styles editor --- src/sidebar/actions/styles.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sidebar/actions/styles.js b/src/sidebar/actions/styles.js index 8003eb3f..d0ee51fc 100644 --- a/src/sidebar/actions/styles.js +++ b/src/sidebar/actions/styles.js @@ -61,6 +61,7 @@ export default { const rootEl = document.getElementById('root') Vue.set(state.customStyles, key, val) rootEl.style.setProperty(Utils.CSSVar(key), val) + setTimeout(() => EventBus.$emit('dynVarChange'), 256) }, /** @@ -70,5 +71,6 @@ export default { const rootEl = document.getElementById('root') Vue.set(state.customStyles, key, null) rootEl.style.removeProperty(Utils.CSSVar(key)) + setTimeout(() => EventBus.$emit('dynVarChange'), 256) }, } \ No newline at end of file From eb957aec1bfb8314bd2b0911baac127e275560ef Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Wed, 27 Mar 2019 21:10:27 +0500 Subject: [PATCH 09/22] Fixed: Scroll to active tab on initialization --- src/sidebar/actions/styles.js | 3 +-- src/sidebar/actions/tabs.js | 13 +++++++++++++ src/sidebar/index.js | 5 +++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/sidebar/actions/styles.js b/src/sidebar/actions/styles.js index d0ee51fc..eb469d2c 100644 --- a/src/sidebar/actions/styles.js +++ b/src/sidebar/actions/styles.js @@ -21,8 +21,7 @@ export default { } state.customStyles = loadedStyles - - setTimeout(() => EventBus.$emit('dynVarChange'), 256) + EventBus.$emit('dynVarChange') }, /** diff --git a/src/sidebar/actions/tabs.js b/src/sidebar/actions/tabs.js index 2dfd42c0..829fcee1 100644 --- a/src/sidebar/actions/tabs.js +++ b/src/sidebar/actions/tabs.js @@ -145,6 +145,19 @@ export default { }, delay) }, + /** + * Scroll to active tab + */ + scrollToActiveTab({ state, getters }) { + const activePanel = getters.panels[state.panelIndex] + if (activePanel && activePanel.tabs) { + const activeTab = activePanel.tabs.find(t => t.active) + if (activeTab) { + EventBus.$emit('scrollToActiveTab', state.panelIndex, activeTab.id) + } + } + }, + /** * Create new tab in current window */ diff --git a/src/sidebar/index.js b/src/sidebar/index.js index 24f91f79..ebdceaad 100644 --- a/src/sidebar/index.js +++ b/src/sidebar/index.js @@ -87,9 +87,10 @@ export default new Vue({ await Store.dispatch('loadState') await Store.dispatch('loadContainers') await Store.dispatch('loadTabs') - Store.dispatch('loadStyles') - Store.dispatch('loadKeybindings') await Store.dispatch('loadLocalID') + await Store.dispatch('loadStyles') + Store.dispatch('scrollToActiveTab') + Store.dispatch('loadKeybindings') Store.dispatch('loadSyncPanels') Store.dispatch('loadSnapshots') Store.dispatch('loadFavicons') From 433d4e513dd4efb6bb2c19adf4f434d2d7c72769 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Wed, 27 Mar 2019 21:38:39 +0500 Subject: [PATCH 10/22] Fixed: z-index of tab's close button --- src/sidebar/components/panels/tabs.tab.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sidebar/components/panels/tabs.tab.vue b/src/sidebar/components/panels/tabs.tab.vue index 2997cb3e..4d480059 100644 --- a/src/sidebar/components/panels/tabs.tab.vue +++ b/src/sidebar/components/panels/tabs.tab.vue @@ -491,7 +491,6 @@ export default { color: var(--tabs-fg-hover) .close opacity: 1 - z-index: 20 &:active &[is-active]:active background-color: var(--tabs-bg-active) @@ -879,7 +878,7 @@ export default { size(31px) height: var(--tabs-height) cursor: pointer - z-index: -1 + z-index: 20 opacity: 0 &:hover > svg fill: #ea4335 From 6ebd786d30cbcae21838dcb947dfd1cef91f07bf Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Wed, 27 Mar 2019 21:50:06 +0500 Subject: [PATCH 11/22] Fixed: Removed 'group' option from context menu of pinned tab --- src/sidebar/store.actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sidebar/store.actions.js b/src/sidebar/store.actions.js index 2454c459..e727350b 100644 --- a/src/sidebar/store.actions.js +++ b/src/sidebar/store.actions.js @@ -140,7 +140,7 @@ export default { }) } - if (state.tabsTree) { + if (state.tabsTree && !node.pinned) { menu.add('tab.group', 'groupTabs', state.selected) } From 416b459585704c62481a4cae7b850f2787b881f7 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Thu, 28 Mar 2019 09:38:11 +0500 Subject: [PATCH 12/22] Build: added ff-esr --- .gitignore | 4 +++- build/debug.js | 4 ++-- build/profile-esr/__preserve-dir | 1 + package.json | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 build/profile-esr/__preserve-dir diff --git a/.gitignore b/.gitignore index 9afe5dc9..c32604fc 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,6 @@ build/profile-ru/* build/profile-en/* !build/profile-en/__preserve-dir build/profile-beta/* -!build/profile-beta/__preserve-dir \ No newline at end of file +!build/profile-beta/__preserve-dir +build/profile-esr/* +!build/profile-esr/__preserve-dir \ No newline at end of file diff --git a/build/debug.js b/build/debug.js index 463dae6d..a734f80d 100644 --- a/build/debug.js +++ b/build/debug.js @@ -2,7 +2,7 @@ /*eslint no-console: off*/ const { spawn, spawnSync } = require('child_process') const { scripts } = require('../package.json') -const LANG = process.argv[process.argv.length - 1] +const VER = process.argv[process.argv.length - 1] const colors = { reset: '\x1b[0m', @@ -36,7 +36,7 @@ const PERM_HIDE = scripts['dev.perm.hide'].split(' ') const PERM_HIDE_CMD = PERM_HIDE[0] const PERM_HIDE_OPT = PERM_HIDE.slice(1) -const EXT = scripts['dev.ext.' + LANG].split(' ') +const EXT = scripts['dev.ext.' + VER].split(' ') const EXT_CMD = EXT[0] const EXT_OPT = EXT.slice(1) diff --git a/build/profile-esr/__preserve-dir b/build/profile-esr/__preserve-dir new file mode 100644 index 00000000..e5418e0b --- /dev/null +++ b/build/profile-esr/__preserve-dir @@ -0,0 +1 @@ +preserve-dir \ No newline at end of file diff --git a/package.json b/package.json index 0e99425e..15a3cef4 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,10 @@ "dev.perm.hide": "parcel watch ./src/permissions/tab-hide.html -d ./addon/permissions/ --public-url ./ --no-autoinstall", "dev.ext.en": "web-ext run --source-dir ./addon -f firefox-beta --keep-profile-changes --firefox-profile ./build/profile-beta", "dev.ext.ru": "web-ext run --source-dir ./addon -f firefox --keep-profile-changes --firefox-profile ./build/profile-ru", + "dev.ext.esr": "web-ext run --source-dir ./addon -f firefox-esr --keep-profile-changes --firefox-profile ./build/profile-esr", "dev": "node ./build/debug.js en", "dev.ru": "node ./build/debug.js ru", + "dev.esr": "node ./build/debug.js esr", "build.sidebar": "parcel build ./src/sidebar/index.html -d ./addon/sidebar/ --public-url ./ --no-autoinstall --no-source-maps", "build.group": "parcel build ./src/group/group.html -d ./addon/group/ --public-url ./ --no-autoinstall --no-source-maps", "build.perm.url": "parcel build ./src/permissions/all-urls.html -d ./addon/permissions/ --public-url ./ --no-autoinstall --no-source-maps", From 0f56b425f352f1342f291bd3c68f89d96f432542 Mon Sep 17 00:00:00 2001 From: mbnuqw Date: Thu, 28 Mar 2019 09:38:50 +0500 Subject: [PATCH 13/22] Fixed: Update favicon on url-change --- src/sidebar/actions/tabs.js | 2 ++ src/sidebar/components/index.vue | 27 +++++++++++++++++----- src/sidebar/components/panels/tabs.tab.vue | 12 ++++------ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/sidebar/actions/tabs.js b/src/sidebar/actions/tabs.js index 829fcee1..1581073b 100644 --- a/src/sidebar/actions/tabs.js +++ b/src/sidebar/actions/tabs.js @@ -41,7 +41,9 @@ export default { t.parentId = -1 t.invisible = false t.lvl = 0 + t.host = t.url.split('/')[2] || '' state.tabsMap[t.id] = t + if (!t.favIconUrl || t.favIconUrl.startsWith('chrome:')) t.favIconUrl = '' }) state.tabs = tabs diff --git a/src/sidebar/components/index.vue b/src/sidebar/components/index.vue index c1bfc7df..1678ac8d 100644 --- a/src/sidebar/components/index.vue +++ b/src/sidebar/components/index.vue @@ -1245,6 +1245,9 @@ export default { tab.parentId = -1 tab.lvl = 0 tab.invisible = false + tab.favIconUrl = '' + tab.host = '' + if (tab.url) tab.host = tab.url.split('/')[2] || '' // Put new tab in tabs list State.tabsMap[tab.id] = tab @@ -1285,9 +1288,17 @@ export default { */ onUpdatedTab(tabId, change, tab) { if (tab.windowId !== State.windowId) return - if (!State.tabs[tab.index]) return - if (State.tabs[tab.index].id !== tabId) return - const localTab = State.tabs[tab.index] + + const localTab = State.tabsMap[tabId] + if (!localTab) return + + // Url + if (change.hasOwnProperty('url')) { + if (change.url !== localTab.url) { + localTab.host = change.url.split('/')[2] || '' + if (change.url.startsWith('about:')) localTab.favIconUrl = '' + } + } // Loaded if (change.hasOwnProperty('status')) { @@ -1298,9 +1309,13 @@ export default { // Handle favicon change // If favicon is base64 string - store it in cache - if (change.favIconUrl && change.favIconUrl.startsWith('data:')) { - const hostname = tab.url.split('/')[2] - Store.dispatch('setFavicon', { hostname, icon: change.favIconUrl }) + if (change.favIconUrl) { + if (change.favIconUrl.startsWith('data:')) { + const hostname = tab.url.split('/')[2] + Store.dispatch('setFavicon', { hostname, icon: change.favIconUrl }) + } else if (change.favIconUrl.startsWith('chrome:')) { + change.favIconUrl = '' + } } // Handle unpinned tab diff --git a/src/sidebar/components/panels/tabs.tab.vue b/src/sidebar/components/panels/tabs.tab.vue index 4d480059..40812b97 100644 --- a/src/sidebar/components/panels/tabs.tab.vue +++ b/src/sidebar/components/panels/tabs.tab.vue @@ -1,7 +1,7 @@