Repository navigation
web/polyfill: polyfill customElements.getName for Safari < 17.4 - #22940
Conversation
The flow renderer started calling window.customElements.getName in 2026.5, which crashes on iOS 16 Safari and any WebKit WebView before 17.4. Reporters saw "getName is not a function" at the first stage render and the page never recovered. The polyfill wraps define() to record each tag and constructor pair, then resolves getName(ctor) from that map. It only installs when the registry is missing the method, so modern browsers keep their native implementation. The polyfill bundle is loaded from base/skeleton.html ahead of every interface entry point, so the wrap is in place before any customElements.define call runs. Fixes #22611 Co-Authored-By: Agent (authentik-i22611-committed-cooperative-orchid) <[email protected]>
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22940 +/- ##
=======================================
Coverage 93.26% 93.27%
=======================================
Files 1033 1033
Lines 60182 60182
Branches 400 400
=======================================
+ Hits 56129 56132 +3
+ Misses 4053 4050 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-3557d9c6285b92ef287ce378f5cabb651c092a8b
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-3557d9c6285b92ef287ce378f5cabb651c092a8bAfterwards, run the upgrade commands from the latest release notes. |
|
🍒 Cherry-pick to |
…ry-pick #22940 to version-2026.5) (#22963) web/polyfill: polyfill customElements.getName for Safari < 17.4 (#22940) * web/polyfill: polyfill customElements.getName for Safari < 17.4 The flow renderer started calling window.customElements.getName in 2026.5, which crashes on iOS 16 Safari and any WebKit WebView before 17.4. Reporters saw "getName is not a function" at the first stage render and the page never recovered. The polyfill wraps define() to record each tag and constructor pair, then resolves getName(ctor) from that map. It only installs when the registry is missing the method, so modern browsers keep their native implementation. The polyfill bundle is loaded from base/skeleton.html ahead of every interface entry point, so the wrap is in place before any customElements.define call runs. Fixes #22611 * Refine. --------- Co-authored-by: Teffen Ellis <[email protected]> Co-authored-by: Agent (authentik-i22611-committed-cooperative-orchid) <[email protected]> Co-authored-by: Connor Peshek <[email protected]> Co-authored-by: Jens L. <[email protected]>
|
Confirming this fix also resolves a crash on Android — not just Safari/WebKit <17.4 as described above. We hit the identical Worth broadening the polyfill's documented scope beyond Safari, since the underlying API gap apparently exists on some Chromium-based mobile builds too. |
What
window.customElements.getName()is undefined on iOS 16 Safari and on any WebKit WebView older than 17.4. The flow renderer began calling it in 2026.5, so those clients throwwindow.customElements.getName is not a functionat the first stage render, and the flow never recovers. Two reporters hit this on iOS 16 (#22611).getName()is the reverse ofcustomElements.get(): given a constructor, it returns the tag name that constructor was registered under. It shipped in Chrome/Edge 117, Firefox 119, and Safari 17.4, so all of iOS 16 and the 17.0 through 17.3 releases reach the renderer without it.How
A polyfill in
web/src/polyfill/custom-elements-get-name.ts:getNameis absent, so browsers that already have the native method are left untouched.define()to record each tag/constructor pair in aWeakMap, then answersgetName(ctor)from that map.define()is in place before anycustomElements.define()call runs. Order matters here: an install that ran later would miss every element defined before it.Unit tests cover the install-when-absent path, round-tripping a defined element, forwarding the full
define()argument list (includingoptions), the unregistered-constructor case, and the native no-op path.Disclosure
Triaged and authored end-to-end by an automated agent operating under my account and supervision. I reviewed the full diff and confirmed the local build, lint, and type-checks before opening.
Fixes #22611