Thanks to visit codestin.com
Credit goes to phabricator.services.mozilla.com

Page MenuHomePhabricator

Bug 1829335 - Add customElements.getName. r?smaug,zcorpan
ClosedPublic

Authored by keithamus on Jun 21 2023, 1:56 PM.
Referenced Files
Unknown Object (File)
Fri, Feb 13, 9:27 PM
Unknown Object (File)
Fri, Feb 13, 9:27 PM
Unknown Object (File)
Jan 26 2026, 2:17 AM
Unknown Object (File)
Dec 28 2025, 4:00 PM
Unknown Object (File)
Dec 28 2025, 4:00 PM
Unknown Object (File)
Jun 9 2025, 7:09 PM
Unknown Object (File)
May 24 2025, 9:18 PM
Unknown Object (File)
May 22 2025, 7:47 AM
Subscribers

Details

Summary

This adds the new customElements.getName method which takes a constructor
and returns string if the definition has been registered, otherwise null.

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".Jun 21 2023, 1:58 PM
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
dom/base/CustomElementRegistry.cpp
1200

I'm sure there's a better way to do this!

smaug requested changes to this revision.Jun 21 2023, 3:43 PM

Web platform tests in https://bugzilla.mozilla.org/show_bug.cgi?id=1838986 and https://bugzilla.mozilla.org/show_bug.cgi?id=1837536. I don't know how to link those to this revision.

You'd need to remove the relevant .ini files, or remove at least annotations for the relevant failing subtests.
The .ini file is always basically testfilename.ini.

Looks like the tests are right now in autoland, but not yet in mozilla-central, so could you perhaps wait until those are merged to mozilla-central and then update this patch. I think that would be the easiest thing to do.

This revision now requires changes to proceed.Jun 21 2023, 3:43 PM

autoland -> mozilla-central merge happens rather often and the relevant bug is always updated one the merge has happened.

dom/base/CustomElementRegistry.cpp
1200

You might want to use https://searchfox.org/mozilla-central/rev/3424c000a7ff304b2d1efb8561a924232f7f12fc/dom/bindings/Bindings.conf#35
Similar to https://searchfox.org/mozilla-central/rev/3424c000a7ff304b2d1efb8561a924232f7f12fc/dom/bindings/Bindings.conf#182-184

I know, it should be an annotation in the webidl file itself (that would be just easier for everyone), but it isn't atm.

keithamus updated this revision to Diff 733903.

This looks fine, but we're still in the limbo state where it looks like some tests are already in tree https://bugzilla.mozilla.org/show_bug.cgi?id=1837536, but some are not https://bugzilla.mozilla.org/show_bug.cgi?id=1838986
So landing this is a bit tricky, since one needs to modify the relevant .ini files.

testing/web-platform/meta/custom-elements/CustomElementRegistry.html.ini at least need to be changed. That is already in mozilla-central
Looks like it has failures for getName only, so I assume the whole file could be removed.

But https://bugzilla.mozilla.org/show_bug.cgi?id=1838986 hints that the test is moving to a different place...

This revision is now accepted and ready to land.Jun 22 2023, 2:39 PM
keithamus edited the summary of this revision. (Show Details)

I'm not familiar enough with mercurial to know what to do here... in git I'd rebase against 3234b709b030 and change the file, or checkout to that commit and apply changes on top on a new branch. I'm struggling to do either here.... 😊

It is just that patches land first to https://hg.mozilla.org/integration/autoland which is then merged to https://hg.mozilla.org/mozilla-central (unless there are some issues with the patch, in which case it is backed out from autoland).
mozilla-central is usually used for development.
At least bug 1837536 has now landed to mozilla-central, so you could tweak testing/web-platform/meta/custom-elements/CustomElementRegistry.html.ini
Since if you run ./mach wpt testing/web-platform/tests/custom-elements/CustomElementRegistry.html
with your patch, you should see some unexpected passes. And you can make those expected by removing the relevant annotations from the .ini.

I guess we don't need to wait for https://bugzilla.mozilla.org/show_bug.cgi?id=1838986 since that isn't even in autoland.

testing/web-platform/meta/custom-elements/CustomElementRegistry.html.ini
9

The whole .ini file can be removed if all the subtests pass.

@smaug is anything else needed for this one?

I think this could land, even though it is a bit odd that the spec pr hasn't landed yet.