Skip to content

Commit 6680fc9

Browse files
committed
Bug 1665215 [wpt PR 25554] - Deny ElementInternals.shadowRoot for pre-created shadow roots, a=testonly
Automatic update from web-platform-tests Deny ElementInternals.shadowRoot for pre-created shadow roots Per the spec issue [1], this change disallows the use of ElementInternals.shadowRoot for shadow roots created prior to the custom element constructor being run. This protects potentially-closed shadow roots, created outside of the custom element, from being revealed to the custom element itself. (Use case unclear, but this was the request.) [1] WICG/webcomponents#871 Bug: 1042130 Change-Id: I25192256e8b1334d09ea587f29d64f35d4f5f949 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2412470 Commit-Queue: Kouhei Ueno <kouheichromium.org> Auto-Submit: Mason Freed <masonfreedchromium.org> Reviewed-by: Kouhei Ueno <kouheichromium.org> Cr-Commit-Position: refs/heads/master{#807311} -- wpt-commits: 8e3392df536283e843589c176ffbc7e00e94e64e wpt-pr: 25554 UltraBlame original commit: 11691695d1b65041eea7dd2470183b95f4335029
1 parent 6b60b13 commit 6680fc9

File tree

1 file changed

+194
-0
lines changed

1 file changed

+194
-0
lines changed

testing/web-platform/tests/shadow-dom/declarative/element-internals-shadowroot.tentative.html

+194
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,200 @@
926926
'
927927
)
928928
;
929+
test
930+
(
931+
(
932+
)
933+
=
934+
>
935+
{
936+
let
937+
constructed
938+
=
939+
false
940+
;
941+
const
942+
element
943+
=
944+
document
945+
.
946+
createElement
947+
(
948+
'
949+
x
950+
-
951+
6
952+
'
953+
)
954+
;
955+
const
956+
sr
957+
=
958+
element
959+
.
960+
attachShadow
961+
(
962+
{
963+
mode
964+
:
965+
'
966+
closed
967+
'
968+
}
969+
)
970+
;
971+
assert_true
972+
(
973+
sr
974+
instanceof
975+
ShadowRoot
976+
)
977+
;
978+
customElements
979+
.
980+
define
981+
(
982+
'
983+
x
984+
-
985+
6
986+
'
987+
class
988+
extends
989+
HTMLElement
990+
{
991+
constructor
992+
(
993+
)
994+
{
995+
super
996+
(
997+
)
998+
;
999+
assert_throws_dom
1000+
(
1001+
'
1002+
NotSupportedError
1003+
'
1004+
(
1005+
)
1006+
=
1007+
>
1008+
this
1009+
.
1010+
attachShadow
1011+
(
1012+
{
1013+
mode
1014+
:
1015+
'
1016+
open
1017+
'
1018+
}
1019+
)
1020+
'
1021+
attachShadow
1022+
already
1023+
called
1024+
'
1025+
)
1026+
;
1027+
const
1028+
elementInternals
1029+
=
1030+
this
1031+
.
1032+
attachInternals
1033+
(
1034+
)
1035+
;
1036+
assert_equals
1037+
(
1038+
elementInternals
1039+
.
1040+
shadowRoot
1041+
null
1042+
'
1043+
ElementInternals
1044+
.
1045+
shadowRoot
1046+
should
1047+
not
1048+
be
1049+
available
1050+
for
1051+
pre
1052+
-
1053+
attached
1054+
shadow
1055+
'
1056+
)
1057+
;
1058+
constructed
1059+
=
1060+
true
1061+
;
1062+
}
1063+
}
1064+
)
1065+
;
1066+
assert_false
1067+
(
1068+
constructed
1069+
)
1070+
;
1071+
customElements
1072+
.
1073+
upgrade
1074+
(
1075+
element
1076+
)
1077+
;
1078+
assert_true
1079+
(
1080+
constructed
1081+
'
1082+
Failed
1083+
to
1084+
construct
1085+
-
1086+
test
1087+
failed
1088+
'
1089+
)
1090+
;
1091+
assert_equals
1092+
(
1093+
element
1094+
.
1095+
shadowRoot
1096+
null
1097+
'
1098+
shadow
1099+
root
1100+
is
1101+
closed
1102+
'
1103+
)
1104+
;
1105+
}
1106+
'
1107+
ElementInternals
1108+
.
1109+
shadowRoot
1110+
doesn
1111+
\
1112+
'
1113+
t
1114+
reveal
1115+
pre
1116+
-
1117+
attached
1118+
closed
1119+
shadowRoot
1120+
'
1121+
)
1122+
;
9291123
<
9301124
/
9311125
script

0 commit comments

Comments
 (0)