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: Delay composer.ready until document is visible Created May 12, 2017, 1:30 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') | safari/ext/background.js » ('J')
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,24 @@
}
});
}
break;
}
});
if (window == window.top)
- ext.backgroundPage.sendMessage({type: "composer.ready"});
+ {
+ if (document.visibilityState == "prerender")
+ {
+ document.addEventListener("visibilitychange", function onVisibilitychange()
kzar 2017/05/19 12:33:05 Nit: Long line. Also it's kind of unusual how you
Manish Jethani 2017/05/19 23:58:48 Sure, I wasn't sure what the preferred style was.
+ {
+ document.removeEventListener("visibilitychange", onVisibilitychange);
+
+ ext.backgroundPage.sendMessage({type: "composer.ready"});
+ });
+ }
+ else
+ {
+ ext.backgroundPage.sendMessage({type: "composer.ready"});
+ }
+ }
}
« no previous file with comments | « no previous file | include.preload.js » ('j') | safari/ext/background.js » ('J')

Powered by Google App Engine
This is Rietveld