simplified undefined check

Co-authored-by: Oliver Blanthorn <freedom4cows@gmail.com>
This commit is contained in:
Nicolas 2022-10-21 11:14:28 +02:00 committed by GitHub
parent d675e5af23
commit 282d5eccbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -696,7 +696,7 @@ export function simulateClick(
(target as HTMLAnchorElement).target === "_blank" ||
(target as HTMLAnchorElement).target === "_new"
const href = (target as HTMLAnchorElement).href
if (href !== undefined && href.startsWith("file:")) {
if (href?.startsWith("file:")) {
// file URLS cannot be opend with browser.tabs.create
// see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/create#url
// still create a new tab