Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: Source/core/html/parser/HTMLPreloadScanner.cpp

Issue 1044133002: HTMLPreloadScanner should only use valid <base> urls (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move the check up Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/
4 * Copyright (C) 2010 Google Inc. All Rights Reserved. 4 * Copyright (C) 2010 Google Inc. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 default: { 508 default: {
509 return; 509 return;
510 } 510 }
511 } 511 }
512 } 512 }
513 513
514 template<typename Token> 514 template<typename Token>
515 void TokenPreloadScanner::updatePredictedBaseURL(const Token& token) 515 void TokenPreloadScanner::updatePredictedBaseURL(const Token& token)
516 { 516 {
517 ASSERT(m_predictedBaseElementURL.isEmpty()); 517 ASSERT(m_predictedBaseElementURL.isEmpty());
518 if (const typename Token::Attribute* hrefAttribute = token.getAttributeItem( hrefAttr)) 518 if (const typename Token::Attribute* hrefAttribute = token.getAttributeItem( hrefAttr)) {
519 m_predictedBaseElementURL = KURL(m_documentURL, stripLeadingAndTrailingH TMLSpaces(hrefAttribute->value)).copy(); 519 KURL url(m_documentURL, stripLeadingAndTrailingHTMLSpaces(hrefAttribute- >value));
520 m_predictedBaseElementURL = url.isValid() ? url.copy() : KURL();
521 }
520 } 522 }
521 523
522 HTMLPreloadScanner::HTMLPreloadScanner(const HTMLParserOptions& options, const K URL& documentURL, PassRefPtr<MediaValues> mediaValues) 524 HTMLPreloadScanner::HTMLPreloadScanner(const HTMLParserOptions& options, const K URL& documentURL, PassRefPtr<MediaValues> mediaValues)
523 : m_scanner(documentURL, mediaValues) 525 : m_scanner(documentURL, mediaValues)
524 , m_tokenizer(HTMLTokenizer::create(options)) 526 , m_tokenizer(HTMLTokenizer::create(options))
525 { 527 {
526 } 528 }
527 529
528 HTMLPreloadScanner::~HTMLPreloadScanner() 530 HTMLPreloadScanner::~HTMLPreloadScanner()
529 { 531 {
(...skipping 20 matching lines...) Expand all
550 if (m_token.type() == HTMLToken::StartTag) 552 if (m_token.type() == HTMLToken::StartTag)
551 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name (), Likely8Bit)); 553 m_tokenizer->updateStateFor(attemptStaticStringCreation(m_token.name (), Likely8Bit));
552 m_scanner.scan(m_token, m_source, requests); 554 m_scanner.scan(m_token, m_source, requests);
553 m_token.clear(); 555 m_token.clear();
554 } 556 }
555 557
556 preloader->takeAndPreload(requests); 558 preloader->takeAndPreload(requests);
557 } 559 }
558 560
559 } 561 }
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698