Skip to content

Commit e25653e

Browse files
committed
Modified new tab flow
1 parent 264983e commit e25653e

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/main/background.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
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 {
@@ -42,7 +42,7 @@
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
}
@@ -139,13 +139,8 @@
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
}

0 commit comments

Comments
 (0)