<?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>20701</bug_id>
          
          <creation_ts>2008-09-07 12:10:45 -0700</creation_ts>
          <short_desc>localStorage not working for file:// based URLs or http:// based URLs loaded from localhost</short_desc>
          <delta_ts>2009-06-01 19:11:17 -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>DOM</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>0</everconfirmed>
          <reporter name="William J. Edney">bedney</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>beidson</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>jorlow</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>90421</commentid>
    <comment_count>0</comment_count>
    <who name="William J. Edney">bedney</who>
    <bug_when>2008-09-07 12:10:45 -0700</bug_when>
    <thetext>Folks -

I&apos;ve attached a testcase that shows that localStorage, as its currently implemented, is not working for pages loaded from file:// URLs or from a local web server (i.e. &apos;localhost&apos;).

I filed a comment on this Mozilla bug (comment #9) wherein I note that the HTML5 specification has the concept of a &apos;file://&apos; origin - therefore this feature should work for these kinds of origins too.

No idea why &apos;http://localhost&apos; is failing.

Obviously, the way to run this testcase is to bring the page up, set the value, verify that the value is set, quit your browser, restart and click the button to show the value.

Thanks!!

Cheers,

- Bill</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90422</commentid>
    <comment_count>1</comment_count>
      <attachid>23229</attachid>
    <who name="William J. Edney">bedney</who>
    <bug_when>2008-09-07 12:12:01 -0700</bug_when>
    <thetext>Created attachment 23229
Testcase showing localStorage not working for file:// or http://localhost URLs</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>90423</commentid>
    <comment_count>2</comment_count>
    <who name="William J. Edney">bedney</who>
    <bug_when>2008-09-07 12:13:14 -0700</bug_when>
    <thetext>Forgot to attach the Mozilla bug URL (my comment is #9)

https://bugzilla.mozilla.org/show_bug.cgi?id=422526

Cheers,

- Bill</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123728</commentid>
    <comment_count>3</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-05-31 04:08:09 -0700</bug_when>
    <thetext>As far as I can tell, each file:// url should be its own origin.  Can you please confirm this is correct?

I&apos;ll look into fixing this in the next couple days (or possibly as part of this work: https://bugs.webkit.org/show_bug.cgi?id=25376).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123741</commentid>
    <comment_count>4</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2009-05-31 10:09:52 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; As far as I can tell, each file:// url should be its own origin.  Can you
&gt; please confirm this is correct?

That is incorrect.  All file URLs inhabit the same origin.  Yes, that&apos;s a bit unfortunate.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123747</commentid>
    <comment_count>5</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-05-31 12:18:40 -0700</bug_when>
    <thetext>That is unfortunate.

FYI, this is why I thought it might be per file: https://developer.mozilla.org/En/Same-origin_policy_for_file:_URIs  I guess Mozilla is breaking from the spec?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123750</commentid>
    <comment_count>6</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2009-05-31 13:07:59 -0700</bug_when>
    <thetext>(In reply to comment #5)
&gt; FYI, this is why I thought it might be per file:
&gt; https://developer.mozilla.org/En/Same-origin_policy_for_file:_URIs  I guess
&gt; Mozilla is breaking from the spec?

Many of the browser vendors would like to lock down file URL access more.  Mozilla is experimenting with a tighter security policy.  My understanding is that their experiment is fairly successful.  It might be getting to be time to revisit this issue more broadly.  For this patch, though, we should stick with WebKit&apos;s current security policy.  We can always change it later if and when we revise the access policy for file URLs in general.

(As for what the specs say, they are silent on this point.  More precisely, they say the behavior is implementation-defined.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123912</commentid>
    <comment_count>7</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2009-06-01 19:02:55 -0700</bug_when>
    <thetext>I tried this out on my mac with the nightly build and it all works as expected (including all files sharing the same localStorage namespace).  I don&apos;t think there&apos;s anything left to do here, but I don&apos;t have permissions to close the bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123913</commentid>
    <comment_count>8</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2009-06-01 19:11:17 -0700</bug_when>
    <thetext>Marking as fixed per comment #7.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>23229</attachid>
            <date>2008-09-07 12:12:01 -0700</date>
            <delta_ts>2008-09-07 12:12:01 -0700</delta_ts>
            <desc>Testcase showing localStorage not working for file:// or http://localhost URLs</desc>
            <filename>localstoragetest.html</filename>
            <type>text/html</type>
            <size>408</size>
            <attacher name="William J. Edney">bedney</attacher>
            
              <data encoding="base64">PGh0bWw+Cgk8aGVhZD4KCQoJPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPgoJZnVuY3Rp
b24gc3RvcmVWYWx1ZSgpCgl7CgkJd2luZG93LmxvY2FsU3RvcmFnZS5zZXRJdGVtKCdmb28nLCAn
YmFyJyk7Cgl9OwoJZnVuY3Rpb24gYWxlcnRWYWx1ZSgpCgl7CgkJYWxlcnQod2luZG93LmxvY2Fs
U3RvcmFnZS5nZXRJdGVtKCdmb28nKSk7Cgl9OwoJPC9zY3JpcHQ+CgoJPC9oZWFkPgoJCgk8Ym9k
eT4KCQk8YnV0dG9uIG9uY2xpY2s9InN0b3JlVmFsdWUoKSI+U2F2ZSAnYmFyJyB0byAnZm9vJyBp
biBsb2NhbFN0b3JhZ2UuPC9idXR0b24+CgkJPGJ1dHRvbiBvbmNsaWNrPSJhbGVydFZhbHVlKCki
PkFsZXJ0IHZhbHVlIG9mICdmb28nIGluIGxvY2FsU3RvcmFnZS48L2J1dHRvbj4KCTwvYm9keT4K
CjwvaHRtbD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>