1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

Replace window.open with browser.tabs.create

Fixes #661
This commit is contained in:
kkapsner 2023-05-30 00:20:54 +02:00
parent 5df98e0cf5
commit e9f5f710e6
5 changed files with 29 additions and 23 deletions

View File

@ -69,7 +69,7 @@
browser.runtime.openOptionsPage(); browser.runtime.openOptionsPage();
} }
else { else {
window.open(extension.getURL("options/options.html"), "_blank"); browser.tabs.create({url: extension.getURL("options/options.html")});
} }
window.close(); window.close();
} }
@ -78,7 +78,7 @@
label: "faq", label: "faq",
icon: extension.getURL("icons/browserAction-faq.svg"), icon: extension.getURL("icons/browserAction-faq.svg"),
action: function(){ action: function(){
window.open("https://canvasblocker.kkapsner.de/faq/", "_blank"); browser.tabs.create({url: "https://canvasblocker.kkapsner.de/faq/"});
window.close(); window.close();
} }
}, },
@ -87,7 +87,7 @@
advanced: true, advanced: true,
icon: extension.getURL("icons/browserAction-test.svg"), icon: extension.getURL("icons/browserAction-test.svg"),
action: function(){ action: function(){
window.open("https://canvasblocker.kkapsner.de/test", "_blank"); browser.tabs.create({url: "https://canvasblocker.kkapsner.de/test"});
window.close(); window.close();
} }
}, },
@ -95,7 +95,7 @@
label: "review", label: "review",
icon: extension.getURL("icons/browserAction-review.svg"), icon: extension.getURL("icons/browserAction-review.svg"),
action: function(){ action: function(){
window.open("https://addons.mozilla.org/firefox/addon/canvasblocker/reviews/", "_blank"); browser.tabs.create({url: "https://addons.mozilla.org/firefox/addon/canvasblocker/reviews/"});
window.close(); window.close();
} }
}, },
@ -103,7 +103,7 @@
label: "reportIssue", label: "reportIssue",
icon: extension.getURL("icons/browserAction-reportIssue.svg"), icon: extension.getURL("icons/browserAction-reportIssue.svg"),
action: function(){ action: function(){
window.open("https://github.com/kkapsner/CanvasBlocker/issues", "_blank"); browser.tabs.create({url: "https://github.com/kkapsner/CanvasBlocker/issues"});
window.close(); window.close();
} }
}, },
@ -149,11 +149,11 @@
search.addEventListener("keypress", function(event){ search.addEventListener("keypress", function(event){
if ([10, 13].indexOf(event.keyCode) !== -1){ if ([10, 13].indexOf(event.keyCode) !== -1){
window.open(extension.getURL( browser.tabs.create({url: extension.getURL(
"options/options.html" + "options/options.html" +
"?search=" + "?search=" +
encodeURIComponent(this.value) encodeURIComponent(this.value)
)); )});
window.close(); window.close();
} }
}); });

View File

@ -25,11 +25,11 @@
}, },
openNavigatorSettings: function(){ openNavigatorSettings: function(){
logging.verbose("open navigator settings"); logging.verbose("open navigator settings");
window.open("navigator.html", "_blank"); browser.tabs.create({url: "navigator.html"});
}, },
showReleaseNotes: function(){ showReleaseNotes: function(){
logging.verbose("open release notes"); logging.verbose("open release notes");
window.open("../releaseNotes.txt", "_blank"); browser.tabs.create({url: extension.getURL("../releaseNotes.txt")});
}, },
clearPersistentRnd: function(){ clearPersistentRnd: function(){
logging.message("clear persistent rnd storage"); logging.message("clear persistent rnd storage");
@ -53,15 +53,15 @@
}, },
inspectSettings: function(){ inspectSettings: function(){
logging.verbose("open settings inspection"); logging.verbose("open settings inspection");
window.open("export.html", "_blank"); browser.tabs.create({url: "export.html"});
}, },
openSettingSanitation: function(){ openSettingSanitation: function(){
logging.verbose("open settings sanitation"); logging.verbose("open settings sanitation");
window.open("sanitize.html", "_blank"); browser.tabs.create({url: "sanitize.html"});
}, },
openSettingPresets: function(){ openSettingPresets: function(){
logging.verbose("open setting presets"); logging.verbose("open setting presets");
window.open("presets.html", "_blank"); browser.tabs.create({url: "presets.html"});
}, },
saveSettings: function(){ saveSettings: function(){
logging.verbose("save settings"); logging.verbose("save settings");
@ -92,7 +92,7 @@
}, },
inspectWhitelist: function(){ inspectWhitelist: function(){
logging.verbose("open whitelist inspection"); logging.verbose("open whitelist inspection");
window.open("whitelist.html", "_blank"); browser.tabs.create({url: "whitelist.html"});
}, },
loadSettings: async function(){ loadSettings: async function(){
logging.verbose("load settings"); logging.verbose("load settings");

View File

@ -30,7 +30,7 @@
browser.runtime.openOptionsPage(); browser.runtime.openOptionsPage();
} }
else { else {
window.open(extension.getURL("options/options.html"), "_blank"); browser.tabs.create({url: extension.getURL("options/options.html")});
} }
} }
}, },
@ -152,15 +152,12 @@
name: "inspectWhitelist", name: "inspectWhitelist",
isIcon: true, isIcon: true,
callback: function({domain, urls}){ callback: function({domain, urls}){
window.open( browser.tabs.create({url: extension.getURL(
extension.getURL( "options/whitelist.html?domain=" +
"options/whitelist.html?domain=" + encodeURIComponent(domain) +
encodeURIComponent(domain) + "&urls=" +
"&urls=" + encodeURIComponent(JSON.stringify(Array.from(urls.values())))
encodeURIComponent(JSON.stringify(Array.from(urls.values()))) )});
),
"_blank"
);
} }
} }
]; ];

View File

@ -10,6 +10,7 @@ Version 1.10:
- persistent rng not working in Firefox for Android - persistent rng not working in Firefox for Android
- mobile default settings were not used in Firefox for Android - mobile default settings were not used in Firefox for Android
- settings export page did not show whole content in Firefox for Android - settings export page did not show whole content in Firefox for Android
- new tabs opened from within the extension did not open properly in Firefox for Android
known issues: known issues:
- if a data URL is blocked the page action button does not appear - if a data URL is blocked the page action button does not appear

View File

@ -253,6 +253,14 @@
{ {
"version": "1.10Alpha20230419", "version": "1.10Alpha20230419",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.10Alpha20230419.xpi" "update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.10Alpha20230419.xpi"
},
{
"version": "1.10Alpha20230529",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.10Alpha20230529.xpi"
},
{
"version": "1.10Alpha20230530",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.10Alpha20230530.xpi"
} }
] ]
} }