diff --git a/index.bs b/index.bs index 4d1a2c4b..59a52d01 100644 --- a/index.bs +++ b/index.bs @@ -4519,9 +4519,9 @@ A network intercept is a mechanism to allow remote ends to intercept and modify network requests and responses. A [=BiDi session=] has an intercept map which is a [=/map=] between -intercept id and a [=struct=] with fields url patterns and -phases that define the properties of active network intercepts. It -is initially empty. +intercept id and a [=struct=] with fields url patterns, +phases, and browsingContexts that define the properties +of active network intercepts. It is initially empty. A [=BiDi session=] has a blocked request map, used to track the requests which are actively being blocked. It is an [=/map=] between [=request id=] @@ -4530,7 +4530,7 @@ and a [=struct=] with fields request, phase, and
-To get the network intercepts given |session|, |event|, and |request|: +To get the network intercepts given |session|, |event|, |request|, and |context id|: 1. Let |session intercepts| be |session|'s [=intercept map=]. @@ -4553,6 +4553,12 @@ To get the network intercepts given |session|, |event|, and |request| 1. For each |intercept id| → |intercept| of |session intercepts|: + 1. If |intercept|'s contexts is not null: + + 1. If |intercept|'s contexts does not [=set/contains|contain=] |context id|: + + 1. Continue. + 1. If |intercept|'s phases [=set/contains=] |phase|: 1. Let |url patterns| be |intercept|'s url patterns. @@ -4753,8 +4759,6 @@ request in addition to the context.
To process a network event given |session|, |event|, and |request|: -1. Let |intercepts| be the result of [=get the network intercepts=] with - |session|, |event|, and |request|. 1. Let |request data| be the result of [=get the request data=] with |request|. @@ -4763,13 +4767,20 @@ To process a network event given |session|, |event|, and |request|: 1. Let |context id| be null. +1. Let |top-level context id| be null. + 1. If |request|'s [=request/window=] is an [=environment settings object=]: 1. Let |environment settings| be |request|'s [=request/window=] 1. If there is a [=/browsing context=] whose [=active window=] is |environment settings|' [=environment settings object/global object=], set |context id| - to the [=browsing context id=] for that context. + to the [=browsing context id=] for that context, and set |top-level context id| + to be [=top-level browsing context=]'s [=browsing context id=] for that + context. + +1. Let |intercepts| be the result of [=get the network intercepts=] with + |session|, |event|, |request|, and |top-level context id|. 1. Let |redirect count| be |request|'s [=redirect count=]. @@ -5842,6 +5853,7 @@ The network.addIntercept command adds a network.AddInterceptParameters = { phases: [+network.InterceptPhase], + ? contexts: [+browsingContext.BrowsingContext], ? urlPatterns: [*network.UrlPattern], } @@ -5867,6 +5879,25 @@ The [=remote end steps=] given |session| and |command parameters| are: 1. Let |url patterns| be the urlPatterns field of |command parameters| if present, or an empty [=/list=] otherwise. +1. Let |contexts| be null. + +1. If the contexts field of |command parameters| is present: + + 1. Set |contexts| to an empty [=/set=]. + + 1. For each |context id| of |command parameters|["contexts"] + + 1. Let |context| be the result of [=trying=] to [=get a browsing context=] + with |context id|. + + 1. If |context| is not a [=top-level browsing context=], return [=error=] + with [=error code=] [=invalid argument=]. + + 1. Append |context| to |contexts|. + + 1. If |contexts| is an empty [=/set=], return [=error=] with [=error code=] + [=invalid argument=]. + 1. Let |intercept map| be |session|'s [=intercept map=]. 1. Let |parsed patterns| be an empty [=/list=]. @@ -5879,7 +5910,9 @@ The [=remote end steps=] given |session| and |command parameters| are: 1. [=list/Append=] |parsed| to |parsed patterns|. 1. Set |intercept map|[|intercept|] to a struct with url patterns - |parsed patterns| and phases |command parameters|["phases"]. + |parsed patterns|, phases |command + parameters|["phases"] and browsingContexts + |contexts|. 1. Return a new [=/map=] matching the network.AddInterceptResult production with the