<?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>26180</bug_id>
          
          <creation_ts>2009-06-03 19:19:51 -0700</creation_ts>
          <short_desc>If &quot;otherOrigin == this&quot; in SecurityOrigin::equal, it&apos;s obviously equal.</short_desc>
          <delta_ts>2009-06-04 11:45:11 -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>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>124264</commentid>
    <comment_count>0</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-06-03 19:19:51 -0700</bug_when>
    <thetext>If &quot;otherOrigin == this&quot; in SecurityOrigin::equal, it&apos;s obviously equal.

From http://lists.macosforge.org/pipermail/webkit-dev/2009-June/008038.html

&gt; SecurityOrigin was created to cleanup the way we do same-origin checks in
&gt; the JavaScript bindings, and as such, carry some of that baggage (eg. domain
&gt; relaxing).  The main design constraint then was that it was a cheap compare
&gt; for two origins representing the same document (pointer compare) as that is
&gt; common case.  The code evolved from there.

Makes sense.  Note that SecurityOrigin::equal does not currently do a fast
path check of &quot;this == other&quot; (to just do a pointer compare as you
mentioned) so this is probably low hanging fruit to make things a bit
faster.  (Though, as you said, it&apos;s not showing up on current profiles...so
it&apos;s probably not a huge deal.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124266</commentid>
    <comment_count>1</comment_count>
      <attachid>30937</attachid>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-06-03 19:27:42 -0700</bug_when>
    <thetext>Created attachment 30937
A fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124267</commentid>
    <comment_count>2</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2009-06-03 19:42:29 -0700</bug_when>
    <thetext>Wouldn&apos;t it makes more sense to do this in isSameSchemeHostPort?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124270</commentid>
    <comment_count>3</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-06-03 20:23:38 -0700</bug_when>
    <thetext>I don&apos;t think so.  I only see isSameSchemeHostPort used a couple places, but they don&apos;t seem like they&apos;d benefit from such an optimization [1].  ::equal, on the other hand, is called pretty often (it&apos;s used a lot in hash tables).  It seems a bit painful to require another function call plus a branch or two for a function that&apos;s not called very often.

We could put the == check in both places.  Doing one additional branch isn&apos;t going to hurt the slow path.  It doesn&apos;t seem necessary though.

[1] http://www.google.com/codesearch?hl=en&amp;q=isSameSchemeHostPort+package%3A%22git%3A%2F%2Fandroid.git.kernel.org%2Fplatform%2Fexternal%2Fwebkit.git%22</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124314</commentid>
    <comment_count>4</comment_count>
      <attachid>30937</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-06-04 09:18:59 -0700</bug_when>
    <thetext>Comment on attachment 30937
A fix.

Seems fine. r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124340</commentid>
    <comment_count>5</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-06-04 11:10:54 -0700</bug_when>
    <thetext>Assign for landing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124344</commentid>
    <comment_count>6</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-06-04 11:34:50 -0700</bug_when>
    <thetext>Landed in @r44420.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>30937</attachid>
            <date>2009-06-03 19:27:42 -0700</date>
            <delta_ts>2009-06-04 09:18:59 -0700</delta_ts>
            <desc>A fix.</desc>
            <filename>fast_path.patch</filename>
            <type>text/plain</type>
            <size>1170</size>
            <attacher name="Jeremy Orlow">jorlow</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA0NDQwNikKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTUgQEAKKzIwMDktMDYtMDMgIEplcmVteSBPcmxvdyAgPGpvcmxvd0BjaHJvbWl1
bS5vcmc+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAg
aHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTI2MTgwCisgICAgICAgIEFk
ZCBhIGZhc3QgcGF0aCBmb3IgU2VjdXJpdHlPcmlnaW46OmVxdWFsLiBJZiAib3RoZXIgPT0gdGhp
cyIgKHdoZXJlCisgICAgICAgIG90aGVyIGlzIHRoZSBvdGhlciBzZWN1cml0eSBvcmlnaW4pLCB0
aGVuIHdlIHJlYWxseSBkb24ndCBuZWVkIHRvIGRvCisgICAgICAgIGFsbCB0aGUgb3RoZXIgKGV4
cGVuc2l2ZSkgY29tcGFyaXNvbnMuIFdlIGtub3cgaXQncyBlcXVhbC4KKworICAgICAgICAqIHBh
Z2UvU2VjdXJpdHlPcmlnaW4uY3BwOgorICAgICAgICAoV2ViQ29yZTo6U2VjdXJpdHlPcmlnaW46
OmVxdWFsKToKKwogMjAwOS0wNi0wMyAgRGFuIEJlcm5zdGVpbiAgPG1pdHpAYXBwbGUuY29tPgog
CiAgICAgICAgIC0gV2luZG93cyBidWlsZCBmaXgKSW5kZXg6IFdlYkNvcmUvcGFnZS9TZWN1cml0
eU9yaWdpbi5jcHAKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PQotLS0gV2ViQ29yZS9wYWdlL1NlY3VyaXR5T3JpZ2luLmNw
cAkocmV2aXNpb24gNDQ0MDUpCisrKyBXZWJDb3JlL3BhZ2UvU2VjdXJpdHlPcmlnaW4uY3BwCSh3
b3JraW5nIGNvcHkpCkBAIC0yNzcsNiArMjc3LDkgQEAgU3RyaW5nIFNlY3VyaXR5T3JpZ2luOjpk
YXRhYmFzZUlkZW50aWZpZQogCiBib29sIFNlY3VyaXR5T3JpZ2luOjplcXVhbChjb25zdCBTZWN1
cml0eU9yaWdpbiogb3RoZXIpIGNvbnN0IAogeworICAgIGlmIChvdGhlciA9PSB0aGlzKQorICAg
ICAgICByZXR1cm4gdHJ1ZTsKKyAgICAKICAgICBpZiAoIWlzU2FtZVNjaGVtZUhvc3RQb3J0KG90
aGVyKSkKICAgICAgICAgcmV0dXJuIGZhbHNlOwog
</data>
<flag name="review"
          id="15728"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>