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

Single Promise, options object, revamped processing model #70

Merged
merged 14 commits into from
Mar 6, 2020
58 changes: 31 additions & 27 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -316,57 +316,61 @@ Interface {#interface}
=================

<pre class="idl">
dictionary NavigatorUABrandVersionDict {
required DOMString brand;
dictionary NavigatorUABrandVersion {
DOMString brand;
DOMString version;
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved
};

dictionary UADataOptions {
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved
boolean platform = false;
boolean platformVersion = false;
boolean architecture = false;
boolean model = false;
};

dictionary UADataValues {
DOMString platform = "";
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved
DOMString platformVersion = "";
DOMString architecture = "";
DOMString model = "";
};

[Exposed=Window]
interface NavigatorUAData {
readonly attribute FrozenArray&lt;NavigatorUABrandVersionDict&gt; brand;
readonly attribute FrozenArray&lt;NavigatorUABrandVersion&gt; UASet;
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved
readonly attribute boolean mobile;
Promise&lt;DOMString&gt; getPlatform();
Promise&lt;SOMString&gt; getPlatformVersion();
Promise&lt;DOMString&gt; getArchitecture();
Promise&lt;DOMString&gt; getModel();
Promise&lt;UADataValues&gt; getHighEntropyValues(optional UADataOptions options);
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved
};

interface mixin NavigatorUA {
[SecureContext] NavigatorUAData getUserAgent();
[SecureContext] readonly attribute NavigatorUAData userAgentData;
};
Navigator includes NavigatorUA;

</pre>

Processing model {#processing}
--------------
<dfn method for="NavigatorUA"><code>getUserAgent()</code></dfn> method MUST run these steps:
On getting, the {{NavigatorUAData/UASet}} attribute must return the set of {{NavigatorUABrandVersion}} objects, initialized with the user agent's [=user agent/brand=] and [=user agent/significant version=].
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved

1. Let |p| be a [=a new promise=].
On getting, the {{NavigatorUAData/mobile}} attribute must return the user agent's [=user agent/mobileness=].

2. Run the following steps [=in parallel=]:
The <dfn method for="NavigatorUA"><code>getHighEntropyValues()</code></dfn> method, optionally called with {{UADataOptions}} |options|, MUST run these steps:
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved

1. Let |UAData| be a new {{NavigatorUAData}} object whose values are initialized as follows:
1. Let |p| be a [=a new promise=].

: {{NavigatorUAData/brand}}
:: The user agent's [=user agent/brand=].
: {{NavigatorUAData/getPlatform}}
:: The user agent's [=user agent/platform brand=].
: {{NavigatorUAData/getPlatformVersion}}
:: The user agent's [=user agent/platform version=].
: {{NavigatorUAData/getArchitecture}}
:: The user agent's [=user agent/platform architecture=].
: {{NavigatorUAData/getModel}}
:: The user agent's [=user agent/model=].
: {{NavigatorUAData/mobile}}
:: The user agent's [=user agent/mobileness=].
2. Run the following steps [=in parallel=]:

2. [=Resolve=] |p| with |UAData|.
1. If |options| is the empty object, let |options| be a new {{UADataOptions}}.
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved
2. Let |UAData| be a new {{UADataValues}}.
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved
3. If |options.platform| is true, let |UAData.platform| be the the user agent's [=user agent/platform brand=].
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved
4. If |options.platformVersion| is true, let |UAData.platformVersion| be the the user agent's [=user agent/platform version=].
5. If |options.architecture| is true, let |UAData.architecture| be the the user agent's [=user agent/platform architecture=].
6. If |options.model| is true, let |UAData.model| be the the user agent's [=user agent/model=].
7. [=Resolve=] |p| with |UAData|.
yoavweiss marked this conversation as resolved.
Show resolved Hide resolved

3. Return |p|.

ISSUE: Provide a method to only access the UA's significant version.

Security and Privacy Considerations {#security-privacy}
===================================

Expand Down