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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>47348</bug_id>
          
          <creation_ts>2010-10-07 07:17:12 -0700</creation_ts>
          <short_desc>Update behaviour of href when document base URI is changed after href attribute has been set</short_desc>
          <delta_ts>2012-11-18 22:58:48 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>98184</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>47665</dependson>
          <blocked>46982</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Steve Block">steveblock</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>ap</cc>
    
    <cc>arv</cc>
    
    <cc>brettw</cc>
    
    <cc>steveblock</cc>
    
    <cc>yael</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>290984</commentid>
    <comment_count>0</comment_count>
    <who name="Steve Block">steveblock</who>
    <bug_when>2010-10-07 07:17:12 -0700</bug_when>
    <thetext>When href attributes are set from JavaScript, the href&apos;s URL is not correctly re-based when the document&apos;s base URL is changed.

The problem is that when an href attribute is set, the href is updated to the absolute URL that is the result of resolving against the current base URL. When the base URL is updated and the href is re-resolved, the result is the same absolute URL. See, for example, HTMLAnchorElement::setSearch().

If the initial href is relative, it should remain relative after the attribute is set, so it can be correctly resolved against the new base URL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>290993</commentid>
    <comment_count>1</comment_count>
      <attachid>70088</attachid>
    <who name="Steve Block">steveblock</who>
    <bug_when>2010-10-07 07:21:30 -0700</bug_when>
    <thetext>Created attachment 70088
Test case</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>292878</commentid>
    <comment_count>2</comment_count>
    <who name="Steve Block">steveblock</who>
    <bug_when>2010-10-12 00:45:40 -0700</bug_when>
    <thetext>If somebody could confirm that this is indeed a bug and that we want to fix it, I&apos;ll provide a patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>292974</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-10-12 09:46:13 -0700</bug_when>
    <thetext>Can you provide a matrix of how other browsers behave on this test?  That will let us figure out what behavior we&apos;d like to adopt.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>293372</commentid>
    <comment_count>4</comment_count>
    <who name="Steve Block">steveblock</who>
    <bug_when>2010-10-13 05:48:10 -0700</bug_when>
    <thetext>I tried this on Chrome, Safari, FF 4 (FF 3 does not support updating the document base) and IE 8.

All pass the first part of the test ...

debug(&quot;Base case, rebase URL without attribute having been set&quot;);
base.href = &quot;http://old_base/&quot;;
a.href = &quot;foo?query&quot;;
shouldBe(&quot;a.href&quot;, &quot;&apos;http://old_base/foo?query&apos;&quot;);
base.href = &quot;http://new_base/&quot;;
shouldBe(&quot;a.href&quot;, &quot;&apos;http://new_base/foo?query&apos;&quot;);

PASS a.href is http://old_base/foo?query
PASS a.href is http://new_base/foo?query

All fail the second part of the test in the same way - the href is not rebased ...

debug(&quot;Rebase URL where search attribute has been set&quot;);
base.href = &quot;http://old_base/&quot;;
a.href = &quot;foo&quot;;
a.search = &quot;query&quot;;
shouldBe(&quot;a.href&quot;, &quot;&apos;http://old_base/foo?query&apos;&quot;);
base.href = &quot;http://new_base/&quot;;
shouldBe(&quot;a.href&quot;, &quot;&apos;http://new_base/foo?query&apos;&quot;);

PASS a.href is http://old_base/foo?query
FAIL a.href should be http://new_base/foo?query, was http://old_base/foo?query

I don&apos;t see anything in the spec - http://dev.w3.org/html5/spec/urls.html - which suggests that setting an attribute should make the href absolute and therefore not subject to changes to the document base URI.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>293453</commentid>
    <comment_count>5</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-10-13 09:32:18 -0700</bug_when>
    <thetext>&gt; I tried this on Chrome, Safari, FF 4 (FF 3 does not support updating the document base) and IE 8.

So, from these results, it looks like all the browsers already behave in the same way?  It sounds like we shouldn&apos;t change anything then.

&gt; I don&apos;t see anything in the spec - http://dev.w3.org/html5/spec/urls.html - which suggests that setting an attribute should make the href absolute and therefore not subject to changes to the document base URI.

That part of the spec needs a lot of love.  Fixing that spec is on my list of thing to do.

It seems like the right thing to here is to land these tests to document our behavior and update the spec to say what all the browsers do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>293455</commentid>
    <comment_count>6</comment_count>
    <who name="Steve Block">steveblock</who>
    <bug_when>2010-10-13 09:35:51 -0700</bug_when>
    <thetext>&gt; So, from these results, it looks like all the browsers already behave in the
&gt; same way?
Correct.

&gt; It seems like the right thing to here is to land these tests to document our
&gt; behavior and update the spec to say what all the browsers do.
OK, will do.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>294058</commentid>
    <comment_count>7</comment_count>
    <who name="Steve Block">steveblock</who>
    <bug_when>2010-10-14 05:17:40 -0700</bug_when>
    <thetext>This bug now tracks updating our behaviour to match the spec, once it&apos;s been fixed.

The current behaviour will be documented through tests added in Bug 47665.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>733732</commentid>
    <comment_count>8</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2012-10-03 08:36:37 -0700</bug_when>
    <thetext>Based on the tests for bug 47665, if a.search is set then the href should be &quot;locked&quot; to the current base. This contradicts comment 4:

debug(&quot;Rebase URL where search attribute has been set&quot;);
base.href = &quot;http://old_base/&quot;;
a.href = &quot;foo&quot;;
a.search = &quot;query&quot;;
shouldBe(&quot;a.href&quot;, &quot;&apos;http://old_base/foo?query&apos;&quot;);
base.href = &quot;http://new_base/&quot;;
shouldBe(&quot;a.href&quot;, &quot;&apos;http://new_base/foo?query&apos;&quot;);

*** This bug has been marked as a duplicate of bug 98184 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>770370</commentid>
    <comment_count>9</comment_count>
    <who name="Steve Block">steveblock</who>
    <bug_when>2012-11-18 22:58:48 -0800</bug_when>
    <thetext>I don&apos;t think there&apos;s a contradiction. The test case attached to the bug tests for the &apos;obvious&apos; behavior, where the URL is re-based whether or not href attributes are set. It is this test case to which the results in #4 refer.

The tests in Bug 47665 were added later, after Adam suggested we keep the existing behavior (where the URL is not re-based if href attributes are set) and add tests to document this.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>70088</attachid>
            <date>2010-10-07 07:21:30 -0700</date>
            <delta_ts>2010-10-07 07:21:30 -0700</delta_ts>
            <desc>Test case</desc>
            <filename>href-attribute-rebase.txt</filename>
            <type>text/plain</type>
            <size>1884</size>
            <attacher name="Steve Block">steveblock</attacher>
            
              <data encoding="base64">SW5kZXg6IExheW91dFRlc3RzL2Zhc3QvZG9tL0hUTUxBbmNob3JFbGVtZW50L3NldC1ocmVmLWF0
dHJpYnV0ZS1yZWJhc2UuaHRtbAo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBMYXlvdXRUZXN0cy9mYXN0L2RvbS9I
VE1MQW5jaG9yRWxlbWVudC9zZXQtaHJlZi1hdHRyaWJ1dGUtcmViYXNlLmh0bWwJKHJldmlzaW9u
IDApCisrKyBMYXlvdXRUZXN0cy9mYXN0L2RvbS9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