fixup 387193d3: don't try to parse unsupported URLs
This commit is contained in:
parent
387193d347
commit
e9a38c8eda
|
@ -105,19 +105,20 @@ function initPopup(url) {
|
||||||
installed);
|
installed);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u = new URL(url);
|
|
||||||
$('#find-styles-link').onclick = handleEvent.openURLandHide;
|
|
||||||
$('#find-styles-link').href +=
|
|
||||||
url.startsWith(location.protocol) ? '?search_terms=Stylus' :
|
|
||||||
u.protocol === 'file:' ? 'file:' :
|
|
||||||
u.hostname.replace(/^www\.|(\.com?)?\.\w+$/g, '').split('.').pop();
|
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
document.body.classList.add('blocked');
|
document.body.classList.add('blocked');
|
||||||
document.body.insertBefore(template.unavailableInfo, document.body.firstChild);
|
document.body.insertBefore(template.unavailableInfo, document.body.firstChild);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const u = tryCatch(() => new URL(url));
|
||||||
|
$('#find-styles-link').onclick = handleEvent.openURLandHide;
|
||||||
|
$('#find-styles-link').href +=
|
||||||
|
!u ? '' :
|
||||||
|
u.protocol === 'file:' ? 'file:' :
|
||||||
|
u.protocol === location.protocol ? '?search_terms=Stylus' :
|
||||||
|
u.hostname.replace(/^www\.|(\.com?)?\.\w+$/g, '').split('.').pop();
|
||||||
|
|
||||||
getActiveTab().then(function ping(tab, retryCountdown = 10) {
|
getActiveTab().then(function ping(tab, retryCountdown = 10) {
|
||||||
sendMessage({tabId: tab.id, method: 'ping', frameId: 0}, pong => {
|
sendMessage({tabId: tab.id, method: 'ping', frameId: 0}, pong => {
|
||||||
if (pong) {
|
if (pong) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user