[Bug 28875] New: [EnforceRange] accepts an odd set of input values

https://www.w3.org/Bugs/Public/show_bug.cgi?id=28875

            Bug ID: 28875
           Summary: [EnforceRange] accepts an odd set of input values
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebIDL
          Assignee: cam@mcc.id.au
          Reporter: jyasskin@gmail.com
        QA Contact: public-webapps-bugzilla@w3.org
                CC: mike@w3.org, public-script-coord@w3.org

[EnforceRange] delegates to the ECMAScript ToNumber() operation before checking
its range, but this makes it accept a strange set of values.

unsigned long enforceRange([EnforceRange] unsigned long arg) { return arg; }

enforceRange({}) throws a TypeError, but enforceRange([]) and enforceRange("")
return 0.
enforceRange(undefined) throws a TypeError, but enforceRange(null) returns 0.

What's the "right" behavior?

Looking at uses: I see 3 existing uses in Blink, all in IndexedDB:
https://code.google.com/p/chromium/codesearch/#search/&q=enforcerange%20file:.idl%20-file:test&type=cs&sq=package:chromium.
Web Bluetooth is also considering using [EnforceRange] for
BluetoothUUID.canonicalUUID().

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Wednesday, 1 July 2015 20:32:42 UTC