From 2ca040233cbc9515ebbaefda4a43a8efb761985a Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Fri, 6 Dec 2019 15:21:05 -0500 Subject: [PATCH 1/3] Restructure algorithms to allow containerPolicy to be snapshotted --- index.bs | 85 +++++++++++++++++++++++--------------------------------- 1 file changed, 35 insertions(+), 50 deletions(-) diff --git a/index.bs b/index.bs index b67c812d..467794a2 100644 --- a/index.bs +++ b/index.bs @@ -845,8 +845,8 @@ partial interface HTMLIFrameElement {
-

Process feature policy - attributes

+

Process feature + policy attributes

Given an element (element), this algorithm returns a container policy, which may be empty.

    @@ -888,9 +888,10 @@ partial interface HTMLIFrameElement {

Create a - Feature Policy for a browsing context

-

Given a browsing context (browsingContext), and an origin - (origin) this algorithm returns a new Feature Policy.

+ Feature Policy for a browsing context +

Given a browsing context (browsingContext), a container policy + containerPolicy, and an origin (origin) this + algorithm returns a new Feature Policy.

  1. Let inherited policy be a new ordered map.
  2. Let declared policy be a new ordered map.
  3. @@ -898,7 +899,8 @@ partial interface HTMLIFrameElement {
    1. Let isInherited be the result of running Define an inherited policy for feature in browsing - context on feature, origin and browsingContext. + context on feature, browsingContext, + containerPolicy, and origin.
    2. Set inherited policy[feature] to isInherited.
    3. @@ -913,14 +915,16 @@ partial interface HTMLIFrameElement {

Create a Feature - Policy for a browsing context from response

-

Given a browsing context (browsingContext), origin - (origin), and a [=response=] (response), this algorithm returns a new - Feature Policy

+ id="create-from-response">Create a Feature Policy for a browsing + context from response +

Given a browsing context (browsingContext), a + container policy (containerPolicy), an origin + (origin), and a [=response=] (response), this + this algorithm returns a new Feature Policy.

  1. Let policy be the result of running Create a Feature Policy for a browsing - context given browsingContext, and origin.
  2. + context given browsingContext, containerPolicy, + and origin.
  3. Let d be the result of running Process response policy on response and origin.
  4. @@ -935,50 +939,31 @@ partial interface HTMLIFrameElement {
-

Define an inherited policy for +

Define an inherited policy for feature in browsing context

-

Given a feature (feature), an origin (origin), and - a browsing context (browsingContext), this algorithm returns the - inherited policy for that feature.

+

Given a feature (feature) a browsing context + (browsingContext), a container policy + (containerPolicy), and an origin (origin), this + algorithm returns the inherited policy for that feature.

    -
  1. If browsingContext is the [=nested browsing context=] of a - [=browsing context container=] element, return the result of - executing Define an inherited policy for feature in container at - origin for feature in browsingContext's browsing - context container at origin.
  2. -
  3. Otherwise, return "Enabled".
  4. -
-

-
-

Define an inherited - policy for feature in container at - origin

-

Given a feature (feature) a browsing context container - (container), and an origin for a document in that - container (origin), this algorithm returns the inherited - policy for that feature.

-
    -
  1. Let parent be container's node - document.
  2. -
  3. Let container policy be the result of running - Process feature policy attributes on - container. -
  4. -
  5. If feature is a key in container policy: +
  6. If feature is a key in containerPolicy:
    1. If the allowlist for feature in - container policy does not match origin, + containerPolicy does not match origin, return "Disabled".
    2. -
    3. If feature is enabled in - parent for parent's origin, - return "Enabled". -
    4. -
    -
  7. -
  8. If feature is - enabled in parent for origin, return - "Enabled". +
  9. If browsingContext has a [=parent browsing context=], + then +
      +
    1. Let parent be browsingContext's [=parent + browsing context=].
    2. +
    3. If feature is enabled + in parent for parent's + origin, return "Enabled".
    4. +
    +
  10. +
  • Otherwise return "Disabled".
  • From 6f57fbe316c864c16ac51b49de7af3b332364d36 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Fri, 6 Dec 2019 16:07:03 -0500 Subject: [PATCH 2/3] Clean up last caller to inherited policy algo --- index.bs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 467794a2..760bf0da 100644 --- a/index.bs +++ b/index.bs @@ -627,10 +627,13 @@ partial interface HTMLIFrameElement { following steps:

    1. Let |inherited policy| be a new ordered map. 2. Let |declared policy| be a new ordered map. + 3. Let |container policy| be the result of calling process feature + policy attributes on |node|. 3. For each supported feature |feature|: 1. Let |isInherited| be the result of running Define an inherited - policy for feature in container at origin on |feature|, - |node| and |node|'s declared origin. + policy for feature in browsing context on |feature|, + |node|'s nested browsing context, |container policy|, and + |node|'s declared origin. 2. Set |inherited policy|[|feature|] to |isInherited|. 4. Return a new feature policy with inherited policy |inherited policy| and declared policy |declared policy|. From 50917713c083574774523d278b88d1e7b4e85dcd Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Fri, 6 Dec 2019 16:12:53 -0500 Subject: [PATCH 3/3] Fix numbering --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 760bf0da..5abcd6fe 100644 --- a/index.bs +++ b/index.bs @@ -629,13 +629,13 @@ partial interface HTMLIFrameElement { 2. Let |declared policy| be a new ordered map. 3. Let |container policy| be the result of calling process feature policy attributes on |node|. - 3. For each supported feature |feature|: + 4. For each supported feature |feature|: 1. Let |isInherited| be the result of running Define an inherited policy for feature in browsing context on |feature|, |node|'s nested browsing context, |container policy|, and |node|'s declared origin. 2. Set |inherited policy|[|feature|] to |isInherited|. - 4. Return a new feature policy with inherited policy + 5. Return a new feature policy with inherited policy |inherited policy| and declared policy |declared policy|.

    To get the declared origin for an Element |node|, run the