Re: Vibration API - There is no definition about invalid parameter.

Hi!

On Dec 27, 2011, at 09:45 , Kihong Kwon wrote:
> There is no definition about invalid parameter in the spec.
> If I get a invalid parameter like string( navigator.vibrate("1000sec")
> or navigator.vibrate([1000 200 500 "msec"])),
> Which DOM Exception have to be set from the engine?(NOT_SUPPORTED_ERR??)

Normally, the invalid parameters that you describe should be handled by WebIDL (something which is complicated here by overloading). I'd give you the details except that WebIDL's overloading has recently been changed and I haven't yet had time to work through the fine print.

The relevant reading should be at:

    http://dev.w3.org/2006/webapi/WebIDL/#idl-overloading
and
    http://dev.w3.org/2006/webapi/WebIDL/#es-unsigned-long

I note that the IDL includes a mention of "raises". That's invalid IDL — we should fix that. Who's in charge of Vibration while Anssi's away?

> If the device gets vibrate message from WebAPP during it is vibrating
> already, how do I arrange these.
> There are three options, I think.
> 1. Stop the first vibration, and do the second.
> 2. Ignore the second
> 3. After finish the first vibration, do the second.

The rules are here:

    http://www.w3.org/TR/vibration/#dfn-processing-vibration-patterns

Essentially:

    • if the new pattern is 0 or [] (or anything that is automatically converted to these) then stop all vibration (step 3)
    • if the new pattern is invalid for the implementation, then an exception is throw but the previous vibration continues (steps 5 and 7)
    • otherwise, cancel the previous vibration and start the new one (step 8)

-- 
Robin Berjon - http://berjon.com/ - @robinberjon

Received on Wednesday, 11 January 2012 11:13:49 UTC