<?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>28262</bug_id>
          
          <creation_ts>2009-08-13 09:33:13 -0700</creation_ts>
          <short_desc>SecurityOrigin::createFromDatabaseIdentifier contains bugs</short_desc>
          <delta_ts>2009-08-13 11:21:43 -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>WebCore Misc.</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>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Steve Block">steveblock</reporter>
          <assigned_to name="Ben Murdoch">benm</assigned_to>
          <cc>andreip</cc>
    
    <cc>eric</cc>
    
    <cc>jorlow</cc>
    
    <cc>steveblock</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>139873</commentid>
    <comment_count>0</comment_count>
    <who name="Steve Block">steveblock</who>
    <bug_when>2009-08-13 09:33:13 -0700</bug_when>
    <thetext>SecurityOrigin::createFromDatabaseIdentifier contains the following two bugs.

Line 286
When testing that the identifier contains at least two separators, the test is reversed. As a result, identifiers with at least two separators are erroneously rejected.
This was introduced in http://trac.webkit.org/changeset/44423.

Test case ...
INPUT:    &quot;http_webkit.org_80&quot;
ACTUAL:   SecurityOrigin(KURL()) (input rejected)
EXPECTED: SecurityOrigin(KURL(&quot;http://webkit.org:80&quot;))

Line 292
When testing that the port is either a valid integer or absent, the logic is incorrect. Instead, the logic tests that the port is a valid integer or present. Hence identifiers where the port is absent are erroneously rejected and those where the port is present but invalid are erroneously accepted.
This was introduced in http://trac.webkit.org/changeset/29386.

Test cases ...
INPUT:    &quot;http_webkit.org_&quot;
ACTUAL:   SecurityOrigin(KURL()) (input rejected)
EXPECTED: SecurityOrigin(KURL(&quot;http://webkit.org:0&quot;))

INPUT:    &quot;http_webkit.org_string&quot;
ACTUAL:   SecurityOrigin(KURL(&quot;http://webkit.org:0&quot;))
EXPECTED: SecurityOrigin(KURL()) (input rejected)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139889</commentid>
    <comment_count>1</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-08-13 09:54:41 -0700</bug_when>
    <thetext>I&apos;ll take a look.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139891</commentid>
    <comment_count>2</comment_count>
      <attachid>34753</attachid>
    <who name="Steve Block">steveblock</who>
    <bug_when>2009-08-13 09:55:16 -0700</bug_when>
    <thetext>Created attachment 34753
Patch 1 for bug 28262

Is there a way to add low-level tests for this kind of functionality?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139897</commentid>
    <comment_count>3</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-08-13 10:04:11 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; Created an attachment (id=34753) [details]
&gt; Patch 1 for bug 28262
&gt; 
&gt; Is there a way to add low-level tests for this kind of functionality?

Not really.  And, in fact, I created a bug suggesting that we do find a way.  This class seems trivial to unittests, but ther&apos;es no framework at the moment.  (Only LayoutTests.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139905</commentid>
    <comment_count>4</comment_count>
      <attachid>34753</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-08-13 10:11:59 -0700</bug_when>
    <thetext>Comment on attachment 34753
Patch 1 for bug 28262

The best way to make tests for this is to figure out what actual effect the bugs would have. It&apos;s OK to have them not tested if there&apos;s no obvious way to do so. Building a lower level unit test machinery would allow testing things like this, but would have other costs that may not be acceptable.

Find to just land this as-is. r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139908</commentid>
    <comment_count>5</comment_count>
    <who name="Steve Block">steveblock</who>
    <bug_when>2009-08-13 10:15:59 -0700</bug_when>
    <thetext>Assigning to benm for landing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139942</commentid>
    <comment_count>6</comment_count>
      <attachid>34753</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-08-13 11:21:39 -0700</bug_when>
    <thetext>Comment on attachment 34753
Patch 1 for bug 28262

Clearing flags on attachment: 34753

Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebCore/ChangeLog
	M	WebCore/page/SecurityOrigin.cpp
Committed r47221
	M	WebCore/ChangeLog
	M	WebCore/page/SecurityOrigin.cpp
r47221 = ce243898041701dab28e73a78b800546022b62dc (trunk)
No changes between current HEAD and refs/remotes/trunk
Resetting to the latest refs/remotes/trunk
http://trac.webkit.org/changeset/47221</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>139943</commentid>
    <comment_count>7</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-08-13 11:21:43 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>34753</attachid>
            <date>2009-08-13 09:55:16 -0700</date>
            <delta_ts>2009-08-13 11:21:39 -0700</delta_ts>
            <desc>Patch 1 for bug 28262</desc>
            <filename>fixSecurityOriginBug.txt</filename>
            <type>text/plain</type>
            <size>1922</size>
            <attacher name="Steve Block">steveblock</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT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