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

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

Issue 2669303004: Removed externalRequest code from CRWWebController. (Closed)
Patch Set: Removed kWindowNameSeparator Created 3 years, 10 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 | « ios/chrome/browser/web/window_open_by_dom_egtest.mm ('k') | ios/web/web_state/ui/crw_web_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2d6b86c2a8ccec2b9a4e9ca7aafb04c29a515854..d383609286b1f98658b18a75051996653552ea37 100644
--- a/ios/web/web_state/js/resources/core.js
+++ b/ios/web/web_state/js/resources/core.js
@@ -547,44 +547,6 @@ goog.require('__crWeb.message');
return hasFrame_(window, node.target);
};
- var getTargetLink_ = function(target) {
- var node = target;
- // Find the closest ancester that is a link.
- while (node) {
- if (node instanceof HTMLAnchorElement)
- break;
- node = node.parentNode;
- }
- return node;
- };
-
- var setExternalRequest_ = function(href, target) {
- if (typeof(target) == 'undefined' || target == '_blank' || target == '') {
- target = '' + Date.now() + '-' + Math.random();
- }
- if (typeof(href) == 'undefined') {
- // W3C recommended behavior.
- href = 'about:blank';
- }
- invokeOnHost_({'command': 'externalRequest',
- 'href': href,
- 'target': target,
- 'referrerPolicy': getReferrerPolicy_()});
- };
-
- var resetExternalRequest_ = function() {
- invokeOnHost_({'command': 'resetExternalRequest'});
- };
-
- var clickBubbleListener_ = function(evt) {
- if (evt['defaultPrevented']) {
- resetExternalRequest_();
- }
- // Remove the listener.
- evt.currentTarget.removeEventListener(
- 'click', clickBubbleListener_, false);
- };
-
var getComputedWebkitTouchCallout_ = function(element) {
return window.getComputedStyle(element, null)['webkitTouchCallout'];
};
@@ -594,51 +556,6 @@ goog.require('__crWeb.message');
__gCrWeb.message.invokeQueues();
}
- document.addEventListener('click', function(evt) {
- var node = getTargetLink_(evt.target);
-
- if (!node)
- return;
-
- if (isInternaLink_(node)) {
- return;
- }
- setExternalRequest_(node.href, node.target);
- // Add listener to the target and its immediate ancesters. These event
- // listeners will be removed if they get called. The listeners for some
- // elements might never be removed, but if multiple identical event
- // listeners are registered on the same event target with the same
- // parameters the duplicate instances are discarded.
- for (var level = 0; level < 5; ++level) {
- if (node && node != document) {
- node.addEventListener('click', clickBubbleListener_, false);
- node = node.parentNode;
- } else {
- break;
- }
- }
- }, true);
-
- // Intercept clicks on anchors (links) during bubbling phase so that the
- // browser can handle target type appropriately.
- document.addEventListener('click', function(evt) {
- var node = getTargetLink_(evt.target);
-
- if (!node)
- return;
-
- if (isInternaLink_(node)) {
- return;
- } else {
- // Resets the external request if it has been canceled, otherwise
- // updates the href in case it has been changed.
- if (evt['defaultPrevented'])
- resetExternalRequest_();
- else
- setExternalRequest_(node.href, node.target);
- }
- }, false);
-
// Capture form submit actions.
document.addEventListener('submit', function(evt) {
if (evt['defaultPrevented'])
« no previous file with comments | « ios/chrome/browser/web/window_open_by_dom_egtest.mm ('k') | ios/web/web_state/ui/crw_web_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698