This section describes features that apply most directly to web browsers. Having said that, except where specified otherwise, the requirements defined in this section do apply to all user agents, whether they are web browsers or not.
Origins
are
presented
the
fundamental
currency
of
the
web's
security
model.
Two
actors
in
the
web
platform
that
share
an
origin
are
assumed
to
trust
each
other
and
to
have
the
user.
same
authority.
Actors
with
differing
origins
are
considered
potentially
hostile
versus
each
other,
and
are
isolated
from
each
other
to
varying
degrees.
For
example,
if
Example
Bank's
web
browser
typically
contains
site,
hosted
at
bank.example.com
,
tries
to
examine
the
DOM
of
Example
Charity's
web
site,
hosted
at
charity.example.org
,
a
browsing
context
,
as
does
an
iframe
or
frame
"
SecurityError
s
in
a
frameset
.
A
browsing
context
"
has
a
corresponding
WindowProxy
DOMException
object.
A
browsing
context
has
an
opener
browsing
context
,
which
is
null
or
a
browsing
context
.
It
is
initially
null.
A
browsing
context
has
a
disowned
boolean.
It
is
initially
false.
will
be
raised.
An
origin
boolean.
It
is
initially
false.
The
following
example
illustrates
the
various
possibilities
one
of
a
browsing
context
.
It
can
be
disowned
,
is
closing
,
neither,
or
both.
the
following:
A
browsing
context
has
a
session
history
,
which
lists
the
Document
objects
that
the
browsing
context
has
presented,
An
internal
value,
with
no
serialization
it
can
be
recreated
from
(it
is
presenting,
or
will
present.
A
serialized
as
"
Document
's
browsing
context
is
the
browsing
context
whose
session
history
contains
the
Document
,
if
any
such
browsing
context
exists
and
has
not
been
discarded
,
and
null
otherwise.
A
Document
does
not
necessarily
have
a
non-null
browsing
context
.
In
particular,
data
mining
tools
are
likely
to
never
instantiate
browsing
contexts.
A
Document
created
using
"
per
serialization
of
an
API
such
as
createDocument()
never
has
a
non-null
browsing
context
.
And
the
Document
origin
originally
created
),
for
an
iframe
element,
which
has
since
been
removed
from
the
document
,
has
no
associated
browsing
context,
since
that
browsing
context
was
discarded
.
only
meaningful
operation
is
testing
for
equality.
A tuple consists of:
In
general,
there
is
a
1-to-1
mapping
from
the
Window
Origins
object
to
the
can
be
shared,
e.g.,
among
multiple
Document
object,
as
long
as
objects.
Furthermore,
origins
are
generally
immutable.
Only
the
Document
domain
object
has
of
a
non-null
browsing
context
.
There
is
one
exception.
A
Window
tuple
origin
can
be
reused
for
the
presentation
of
a
second
Document
in
the
same
browsing
context
,
such
that
the
mapping
is
then
1-to-2.
This
occurs
when
a
browsing
context
is
navigated
from
changed,
and
only
through
the
initial
about:blank
Document
to
another,
with
historyHandling
set
to
"
replace
document.domain
".
API.
A
browsing
context
has
a
virtual
browsing
context
group
ID
The
effective
domain
integer.
It
is
initially
0.
This
is
used
by
cross-origin
opener
policy
reporting
,
to
keep
track
of
the
browsing
context
group
switches
that
would
have
happened
if
the
report-only
policy
had
been
enforced.
A
browsing
context
has
an
initial
URL
,
which
is
a
URL
origin
or
null.
It
origin
is
initially
null.
computed
as
follows:
A
browsing
context
has
an
opener
If
origin
at
creation
,
which
is
an
opaque
origin
or
null.
It
is
initially
,
then
return
null.
7.1.1
Creating
browsing
contexts
If origin 's domain is non-null, then return origin 's domain .
To
set
the
active
document
of
a
browsing
context
Return
browsingContext
origin
's
host
.
The
serialization
of
an
origin
is
the
string
obtained
by
applying
the
following
algorithm
to
a
Document
the
given
origin
object
document
,
run
these
steps:
origin
:
Let
If
window
origin
is
an
opaque
origin
,
then
return
"
null
".
Otherwise,
let
result
be
document
origin
's
relevant
global
object
scheme
.
Set
document
's
visibility
state
Append
"
://
"
to
browsingContext
's
top-level
browsing
context
's
system
visibility
state
.
result
.
Set
Append
browsingContext
origin
's
active
window
host
,
serialized
,
to
window
result
.
Set
If
window
origin
's
associated
Document
port
is
non-null,
append
a
U+003A
COLON
character
(:),
and
origin
's
port
,
serialized
,
to
document
result
.
Set
Return
window
's
relevant
settings
object
's
execution
ready
flag
.
result
.
The
serialization
has
an
associated
creator
origin
(null
or
returns
of
("
https
",
"
xn--maraa-rta.example
",
null,
null)
is
"
https://xn--maraa-rta.example
".
There
used
to
also
be
a
Unicode
serialization
of
an
origin
),
creator
URL
(null
or
returns
a
URL
),
and
creator
base
URL
(null
or
returns
a
URL
).
These
are
all
initially
null.
.
However,
it
was
never
widely
adopted.
To
determine
the
origin
,
given
browsing
context
browsingContext
,
URL
Two
origins
,
url
,
sandboxing
flag
set
A
and
sandboxFlags
B
,
and
an
are
said
to
be
same
origin
invocationOrigin
:
if
the
following
algorithm
returns
true:
If
sandboxFlags
A
has
its
sandboxed
and
B
are
the
same
opaque
origin
browsing
context
flag
set,
,
then
return
a
new
opaque
origin
.
true.
If
url
A
is
null,
and
B
are
both
tuple
origins
and
their
schemes
,
hosts
,
and
port
are
identical,
then
return
a
new
opaque
origin
.
true.
Return false.
Two origins , A and B , are said to be same origin-domain if the following algorithm returns true:
If
invocationOrigin
A
is
non-null
and
url
B
matches
about:blank
are
the
same
opaque
origin
,
then
return
true.
If
invocationOrigin
.
The
result
here
is
that
two
documents
end
up
with
the
same
underlying
origin
A
and
B
are
both
tuple
origins
,
meaning
that
document.domain
affects
both.
run
these
substeps:
If
url
A
is
about:srcdoc
and
B
's
schemes
,
are
identical,
and
their
domains
are
identical
and
non-null,
then
return
the
origin
of
true.
Otherwise,
if
browsingContext
A
's
container
document
.
and
B
are
same
origin
and
their
domains
are
identical
and
null,
then
return
true.
Return false.
|
| B |
same
origin
|
|
|---|---|---|---|
("
https
",
"
example.org
",
null,
null)
|
("
https
",
"
example.org
",
null,
null)
| ✅ | ✅ |
("
https
example.org
",
314,
null)
|
("
https
",
"
example.org
",
420,
null)
| ❌ | ❌ |
("
https
",
"
example.org
",
314,
"
example.org
")
|
("
https
",
"
example.org
",
420,
"
example.org
")
| ❌ | ✅ |
("
https
",
"
example.org
",
null,
null)
|
("
https
",
"
example.org
",
null,
"
example.org
")
| ✅ | ❌ |
("
https
",
"
example.org
",
null,
"
example.org
")
|
("
http
",
"
example.org
",
null,
"
example.org
")
| ❌ | ❌ |
A
scheme-and-host
is
a
tuple
of
a
scheme
(an
ASCII
string
)
and
a
browsing
context
group
host
(a
host
).
A site is an opaque origin or a scheme-and-host .
To
obtain
a
site
,
given
an
origin
group
origin
,
run
these
steps:
Let
If
browsingContext
origin
be
a
new
browsing
context
.
Let
is
an
opaque
origin
,
then
return
unsafeContextCreationTime
be
the
unsafe
shared
current
time
.
origin
.
If
creator
is
non-null,
then
set
browsingContext
origin
's
creator
origin
host
to
's
registrable
domain
is
null,
then
return
(
creator
origin
's
origin
scheme
,
browsingContext
origin
's
creator
URL
host
to
return
).
Return
(
creator
origin
's
URL
scheme
,
browsingContext
origin
's
creator
base
URL
host
's
registrable
domain
).
Two sites , A and B , are said to be same site if the following algorithm returns true:
If A and B are the same opaque origin , the return true.
If
creator
A
's
base
URL
or
B
is
an
opaque
origin
,
and
then
return
false.
If
browsingContext
A
's
virtual
browsing
context
group
ID
to
and
creator
B
's
top-level
browsing
context
scheme
's
virtual
browsing
context
group
ID
.
values
are
different,
then
return
false.
Let
sandboxFlags
be
the
result
of
determining
the
creation
sandboxing
flags
given
If
browsingContext
A
's
and
embedder
.
B
's
host
values
are
not
equal
,
then
return
false.
Let
origin
be
the
result
Return
true.
The
serialization
of
determining
a
site
is
the
string
obtained
by
applying
the
following
algorithm
to
the
origin
given
site
browsingContext
,
site
:
If
browsingContext
site
's
creator
is
an
opaque
origin
.
,
then
return
"
null
".
Let
permissionsPolicy
result
be
the
result
of
creating
a
permissions
policy
given
browsingContext
site
and
origin
.
[PERMISSIONSPOLICY]
[0].
Append
"
://
"
to
use
embedder
result
.
Let
Append
agent
site
be
the
result
of
obtaining
a
similar-origin
window
agent
given
origin
,
[1],
serialized
,
to
group
,
and
false.
result
.
Let
Return
realm
execution
context
result
.
It
needs
to
be
clear
from
context
that
the
result
of
creating
serialized
value
is
a
new
realm
given
site,
not
an
origin,
as
there
is
not
necessarily
a
syntactic
difference
between
the
two.
For
example,
the
origin
("
https
",
"
shop.example
",
null,
null)
and
the
site
("
https
",
"
shop.example
")
have
the
same
serialization:
"
https://shop.example
".
Two
origins
,
agent
A
and
B
,
are
said
to
be
schemelessly
same
site
if
the
following
customizations:
algorithm
returns
true:
For
If
A
and
B
are
the
global
object,
create
a
new
Window
object.
same
opaque
origin
,
then
return
true.
For
the
global
this
binding,
use
If
browsingContext
A
's
WindowProxy
and
B
are
both
tuple
origins
,
then:
Let
topLevelCreationURL
hostA
be
about:blank
if
embedder
A
is
null;
otherwise
's
host
,
and
let
embedder
hostB
be
B
's
relevant
settings
object
's
top-level
creation
URL
host
.
Let
If
topLevelOrigin
hostA
be
equals
origin
hostB
if
and
embedder
hostA
's
registrable
domain
is
null;
otherwise
null,
then
return
true.
If
embedder
hostA
's
relevant
settings
object
registrable
domain
equals
hostB
's
top-level
origin
.
registrable
domain
and
is
non-null,
then
return
true.
Set
up
a
window
environment
settings
object
with
about:blank
,
realm
execution
context
,
null,
Return
false.
Two
origins
,
topLevelCreationURL
,
A
and
topLevelOrigin
.
B
,
are
said
to
be
same
site
if
the
following
algorithm
returns
true:
Let
loadTimingInfo
siteA
be
a
new
document
load
timing
info
with
its
navigation
start
time
set
to
the
result
of
calling
coarsen
time
obtaining
a
site
with
given
unsafeContextCreationTime
and
the
new
environment
settings
object
's
cross-origin
isolated
capability
.
A
.
Let
coop
siteB
be
the
result
of
obtaining
a
new
cross-origin
opener
policy
.
site
given
B
.
If
creator
is
non-null
and
creator
siteA
's
origin
is
same
origin
site
with
creator
's
relevant
settings
object
's
top-level
origin
,
siteB
,
then
set
coop
to
creator
's
browsing
context
's
top-level
browsing
context
's
active
document
's
cross-origin
opener
policy
.
return
true.
Let
document
be
a
new
Document
Return
false.
Unlike
the
same
origin
,
marked
as
an
HTML
document
and
same
origin-domain
in
quirks
mode
,
whose
content
type
concepts,
for
schemelessly
same
site
is
"
text/html
",
origin
and
same
site
,
the
port
is
origin
,
active
sandboxing
flag
set
and
domain
is
sandboxFlags
,
permissions
policy
components
are
ignored.
For
the
reasons
explained
in
URL
,
the
same
site
is
permissionsPolicy
,
cross-origin
opener
policy
and
schemelessly
same
site
is
coop
,
load
timing
info
concepts
should
be
avoided
when
possible,
in
favor
of
same
origin
is
loadTimingInfo
,
navigation
id
checks.
Given
that
wildlife.museum
,
museum
,
and
com
are
public
suffixes
is
null,
and
which
that
example.com
is
ready
for
post-load
tasks
.
not:
|
|
|
schemelessly
same
site
|
|
|---|---|---|---|
("
https
",
"
example.com
")
|
("
https
",
"
sub.example.com
")
| ✅ | ✅ |
("
",
"
example.com
")
|
("
https
",
"
sub.other.example.com
")
| ✅ | ✅ |
("
https
",
"
example.com
")
|
("
http
",
"
non-secure.example.com
")
| ✅ | ❌ |
("
https
",
"
r.wildlife.museum
")
|
("
https
",
"
sub.r.wildlife.museum
")
| ✅ | ✅ |
("
https
",
"
r.wildlife.museum
")
|
("
https
",
"
sub.other.r.wildlife.museum
")
| ✅ | ✅ |
("
https
r.wildlife.museum
")
|
("
https
",
"
other.wildlife.museum
")
| ❌ | ❌ |
("
https
",
"
r.wildlife.museum
")
|
("
https
",
"
wildlife.museum
")
| ❌ | ❌ |
("
https
wildlife.museum
")
|
("
https
",
"
wildlife.museum
")
| ✅ | ✅ |
("
https
",
"
example.com
")
|
("
https
",
"
example.com.
")
| ❌ | ❌ |
(Here
we
have
omitted
the
port
and
a
domain
components
since
they
are
not
considered.)
document
.
domain
of
[
=
browsingContext
domain
to
document
.
]
If
browsingContext
's
creator
URL
is
non-null,
then
Returns
the
current
domain
used
for
security
checks.
Can
be
set
document
's
referrer
to
a
value
that
removes
subdomains,
to
change
the
serialization
origin
of
it.
If
creator
is
non-null,
then
set
document
's
policy
container
domain
to
a
clone
allow
pages
on
other
subdomains
of
the
same
domain
(if
they
do
the
same
thing)
to
access
each
other.
This
enables
pages
on
different
hosts
of
creator
's
policy
container
.
Append
a
new
session
history
entry
domain
to
browsingContext
's
session
history
synchronously
access
each
other's
DOMs.
In
sandboxed
iframe
s,
whose
URL
Document
s
with
opaque
origins
,is
about:blank
Document
s
without
a
browsing
context
,
and
document
when
the
"
document-domain
"
feature
is
document
.
disabled,
the
setter
will
throw
a
"
SecurityError
"
exception.
In
cases
where
crossOriginIsolated
or
Completely
finish
loading
originAgentCluster
return
true,
the
setter
will
do
nothing.
document
.
Return
browsingContext
.
To
create
Avoid
using
the
document.domain
setter.
It
undermines
the
security
protections
provided
by
the
same-origin
policy.
This
is
especially
acute
when
using
shared
hosting;
for
example,
if
an
untrusted
third
party
is
able
to
host
an
HTTP
server
at
the
same
IP
address
but
on
a
new
top-level
browsing
context
:
different
port,
then
the
same-origin
protection
that
normally
protects
two
different
sites
on
the
same
host
will
fail,
as
the
ports
are
ignored
when
comparing
origins
after
the
document.domain
setter
has
been
used.
Let
group
be
Because
of
these
security
pitfalls,
this
feature
is
in
the
result
process
of
creating
being
removed
from
the
web
platform.
(This
is
a
new
browsing
context
group
.
long
process
that
takes
many
years.)
Return
group
's
browsing
context
set
Instead,
use
postMessage()
or
[0].
This
creates
MessageChannel
objects
to
communicate
across
origins
in
a
top-level
browsing
context
.
safe
manner.
To
create
a
new
auxiliary
browsing
context
,
given
a
browsing
context
opener
:
The
domain
getter
steps
are:
Let
group
effectiveDomain
be
opener
's
top-level
browsing
context
this
's
group
origin
's
effective
domain
.
Assert
:
If
group
effectiveDomain
is
non-null,
as
navigating
invokes
this
directly.
null,
then
return
the
empty
string.
Let
browsingContext
be
the
result
of
creating
a
new
browsing
context
with
opener
's
active
document
,
null,
and
Return
group
.
effectiveDomain
,
serialized
.
The
setter
steps
are:
Append
domain
browsingContext
to
group
.
Set
browsingContext
's
opener
browsing
context
to
opener
.
Set
browsingContext
's
virtual
browsing
context
group
ID
If
this
to
opener
's
top-level
browsing
context
's
virtual
browsing
context
group
ID
.
is
null,
then
throw
a
"
SecurityError
"
DOMException
.
Set
browsingContext
's
opener
origin
at
creation
If
this
to
opener
's
active
document
sandboxing
flag
set
's
origin
.
Legacy-clone
a
has
its
sandboxed
document.domain
browsing
session
storage
shed
context
flag
with
opener
's
browsing
session
set,
then
throw
a
"
SecurityError
"
and
browsingContext
's
browsing
session
.
[STORAGE]
DOMException
.
Return
browsingContext
.
This
creates
a
top-level
browsing
context
If
this
that
is
also
an
auxiliary
browsing
context
.
To
create
not
allowed
to
use
the
"
document-domain
"
feature,
then
throw
a
new
nested
browsing
context
,
given
an
element
element
:
"
SecurityError
"
DOMException
.
Let
group
effectiveDomain
be
element
's
node
document
's
browsing
context
this
's
top-level
browsing
context
origin
's
group
effective
domain
.
Let
If
browsingContext
effectiveDomain
be
the
result
of
creating
is
null,
then
throw
a
new
browsing
context
"
SecurityError
"
with
element
's
node
document
,
element
,
and
group
.
.
Set
element
's
nested
browsing
context
DOMException
to
browsingContext
.
If
the
given
value
is
not
a
registrable
domain
suffix
of
and
is
not
equal
to
element
has
effectiveDomain
,
then
throw
a
"
name
SecurityError
attribute,
then
set
browsingContext
's
name
"
to
the
value
of
this
attribute.
7.1.2
Related
browsing
contexts
DOMException
.
Certain
elements
(for
example,
iframe
Each
browsing
context
container
If
the
surrounding
agent
has
a
nested
browsing
context
,
which
's
agent
cluster
's
is
either
a
browsing
context
origin-keyed
or
null.
It
is
initially
null.
true,
then
return.
The
container
of
a
browsing
context
Set
bc
this
is
the
browsing
context
container
's
origin
whose
nested
browsing
context
's
domain
is
bc
,
or
null
if
there
is
no
such
element.
Each
browsing
context
to
the
result
of
parsing
the
given
value.
To
determine
if
a
string
bc
hostSuffixString
has
a
container
document
,
which
is
the
result
a
registrable
domain
suffix
of
running
or
is
equal
to
a
host
originalHost
,
run
these
steps:
If
bc
hostSuffixString
's
container
is
null,
the
empty
string,
then
return
null.
false.
Return
Let
bc
hostSuffix
's
container
be
the
result
of
parsing
's
node
document
.
This
is
equal
to
bc
's
container
's
shadow-including
root
as
hostSuffixString
.
If
bc
hostSuffix
's
container
has
to
be
connected
.
is
failure,
then
return
false.
A
browsing
context
If
child
hostSuffix
is
said
to
be
a
child
browsing
context
of
another
browsing
context
does
not
equal
parent
originalHost
,
if
then:
If
child
hostSuffix
's
container
document
is
non-null
and
or
child
originalHost
's
container
document
's
browsing
context
is
parent
.
not
a
domain
,
then
return
false.
This excludes hosts that are IP addresses .
If
child
is
a
document-tree
child
browsing
context
hostSuffix
,
prefixed
by
U+002E
(.),
does
not
match
the
end
of
parent
if
originalHost
,
then
return
false.
If one of the following is true
child
hostSuffix
is
a
child
browsing
context
equals
and
child
hostSuffix
's
container
public
suffix
is
in
a
document
tree
.
A
browsing
context
child
may
have
a
parent
browsing
context
.
This
is
hostSuffix
,
prefixed
by
U+002E
(.),
matches
the
unique
browsing
context
that
has
end
child
originalHost
as
a
child
browsing
context
,
if
any
such
browsing
context
exists.
Otherwise,
the
browsing
context
's
public
suffix
has
no
parent
browsing
context
.
A
browsing
context
then
return
false.
[URL]
Assert
:
A
originalHost
is
said
to
be
an
ancestor
's
public
suffix
,
prefixed
by
U+002E
(.),
matches
the
end
of
a
browsing
context
B
hostSuffix
.
Return true.
|
hostSuffixString
|
|
Outcome
of
is
a
| Notes |
|---|---|---|---|
"
0.0.0.0
"
|
0.0.0.0
| ✅ | |
"
0x10203
"
|
0.1.2.3
| ✅ | |
"
[0::1]
"
| ::1 | ✅ | |
"
example.com
"
|
example.com
| ✅ | |
"
example.com
"
|
example.com.
| ❌ | Trailing dot is significant. |
"
example.com.
"
|
example.com
| ❌ | |
"
example.com
"
|
www.example.com
| ✅ | |
"
com
"
|
example.com
| ❌ |
At
the
com
is
a
public
suffix.
|
"
example
"
|
example
| ✅ | |
"
compute.amazonaws.com
"
|
example.compute.amazonaws.com
| ❌ |
At
the
is
a
public
suffix.
|
"
example.compute.amazonaws.com
"
|
www.example.compute.amazonaws.com
| ❌ | |
"
amazonaws.com
"
|
www.example.compute.amazonaws.com
| ❌ | |
"
amazonaws.com
"
|
test.amazonaws.com
| ✅ |
At
the
amazonaws.com
is
|
window.
originAgentCluster
has
an
is
popup
boolean.
It
is
initially
false.
The
only
mandatory
impact
in
Returns
true
if
this
specification
of
is
popup
is
on
the
visible
Window
getter
of
belongs
to
an
agent
cluster
which
is
origin
-
keyed
,
in
the
relevant
manner
described
in
this
section.
A
BarProp
Document
objects.
However,
user
agents
might
also
use
delivered
over
a
secure
context
can
request
that
it
be
placed
in
an
origin
-
keyed
agent
cluster
,
by
using
the
following
ways:
`
Deciding
whether
or
not
to
provide
Origin-Agent-Cluster
`
HTTP
response
header.
This
header
is
a
minimal
web
browser
user
interface
for
the
browsing
context
.
Performing
the
optional
steps
in
set
up
browsing
context
features
.
In
both
cases
user
agents
might
additionally
incorporate
user
preferences,
or
present
structured
header
whose
value
must
be
a
choice
as
to
whether
to
go
down
the
popup
route.
boolean
.
[STRUCTURED-FIELDS]
User
agents
that
provides
a
minimal
web
browser
user
interface
for
such
popups
are
encouraged
to
not
hide
Per
the
browser's
location
bar.
It
is
possible
to
processing
model
in
the
create
and
initialize
a
new
browsing
contexts
Document
object
,
values
that
are
related
to
a
top-level
browsing
context
while
their
container
not
the
structured
header
boolean
is
null.
Such
browsing
contexts
are
called
auxiliary
browsing
contexts
.
Auxiliary
browsing
contexts
are
always
top-level
browsing
contexts
.
true
value
(i.e.,
`
?1
`)
will
be
ignored.
The
transitive
closure
consequences
of
parent
browsing
contexts
for
a
browsing
context
using
this
header
are
that
is
a
child
browsing
context
gives
the
list
of
ancestor
browsing
contexts
.
The
list
of
the
descendant
browsing
contexts
of
a
resulting
Document
d
's
agent
cluster
key
is
its
origin
,
instead
of
the
(ordered)
list
returned
by
corresponding
site
.
In
terms
of
observable
effects,
this
means
that
attempting
to
relax
the
following
algorithm:
same-origin
restriction
using
document.domain
will
instead
do
nothing,
and
it
will
not
be
Let
list
an
empty
list
.
For
each
browsing
context
container
possible
to
send
WebAssembly.Module
objects
to
cross-origin
container
,
whose
nested
browsing
context
Document
s
(even
if
they
are
same
site
is
non-null
and
whose
shadow-including
root
is
d
,
in
shadow-including
tree
order
:
).
Behind
the
scenes,
this
isolation
can
allow
user
agents
to
allocate
implementation-specific
resources
corresponding
to
agent
clusters
,
such
as
processes
or
threads,
more
efficiently.
Let
nestedBC
be
container
's
nested
Note
that
within
a
browsing
context
.
group
,
the
`
`
header
can
never
cause
same-origin
Append
Origin-Agent-Cluster
nestedBC
to
list
.
objects
to
end
up
in
different
agent
clusters
,
even
if
one
sends
the
Extend
Document
list
with
list
of
header
and
the
descendant
browsing
contexts
other
doesn't.
This
is
prevented
by
means
of
nestedBC
's
active
document
the
historical
agent
cluster
key
map
.
Return
list
.
A
This
means
that
the
Document
originAgentCluster
d
is
said
to
be
fully
active
when
d
's
browsing
context
getter
can
return
false,
even
if
the
header
is
non-null,
d
's
set,
if
the
header
was
omitted
on
a
previously-loaded
same-origin
page
in
the
same
browsing
context
's
active
document
group
.
Similarly,
it
can
return
true
even
when
the
header
is
d
,
and
either
d
's
browsing
context
not
set.
The
originAgentCluster
getter
steps
are
to
return
the
surrounding
agent
is
a
top-level
browsing
context
,
or
d
's
browsing
context
agent
cluster
's
container
document
is
fully
active
origin-keyed
.
Document
in
their
parent
browsing
context
.
User
agents
must
not
allow
the
user
to
interact
s
with
child
browsing
contexts
an
opaque
origin
of
elements
that
are
in
can
be
considered
unconditionally
origin-keyed;
for
them
the
header
has
no
effect,
and
the
Document
originAgentCluster
s
that
are
not
themselves
fully
active
.
getter
will
always
return
true.
Similarly,
Document
objects.
Here
a.html
s
whose
agent
cluster
's
cross-origin
isolation
mode
is
loaded
into
a
browser
window,
b-1.html
starts
out
loaded
into
an
not
"
iframe
none
as
shown,
and
b-2.html
and
c.html
"
are
omitted
(they
can
simply
be
an
empty
document).
<!-- a.html -->
<!DOCTYPE html>
<html lang="en">
<title>Browsing context A</title>
<iframe src="b-1.html"></iframe>
<button onclick="frames[0].location.href = 'b-2.html'">Click me</button>
<!-- b-1.html -->
<!DOCTYPE html>
<html lang="en">
<title>Browsing context B</title>
automatically
origin-keyed.
The
`
<iframe
src="c.html"></iframe>
Origin-Agent-Cluster
At
this
point,
the
documents
given
by
a.html
,
b-1.html
,
and
c.html
are
all
the
active
documents
of
their
respective
browsing
contexts
.
They
are
also
all
fully
active
.
After
clicking
on
`
header
might
be
useful
as
an
additional
hint
to
implementations
about
resource
allocation,
since
the
`
`
and
button
Cross-Origin-Opener-Policy
,
thus
loading
a
new
`
Document
Cross-Origin-Embedder-Policy
from
b-2.html
into
browsing
context
B,
we
have
`
headers
used
to
achieve
cross-origin
isolation
are
more
about
ensuring
that
everything
in
the
following
results:
same
address
space
opts
in
to
being
there.
But
adding
it
would
have
no
additional
observable
effects
on
author
code.
A
cross-origin
opener
policy
value
allows
a
document
which
is
navigated
to
in
a
top-level
browsing
context
to
force
the
creation
of
a
new
top-level
browsing
context
A,
,
and
fully
active
a
corresponding
group
.
The
possible
values
are:
b-1.html
unsafe-none
This
is
now
not
the
active
(current)
default
and
means
that
the
document
of
will
occupy
the
same
top-level
browsing
context
B.
As
such
it
is
also
not
fully
active
as
its
predecessor,
unless
that
document
specified
a
different
cross-origin
opener
policy
.
b-2.html
same-origin-allow-popups
This
forces
the
active
document
creation
of
a
new
top-level
browsing
context
B,
for
the
document,
unless
its
predecessor
specified
the
same
cross-origin
opener
policy
and
is
also
fully
active
they
are
same
origin
.
c.html
same-origin
This
behaves
the
same
as
"
same-origin-allow-popups
is
still
",
with
the
active
document
of
addition
that
any
auxiliary
browsing
context
C.
However,
since
C's
container
document
is
created
needs
to
contain
same
origin
documents
that
also
have
the
b-1.html
Document
same
cross-origin
opener
policy
,
which
is
itself
not
fully
active
,
this
means
or
it
will
appear
closed
to
the
opener.
c.html
same-origin-plus-COEP
This
behaves
the
same
as
"
same-origin
is
now
not
fully
active
(even
though
it
is
active
).
For
more
explorations
of
",
with
the
complexities
involved
here,
especially
as
addition
that
it
impacts
sets
the
session
history
,
see
A
Model
of
Navigation
History
.
[NAVMODEL]
A
child
(new)
top-level
browsing
context
can
be
put
into
a
delaying
load
events
's
group
's
cross-origin
isolation
mode
.
This
is
used
when
it
is
navigated
,
to
delay
the
load
event
to
one
of
its
container
"
logical
"
or
"
before
the
new
Document
concrete
is
created.
".
"
Document
same-origin-plus-COEP
objects
in
that
browsing
context
's
session
history
and
"
cannot
be
directly
set
via
the
document
families
`
Cross-Origin-Opener-Policy
`
header,
but
results
from
a
combination
of
all
those
setting
both
`
Document
Cross-Origin-Opener-Policy
:
same-origin
objects.
The
document
family
of
`
and
a
`
Document
Cross-Origin-Embedder-Policy
object
consists
of
the
union
of
all
the
document
families
of
the
browsing
contexts
`
header
whose
value
is
compatible
with
cross-origin
isolation
in
the
list
of
the
descendant
browsing
contexts
together.
A cross-origin opener policy consists of:
A
value
,
which
is
a
cross-origin
opener
policy
value
,
initially
"
unsafe-none
".
of
the
Document
A reporting endpoint , which is string or null, initially null.
A
report-only
value
,
which
is
a
cross-origin
opener
policy
value
,
initially
"
unsafe-none
object.
".
The
content
document
of
A
report-only
reporting
endpoint
,
which
is
a
browsing
context
container
string
or
null,
initially
null.
To
match
cross-origin
opener
policy
values
,
given
a
cross-origin
opener
policy
value
container
is
the
result
of
the
following
algorithm:
A
,
an
origin
originA
,
a
cross-origin
opener
policy
value
B
,
and
an
origin
originB
:
If
container
A
's
nested
browsing
context
is
"
unsafe-none
"
and
B
is
null,
"
unsafe-none
",
then
return
null.
true.
Let
context
be
If
container
A
's
nested
browsing
context
.
is
"
"
or
Let
document
be
unsafe-none
context
B
's
active
document
.
is
"
unsafe-none
",
then
return
false.
If
document
A
is
B
's
origin
and
container
originA
's
node
document
's
is
same
origin
are
not
same
origin-domain
,
with
originB
,
then
return
null.
true.
Return
document
.
false.
Window/top
Headers/Cross-Origin-Opener-Policy
Support in all current engines.
Returns
the
A
WindowProxy
Document
for
's
cross-origin
opener
policy
is
derived
from
the
top-level
browsing
context
.
`
window
.
opener
[
=
value
]
Cross-Origin-Opener-Policy
✔
MDN
`
and
`
Cross-Origin-Opener-Policy-Report-Only
`
HTTP
response
headers.
These
headers
are
structured
headers
whose
value
must
be
a
token
.
[STRUCTURED-FIELDS]
Window/opener
The
valid
token
values
are
the
opener
policy
values
.
The
token
may
also
have
attached
parameters
;
of
these,
the
"
Support
in
all
current
engines.
Firefox
1+
Safari
1+
Chrome
1+
Opera
3+
Edge
79+
Edge
(Legacy)
12+
Internet
Explorer
9+
report-to
"
parameter
can
have
a
valid
URL
string
identifying
an
appropriate
reporting
endpoint.
[REPORTING]
Per the processing model described below, user agents will ignore this header if it contains an invalid value. Likewise, user agents will ignore this header if the value cannot be parsed as a token .
To obtain a cross-origin opener policy given a response response and an environment reservedEnvironment :
Let policy be a new cross-origin opener policy .
If reservedEnvironment is a non-secure context , then return policy .
Returns
Let
value
be
the
result
of
getting
a
structured
field
value
given
`
WindowProxy
Cross-Origin-Opener-Policy
for
the
opener
browsing
context
`
and
"
item
"
from
response
's
header
list
.
Returns
null
if
there
isn't
one
or
if
it
has
been
set
to
null.
Can
be
set
to
null.
If
parsedItem
is
not
null,
then:
If
window
.
parent
parsedItem
[0]
is
"
same-origin
",
then:
Window/parent
Let
coep
be
the
result
of
obtaining
a
cross-origin
embedder
policy
from
response
and
reservedEnvironment
.
If
coep
's
value
is
compatible
with
cross-origin
isolation
,
then
set
policy
's
value
to
"
".
WebView
Android
same-origin-plus-COEP
?
Otherwise,
set
policy
's
value
to
"
same-origin
".
Samsung
Internet
If
parsedItem
[0]
is
"
same-origin-allow-popups
",
then
set
policy
's
value
to
"
".
Opera
Android
same-origin-allow-popups
10.1+
If
parsedItem
[1]["
report-to
"]
exists
and
it
is
a
string,
then
set
policy
's
reporting
endpoint
to
parsedItem
[1]["
report-to
"].
Returns
Set
parsedItem
to
the
result
of
getting
a
structured
field
value
given
`
WindowProxy
Cross-Origin-Opener-Policy-Report-Only
for
the
parent
browsing
context
.
`
and
"
item
"
from
response
's
header
list
.
If parsedItem is not null, then:
If
window
.
frameElement
parsedItem
[0]
is
"
same-origin
",
then:
) in which the window is embedded.">
Window/frameElement
Let
coep
be
the
result
of
obtaining
a
cross-origin
embedder
policy
from
response
and
reservedEnvironment
.
If
coep
's
value
is
compatible
with
cross-origin
isolation
or
coep
's
report-only
value
is
compatible
with
cross-origin
isolation
,
then
set
policy
's
report-only
value
to
"
".
Support
in
all
current
engines.
Firefox
1+
Safari
3+
Chrome
1+
Opera
12.1+
Edge
79+
Edge
(Legacy)
12+
Internet
Explorer
5.5+
same-origin-plus-COEP
Report
only
COOP
also
considers
report-only
COEP
to
assign
the
special
"
same-origin-plus-COEP
"
value.
This
allows
developers
more
freedom
in
the
order
of
deployment
of
COOP
and
COEP.
Otherwise,
set
policy
's
report-only
value
to
"
".
?
same-origin
If
parsedItem
[0]
is
"
",
then
set
policy
's
report-only
value
to
"
Safari
iOS
same-origin-allow-popups
1+
same-origin-allow-popups
".
If
parsedItem
[1]["
"]
exists
and
it
is
a
string,
then
set
policy
's
report-only
reporting
endpoint
to
parsedItem
[1]["
?
report-to
report-to
"].
WebView
Android
Return policy .
To check if COOP values require a browsing context group switch , given a boolean isInitialAboutBlank , two origins responseOrigin and activeDocumentNavigationOrigin , and two cross-origin opener policy values responseCOOPValue and activeDocumentCOOPValue :
If the result of matching activeDocumentCOOPValue , activeDocumentNavigationOrigin , responseCOOPValue , and responseOrigin is true, return false.
If all of the following are true:
12.1+
isInitialAboutBlank
;
activeDocumentCOOPValue
's
value
is
"
same-origin-allow-popups
";
and
Returns
the
Element
responseCOOPValue
is
"
unsafe-none
for
the
browsing
context
container
.
"
then return false.
Returns
null
Return
true.
To
check
if
there
isn't
one,
enforcing
report-only
COOP
would
require
a
browsing
context
group
switch
,
given
a
boolean
isInitialAboutBlank
,
two
origins
responseOrigin
,
activeDocumentNavigationOrigin
,
and
in
two
cross-origin
situations.
opener
policies
responseCOOP
and
activeDocumentCOOP
:
If the result of checking if COOP values require a browsing context group switch given isInitialAboutBlank , responseOrigin , activeDocumentNavigationOrigin , responseCOOP 's report-only value and activeDocumentCOOPReportOnly 's report-only value is false, then return false.
Matching
report-only
policies
allows
a
website
to
specify
the
same
report-only
cross-origin
opener
policy
on
all
its
pages
and
not
receive
violation
reports
for
navigations
between
these
steps:
pages.
If
this
Window
the
result
of
checking
if
COOP
values
require
a
browsing
context
group
switch
given
isInitialAboutBlank
,
responseOrigin
,
activeDocumentNavigationOrigin
,
responseCOOP
's
value
and
activeDocumentCOOPReportOnly
's
report-only
value
is
true,
then
return
true.
If
the
result
of
checking
if
COOP
values
require
a
browsing
context
group
switch
given
isInitialAboutBlank
,
responseOrigin
,
activeDocumentNavigationOrigin
,
responseCOOP
's
report-only
value
and
activeDocumentCOOPReportOnly
's
value
is
null,
true,
then
return
null.
true.
Return
this
Window
false.
A cross-origin opener policy enforcement result is a struct with the following items :
A
boolean
needs
a
browsing
context
's
top-level
group
switch
,
initially
false.
A
boolean
would
need
a
browsing
context
's
group
switch
due
to
report-only
,
initially
false.
A URL url .
The
An
origin
origin
.
A cross-origin opener policy cross-origin opener policy .
A boolean current context is navigation source .
To enforce a response's cross-origin opener policy , given a browsing context browsingContext , a URL responseURL , an origin responseOrigin , a cross-origin opener policy responseCOOP , a cross-origin opener policy enforcement result currentCOOPEnforcementResult , and a referrer referrer :
Let
current
newCOOPEnforcementResult
be
this
a
new
cross-origin
opener
policy
enforcement
result
whose
needs
a
browsing
context
group
switch
is
currentCOOPEnforcementResult
's
needs
a
browsing
context
.
If
group
switch
,
would
need
a
browsing
context
group
switch
due
to
report-only
is
current
currentCOOPEnforcementResult
's
would
need
a
browsing
context
group
switch
due
to
report-only
,
url
is
null,
then
return
null.
responseURL
,
origin
is
responseOrigin
,
coop
is
responseCOOP
,
and
current
context
is
navigation
source
is
true.
If
Let
current
isInitialAboutBlank
be
browsingContext
's
disowned
active
document
's
is
true,
then
return
null.
initial
about:blank
.
If
current
isInitialAboutBlank
is
true
and
browsingContext
's
opener
browsing
context
initial
URL
is
null,
then
return
null.
Return
set
current
browsingContext
's
opener
initial
URL
to
responseURL
.
If
the
result
of
checking
if
COOP
values
require
a
browsing
context
group
switch
given
isInitialAboutBlank
,
currentCOOPEnforcementResult
's
WindowProxy
object.
The
cross-origin
opener
policy
setter
steps
are:
's
value
,
currentCOOPEnforcementResult
's
origin
,
responseCOOP
's
value
,
and
responseOrigin
is
true,
then:
If
the
given
value
is
null
and
this
Set
newCOOPEnforcementResult
's
needs
a
browsing
context
group
switch
is
non-null,
then
set
this
to
true.
If
browsingContext
's
group
's
browsing
context
set
's
disowned
size
is
greater
than
1,
then:
Queue
a
violation
report
for
browsing
context
group
switch
when
navigating
to
true.
a
COOP
response
with
responseCOOP
,
"
enforce
",
responseURL
,
currentCOOPEnforcementResult
's
url
,
currentCOOPEnforcementResult
's
origin
,
responseOrigin
,
and
referrer
.
If
the
given
value
is
non-null,
then
return
?
OrdinaryDefineOwnProperty
Queue
a
violation
report
for
browsing
context
group
switch
when
navigating
away
from
a
COOP
response
(
this
with
currentCOOPEnforcementResult
's
cross-origin
opener
policy
,
"
",
opener
enforce
{
[[Value]]:
the
given
value,
[[Writable]]:
true,
[[Enumerable]]:
true,
[[Configurable]]:
true
}).
currentCOOPEnforcementResult
's
url
,
responseURL
,
currentCOOPEnforcementResult
's
origin
,
responseOrigin
,
and
currentCOOPEnforcementResult
's
current
context
is
navigation
source
.
If
the
result
of
checking
if
enforcing
report-only
COOP
would
require
a
browsing
context
group
switch
given
isInitialAboutBlank
,
responseOrigin
,
currentCOOPEnforcementResult
's
disowned
origin
,
responseCOOP
,
and
currentCOOPEnforcementResult
's
cross-origin
opener
policy
,
is
true,
its
then:
Set
result
's
would
need
a
browsing
context
group
switch
due
to
report-only
from
changing
any
properties
of
its
opener
to
true.
If
browsingContext
's
group
's
browsing
context
set
's
Window
size
is
greater
than
1,
then:
object
from
which
the
Queue
a
violation
report
for
browsing
context
group
switch
when
navigating
to
a
COOP
response
was
created).
with
responseCOOP
,
"
reporting
",
responseURL
,
currentCOOPEnforcementResult
's
url
,
currentCOOPEnforcementResult
's
origin
,
responseOrigin
,
and
referrer
.
Otherwise,
if
Queue
a
violation
report
for
browsing
context
group
switch
when
navigating
away
from
a
COOP
response
with
currentCOOPEnforcementResult
's
disowned
cross-origin
opener
policy
,
"
reporting
",
currentCOOPEnforcementResult
's
url
,
responseURL
,
currentCOOPEnforcementResult
's
origin
,
responseOrigin
,
and
currentCOOPEnforcementResult
's
current
context
is
false,
then
scripts
in
that
navigation
source
.
Return newCOOPEnforcementResult .
To
obtain
a
browsing
context
can
use
window.opener
to
change
properties
of
its
opener
use
for
a
navigation
response
,
given
a
browsing
context
's
Window
object.
For
example,
browsingContext
,
a
script
running
in
the
browsing
context
sandboxing
flag
set
can
change
the
value
of
window.opener.location
,
causing
the
sandboxFlags
,
a
cross-origin
opener
browsing
context
policy
to
navigate
to
navigationCOOP
,
and
a
completely
different
document.
The
parent
attribute's
getter
must
run
these
steps:
cross-origin
opener
policy
enforcement
result
coopEnforcementResult
:
Let
If
current
browsingContext
be
this
Window
object's
is
not
a
top-level
browsing
context
.
,
then
return
browsingContext
.
If
current
coopEnforcementResult
's
needs
a
browsing
context
group
switch
is
null,
then
return
null.
false,
then:
If
current
coopEnforcementResult
is
's
would
need
a
child
browsing
context
group
switch
due
to
report-only
of
another
is
true,
set
browsing
context
parent
,
then
return
parent
's
WindowProxy
virtual
browsing
context
group
ID
object.
to
a
new
unique
identifier.
Assert
:
Return
current
browsingContext
.
Let
newBrowsingContext
is
be
the
first
return
value
of
creating
a
new
top-level
browsing
context
and
document
.
In
this
case
we
are
going
to
perform
a
browsing
context
group
swap.
browsingContext
will
not
be
used
by
the
new
Document
that
we
are
about
to
create
.
If
it
is
not
used
by
other
Document
s
either
(such
as
ones
in
the
back/forward
cache),
then
the
user
agent
might
destroy
it
at
this
point.
Return
If
current
navigationCOOP
's
value
is
"
WindowProxy
same-origin-plus-COEP
object.
The
",
then
set
newBrowsingContext
's
group
's
cross-origin
isolation
mode
to
either
"
logical
"
or
"
frameElement
".
The
choice
of
which
is
implementation-defined
.
getter
steps
are:
concrete
It
is
difficult
on
some
platforms
to
provide
the
security
properties
required
by
the
cross-origin
isolated
capability
.
"
concrete
"
grants
access
to
it
and
"
Let
current
be
this
Window
logical
object's
browsing
context
.
"
does
not.
If
current
sandboxFlags
is
null,
then
return
null.
not
empty,
then:
Let
container
be
Assert
current
navigationCOOP
's
container
.
value
is
"
unsafe-none
".
If
Assert
:
container
newBrowsingContext
's
popup
sandboxing
flag
set
is
null,
then
return
null.
empty
.
If
Set
container
newBrowsingContext
's
node
document
's
origin
is
not
same
origin-domain
popup
sandboxing
flag
set
with
the
current
settings
object
to
a
clone
's
origin
,
then
return
null.
of
sandboxFlags
.
Return
container
newBrowsingContext
.
Here
An
accessor-accessed
relationship
is
an
enum
that
describes
the
relationship
between
two
browsing
context
corresponding
to
iframeWindow
was
discarded
contexts
when
element
was
removed
from
between
which
an
access
happened.
It
can
take
the
document.
following
values:
The
accessor
browsing
context
B
if
or
one
of
the
following
conditions
is
true:
Either
the
origin
of
the
active
document
its
ancestors
of
A
is
the
same
as
the
origin
opener
browsing
context
of
the
active
document
of
B
,
or
The
browsing
context
A
is
a
child
accessed
browsing
context
and
its
's
top-level
browsing
context
.
The
accessed
browsing
context
B
or
one
of
its
ancestors
is
an
auxiliary
the
opener
browsing
context
and
A
is
familiar
with
B
's
opener
of
the
accessor
browsing
context
,
or
The
's
top-level
browsing
context
B
.
There
is
not
a
top-level
no
opener
relationship
between
the
accessor
browsing
context
,
but
there
exists
an
ancestor
the
accessor
browsing
context
of
B
whose
active
document
has
the
same
origin
as
the
active
document
,
or
any
of
A
(possibly
in
fact
being
A
itself).
their
ancestors
.
A
To
check
if
an
access
between
two
browsing
context
contexts
should
be
reported
,
given
two
browsing
contexts
A
accessor
is
allowed
to
navigate
and
accessed
,
a
second
browsing
context
JavaScript
property
name
P
,
and
an
environment
settings
object
B
if
the
following
algorithm
returns
true:
environment
:
If
A
P
is
not
the
same
browsing
context
as
a
cross-origin
accessible
window
property
name
,
then
return.
Assert
:
B
,
accessor
's
active
document
and
A
accessed
is
not
one
of
the
ancestor
browsing
contexts
's
active
document
of
are
both
fully
active
.
Let
B
,
and
accessorTopDocument
be
B
accessor
is
not
a
's
top-level
browsing
context
,
and
's
active
document
.
Let
A
accessorInclusiveAncestorOrigins
's
be
the
list
obtained
by
taking
the
origin
of
the
active
document
of
each
of
accessor
's
active
sandboxing
flag
set
has
its
sandboxed
navigation
browsing
context
flag
document
set,
then
return
false.
's
inclusive
ancestor
navigables
.
Otherwise,
if
Let
B
accessedTopDocument
is
a
be
accessed
's
top-level
browsing
context
,
and
is
one
of
the
ancestor
browsing
contexts
of
A
,
then:
's
active
document
.
If
Let
A
accessedInclusiveAncestorOrigins
's
active
window
be
the
list
obtained
by
taking
the
origin
has
transient
activation
of
the
active
document
and
of
each
of
A
accessed
's
active
document
's
active
sandboxing
flag
set
inclusive
ancestor
navigables
.
If
any
of
accessorInclusiveAncestorOrigins
are
not
same
origin
has
its
sandboxed
top-level
navigation
with
user
activation
browsing
context
flag
accessorTopDocument
's
origin
,
or
if
any
of
accessedInclusiveAncestorOrigins
are
not
same
origin
set,
with
accessedTopDocument
's
origin
,
then
return
false.
return.
This avoids leaking information about cross-origin iframes to a top level frame with cross-origin opener policy reporting.
Otherwise,
if
If
A
accessor
's
active
window
top-level
browsing
context
does
not
have
transient
activation
's
virtual
browsing
context
group
ID
and
is
A
accessed
's
active
document
's
active
sandboxing
flag
set
has
its
sandboxed
top-level
navigation
without
user
activation
browsing
context
flag
set,
's
virtual
browsing
context
group
ID
,
then
return
false.
return.
Otherwise,
if
Let
B
accessorAccessedRelationship
is
be
a
new
accessor-accessed
relationship
with
value
none
.
If
accessed
's
top-level
browsing
context
,
and
's
opener
browsing
context
is
neither
A
accessor
nor
one
of
the
or
is
an
ancestor
browsing
contexts
of
A
accessor
,
and
then
set
A
accessorAccessedRelationship
's
Document
to
accessor
is
opener
.
If
accessor
's
active
sandboxing
flag
set
top-level
browsing
context
has
its
sandboxed
navigation
's
opener
browsing
context
flag
set,
and
is
A
accessed
or
is
not
the
one
permitted
sandboxed
navigator
an
ancestor
of
B
accessed
,
then
return
false.
set
accessorAccessedRelationship
to
accessor
is
openee
.
Return
true.
An
element
has
a
browsing
context
scope
origin
if
its
Document
Queue
violation
reports
for
accesses
,
given
accessorAccessedRelationship
,
accessorTopDocument
's
cross-origin
opener
policy
,
accessedTopDocument
's
cross-origin
opener
policy
,
accessor
's
active
document
's
browsing
context
URL
,
accessed
's
active
document
is
a
's
URL
,
accessor
's
top-level
browsing
context
or
if
all
of
its
Document
's
ancestor
initial
URL
,
accessed
's
top-level
browsing
contexts
context
all
have
's
initial
URL
,
accessor
's
active
documents
whose
origins
document
are
the
same
's
origin
as
the
element's
node
,
accessed
's
active
document
's
origin
.
If
an
element
has
a
,
accessor
's
top-level
browsing
context
scope
's
opener
origin
at
creation
,
then
its
value
is
the
origin
of
the
element's
node
document
.
7.1.4
Groupings
of
accessed
's
top-level
browsing
contexts
context
's
opener
origin
at
creation
,
accessorTopDocument
's
referrer
,
accessedTopDocument
's
referrer
,
P
,
and
environment
.
A
user
agent
holds
To
sanitize
a
browsing
context
group
set
URL
to
send
in
a
report
(a
set
of
browsing
context
groups
given
a
URL
).
url
:
A
browsing
context
group
holds
Let
sanitizedURL
be
a
browsing
context
set
(a
set
copy
of
top-level
browsing
contexts
).
A
top-level
browsing
context
is
added
to
url
.
Set
the
group
username
when
given
sanitizedURL
and
the
group
is
created
.
All
subsequent
top-level
browsing
contexts
added
to
empty
string.
Set
the
group
password
will
be
auxiliary
browsing
contexts
.
given
sanitizedURL
and
the
empty
string.
A
browsing
context
group
has
an
associated
agent
cluster
map
(a
weak
map
Return
the
serialization
of
agent
cluster
keys
sanitizedURL
with
exclude
fragment
set
to
agent
clusters
).
User
agents
are
responsible
for
collecting
agent
clusters
when
it
is
deemed
that
nothing
can
access
them
anymore.
true.
A
To
queue
a
violation
report
for
browsing
context
group
switch
when
navigating
to
a
COOP
response
given
a
cross-origin
opener
policy
has
an
associated
historical
agent
cluster
key
map
,
which
is
coop
,
a
map
string
disposition
,
a
URL
of
origins
coopURL
,
a
URL
to
agent
cluster
keys
.
This
map
is
used
to
ensure
the
consistency
of
the
origin-keyed
agent
clusters
previousResponseURL
,
two
origins
feature
by
recording
what
agent
cluster
keys
were
previously
used
for
coopOrigin
and
previousResponseOrigin
,
and
a
given
origin.
The
historical
agent
cluster
key
map
referrer
only
ever
gains
entries
over
the
lifetime
of
the
browsing
context
group.
referrer
:
A
browsing
context
group
If
coop
's
reporting
endpoint
has
a
cross-origin
isolation
mode
,
which
is
a
cross-origin
isolation
mode
null,
return.
Let
coopValue
be
coop
's
value
.
It
If
disposition
is
initially
"
reporting
",
then
set
coopValue
to
coop
's
report-only
value
.
Let serializedReferrer be an empty string.
A
cross-origin
isolation
mode
If
referrer
is
one
a
URL
,
set
serializedReferrer
to
the
serialization
of
three
possible
values:
"
referrer
.
Let body be a new object containing the following properties:
| key | value |
|---|---|
| disposition |
|
| effectivePolicy |
|
| previousResponseURL |
If
coopOrigin
and
previousResponseOrigin
are
|
| referrer |
|
| type |
"
navigation-to-response
|
every
Document
has
a
`
Cross-Origin-Embedder-Policy
Queue
`
header
whose
value
is
compatible
with
cross-origin
isolation
.
On
some
platforms,
it
is
difficult
to
provide
the
security
properties
required
to
grant
safe
access
to
the
APIs
gated
by
the
cross-origin
isolated
capability
.
As
a
result,
only
body
as
"
concrete
coop
"
can
grant
access
that
capability.
"
logical
for
coop
's
reporting
endpoint
"
is
used
on
platform
not
supporting
this
capability,
where
various
restrictions
imposed
by
cross-origin
isolation
will
still
apply,
but
the
capability
is
not
granted.
with
coopURL
.
To
create
queue
a
new
violation
report
for
browsing
context
group
,
run
these
steps:
switch
when
navigating
away
from
a
COOP
response
given
a
cross-origin
opener
policy
coop
,
a
string
disposition
,
a
URL
coopURL
,
a
URL
nextResponseURL
,
two
origins
coopOrigin
and
nextResponseOrigin
,
and
a
boolean
isCOOPResponseNavigationSource
:
If coop 's reporting endpoint is null, return.
Let
group
coopValue
be
a
new
browsing
context
group
coop
's
value
.
Append
If
group
disposition
to
the
user
agent's
browsing
context
group
is
"
reporting
",
then
set
coopValue
to
coop
's
report-only
value
.
Let
browsingContext
body
be
the
result
of
creating
a
new
browsing
context
with
null,
null,
and
group
.
object
containing
the
following
properties:
| key | value |
|---|---|
| disposition |
|
| effectivePolicy |
|
| nextResponseURL |
If
|
| type |
"
navigation-from-response
"
|
Append
Queue
browsingContext
to
group
body
's
browsing
context
set
.
Set
as
"
coop
"
for
browsingContext
coop
's
group
reporting
endpoint
to
with
group
coopURL
.
To
remove
a
top-level
browsing
context
queue
violation
reports
for
accesses
,
given
an
accessor-accessed
relationship
browsingContext
accessorAccessedRelationship
,
run
these
steps:
two
cross-origin
opener
policies
accessorCOOP
and
accessedCOOP
,
four
URLs
accessorURL
,
accessedURL
,
accessorInitialURL
,
accessedInitialURL
,
four
origins
accessorOrigin
,
accessedOrigin
,
accessorCreatorOrigin
and
accessedCreatorOrigin
,
two
referrers
accessorReferrer
and
accessedReferrer
,
a
string
propertyName
,
and
an
environment
settings
object
environment
:
Assert
:
If
browsingContext
coop
's
group
reporting
endpoint
is
non-null,
because
a
browsing
context
only
gets
discarded
once.
null,
return.
Let
group
coopValue
be
browsingContext
coop
's
group
value
.
Set
If
browsingContext
disposition
's
group
to
null.
Remove
is
"
reporting
",
then
set
browsingContext
coopValue
from
to
group
coop
's
browsing
context
set
report-only
value
.
If
group
accessorAccessedRelationship
's
browsing
context
set
is
empty
accessor
is
opener
:
Queue
a
violation
report
for
access
to
an
opened
window
,
then
remove
given
group
from
the
user
agent's
browsing
context
group
set
.
Append
accessorCOOP
,
accessorURL
,
accessedURL
,
accessedInitialURL
,
accessorOrigin
,
accessedOrigin
,
accessedCreatorOrigin
,
propertyName
,
and
remove
are
primitive
operations
that
help
define
the
lifetime
of
environment
.
Queue
a
browsing
context
group
.
They
are
called
violation
report
for
access
from
creating
a
new
browsing
context
group
the
opener
,
creating
given
accessedCOOP
,
accessedURL
,
accessorURL
,
accessedOrigin
,
accessorOrigin
,
propertyName
,
and
accessedReferrer
.
Otherwise, if accessorAccessedRelationship is accessor is openee :
Queue
a
new
auxiliary
browsing
context
violation
report
for
access
to
the
opener
,
given
accessorCOOP
,
accessorURL
,
accessedURL
,
accessorOrigin
,
accessedOrigin
,
propertyName
,
accessorReferrer
,
and
discarding
environment
.
Queue
a
browsing
context
.
The
HTML
Standard
used
to
define
"
unit
of
related
browsing
contexts
"
violation
report
for
access
from
an
opened
window
,
given
accessedCOOP
,
accessedURL
,
accessorURL
,
accessorInitialURL
,
accessedOrigin
,
accessorOrigin
,
accessorCreatorOrigin
,
and
"
unit
of
related
similar-origin
browsing
contexts
".
These
have
been
removed
as
they
were
not
adequate.
propertyName
.
Otherwise:
Browsing
contexts
can
have
Queue
a
browsing
context
name
.
Unless
stated
otherwise,
it
is
the
empty
string.
violation
report
for
access
to
another
window
,
given
accessorCOOP
,
accessorURL
,
accessedURL
,
accessorOrigin
,
accessedOrigin
,
propertyName
,
and
environment
A
valid
browsing
context
name
is
any
string
with
at
least
one
character
that
does
not
start
with
Queue
a
U+005F
LOW
LINE
character.
(Names
starting
with
an
underscore
are
reserved
violation
report
for
special
keywords.)
access
from
another
window
,
given
accessedCOOP
,
accessedURL
,
accessorURL
,
accessedOrigin
,
accessorOrigin
,
and
propertyName
.
A
valid
browsing
context
name
or
keyword
is
any
string
that
is
either
To
queue
a
valid
browsing
context
name
or
that
is
an
ASCII
case-insensitive
match
violation
report
for
one
of:
_blank
,
_self
,
_parent
,
or
_top
.
These
values
have
different
meanings
based
on
whether
the
page
is
sandboxed
or
not,
as
summarized
in
the
following
(non-normative)
table.
In
this
table,
"current"
means
access
to
the
browsing
context
opener
,
given
a
cross-origin
opener
policy
that
the
link
or
script
is
in,
"parent"
means
the
parent
browsing
context
coop
,
two
URLs
of
the
one
the
link
or
script
is
in,
"top"
means
the
top-level
browsing
context
coopURL
and
openerURL
,
two
origins
of
the
one
the
link
or
script
is
in,
"new"
means
coopOrigin
and
openerOrigin
,
a
new
top-level
browsing
context
or
auxiliary
browsing
context
string
propertyName
,
a
referrer
is
to
be
created,
subject
to
various
user
preferences
referrer
,
and
user
agent
policies,
"none"
means
that
nothing
will
happen,
an
environment
settings
object
environment
:
Let
sourceFile
,
lineNumber
and
"maybe
new"
means
the
same
as
"new"
if
columnNumber
be
the
"
relevant
script
URL
and
problematic
position
which
triggered
this
report.
Let serializedReferrer be an empty string.
If
referrer
is
also
specified
on
a
URL
,
set
serializedReferrer
to
the
sandbox
serialization
attribute
(or
if
the
user
overrode
the
sandboxing),
and
of
referrer
.
Let
body
be
a
new
object
containing
the
same
as
"none"
otherwise.
following
properties:
|
|
|
|---|---|
|
|
reporting
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| type |
"
|
Queue
body
as
"
_parent
coop
if
there
is
one
"
for
coop
's
reporting
endpoint
with
coopURL
and
it's
not
top
parent
none
none
environment
.
To queue a violation report for access to an opened window , given a cross-origin opener policy coop , three URLs coopURL , openedWindowURL and initialWindowURL , three origins coopOrigin , openedWindowOrigin , and openerInitialOrigin , a string propertyName , and an environment settings object environment :
Let sourceFile , lineNumber and columnNumber be the relevant script URL and problematic position which triggered this report.
Let body be a new object containing the following properties:
| key | value |
|---|---|
| disposition |
"
|
|
|
|
|
|
|
|
|
If
coopOrigin
and
openedWindowOrigin
are
same
origin
,
this
is
|
|
|
If
coopOrigin
and
openerInitialOrigin
are
same
origin
,
this
is
|
|
|
|
|
|
|
|
|
|
|
|
"
access-to-opener
"
|
Queue
body
as
"
coop
"
for
coop
's
reporting
endpoint
with
coopURL
and
environment
.
To
queue
a
violation
report
for
access
to
another
window
,
given
a
cross-origin
opener
policy
coop
,
two
URLs
coopURL
and
otherURL
,
two
origins
coopOrigin
and
otherOrigin
,
a
string
propertyName
,
and
is
an
ancestor
that
is
not
top
specified
ancestor
environment
settings
object
environment
:
Let sourceFile , lineNumber and columnNumber be the relevant script URL and problematic position which triggered this report.
Let body be a new object containing the following properties:
| key | value |
|---|---|
|
|
reporting
"
|
|
|
|
|
|
|
|
|
If
coopOrigin
and
|
|
|
|
|
|
|
|
|
|
|
|
access-to-opener
"
|
Queue
algorithm,
not
the
rules
body
as
"
coop
"
for
choosing
a
browsing
context
coop
's
reporting
endpoint
given
below.
with
coopURL
and
environment
.
The
rules
for
choosing
To
queue
a
browsing
context
violation
report
for
access
from
the
opener
,
given
a
browsing
context
name
cross-origin
opener
policy
name
coop
,
a
browsing
context
two
URLs
current
coopURL
and
openerURL
,
two
origins
coopOrigin
and
openerOrigin
,
a
boolean
string
noopener
are
as
follows:
propertyName
,
and
a
referrer
referrer
:
Let
If
chosen
coop
be
null.
's
reporting
endpoint
is
null,
return.
Let
windowType
serializedReferrer
be
"
existing
or
none
".
an
empty
string.
If referrer is a URL , set serializedReferrer to the serialization of referrer .
Let
sandboxingFlagSet
body
be
a
new
object
containing
the
following
properties:
| key | value |
|---|---|
| disposition |
"
reporting
"
|
| effectivePolicy |
|
| property | propertyName |
| openerURL |
If
|
| referrer | serializedReferrer |
| type |
"
|
Queue
chosen
body
to
as
"
coop
"
for
current
coop
's
reporting
endpoint
with
coopURL
.
To queue a violation report for access from an opened window , given a cross-origin opener policy coop , three URLs coopURL , openedWindowURL and initialWindowURL , three origins coopOrigin , openedWindowOrigin , and openerInitialOrigin , and a string propertyName :
Otherwise,
if
If
name
coop
is
an
ASCII
case-insensitive
's
reporting
endpoint
match
for
is
null,
return.
Let body be a new object containing the following properties:
| key | value |
|---|---|
| disposition |
"
|
| effectivePolicy |
|
| property |
|
| openedWindowURL |
If
coopOrigin
and
|
| openedWindowInitialURL |
If
|
| type |
"
|
Queue
chosen
body
to
as
"
coop
"
for
current
coop
's
top-level
browsing
context
,
if
any,
reporting
endpoint
with
coopURL
.
To
queue
a
violation
report
for
access
from
another
window
,
given
a
cross-origin
opener
policy
coop
,
two
URLs
coopURL
and
current
otherURL
,
two
origins
coopOrigin
otherwise.
and
otherOrigin
,
and
a
string
propertyName
:
Otherwise,
if
If
name
coop
is
not
an
ASCII
case-insensitive
's
reporting
endpoint
match
for
is
null,
return.
Let body be a new object containing the following properties:
| key | value |
|---|---|
| disposition |
"
|
| effectivePolicy | coop 's report-only value |
| property | propertyName |
| otherURL |
If
coopOrigin
and
otherOrigin
are
same
origin
,
this
is
the
|
| type |
access-to-opener
|
Queue
current
body
is
familiar
as
"
coop
"
for
coop
's
reporting
endpoint
with
coopURL
.
Headers/Cross-Origin-Embedder-Policy
Support in all current engines.
An
embedder
policy
value
is
one
of
three
strings
that
browsing
context,
and
controls
the
user
agent
determines
that
fetching
of
cross-origin
resources
without
explicit
permission
from
resource
owners.
unsafe-none
"
This
is
the
two
browsing
contexts
default
value.
When
this
value
is
used,
cross-origin
resources
can
be
fetched
without
giving
explicit
permission
through
the
CORS
protocol
or
the
`
Cross-Origin-Resource-Policy
`
header.
require-corp
"
When
this
value
is
used,
fetching
cross-origin
resources
requires
the
server's
explicit
permission
through
the
CORS
protocol
or
the
`
Cross-Origin-Resource-Policy
`
header.
credentialless
"
When
this
value
is
used,
fetching
cross-origin
no-CORS
resources
omits
credentials.
In
exchange,
an
explicit
`
Cross-Origin-Resource-Policy
`
header
is
not
required.
Other
requests
sent
with
credentials
require
the
server's
explicit
permission
through
the
CORS
protocol
or
the
`
Cross-Origin-Resource-Policy
`
header.
Before
supporting
"
credentialless
",
implementers
are
related
enough
that
strongly
encouraged
to
support
both:
Otherwise,
it
is
ok
if
they
reach
each
other,
set
chosen
would
allow
attackers
to
that
browsing
context.
If
there
are
multiple
matching
browsing
contexts,
leverage
the
user
agent
should
set
chosen
client's
network
position
to
one
in
some
arbitrary
consistent
manner,
such
as
read
non
public
resources,
using
the
most
recently
opened,
most
recently
focused,
cross-origin
isolated
capability
.
An
embedder
policy
value
is
compatible
with
cross-origin
isolation
if
it
is
"
credentialless
"
or
more
closely
related.
"
require-corp
".
An embedder policy consists of:
Otherwise,
a
new
browsing
context
A
value
,
which
is
being
requested,
and
what
happens
depends
on
an
embedder
policy
value
,
initially
"
unsafe-none
".
A
reporting
endpoint
string,
initially
the
user
agent's
configuration
and
abilities
—
it
empty
string.
A
report
only
value
,
which
is
determined
by
the
rules
given
for
the
first
applicable
option
from
an
embedder
policy
value
,
initially
"
unsafe-none
".
A
report
only
reporting
endpoint
string,
initially
the
following
list:
empty
string.
The
"
coep
"
report
type
is
a
report
type
whose
value
is
"
coep
".
It
is
visible
to
ReportingObserver
s
.
The
`
Cross-Origin-Embedder-Policy
`
and
the
user
agent
has
been
configured
to
not
show
popups
(i.e.,
the
user
agent
has
a
"popup
blocker"
enabled)
`
Cross-Origin-Embedder-Policy-Report-Only
`
HTTP
response
headers
allow
a
server
to
declare
an
embedder
policy
for
an
environment
settings
object
.
These
headers
are
structured
headers
whose
values
must
be
token
.
[STRUCTURED-FIELDS]
The
user
agent
valid
token
values
are
the
embedder
policy
values
.
The
token
may
inform
also
have
attached
parameters
;
of
these,
the
user
that
"
report-to
"
parameter
can
have
a
popup
has
been
blocked.
If
sandboxingFlagSet
has
the
sandboxed
auxiliary
navigation
browsing
context
flag
valid
URL
string
identifying
an
appropriate
reporting
endpoint.
[REPORTING]
set
The
user
agent
may
report
processing
model
fails
open
(by
defaulting
to
"
unsafe-none
")
in
the
presence
of
a
developer
console
header
that
cannot
be
parsed
as
a
popup
has
been
blocked.
If
token.
This
includes
inadvertent
lists
created
by
combining
multiple
instances
of
the
user
agent
has
been
configured
such
that
`
Cross-Origin-Embedder-Policy
`
header
present
in
this
instance
it
will
create
a
new
browsing
context
given
response:
`
Cross-Origin-Embedder-Policy
`
| Final embedder policy value |
|---|---|
| No header delivered |
"
unsafe-none
"
|
`
|
"
require-corp
"
|
`
unknown-value
`
|
"
unsafe-none
"
|
`
require-corp,
unknown-value
`
|
"
unsafe-none
"
|
`
unknown-value,
unknown-value
`
|
"
unsafe-none
"
|
`
unknown-value,
require-corp
`
|
"
unsafe-none
"
|
`
require-corp,
require-corp
`
|
"
|
(The
same
applies
to
`
Cross-Origin-Embedder-Policy-Report-Only
`.)
To obtain an embedder policy from a response response and an environment environment :
Let
currentDocument
policy
be
current
's
active
document
a
new
embedder
policy
.
If
currentDocument
environment
's
origin
is
not
same
origin
with
currentDocument
's
relevant
settings
object
's
top-level
origin
a
non-secure
context
,
then
set
return
noopener
to
true,
policy
.
Let
name
parsedItem
to
be
the
result
of
getting
a
structured
field
value
with
`
Cross-Origin-Embedder-Policy
`
and
"
_blank
item
",
"
from
response
's
header
list
.
If
parsedItem
is
non-null
and
windowType
parsedItem
to
"
new
[0]
is
compatible
with
no
opener
".
In
the
presence
of
a
cross-origin
opener
policy
,
nested
documents
that
are
cross-origin
with
their
top-level
browsing
context's
active
document
always
set
isolation
:
Set
chosen
parsedItem
to
the
result
of
creating
getting
a
new
auxiliary
browsing
context
structured
field
value
with
`
Cross-Origin-Embedder-Policy-Report-Only
`
and
"
item
"
from
current
.
response
's
header
list
.
If
sandboxingFlagSet
parsedItem
's
sandboxed
navigation
browsing
context
flag
is
set,
then
current
must
be
set
as
non-null
and
chosen
parsedItem
's
one
permitted
sandboxed
navigator
.
[0]
is
compatible
with
cross-origin
isolation
:
If
Set
sandboxingFlagSet
policy
's
sandbox
propagates
to
auxiliary
browsing
contexts
flag
report
only
value
is
set,
then
all
the
flags
that
are
set
in
sandboxingFlagSet
must
be
set
in
to
chosen
parsedItem
's
popup
sandboxing
flag
set
.
[0].
If
name
parsedItem
is
not
an
ASCII
case-insensitive
[1]["
report-to
match
for
"
_blank
",
"]
exists
,
then
set
chosen
policy
's
name
endpoint
to
name
parsedItem
[1]["
report-to
"].
Return policy .
To
check
a
navigation
will
be
done
with
response's
adherence
to
its
embedder
policy
given
a
"
replace
response
"
history
handling
behavior
.
If
the
user
agent
has
been
configured
such
that
in
this
instance
it
will
reuse
current
response
,
a
navigable
navigable
,
and
an
embedder
policy
responsePolicy
:
Set
If
chosen
navigable
to
current
.
If
the
user
agent
has
been
configured
such
that
in
this
instance
it
will
is
not
find
a
browsing
context
child
navigable
,
then
return
true.
Do
nothing.
User
agents
are
encouraged
to
provide
a
way
for
users
to
configure
the
user
agent
to
always
reuse
Let
current
.
parentPolicy
be
navigable
's
container
document
's
policy
container
's
embedder
policy
.
Return
If
chosen
parentPolicy
and
windowType
.
7.2
Security
infrastructure
for
Window
's
report-only
value
,
WindowProxy
is
compatible
with
cross-origin
isolation
,
and
Location
responsePolicy
's
value
is
not,
then
queue
a
cross-origin
embedder
policy
inheritance
violation
with
response
,
"
navigation
objects
",
parentPolicy
's
report
only
reporting
endpoint
,
"
reporting
",
and
navigable
's
container
document
's
relevant
settings
object
.
Although
typically
objects
cannot
be
accessed
across
origins
,
the
web
platform
would
not
be
true
to
itself
if
it
did
If
parentPolicy
's
value
is
not
have
some
legacy
exceptions
to
that
rule
that
the
web
depends
upon.
7.2.1
Integration
compatible
with
IDL
cross-origin
isolation
or
responsePolicy
's
value
is
compatible
with
cross-origin
isolation
,
then
return
true.
When
perform
Queue
a
security
check
cross-origin
embedder
policy
inheritance
violation
is
invoked,
with
response
,
"
navigation
",
parentPolicy
's
reporting
endpoint
,
"
enforce
",
and
navigable
's
container
document
's
relevant
settings
object
.
Return false.
To
check
a
global
object's
embedder
policy
given
a
WorkerGlobalScope
platformObject
workerGlobalScope
,
an
environment
settings
object
identifier
owner
,
and
a
response
type
,
run
these
steps:
response
:
If
platformObject
workerGlobalScope
is
not
a
Window
or
object,
then
Location
DedicatedWorkerGlobalScope
return.
return
true.
For
each
Let
e
policy
of
CrossOriginProperties
(
be
platformObject
workerGlobalScope
):
's
embedder
policy
.
If
SameValue
(
Let
e
.[[Property]],
ownerPolicy
be
identifier
owner
)
is
true,
then:
's
policy
container
's
embedder
policy
.
If
type
ownerPolicy
's
report-only
value
is
compatible
with
cross-origin
isolation
and
policy
's
value
is
not,
then
queue
a
cross-origin
embedder
policy
inheritance
violation
with
response
,
"
",
owner's
policy
's
report
only
reporting
endpoint
,
"
method
worker
initialization
reporting
",
and
e
has
neither
[[NeedsGet]]
nor
[[NeedsSet]],
then
return.
owner
.
Otherwise,
if
If
type
ownerPolicy
's
value
is
"
getter
"
and
not
compatible
with
cross-origin
isolation
or
e
.[[NeedsGet]]
policy
's
value
is
true,
compatible
with
cross-origin
isolation
,
then
return.
return
true.
Otherwise,
if
Queue
a
cross-origin
embedder
policy
inheritance
violation
with
type
is
response
,
"
",
owner's
policy
's
reporting
endpoint
,
"
setter
worker
initialization
enforce
",
and
e
.[[NeedsSet]]
is
true,
then
return.
owner
.
Return false.
To queue a cross-origin embedder policy inheritance violation given a response response , a string type , a string endpoint , a string disposition , and an environment settings object settings :
If
IsPlatformObjectSameOrigin
Let
serialized
be
the
result
of
serializing
a
response
URL
for
reporting
(
with
platformObject
response
.
Let
body
)
is
false,
then
throw
be
a
new
object
containing
the
following
properties:
| key | value |
|---|---|
| type | type |
| blockedURL | serialized |
| disposition | disposition |
Queue
body
as
the
"
"
report
type
SecurityError
coep
DOMException
.
for
endpoint
on
settings
.
A sandboxing flag set is a set of zero or more of the following flags, which are used to restrict the abilities that potentially untrusted resources have:
This
flag
prevents
content
from
navigating
browsing
contexts
other
than
the
sandboxed
browsing
context
itself
(or
browsing
contexts
further
nested
inside
it),
auxiliary
browsing
contexts
(which
are
protected
by
the
sandboxed
auxiliary
navigation
browsing
context
flag
defined
next),
and
Location
the
top-level
browsing
context
objects
both
have
a
[[CrossOriginPropertyDescriptorMap]]
internal
slot,
whose
value
(which
is
initially
an
empty
map.
The
[[CrossOriginPropertyDescriptorMap]]
protected
by
the
sandboxed
top-level
navigation
without
user
activation
browsing
context
flag
internal
slot
contains
a
map
with
entries
whose
keys
are
(
currentGlobal
,
objectGlobal
,
propertyKey
)-tuples
and
values
are
property
descriptors,
as
a
memoization
of
what
sandboxed
top-level
navigation
with
user
activation
browsing
context
flag
defined
below).
If
the
sandboxed
auxiliary
navigation
browsing
context
flag
is
visible
not
set,
then
in
certain
cases
the
restrictions
nonetheless
allow
popups
(new
top-level
browsing
contexts
)
to
scripts
be
opened.
These
browsing
contexts
always
have
one
permitted
sandboxed
navigator
,
set
when
currentGlobal
inspects
a
the
browsing
context
is
created,
which
allows
the
browsing
context
that
created
them
to
actually
navigate
them.
(Otherwise,
the
sandboxed
navigation
browsing
context
flag
would
prevent
them
from
being
navigated
even
if
they
were
opened.)
This
flag
prevents
content
from
creating
new
auxiliary
browsing
contexts
,
e.g.
using
the
target
attribute
or
the
Location
window.open()
object
method.
This
flag
prevents
content
from
objectGlobal
.
navigating
their
top-level
browsing
context
and
prevents
content
from
closing
their
top-level
browsing
context
.
It
is
filled
lazily
by
CrossOriginGetOwnPropertyHelper
,
which
consults
it
on
future
lookups.
consulted
only
when
the
sandboxed
browsing
context's
active
window
does
not
have
transient
activation
.
User
agents
should
allow
a
value
held
in
When
the
map
to
be
garbage
collected
along
with
sandboxed
top-level
navigation
without
user
activation
browsing
context
flag
is
not
set,
content
can
navigate
its
corresponding
key
when
nothing
holds
a
reference
to
any
part
of
top-level
browsing
context
,
but
other
browsing
contexts
are
still
protected
by
the
value.
That
is,
as
long
as
garbage
collection
sandboxed
navigation
browsing
context
flag
and
possibly
the
sandboxed
auxiliary
navigation
browsing
context
flag
.
This
flag
prevents
content
from
navigating
their
top-level
browsing
context
and
prevents
content
from
closing
their
top-level
browsing
context
.
It
is
not
observable.
consulted
only
when
the
sandboxed
browsing
context's
active
window
has
transient
activation
.
As
with
const
href
=
Object.getOwnPropertyDescriptor(crossOriginLocation,
"href").set
the
value
and
its
corresponding
key
in
sandboxed
top-level
navigation
without
user
activation
browsing
context
flag
,
this
flag
only
affects
the
map
cannot
be
garbage
collected
as
that
would
top-level
browsing
context
;
if
it
is
not
set,
other
browsing
contexts
might
still
be
observable.
protected
by
other
flags.
User
agents
may
have
an
optimization
whereby
they
remove
key-value
pairs
This
flag
forces
content
into
a
unique
origin
,
thus
preventing
it
from
accessing
other
content
from
the
map
when
same
origin
.
This
flag
also
prevents
script
from
reading
from
or
writing
to
the
document.cookie
IDL
attribute
,
and
blocks
access
to
.
document.domain
localStorage
is
set.
This
is
not
observable
as
flag
blocks
form
submission
.
This
flag
disables
the
Pointer
Lock
API.
[POINTERLOCK]
cannot
revisit
an
earlier
value.
This flag blocks script execution .
This flag blocks features that trigger automatically, such as automatically playing a video or automatically focusing a form control .
document.domain
browsing
context
flag
This
flag
prevents
content
from
using
the
document.domain
setter.
This
flag
prevents
content
from
escaping
the
map
where
part
of
the
key
is
www.example.com,
as
sandbox
by
ensuring
that
can
never
be
part
of
the
origin
any
auxiliary
browsing
context
again
and
therefore
it
creates
inherits
the
corresponding
value
could
never
be
retrieved
content's
active
sandboxing
flag
set
.
This
flag
prevents
content
from
using
any
of
the
map.
following
features
to
produce
modal
dialogs:
window.alert()
window.confirm()
Assert
:
O
is
a
window.print()
Location
window.prompt()
beforeunload
This flag disables the ability to lock the screen orientation. [SCREENORIENTATION]
This flag disables the Presentation API. [PRESENTATION]
This flag prevents content from initiating or instantiating downloads, whether through downloading hyperlinks or through navigation that gets handled as a download .
This flag prevents navigations toward non fetch schemes from being handed off to external software .
When the user agent is to parse a sandboxing directive , given a string input , a sandboxing flag set output , it must run the following steps:
If
Split
O
input
is
a
on
ASCII
whitespace
,
to
obtain
tokens
.
Let output be empty.
Add the following flags to output :
Return
«
{
[[Property]]:
"
window
",
[[NeedsGet]]:
true,
[[NeedsSet]]:
false
},
{
[[Property]]:
"
self
",
[[NeedsGet]]:
true,
[[NeedsSet]]:
false
},
{
[[Property]]:
"
location
",
[[NeedsGet]]:
true,
[[NeedsSet]]:
true
},
{
[[Property]]:
"
close
"
},
{
[[Property]]:
"
closed
",
[[NeedsGet]]:
true,
[[NeedsSet]]:
false
},
{
[[Property]]:
"
focus
"
},
{
[[Property]]:
"
blur
"
},
{
[[Property]]:
"
frames
",
[[NeedsGet]]:
true,
[[NeedsSet]]:
false
},
{
[[Property]]:
"
length
",
[[NeedsGet]]:
true,
[[NeedsSet]]:
false
},
{
[[Property]]:
"
The
sandboxed
navigation
browsing
context
flag
.
The
sandboxed
auxiliary
navigation
browsing
context
flag
,
unless
tokens
contains
the
top
allow-popups
",
[[NeedsGet]]:
true,
[[NeedsSet]]:
false
},
{
[[Property]]:
"
keyword.
The
sandboxed
top-level
navigation
without
user
activation
browsing
context
flag
,
unless
tokens
contains
the
opener
allow-top-navigation
",
[[NeedsGet]]:
true,
[[NeedsSet]]:
false
},
{
[[Property]]:
"
keyword.
The
sandboxed
top-level
navigation
with
user
activation
browsing
context
flag
,
unless
tokens
contains
either
the
parent
allow-top-navigation-by-user-activation
",
[[NeedsGet]]:
true,
[[NeedsSet]]:
false
},
{
[[Property]]:
"
postMessage
keyword
or
the
allow-top-navigation
"
}
».
This
abstract
operation
does
not
return
a
Completion
Record
.
keyword.
Indexed
properties
do
not
need
to
be
safelisted
in
this
algorithm,
as
they
are
handled
directly
by
This
means
that
if
the
WindowProxy
allow-top-navigation
object.
is
present,
the
allow-top-navigation-by-user-activation
keyword
will
have
no
effect.
For
this
reason,
specifying
both
is
a
document
conformance
error.
A
JavaScript
property
name
The
sandboxed
origin
browsing
context
flag
,
unless
the
P
tokens
is
a
cross-origin
accessible
window
property
name
if
it
is
"
window
",
"
self
",
"
location
",
"
close
",
"
closed
",
"
contains
the
focus
allow-same-origin
",
"
blur
keyword.
The
allow-same-origin
",
"
keyword
is
intended
for
two
cases.
First, it can be used to allow content from the same site to be sandboxed to disable scripting, while still allowing access to the DOM of the sandboxed content.
Second, it can be used to embed content from a third-party site, sandboxed to prevent that site from opening popups, etc, without preventing the embedded page from communicating back to its originating site, using the database APIs to store data, etc.
The
sandboxed
forms
browsing
context
flag
,
unless
tokens
contains
the
frames
allow-forms
",
"
keyword.
The
sandboxed
pointer
lock
browsing
context
flag
,
unless
tokens
contains
the
length
allow-pointer-lock
",
"
keyword.
The
sandboxed
scripts
browsing
context
flag
,
unless
tokens
contains
the
top
allow-scripts
",
"
opener
keyword.
The
sandboxed
automatic
features
browsing
context
flag
,
unless
tokens
contains
the
allow-scripts
",
"
keyword
(defined
above).
This flag is relaxed by the same keyword as scripts, because when scripts are enabled these features are trivially possible anyway, and it would be unfortunate to force authors to use script to do them when sandboxed rather than allowing them to use the declarative features.
The
sandboxed
parent
document.domain
",
"
browsing
context
flag
.
The
sandbox
propagates
to
auxiliary
browsing
contexts
flag
,
unless
tokens
contains
the
postMessage
allow-popups-to-escape-sandbox
",
or
an
array
index
property
name
.
7.2.3.2
CrossOriginPropertyFallback
(
keyword.
The
sandboxed
modals
flag
,
unless
P
tokens
)
contains
the
allow-modals
keyword.
If
The
sandboxed
orientation
lock
browsing
context
flag
,
unless
P
tokens
is
"
contains
the
then
allow-orientation-lock
",
@@toStringTag
,
@@hasInstance
,
or
@@isConcatSpreadable
,
then
return
PropertyDescriptor
{
[[Value]]:
undefined,
[[Writable]]:
false,
[[Enumerable]]:
false,
[[Configurable]]:
true
}.
keyword.
Throw
a
"
The
sandboxed
presentation
browsing
context
flag
,
unless
tokens
contains
the
SecurityError
allow-presentation
"
DOMException
keyword.
The
sandboxed
downloads
browsing
context
flag
,
unless
tokens
contains
the
allow-downloads
7.2.3.3
IsPlatformObjectSameOrigin
(
keyword.
The
sandboxed
custom
protocols
navigation
browsing
context
flag
,
unless
O
tokens
)
contains
either
the
allow-top-navigation-to-custom-protocols
keyword,
the
allow-popups
keyword,
or
the
Return
true
if
current
settings
object
allow-top-navigation
keyword.
's
origin
Every
top-level
browsing
context
has
a
popup
sandboxing
flag
set
,
which
is
same
origin-domain
with
O
's
relevant
settings
object
's
origin
,
and
false
otherwise.
This
abstract
operation
does
not
return
a
Completion
Record
sandboxing
flag
set
.
Here
the
current
settings
object
roughly
corresponds
to
the
"caller",
because
this
check
occurs
before
the
execution
When
a
browsing
context
for
the
getter/setter/method
in
question
makes
is
created,
its
way
onto
popup
sandboxing
flag
set
must
be
empty.
It
is
populated
by
the
JavaScript
execution
rules
for
choosing
a
navigable
and
the
obtain
a
browsing
context
stack
to
use
for
a
navigation
response
algorithm.
Every
iframe
element
has
an
iframe
sandboxing
flag
set
,
which
is
a
sandboxing
flag
set
.
For
example,
Which
flags
in
the
code
an
sandboxing
flag
set
are
set
at
any
particular
time
is
w.document
,
this
step
iframe
invoked
before
determined
by
the
document
iframe
getter
is
reached
as
part
of
the
[[Get]]
algorithm
for
the
element's
WindowProxy
sandbox
w
.
attribute.
Every
Document
has
an
active
sandboxing
flag
set
,
which
is
If
this
abstract
operation
returns
undefined
and
there
no
custom
behavior,
the
caller
needs
to
throw
a
"
SecurityError
"
sandboxing
flag
set
.
When
the
is
DOMException
Document
.
In
practice
this
handled
created,
its
active
sandboxing
flag
set
must
be
empty.
It
is
populated
by
the
caller
calling
CrossOriginPropertyFallback
navigation
algorithm
.
Every CSP list cspList has CSP-derived sandboxing flags , which is a sandboxing flag set . It is the return value of the following algorithm:
Let
crossOriginKey
directives
be
a
tuple
consisting
of
the
current
settings
object
,
O
's
relevant
settings
object
,
and
P
.
an
empty
ordered
set
.
For
each
e
of
CrossOriginProperties
(
policy
in
O
):
cspList
:
If
SameValue
(
e
.[[Property]],
P
policy
)
's
disposition
is
true,
then:
not
"
enforce
",
then
continue
.
If
the
value
of
the
[[CrossOriginPropertyDescriptorMap]]
internal
slot
of
O
policy
's
directive
set
contains
an
entry
a
directive
whose
key
name
is
"
sandbox
",
then
append
that
directive
to
crossOriginKey
,
directives
.
If
directives
is
empty,
then
return
that
entry's
value.
an
empty
sandboxing
flag
set
.
Let
originalDesc
directive
be
OrdinaryGetOwnProperty
(
O
,
directives
[
P
directives
).
's
size
−
1].
Let
Return
the
result
of
parsing
the
sandboxing
directive
crossOriginDesc
be
undefined.
directive
.
If
To
determine
the
creation
sandboxing
flags
for
a
browsing
context
e
.[[NeedsGet]]
and
browsing
context
,
given
null
or
an
element
e
.[[NeedsSet]]
embedder
,
return
the
union
of
the
flags
that
are
absent,
then:
present
in
the
following
sandboxing
flag
sets
:
Let
If
value
embedder
be
is
null,
then:
the
flags
set
on
originalDesc
.[[Value]].
browsing
context
's
popup
sandboxing
flag
set
.
If
IsCallable
(
value
embedder
)
is
true,
then
set
value
to
an
anonymous
built-in
function,
created
in
the
current
realm
,
that
performs
the
same
steps
as
element,
then:
the
IDL
operation
P
flags
set
on
object
O
.
embedder
's
iframe
sandboxing
flag
set
.
Set
If
crossOriginDesc
embedder
to
PropertyDescriptor
{
[[Value]]:
is
an
element,
then:
the
flags
set
on
value
,
[[Enumerable]]:
false,
[[Writable]]:
false,
[[Configurable]]:
true
}.
embedder
's
node
document
's
active
sandboxing
flag
set
.
Otherwise:
A
policy
container
is
a
struct
containing
policies
that
apply
to
a
Document
,
a
WorkerGlobalScope
,
or
a
WorkletGlobalScope
.
It
has
the
following
items
:
Let
crossOriginGet
be
undefined.
A
CSP
list
,
which
is
a
CSP
list
.
It
is
initially
empty.
If
e
.[[NeedsGet]]
An
embedder
policy
,
which
is
true,
then
set
crossOriginGet
to
an
anonymous
built-in
function,
created
in
the
current
realm
,
that
performs
the
same
steps
as
embedder
policy
.
It
is
initially
a
new
embedder
policy
.
A
referrer
policy
,
which
is
a
referrer
policy
.
It
is
initially
the
getter
of
default
referrer
policy
.
Move
other
policies
into
the
IDL
attribute
P
on
object
policy
container.
To
clone
a
policy
container
given
a
policy
container
O
.
policyContainer
:
Let
crossOriginSet
clone
be
undefined.
a
new
policy
container
.
If
e
.[[NeedsSet]]
is
true,
then
set
For
each
crossOriginSet
policy
to
an
anonymous
built-in
function,
created
in
the
current
realm
policyContainer
's
CSP
list
,
that
performs
the
same
steps
as
the
setter
append
a
copy
of
the
IDL
attribute
P
policy
on
object
into
O
.
clone
's
CSP
list
.
Set
crossOriginDesc
clone
to
PropertyDescriptor
's
embedder
policy
{
[[Get]]:
crossOriginGet
,
[[Set]]:
to
a
copy
of
crossOriginSet
,
[[Enumerable]]:
false,
[[Configurable]]:
true
}.
policyContainer
's
embedder
policy
.
Create
an
entry
in
the
value
of
the
[[CrossOriginPropertyDescriptorMap]]
internal
slot
of
Set
O
clone
with
key
's
referrer
policy
to
crossOriginKey
policyContainer
and
value
crossOriginDesc
.
's
referrer
policy
.
Return
crossOriginDesc
clone
.
Return
undefined.
This
abstract
operation
does
not
return
To
determine
whether
a
Completion
Record
.
The
reason
that
the
property
descriptors
produced
here
are
configurable
is
to
preserve
the
invariants
of
the
essential
internal
methods
URL
required
by
the
JavaScript
specification.
In
particular,
since
the
value
of
the
property
can
change
as
a
consequence
of
navigation,
it
is
required
that
url
requires
storing
the
property
be
configurable.
(However,
see
tc39/ecma262
issue
#672
and
references
to
it
elsewhere
policy
container
in
this
specification
for
cases
where
we
are
not
able
to
preserve
these
invariants,
for
compatibility
with
existing
web
content.)
[JAVASCRIPT]
The
reason
the
property
descriptors
are
non-enumerable,
despite
this
mismatching
the
same-origin
behavior,
is
for
compatibility
with
existing
web
content.
See
issue
#3183
for
details.
history
:
Let
If
desc
url
be
?
O
.[[GetOwnProperty]](
's
scheme
is
"
blob
",
then
return
false.
If
P
url
).
is
local
,
then
return
true.
Assert
:
Return
false.
To
create
a
policy
container
from
a
fetch
response
given
a
response
desc
response
is
not
undefined.
and
an
environment
-or-null
environment
:
If
IsDataDescriptor
(
desc
response
)
's
URL
's
scheme
is
true,
"
blob
",
then
return
a
clone
of
desc
.[[Value]].
response
's
URL
's
blob
URL
entry
's
environment
's
policy
container
.
Assert
:
IsAccessorDescriptor
(
Let
desc
result
)
is
true.
be
a
new
policy
container
.
Let
Set
getter
result
be
's
CSP
list
to
the
result
of
parsing
a
response's
Content
Security
Policies
given
desc
.[[Get]].
response
.
If
getter
environment
is
undefined,
non-null,
then
throw
a
set
result
's
embedder
policy
to
the
result
of
obtaining
an
embedder
policy
given
response
and
environment
.
Otherwise,
set
it
to
"
unsafe-none
".
Set
result
's
referrer
policy
to
the
result
of
parsing
the
`
SecurityError
Referrer-Policy
"
`
header
DOMException
given
response
.
[REFERRERPOLICY]
.
Return
?
Call
(
getter
,
Receiver
).
result
.
To
determine
navigation
params
policy
container
(
given
a
URL
O
responseURL
and
four
policy
container
-or-nulls
historyPolicyContainer
,
P
initiatorPolicyContainer
,
V
parentPolicyContainer
,
and
Receiver
)
responsePolicyContainer
:
If historyPolicyContainer is not null, then:
Let
Assert
:
desc
responseURL
be
?
requires
storing
the
policy
container
in
history
.
Return
a
clone
of
O
.[[GetOwnProperty]](
historyPolicyContainer
.
If
P
responseURL
).
is
about:srcdoc
,
then:
If
desc
.[[Set]]
responseURL
is
present
local
and
its
value
initiatorPolicyContainer
is
not
undefined,
then:
null,
then
return
a
clone
of
initiatorPolicyContainer
.
Perform
?
Call
(
setter
,
Receiver
,
«
If
V
responsePolicyContainer
»).
is
not
null,
then
return
responsePolicyContainer
.
Return
true.
a
new
policy
container
.
Throw
To
initialize
a
"
SecurityError
"
worker
global
scope's
policy
container
given
a
workerGlobalScope
,
a
response
response
,
and
an
environment
environment
:DOMException
WorkerGlobalScope
.
If
O
workerGlobalScope
)
's
url
is
local
but
its
scheme
is
not
"
blob
":
Let
Assert
:
keys
workerGlobalScope
be
a
new
empty
List
.
's
owner
set
's
size
is
1.
For
each
Set
e
workerGlobalScope
of
CrossOriginProperties
's
policy
container
(
to
a
clone
of
O
workerGlobalScope
),
append
's
owner
set
e
.[[Property]]
to
keys
.
[0]'s
relevant
settings
object
's
policy
container
.
Return
Otherwise,
set
workerGlobalScope
's
policy
container
to
the
concatenation
result
of
creating
a
policy
container
from
a
fetch
response
given
keys
response
and
«
"
then
",
@@toStringTag
,
@@hasInstance
,
@@isConcatSpreadable
».
environment
.