<?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>26154</bug_id>
          
          <creation_ts>2009-06-02 23:27:20 -0700</creation_ts>
          <short_desc>SecurityOrigin::createFromDatabaseIdentifier should handle _&apos;s in the hostname</short_desc>
          <delta_ts>2009-06-04 12:29:41 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jeremy Orlow">jorlow</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>124104</commentid>
    <comment_count>0</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-06-02 23:27:20 -0700</bug_when>
    <thetext>As Adam Barth mentioned:
&gt; There are a bunch of problems with
&gt; SecurityOrigin::databaseIdentifier(), not the least of which is that
&gt; &quot;_&quot; can&apos;t really be used as a delimiter because some intranet host
&gt; names contain the character in their names.  I&apos;d rather we didn&apos;t used
&gt; databaseIdentifier() and had a single string representation we used
&gt; everywhere.

It seems like a good first step towards a fix is to search for only the first and the last _ and assume everything in between is the host name.  This would choke on any protocols/schemes with an underscore in it, but the old code would have as well, and it&apos;s not clear to me how to handle this gracefully.

The original thread:
http://lists.macosforge.org/pipermail/webkit-dev/2009-June/008038.html
http://lists.macosforge.org/pipermail/webkit-dev/2009-June/008043.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124105</commentid>
    <comment_count>1</comment_count>
      <attachid>30891</attachid>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-06-02 23:33:45 -0700</bug_when>
    <thetext>Created attachment 30891
A potential fix.

This is the fix I proposed in the thread, but I have no idea how to create a test for it.  Any ideas?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124153</commentid>
    <comment_count>2</comment_count>
      <attachid>30891</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-06-03 09:05:10 -0700</bug_when>
    <thetext>Comment on attachment 30891
A potential fix.

&gt; +        WARNING: NO TEST CASES ADDED OR CHANGED

This is something you&apos;re supposed to delete if you either add a test case or decide you can&apos;t add one. You shouldn&apos;t submit patches with this in them. We don&apos;t want to check this warning into the change log!

&gt; +    // Ensure there were at least 2 seperator characters.  Some hostnames on intranets have
&gt; +    // underscores in them, so we&apos;ll assume that any additional underscores are part of the host.

Typo in this comment (&quot;seperator&quot;). Also, we use only one space after periods in our comments.

Seems OK to land this without a test. To make a test we&apos;d have to change run-webkit-tests to set up the Apache server to run with a hostname that had an underscore in it. Not impossible, but perhaps difficult.

It would also be good to have tests for the existing behavior, for example, illegal database identifiers that fall into the failure case.

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124162</commentid>
    <comment_count>3</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-06-03 10:04:28 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 30891 [review])
&gt; &gt; +        WARNING: NO TEST CASES ADDED OR CHANGED
&gt; 
&gt; This is something you&apos;re supposed to delete if you either add a test case or
&gt; decide you can&apos;t add one. You shouldn&apos;t submit patches with this in them. We
&gt; don&apos;t want to check this warning into the change log!

I left that in as a warning to my reviewer.  I assumed it&apos;d be taken out by whomever checked it in.
 
&gt; &gt; +    // Ensure there were at least 2 seperator characters.  Some hostnames on intranets have
&gt; &gt; +    // underscores in them, so we&apos;ll assume that any additional underscores are part of the host.
&gt; 
&gt; Typo in this comment (&quot;seperator&quot;). Also, we use only one space after periods
&gt; in our comments.

Ugh.  That&apos;s going to take some getting used to.  :-)

&gt; Seems OK to land this without a test. To make a test we&apos;d have to change
&gt; run-webkit-tests to set up the Apache server to run with a hostname that had an
&gt; underscore in it. Not impossible, but perhaps difficult.
&gt; 
&gt; It would also be good to have tests for the existing behavior, for example,
&gt; illegal database identifiers that fall into the failure case.

It does seem like a pain to test.  Now that I think about it, even if I wrote a LayoutTest, there&apos;s really no good way to verify the output beyond it not crashing.  It&apos;s really too bad there&apos;s no way to write unittests in WebKit since this is basically a perfect example of what they&apos;re really useful for.  

Anyway, would you like me to fix the ChangeLog + 2 spaces issue and send another patch, or did you + it since a committer can easily do that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124199</commentid>
    <comment_count>4</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-06-03 12:27:10 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; &gt; +        WARNING: NO TEST CASES ADDED OR CHANGED
&gt; &gt; 
&gt; &gt; This is something you&apos;re supposed to delete if you either add a test case or
&gt; &gt; decide you can&apos;t add one. You shouldn&apos;t submit patches with this in them. We
&gt; &gt; don&apos;t want to check this warning into the change log!
&gt; 
&gt; I left that in as a warning to my reviewer.  I assumed it&apos;d be taken out by
&gt; whomever checked it in.

OK. That&apos;s not how it is supposed to work. The only thing a committer should have to do is add the name of the reviewer and update the date.

&gt; &gt; &gt; +    // Ensure there were at least 2 seperator characters.  Some hostnames on intranets have
&gt; &gt; &gt; +    // underscores in them, so we&apos;ll assume that any additional underscores are part of the host.
&gt; &gt; 
&gt; &gt; Typo in this comment (&quot;seperator&quot;). Also, we use only one space after periods
&gt; &gt; in our comments.
&gt; 
&gt; Ugh.  That&apos;s going to take some getting used to.  :-)

Join the debate!

http://en.wikipedia.org/wiki/French_spacing
http://www.chicagomanualofstyle.org/CMS_FAQ/OneSpaceorTwo/OneSpaceorTwo02.html
http://www.webword.com/reports/period.html
http://en.wikipedia.org/wiki/Wikipedia_talk:Manual_of_Style_archive_(spaces_after_a_full_stop/period)

&gt; &gt; Seems OK to land this without a test. To make a test we&apos;d have to change
&gt; &gt; run-webkit-tests to set up the Apache server to run with a hostname that had an
&gt; &gt; underscore in it. Not impossible, but perhaps difficult.
&gt; &gt; 
&gt; &gt; It would also be good to have tests for the existing behavior, for example,
&gt; &gt; illegal database identifiers that fall into the failure case.
&gt; 
&gt; It&apos;s really too bad there&apos;s no way to write unittests in WebKit
&gt; since this is basically a perfect example of what they&apos;re really useful for.  

There&apos;s no reason for you to settle for the status quo. Everything about our testing infrastructure was created by someone at one point to solve a problem like the one you just mentioned. You could be the person who made this possible. Exposing some particular function to JavaScript is all it takes to make a particular unit test in our existing framework; that has been done many times. There&apos;s an experimental feature in the Mac DumpRenderTree that lets JavaScript call any Objective-C method, too. You could invent a new approach. Maybe you could bring unit tests as you know them from other projects to this project.

Please don&apos;t assume that someone else is going to fix this!

&gt; Anyway, would you like me to fix the ChangeLog + 2 spaces issue and send
&gt; another patch, or did you + it since a committer can easily do that?

It&apos;d be kind for you to do that. Really depends on the committer how they feel about doing such minor chores.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124202</commentid>
    <comment_count>5</comment_count>
      <attachid>30921</attachid>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-06-03 13:00:12 -0700</bug_when>
    <thetext>Created attachment 30921
Fixed spacing in comment + ChangeLog issues

(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; It&apos;s really too bad there&apos;s no way to write unittests in WebKit
&gt; &gt; since this is basically a perfect example of what they&apos;re really useful for.  
&gt; 
&gt; There&apos;s no reason for you to settle for the status quo. Everything about our
&gt; testing infrastructure was created by someone at one point to solve a problem
&gt; like the one you just mentioned. You could be the person who made this
&gt; possible. Exposing some particular function to JavaScript is all it takes to
&gt; make a particular unit test in our existing framework; that has been done many
&gt; times. There&apos;s an experimental feature in the Mac DumpRenderTree that lets
&gt; JavaScript call any Objective-C method, too. You could invent a new approach.
&gt; Maybe you could bring unit tests as you know them from other projects to this
&gt; project.
&gt; 
&gt; Please don&apos;t assume that someone else is going to fix this!

Created https://bugs.webkit.org/show_bug.cgi?id=26171

&gt; &gt; Anyway, would you like me to fix the ChangeLog + 2 spaces issue and send
&gt; &gt; another patch, or did you + it since a committer can easily do that?
&gt; 
&gt; It&apos;d be kind for you to do that. Really depends on the committer how they feel
&gt; about doing such minor chores.

Done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124210</commentid>
    <comment_count>6</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-06-03 13:50:32 -0700</bug_when>
    <thetext>Interesting.  I can&apos;t set the review flag on my updated patch.  Is that because it already has a +?

Anyhow, I think it&apos;s ready to commit.  Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124214</commentid>
    <comment_count>7</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-06-03 14:23:08 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; Interesting.  I can&apos;t set the review flag on my updated patch.  Is that because
&gt; it already has a +?

I don&apos;t know why.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124349</commentid>
    <comment_count>8</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-06-04 11:46:26 -0700</bug_when>
    <thetext>Assign for landing.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>30891</attachid>
            <date>2009-06-02 23:33:45 -0700</date>
            <delta_ts>2009-06-03 13:00:12 -0700</delta_ts>
            <desc>A potential fix.</desc>
            <filename>parse.patch</filename>
            <type>text/plain</type>
            <size>1759</size>
            <attacher name="Jeremy Orlow">jorlow</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA0NDM3OSkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTYgQEAKKzIwMDktMDYtMDIgIEplcmVteSBPcmxvdyAgPGpvcmxvd0BjaHJvbWl1
bS5vcmc+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAg
V0FSTklORzogTk8gVEVTVCBDQVNFUyBBRERFRCBPUiBDSEFOR0VECisKKyAgICAgICAgaHR0cHM6
Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTI2MTU0CisgICAgICAgIEFsbG93IHVu
ZGVyc2NvcmVzIGluIHRoZSBob3N0bmFtZXMgd2UgcGFyc2Ugb3V0IG9mIGRhdGFiYXNlSWRlbnRp
ZmllcnMuCisgICAgICAgIFRoaXMgY29kZSBpcyB1c2VkIGZvciBIVE1MIDUgZGF0YWJhc2Ugc3Vw
cG9ydC4KKworICAgICAgICAqIHBhZ2UvU2VjdXJpdHlPcmlnaW4uY3BwOgorICAgICAgICAoV2Vi
Q29yZTo6U2VjdXJpdHlPcmlnaW46OmNyZWF0ZUZyb21EYXRhYmFzZUlkZW50aWZpZXIpOgorCiAy
MDA5LTA2LTAyICBEYXJpbiBBZGxlciAgPGRhcmluQGFwcGxlLmNvbT4KIAogICAgICAgICBSZXZp
ZXdlZCBieSBEYXZpZCBIeWF0dC4KSW5kZXg6IFdlYkNvcmUvcGFnZS9TZWN1cml0eU9yaWdpbi5j
cHAKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09P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cmVzIGFyZSBwYXJ0IG9m
IHRoZSBob3N0LgorICAgIGlmIChzZXBhcmF0b3IxICE9IHNlcGFyYXRvcjIpCiAgICAgICAgIHJl
dHVybiBjcmVhdGUoS1VSTCgpKTsKICAgICAgICAgCiAgICAgLy8gTWFrZSBzdXJlIHRoZSBwb3J0
IHNlY3Rpb24gaXMgYSB2YWxpZCBwb3J0IG51bWJlciBvciBkb2Vzbid0IGV4aXN0Cg==
</data>
<flag name="review"
          id="15694"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>30921</attachid>
            <date>2009-06-03 13:00:12 -0700</date>
            <delta_ts>2009-06-03 14:22:57 -0700</delta_ts>
            <desc>Fixed spacing in comment + ChangeLog issues</desc>
            <filename>parse.patch</filename>
            <type>text/plain</type>
            <size>1707</size>
            <attacher name="Jeremy Orlow">jorlow</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA0NDM3OSkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTQgQEAKKzIwMDktMDYtMDIgIEplcmVteSBPcmxvdyAgPGpvcmxvd0BjaHJvbWl1
bS5vcmc+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAg
aHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTI2MTU0CisgICAgICAgIEFs
bG93IHVuZGVyc2NvcmVzIGluIHRoZSBob3N0bmFtZXMgd2UgcGFyc2Ugb3V0IG9mIGRhdGFiYXNl
SWRlbnRpZmllcnMuCisgICAgICAgIFRoaXMg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AgICAgIAotICAgIC8vIE1ha2Ug
c3VyZSB0aGVyZSdzIG5vdCBhIHRoaXJkIHNlcGFyYXRvcgotICAgIGlmIChkYXRhYmFzZUlkZW50
aWZpZXIucmV2ZXJzZUZpbmQoU2VwYXJhdG9yQ2hhcmFjdGVyKSAhPSBzZXBhcmF0b3IyKQorICAg
IC8vIEVuc3VyZSB0aGVyZSB3ZXJlIGF0IGxlYXN0IDIgc2VwZXJhdG9yIGNoYXJhY3RlcnMuIFNv
bWUgaG9zdG5hbWVzIG9uIGludHJhbmV0cyBoYXZlCisgICAgLy8gdW5kZXJzY29yZXMgaW4gdGhl
bSwgc28gd2UnbGwgYXNzdW1lIHRoYXQgYW55IGFkZGl0aW9uYWwgdW5kZXJzY29yZXMgYXJlIHBh
cnQgb2YgdGhlIGhvc3QuCisgICAgaWYgKHNlcGFyYXRvcjEgIT0gc2VwYXJhdG9yMikKICAgICAg
ICAgcmV0dXJuIGNyZWF0ZShLVVJMKCkpOwogICAgICAgICAKICAgICAvLyBNYWtlIHN1cmUgdGhl
IHBvcnQgc2VjdGlvbiBpcyBhIHZhbGlkIHBvcnQgbnVtYmVyIG9yIGRvZXNuJ3QgZXhpc3QK
</data>
<flag name="review"
          id="15717"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>