From f852cbbfe31b6afc13d121dc58b08040af7b593a Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 5 Oct 2017 23:27:32 -0400 Subject: [PATCH] collect for notification bar inside iframes --- src/content/notificationBar.js | 21 ++++++++++++++++++++- src/manifest.json | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/content/notificationBar.js b/src/content/notificationBar.js index 2836e9d846..6b25eb8315 100644 --- a/src/content/notificationBar.js +++ b/src/content/notificationBar.js @@ -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) { diff --git a/src/manifest.json b/src/manifest.json index fdea09f7be..3c9abb0ee5 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -40,7 +40,7 @@ "run_at": "document_start" }, { - "all_frames": false, + "all_frames": true, "js": [ "content/notificationBar.js" ],