Skip to content

Commit

Permalink
Fix spurious error in content script
Browse files Browse the repository at this point in the history
No guarantee vAPI.bootstrap will still be present when callback
executes.
  • Loading branch information
gorhill committed Oct 4, 2024
1 parent 9f4123a commit 5133991
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/js/scriptlets/should-inject-contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
Home: https://github.com/gorhill/uBlock
*/

'use strict';

// If content scripts are already injected, we need to respond with `false`,
// to "should inject content scripts?"
//
Expand All @@ -31,7 +29,7 @@
try {
const status = vAPI.uBO !== true;
if ( status === false && vAPI.bootstrap ) {
self.requestIdleCallback(( ) => vAPI && vAPI.bootstrap());
self.requestIdleCallback(( ) => vAPI?.bootstrap());
}
return status;
} catch(ex) {
Expand Down

0 comments on commit 5133991

Please sign in to comment.