File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -13,16 +13,16 @@ import { assertExhaustiveCheck } from "./ts.js";
13
13
* onClick listener for the extension toolbar button.
14
14
*/
15
15
chrome . action . onClicked . addListener ( async ( tab ) => {
16
- if ( ! isTabAllowedToAttach ( tab ) ) {
17
- return ;
18
- }
19
-
20
16
if ( ! state . tabId && tab . id !== undefined ) {
21
17
state . tabId = tab . id ;
22
18
}
23
19
24
20
switch ( state . recordingState ) {
25
21
case "idle" :
22
+ // Only check this when we need to start profiling. We can stop at any time.
23
+ if ( ! isTabAllowedToAttach ( tab ) ) {
24
+ return ;
25
+ }
26
26
await startTracing ( ) ;
27
27
break ;
28
28
case "recording" :
@@ -48,10 +48,6 @@ chrome.commands.onCommand.addListener(async (command) => {
48
48
return ;
49
49
}
50
50
51
- if ( ! isTabAllowedToAttach ( tab ) ) {
52
- return ;
53
- }
54
-
55
51
if ( ! state . tabId && tab . id !== undefined ) {
56
52
state . tabId = tab . id ;
57
53
}
@@ -60,6 +56,10 @@ chrome.commands.onCommand.addListener(async (command) => {
60
56
case "start-stop-profiler" : {
61
57
switch ( state . recordingState ) {
62
58
case "idle" :
59
+ // Only check this when we need to start profiling. We can stop at any time.
60
+ if ( ! isTabAllowedToAttach ( tab ) ) {
61
+ return ;
62
+ }
63
63
await startTracing ( ) ;
64
64
break ;
65
65
case "recording" :
You can’t perform that action at this time.
0 commit comments