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

Side by Side Diff: Source/core/html/HTMLAnchorElement.cpp

Issue 26506003: Setting host without port should keep old port (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: git rebase Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-host-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Simon Hausmann <hausmann@kde.org> 4 * (C) 2000 Simon Hausmann <hausmann@kde.org>
5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 if (value.isEmpty()) 406 if (value.isEmpty())
407 return; 407 return;
408 KURL url = href(); 408 KURL url = href();
409 if (!url.canSetHostOrPort()) 409 if (!url.canSetHostOrPort())
410 return; 410 return;
411 411
412 size_t separator = value.find(':'); 412 size_t separator = value.find(':');
413 if (!separator) 413 if (!separator)
414 return; 414 return;
415 415
416 if (separator == kNotFound) 416 if (separator == kNotFound) {
417 url.setHostAndPort(value); 417 url.setHost(value);
418 else { 418 } else {
419 unsigned portEnd; 419 unsigned portEnd;
420 unsigned port = parsePortFromStringPosition(value, separator + 1, portEn d); 420 unsigned port = parsePortFromStringPosition(value, separator + 1, portEn d);
421 if (!port) { 421 if (!port) {
422 // http://dev.w3.org/html5/spec/infrastructure.html#url-decompositio n-idl-attributes 422 // http://dev.w3.org/html5/spec/infrastructure.html#url-decompositio n-idl-attributes
423 // specifically goes against RFC 3986 (p3.2) and 423 // specifically goes against RFC 3986 (p3.2) and
424 // requires setting the port to "0" if it is set to empty string. 424 // requires setting the port to "0" if it is set to empty string.
425 url.setHostAndPort(value.substring(0, separator + 1) + "0"); 425 url.setHostAndPort(value.substring(0, separator + 1) + "0");
426 } else { 426 } else {
427 if (isDefaultPortForProtocol(port, url.protocol())) 427 if (isDefaultPortForProtocol(port, url.protocol()))
428 url.setHostAndPort(value.substring(0, separator)); 428 url.setHostAndPort(value.substring(0, separator));
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 844
845 // The precision of current MouseOver trigger is too low to actually trigger preconnects. 845 // The precision of current MouseOver trigger is too low to actually trigger preconnects.
846 if (motivation == WebKit::WebPreconnectMotivationLinkMouseOver) 846 if (motivation == WebKit::WebPreconnectMotivationLinkMouseOver)
847 return; 847 return;
848 848
849 preconnectToURL(url, motivation); 849 preconnectToURL(url, motivation);
850 m_hasIssuedPreconnect = true; 850 m_hasIssuedPreconnect = true;
851 } 851 }
852 852
853 } 853 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-host-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698