This repository was archived by the owner on Oct 3, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
runner-modules/tabs/lib/content Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3939 }
4040 } ) ;
4141
42- window . openRunnerRegisterRunnerModule = async ( moduleName , func ) => {
42+ const openRunnerRegisterRunnerModule = async ( moduleName , func ) => {
4343 try {
4444 if ( typeof func !== 'function' ) {
4545 throw Error ( 'openRunnerRegisterRunnerModule(): Invalid `func`' ) ;
6161 }
6262 } ;
6363
64+ window . openRunnerRegisterRunnerModule = openRunnerRegisterRunnerModule ;
65+ // Workaround for firefox bug (last tested to occur in v57)
66+ // it seems that sometimes this content script is executed so early that firefox still has to perform some kind of house keeping,
67+ // which causes our global variable to disappear. assigning the global variable again in a microtask works around this bug.
68+ Promise . resolve ( ) . then ( ( ) => {
69+ window . openRunnerRegisterRunnerModule = openRunnerRegisterRunnerModule ;
70+ } ) ;
71+
6472 log . debug ( 'Initialized... Notifying the background script' ) ;
6573 rpc . notify ( 'tabs.mainContentInit' )
6674 . catch ( err => log . error ( { err} , 'Unable to send tabs.mainContentInit to the background script' ) ) ;
You can’t perform that action at this time.
0 commit comments