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

Unified Diff: composer.postload.js

Issue 29436567: Issue 3200 - Delay initialization for prerendered documents (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Address comments to Patch Set 2 Created May 19, 2017, 11:57 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 | include.preload.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: composer.postload.js
===================================================================
--- a/composer.postload.js
+++ b/composer.postload.js
@@ -577,10 +577,26 @@
}
});
}
break;
}
});
if (window == window.top)
- ext.backgroundPage.sendMessage({type: "composer.ready"});
+ {
+ if (document.visibilityState == "prerender")
Sebastian Noack 2017/05/20 11:19:06 Note that the visibility API doesn't exists before
Manish Jethani 2017/05/20 19:01:06 Yes, then visibilityState should just be undefined
Sebastian Noack 2017/05/21 20:31:01 Yeah, I supposed so. Thanks for confirming my assu
Manish Jethani 2017/08/24 14:07:57 Done.
+ {
+ let onVisibilitychange = function()
+ {
+ document.removeEventListener("visibilitychange", onVisibilitychange);
+
Sebastian Noack 2017/05/21 20:31:01 Nit: The blank line here looks weird.
Manish Jethani 2017/08/24 14:07:57 Acknowledged.
+ ext.backgroundPage.sendMessage({type: "composer.ready"});
+ };
+
+ document.addEventListener("visibilitychange", onVisibilitychange);
+ }
+ else
+ {
+ ext.backgroundPage.sendMessage({type: "composer.ready"});
+ }
+ }
}
« no previous file with comments | « no previous file | include.preload.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld