From 1e18827b611ce682384c9b2c50c8ccde9ef82786 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 2 Oct 2017 10:29:46 -0400 Subject: [PATCH] Revert "skip vis checks for notification bar collect()" This reverts commit 9f51f005b0cf21d594e9c7baef6191f248ee5b54. --- src/background.js | 20 +++++--------------- src/content/autofill.js | 12 ++---------- src/content/autofiller.js | 3 +-- src/content/notificationBar.js | 3 +-- src/popup/app/current/currentController.js | 12 ++++-------- 5 files changed, 13 insertions(+), 37 deletions(-) diff --git a/src/background.js b/src/background.js index f0d54afd..de4ba7c0 100644 --- a/src/background.js +++ b/src/background.js @@ -67,7 +67,7 @@ var bg_isBackground = true, hitType: 'event', 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); } else if (msg.command === 'bgCollectPageDetails') { - collectPageDetailsForContentScript(sender.tab, msg.sender, msg.noVisibleChecks); + collectPageDetailsForContentScript(sender.tab, msg.sender); } else if (msg.command === 'bgAddLogin') { 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) { return; } - chrome.tabs.sendMessage(tab.id, { - command: 'collectPageDetails', - tab: tab, - sender: sender, - noVisibleChecks: noVisibleChecks - }, function () { + chrome.tabs.sendMessage(tab.id, { command: 'collectPageDetails', tab: tab, sender: sender }, function () { if (chrome.runtime.lastError) { return; } @@ -742,12 +737,7 @@ var bg_isBackground = true, return; } - chrome.tabs.sendMessage(tab.id, { - command: 'collectPageDetails', - tab: tab, - sender: 'contextMenu', - noVisibleChecks: false - }, function () { + chrome.tabs.sendMessage(tab.id, { command: 'collectPageDetails', tab: tab, sender: 'contextMenu' }, function () { }); }); } diff --git a/src/content/autofill.js b/src/content/autofill.js index d1fdb1f2..d2d3a7e3 100644 --- a/src/content/autofill.js +++ b/src/content/autofill.js @@ -36,7 +36,7 @@ 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; document.elementsByOPID = {}; @@ -457,10 +457,6 @@ // is a dom element visible on screen? function isElementVisible(el) { - if (noVisibleChecks) { - return true; - } - var theEl = el; el = (el = el.ownerDocument) ? el.defaultView : {}; @@ -484,10 +480,6 @@ // is a dom element "viewable" on screen? function isElementViewable(el) { - if (noVisibleChecks) { - return true; - } - var theDoc = el.ownerDocument.documentElement, rect = el.getBoundingClientRect(), docScrollWidth = theDoc.scrollWidth, @@ -966,7 +958,7 @@ chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) { if (msg.command === 'collectPageDetails') { - var pageDetails = collect(document, msg.noVisibleChecks || false); + var pageDetails = collect(document); var pageDetailsObj = JSON.parse(pageDetails); chrome.runtime.sendMessage({ command: 'collectPageDetailsResponse', diff --git a/src/content/autofiller.js b/src/content/autofiller.js index cec32ffa..d402d838 100644 --- a/src/content/autofiller.js +++ b/src/content/autofiller.js @@ -9,8 +9,7 @@ function fill() { chrome.runtime.sendMessage({ command: 'bgCollectPageDetails', - sender: 'autofiller', - noVisibleChecks: false + sender: 'autofiller' }); } }); diff --git a/src/content/notificationBar.js b/src/content/notificationBar.js index e776b320..358bf3fa 100644 --- a/src/content/notificationBar.js +++ b/src/content/notificationBar.js @@ -42,8 +42,7 @@ if (!obj || !obj.disableAddLoginNotification) { chrome.runtime.sendMessage({ command: 'bgCollectPageDetails', - sender: 'notificationBar', - noVisibleChecks: true + sender: 'notificationBar' }); } }); diff --git a/src/popup/app/current/currentController.js b/src/popup/app/current/currentController.js index 215ab802..fecaef4f 100644 --- a/src/popup/app/current/currentController.js +++ b/src/popup/app/current/currentController.js @@ -37,14 +37,10 @@ angular return; } - chrome.tabs.sendMessage(tabs[0].id, { - command: 'collectPageDetails', - tab: tabs[0], - sender: 'currentController', - noVisibleChecks: false - }, function () { - canAutofill = true; - }); + chrome.tabs.sendMessage(tabs[0].id, + { command: 'collectPageDetails', tab: tabs[0], sender: 'currentController' }, function () { + canAutofill = true; + }); $q.when(loginService.getAllDecryptedForDomain(domain)).then(function (logins) { $scope.loaded = true;