W3C home > Mailing lists > Public > public-media-capture@w3.org > August 2016

[mediacapture-main] Should we use [EnforceRange] on min/max in constraints?

From: Harald Alvestrand via GitHub <sysbot+gh@w3.org>
Date: Fri, 19 Aug 2016 12:25:08 +0000
To: public-media-capture@w3.org
Message-ID: <issues.opened-172119889-1471609506-sysbot+gh@w3.org>
alvestrand has just created a new issue for 
https://github.com/w3c/mediacapture-main:

== Should we use [EnforceRange] on min/max in constraints? ==
I was trying to debug a test with this constraint:

navigator.getUserMedia({video: {width: {min:Infinity}}} ....)

It failed in an interesting way (so there is probably a bug), but I 
tried to figure out what SHOULD happen.

WebIDL: https://www.w3.org/TR/WebIDL/#es-long - short version: 
ToInt32(ToNumber(string))

Assuming that "Infinity" is spelled correctly, this is ToInt32(+inf). 
Follow link to ECMAScript.

http://es5.github.io/#x9.5 - If number is NaN, +0, −0, +∞, or −∞, 
return +0. (WAT)

So if it's just a very large number? "Let int32bit be posInt modulo 
2^32"

Result: constraining to +inf is the same as constraining to 0. 
Constraining to 2^32+100 is the same as constraining to 100.

Would the behavior specified at https://www.w3.org/TR/WebIDL/#es-long 
for [EnforceRange] (which is "throw a TypeError") be a less surprising
 behavior for users?





Please view or discuss this issue at 
https://github.com/w3c/mediacapture-main/issues/384 using your GitHub 
account
Received on Friday, 19 August 2016 12:25:18 UTC

This archive was generated by hypermail 2.3.1 : Friday, 19 August 2016 12:25:18 UTC