Changeset 205400 in webkit
- Timestamp:
- Sep 3, 2016 7:09:58 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 15 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r205399 r205400 1 2016-09-03 Chris Dumez <cdumez@apple.com> 2 3 Align meta element http-equiv="refresh" parsing with the HTML specification 4 https://bugs.webkit.org/show_bug.cgi?id=161543 5 6 Reviewed by Darin Adler. 7 8 Update layout test to only use HTML spaces in http-equiv="refresh" 9 content value. 10 11 * http/tests/misc/refresh-meta-with-newline.html: 12 1 13 2016-09-03 Youenn Fablet <youenn@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/ChangeLog
r205399 r205400 1 2016-09-03 Chris Dumez <cdumez@apple.com> 2 3 Align meta element http-equiv="refresh" parsing with the HTML specification 4 https://bugs.webkit.org/show_bug.cgi?id=161543 5 6 Reviewed by Darin Adler. 7 8 Import corresponding test from W3C. 9 10 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing-expected.txt: Added. 11 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html: Added. 12 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/;url=foo: Added. 13 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/__dir__.headers: Added. 14 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/foo: Added. 15 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/foo'bar: Added. 16 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html: Added. 17 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/ufoo: Added. 18 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/urfoo: Added. 19 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/url foo: Added. 20 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/urlfoo: Added. 21 * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/x;url=foo: Added. 22 1 23 2016-09-03 Youenn Fablet <youenn@apple.com> 2 24 -
trunk/Source/WebCore/ChangeLog
r205396 r205400 1 2016-09-03 Chris Dumez <cdumez@apple.com> 2 3 Align meta element http-equiv="refresh" parsing with the HTML specification 4 https://bugs.webkit.org/show_bug.cgi?id=161543 5 6 Reviewed by Darin Adler. 7 8 Align meta element http-equiv="refresh" parsing with the HTML specification: 9 - https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh 10 11 Tests: imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html 12 13 * dom/Document.cpp: 14 (WebCore::Document::processHttpEquiv): 15 * html/parser/HTMLParserIdioms.cpp: 16 (WebCore::parseHTTPRefreshInternal): 17 (WebCore::parseMetaHTTPEquivRefresh): 18 * html/parser/HTMLParserIdioms.h: 19 * loader/FrameLoader.cpp: 20 (WebCore::FrameLoader::receivedFirstData): 21 * platform/network/HTTPParsers.cpp: 22 (WebCore::skipWhiteSpace): 23 (WebCore::skipEquals): 24 (WebCore::parseHTTPRefresh): 25 (WebCore::parseXSSProtectionHeader): 26 (WebCore::skipValue): Deleted. 27 * platform/network/HTTPParsers.h: 28 1 29 2016-09-02 Myles C. Maxfield <mmaxfield@apple.com> 2 30 -
trunk/Source/WebCore/dom/Document.cpp
r205340 r205400 3267 3267 double delay; 3268 3268 String urlString; 3269 if (frame && parse HTTPRefresh(content, true, delay, urlString)) {3269 if (frame && parseMetaHTTPEquivRefresh(content, delay, urlString)) { 3270 3270 URL completedURL; 3271 3271 if (urlString.isEmpty()) -
trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp
r205095 r205400 292 292 } 293 293 294 } 294 // https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh 295 template <typename CharacterType> 296 static bool parseHTTPRefreshInternal(const CharacterType* position, const CharacterType* end, double& parsedDelay, String& parsedURL) 297 { 298 while (position < end && isHTMLSpace(*position)) 299 ++position; 300 301 const CharacterType* numberStart = position; 302 while (position < end && isASCIIDigit(*position)) 303 ++position; 304 305 Optional<int> number = parseHTMLNonNegativeInteger(StringView(numberStart, position - numberStart).toStringWithoutCopying()); 306 if (!number) 307 return false; 308 309 while (position < end && (isASCIIDigit(*position) || *position == '.')) 310 ++position; 311 312 if (position == end) { 313 parsedDelay = number.value(); 314 return true; 315 } 316 317 if (*position != ';' && *position != ',' && !isHTMLSpace(*position)) 318 return false; 319 320 parsedDelay = number.value(); 321 322 while (position < end && isHTMLSpace(*position)) 323 ++position; 324 325 if (position < end && (*position == ';' || *position == ',')) 326 ++position; 327 328 while (position < end && isHTMLSpace(*position)) 329 ++position; 330 331 if (position == end) 332 return true; 333 334 if (*position == 'U' || *position == 'u') { 335 StringView url(position, end - position); 336 337 ++position; 338 339 if (position < end && (*position == 'R' || *position == 'r')) 340 ++position; 341 else { 342 parsedURL = url.toString(); 343 return true; 344 } 345 346 if (position < end && (*position == 'L' || *position == 'l')) 347 ++position; 348 else { 349 parsedURL = url.toString(); 350 return true; 351 } 352 353 while (position < end && isHTMLSpace(*position)) 354 ++position; 355 356 if (position < end && *position == '=') 357 ++position; 358 else { 359 parsedURL = url.toString(); 360 return true; 361 } 362 363 while (position < end && isHTMLSpace(*position)) 364 ++position; 365 } 366 367 CharacterType quote; 368 if (position < end && (*position == '\'' || *position == '"')) { 369 quote = *position; 370 ++position; 371 } else 372 quote = '\0'; 373 374 StringView url(position, end - position); 375 376 if (quote != '\0') { 377 size_t index = url.find(quote); 378 if (index != notFound) 379 url = url.substring(0, index); 380 } 381 382 parsedURL = url.toString(); 383 return true; 384 } 385 386 bool parseMetaHTTPEquivRefresh(const StringView& input, double& delay, String& url) 387 { 388 if (LIKELY(input.is8Bit())) { 389 auto* start = input.characters8(); 390 return parseHTTPRefreshInternal(start, start + input.length(), delay, url); 391 } 392 393 auto* start = input.characters16(); 394 return parseHTTPRefreshInternal(start, start + input.length(), delay, url); 395 } 396 397 } -
trunk/Source/WebCore/html/parser/HTMLParserIdioms.h
r205095 r205400 70 70 // https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-floating-point-number-values 71 71 Vector<double> parseHTMLListOfOfFloatingPointNumberValues(StringView); 72 73 // https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh 74 bool parseMetaHTTPEquivRefresh(const StringView&, double& delay, String& url); 72 75 73 76 // https://html.spec.whatwg.org/multipage/infrastructure.html#cors-settings-attribute -
trunk/Source/WebCore/loader/FrameLoader.cpp
r205275 r205400 656 656 double delay; 657 657 String urlString; 658 if (!parseHTTPRefresh(m_documentLoader->response().httpHeaderField(HTTPHeaderName::Refresh), false,delay, urlString))658 if (!parseHTTPRefresh(m_documentLoader->response().httpHeaderField(HTTPHeaderName::Refresh), delay, urlString)) 659 659 return; 660 660 URL completedURL; -
trunk/Source/WebCore/platform/network/HTTPParsers.cpp
r205011 r205400 48 48 // true if there is more to parse, after incrementing pos past whitespace. 49 49 // Note: Might return pos == str.length() 50 static inline bool skipWhiteSpace(const String& str, unsigned& pos , bool fromHttpEquivMeta)50 static inline bool skipWhiteSpace(const String& str, unsigned& pos) 51 51 { 52 52 unsigned len = str.length(); 53 53 54 if (fromHttpEquivMeta) { 55 while (pos < len && str[pos] <= ' ') 56 ++pos; 57 } else { 58 while (pos < len && (str[pos] == '\t' || str[pos] == ' ')) 59 ++pos; 60 } 54 while (pos < len && (str[pos] == '\t' || str[pos] == ' ')) 55 ++pos; 61 56 62 57 return pos < len; … … 87 82 static inline bool skipEquals(const String& str, unsigned &pos) 88 83 { 89 return skipWhiteSpace(str, pos , false) && str[pos++] == '=' && skipWhiteSpace(str, pos, false);84 return skipWhiteSpace(str, pos) && str[pos++] == '=' && skipWhiteSpace(str, pos); 90 85 } 91 86 … … 188 183 } 189 184 190 bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta,double& delay, String& url)185 bool parseHTTPRefresh(const String& refresh, double& delay, String& url) 191 186 { 192 187 unsigned len = refresh.length(); 193 188 unsigned pos = 0; 194 189 195 if (!skipWhiteSpace(refresh, pos , fromHttpEquivMeta))190 if (!skipWhiteSpace(refresh, pos)) 196 191 return false; 197 192 … … 211 206 212 207 ++pos; 213 skipWhiteSpace(refresh, pos , fromHttpEquivMeta);208 skipWhiteSpace(refresh, pos); 214 209 unsigned urlStartPos = pos; 215 210 if (refresh.find("url", urlStartPos, false) == urlStartPos) { 216 211 urlStartPos += 3; 217 skipWhiteSpace(refresh, urlStartPos , fromHttpEquivMeta);212 skipWhiteSpace(refresh, urlStartPos); 218 213 if (refresh[urlStartPos] == '=') { 219 214 ++urlStartPos; 220 skipWhiteSpace(refresh, urlStartPos , fromHttpEquivMeta);215 skipWhiteSpace(refresh, urlStartPos); 221 216 } else 222 217 urlStartPos = pos; // e.g. "Refresh: 0; url.html" … … 389 384 unsigned pos = 0; 390 385 391 if (!skipWhiteSpace(header, pos , false))386 if (!skipWhiteSpace(header, pos)) 392 387 return XSSProtectionDisposition::Enabled; 393 388 … … 406 401 while (1) { 407 402 // At end of previous directive: consume whitespace, semicolon, and whitespace. 408 if (!skipWhiteSpace(header, pos , false))403 if (!skipWhiteSpace(header, pos)) 409 404 return result; 410 405 … … 415 410 } 416 411 417 if (!skipWhiteSpace(header, pos , false))412 if (!skipWhiteSpace(header, pos)) 418 413 return result; 419 414 -
trunk/Source/WebCore/platform/network/HTTPParsers.h
r203899 r205400 79 79 bool isValidHTTPHeaderValue(const String&); 80 80 bool isValidHTTPToken(const String&); 81 bool parseHTTPRefresh(const String& refresh, bool fromHttpEquivMeta,double& delay, String& url);81 bool parseHTTPRefresh(const String& refresh, double& delay, String& url); 82 82 Optional<std::chrono::system_clock::time_point> parseHTTPDate(const String&); 83 83 String filenameFromHTTPContentDisposition(const String&);
Note: See TracChangeset
for help on using the changeset viewer.