Changeset 207914 in webkit
- Timestamp:
- Oct 26, 2016 4:15:51 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r207912 r207914 1 2016-10-26 Chris Dumez <cdumez@apple.com> 2 3 The URLSearchParams constructor should take a union in parameter 4 https://bugs.webkit.org/show_bug.cgi?id=163906 5 6 Reviewed by Darin Adler. 7 8 The URLSearchParams constructor should take a union in parameter: 9 - https://url.spec.whatwg.org/#urlsearchparams 10 11 No new tests, no web-exposed behavior change. 12 13 * html/URLSearchParams.h: 14 (WebCore::URLSearchParams::create): 15 * html/URLSearchParams.idl: 16 1 17 2016-10-26 Sam Weinig <sam@webkit.org> 2 18 -
trunk/Source/WebCore/html/URLSearchParams.h
r206632 r207914 26 26 27 27 #include "DOMURL.h" 28 #include <wtf/Variant.h> 28 29 #include <wtf/Vector.h> 29 30 #include <wtf/text/WTFString.h> … … 33 34 class URLSearchParams : public RefCounted<URLSearchParams> { 34 35 public: 35 static Ref<URLSearchParams> create(const String& string, DOMURL* associatedURL = nullptr) { return adoptRef(*new URLSearchParams(string, associatedURL)); }36 static Ref<URLSearchParams> create(const Vector<std::pair<String, String>>& pairs) { return adoptRef(*new URLSearchParams(pairs)); }36 using StringOrURLSearchParams = WTF::Variant<String, RefPtr<URLSearchParams>>; 37 static Ref<URLSearchParams> create(const StringOrURLSearchParams&, DOMURL* associatedURL = nullptr); 37 38 38 39 void associatedURLDestroyed() { m_associatedURL = nullptr; } … … 56 57 }; 57 58 59 inline Ref<URLSearchParams> URLSearchParams::create(const StringOrURLSearchParams& variant, DOMURL* associatedURL) 60 { 61 auto visitor = WTF::makeVisitor([&](const String& string) { 62 return adoptRef(*new URLSearchParams(string, associatedURL)); 63 }, [&](const RefPtr<URLSearchParams>& params) { 64 return adoptRef(*new URLSearchParams(static_cast<const Vector<std::pair<String, String>>&>(*params))); 65 }); 66 return WTF::visit(visitor, variant); 58 67 } 68 69 } // namespace WebCore -
trunk/Source/WebCore/html/URLSearchParams.idl
r205893 r207914 25 25 26 26 [ 27 // FIXME: This should use unions once they are supported 28 Constructor(optional USVString arg = ""), 29 Constructor(URLSearchParams init), 27 Constructor(optional (USVString or URLSearchParams) init = ""), 30 28 Exposed=(Window,Worker), 31 29 ImplementationLacksVTable,
Note: See TracChangeset
for help on using the changeset viewer.