<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>15864</bug_id>
          
          <creation_ts>2012-02-03 12:39:06 +0000</creation_ts>
          <short_desc>[IndexedDB] Array as key, avoid array loops</short_desc>
          <delta_ts>2012-03-02 16:25:19 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>Indexed Database API</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</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="Odin Hørthe Omdal">odinho</reporter>
          <assigned_to name="Eliot Graff">eliotgra</assigned_to>
          <cc>eliotgra</cc>
    
    <cc>jonas</cc>
    
    <cc>jsbell</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>63635</commentid>
    <comment_count>0</comment_count>
    <who name="Odin Hørthe Omdal">odinho</who>
    <bug_when>2012-02-03 12:39:06 +0000</bug_when>
    <thetext>&gt; Note that Arrays that contain other Arrays are allowed as valid keys.
&gt; In this case the algorithm above runs recursively when comparing the
&gt; individual values in the arrays.
http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#key-construct

Using an array embedding itself makes a loop, the spec doesn&apos;t clarify how to deal with that.

var a = [];
a[0] = a;

I guess you wouldn&apos;t want to /recurse/ two of those to find which is biggest ;-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63645</commentid>
    <comment_count>1</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-02-03 16:55:51 +0000</bug_when>
    <thetext>Agreed that we should add something to &quot;3.1.3 Keys&quot; about this case.

Chromium treats arrays with cyclic references as non-valid keys. This occurs at any level of indirection. The spec dictates that members of an array must be valid keys for the array to be a valid key. Therefore, none of the following are valid keys in Chromium:

var a1 = []; a1.push(a1); // root directly contains self

var a2 = []; a2.push([a2]); // root indirectly contains self

var a3 = [a1]; // member contains self</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64064</commentid>
    <comment_count>2</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-02-14 05:01:51 +0000</bug_when>
    <thetext>Yeah, we were thinking of solving this in Firefox by simply treating cyclic keys as invalid keys.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64066</commentid>
    <comment_count>3</comment_count>
    <who name="Odin Hørthe Omdal">odinho</who>
    <bug_when>2012-02-14 08:26:27 +0000</bug_when>
    <thetext>So Sicking&apos;s proposal?

&gt; I suggest an addition to the text e.g. &quot;However, an Array values is only a
&gt; valid key if every item in the array is defined, if every item in the array
&gt; is a valid key (i.e. sparse arrays can not be valid keys), and if Array
&gt; value is not an item in the Array itself or any other Arrays within the
&gt; value. (i.e. arrays with cyclic references are not valid keys).&quot; (That could
&gt; use a sprinkling of rigor, though.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64097</commentid>
    <comment_count>4</comment_count>
    <who name="Joshua Bell">jsbell</who>
    <bug_when>2012-02-14 16:22:59 +0000</bug_when>
    <thetext>Ah, I knew this sounded familiar. 

http://lists.w3.org/Archives/Public/public-webapps/2011OctDec/0609.html

SGTM, obviously!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64922</commentid>
    <comment_count>5</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-03-02 16:25:19 +0000</bug_when>
    <thetext>http://dvcs.w3.org/hg/IndexedDB/rev/b4158388d1f8

Fixed</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>