2.1.1 [W3C-INDEXEDDB-2] Section 2.4. Keys

V0002: Invalid keys do not throw the correct exception

The specification states:

 2.4. Keys
  
     In order to efficiently retrieve records stored in an indexed database, each record 
     is organized according to its key.
  
     A key has an associated type which is one of: number, date, string, binary, or array.
         ...
         The following ECMAScript types are valid keys: 
             ▪ Number primitive values, except NaN. This includes Infinity and -Infinity.
             ▪ Date objects, except where the [[DateValue]] internal slot is NaN.
             ▪ String primitive values.
             ▪ ArrayBuffer objects (or views on buffers such as Uint8Array).
             ▪ Array objects, where every item is defined, is itself a valid key, and does 
             not directly or indirectly contain itself. This includes empty arrays. Arrays 
             can contain other arrays.

EdgeHTML Mode

A key defined as null, function(){}, window, {length:0,constructor:Array}, Array object, or String object throws incorrect errors (DataCloneError).

V0001: An Array cannot be used as a key

The specification states:

 2.4. Keys
  
     In order to efficiently retrieve records stored in an indexed database, each record 
     is organized according to its key.
  
     A key has an associated type which is one of: number, date, string, binary, or array.
     ...
     The following ECMAScript types are valid keys:
         …
         ▪ Array objects, where every item is defined, is itself a valid key, and does not 
         directly or indirectly contain itself. This includes empty arrays. Arrays can 
         contain other arrays.

EdgeHTML Mode

An Array cannot be used as a key.

V0039: Binary keys are not supported

The specification states:

 2.4. Keys
  
     In order to efficiently retrieve records stored in an indexed database, each record 
     is organized according to its key.
  
     A key has an associated type which is one of: number, date, string, binary, or array.

EdgeHTML Mode

Binary keys are not supported.

V0003: Invalid keys are incorrectly considered valid

The specification states:

 2.4. Keys
  
     In order to efficiently retrieve records stored in an indexed database, each record 
     is organized according to its key.
  
     A key has an associated type which is one of: number, date, string, binary, or array.
         ...
         The following ECMAScript types are valid keys: 
             ▪ Number primitive values, except NaN. This includes Infinity and -Infinity.
             ▪ Date objects, except where the [[DateValue]] internal slot is NaN.
             ▪ String primitive values.
             ▪ ArrayBuffer objects (or views on buffers such as Uint8Array).
             ▪ Array objects, where every item is defined, is itself a valid key, and does 
             not directly or indirectly contain itself. This includes empty arrays. Arrays 
             can contain other arrays.

EdgeHTML Mode

The following keys are incorrectly considered valid and do not throw errors: new String(), new Number(), new Date(NaN), new Date(Infinity), /foo/, and  new RegExp().