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";
1313 * onClick listener for the extension toolbar button.
1414 */
1515chrome . action . onClicked . addListener ( async ( tab ) => {
16- if ( ! isTabAllowedToAttach ( tab ) ) {
17- return ;
18- }
19-
2016 if ( ! state . tabId && tab . id !== undefined ) {
2117 state . tabId = tab . id ;
2218 }
2319
2420 switch ( state . recordingState ) {
2521 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+ }
2626 await startTracing ( ) ;
2727 break ;
2828 case "recording" :
@@ -48,10 +48,6 @@ chrome.commands.onCommand.addListener(async (command) => {
4848 return ;
4949 }
5050
51- if ( ! isTabAllowedToAttach ( tab ) ) {
52- return ;
53- }
54-
5551 if ( ! state . tabId && tab . id !== undefined ) {
5652 state . tabId = tab . id ;
5753 }
@@ -60,6 +56,10 @@ chrome.commands.onCommand.addListener(async (command) => {
6056 case "start-stop-profiler" : {
6157 switch ( state . recordingState ) {
6258 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+ }
6363 await startTracing ( ) ;
6464 break ;
6565 case "recording" :
You can’t perform that action at this time.
0 commit comments