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

View File

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

View File

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

View File

@ -10,6 +10,7 @@ Version 1.10:
- persistent rng not working 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
- new tabs opened from within the extension did not open properly in Firefox for Android
known issues:
- if a data URL is blocked the page action button does not appear

View File

@ -253,6 +253,14 @@
{
"version": "1.10Alpha20230419",
"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"
}
]
}