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:15 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,8 @@
{
var iframe = document.getElementById("share-popup");
var glassPane = document.getElementById("glass-pane");
+ var popupMessageReceived = false;
+ var popupVisible = false;
var popupMessageListener = function(event)
{
@@ -15,26 +17,37 @@
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";
+ popupVisible = true;
- 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);
+ }
iframe.removeEventListener("load", popupLoadListener);
};
iframe.addEventListener("load", popupLoadListener, false);
iframe.src = url;
glassPane.className = "visible";
+
+ setTimeout(function()
+ {
+ if (!popupVisible)
+ glassPane.className = "";
+ }, 2000);
Wladimir Palant 2012/10/25 15:32:51 This timeout should be 20 seconds at least, otherw
Felix Dahlke 2012/10/25 15:39:27 You're right, the load event will even arrive even
}
function initSocialLinks(variant)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld