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

Side by Side Diff: Source/core/xml/parser/XMLDocumentParser.cpp

Issue 1170503003: Remove resource type-specific fetching logic from ResourceFetcher (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Null-check Document::loader() before calling startPreload() Created 5 years, 6 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/xml/XSLTProcessorLibxslt.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | 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) 2000 Peter Kelly (pmk@post.com) 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com)
3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved. 3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2008 Holger Hans Peter Freyther 7 * Copyright (C) 2008 Holger Hans Peter Freyther
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 24 matching lines...) Expand all
35 #include "core/XMLNSNames.h" 35 #include "core/XMLNSNames.h"
36 #include "core/dom/CDATASection.h" 36 #include "core/dom/CDATASection.h"
37 #include "core/dom/Comment.h" 37 #include "core/dom/Comment.h"
38 #include "core/dom/Document.h" 38 #include "core/dom/Document.h"
39 #include "core/dom/DocumentFragment.h" 39 #include "core/dom/DocumentFragment.h"
40 #include "core/dom/DocumentType.h" 40 #include "core/dom/DocumentType.h"
41 #include "core/dom/ProcessingInstruction.h" 41 #include "core/dom/ProcessingInstruction.h"
42 #include "core/dom/ScriptLoader.h" 42 #include "core/dom/ScriptLoader.h"
43 #include "core/dom/TransformSource.h" 43 #include "core/dom/TransformSource.h"
44 #include "core/fetch/FetchInitiatorTypeNames.h" 44 #include "core/fetch/FetchInitiatorTypeNames.h"
45 #include "core/fetch/RawResource.h"
45 #include "core/fetch/ResourceFetcher.h" 46 #include "core/fetch/ResourceFetcher.h"
46 #include "core/fetch/ScriptResource.h" 47 #include "core/fetch/ScriptResource.h"
47 #include "core/frame/ConsoleTypes.h" 48 #include "core/frame/ConsoleTypes.h"
48 #include "core/frame/LocalFrame.h" 49 #include "core/frame/LocalFrame.h"
49 #include "core/frame/UseCounter.h" 50 #include "core/frame/UseCounter.h"
50 #include "core/html/HTMLHtmlElement.h" 51 #include "core/html/HTMLHtmlElement.h"
51 #include "core/html/HTMLTemplateElement.h" 52 #include "core/html/HTMLTemplateElement.h"
52 #include "core/html/parser/HTMLEntityParser.h" 53 #include "core/html/parser/HTMLEntityParser.h"
53 #include "core/html/parser/TextResourceDecoder.h" 54 #include "core/html/parser/TextResourceDecoder.h"
54 #include "core/inspector/ConsoleMessage.h" 55 #include "core/inspector/ConsoleMessage.h"
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 return &globalDescriptor; 647 return &globalDescriptor;
647 648
648 KURL finalURL; 649 KURL finalURL;
649 RefPtr<SharedBuffer> data; 650 RefPtr<SharedBuffer> data;
650 651
651 { 652 {
652 Document* document = XMLDocumentParserScope::currentDocument; 653 Document* document = XMLDocumentParserScope::currentDocument;
653 XMLDocumentParserScope scope(0); 654 XMLDocumentParserScope scope(0);
654 // FIXME: We should restore the original global error handler as well. 655 // FIXME: We should restore the original global error handler as well.
655 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::xml, ResourceFetcher::defaultResourceOptions()); 656 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::xml, ResourceFetcher::defaultResourceOptions());
656 ResourcePtr<Resource> resource = document->fetcher()->fetchSynchronously (request); 657 ResourcePtr<Resource> resource = RawResource::fetchSynchronously(request , document->fetcher());
657 if (resource && !resource->errorOccurred()) { 658 if (resource && !resource->errorOccurred()) {
658 data = resource->resourceBuffer(); 659 data = resource->resourceBuffer();
659 finalURL = resource->response().url(); 660 finalURL = resource->response().url();
660 } 661 }
661 } 662 }
662 663
663 // We have to check the URL again after the load to catch redirects. 664 // We have to check the URL again after the load to catch redirects.
664 // See <https://bugs.webkit.org/show_bug.cgi?id=21963>. 665 // See <https://bugs.webkit.org/show_bug.cgi?id=21963>.
665 if (!shouldAllowExternalLoad(finalURL)) 666 if (!shouldAllowExternalLoad(finalURL))
666 return &globalDescriptor; 667 return &globalDescriptor;
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 sax.initialized = XML_SAX2_MAGIC; 1667 sax.initialized = XML_SAX2_MAGIC;
1667 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); 1668 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state);
1668 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; 1669 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />";
1669 parseChunk(parser->context(), parseString); 1670 parseChunk(parser->context(), parseString);
1670 finishParsing(parser->context()); 1671 finishParsing(parser->context());
1671 attrsOK = state.gotAttributes; 1672 attrsOK = state.gotAttributes;
1672 return state.attributes; 1673 return state.attributes;
1673 } 1674 }
1674 1675
1675 } // namespace blink 1676 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/xml/XSLTProcessorLibxslt.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698