W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2015

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

From: <bugzilla@jessica.w3.org>
Date: Wed, 01 Jul 2015 20:32:39 +0000
To: public-script-coord@w3.org
Message-ID: <bug-28875-3890@http.www.w3.org/Bugs/Public/>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 1 July 2015 20:32:42 UTC