Replace deprecated String.prototype.substr()

String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with slice() which works similarily but isn't deprecated.
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
Tobias Speicher 2022-02-20 19:30:58 +01:00
parent 2edfc8cc07
commit 368f3029ac
No known key found for this signature in database
GPG key ID: 2CF824BD810C3BDB

View file

@ -333,7 +333,7 @@ const ua = {
const o = ua.object(null, windowId, tab.cookieStoreId); const o = ua.object(null, windowId, tab.cookieStoreId);
chrome.browserAction.setBadgeText({ chrome.browserAction.setBadgeText({
tabId, tabId,
text: o && o.platform ? o.platform.substr(0, 3) : '' text: o && o.platform ? o.platform.slice(0, 3) : ''
}); });
})); }));
} }
@ -341,7 +341,7 @@ const ua = {
const o = ua.object(tabId, undefined, cookieStoreId); const o = ua.object(tabId, undefined, cookieStoreId);
chrome.browserAction.setBadgeText({ chrome.browserAction.setBadgeText({
tabId, tabId,
text: o.platform ? o.platform.substr(0, 3) : 'BOT' text: o.platform ? o.platform.slice(0, 3) : 'BOT'
}); });
} }
}, },