@@ -26,7 +26,7 @@ state.ignoredTabs = new Set();
2626state . mutedMedia = new Set ( ) ; // Tab IDs of resumable muted media.
2727state . legacyMedia = new Set ( ) ; // Tab IDs of old media.
2828state . autoPauseWindow = null ;
29- state . denyPlayback = false ;
29+ state . locked = false ;
3030
3131let resolveInitialization ;
3232const initializationCompletePromise = new Promise ( ( resolve ) => {
@@ -405,7 +405,7 @@ function autoResume(id) {
405405 hasProperty ( options , 'disableresume' ) ||
406406 state . media . size === 0 ||
407407 ( state . otherTabs . size > 0 && ! hasProperty ( options , 'ignoreother' ) ) ||
408- state . denyPlayback
408+ state . locked
409409 )
410410 return ;
411411 if (
@@ -494,7 +494,7 @@ chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
494494
495495function denyPlay ( tab , userActivation = false ) {
496496 // Security: Logic used to determine if videos are not allowed to play.
497- if ( state . denyPlayback ) return true ;
497+ if ( state . locked ) return true ;
498498 if ( userActivation ) return false ;
499499 if ( tab . id === state . activeTab ) return false ;
500500 if ( tab . id === state . lastPlaying ) return false ;
@@ -505,7 +505,7 @@ function denyPlay(tab, userActivation = false) {
505505
506506async function denyPause ( id , exclude , skipLast , allowbg , auto ) {
507507 // Security: Logic used to determine if the extension is not allowed to pause automatically.
508- if ( state . denyPlayback ) return false ;
508+ if ( state . locked ) return false ;
509509 if ( id === exclude ) return true ;
510510 if ( allowbg && state . backgroundaudio . has ( id ) ) return true ;
511511 if ( skipLast && id === state . lastPlaying ) return true ;
@@ -698,14 +698,12 @@ async function checkIdle(userState) {
698698 await initializationCompletePromise ;
699699 if ( ! hasProperty ( options , 'checkidle' ) ) return ;
700700 if ( userState === 'locked' ) {
701- state . waslocked = true ;
702- // Security: While locked no media should be playing and state.denyPlayback should stay true.
703- state . denyPlayback = true ;
701+ // Security: While locked no media should be playing and state.locked should stay true.
702+ state . locked = true ;
704703 // Pause everything
705704 pauseAll ( ) ;
706- } else if ( state . waslocked ) {
707- state . waslocked = false ;
708- state . denyPlayback = false ;
705+ } else if ( state . locked ) {
706+ state . locked = false ;
709707 const tabId = getResumeTab ( ) ;
710708 if ( tabId !== false ) play ( tabId ) ;
711709 }
0 commit comments