1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

Fix errors from background when context menu is disabled. Updated language for context menu disabling.

This commit is contained in:
Kyle Spearrin 2017-03-14 23:17:22 -04:00
parent abf4d97e81
commit c6705ebaf8
3 changed files with 21 additions and 15 deletions

View File

@ -648,11 +648,11 @@
"description": "Yes, Save Now"
},
"disableContextMenuItem": {
"message": "Disable Context Menu Integration",
"description": "Disable Context Menu Integration"
"message": "Disable Context Menu Options",
"description": "Disable Context Menu Options"
},
"disableContextMenuItemDesc": {
"message": "bitwarden's context menu item provides quick access to logins for the current tab.",
"desription": "bitwarden's context menu item provides quick access to logins for the current tab."
"message": "Context menu options provide quick access to password generation and logins for the website in your current tab.",
"desription": "Context menu options provide quick access to password generation and logins for the website in your current tab."
}
}

View File

@ -649,10 +649,10 @@
},
"disableContextMenuItem": {
"message": "Disabilita Integrazione Menu Contestuale",
"description": "Disable Context Menu Integration"
"description": "Disable Context Menu Options"
},
"disableContextMenuItemDesc": {
"message": "il menu contestuale di bitwarden fornisce l'accesso rapido ai login per la tab corrente.",
"desription": "bitwarden's context menu item provides quick access to logins for the current tab."
"desription": "Context menu options provide quick access to password generation and logins for the website in your current tab."
}
}

View File

@ -230,23 +230,25 @@ function refreshBadgeAndMenu() {
}
chrome.storage.local.get(constantsService.disableContextMenuItemKey, function (obj) {
if (! obj[constantsService.disableContextMenuItemKey]) {
buildContextMenu(function() { contextMenuReady(tab) });
if (!obj[constantsService.disableContextMenuItemKey]) {
buildContextMenu(function () {
contextMenuReady(tab, true);
});
}
else {
chrome.contextMenus.removeAll();
contextMenuReady(tab);
contextMenuReady(tab, false);
}
});
});
}
function contextMenuReady(tab) {
loadMenuAndUpdateBadge(tab.url, tab.id, true);
function contextMenuReady(tab, contextMenuEnabled) {
loadMenuAndUpdateBadge(tab.url, tab.id, contextMenuEnabled);
onUpdatedRan = onReplacedRan = false;
}
function loadMenuAndUpdateBadge(url, tabId, loadContextMenuOptions) {
function loadMenuAndUpdateBadge(url, tabId, contextMenuEnabled) {
if (!url) {
return;
}
@ -262,7 +264,7 @@ function loadMenuAndUpdateBadge(url, tabId, loadContextMenuOptions) {
loginService.getAllDecryptedForDomain(tabDomain).then(function (logins) {
sortLogins(logins);
if (loadContextMenuOptions) {
if (contextMenuEnabled) {
for (var i = 0; i < logins.length; i++) {
loadLoginContextMenuOptions(logins[i]);
}
@ -281,14 +283,18 @@ function loadMenuAndUpdateBadge(url, tabId, loadContextMenuOptions) {
});
}
else {
loadNoLoginsContextMenuOptions(i18nService.noMatchingLogins);
if (contextMenuEnabled) {
loadNoLoginsContextMenuOptions(i18nService.noMatchingLogins);
}
chrome.browserAction.setBadgeText({
text: '',
tabId: tabId
});
}
}, function () {
loadNoLoginsContextMenuOptions(i18nService.vaultLocked);
if (contextMenuEnabled) {
loadNoLoginsContextMenuOptions(i18nService.vaultLocked);
}
chrome.browserAction.setBadgeText({
text: '',
tabId: tabId