import { Injectable } from 'angular-ts-decorators' ; import autobind from 'autobind-decorator' ; import browser from 'webextension-polyfill' ; import { PlatformType } from '../../../../shared/global-shared.enum' ; import { WebExtPlatformService } from '../../../shared/webext-platform/webext-platform.service' ; @ autobind @ Injectable ( 'PlatformService' ) export class FirefoxPlatformService extends WebExtPlatformService { platformName = PlatformType . Firefox ; getNewTabUrl ( ) { return 'about:newtab' ; } openUrl ( url ) { if ( this . urlIsNativeConfigPage ( url ) ) { browser . tabs . create ( { } ) . then ( window . close ) ; return ; } super . openUrl ( url ) ; } urlIsNativeConfigPage ( url ) { return /^about:/i . test ( url ?? '' ) ; } urlIsSupported ( url ) { return /^(?!chrome|data)[\w-]+:/i . test ( url ?? '' ) ; } }