filter senders for autofill

This commit is contained in:
Kyle Spearrin 2017-10-17 22:52:56 -04:00
parent 3d45cfc7b8
commit 9fe35a9aef
3 changed files with 19 additions and 8 deletions

View File

@ -128,7 +128,7 @@ var bg_isBackground = true,
frameId: sender.frameId, tab: msg.tab, details: msg.details frameId: sender.frameId, tab: msg.tab, details: msg.details
}], msg.sender === 'autofill_cmd'); }], msg.sender === 'autofill_cmd');
} }
else { else if (msg.sender === 'contextMenu') {
clearTimeout(autofillTimeout); clearTimeout(autofillTimeout);
pageDetailsToAutoFill.push({ frameId: sender.frameId, tab: msg.tab, details: msg.details }); pageDetailsToAutoFill.push({ frameId: sender.frameId, tab: msg.tab, details: msg.details });
autofillTimeout = setTimeout(autofillPage, 300); autofillTimeout = setTimeout(autofillPage, 300);
@ -569,7 +569,11 @@ var bg_isBackground = true,
return; return;
} }
chrome.tabs.sendMessage(tab.id, { command: 'collectPageDetails', tab: tab, sender: sender }, function () { chrome.tabs.sendMessage(tab.id, {
command: 'collectPageDetails',
tab: tab,
sender: sender
}, function () {
if (chrome.runtime.lastError) { if (chrome.runtime.lastError) {
return; return;
} }
@ -732,7 +736,11 @@ var bg_isBackground = true,
return; return;
} }
chrome.tabs.sendMessage(tab.id, { command: 'collectPageDetails', tab: tab, sender: 'contextMenu' }, function () { chrome.tabs.sendMessage(tab.id, {
command: 'collectPageDetails',
tab: tab,
sender: 'contextMenu'
}, function () {
}); });
}); });
} }

View File

@ -40,8 +40,11 @@ angular
return; return;
} }
chrome.tabs.sendMessage(tabs[0].id, chrome.tabs.sendMessage(tabs[0].id, {
{ command: 'collectPageDetails', tab: tabs[0], sender: 'currentController' }, function () { command: 'collectPageDetails',
tab: tabs[0],
sender: 'currentController'
}, function () {
canAutofill = true; canAutofill = true;
}); });

View File

@ -78,7 +78,7 @@ angular
$state.go('home'); $state.go('home');
}); });
} }
else if (msg.command === 'collectPageDetailsResponse') { else if (msg.command === 'collectPageDetailsResponse' && msg.sender === 'currentController') {
$scope.$broadcast('collectPageDetailsResponse', { $scope.$broadcast('collectPageDetailsResponse', {
frameId: sender.frameId, frameId: sender.frameId,
tab: msg.tab, tab: msg.tab,