diff --git a/index.bs b/index.bs index fe7ec25..3d54489 100644 --- a/index.bs +++ b/index.bs @@ -34,6 +34,7 @@ urlPrefix: https://tools.ietf.org/html/draft-ietf-httpbis-header-structure; spec text: list; url: #section-3.1 type: abstract-op text: serialize Structured Header; url: #section-4.1 + spec:infra; type:dfn; for:/; text:list
{ @@ -316,23 +317,27 @@ Interface {#interface} =================-dictionary NavigatorUABrandVersionDict { - required DOMString brand; +dictionary NavigatorUABrandVersion { + DOMString brand; DOMString version; }; +dictionary UADataValues { + DOMString platform; + DOMString platformVersion; + DOMString architecture; + DOMString model; +}; + [Exposed=Window] interface NavigatorUAData { - readonly attribute FrozenArray<NavigatorUABrandVersionDict> brand; + readonly attribute FrozenArray<NavigatorUABrandVersion> uaList; readonly attribute boolean mobile; - Promise<DOMString> getPlatform(); - Promise<SOMString> getPlatformVersion(); - Promise<DOMString> getArchitecture(); - Promise<DOMString> getModel(); + Promise<UADataValues> getHighEntropyValues(sequence<DOMString> hints); }; interface mixin NavigatorUA { - [SecureContext] NavigatorUAData getUserAgent(); + [SecureContext] readonly attribute NavigatorUAData userAgentData; }; Navigator includes NavigatorUA; @@ -340,32 +345,68 @@ Navigator includes NavigatorUA; Processing model {#processing} -------------- -getUserAgent()
method MUST run these steps: + ++ +Each [=user agent=] has an associated UA list, which is a [=/list=] created by running [=create UA list=]. + +Every {{WindowOrWorkerGlobalScope}} object has an associated UA frozen array, which is a
WindowOrWorkerGlobalScope
FrozenArray<NavigatorUABrandVersion>
. It is initially the result of [=create a frozen array|creating a frozen array=] from the [=user agent=]'s [=UA list=]. + +Create a UA list
+ +When asked to run the create UA list algorithm, the user agent MUST run the following steps: +1. Let |list| be a [=/list=]. + +2. Collect pairs of [=user agent/brand=] and [=user agent/significant version=] which represent the user agent, + its equivalence class and/or its rendering engine. + +3. For each pair: + + 1. Let |dict| be a new {{NavigatorUABrandVersion}} dictionary, + with [=user agent/brand=] as {{NavigatorUABrandVersion/brand}} and [=user agent/significant version=] as {{NavigatorUABrandVersion/version}}. + + 2. Append |dict| to |list|. + +4. The user agent MAY execute the following steps: + + 1. [=list/Append=] additional items to |list| containing {{NavigatorUABrandVersion}} objects, + initialized with arbitrary {{NavigatorUABrandVersion/brand}} and {{NavigatorUABrandVersion/version}} combinations. + + 2. Randomize the order of the items in |list|. + + Note: See [[#grease]] for more details on why these steps might be appropriate. + +5. Return |list|. + +Getters
+ +On getting, the {{NavigatorUAData/uaList}} attribute MUST return [=this=]'s [=relevant global object=]'s [=WindowOrWorkerGlobalScope/UA frozen array=]. + +On getting, the {{NavigatorUAData/mobile}} attribute must return the user agent's [=user agent/mobileness=]. + ++ +The
getHighEntropyValues
methodgetHighEntropyValues(|hints|)
method MUST run these steps: 1. Let |p| be a [=a new promise=]. 2. Run the following steps [=in parallel=]: - 1. Let |UAData| be a new {{NavigatorUAData}} object whose values are initialized as follows: + 1. Let |uaData| be a new {{UADataValues}}. - : {{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. If |hints| [=contains=] "platform", set |uaData|["{{UADataValues/platform}}"] to the user agent's [=user agent/platform brand=]. - 2. [=Resolve=] |p| with |UAData|. + 3. If |hints| [=contains=] "platformVersion", set |uaData|["{{UADataValues/platformVersion}}"] to the user agent's [=user agent/platform version=]. -3. Return |p|. + 4. If |hints| [=contains=] "architecture", set |uaData|["{{UADataValues/architecture}}"] to the user agent's [=user agent/platform architecture=]. + + 5. If |hints| [=contains=] "model", set |uaData|["{{UADataValues/model}}"] to the user agent's [=user agent/model=]. + + 6. [=Queue a task=] to [=resolve=] |p| with |uaData|. -ISSUE: Provide a method to only access the UA's significant version. +ISSUE: Add a specific task source this is queued on. + +3. Return |p|. Security and Privacy Considerations {#security-privacy} =================================== @@ -590,4 +631,3 @@ Author/Change controller: Specification document: : this specification ([[#user-agent]]), and Section 5.5.3 of [[RFC7231]] -