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

Unified Diff: third_party/polymer/v1_0/components-chromium/iron-location/iron-location-extracted.js

Issue 1984963002: Roll Polymer elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: third_party/polymer/v1_0/components-chromium/iron-location/iron-location-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/iron-location/iron-location-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-location/iron-location-extracted.js
index 85ea5f375015c960490df908cbf01066b3e73bfa..4f2f1c76d9850a32855347f896afd40085b604f5 100644
--- a/third_party/polymer/v1_0/components-chromium/iron-location/iron-location-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/iron-location/iron-location-extracted.js
@@ -191,10 +191,6 @@
* is clicking on, if we can and should override the resulting full
* page navigation. Returns null otherwise.
*
- * This method is separated away from _globalOnClick for testability,
- * as we can't test that a clicked link should have resulted in navigating
- * away from the test page.
- *
* @param {MouseEvent} event .
* @return {string?} .
*/
@@ -209,19 +205,33 @@
return null;
}
var eventPath = Polymer.dom(event).path;
- var href = null;
+ var anchor = null;
for (var i = 0; i < eventPath.length; i++) {
var element = eventPath[i];
if (element.tagName === 'A' && element.href) {
- href = element.href;
+ anchor = element;
break;
}
}
+
// If there's no link there's nothing to do.
- if (!href) {
- return null;
+ if (!anchor) {
+ return;
}
+ // Target blank is a new tab, don't intercept.
+ if (anchor.target === '_blank') {
+ return;
+ }
+ // If the link is for an existing parent frame, don't intercept.
+ if ((anchor.target === '_top' ||
+ anchor.target === '_parent') &&
+ window.top !== window) {
+ return;
+ }
+
+ var href = anchor.href;
+
// It only makes sense for us to intercept same-origin navigations.
// pushState/replaceState don't work with cross-origin links.
var url;

Powered by Google App Engine
This is Rietveld 408576698