Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: firstRun.js

Issue 8689042: adblockpluschrome: Handle invalid share popup sites (Closed)
Patch Set: Created Oct. 25, 2012, 3:38 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firstRun.js
===================================================================
--- a/firstRun.js
+++ b/firstRun.js
@@ -7,6 +7,7 @@
{
var iframe = document.getElementById("share-popup");
var glassPane = document.getElementById("glass-pane");
+ var popupMessageReceived = false;
var popupMessageListener = function(event)
{
@@ -15,20 +16,27 @@
iframe.width = event.data.width;
iframe.height = event.data.height;
+ popupMessageReceived = true;
window.removeEventListener("message", popupMessageListener);
};
window.addEventListener("message", popupMessageListener, false);
var popupLoadListener = function()
{
- iframe.className = "visible";
+ if (popupMessageReceived)
+ {
+ iframe.className = "visible";
- var popupCloseListener = function()
- {
- iframe.className = glassPane.className = "";
- document.removeEventListener("click", popupCloseListener);
- };
- document.addEventListener("click", popupCloseListener, false);
+ var popupCloseListener = function()
+ {
+ iframe.className = glassPane.className = "";
+ document.removeEventListener("click", popupCloseListener);
+ };
+ document.addEventListener("click", popupCloseListener, false);
+ }
+ else
+ glassPane.className = "";
Wladimir Palant 2012/10/25 15:54:15 Also remove message listener here?
Felix Dahlke 2012/10/25 15:57:11 Done.
+
iframe.removeEventListener("load", popupLoadListener);
};
iframe.addEventListener("load", popupLoadListener, false);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld