Merge pull request #1388 from bitwarden/remove-old-ie-edge-hacks
Remove old IE Edge hacks
This commit is contained in:
commit
8b590ebc6c
2
jslib
2
jslib
|
@ -1 +1 @@
|
|||
Subproject commit fa2b8e834bf0576ef3c33eb64bb133b54028943f
|
||||
Subproject commit 5e0a2d1d998b5d36b093f3eff032453421680a41
|
|
@ -10,25 +10,23 @@ import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service';
|
|||
|
||||
export default class CommandsBackground {
|
||||
private isSafari: boolean;
|
||||
private isEdge: boolean;
|
||||
private isVivaldi: boolean;
|
||||
|
||||
constructor(private main: MainBackground, private passwordGenerationService: PasswordGenerationService,
|
||||
private platformUtilsService: PlatformUtilsService, private analytics: Analytics,
|
||||
private vaultTimeoutService: VaultTimeoutService) {
|
||||
this.isSafari = this.platformUtilsService.isSafari();
|
||||
this.isEdge = this.platformUtilsService.isEdge();
|
||||
this.isVivaldi = this.platformUtilsService.isVivaldi();
|
||||
}
|
||||
|
||||
async init() {
|
||||
if (this.isSafari || this.isEdge || this.isVivaldi) {
|
||||
if (this.isSafari || this.isVivaldi) {
|
||||
BrowserApi.messageListener('commands.background', async (msg: any, sender: any, sendResponse: any) => {
|
||||
if (msg.command === 'keyboardShortcutTriggered' && msg.shortcut) {
|
||||
await this.processCommand(msg.shortcut, sender);
|
||||
}
|
||||
});
|
||||
} else if (chrome && chrome.commands && !this.isEdge) {
|
||||
} else if (chrome && chrome.commands) {
|
||||
chrome.commands.onCommand.addListener(async (command: any) => {
|
||||
await this.processCommand(command);
|
||||
});
|
||||
|
@ -52,11 +50,6 @@ export default class CommandsBackground {
|
|||
}
|
||||
|
||||
private async generatePasswordToClipboard() {
|
||||
if (this.isEdge) {
|
||||
// Edge does not support access to clipboard from background
|
||||
return;
|
||||
}
|
||||
|
||||
const options = (await this.passwordGenerationService.getOptions())[0];
|
||||
const password = await this.passwordGenerationService.generatePassword(options);
|
||||
this.platformUtilsService.copyToClipboard(password, { window: window });
|
||||
|
|
|
@ -165,7 +165,7 @@ export default class MainBackground {
|
|||
this.storageService, this.i18nService, this.cipherService);
|
||||
this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService,
|
||||
this.i18nService);
|
||||
this.searchService = new SearchService(this.cipherService, this.platformUtilsService);
|
||||
this.searchService = new SearchService(this.cipherService);
|
||||
this.stateService = new StateService();
|
||||
this.policyService = new PolicyService(this.userService, this.storageService);
|
||||
this.vaultTimeoutService = new VaultTimeoutService(this.cipherService, this.folderService,
|
||||
|
@ -441,48 +441,45 @@ export default class MainBackground {
|
|||
title: this.i18nService.t('autoFill'),
|
||||
});
|
||||
|
||||
// Edge does not support writing to the clipboard from background
|
||||
if (!this.platformUtilsService.isEdge()) {
|
||||
await this.contextMenusCreate({
|
||||
type: 'normal',
|
||||
id: 'copy-username',
|
||||
parentId: 'root',
|
||||
contexts: ['all'],
|
||||
title: this.i18nService.t('copyUsername'),
|
||||
});
|
||||
|
||||
await this.contextMenusCreate({
|
||||
type: 'normal',
|
||||
id: 'copy-password',
|
||||
parentId: 'root',
|
||||
contexts: ['all'],
|
||||
title: this.i18nService.t('copyPassword'),
|
||||
});
|
||||
|
||||
if (await this.userService.canAccessPremium()) {
|
||||
await this.contextMenusCreate({
|
||||
type: 'normal',
|
||||
id: 'copy-username',
|
||||
id: 'copy-totp',
|
||||
parentId: 'root',
|
||||
contexts: ['all'],
|
||||
title: this.i18nService.t('copyUsername'),
|
||||
});
|
||||
|
||||
await this.contextMenusCreate({
|
||||
type: 'normal',
|
||||
id: 'copy-password',
|
||||
parentId: 'root',
|
||||
contexts: ['all'],
|
||||
title: this.i18nService.t('copyPassword'),
|
||||
});
|
||||
|
||||
if (await this.userService.canAccessPremium()) {
|
||||
await this.contextMenusCreate({
|
||||
type: 'normal',
|
||||
id: 'copy-totp',
|
||||
parentId: 'root',
|
||||
contexts: ['all'],
|
||||
title: this.i18nService.t('copyVerificationCode'),
|
||||
});
|
||||
}
|
||||
|
||||
await this.contextMenusCreate({
|
||||
type: 'separator',
|
||||
parentId: 'root',
|
||||
});
|
||||
|
||||
await this.contextMenusCreate({
|
||||
type: 'normal',
|
||||
id: 'generate-password',
|
||||
parentId: 'root',
|
||||
contexts: ['all'],
|
||||
title: this.i18nService.t('generatePasswordCopied'),
|
||||
title: this.i18nService.t('copyVerificationCode'),
|
||||
});
|
||||
}
|
||||
|
||||
await this.contextMenusCreate({
|
||||
type: 'separator',
|
||||
parentId: 'root',
|
||||
});
|
||||
|
||||
await this.contextMenusCreate({
|
||||
type: 'normal',
|
||||
id: 'generate-password',
|
||||
parentId: 'root',
|
||||
contexts: ['all'],
|
||||
title: this.i18nService.t('generatePasswordCopied'),
|
||||
});
|
||||
|
||||
this.buildingContextMenu = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ export class BrowserApi {
|
|||
static isChromeApi: boolean = !BrowserApi.isSafariApi && (typeof chrome !== 'undefined');
|
||||
static isFirefoxOnAndroid: boolean = navigator.userAgent.indexOf('Firefox/') !== -1 &&
|
||||
navigator.userAgent.indexOf('Android') !== -1;
|
||||
static isEdge18: boolean = navigator.userAgent.indexOf(' Edge/18.') !== -1;
|
||||
|
||||
static async getTabFromCurrentWindowId(): Promise<any> {
|
||||
if (BrowserApi.isChromeApi) {
|
||||
|
|
|
@ -3,10 +3,9 @@ import * as Mousetrap from 'mousetrap';
|
|||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
const isSafari = (typeof safari !== 'undefined') && navigator.userAgent.indexOf(' Safari/') !== -1 &&
|
||||
navigator.userAgent.indexOf('Chrome') === -1;
|
||||
const isEdge = !isSafari && navigator.userAgent.indexOf(' Edge/') !== -1;
|
||||
const isVivaldi = !isSafari && navigator.userAgent.indexOf(' Vivaldi/') !== -1;
|
||||
|
||||
if (!isSafari && !isEdge && !isVivaldi) {
|
||||
if (!isSafari && !isVivaldi) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -21,8 +20,6 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
|||
let autofillCommand = ['mod+shift+l'];
|
||||
if (isSafari) {
|
||||
autofillCommand = ['mod+\\', 'mod+8', 'mod+shift+p'];
|
||||
} else if (isEdge) {
|
||||
autofillCommand = ['mod+\\', 'mod+9'];
|
||||
}
|
||||
Mousetrap.bind(autofillCommand, () => {
|
||||
sendMessage('autofill_login');
|
||||
|
@ -32,7 +29,7 @@ document.addEventListener('DOMContentLoaded', (event) => {
|
|||
Mousetrap.bind('mod+shift+y', () => {
|
||||
sendMessage('open_popup');
|
||||
});
|
||||
} else if (!isEdge) {
|
||||
} else {
|
||||
Mousetrap.bind('mod+shift+9', () => {
|
||||
sendMessage('generate_password');
|
||||
});
|
||||
|
|
|
@ -1,846 +0,0 @@
|
|||
if (!Range.prototype["intersectsNode"]) {
|
||||
Range.prototype["intersectsNode"] = function (node) {
|
||||
let range = document.createRange();
|
||||
range.selectNode(node);
|
||||
return 0 > this.compareBoundaryPoints(Range.END_TO_START, range)
|
||||
&& 0 < this.compareBoundaryPoints(Range.START_TO_END, range);
|
||||
};
|
||||
}
|
||||
var getExtensionProtocol = function () {
|
||||
if (typeof browser == "undefined") {
|
||||
if (typeof chrome !== "undefined")
|
||||
return "chrome-extension://";
|
||||
}
|
||||
else {
|
||||
return "ms-browser-extension://";
|
||||
}
|
||||
};
|
||||
class FakeEvent {
|
||||
addListener(callback) { }
|
||||
addRules(rules, callback) { }
|
||||
getRules(ruleIdentifiers, callback) { }
|
||||
hasListener(callback) { return false; }
|
||||
hasListeners() { return false; }
|
||||
removeRules(ruleIdentifiers, callback) { }
|
||||
removeListener(callback) { }
|
||||
}
|
||||
class EdgeBridgeHelper {
|
||||
constructor() {
|
||||
this.fakeEvent = new FakeEvent();
|
||||
}
|
||||
toAbsolutePath(relativePath) {
|
||||
if (relativePath.indexOf("ms-browser-extension://") == 0) {
|
||||
return relativePath.replace(myBrowser.runtime.getURL(""), "");
|
||||
}
|
||||
else if (relativePath.indexOf("/") != 0) {
|
||||
var absolutePath = "";
|
||||
var documentPath = document.location.pathname;
|
||||
absolutePath = documentPath.substring(0, documentPath.lastIndexOf("/") + 1);
|
||||
absolutePath += relativePath;
|
||||
return absolutePath;
|
||||
}
|
||||
return relativePath;
|
||||
}
|
||||
}
|
||||
var bridgeHelper = new EdgeBridgeHelper();
|
||||
class EdgeBridgeDebugLog {
|
||||
constructor() {
|
||||
this.CatchOnException = true;
|
||||
this.VerboseLogging = true;
|
||||
this.FailedCalls = {};
|
||||
this.SuccededCalls = {};
|
||||
this.DeprecatedCalls = {};
|
||||
this.BridgedCalls = {};
|
||||
this.UnavailableApis = {};
|
||||
this.EdgeIssues = {};
|
||||
}
|
||||
log(message) {
|
||||
try {
|
||||
if (this.VerboseLogging) {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
info(message) {
|
||||
try {
|
||||
if (this.VerboseLogging) {
|
||||
console.info(message);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
warn(message) {
|
||||
try {
|
||||
if (this.VerboseLogging) {
|
||||
console.warn(message);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
error(message) {
|
||||
try {
|
||||
if (this.VerboseLogging) {
|
||||
console.error(message);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
DoActionAndLog(action, name, deprecatedTo, bridgedTo) {
|
||||
var result;
|
||||
try {
|
||||
result = action();
|
||||
this.AddToCalledDictionary(this.SuccededCalls, name);
|
||||
if (typeof deprecatedTo !== "undefined" && typeof deprecatedTo !== "null") {
|
||||
this.warn("API Call Deprecated - Name: " + name + ", Please use " + deprecatedTo + " instead!");
|
||||
this.AddToCalledDictionary(this.DeprecatedCalls, name);
|
||||
}
|
||||
if (typeof bridgedTo !== "undefined" && typeof bridgedTo !== "null") {
|
||||
this.info("API Call '" + name + "' has been bridged to another Edge API: " + bridgedTo);
|
||||
this.AddToCalledDictionary(this.BridgedCalls, name);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (ex) {
|
||||
this.AddToCalledDictionary(this.FailedCalls, name);
|
||||
if (this.CatchOnException)
|
||||
this.error("API Call Failed: " + name + " - " + ex);
|
||||
else
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
LogEdgeIssue(name, message) {
|
||||
this.warn(message);
|
||||
this.AddToCalledDictionary(this.EdgeIssues, name);
|
||||
}
|
||||
LogUnavailbleApi(name, deprecatedTo) {
|
||||
this.warn("API Call '" + name + "' is not supported in Edge");
|
||||
this.AddToCalledDictionary(this.UnavailableApis, name);
|
||||
if (typeof deprecatedTo !== "undefined" && typeof deprecatedTo !== "null") {
|
||||
this.warn("API Call Deprecated - Name: " + name + ", Please use " + deprecatedTo + " instead!");
|
||||
this.AddToCalledDictionary(this.DeprecatedCalls, name);
|
||||
}
|
||||
}
|
||||
AddToCalledDictionary(dictionary, name) {
|
||||
if (typeof dictionary[name] !== "undefined") {
|
||||
dictionary[name]++;
|
||||
}
|
||||
else {
|
||||
dictionary[name] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
var bridgeLog = new EdgeBridgeDebugLog();
|
||||
class EdgeChromeAppBridge {
|
||||
getDetails() {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return EdgeChromeRuntimeBridge.prototype.getManifest();
|
||||
}, "app.getManifest", undefined, "runtime.getManifest");
|
||||
}
|
||||
get isInstalled() { return bridgeLog.DoActionAndLog(() => { throw "app.isInstalled is not available in Edge"; }, "app.isInstalled"); }
|
||||
getIsInstalled() { return bridgeLog.DoActionAndLog(() => { throw "app.getIsInstalled is not available in the Edge"; }, "app.getIsInstalled"); }
|
||||
installState() { return bridgeLog.DoActionAndLog(() => { throw "app.installState is not available in Edge"; }, "app.installState"); }
|
||||
runningState() { return bridgeLog.DoActionAndLog(() => { throw "app.runningState is not available in Edge"; }, "app.runningState"); }
|
||||
}
|
||||
class EdgeBrowserActionBridge {
|
||||
get onClicked() { return bridgeLog.DoActionAndLog(() => { return myBrowser.browserAction.onClicked; }, "browserAction.onClicked"); }
|
||||
disable(tabId) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.browserAction.disable(tabId);
|
||||
}, "browserAction.disable");
|
||||
}
|
||||
enable(tabId) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof tabId !== "undefined" && typeof tabId !== "null") {
|
||||
myBrowser.browserAction.enable(tabId);
|
||||
}
|
||||
else {
|
||||
myBrowser.browserAction.enable();
|
||||
}
|
||||
}, "browserAction.Enable");
|
||||
}
|
||||
getBadgeBackgroundColor(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.browserAction.getBadgeBackgroundColor(details, callback);
|
||||
}, "browserAction.getBadgeBackgroundColor");
|
||||
}
|
||||
getBadgeText(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.browserAction.getBadgeText(details, callback);
|
||||
}, "browserAction.getBadgeText");
|
||||
}
|
||||
setBadgeBackgroundColor(details) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.browserAction.setBadgeBackgroundColor(details);
|
||||
}, "browserAction.setBadgeBackgroundColor");
|
||||
}
|
||||
setBadgeText(details) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.browserAction.setBadgeText(details);
|
||||
}, "browserAction.setBadgeText");
|
||||
}
|
||||
setIcon(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof details.path !== "undefined") {
|
||||
if (typeof details.path === "object") {
|
||||
for (var key in details.path) {
|
||||
if (details.path.hasOwnProperty(key)) {
|
||||
details.path[key] = bridgeHelper.toAbsolutePath(details.path[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
details.path = bridgeHelper.toAbsolutePath(details.path);
|
||||
}
|
||||
}
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.browserAction.setIcon(details, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.browserAction.setIcon(details);
|
||||
}
|
||||
}, "browserAction.setIcon", undefined, "browserAction.setIcon with absolute path");
|
||||
}
|
||||
setPopup(details) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.browserAction.setPopup(details);
|
||||
}, "browserAction.setPopup");
|
||||
}
|
||||
}
|
||||
class EdgeChromeBrowserActionBridge extends EdgeBrowserActionBridge {
|
||||
getPopup(details, callback) {
|
||||
bridgeLog.LogUnavailbleApi("browserAction.getPopup");
|
||||
}
|
||||
getTitle(details, callback) {
|
||||
bridgeLog.LogUnavailbleApi("browserAction.getTitle");
|
||||
}
|
||||
setTitle(details) {
|
||||
bridgeLog.LogUnavailbleApi("browserAction.setTitle");
|
||||
}
|
||||
}
|
||||
class EdgeContextMenusBridge {
|
||||
get ACTION_MENU_TOP_LEVEL_LIMIT() { return bridgeLog.DoActionAndLog(() => { return myBrowser.contextMenus.ACTION_MENU_TOP_LEVEL_LIMIT; }, "contextMenus.ACTION_MENU_TOP_LEVEL_LIMIT"); }
|
||||
get onClicked() { return bridgeLog.DoActionAndLog(() => { return myBrowser.contextMenus.onClicked; }, "contextMenus.onClicked"); }
|
||||
create(createProperties, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.contextMenus.create(createProperties, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.contextMenus.create(createProperties);
|
||||
}
|
||||
}, "contextMenus.create");
|
||||
}
|
||||
remove(menuItemId, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.contextMenus.remove(menuItemId, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.contextMenus.remove(menuItemId);
|
||||
}
|
||||
}, "contextMenus.remove");
|
||||
}
|
||||
removeAll(callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.contextMenus.removeAll(callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.contextMenus.removeAll();
|
||||
}
|
||||
}, "contextMenus.removeAll");
|
||||
}
|
||||
update(id, updateProperties, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.contextMenus.update(id, updateProperties, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.contextMenus.update(id, updateProperties);
|
||||
}
|
||||
}, "contextMenus.update");
|
||||
}
|
||||
}
|
||||
class EdgeCookiesBridge {
|
||||
get(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.cookies.get(details, callback);
|
||||
}, "cookies.get");
|
||||
}
|
||||
getAll(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.cookies.getAll(details, callback);
|
||||
}, "cookies.getAll");
|
||||
}
|
||||
remove(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.cookies.remove(details, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.cookies.remove(details);
|
||||
}
|
||||
}, "cookies.remove");
|
||||
}
|
||||
set(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.cookies.set(details, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.cookies.set(details);
|
||||
}
|
||||
}, "cookies.set");
|
||||
}
|
||||
}
|
||||
class EdgeChromeCookiesBridge extends EdgeCookiesBridge {
|
||||
get onChanged() { bridgeLog.LogUnavailbleApi("cookies.onChanged"); return bridgeHelper.fakeEvent; }
|
||||
}
|
||||
class EdgeExtensionBridge {
|
||||
getBackgroundPage() {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.extension.getBackgroundPage();
|
||||
}, "extension.getBackgroundPage");
|
||||
}
|
||||
getURL(path) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.extension.getURL(path);
|
||||
}, "extension.getURL");
|
||||
}
|
||||
getViews(fetchProperties) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.extension.getViews(fetchProperties);
|
||||
}, "extension.getViews");
|
||||
}
|
||||
}
|
||||
class EdgeChromeExtensionBridge extends EdgeExtensionBridge {
|
||||
get onConnect() { return bridgeLog.DoActionAndLog(() => { return EdgeRuntimeBridge.prototype.onConnect; }, "extension.onConnect", "runtime.onConnect", "runtime.onConnect"); }
|
||||
get onMessage() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "extension.onMessage", "runtime.onMessage", "runtime.onMessage"); }
|
||||
get onRequest() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "extension.onRequest", "runtime.onMessage", "runtime.onMessage"); }
|
||||
get onRequestExternal() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessageExternal; }, "extension.onRequestExternal", "runtime.onMessageExternal", "runtime.onMessageExternal"); }
|
||||
get inIncognitoContext() { return bridgeLog.DoActionAndLog(() => { return myBrowser.extension["inPrivateContext"]; }, "extension.inIncognitoContext", undefined, "extension.inPrivateContext"); }
|
||||
get lastError() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.lastError; }, "extension.lastError", undefined, "runtime.lastError"); }
|
||||
connect(extensionId, connectInfo) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return EdgeRuntimeBridge.prototype.connect(extensionId, connectInfo);
|
||||
}, "extension.connect", "runtime.connect", "runtime.connect");
|
||||
}
|
||||
sendMessage(message, responseCallback) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return EdgeRuntimeBridge.prototype.sendMessage(message, responseCallback, undefined, undefined);
|
||||
}, "extension.sendMessage", "runtime.sendMessage", "runtime.sendMessage");
|
||||
}
|
||||
sendRequest(extensionId, message, options, responseCallback) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return EdgeRuntimeBridge.prototype.sendMessage(extensionId, message, options, responseCallback);
|
||||
}, "extension.sendRequest", "runtime.sendMessage", "runtime.sendMessage");
|
||||
}
|
||||
isAllowedFileSchemeAccess(callback) {
|
||||
bridgeLog.LogUnavailbleApi("extension.isAllowedFileSchemeAccess");
|
||||
}
|
||||
isAllowedIncognitoAccess(callback) {
|
||||
bridgeLog.LogUnavailbleApi("extension.isAllowedIncognitoAccess");
|
||||
}
|
||||
setUpdateUrlData(data) {
|
||||
bridgeLog.LogUnavailbleApi("extension.setUpdateUrlData");
|
||||
}
|
||||
}
|
||||
class EdgeHistoryBridge {
|
||||
get onVisited() { bridgeLog.LogUnavailbleApi("history.onVisited"); return bridgeHelper.fakeEvent; }
|
||||
get onVisitRemoved() { bridgeLog.LogUnavailbleApi("history.onVisitRemoved"); return bridgeHelper.fakeEvent; }
|
||||
addUrl(details, callback) {
|
||||
bridgeLog.LogUnavailbleApi("history.addUrl");
|
||||
}
|
||||
deleteAll(callback) {
|
||||
bridgeLog.LogUnavailbleApi("history.deleteAll");
|
||||
}
|
||||
deleteRange(range, callback) {
|
||||
bridgeLog.LogUnavailbleApi("history.deleteRange");
|
||||
}
|
||||
deleteUrl(details, callback) {
|
||||
bridgeLog.LogUnavailbleApi("history.deleteUrl");
|
||||
}
|
||||
getVisits(details, callback) {
|
||||
bridgeLog.LogUnavailbleApi("history.getVisits");
|
||||
}
|
||||
search(query, callback) {
|
||||
bridgeLog.LogUnavailbleApi("history.search");
|
||||
}
|
||||
}
|
||||
class EdgeI18nBridge {
|
||||
getAcceptLanguages(callback) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.i18n.getAcceptLanguages(callback);
|
||||
}, "i18n.getAcceptLanguages");
|
||||
}
|
||||
getMessage(messageName, substitutions) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
if (messageName.indexOf("@@extension_id") > -1) {
|
||||
return myBrowser.runtime.id;
|
||||
}
|
||||
if (typeof substitutions !== "undefined" && typeof substitutions !== "null") {
|
||||
return myBrowser.i18n.getMessage(messageName, substitutions);
|
||||
}
|
||||
else {
|
||||
return myBrowser.i18n.getMessage(messageName);
|
||||
}
|
||||
}, "i18n.getMessage");
|
||||
}
|
||||
getUILanguage() {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.i18n.getUILanguage();
|
||||
}, "i18n.getUILanguage");
|
||||
}
|
||||
}
|
||||
class EdgeNotificationBridge {
|
||||
get onButtonClicked() { bridgeLog.LogUnavailbleApi("notifications.onButtonClicked"); return bridgeHelper.fakeEvent; }
|
||||
get onClicked() { bridgeLog.LogUnavailbleApi("notifications.onClicked"); return bridgeHelper.fakeEvent; }
|
||||
get onClosed() { bridgeLog.LogUnavailbleApi("notifications.onClosed"); return bridgeHelper.fakeEvent; }
|
||||
get onPermissionLevelChanged() { bridgeLog.LogUnavailbleApi("notifications.onPermissionLevelChanged"); return bridgeHelper.fakeEvent; }
|
||||
get onShowSettings() { bridgeLog.LogUnavailbleApi("notifications.onShowSettings"); return bridgeHelper.fakeEvent; }
|
||||
clear(notificationId, callback) {
|
||||
bridgeLog.LogUnavailbleApi("notifications.clear");
|
||||
}
|
||||
create(notificationId, options, callback) {
|
||||
bridgeLog.LogUnavailbleApi("notifications.create");
|
||||
}
|
||||
getAll(callback) {
|
||||
bridgeLog.LogUnavailbleApi("notifications.getAll");
|
||||
}
|
||||
getPermissionLevel(callback) {
|
||||
bridgeLog.LogUnavailbleApi("notifications.getPermissionLevel");
|
||||
}
|
||||
update(notificationId, options, callback) {
|
||||
bridgeLog.LogUnavailbleApi("notifications.update");
|
||||
}
|
||||
}
|
||||
class EdgePageActionBridge {
|
||||
get onClicked() { return bridgeLog.DoActionAndLog(() => { return myBrowser.pageAction.onClicked; }, "pageAction.onClicked"); }
|
||||
getPopup(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.pageAction.getPopup(details, callback);
|
||||
}, "pageAction.getPopup");
|
||||
}
|
||||
getTitle(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.pageAction.getTitle(details, callback);
|
||||
}, "pageAction.getTitle");
|
||||
}
|
||||
hide(tabId) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.pageAction.hide(tabId);
|
||||
}, "pageAction.hide");
|
||||
}
|
||||
setTitle(details) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.pageAction.setTitle(details);
|
||||
}, "pageAction.setTitle");
|
||||
}
|
||||
setIcon(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.pageAction.setIcon(details, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.pageAction.setIcon(details, callback);
|
||||
}
|
||||
}, "pageAction.setIcon");
|
||||
}
|
||||
setPopup(details) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.pageAction.setPopup(details);
|
||||
}, "pageAction.setPopup");
|
||||
}
|
||||
show(tabId) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.pageAction.show(tabId);
|
||||
}, "pageAction.show");
|
||||
}
|
||||
}
|
||||
class EdgePermissionsBridge {
|
||||
get onAdded() { bridgeLog.LogUnavailbleApi("permissions.onAdded"); return bridgeHelper.fakeEvent; }
|
||||
get onRemoved() { bridgeLog.LogUnavailbleApi("permissions.onRemoved"); return bridgeHelper.fakeEvent; }
|
||||
contains(permissions, callback) {
|
||||
bridgeLog.LogUnavailbleApi("permissions.contains");
|
||||
}
|
||||
getAll(callback) {
|
||||
bridgeLog.LogUnavailbleApi("permissions.getAll");
|
||||
}
|
||||
remove(permissions, callback) {
|
||||
bridgeLog.LogUnavailbleApi("permissions.remove");
|
||||
}
|
||||
request(permissions, callback) {
|
||||
bridgeLog.LogUnavailbleApi("permissions.request");
|
||||
}
|
||||
}
|
||||
class EdgeRuntimeBridge {
|
||||
get id() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.id; }, "runtime.id"); }
|
||||
get lastError() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.lastError; }, "runtime.lastError"); }
|
||||
get onConnect() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onConnect; }, "runtime.onConnect"); }
|
||||
get onInstalled() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onInstalled; }, "runtime.onInstalled"); }
|
||||
get onMessage() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "runtime.onMessage"); }
|
||||
get onMessageExternal() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessageExternal; }, "runtime.onMessageExternal"); }
|
||||
connect(extensionId, connectInfo) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof connectInfo !== "undefined" && typeof connectInfo !== "null") {
|
||||
return myBrowser.runtime.connect(extensionId, connectInfo);
|
||||
}
|
||||
else {
|
||||
return myBrowser.runtime.connect(extensionId);
|
||||
}
|
||||
}, "runtime.connect");
|
||||
}
|
||||
getBackgroundPage(callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.runtime.getBackgroundPage(callback);
|
||||
}, "runtime.getBackgroundPage");
|
||||
}
|
||||
getManifest() {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.runtime.getManifest();
|
||||
}, "runtime.getManifest");
|
||||
}
|
||||
getURL(path) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.runtime.getURL(path);
|
||||
}, "runtime.getURL");
|
||||
}
|
||||
sendMessage(extensionId, message, options, responseCallback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof responseCallback !== "undefined" && typeof responseCallback !== "null") {
|
||||
myBrowser.runtime.sendMessage(extensionId, message, options, responseCallback);
|
||||
}
|
||||
else if (typeof options !== "undefined" && typeof options !== "null") {
|
||||
myBrowser.runtime.sendMessage(extensionId, message, options);
|
||||
}
|
||||
else if (typeof message !== "undefined" && typeof message !== "null") {
|
||||
myBrowser.runtime.sendMessage(extensionId, message);
|
||||
}
|
||||
else {
|
||||
myBrowser.runtime.sendMessage(undefined, extensionId);
|
||||
}
|
||||
}, "runtime.sendMessage");
|
||||
}
|
||||
}
|
||||
class EdgeChromeRuntimeBridge extends EdgeRuntimeBridge {
|
||||
get onConnectExternal() { bridgeLog.LogUnavailbleApi("runtime.onConnectExternal"); return bridgeHelper.fakeEvent; }
|
||||
get onRestartRequired() { bridgeLog.LogUnavailbleApi("runtime.onRestartRequired"); return bridgeHelper.fakeEvent; }
|
||||
get onStartup() { bridgeLog.LogUnavailbleApi("runtime.onStartup"); return bridgeHelper.fakeEvent; }
|
||||
get onSuspend() { bridgeLog.LogUnavailbleApi("runtime.onSuspend"); return bridgeHelper.fakeEvent; }
|
||||
get onSuspendCanceled() { bridgeLog.LogUnavailbleApi("runtime.onSuspendCanceled"); return bridgeHelper.fakeEvent; }
|
||||
get onUpdateAvailable() { bridgeLog.LogUnavailbleApi("runtime.onUpdateAvailable"); return bridgeHelper.fakeEvent; }
|
||||
openOptionsPage(callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
var optionsPage = myBrowser.runtime.getManifest()["options_page"];
|
||||
var optionsPageUrl = myBrowser.runtime.getURL(optionsPage);
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.tabs.create({ url: optionsPageUrl }, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.tabs.create({ url: optionsPageUrl });
|
||||
}
|
||||
}, "runtime.openOptionsPage", undefined, "tabs.create({ url: optionsPageUrl })");
|
||||
}
|
||||
connectNative(application) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.connectNative");
|
||||
return null;
|
||||
}
|
||||
getPackageDirectoryEntry(callback) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.getPackageDirectoryEntry");
|
||||
}
|
||||
getPlatformInfo(callback) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.getPlatformInfo");
|
||||
}
|
||||
reload() {
|
||||
bridgeLog.LogUnavailbleApi("runtime.reload");
|
||||
}
|
||||
requestUpdateCheck(callback) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.requestUpdateCheck");
|
||||
}
|
||||
restart() {
|
||||
bridgeLog.LogUnavailbleApi("runtime.restart");
|
||||
}
|
||||
setUninstallURL(url, callback) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.setUninstallURL");
|
||||
}
|
||||
sendNativeMessage(application, message, responseCallback) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.sendNativeMessage");
|
||||
}
|
||||
}
|
||||
class EdgeStorageBridge {
|
||||
get local() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.local; }, "storage.local"); }
|
||||
get onChanged() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.onChanged; }, "storage.onChanged"); }
|
||||
}
|
||||
class EdgeChromeStorageBridge extends EdgeStorageBridge {
|
||||
get managed() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.local; }, "storage.managed", undefined, "storage.local"); }
|
||||
get sync() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.local; }, "storage.sync", undefined, "storage.local"); }
|
||||
}
|
||||
class EdgeTabsBridge {
|
||||
get onActivated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onActivated; }, "tabs.onActivated"); }
|
||||
get onCreated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onCreated; }, "tabs.onCreated"); }
|
||||
get onRemoved() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onRemoved; }, "tabs.onRemoved"); }
|
||||
get onReplaced() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onReplaced; }, "tabs.onReplaced"); }
|
||||
get onUpdated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.tabs.onUpdated; }, "tabs.onUpdated"); }
|
||||
create(createProperties, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.tabs.create(createProperties, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.tabs.create(createProperties);
|
||||
}
|
||||
}, "tabs.create");
|
||||
}
|
||||
detectLanguage(tabId, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.tabs.detectLanguage(tabId, callback);
|
||||
}, "tabs.detectLanguage");
|
||||
}
|
||||
executeScript(tabId, details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.tabs.executeScript(tabId, details, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.tabs.executeScript(tabId, details);
|
||||
}
|
||||
}, "tabs.executeScript");
|
||||
}
|
||||
get(tabId, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.tabs.get(tabId, callback);
|
||||
}, "tabs.get");
|
||||
}
|
||||
getCurrent(callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.tabs.getCurrent(callback);
|
||||
}, "tabs.getCurrent");
|
||||
}
|
||||
insertCSS(tabId, details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.tabs.insertCSS(tabId, details, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.tabs.insertCSS(tabId, details);
|
||||
}
|
||||
}, "tabs.insertCSS");
|
||||
}
|
||||
query(queryInfo, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.tabs.query(queryInfo, callback);
|
||||
}, "tabs.query");
|
||||
}
|
||||
remove(tabId, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.tabs.remove(tabId, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.tabs.remove(tabId);
|
||||
}
|
||||
}, "tabs.remove");
|
||||
}
|
||||
sendMessage(tabId, message, responseCallback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof responseCallback !== "undefined" && typeof responseCallback !== "null") {
|
||||
myBrowser.tabs.sendMessage(tabId, message, responseCallback);
|
||||
}
|
||||
else {
|
||||
myBrowser.tabs.sendMessage(tabId, message);
|
||||
}
|
||||
}, "tabs.sendMessage");
|
||||
}
|
||||
update(tabId, updateProperties, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.tabs.update(tabId, updateProperties, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.tabs.update(tabId, updateProperties);
|
||||
}
|
||||
}, "tabs.update");
|
||||
}
|
||||
}
|
||||
class EdgeChromeTabsBridge extends EdgeTabsBridge {
|
||||
get onAttached() { bridgeLog.LogUnavailbleApi("tabs.onAttached"); return bridgeHelper.fakeEvent; }
|
||||
get onDetached() { bridgeLog.LogUnavailbleApi("tabs.onDetached"); return bridgeHelper.fakeEvent; }
|
||||
get onHighlighted() { bridgeLog.LogUnavailbleApi("tabs.onHighlighted"); return bridgeHelper.fakeEvent; }
|
||||
get onMoved() { bridgeLog.LogUnavailbleApi("tabs.onMoved"); return bridgeHelper.fakeEvent; }
|
||||
get onSelectionChanged() {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
var fakeEvent = bridgeHelper.fakeEvent;
|
||||
fakeEvent.addListener = (callback) => {
|
||||
myBrowser.tabs.onActivated.addListener((activeInfo) => {
|
||||
callback(activeInfo.tabId, { windowId: activeInfo.windowId });
|
||||
});
|
||||
};
|
||||
return fakeEvent;
|
||||
}, "tabs.onSelectionChanged", "tabs.onActivated", "tabs.onActivated");
|
||||
}
|
||||
duplicate(tabId, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
this.get(tabId, function (tab) {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.tabs.create({ url: tab.url }, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.tabs.create({ url: tab.url });
|
||||
}
|
||||
});
|
||||
}, "tabs.duplicate", undefined, "tabs.create");
|
||||
}
|
||||
getAllInWindow(windowId, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
this.query({ windowId: windowId }, callback);
|
||||
}, "tabs.getAllInWindow", "tabs.query", "tabs.query");
|
||||
}
|
||||
getSelected(windowId, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
this.query({ active: true }, (tabs) => callback(tabs[0]));
|
||||
}, "tabs.getSelected", "tabs.query", "tabs.query");
|
||||
}
|
||||
sendRequest(tabId, request, responseCallback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
this.sendMessage(tabId, request, responseCallback);
|
||||
}, "tabs.sendRequest", "tabs.sendMessage", "tabs.sendMessage");
|
||||
}
|
||||
captureVisibleTab(windowId, options, callback) {
|
||||
bridgeLog.LogUnavailbleApi("tabs.captureVisibleTab");
|
||||
}
|
||||
connect(tabId, connectInfo) {
|
||||
bridgeLog.LogUnavailbleApi("tabs.connect");
|
||||
return null;
|
||||
}
|
||||
highlight(highlightInfo, callback) {
|
||||
bridgeLog.LogUnavailbleApi("tabs.highlight");
|
||||
}
|
||||
move(tabId, moveProperties, callback) {
|
||||
bridgeLog.LogUnavailbleApi("tabs.move");
|
||||
}
|
||||
reload(tabId, reloadProperties, callback) {
|
||||
bridgeLog.LogUnavailbleApi("tabs.reload");
|
||||
}
|
||||
}
|
||||
class EdgeWebNavigationBridge {
|
||||
get onBeforeNavigate() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onBeforeNavigate; }, "webNavigation.onBeforeNavigate"); }
|
||||
get onCommitted() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onCommitted; }, "webNavigation.onCommitted"); }
|
||||
get onCompleted() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onCompleted; }, "webNavigation.onCompleted"); }
|
||||
get onCreatedNavigationTarget() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onCreatedNavigationTarget; }, "webNavigation.onCreatedNavigationTarget"); }
|
||||
get onDOMContentLoaded() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onDOMContentLoaded; }, "webNavigation.onDOMContentLoaded"); }
|
||||
get onErrorOccurred() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onErrorOccurred; }, "webNavigation.onErrorOccurred"); }
|
||||
get onHistoryStateUpdated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onHistoryStateUpdated; }, "webNavigation.onHistoryStateUpdated"); }
|
||||
get onReferenceFragmentUpdated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onReferenceFragmentUpdated; }, "webNavigation.onReferenceFragmentUpdated"); }
|
||||
get onTabReplaced() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webNavigation.onTabReplaced; }, "webNavigation.onTabReplaced"); }
|
||||
getAllFrames(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.webNavigation.getAllFrames(details, callback);
|
||||
}, "webNavigation.getAllFrames");
|
||||
}
|
||||
getFrame(details, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.webNavigation.getFrame(details, callback);
|
||||
}, "webNavigation.getFrame");
|
||||
}
|
||||
}
|
||||
class EdgeWebRequestBridge {
|
||||
get MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES; }, "webNavigation.MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES"); }
|
||||
get onAuthRequired() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onAuthRequired; }, "webNavigation.onAuthRequired"); }
|
||||
get onBeforeRedirect() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onBeforeRedirect; }, "webNavigation.onBeforeRedirect"); }
|
||||
get onBeforeRequest() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onBeforeRequest; }, "webNavigation.onBeforeRequest"); }
|
||||
get onBeforeSendHeaders() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onBeforeSendHeaders; }, "webNavigation.onBeforeSendHeaders"); }
|
||||
get onCompleted() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onCompleted; }, "webNavigation.onCompleted"); }
|
||||
get onErrorOccurred() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onErrorOccurred; }, "webNavigation.onErrorOccurred"); }
|
||||
get onHeadersReceived() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onHeadersReceived; }, "webNavigation.onHeadersReceived"); }
|
||||
get onResponseStarted() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onResponseStarted; }, "webNavigation.onResponseStarted"); }
|
||||
get onSendHeaders() { return bridgeLog.DoActionAndLog(() => { return myBrowser.webRequest.onSendHeaders; }, "webNavigation.onSendHeaders"); }
|
||||
handlerBehaviorChanged(callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.webRequest.handlerBehaviorChanged(callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.webRequest.handlerBehaviorChanged();
|
||||
}
|
||||
}, "webRequest.handlerBehaviorChanged");
|
||||
}
|
||||
}
|
||||
class EdgeWindowsBridge {
|
||||
get WINDOW_ID_CURRENT() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.WINDOW_ID_CURRENT; }, "windows.WINDOW_ID_CURRENT"); }
|
||||
get WINDOW_ID_NONE() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.WINDOW_ID_NONE; }, "windows.WINDOW_ID_NONE"); }
|
||||
get onCreated() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.onCreated; }, "windows.onCreated"); }
|
||||
get onFocusChanged() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.onFocusChanged; }, "windows.onFocusChanged"); }
|
||||
get onRemoved() { return bridgeLog.DoActionAndLog(() => { return myBrowser.windows.onRemoved; }, "windows.onRemoved"); }
|
||||
create(createData, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.windows.create(createData, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.windows.create(createData);
|
||||
}
|
||||
}, "windows.create");
|
||||
}
|
||||
get(windowId, getInfo, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.windows.get(windowId, getInfo, callback);
|
||||
}, "windows.get");
|
||||
}
|
||||
getAll(getInfo, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.windows.getAll(getInfo, callback);
|
||||
}, "windows.getAll");
|
||||
}
|
||||
getCurrent(getInfo, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.windows.getCurrent(getInfo, callback);
|
||||
}, "windows.getCurrent");
|
||||
}
|
||||
getLastFocused(getInfo, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.windows.getLastFocused(getInfo, callback);
|
||||
}, "windows.getLastFocused");
|
||||
}
|
||||
update(windowId, updateInfo, callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.windows.update(windowId, updateInfo, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.windows.update(windowId, updateInfo);
|
||||
}
|
||||
}, "windows.update");
|
||||
}
|
||||
}
|
||||
class EdgeChromeWindowsBridge extends EdgeWindowsBridge {
|
||||
remove(windowId, callback) {
|
||||
bridgeLog.LogUnavailbleApi("windows.remove");
|
||||
}
|
||||
}
|
||||
class EdgeBackgroundBridge {
|
||||
constructor() {
|
||||
this.app = new EdgeChromeAppBridge();
|
||||
this.browserAction = typeof browser.browserAction !== "undefined" ? new EdgeChromeBrowserActionBridge() : undefined;
|
||||
this.contextMenus = typeof browser.contextMenus !== "undefined" ? new EdgeContextMenusBridge() : undefined;
|
||||
this.cookies = typeof browser.cookies !== "undefined" ? new EdgeChromeCookiesBridge() : undefined;
|
||||
this.extension = typeof browser.extension !== "undefined" ? new EdgeChromeExtensionBridge() : undefined;
|
||||
this.history = typeof browser.history !== "undefined" ? new EdgeHistoryBridge() : undefined;
|
||||
this.i18n = typeof browser.i18n !== "undefined" ? new EdgeI18nBridge() : undefined;
|
||||
this.notifications = typeof browser.notifications !== "undefined" ? new EdgeNotificationBridge() : undefined;
|
||||
this.pageAction = typeof browser.pageAction !== "undefined" ? new EdgePageActionBridge() : undefined;
|
||||
this.permissions = typeof browser.permissions !== "undefined" ? new EdgePermissionsBridge() : undefined;
|
||||
this.runtime = typeof browser.runtime !== "undefined" ? new EdgeChromeRuntimeBridge() : undefined;
|
||||
this.storage = typeof browser.storage !== "undefined" ? new EdgeChromeStorageBridge() : undefined;
|
||||
this.tabs = typeof browser.tabs !== "undefined" ? new EdgeChromeTabsBridge() : undefined;
|
||||
this.webNavigation = typeof browser.webNavigation !== "undefined" ? new EdgeWebNavigationBridge() : undefined;
|
||||
this.webRequest = typeof browser.webRequest !== "undefined" ? new EdgeWebRequestBridge() : undefined;
|
||||
this.windows = typeof browser.windows !== "undefined" ? new EdgeChromeWindowsBridge() : undefined;
|
||||
}
|
||||
}
|
||||
var myBrowser = browser;
|
||||
var chrome = new EdgeBackgroundBridge();
|
|
@ -1,323 +0,0 @@
|
|||
if (!Range.prototype["intersectsNode"]) {
|
||||
Range.prototype["intersectsNode"] = function (node) {
|
||||
let range = document.createRange();
|
||||
range.selectNode(node);
|
||||
return 0 > this.compareBoundaryPoints(Range.END_TO_START, range)
|
||||
&& 0 < this.compareBoundaryPoints(Range.START_TO_END, range);
|
||||
};
|
||||
}
|
||||
var getExtensionProtocol = function () {
|
||||
if (typeof browser == "undefined") {
|
||||
if (typeof chrome !== "undefined")
|
||||
return "chrome-extension://";
|
||||
}
|
||||
else {
|
||||
return "ms-browser-extension://";
|
||||
}
|
||||
};
|
||||
class FakeEvent {
|
||||
addListener(callback) { }
|
||||
addRules(rules, callback) { }
|
||||
getRules(ruleIdentifiers, callback) { }
|
||||
hasListener(callback) { return false; }
|
||||
hasListeners() { return false; }
|
||||
removeRules(ruleIdentifiers, callback) { }
|
||||
removeListener(callback) { }
|
||||
}
|
||||
class EdgeBridgeHelper {
|
||||
constructor() {
|
||||
this.fakeEvent = new FakeEvent();
|
||||
}
|
||||
toAbsolutePath(relativePath) {
|
||||
if (relativePath.indexOf("ms-browser-extension://") == 0) {
|
||||
return relativePath.replace(myBrowser.runtime.getURL(""), "");
|
||||
}
|
||||
else if (relativePath.indexOf("/") != 0) {
|
||||
var absolutePath = "";
|
||||
var documentPath = document.location.pathname;
|
||||
absolutePath = documentPath.substring(0, documentPath.lastIndexOf("/") + 1);
|
||||
absolutePath += relativePath;
|
||||
return absolutePath;
|
||||
}
|
||||
return relativePath;
|
||||
}
|
||||
}
|
||||
var bridgeHelper = new EdgeBridgeHelper();
|
||||
class EdgeBridgeDebugLog {
|
||||
constructor() {
|
||||
this.CatchOnException = true;
|
||||
this.VerboseLogging = true;
|
||||
this.FailedCalls = {};
|
||||
this.SuccededCalls = {};
|
||||
this.DeprecatedCalls = {};
|
||||
this.BridgedCalls = {};
|
||||
this.UnavailableApis = {};
|
||||
this.EdgeIssues = {};
|
||||
}
|
||||
log(message) {
|
||||
try {
|
||||
if (this.VerboseLogging) {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
info(message) {
|
||||
try {
|
||||
if (this.VerboseLogging) {
|
||||
console.info(message);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
warn(message) {
|
||||
try {
|
||||
if (this.VerboseLogging) {
|
||||
console.warn(message);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
error(message) {
|
||||
try {
|
||||
if (this.VerboseLogging) {
|
||||
console.error(message);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
DoActionAndLog(action, name, deprecatedTo, bridgedTo) {
|
||||
var result;
|
||||
try {
|
||||
result = action();
|
||||
this.AddToCalledDictionary(this.SuccededCalls, name);
|
||||
if (typeof deprecatedTo !== "undefined" && typeof deprecatedTo !== "null") {
|
||||
this.warn("API Call Deprecated - Name: " + name + ", Please use " + deprecatedTo + " instead!");
|
||||
this.AddToCalledDictionary(this.DeprecatedCalls, name);
|
||||
}
|
||||
if (typeof bridgedTo !== "undefined" && typeof bridgedTo !== "null") {
|
||||
this.info("API Call '" + name + "' has been bridged to another Edge API: " + bridgedTo);
|
||||
this.AddToCalledDictionary(this.BridgedCalls, name);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (ex) {
|
||||
this.AddToCalledDictionary(this.FailedCalls, name);
|
||||
if (this.CatchOnException)
|
||||
this.error("API Call Failed: " + name + " - " + ex);
|
||||
else
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
LogEdgeIssue(name, message) {
|
||||
this.warn(message);
|
||||
this.AddToCalledDictionary(this.EdgeIssues, name);
|
||||
}
|
||||
LogUnavailbleApi(name, deprecatedTo) {
|
||||
this.warn("API Call '" + name + "' is not supported in Edge");
|
||||
this.AddToCalledDictionary(this.UnavailableApis, name);
|
||||
if (typeof deprecatedTo !== "undefined" && typeof deprecatedTo !== "null") {
|
||||
this.warn("API Call Deprecated - Name: " + name + ", Please use " + deprecatedTo + " instead!");
|
||||
this.AddToCalledDictionary(this.DeprecatedCalls, name);
|
||||
}
|
||||
}
|
||||
AddToCalledDictionary(dictionary, name) {
|
||||
if (typeof dictionary[name] !== "undefined") {
|
||||
dictionary[name]++;
|
||||
}
|
||||
else {
|
||||
dictionary[name] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
var bridgeLog = new EdgeBridgeDebugLog();
|
||||
class EdgeExtensionBridge {
|
||||
getBackgroundPage() {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.extension.getBackgroundPage();
|
||||
}, "extension.getBackgroundPage");
|
||||
}
|
||||
getURL(path) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.extension.getURL(path);
|
||||
}, "extension.getURL");
|
||||
}
|
||||
getViews(fetchProperties) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.extension.getViews(fetchProperties);
|
||||
}, "extension.getViews");
|
||||
}
|
||||
}
|
||||
class EdgeChromeExtensionBridge extends EdgeExtensionBridge {
|
||||
get onConnect() { return bridgeLog.DoActionAndLog(() => { return EdgeRuntimeBridge.prototype.onConnect; }, "extension.onConnect", "runtime.onConnect", "runtime.onConnect"); }
|
||||
get onMessage() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "extension.onMessage", "runtime.onMessage", "runtime.onMessage"); }
|
||||
get onRequest() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "extension.onRequest", "runtime.onMessage", "runtime.onMessage"); }
|
||||
get onRequestExternal() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessageExternal; }, "extension.onRequestExternal", "runtime.onMessageExternal", "runtime.onMessageExternal"); }
|
||||
get inIncognitoContext() { return bridgeLog.DoActionAndLog(() => { return myBrowser.extension["inPrivateContext"]; }, "extension.inIncognitoContext", undefined, "extension.inPrivateContext"); }
|
||||
get lastError() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.lastError; }, "extension.lastError", undefined, "runtime.lastError"); }
|
||||
connect(extensionId, connectInfo) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return EdgeRuntimeBridge.prototype.connect(extensionId, connectInfo);
|
||||
}, "extension.connect", "runtime.connect", "runtime.connect");
|
||||
}
|
||||
sendMessage(message, responseCallback) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return EdgeRuntimeBridge.prototype.sendMessage(message, responseCallback, undefined, undefined);
|
||||
}, "extension.sendMessage", "runtime.sendMessage", "runtime.sendMessage");
|
||||
}
|
||||
sendRequest(extensionId, message, options, responseCallback) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return EdgeRuntimeBridge.prototype.sendMessage(extensionId, message, options, responseCallback);
|
||||
}, "extension.sendRequest", "runtime.sendMessage", "runtime.sendMessage");
|
||||
}
|
||||
isAllowedFileSchemeAccess(callback) {
|
||||
bridgeLog.LogUnavailbleApi("extension.isAllowedFileSchemeAccess");
|
||||
}
|
||||
isAllowedIncognitoAccess(callback) {
|
||||
bridgeLog.LogUnavailbleApi("extension.isAllowedIncognitoAccess");
|
||||
}
|
||||
setUpdateUrlData(data) {
|
||||
bridgeLog.LogUnavailbleApi("extension.setUpdateUrlData");
|
||||
}
|
||||
}
|
||||
class EdgeI18nBridge {
|
||||
getAcceptLanguages(callback) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.i18n.getAcceptLanguages(callback);
|
||||
}, "i18n.getAcceptLanguages");
|
||||
}
|
||||
getMessage(messageName, substitutions) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
if (messageName.indexOf("@@extension_id") > -1) {
|
||||
return myBrowser.runtime.id;
|
||||
}
|
||||
if (typeof substitutions !== "undefined" && typeof substitutions !== "null") {
|
||||
return myBrowser.i18n.getMessage(messageName, substitutions);
|
||||
}
|
||||
else {
|
||||
return myBrowser.i18n.getMessage(messageName);
|
||||
}
|
||||
}, "i18n.getMessage");
|
||||
}
|
||||
getUILanguage() {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.i18n.getUILanguage();
|
||||
}, "i18n.getUILanguage");
|
||||
}
|
||||
}
|
||||
class EdgeRuntimeBridge {
|
||||
get id() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.id; }, "runtime.id"); }
|
||||
get lastError() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.lastError; }, "runtime.lastError"); }
|
||||
get onConnect() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onConnect; }, "runtime.onConnect"); }
|
||||
get onInstalled() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onInstalled; }, "runtime.onInstalled"); }
|
||||
get onMessage() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessage; }, "runtime.onMessage"); }
|
||||
get onMessageExternal() { return bridgeLog.DoActionAndLog(() => { return myBrowser.runtime.onMessageExternal; }, "runtime.onMessageExternal"); }
|
||||
connect(extensionId, connectInfo) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof connectInfo !== "undefined" && typeof connectInfo !== "null") {
|
||||
return myBrowser.runtime.connect(extensionId, connectInfo);
|
||||
}
|
||||
else {
|
||||
return myBrowser.runtime.connect(extensionId);
|
||||
}
|
||||
}, "runtime.connect");
|
||||
}
|
||||
getBackgroundPage(callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
myBrowser.runtime.getBackgroundPage(callback);
|
||||
}, "runtime.getBackgroundPage");
|
||||
}
|
||||
getManifest() {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.runtime.getManifest();
|
||||
}, "runtime.getManifest");
|
||||
}
|
||||
getURL(path) {
|
||||
return bridgeLog.DoActionAndLog(() => {
|
||||
return myBrowser.runtime.getURL(path);
|
||||
}, "runtime.getURL");
|
||||
}
|
||||
sendMessage(extensionId, message, options, responseCallback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
if (typeof responseCallback !== "undefined" && typeof responseCallback !== "null") {
|
||||
myBrowser.runtime.sendMessage(extensionId, message, options, responseCallback);
|
||||
}
|
||||
else if (typeof options !== "undefined" && typeof options !== "null") {
|
||||
myBrowser.runtime.sendMessage(extensionId, message, options);
|
||||
}
|
||||
else if (typeof message !== "undefined" && typeof message !== "null") {
|
||||
myBrowser.runtime.sendMessage(extensionId, message);
|
||||
}
|
||||
else {
|
||||
myBrowser.runtime.sendMessage(undefined, extensionId);
|
||||
}
|
||||
}, "runtime.sendMessage");
|
||||
}
|
||||
}
|
||||
class EdgeChromeRuntimeBridge extends EdgeRuntimeBridge {
|
||||
get onConnectExternal() { bridgeLog.LogUnavailbleApi("runtime.onConnectExternal"); return bridgeHelper.fakeEvent; }
|
||||
get onRestartRequired() { bridgeLog.LogUnavailbleApi("runtime.onRestartRequired"); return bridgeHelper.fakeEvent; }
|
||||
get onStartup() { bridgeLog.LogUnavailbleApi("runtime.onStartup"); return bridgeHelper.fakeEvent; }
|
||||
get onSuspend() { bridgeLog.LogUnavailbleApi("runtime.onSuspend"); return bridgeHelper.fakeEvent; }
|
||||
get onSuspendCanceled() { bridgeLog.LogUnavailbleApi("runtime.onSuspendCanceled"); return bridgeHelper.fakeEvent; }
|
||||
get onUpdateAvailable() { bridgeLog.LogUnavailbleApi("runtime.onUpdateAvailable"); return bridgeHelper.fakeEvent; }
|
||||
openOptionsPage(callback) {
|
||||
bridgeLog.DoActionAndLog(() => {
|
||||
var optionsPage = myBrowser.runtime.getManifest()["options_page"];
|
||||
var optionsPageUrl = myBrowser.runtime.getURL(optionsPage);
|
||||
if (typeof callback !== "undefined" && typeof callback !== "null") {
|
||||
myBrowser.tabs.create({ url: optionsPageUrl }, callback);
|
||||
}
|
||||
else {
|
||||
myBrowser.tabs.create({ url: optionsPageUrl });
|
||||
}
|
||||
}, "runtime.openOptionsPage", undefined, "tabs.create({ url: optionsPageUrl })");
|
||||
}
|
||||
connectNative(application) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.connectNative");
|
||||
return null;
|
||||
}
|
||||
getPackageDirectoryEntry(callback) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.getPackageDirectoryEntry");
|
||||
}
|
||||
getPlatformInfo(callback) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.getPlatformInfo");
|
||||
}
|
||||
reload() {
|
||||
bridgeLog.LogUnavailbleApi("runtime.reload");
|
||||
}
|
||||
requestUpdateCheck(callback) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.requestUpdateCheck");
|
||||
}
|
||||
restart() {
|
||||
bridgeLog.LogUnavailbleApi("runtime.restart");
|
||||
}
|
||||
setUninstallURL(url, callback) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.setUninstallURL");
|
||||
}
|
||||
sendNativeMessage(application, message, responseCallback) {
|
||||
bridgeLog.LogUnavailbleApi("runtime.sendNativeMessage");
|
||||
}
|
||||
}
|
||||
class EdgeStorageBridge {
|
||||
get local() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.local; }, "storage.local"); }
|
||||
get onChanged() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.onChanged; }, "storage.onChanged"); }
|
||||
}
|
||||
class EdgeChromeStorageBridge extends EdgeStorageBridge {
|
||||
get managed() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.local; }, "storage.managed", undefined, "storage.local"); }
|
||||
get sync() { return bridgeLog.DoActionAndLog(() => { return myBrowser.storage.local; }, "storage.sync", undefined, "storage.local"); }
|
||||
}
|
||||
class EdgeContentBridge {
|
||||
constructor() {
|
||||
this.extension = typeof browser.extension !== "undefined" ? new EdgeChromeExtensionBridge() : undefined;
|
||||
this.i18n = typeof browser.i18n !== "undefined" ? new EdgeI18nBridge() : undefined;
|
||||
this.runtime = typeof browser.runtime !== "undefined" ? new EdgeChromeRuntimeBridge() : undefined;
|
||||
this.storage = typeof browser.storage !== "undefined" ? new EdgeChromeStorageBridge() : undefined;
|
||||
}
|
||||
}
|
||||
var myBrowser = browser;
|
||||
var chrome = new EdgeContentBridge();
|
|
@ -163,9 +163,7 @@ export class AppComponent implements OnInit {
|
|||
}
|
||||
|
||||
getState(outlet: RouterOutlet) {
|
||||
if (BrowserApi.isEdge18) {
|
||||
return null;
|
||||
} else if (outlet.activatedRouteData.state === 'ciphers') {
|
||||
if (outlet.activatedRouteData.state === 'ciphers') {
|
||||
const routeDirection = (window as any).routeDirection != null ? (window as any).routeDirection : '';
|
||||
return 'ciphers_direction=' + routeDirection + '_' +
|
||||
(outlet.activatedRoute.queryParams as any).value.folderId + '_' +
|
||||
|
|
|
@ -7,8 +7,6 @@ import 'web-animations-js';
|
|||
// tslint:disable-next-line
|
||||
require('./scss/popup.scss');
|
||||
|
||||
import { BrowserApi } from '../browser/browserApi';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
if (process.env.ENV === 'production') {
|
||||
|
@ -16,22 +14,6 @@ if (process.env.ENV === 'production') {
|
|||
}
|
||||
|
||||
function init() {
|
||||
if (BrowserApi.isEdge18) {
|
||||
const inPopup = window.location.search === '' || window.location.search.indexOf('uilocation=') === -1 ||
|
||||
window.location.search.indexOf('uilocation=popup') > -1;
|
||||
if (inPopup) {
|
||||
const bodyRect = document.querySelector('body').getBoundingClientRect();
|
||||
chrome.windows.create({
|
||||
url: 'popup/index.html?uilocation=popout',
|
||||
type: 'popup',
|
||||
width: Math.round(bodyRect.width + 60),
|
||||
height: Math.round(bodyRect.height),
|
||||
});
|
||||
BrowserApi.closePopup(window);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule, { preserveWhitespaces: true });
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,6 @@ export class LaunchGuardService implements CanActivate {
|
|||
|
||||
async canActivate() {
|
||||
if (BrowserApi.getBackgroundPage() == null) {
|
||||
if (BrowserApi.isEdge18) {
|
||||
// tslint:disable-next-line
|
||||
console.log('getBackgroundPage is null from launch guard.');
|
||||
}
|
||||
this.router.navigate(['private-mode']);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import { CipherService } from 'jslib/abstractions/cipher.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
|
||||
import { SearchService } from 'jslib/services/search.service';
|
||||
|
||||
export class PopupSearchService extends SearchService {
|
||||
constructor(private mainSearchService: SearchService, cipherService: CipherService,
|
||||
platformUtilsService: PlatformUtilsService) {
|
||||
super(cipherService, platformUtilsService);
|
||||
constructor(private mainSearchService: SearchService, cipherService: CipherService) {
|
||||
super(cipherService);
|
||||
}
|
||||
|
||||
clearIndex() {
|
||||
|
|
|
@ -39,12 +39,6 @@ export class PopupUtilsService {
|
|||
|
||||
popOut(win: Window): void {
|
||||
let href = win.location.href;
|
||||
if (this.platformUtilsService.isEdge()) {
|
||||
const popupIndex = href.indexOf('/popup/');
|
||||
if (popupIndex > -1) {
|
||||
href = href.substring(popupIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof chrome !== 'undefined') && chrome.windows && chrome.windows.create) {
|
||||
if (href.indexOf('?uilocation=') > -1) {
|
||||
|
|
|
@ -70,7 +70,7 @@ export const authService = new AuthService(getBgService<CryptoService>('cryptoSe
|
|||
getBgService<I18nService>('i18nService')(), getBgService<PlatformUtilsService>('platformUtilsService')(),
|
||||
messagingService, getBgService<VaultTimeoutService>('vaultTimeoutService')(), null);
|
||||
export const searchService = new PopupSearchService(getBgService<SearchService>('searchService')(),
|
||||
getBgService<CipherService>('cipherService')(), getBgService<PlatformUtilsService>('platformUtilsService')());
|
||||
getBgService<CipherService>('cipherService')());
|
||||
|
||||
export function initFactory(i18nService: I18nService, storageService: StorageService,
|
||||
popupUtilsService: PopupUtilsService): Function {
|
||||
|
|
|
@ -61,8 +61,7 @@ export class SettingsComponent implements OnInit {
|
|||
}
|
||||
|
||||
async ngOnInit() {
|
||||
const showOnLocked = !this.platformUtilsService.isFirefox() && !this.platformUtilsService.isEdge()
|
||||
&& !this.platformUtilsService.isSafari();
|
||||
const showOnLocked = !this.platformUtilsService.isFirefox() && !this.platformUtilsService.isSafari();
|
||||
|
||||
this.vaultTimeouts = [
|
||||
{ name: this.i18nService.t('immediately'), value: 0 },
|
||||
|
@ -264,11 +263,6 @@ export class SettingsComponent implements OnInit {
|
|||
}
|
||||
|
||||
export() {
|
||||
if (this.platformUtilsService.isEdge()) {
|
||||
BrowserApi.createNewTab('https://help.bitwarden.com/article/export-your-data/');
|
||||
return;
|
||||
}
|
||||
|
||||
this.router.navigate(['/export']);
|
||||
}
|
||||
|
||||
|
@ -327,10 +321,7 @@ export class SettingsComponent implements OnInit {
|
|||
|
||||
rate() {
|
||||
this.analytics.eventTrack.next({ action: 'Rate Extension' });
|
||||
let deviceType = this.platformUtilsService.getDevice();
|
||||
if (window.navigator.userAgent.indexOf('Edg/') > -1) {
|
||||
deviceType = DeviceType.EdgeExtension;
|
||||
}
|
||||
const deviceType = this.platformUtilsService.getDevice();
|
||||
BrowserApi.createNewTab((RateUrls as any)[deviceType]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ export class AddEditComponent extends BaseAddEditComponent {
|
|||
|
||||
async ngOnInit() {
|
||||
await super.ngOnInit();
|
||||
this.showAttachments = !this.platformUtilsService.isEdge();
|
||||
|
||||
const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
|
||||
if (params.cipherId) {
|
||||
this.cipherId = params.cipherId;
|
||||
|
|
|
@ -64,7 +64,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
|
|||
private folderService: FolderService, private collectionService: CollectionService,
|
||||
private analytics: Angulartics2, private platformUtilsService: PlatformUtilsService) {
|
||||
super(searchService);
|
||||
this.pageSize = platformUtilsService.isEdge() ? 25 : 100;
|
||||
this.pageSize = 100;
|
||||
this.applySavedState = (window as any).previousPopupUrl != null &&
|
||||
!(window as any).previousPopupUrl.startsWith('/ciphers');
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
|
|||
private platformUtilsService: PlatformUtilsService, private searchService: SearchService,
|
||||
private location: Location) {
|
||||
super(collectionService, folderService, storageService, userService);
|
||||
this.noFolderListSize = platformUtilsService.isEdge() ? 25 : 100;
|
||||
this.noFolderListSize = 100;
|
||||
}
|
||||
|
||||
get showNoFolderCiphers(): boolean {
|
||||
|
|
|
@ -56,7 +56,6 @@ export class ViewComponent extends BaseViewComponent {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.showAttachments = !this.platformUtilsService.isEdge();
|
||||
this.inPopout = this.popupUtilsService.inPopout(window);
|
||||
const queryParamsSub = this.route.queryParams.subscribe(async (params) => {
|
||||
if (params.cipherId) {
|
||||
|
|
|
@ -59,7 +59,7 @@ describe('Browser Utils Service', () => {
|
|||
it('should detect edge', () => {
|
||||
Object.defineProperty(navigator, 'userAgent', {
|
||||
configurable: true,
|
||||
value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; ServiceUI 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063',
|
||||
value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.74 Safari/537.36 Edg/79.0.309.43',
|
||||
});
|
||||
|
||||
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null, null);
|
||||
|
|
|
@ -32,7 +32,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
|
|||
} else if ((!!(window as any).opr && !!opr.addons) || !!(window as any).opera ||
|
||||
navigator.userAgent.indexOf(' OPR/') >= 0) {
|
||||
this.deviceCache = DeviceType.OperaExtension;
|
||||
} else if (navigator.userAgent.indexOf(' Edge/') !== -1) {
|
||||
} else if (navigator.userAgent.indexOf(' Edg/') !== -1) {
|
||||
this.deviceCache = DeviceType.EdgeExtension;
|
||||
} else if (navigator.userAgent.indexOf(' Vivaldi/') !== -1) {
|
||||
this.deviceCache = DeviceType.VivaldiExtension;
|
||||
|
|
Loading…
Reference in New Issue