@@ -4519,9 +4519,9 @@ A <dfn>network intercept</dfn> is a mechanism to allow remote ends to intercept
45194519and modify network requests and responses.
45204520
45214521A [=BiDi session=] has an <dfn>intercept map</dfn> which is a [=/map=] between
4522- intercept id and a [=struct=] with fields <code> url patterns</code> and
4523- <code> phases</code> that define the properties of active network intercepts. It
4524- is initially empty.
4522+ intercept id and a [=struct=] with fields <code> url patterns</code> ,
4523+ <code> phases</code> , and <code> browsingContexts </code> that define the properties
4524+ of active network intercepts. It is initially empty.
45254525
45264526A [=BiDi session=] has a <dfn>blocked request map</dfn> , used to track the
45274527requests which are actively being blocked. It is an [=/map=] between [=request id=]
@@ -4530,7 +4530,7 @@ and a [=struct=] with fields <code>request</code>, <code>phase</code>, and
45304530
45314531<div algorithm>
45324532
4533- To <dfn>get the network intercepts</dfn> given |session|, |event|, and |request |:
4533+ To <dfn>get the network intercepts</dfn> given |session|, |event|, |request|, and |context id |:
45344534
453545351. Let |session intercepts| be |session|'s [=intercept map=] .
45364536
@@ -4553,6 +4553,12 @@ To <dfn>get the network intercepts</dfn> given |session|, |event|, and |request|
45534553
455445541. For each |intercept id| → |intercept| of |session intercepts|:
45554555
4556+ 1. If |intercept|'s <code> contexts</code> is not null:
4557+
4558+ 1. If |intercept|'s <code> contexts</code> does not [=set/contains|contain=] |context id|:
4559+
4560+ 1. Continue.
4561+
45564562 1. If |intercept|'s <code> phases</code> [=set/contains=] |phase|:
45574563
45584564 1. Let |url patterns| be |intercept|'s <code> url patterns</code> .
@@ -4753,8 +4759,6 @@ request in addition to the context.
47534759<div algorithm>
47544760To <dfn>process a network event</dfn> given |session|, |event|, and |request|:
47554761
4756- 1. Let |intercepts| be the result of [=get the network intercepts=] with
4757- |session|, |event|, and |request|.
47584762
475947631. Let |request data| be the result of [=get the request data=] with |request|.
47604764
@@ -4763,13 +4767,20 @@ To <dfn>process a network event</dfn> given |session|, |event|, and |request|:
47634767
476447681. Let |context id| be null.
47654769
4770+ 1. Let |top-level context id| be null.
4771+
476647721. If |request|'s [=request/window=] is an [=environment settings object=] :
47674773
47684774 1. Let |environment settings| be |request|'s [=request/window=]
47694775
47704776 1. If there is a [=/browsing context=] whose [=active window=] is |environment
47714777 settings|' [=environment settings object/global object=] , set |context id|
4772- to the [=browsing context id=] for that context.
4778+ to the [=browsing context id=] for that context, and set |top-level context id|
4779+ to be [=top-level browsing context=] 's [=browsing context id=] for that
4780+ context.
4781+
4782+ 1. Let |intercepts| be the result of [=get the network intercepts=] with
4783+ |session|, |event|, |request|, and |top-level context id|.
47734784
477447851. Let |redirect count| be |request|'s [=redirect count=] .
47754786
@@ -5842,6 +5853,7 @@ The <dfn export for=commands>network.addIntercept</dfn> command adds a
58425853
58435854 network.AddInterceptParameters = {
58445855 phases: [+network.InterceptPhase] ,
5856+ ? contexts: [+browsingContext.BrowsingContext] ,
58455857 ? urlPatterns: [*network.UrlPattern] ,
58465858 }
58475859
@@ -5867,6 +5879,25 @@ The [=remote end steps=] given |session| and |command parameters| are:
586758791. Let |url patterns| be the <code> urlPatterns</code> field of |command
58685880 parameters| if present, or an empty [=/list=] otherwise.
58695881
5882+ 1. Let |contexts| be null.
5883+
5884+ 1. If the <code> contexts</code> field of |command parameters| is present:
5885+
5886+ 1. Set |contexts| to an empty [=/set=] .
5887+
5888+ 1. For each |context id| of |command parameters|["<code>contexts</code>"]
5889+
5890+ 1. Let |context| be the result of [=trying=] to [=get a browsing context=]
5891+ with |context id|.
5892+
5893+ 1. If |context| is not a [=top-level browsing context=] , return [=error=]
5894+ with [=error code=] [=invalid argument=] .
5895+
5896+ 1. Append |context| to |contexts|.
5897+
5898+ 1. If |contexts| is an empty [=/set=] , return [=error=] with [=error code=]
5899+ [=invalid argument=] .
5900+
587059011. Let |intercept map| be |session|'s [=intercept map=] .
58715902
587259031. Let |parsed patterns| be an empty [=/list=] .
@@ -5879,7 +5910,9 @@ The [=remote end steps=] given |session| and |command parameters| are:
58795910 1. [=list/Append=] |parsed| to |parsed patterns|.
58805911
588159121. Set |intercept map|[|intercept|] to a struct with <code> url patterns</code>
5882- |parsed patterns| and <code> phases</code> |command parameters|["<code>phases</code>"] .
5913+ |parsed patterns|, <code> phases</code> |command
5914+ parameters|["<code>phases</code>"] and <code> browsingContexts</code>
5915+ |contexts|.
58835916
588459171. Return a new [=/map=] matching the
58855918 <code> network.AddInterceptResult</code> production with the
0 commit comments