<?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>149107</bug_id>
          
          <creation_ts>2015-09-13 12:45:50 -0700</creation_ts>
          <short_desc>IndexedDB does not throw ConstraintErrors for unique keys</short_desc>
          <delta_ts>2016-03-21 13:57: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>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.10</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>
          
          <blocked>149117</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Nolan Lawson">nolan</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>beidson</cc>
    
    <cc>info</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1125493</commentid>
    <comment_count>0</comment_count>
      <attachid>261088</attachid>
    <who name="Nolan Lawson">nolan</who>
    <bug_when>2015-09-13 12:45:50 -0700</bug_when>
    <thetext>Created attachment 261088
Reproducible test case

(May be a dup of https://bugs.webkit.org/show_bug.cgi?id=60720, but it was marked as invalid because they didn&apos;t have a good reproducible test case.)

In WebKit Nightly 600.8.9 (as well as Safari 8.0.8), it is possible to put() two documents with the same key, even if that key is defined as a unique index.

I have a reproducible test case to demonstrate: http://bl.ocks.org/nolanlawson/28ff2db3f3cb386c8ecb. The same test is also attached to this bug.

If the bug has been successfully reproduced, then this HTML page will print &quot;There is a bug.&quot; Note that openKeyCursor() also returns the same key twice.

This bug cannot be reproduced in either Firefox or Chrome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1171044</commentid>
    <comment_count>1</comment_count>
    <who name="Dmitry Sorin">info</who>
    <bug_when>2016-03-04 14:24:57 -0800</bug_when>
    <thetext>+1 for this bug. Reproducable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1171053</commentid>
    <comment_count>2</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2016-03-04 14:42:52 -0800</bug_when>
    <thetext>Good thing this is fixed in Modern IDB!

Works great in ToT/WebKit nightly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1171055</commentid>
    <comment_count>3</comment_count>
    <who name="Dmitry Sorin">info</who>
    <bug_when>2016-03-04 14:43:58 -0800</bug_when>
    <thetext>Will Safari9 in OSX 10.11 get this update?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1171058</commentid>
    <comment_count>4</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2016-03-04 14:46:45 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; Will Safari9 in OSX 10.11 get this update?

This is the WebKit open source project.

Safari is an Apple product, and Apple generally does not comment on their future products.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1171062</commentid>
    <comment_count>5</comment_count>
    <who name="Dmitry Sorin">info</who>
    <bug_when>2016-03-04 14:50:53 -0800</bug_when>
    <thetext>Generally !== always, huh? :)
Not in this Safari version, right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1171072</commentid>
    <comment_count>6</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2016-03-04 14:58:20 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; Generally !== always, huh? :)
&gt; Not in this Safari version, right?

I&apos;m not sure what you&apos;re trying to clarify.

This should be working for you in whatever relatively modern Safari version you have + a WebKit nightly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1171082</commentid>
    <comment_count>7</comment_count>
    <who name="Dmitry Sorin">info</who>
    <bug_when>2016-03-04 15:29:48 -0800</bug_when>
    <thetext>Okay, thank you</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1176743</commentid>
    <comment_count>8</comment_count>
    <who name="Nolan Lawson">nolan</who>
    <bug_when>2016-03-21 08:29:57 -0700</bug_when>
    <thetext>Nice to see progress getting made on this! :)

Unfortunately I tested my demo site (http://bl.ocks.org/nolanlawson/28ff2db3f3cb386c8ecb) on WebKit Nightly (10601.5.17.1.1, r195011) and it seems to still be broken. (It says &quot;there is a bug.&quot;) Was this closed too early or is there some other reason the test case is failing?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1176753</commentid>
    <comment_count>9</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2016-03-21 09:30:35 -0700</bug_when>
    <thetext>(In reply to comment #8)
&gt; Was this closed too early or is there some other reason the test
&gt; case is failing?

Unclear. I see the same with the attached test case (but did not on 3/4)
I&apos;ll poke around using the attached test case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1176790</commentid>
    <comment_count>10</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2016-03-21 11:21:43 -0700</bug_when>
    <thetext>Odd.

I reproduced this in the latest WebKit nightly, but it works fine in my local build of ToT.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1176794</commentid>
    <comment_count>11</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2016-03-21 11:27:02 -0700</bug_when>
    <thetext>(In reply to comment #10)
&gt; Odd.
&gt; 
&gt; I reproduced this in the latest WebKit nightly, but it works fine in my
&gt; local build of ToT.

Nope, bonehead - I did *not* reproduce with a WebKit nightly. I was using stock Safari.

So, to clarify - I cannot reproduce this being broken.

In nightly 198484 (http://builds.nightly.webkit.org/files/trunk/mac/WebKit-SVN-r198484.dmg) and a ToT debug build, the attached test case works fine.

----

If you see the text There is a bug, then there&apos;s a bug.

Got a ConstraintError when we tried to put() the same key twice

Found keys: a
Found primaryKeys: 1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1176795</commentid>
    <comment_count>12</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2016-03-21 11:30:37 -0700</bug_when>
    <thetext>(In reply to comment #8)

Oh I see:

&gt; Unfortunately I tested my demo site
&gt; (http://bl.ocks.org/nolanlawson/28ff2db3f3cb386c8ecb) on WebKit Nightly
&gt; (10601.5.17.1.1, r195011) and it seems to still be broken. (It says &quot;there
&gt; is a bug.&quot;) Was this closed too early or is there some other reason the test
&gt; case is failing?

Nightly 195011 is ancient.

January 14th was well before the new engine was enabled in WebKit2, which is what Safari (and therefore WebKit nightlies) uses.

Try with the latest nightly, please.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1176796</commentid>
    <comment_count>13</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2016-03-21 11:32:00 -0700</bug_when>
    <thetext>(In reply to comment #12)
&gt; (In reply to comment #8)
&gt; 
&gt; Oh I see:
&gt; 
&gt; &gt; Unfortunately I tested my demo site
&gt; &gt; (http://bl.ocks.org/nolanlawson/28ff2db3f3cb386c8ecb) on WebKit Nightly
&gt; &gt; (10601.5.17.1.1, r195011) and it seems to still be broken. (It says &quot;there
&gt; &gt; is a bug.&quot;) Was this closed too early or is there some other reason the test
&gt; &gt; case is failing?
&gt; 
&gt; Nightly 195011 is ancient.
&gt; 
&gt; January 14th was well before the new engine was enabled in WebKit2, which is
&gt; what Safari (and therefore WebKit nightlies) uses.
&gt; 
&gt; Try with the latest nightly, please.

For the historical record: Modern IDB wasn&apos;t enabled in WK2 until http://trac.webkit.org/changeset/197122, and there were still some pretty bad bugs with it for another ~1 week after that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1176841</commentid>
    <comment_count>14</comment_count>
    <who name="Nolan Lawson">nolan</who>
    <bug_when>2016-03-21 13:57:41 -0700</bug_when>
    <thetext>My bad! It is indeed fixed. Somehow I got stuck with an old version of WebKit Nightly, but re-downloading worked. :) I&apos;m on r198490.

Also a big thank-you for your work on &quot;modern IDB&quot;! Love seeing all these IDB bugs slowly getting knocked down.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>261088</attachid>
            <date>2015-09-13 12:45:50 -0700</date>
            <delta_ts>2015-09-13 12:45:50 -0700</delta_ts>
            <desc>Reproducible test case</desc>
            <filename>index.html</filename>
            <type>text/html</type>
            <size>1901</size>
            <attacher name="Nolan Lawson">nolan</attacher>
            
              <data encoding="base64">PGJvZHk+CiAgPGgxPiBSZXBybyBXZWJLaXQgSW5kZXhlZERCIHVuaXF1ZSBpbmRleCBidWcgPC9o
MT4KICA8cD5JZiB5b3Ugc2VlIHRoZSB0ZXh0IDxzdHJvbmc+VGhlcmUgaXMgYSBidWc8L3N0cm9u
Zz4sIHRoZW4gdGhlcmUncyBhIGJ1Zy48L3A+CjxkaXYgaWQ9ImxvZ2dlciI+PC9kaXY+CjxzY3Jp
cHQ+Cgp2YXIgZGJuYW1lID0gJ3JhbmRvXycgKyBNYXRoLnJhbmRvbSgpICsgJ18nOwoKZnVuY3Rp
b24gbG9nKG1zZykgewogIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJsb2dnZXIiKS5pbm5lckhU
TUwgKz0gbXNnICsgIjxicj4iOwp9Cgp2YXIgcmVxID0gaW5kZXhlZERCLm9wZW4oZGJuYW1lICsg
IjEiKTsKCnJlcS5vbnVwZ3JhZGVuZWVkZWQgPSBmdW5jdGlvbiAoZSkgewogIHZhciBkYiA9IGUu
dGFyZ2V0LnJlc3VsdDsKCiAgaWYgKGUub2xkVmVyc2lvbiA9PT0gMSkgewogICAgcmV0dXJuOwog
IH0KCiAgZGIuY3JlYXRlT2JqZWN0U3RvcmUoJ3N0b3JlJywge2F1dG9JbmNyZW1lbnQ6IHRydWV9
KS5jcmVhdGVJbmR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G9yZScsICdyZWFkb25seScpOwogICAgICB2YXIga2V5cyA9IFtdOwog
ICAgICB2YXIgcHJpbWFyeUtleXMgPSBbXTsKICAgICAgdHhuLm9iamVjdFN0b3JlKCdzdG9yZScp
LmluZGV4KCdrZXknKS5vcGVuS2V5Q3Vyc29yKCkub25zdWNjZXNzID0gZnVuY3Rpb24gKGUpIHsK
ICAgICAgICB2YXIgY3Vyc29yID0gZS50YXJnZXQucmVzdWx0OwogICAgICAgIGlmICghY3Vyc29y
KSB7CiAgICAgICAgICByZXR1cm47CiAgICAgICAgfQogIAogICAgICAgIGtleXMucHVzaChjdXJz
b3Iua2V5KTsKICAgICAgICBwcmltYXJ5S2V5cy5wdXNoKGN1cnNvci5wcmltYXJ5S2V5KTsKICAK
ICAgICAgICBjdXJzb3IuY29udGludWUoKTsKICAgICAgfTsKICAgICAgdHhuLm9uY29tcGxldGUg
PSBmdW5jdGlvbiAoKSB7CiAgICAgICAgbG9nKCcnKQogICAgICAgIGxvZygnRm91bmQga2V5czog
JyArIGtleXMuam9pbignLCAnKSk7CiAgICAgICAgbG9nKCdGb3VuZCBwcmltYXJ5S2V5czogJyAr
IHByaW1hcnlLZXlzLmpvaW4oJywgJykpOwogICAgICB9OwogICAgfTsKICB9Owp9OwoKPC9zY3Jp
cHQ+CjwvYm9keT4KPC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>