RESOLVED FIXED 215562
Resolve with the class used to define the Custom Element
https://bugs.webkit.org/show_bug.cgi?id=215562
Summary Resolve with the class used to define the Custom Element
Andrea Giammarchi
Reported 2020-08-17 03:00:12 PDT
Accordingly with https://github.com/whatwg/html/issues/5552, `whenDefined` should resolve with the class used to define the custom element in the registry.
Attachments
Implements the new behavior (13.93 KB, patch)
2020-08-20 19:47 PDT, Ryosuke Niwa
no flags
Patch for landing (14.59 KB, patch)
2020-08-25 13:54 PDT, Ryosuke Niwa
no flags
Radar WebKit Bug Importer
Comment 1 2020-08-17 17:28:50 PDT
Ryosuke Niwa
Comment 2 2020-08-20 19:47:29 PDT
Created attachment 406998 [details] Implements the new behavior
EWS Watchlist
Comment 3 2020-08-20 19:48:32 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Darin Adler
Comment 4 2020-08-20 19:54:25 PDT
Comment on attachment 406998 [details] Implements the new behavior View in context: https://bugs.webkit.org/attachment.cgi?id=406998&action=review > Source/WebCore/bindings/js/JSDOMPromiseDeferred.h:80 > + JSC::JSGlobalObject* lexicalGlobalObject = globalObject(); auto > Source/WebCore/dom/CustomElementRegistry.cpp:81 > if (auto promise = m_promiseMap.take(localName)) > - promise.value()->resolve(); > + return WTFMove(*promise); > + return nullptr; No if statement needed: return m_promiseMap.take(localName);
Ryosuke Niwa
Comment 5 2020-08-20 20:17:52 PDT
(In reply to Darin Adler from comment #4) > Comment on attachment 406998 [details] > Implements the new behavior > > View in context: > https://bugs.webkit.org/attachment.cgi?id=406998&action=review > > > Source/WebCore/dom/CustomElementRegistry.cpp:81 > > if (auto promise = m_promiseMap.take(localName)) > > - promise.value()->resolve(); > > + return WTFMove(*promise); > > + return nullptr; > > No if statement needed: > > return m_promiseMap.take(localName); That's what I thought but I was getting (and still getting) this error: ./dom/CustomElementRegistry.cpp:79:12: error: no viable conversion from returned value of type 'WTF::HashMap<WTF::AtomString, WTF::Ref<WebCore::DeferredPromise, WTF::DumbPtrTraits<WebCore::DeferredPromise> >, WTF::DefaultHash<WTF::AtomString>, WTF::HashTraits<WTF::AtomString>, WTF::HashTraits<WTF::Ref<WebCore::DeferredPromise, WTF::DumbPtrTraits<WebCore::DeferredPromise> > > >::MappedTakeType' (aka 'Optional<Ref<WebCore::DeferredPromise> >') to function return type 'RefPtr<WebCore::DeferredPromise>' return m_promiseMap.take(localName); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Darin Adler
Comment 6 2020-08-21 09:15:53 PDT
I see. You’ll have to write it this way for now, but we should either change RefHashTraits::TakeType to RefPtr in HashTraits.h, or add a constructor for RefPtr that takes Optional<Ref>&& in RefPtr.h, or possibly do both. Then we can come back here and re-simplify this.
Ryosuke Niwa
Comment 7 2020-08-25 13:54:22 PDT
Created attachment 407227 [details] Patch for landing
Ryosuke Niwa
Comment 8 2020-08-25 13:54:49 PDT
(In reply to Darin Adler from comment #6) > I see. You’ll have to write it this way for now, but we should either change > RefHashTraits::TakeType to RefPtr in HashTraits.h, or add a constructor for > RefPtr that takes Optional<Ref>&& in RefPtr.h, or possibly do both. Then we > can come back here and re-simplify this. Yeah, let me work on that next.
EWS
Comment 9 2020-08-25 14:22:17 PDT
Committed r266142: <https://trac.webkit.org/changeset/266142> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407227 [details].
Note You need to log in before you can comment on or make changes to this bug.