Skip to content

Commit

Permalink
Bug 1410364 - Don't consider opener when calculating IsSecureContext.…
Browse files Browse the repository at this point in the history
… r=bz, r=dveditz

Per w3c/webappsec-secure-contexts#42, the
section considering the window opener when calculating secure context is
to be dropped. Firefox already uses "isSecureContextIfOpenerIgnored" in
most places as this is the actual behavior we want. This patch aligns
with the upcoming spec changes by ignoring the window opener. We also no
longer have to keep information about whether our opener was secure as
that no longer factors in our calculations.

UltraBlame original commit: 6784a27f54ff76952569067bab6e34c443e48c84
  • Loading branch information
marco-c committed Oct 2, 2019
1 parent 20cfae6 commit 3439792
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 447 deletions.
41 changes: 0 additions & 41 deletions dom/base/nsGlobalWindowInner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4862,10 +4862,6 @@ mAddActiveEventFuzzTime
(
true
)
mIsSecureContextIfOpenerIgnored
(
false
)
mWasOffline
(
false
Expand Down Expand Up @@ -12320,30 +12316,6 @@ IsSecureContext
)
;
}
bool
nsPIDOMWindowInner
:
:
IsSecureContextIfOpenerIgnored
(
)
const
{
return
nsGlobalWindowInner
:
:
Cast
(
this
)
-
>
IsSecureContextIfOpenerIgnored
(
)
;
}
void
nsPIDOMWindowInner
:
Expand Down Expand Up @@ -38861,19 +38833,6 @@ GetWrapperPreserveColor
)
;
}
bool
nsGlobalWindowInner
:
:
IsSecureContextIfOpenerIgnored
(
)
const
{
return
mIsSecureContextIfOpenerIgnored
;
}
already_AddRefed
<
External
Expand Down
11 changes: 0 additions & 11 deletions dom/base/nsGlobalWindowInner.h
Original file line number Diff line number Diff line change
Expand Up @@ -4041,12 +4041,6 @@ IsSecureContext
)
const
;
bool
IsSecureContextIfOpenerIgnored
(
)
const
;
void
GetSidebar
(
Expand Down Expand Up @@ -8204,11 +8198,6 @@ aRequest
;
protected
:
bool
mIsSecureContextIfOpenerIgnored
:
1
;
/
/
Window
Expand Down
81 changes: 0 additions & 81 deletions dom/base/nsGlobalWindowOuter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6008,10 +6008,6 @@ mHadOriginalOpener
(
false
)
mOriginalOpenerWasSecureContext
(
false
)
mIsPopupSpam
(
false
Expand Down Expand Up @@ -9661,17 +9657,6 @@ state
"
)
;
if
(
aFlags
!
=
SecureContextFlags
:
:
eIgnoreOpener
)
{
hadNonSecureContextCreator
=
!
Expand All @@ -9683,44 +9668,6 @@ IsSecureContext
)
;
}
else
{
hadNonSecureContextCreator
=
!
parentWin
-
>
IsSecureContextIfOpenerIgnored
(
)
;
}
}
else
if
(
mHadOriginalOpener
)
{
if
(
aFlags
!
=
SecureContextFlags
:
:
eIgnoreOpener
)
{
hadNonSecureContextCreator
=
!
mOriginalOpenerWasSecureContext
;
}
}
if
(
hadNonSecureContextCreator
Expand Down Expand Up @@ -12119,20 +12066,6 @@ global
"
)
;
newInnerWindow
-
>
mIsSecureContextIfOpenerIgnored
=
ComputeIsSecureContext
(
aDocument
SecureContextFlags
:
:
eIgnoreOpener
)
;
mCreatingInnerWindow
=
false
Expand Down Expand Up @@ -15090,20 +15023,6 @@ mHadOriginalOpener
=
true
;
mOriginalOpenerWasSecureContext
=
aOpener
-
>
GetCurrentInnerWindow
(
)
-
>
IsSecureContext
(
)
;
}
#
ifdef
Expand Down
5 changes: 0 additions & 5 deletions dom/base/nsGlobalWindowOuter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6338,11 +6338,6 @@ mHadOriginalOpener
1
;
bool
mOriginalOpenerWasSecureContext
:
1
;
bool
mIsPopupSpam
:
1
Expand Down
2 changes: 1 addition & 1 deletion dom/geolocation/nsGeolocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5959,7 +5959,7 @@ win
)
-
>
IsSecureContextIfOpenerIgnored
IsSecureContext
(
)
)
Expand Down
109 changes: 0 additions & 109 deletions dom/webidl/Window.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -3724,115 +3724,6 @@ IdleDeadline
deadline
)
;
/
*
*
*
Similar
to
|
isSecureContext
|
but
doesn
'
t
pay
attention
to
whether
the
*
window
'
s
opener
(
if
any
)
is
a
secure
context
or
not
.
*
*
WARNING
:
Do
not
use
this
unless
you
are
familiar
with
the
issues
that
*
taking
opener
state
into
account
is
designed
to
address
(
or
else
you
may
*
introduce
security
issues
)
.
If
in
doubt
use
|
isSecureContext
|
.
In
*
particular
do
not
use
this
to
gate
access
to
JavaScript
APIs
.
*
/
partial
interface
Window
{
[
ChromeOnly
]
readonly
attribute
boolean
isSecureContextIfOpenerIgnored
;
}
;
partial
interface
Window
Expand Down

This file was deleted.

Loading

0 comments on commit 3439792

Please sign in to comment.