File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 const browserAPI = globalThis . chrome ?? globalThis . browser ;
2323 const contextMenuAPI = browserAPI ?. contextMenus ?? browserAPI ?. menus ;
2424 let supportsManagedPolicies = true ;
25- let replaceNewTabs = false ;
25+ let redirectToGoogle = false ;
2626
2727 // Import necessary scripts for functionality
2828 try {
4242 ) ;
4343 } catch ( error ) {
4444 // In Firefox-based browsers, importScripts is not available; scripts are loaded via background.html
45- replaceNewTabs = true ;
45+ redirectToGoogle = true ;
4646 console . debug ( "Running in Firefox or another environment without importScripts" ) ;
4747 console . debug ( `Error: ${ error } ` ) ;
4848 }
139139 * @param {number } tabId - The ID of the tab to be updated.
140140 */
141141 const sendToNewTabPage = tabId => {
142- if ( replaceNewTabs ) { // Firefox regression workaround
143- browserAPI . tabs . update ( tabId , { url : "about:newtab" } ) ;
144- browserAPI . tabs . update ( tabId , { url : "about:home" } ) ;
145- browserAPI . tabs . update ( tabId , { url : "about:blank" } ) ;
146-
147- // browserAPI.tabs.remove(tabId);
148- // browserAPI.tabs.create({});
142+ if ( redirectToGoogle ) {
143+ browserAPI . tabs . update ( tabId , { url : "https://www.google.com" } ) ;
149144 } else {
150145 browserAPI . tabs . update ( tabId , { url : "about:newtab" } ) ;
151146 }
You can’t perform that action at this time.
0 commit comments