1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-30 13:03:53 +01:00

Fix error in firefox

This commit is contained in:
Hinton 2020-10-21 19:23:27 +02:00
parent 251d0fdde3
commit 222665dd9d
2 changed files with 9 additions and 11 deletions

View File

@ -67,9 +67,15 @@ export class NativeMessagingBackground {
}
});
this.port.onDisconnect.addListener(() => {
const error = BrowserApi.runtimeLastError().message;
if (error === 'Specified native messaging host not found.' || error === 'Access to the specified native messaging host is forbidden.') {
this.port.onDisconnect.addListener((p: any) => {
let error;
if (BrowserApi.isWebExtensionsApi) {
error = p.error.message;
} else {
error = chrome.runtime.lastError.message;
}
if (error === 'Specified native messaging host not found.' || error === 'Access to the specified native messaging host is forbidden.' || error === 'An unexpected error occurred') {
this.messagingService.send('showDialog', {
text: this.i18nService.t('desktopIntegrationDisabledDesc'),
title: this.i18nService.t('desktopIntegrationDisabledTitle'),

View File

@ -229,12 +229,4 @@ export class BrowserApi {
return chrome.runtime.connectNative(application);
}
}
static runtimeLastError(): browser.runtime._LastError | chrome.runtime.LastError {
if (BrowserApi.isWebExtensionsApi) {
return browser.runtime.lastError;
} else if (BrowserApi.isChromeApi) {
return chrome.runtime.lastError;
}
}
}