Changeset 223446 in webkit
- Timestamp:
- Oct 16, 2017 4:29:36 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r223443 r223446 1 2017-10-16 Alex Christensen <achristensen@webkit.org> 2 3 Allow modern decoding of URLs 4 https://bugs.webkit.org/show_bug.cgi?id=178265 5 6 Reviewed by Chris Dumez. 7 8 * platform/URL.h: 9 (WebCore::URL::decode): 10 1 11 2017-10-16 Ryan Haddad <ryanhaddad@apple.com> 2 12 -
trunk/Source/WebCore/platform/URL.h
r222239 r223446 206 206 template <class Encoder> void encode(Encoder&) const; 207 207 template <class Decoder> static bool decode(Decoder&, URL&); 208 template <class Decoder> static std::optional<URL> decode(Decoder&); 208 209 209 210 String serialize(bool omitFragment = false) const; … … 262 263 bool URL::decode(Decoder& decoder, URL& url) 263 264 { 265 auto optionalURL = URL::decode(decoder); 266 if (!optionalURL) 267 return false; 268 url = WTFMove(*optionalURL); 269 return true; 270 } 271 272 template <class Decoder> 273 std::optional<URL> URL::decode(Decoder& decoder) 274 { 275 URL url; 264 276 if (!decoder.decode(url.m_string)) 265 return false;277 return std::nullopt; 266 278 bool isValid; 267 279 if (!decoder.decode(isValid)) 268 return false;280 return std::nullopt; 269 281 url.m_isValid = isValid; 270 282 if (!isValid) 271 return true;283 return WTFMove(url); 272 284 bool protocolIsInHTTPFamily; 273 285 if (!decoder.decode(protocolIsInHTTPFamily)) 274 return false;286 return std::nullopt; 275 287 url.m_protocolIsInHTTPFamily = protocolIsInHTTPFamily; 276 288 if (!decoder.decode(url.m_schemeEnd)) 277 return false;289 return std::nullopt; 278 290 if (!decoder.decode(url.m_userStart)) 279 return false;291 return std::nullopt; 280 292 if (!decoder.decode(url.m_userEnd)) 281 return false;293 return std::nullopt; 282 294 if (!decoder.decode(url.m_passwordEnd)) 283 return false;295 return std::nullopt; 284 296 if (!decoder.decode(url.m_hostEnd)) 285 return false;297 return std::nullopt; 286 298 if (!decoder.decode(url.m_portEnd)) 287 return false;299 return std::nullopt; 288 300 if (!decoder.decode(url.m_pathAfterLastSlash)) 289 return false;301 return std::nullopt; 290 302 if (!decoder.decode(url.m_pathEnd)) 291 return false;303 return std::nullopt; 292 304 if (!decoder.decode(url.m_queryEnd)) 293 return false;294 return true;305 return std::nullopt; 306 return WTFMove(url); 295 307 } 296 308
Note: See TracChangeset
for help on using the changeset viewer.