diff --git a/spec.bs b/spec.bs index c9fe9ed..bdfe099 100644 --- a/spec.bs +++ b/spec.bs @@ -279,7 +279,7 @@ spec: html; urlPrefix: https://www.rfc-editor.org/rfc/ 1. Let |presumedNextCalculationDelay| be |lastTopicsCalculationTime| + (a [=duration=] of 7 days) − |fromUnixEpochTime|. 1. If |presumedNextCalculationDelay| < (a [=duration=] of 0), then set |presumedNextCalculationDelay| to (a [=duration=] of 0). 1. Else if |presumedNextCalculationDelay| ≥ (a [=duration=] of 14 days), then set |presumedNextCalculationDelay| to (a [=duration=] of 0). - + Note: This could happen if the machine time has gone backward since the last topics calculation. Recalculate immediately to align with the expected schedule rather than potentially stop calculating for a very long time. 1. Schedule the [=calculate user topics=] algorithm to run at [=Unix epoch=] + |fromUnixEpochTime| + |presumedNextCalculationDelay|. @@ -455,19 +455,17 @@ spec: html; urlPrefix: https://www.rfc-editor.org/rfc/ - |document|'s [=Document/origin=] is an [=opaque origin=]. - |document| is not [=allowed to use=] the browsing-topics feature. - |document| is not [=allowed to use=] the interest-cohort feature. - - The user preference setting disallows access to topics from |topLevelDocument| given |document|'s [=Document/origin=]. - - Access to topics from |topLevelDocument| given |document|'s [=Document/origin=] is disabled due to some other user agent-defined mechanism, like lack of enrollment. - - Note: In Chrome's experimentation phase, it will additionally require a valid origin trial token to exist in |document|. then: 1. [=Queue a global task=] on the browsing topics task source given |document|'s [=relevant global object=] to [=reject=] |promise| with a "{{NotAllowedError}}" {{DOMException}}. 1. Abort these steps. 1. Run the following steps [=in parallel=]: - 1. Let |topics| be the result of running the [=calculate the topics for caller=] algorithm, with |topicsCallerContext| as input. - 1. If options["{{BrowsingTopicsOptions/skipObservation}}"] is false: - 1. Run the [=collect page topics calculation input data=] algorithm with |topLevelDocument| as input. - 1. Run the [=collect topics caller domain=] algorithm with |topLevelDocument| and |topicsCallerContext|'s [=topics caller context/caller domain=] as input. + 1. Let |topics| be an empty [=list=]. + 1. If the user preference setting and other user agent-defined mechanisms like enrollment allow access to topics from |topLevelDocument| given |document|'s [=Document/origin=]: + 1. Set |topics| to the result of running the [=calculate the topics for caller=] algorithm, with |topicsCallerContext| as input. + 1. If options["{{BrowsingTopicsOptions/skipObservation}}"] is false: + 1. Run the [=collect page topics calculation input data=] algorithm with |topLevelDocument| as input. + 1. Run the [=collect topics caller domain=] algorithm with |topLevelDocument| and |topicsCallerContext|'s [=topics caller context/caller domain=] as input. 1. [=Queue a global task=] on the [=browsing topics task source=] given |document|'s [=relevant global object=] to perform the following steps: 1. [=Resolve=] |promise| with |topics|. 1. Return |promise|. @@ -557,9 +555,11 @@ spec: html; urlPrefix: https://www.rfc-editor.org/rfc/ 1. Let |moment| be the result of running [=coarsen time=] algorithm given |unsafeMoment| and [=wall clock=] as input. 1. Let |fromUnixEpochTime| be the [=duration from=] the [=Unix epoch=] to |moment|. 1. Set |topicsCallerContext|'s [=topics caller context/timestamp=] to |fromUnixEpochTime|. - 1. If the user preference setting disallows access to topics from |topLevelDocument| given |requestOrigin|, or access to topics from |topLevelDocument| given |requestOrigin| is disabled due to some other user agent-defined mechanism, like lack of enrollment, then return. - 1. Let |topics| be the result of running the [=calculate the topics for caller=] algorithm, with |topicsCallerContext| as input. - 1. Let |numVersionsInEpochs| be the result of running the [=get the number of distinct versions in epochs=] algorithm, with |topicsCallerContext| as input. + 1. Let |topics| be an empty [=list=]. + 1. Let |numVersionsInEpochs| be 0. + 1. If the user preference setting and other user agent-defined mechanisms like enrollment allow access to topics from |topLevelDocument| given |requestOrigin|: + 1. Set |topics| to the result of running the [=calculate the topics for caller=] algorithm, with |topicsCallerContext| as input. + 1. Set |numVersionsInEpochs| to the result of running the [=get the number of distinct versions in epochs=] algorithm, with |topicsCallerContext| as input. 1. Let |versionsToTopics| be an [=ordered map=]. 1. For each |topic| of |topics|: 1. Let |version| be |topic|["{{BrowsingTopic/version}}"]. @@ -631,10 +631,6 @@ spec: html; urlPrefix: https://www.rfc-editor.org/rfc/ The various lengths being returned (that depends on the number of distinct versions) could leak which epochs the user had disabled topics or didn't use the browser, if it coincided with the version change. But this leak is minor. The most common cases (i.e. returning same version topics, or no topics) will have the same length. - -
- In Chrome's experimentation phase, it will additionally require a valid origin trial token to exist in |initiatorWindow|'s associated document for the request to be eligible for topics. -

The \`Observe-Browsing-Topics\` HTTP response header

@@ -643,10 +639,11 @@ spec: html; urlPrefix: https://www.rfc-editor.org/rfc/
To handle topics response, given a [=response=] |response| and a [=request=] request: - 1. If |request|'s [=request/header list=] does not [=list/contain=] [:Sec-Browsing-Topics:] (implying the |request|'s [=request/current URL=] is not eligible for topics), then return. 1. Let |topLevelDocument| be |request|'s [=request/window=]'s [=environment settings object/global object=]'s [=Window/navigable=]'s [=navigable/top-level traversable=]'s [=navigable/active document=]. - 1. Let |callerDomain| be |request|'s [=request/current URL=]'s [=url/origin=]'s [=origin/host=]'s [=host/registrable domain=]. + 1. Let |callerOrigin| be |request|'s [=request/current URL=]'s [=url/origin=]. + 1. If the user preference setting or other user agent-defined mechanisms like enrollment disallows access to topics from |topLevelDocument| given |callerOrigin|, then return. + 1. Let |callerDomain| be |callerOrigin|'s [=origin/host=]'s [=host/registrable domain=]. 1. Let |list| be |response|'s [=response/header list=]. 1. Let |observe| be the result of running [=get a structured field value=] algorithm given [:Observe-Browsing-Topics:], "item", and |list| as input. 1. If |observe| is true: