From fd2c7c5dc22a8def8551bf384dcc87ae035b7a2e Mon Sep 17 00:00:00 2001 From: Xiaocheng Hu Date: Mon, 1 May 2023 12:05:30 -0700 Subject: [PATCH] [scoped-registry] Implement scoped custom element upgrade This patch: 1. Changes CustomElement::Registry() to return tree-scoped registries instead of the global registry. As this function is used by a lot of callers (including upgrade), this allows these callers to use the scoped registry associated with the tree scope. 2. Custom element construction stack entries are augmented with the definition being used, so that later when calling `super()`, we can still know which custom element definition is being used. See https://github.com/WICG/webcomponents/issues/969 for details. Bug: 1304439 Change-Id: Id510ecea0f4c5cf6386f77a39d346918c9592e76 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4144367 Reviewed-by: Joey Arhar Reviewed-by: Yuki Shiino Commit-Queue: Xiaocheng Hu Cr-Commit-Position: refs/heads/main@{#1137942} --- ...hadowRoot-innerHTML-upgrade.tentative.html | 116 +++++++++++++++ .../constructor-call.tentative.html | 42 ++++++ ...y-with-different-definition.tentative.html | 137 ++++++++++++++++++ 3 files changed, 295 insertions(+) create mode 100644 custom-elements/scoped-registry/ShadowRoot-innerHTML-upgrade.tentative.html create mode 100644 custom-elements/scoped-registry/constructor-call.tentative.html create mode 100644 custom-elements/scoped-registry/constructor-reentry-with-different-definition.tentative.html diff --git a/custom-elements/scoped-registry/ShadowRoot-innerHTML-upgrade.tentative.html b/custom-elements/scoped-registry/ShadowRoot-innerHTML-upgrade.tentative.html new file mode 100644 index 00000000000000..e21c9dd03326d6 --- /dev/null +++ b/custom-elements/scoped-registry/ShadowRoot-innerHTML-upgrade.tentative.html @@ -0,0 +1,116 @@ + + + + + + + + +
+ + diff --git a/custom-elements/scoped-registry/constructor-call.tentative.html b/custom-elements/scoped-registry/constructor-call.tentative.html new file mode 100644 index 00000000000000..19a8e3f4d8ac69 --- /dev/null +++ b/custom-elements/scoped-registry/constructor-call.tentative.html @@ -0,0 +1,42 @@ + + + + + + + + + + diff --git a/custom-elements/scoped-registry/constructor-reentry-with-different-definition.tentative.html b/custom-elements/scoped-registry/constructor-reentry-with-different-definition.tentative.html new file mode 100644 index 00000000000000..dc93e3c702d578 --- /dev/null +++ b/custom-elements/scoped-registry/constructor-reentry-with-different-definition.tentative.html @@ -0,0 +1,137 @@ + + + + + + + + +
+
+ +