Index: ios/web/web_state/js/resources/core.js |
diff --git a/ios/web/web_state/js/resources/core.js b/ios/web/web_state/js/resources/core.js |
index 3ceb27f234b277ee69979d42a8a05d05d0a7907d..42fd71be2e0c66a3c0e77a568625a26402108852 100644 |
--- a/ios/web/web_state/js/resources/core.js |
+++ b/ios/web/web_state/js/resources/core.js |
@@ -339,10 +339,6 @@ goog.require('__crWeb.message'); |
__gCrWeb.message.invokeOnHost(command); |
}; |
- function invokeOnHostImmediate_(command) { |
- __gCrWeb.message.invokeOnHostImmediate(command); |
- }; |
- |
/** |
* Gets the referrer policy to use for navigations away from the current page. |
* If a link element is passed, and it includes a rel=noreferrer tag, that |
@@ -546,6 +542,10 @@ goog.require('__crWeb.message'); |
}; |
var setExternalRequest_ = function(href, target) { |
+ // If there is no document or body, the request will be silently dropped |
Eugene But (OOO till 7-30)
2016/09/20 22:05:14
Do you even need this comment? It simply repeats t
|
+ // here. |
+ if (!document || !document.body) |
+ return; |
if (typeof(target) == 'undefined' || target == '_blank' || target == '') { |
target = '' + Date.now() + '-' + Math.random(); |
} |
@@ -553,15 +553,10 @@ goog.require('__crWeb.message'); |
// W3C recommended behavior. |
href = 'about:blank'; |
} |
- // ExternalRequest messages need to be handled before the expected |
- // shouldStartLoadWithRequest, as such we cannot wait for the regular |
- // message queue invoke which delays to avoid illegal recursion into |
- // UIWebView. This immediate class of messages is handled ASAP by |
- // CRWWebController. |
- invokeOnHostImmediate_({'command': 'externalRequest', |
- 'href': href, |
- 'target': target, |
- 'referrerPolicy': getReferrerPolicy_()}); |
+ invokeOnHost_({'command': 'externalRequest', |
+ 'href': href, |
+ 'target': target, |
+ 'referrerPolicy': getReferrerPolicy_()}); |
}; |
var resetExternalRequest_ = function() { |