1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-03 18:28:13 +01:00

fix issue with no message on menus

This commit is contained in:
Kyle Spearrin 2017-12-06 22:10:02 -05:00
parent c2e5945be5
commit b1880c5305

View File

@ -361,19 +361,18 @@ export default class MainBackground {
return; return;
} }
const self = this;
const tab = await this.tabsQueryFirst({ active: true, windowId: chrome.windows.WINDOW_ID_CURRENT }); const tab = await this.tabsQueryFirst({ active: true, windowId: chrome.windows.WINDOW_ID_CURRENT });
if (!tab) { if (!tab) {
return; return;
} }
const disabled = await self.utilsService.getObjFromStorage<boolean>(ConstantsService.disableContextMenuItemKey); const disabled = await this.utilsService.getObjFromStorage<boolean>(ConstantsService.disableContextMenuItemKey);
if (!disabled) { if (!disabled) {
await this.buildContextMenu(); await this.buildContextMenu();
this.contextMenuReady(tab, true); await this.contextMenuReady(tab, true);
} else { } else {
await this.contextMenusRemoveAll(); await this.contextMenusRemoveAll();
self.contextMenuReady(tab, false); await this.contextMenuReady(tab, false);
} }
} }
@ -387,7 +386,7 @@ export default class MainBackground {
return; return;
} }
const tabDomain = this.utilsService.getDomain(url); const tabDomain = UtilsService.getDomain(url);
if (tabDomain == null) { if (tabDomain == null) {
return; return;
} }
@ -413,7 +412,7 @@ export default class MainBackground {
theText = '9+'; theText = '9+';
} else { } else {
if (contextMenuEnabled) { if (contextMenuEnabled) {
this.loadNoLoginsContextMenuOptions(this.i18nService.noMatchingLogins); await this.loadNoLoginsContextMenuOptions(this.i18nService.noMatchingLogins);
} }
} }
@ -421,7 +420,7 @@ export default class MainBackground {
this.sidebarActionSetBadgeText(theText, tabId); this.sidebarActionSetBadgeText(theText, tabId);
} catch (e) { } catch (e) {
if (contextMenuEnabled) { if (contextMenuEnabled) {
this.loadNoLoginsContextMenuOptions(this.i18nService.vaultLocked); await this.loadNoLoginsContextMenuOptions(this.i18nService.vaultLocked);
} }
this.browserActionSetBadgeText('', tabId); this.browserActionSetBadgeText('', tabId);
this.sidebarActionSetBadgeText('', tabId); this.sidebarActionSetBadgeText('', tabId);
@ -452,11 +451,7 @@ export default class MainBackground {
this.menuOptionsLoaded.push(idSuffix); this.menuOptionsLoaded.push(idSuffix);
if (cipher == null) { if (cipher == null || (cipher.login.password && cipher.login.password !== '')) {
return;
}
if (cipher.login.password && cipher.login.password !== '') {
await this.contextMenusCreate({ await this.contextMenusCreate({
type: 'normal', type: 'normal',
id: 'autofill_' + idSuffix, id: 'autofill_' + idSuffix,
@ -471,7 +466,7 @@ export default class MainBackground {
return; return;
} }
if (cipher.login.username && cipher.login.username !== '') { if (cipher == null || (cipher.login.username && cipher.login.username !== '')) {
await this.contextMenusCreate({ await this.contextMenusCreate({
type: 'normal', type: 'normal',
id: 'copy-username_' + idSuffix, id: 'copy-username_' + idSuffix,
@ -481,7 +476,7 @@ export default class MainBackground {
}); });
} }
if (cipher.login.password && cipher.login.password !== '') { if (cipher == null || (cipher.login.password && cipher.login.password !== '')) {
await this.contextMenusCreate({ await this.contextMenusCreate({
type: 'normal', type: 'normal',
id: 'copy-password_' + idSuffix, id: 'copy-password_' + idSuffix,