1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-20 16:07:45 +01:00

collect for notification bar inside iframes

This commit is contained in:
Kyle Spearrin 2017-10-05 23:27:32 -04:00
parent e5140595e6
commit f852cbbfe3
2 changed files with 21 additions and 2 deletions

View File

@ -4,7 +4,8 @@
barType = null,
pageHref = null,
observer = null,
domObservationCollectTimeout = null;
domObservationCollectTimeout = null,
iframed = isIframed();
if (window.location.hostname.indexOf('bitwarden.com') === -1) {
chrome.storage.local.get('neverDomains', function (obj) {
@ -23,16 +24,25 @@
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
if (msg.command === 'openNotificationBar') {
if (iframed) {
return;
}
closeExistingAndOpenBar(msg.data.type, msg.data.typeData);
sendResponse();
return true;
}
else if (msg.command === 'closeNotificationBar') {
if (iframed) {
return;
}
closeBar(true);
sendResponse();
return true;
}
else if (msg.command === 'adjustNotificationBar') {
if (iframed) {
return;
}
adjustBar(msg.data);
sendResponse();
return true;
@ -45,6 +55,15 @@
}
});
function isIframed() {
try {
return window.self !== window.top;
}
catch (e) {
return true;
}
}
function observeDom() {
var bodies = document.querySelectorAll('body');
if (bodies.length > 0) {

View File

@ -40,7 +40,7 @@
"run_at": "document_start"
},
{
"all_frames": false,
"all_frames": true,
"js": [
"content/notificationBar.js"
],