File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 4
4
5
5
module BackgroundScript {
6
6
var tabStates ;
7
+
7
8
export function getTabStateManager ( ) {
8
9
return tabStates ;
9
10
}
11
+
10
12
function init ( ) {
11
13
tabStates = new TabStateManager ( ) ;
12
14
addTabStateListeners ( tabStates ) ;
@@ -32,10 +34,9 @@ module BackgroundScript {
32
34
var id = sender . tab . id ;
33
35
// Reset the tab state whenever it is loaded/reloaded
34
36
if ( request . event == "loaded" ) {
35
- if ( tabStates . exists ( id ) ) {
37
+ if ( ! tabStates . exists ( id ) ) { // New tab
36
38
tabStates . resetState ( id ) ;
37
- } else {
38
- // Don't change the query, only reset searching
39
+ } else { // Same tab, refresh or new URL
39
40
tabStates . set ( id , "searching" , false ) ;
40
41
}
41
42
}
Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ module Popup {
8
8
var tabStates = BackgroundInterface . getTabStateManager ( ) ;
9
9
10
10
// In most cases the map entry will already be initialized. However, there
11
- // may be a few edge cases where we need to initialize it ourselves.
11
+ // may be a few edge cases where we need to initialize it ourselves,
12
+ // like if we enable/reload the extension
12
13
if ( ! tabStates . exists ( id ) ) {
13
14
Utils . log ( "ID doesn't exist. Initializing entry." )
14
15
tabStates . resetState ( id ) ;
You can’t perform that action at this time.
0 commit comments