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: 681fece780aef771f1c6b56cddf4e52c8c800cb2
  • Loading branch information
marco-c committed Oct 2, 2019
1 parent 18e303b commit 6cf548b
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 440 deletions.
48 changes: 0 additions & 48 deletions dom/base/nsGlobalWindowInner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2819,10 +2819,6 @@ mHadOriginalOpener
(
false
)
mOriginalOpenerWasSecureContext
(
false
)
mIsPopupSpam
(
false
Expand Down Expand Up @@ -10583,30 +10579,6 @@ IsSecureContext
)
;
}
bool
nsPIDOMWindowInner
:
:
IsSecureContextIfOpenerIgnored
(
)
const
{
return
nsGlobalWindowInner
:
:
Cast
(
this
)
-
>
IsSecureContextIfOpenerIgnored
(
)
;
}
void
nsPIDOMWindowInner
:
Expand Down Expand Up @@ -38699,26 +38671,6 @@ GetWrapperPreserveColor
)
;
}
bool
nsGlobalWindowInner
:
:
IsSecureContextIfOpenerIgnored
(
)
const
{
MOZ_RELEASE_ASSERT
(
IsInnerWindow
(
)
)
;
return
mIsSecureContextIfOpenerIgnored
;
}
already_AddRefed
<
External
Expand Down
16 changes: 0 additions & 16 deletions dom/base/nsGlobalWindowInner.h
Original file line number Diff line number Diff line change
Expand Up @@ -4508,12 +4508,6 @@ IsSecureContext
)
const
;
bool
IsSecureContextIfOpenerIgnored
(
)
const
;
void
GetSidebar
(
Expand Down Expand Up @@ -8919,16 +8913,6 @@ mHadOriginalOpener
1
;
bool
mOriginalOpenerWasSecureContext
:
1
;
bool
mIsSecureContextIfOpenerIgnored
:
1
;
bool
mIsPopupSpam
:
1
Expand Down
81 changes: 0 additions & 81 deletions dom/base/nsGlobalWindowOuter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4330,10 +4330,6 @@ mHadOriginalOpener
(
false
)
mOriginalOpenerWasSecureContext
(
false
)
mIsPopupSpam
(
false
Expand Down Expand Up @@ -9197,17 +9193,6 @@ state
"
)
;
if
(
aFlags
!
=
SecureContextFlags
:
:
eIgnoreOpener
)
{
hadNonSecureContextCreator
=
!
Expand All @@ -9219,44 +9204,6 @@ IsSecureContext
)
;
}
else
{
hadNonSecureContextCreator
=
!
parentWin
-
>
IsSecureContextIfOpenerIgnored
(
)
;
}
}
else
if
(
mHadOriginalOpener
)
{
if
(
aFlags
!
=
SecureContextFlags
:
:
eIgnoreOpener
)
{
hadNonSecureContextCreator
=
!
mOriginalOpenerWasSecureContext
;
}
}
if
(
hadNonSecureContextCreator
Expand Down Expand Up @@ -10675,20 +10622,6 @@ global
"
)
;
newInnerWindow
-
>
mIsSecureContextIfOpenerIgnored
=
ComputeIsSecureContext
(
aDocument
SecureContextFlags
:
:
eIgnoreOpener
)
;
mCreatingInnerWindow
=
false
Expand Down Expand Up @@ -13743,20 +13676,6 @@ mHadOriginalOpener
=
true
;
mOriginalOpenerWasSecureContext
=
aOpener
-
>
GetCurrentInnerWindow
(
)
-
>
IsSecureContext
(
)
;
}
#
ifdef
Expand Down
10 changes: 0 additions & 10 deletions dom/base/nsGlobalWindowOuter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7169,16 +7169,6 @@ mHadOriginalOpener
1
;
bool
mOriginalOpenerWasSecureContext
:
1
;
bool
mIsSecureContextIfOpenerIgnored
:
1
;
bool
mIsPopupSpam
:
1
Expand Down
6 changes: 0 additions & 6 deletions dom/base/nsPIDOMWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -5051,12 +5051,6 @@ IsSecureContext
)
const
;
bool
IsSecureContextIfOpenerIgnored
(
)
const
;
/
/
Calling
Expand Down
2 changes: 1 addition & 1 deletion dom/geolocation/nsGeolocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5905,7 +5905,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
Loading

0 comments on commit 6cf548b

Please sign in to comment.