<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23535</bug_id>
          
          <creation_ts>2013-10-16 18:47:18 +0000</creation_ts>
          <short_desc>Should setting port to &apos;&apos;  remove the port</short_desc>
          <delta_ts>2014-01-08 17:33:56 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>URL</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Erik Arvidsson">erik.arvidsson</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>mike</cc>
          
          <qa_contact>sideshowbarker+urlspec</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94853</commentid>
    <comment_count>0</comment_count>
    <who name="Erik Arvidsson">erik.arvidsson</who>
    <bug_when>2013-10-16 18:47:18 +0000</bug_when>
    <thetext>The spec says that url.port = &apos;&apos; should remove the port but this does not match browsers:

Gecko:  Keeps the current port
Presto: Keeps the current port
WebKit: Sets the port to 0
Blink:  Sets the port to 0
IE:     Sets the port to 0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94854</commentid>
    <comment_count>1</comment_count>
    <who name="Erik Arvidsson">erik.arvidsson</who>
    <bug_when>2013-10-16 19:30:37 +0000</bug_when>
    <thetext>Also, location.port is also not consistent.

location.port = &apos;&apos;

Gecko: Throws
Presto: Noop
Trident: Sets port to 0 and navigates to it. Actually loads port 80
Blink: Removes the port and navigates
WebKit: Removes the port and navigates

location.port = 0

Gecko: Throws
Presto: Noop
Trident: Sets port to 0 and navigates to it. Actually loads port 80
Blink: Sets port to 0 and navigates. Navigation fails of port 0
WebKit: Noop</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95290</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-10-24 10:38:13 +0000</bug_when>
    <thetext>So normally empty string means the same as the default port:

  http://test:/ -&gt; http://test/

but it seems that the port setter needs a special case. I prefer the Blink behavior for the special case as it is consistent across objects. (Assuming it would actually succeed loading if I have something hosted on port 0.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95292</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-10-24 10:50:10 +0000</bug_when>
    <thetext>https://github.com/whatwg/url/commit/53dae545e386f26208b8038de55a918ffe421ac8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97663</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-12-16 14:28:04 +0000</bug_when>
    <thetext>So bz pointed out that what everyone does here is not very useful and that having &quot;&quot; string mean the default port (ie removing the port) is more useful. Reading comment 1 again it seems that is what Blink/WebKit do for location.port today. So maybe the specification was not that bad here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97664</commentid>
    <comment_count>5</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-12-16 14:37:19 +0000</bug_when>
    <thetext>&gt; Assuming it would actually succeed loading if I have something hosted on port 0

It wouldn&apos;t, since 0 is not a valid port number for any of the protocols we care about.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98068</commentid>
    <comment_count>6</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-07 11:19:57 +0000</bug_when>
    <thetext>In https://bugzilla.mozilla.org/show_bug.cgi?id=930450 Gecko decided that the empty string should not be special cased (it will result in .port === &quot;&quot;).

To match that I should remove step 2 in the setting algorithm here: http://url.spec.whatwg.org/#dom-url-port</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98137</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-08 17:33:56 +0000</bug_when>
    <thetext>https://github.com/whatwg/url/commit/def2ff3b3881fa9f4cf8ee2b6d622a9c5209c0c3</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>