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:
parent
251d0fdde3
commit
222665dd9d
@ -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'),
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user