Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clamp NFCPushOptions.timeout and provide default values #81

Closed
alexshalamov opened this issue Oct 30, 2015 · 7 comments
Closed

Clamp NFCPushOptions.timeout and provide default values #81

alexshalamov opened this issue Oct 30, 2015 · 7 comments

Comments

@alexshalamov
Copy link

If NFCPushOptions.timeout can be set to Infinity, it should be clamped.

It will be also nice to have default values set for:
NFCPushOptions.timeout to "0xFFFFFFFF max timeout"
NFCPushOptions.target to "tag" enumeration value

dictionary NFCPushOptions {
    NFCPushTarget target = "tag";
    [Clamp] unsigned long timeout = 0xFFFFFFFF;
};
@kenchris
Copy link
Contributor

kenchris commented Nov 3, 2015

Why not just write a note that the UA might clamp to a UA specific upper bound?

@riju
Copy link
Collaborator

riju commented Nov 3, 2015

Its ok to be explicit in the idl, geolocaltion, vibration, etc do it.

@alexshalamov
Copy link
Author

@zolkis
http://www.ecma-international.org/ecma-262/5.1/#sec-8.5
http://www.w3.org/TR/WebIDL/#es-unsigned-long
If x > 2^32 − 1, then throw a TypeError

I wonder why other specs (MSE, WebAudio, Battery, DeviceLight) use "unrestricted double" for Infinity values? Should we also use:

dictionary NFCPushOptions {
    NFCPushTarget target = "any";
    unrestricted double timeout; // default value +Infinity
};

@zolkis
Copy link
Contributor

zolkis commented Nov 3, 2015

Could we use unsigned long long and say the value 0 means no timer (i.e. timeout=Infinity)?
That would be in line with step 4 of http://www.w3.org/TR/WebIDL/#es-unsigned-long-long.

@kenchris
Copy link
Contributor

kenchris commented Nov 3, 2015

@anssiko your input please? :)

@alexshalamov
Copy link
Author

timeout: 0; means 0 ms, timer will be created and push operation would be cancelled in 0 ms.

I have to represent "infinity" value somehow in implementation, at the moment I use "unrestricted double timeout;" in the idl, which is mapped to "double".

std::numeric_limits<double>::has_infinity => true
std::numeric_limits<unsigned long long>::has_infinity => false
std::numeric_limits<unsigned long>::has_infinity => false

@zolkis
Copy link
Contributor

zolkis commented Nov 3, 2015

OK, that solves it. Thanks.

zolkis added a commit to zolkis/web-nfc that referenced this issue Nov 4, 2015
…3c#84. Handle push related TAG review comments: simplified and aligned push message, optional push options with sensible defaults, improved push and cancelPush steps, option for suspending watches during push(), editorials.
@zolkis zolkis closed this as completed in #87 Nov 4, 2015
zolkis added a commit that referenced this issue Nov 4, 2015
Change type of timeout to unrestricted double fix #81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants