Summary: | Resolve with the class used to define the Custom Element | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Andrea Giammarchi <andrea.giammarchi> | ||||||
Component: | Platform | Assignee: | Ryosuke Niwa <rniwa> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | cdumez, clopez, darin, esprehn+autocc, ews-watchlist, kangil.han, koivisto, rniwa, webkit-bug-importer, wenson_hsieh, youennf, ysuzuki | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | Other | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Unspecified | ||||||||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=215830 | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 154907 | ||||||||
Attachments: |
|
Description
Andrea Giammarchi
2020-08-17 03:00:12 PDT
Created attachment 406998 [details]
Implements the new behavior
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 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); (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); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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. Created attachment 407227 [details]
Patch for landing
(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. Committed r266142: <https://trac.webkit.org/changeset/266142> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407227 [details]. |