Added exception handling on browser.tabs.get()

#346
This commit is contained in:
Kevin Röbert 2020-01-08 10:38:48 +01:00
parent c3ddf2a8d4
commit 861cf554f5

View File

@ -557,7 +557,7 @@ function start() {
"cancel": false "cancel": false
}; };
if(storage.pingBlocking && storage.pingRequestTypes.includes(request.type)) { if (storage.pingBlocking && storage.pingRequestTypes.includes(request.type)) {
pushToLog(request.url, request.url, translate('log_ping_blocked')); pushToLog(request.url, request.url, translate('log_ping_blocked'));
increaseBadged(); increaseBadged();
return {cancel: true}; return {cancel: true};
@ -651,7 +651,9 @@ function start() {
function handleActivated(activeInfo) { function handleActivated(activeInfo) {
tabid = activeInfo.tabId; tabid = activeInfo.tabId;
browser.tabs.get(tabid).then(function (tab) { browser.tabs.get(tabid).then(function (tab) {
currentURL = tab.url; if (!browser.runtime.lastError) { // https://gitlab.com/KevinRoebert/ClearUrls/issues/346
currentURL = tab.url;
}
}); });
} }