Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: ios/web/web_state/js/resources/message_dynamic_ui.js

Issue 1132163007: Invoke JS messaging for UIWebView via window.requestAnimationFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hard code message queue send delay for iforgot.apple.com Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
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: ios/web/web_state/js/resources/message_dynamic_ui.js
diff --git a/ios/web/web_state/js/resources/message_dynamic_ui.js b/ios/web/web_state/js/resources/message_dynamic_ui.js
index d3118141228e161eaf01fabbea36d46c55866598..6d5b1844ff43c4a94041a51f6ccf6174aeb1cd0f 100644
--- a/ios/web/web_state/js/resources/message_dynamic_ui.js
+++ b/ios/web/web_state/js/resources/message_dynamic_ui.js
@@ -20,23 +20,34 @@ new function() {
* @param {Object} queueObject Queue object containing messages to send.
*/
__gCrWeb.message_dynamic.sendQueue = function(queueObject) {
- // The technique requires the document to be present. If it is not, the
- // messages will be sent once the document object is created.
- if (!document || !document.body) {
- // This happens in rare occasions early in the page cycle. It is
- // possible to create a body element indirectly here, but it has side
- // effects such as blocking page redirection. The safest solution is to
- // try again in 1/10th of a second.
- window.setTimeout(__gCrWeb.message.invokeQueues, 100);
- return;
- }
+ var send = function() {
+ // The technique requires the document to be present. If it is not, the
+ // messages will be sent once the document object is created.
+ if (!document || !document.body) {
+ // This happens in rare occasions early in the page cycle. It is
+ // possible to create a body element indirectly here, but it has side
+ // effects such as blocking page redirection. The safest solution is to
+ // try again in 1/10th of a second.
+ window.setTimeout(__gCrWeb.message.invokeQueues, 100);
+ return;
+ }
+
+ var frame = document.createElement('iframe');
+ frame.style.display = 'none';
+ frame.src = queueObject.scheme + '://' + __gCrWeb.windowId + '#' +
+ encodeURIComponent(__gCrWeb.common.JSONStringify(queueObject.queue));
+ queueObject.reset();
+ document.body.appendChild(frame);
+ document.body.removeChild(frame);
+ };
- var frame = document.createElement('iframe');
- frame.style.display = 'none';
- frame.src = queueObject.scheme + '://' + __gCrWeb.windowId + '#' +
- encodeURIComponent(__gCrWeb.common.JSONStringify(queueObject.queue));
- queueObject.reset();
- document.body.appendChild(frame);
- document.body.removeChild(frame);
+ // The Apple mobile password recovery page does not interact well with
+ // iframes, so on pages with the 'iforgot.apple.com' domain, delay sending
+ // the queue.
+ if (window.location.origin === "https://iforgot.apple.com") {
stuartmorgan 2015/05/18 19:57:08 Let's do a bit of combination self-documentation a
Jackie Quinn 2015/05/18 20:36:42 Done.
+ window.setTimeout(send, 150);
+ } else {
+ send();
+ }
};
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698