1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-06-27 10:46:02 +02:00

Revert "skip vis checks for notification bar collect()"

This reverts commit 9f51f005b0.
This commit is contained in:
Kyle Spearrin 2017-10-02 10:29:46 -04:00
parent 9f51f005b0
commit 1e18827b61
5 changed files with 13 additions and 37 deletions

View File

@ -67,7 +67,7 @@ var bg_isBackground = true,
hitType: 'event', hitType: 'event',
eventAction: 'Autofilled From Command' eventAction: 'Autofilled From Command'
}); });
collectPageDetailsForContentScript(tabs[0], 'autofill_cmd', false); collectPageDetailsForContentScript(tabs[0], 'autofill_cmd');
} }
}); });
} }
@ -101,7 +101,7 @@ var bg_isBackground = true,
messageTab(sender.tab.id, 'adjustNotificationBar', msg.data); messageTab(sender.tab.id, 'adjustNotificationBar', msg.data);
} }
else if (msg.command === 'bgCollectPageDetails') { else if (msg.command === 'bgCollectPageDetails') {
collectPageDetailsForContentScript(sender.tab, msg.sender, msg.noVisibleChecks); collectPageDetailsForContentScript(sender.tab, msg.sender);
} }
else if (msg.command === 'bgAddLogin') { else if (msg.command === 'bgAddLogin') {
addLogin(msg.login, sender.tab); addLogin(msg.login, sender.tab);
@ -560,17 +560,12 @@ var bg_isBackground = true,
}); });
} }
function collectPageDetailsForContentScript(tab, sender, noVisibleChecks) { function collectPageDetailsForContentScript(tab, sender) {
if (!tab || !tab.id) { if (!tab || !tab.id) {
return; return;
} }
chrome.tabs.sendMessage(tab.id, { chrome.tabs.sendMessage(tab.id, { command: 'collectPageDetails', tab: tab, sender: sender }, function () {
command: 'collectPageDetails',
tab: tab,
sender: sender,
noVisibleChecks: noVisibleChecks
}, function () {
if (chrome.runtime.lastError) { if (chrome.runtime.lastError) {
return; return;
} }
@ -742,12 +737,7 @@ var bg_isBackground = true,
return; return;
} }
chrome.tabs.sendMessage(tab.id, { chrome.tabs.sendMessage(tab.id, { command: 'collectPageDetails', tab: tab, sender: 'contextMenu' }, function () {
command: 'collectPageDetails',
tab: tab,
sender: 'contextMenu',
noVisibleChecks: false
}, function () {
}); });
}); });
} }

View File

@ -36,7 +36,7 @@
3. Unminify and format to meet Mozilla review requirements. 3. Unminify and format to meet Mozilla review requirements.
*/ */
function collect(document, undefined, noVisibleChecks) { function collect(document, undefined) {
var isFirefox = navigator.userAgent.indexOf('Firefox') !== -1 || navigator.userAgent.indexOf('Gecko/') !== -1; var isFirefox = navigator.userAgent.indexOf('Firefox') !== -1 || navigator.userAgent.indexOf('Gecko/') !== -1;
document.elementsByOPID = {}; document.elementsByOPID = {};
@ -457,10 +457,6 @@
// is a dom element visible on screen? // is a dom element visible on screen?
function isElementVisible(el) { function isElementVisible(el) {
if (noVisibleChecks) {
return true;
}
var theEl = el; var theEl = el;
el = (el = el.ownerDocument) ? el.defaultView : {}; el = (el = el.ownerDocument) ? el.defaultView : {};
@ -484,10 +480,6 @@
// is a dom element "viewable" on screen? // is a dom element "viewable" on screen?
function isElementViewable(el) { function isElementViewable(el) {
if (noVisibleChecks) {
return true;
}
var theDoc = el.ownerDocument.documentElement, var theDoc = el.ownerDocument.documentElement,
rect = el.getBoundingClientRect(), rect = el.getBoundingClientRect(),
docScrollWidth = theDoc.scrollWidth, docScrollWidth = theDoc.scrollWidth,
@ -966,7 +958,7 @@
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) { chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (msg.command === 'collectPageDetails') { if (msg.command === 'collectPageDetails') {
var pageDetails = collect(document, msg.noVisibleChecks || false); var pageDetails = collect(document);
var pageDetailsObj = JSON.parse(pageDetails); var pageDetailsObj = JSON.parse(pageDetails);
chrome.runtime.sendMessage({ chrome.runtime.sendMessage({
command: 'collectPageDetailsResponse', command: 'collectPageDetailsResponse',

View File

@ -9,8 +9,7 @@
function fill() { function fill() {
chrome.runtime.sendMessage({ chrome.runtime.sendMessage({
command: 'bgCollectPageDetails', command: 'bgCollectPageDetails',
sender: 'autofiller', sender: 'autofiller'
noVisibleChecks: false
}); });
} }
}); });

View File

@ -42,8 +42,7 @@
if (!obj || !obj.disableAddLoginNotification) { if (!obj || !obj.disableAddLoginNotification) {
chrome.runtime.sendMessage({ chrome.runtime.sendMessage({
command: 'bgCollectPageDetails', command: 'bgCollectPageDetails',
sender: 'notificationBar', sender: 'notificationBar'
noVisibleChecks: true
}); });
} }
}); });

View File

@ -37,14 +37,10 @@ angular
return; return;
} }
chrome.tabs.sendMessage(tabs[0].id, { chrome.tabs.sendMessage(tabs[0].id,
command: 'collectPageDetails', { command: 'collectPageDetails', tab: tabs[0], sender: 'currentController' }, function () {
tab: tabs[0], canAutofill = true;
sender: 'currentController', });
noVisibleChecks: false
}, function () {
canAutofill = true;
});
$q.when(loginService.getAllDecryptedForDomain(domain)).then(function (logins) { $q.when(loginService.getAllDecryptedForDomain(domain)).then(function (logins) {
$scope.loaded = true; $scope.loaded = true;