OLD | NEW |
---|---|
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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 } | 622 } |
623 | 623 |
624 return true; | 624 return true; |
625 } | 625 } |
626 | 626 |
627 static void* openFunc(const char* uri) | 627 static void* openFunc(const char* uri) |
628 { | 628 { |
629 ASSERT(XMLDocumentParserScope::currentFetcher); | 629 ASSERT(XMLDocumentParserScope::currentFetcher); |
630 ASSERT(currentThread() == libxmlLoaderThread); | 630 ASSERT(currentThread() == libxmlLoaderThread); |
631 | 631 |
632 UseCounter::count(XMLDocumentParserScope::currentFetcher->document(), UseCou nter::XMLExternalDTD); | |
kouhei (in TOK)
2014/09/08 17:07:58
Let's move this down.
tasak
2014/09/09 03:07:06
Done.
| |
633 | |
632 KURL url(KURL(), uri); | 634 KURL url(KURL(), uri); |
633 | 635 |
634 if (!shouldAllowExternalLoad(url)) | 636 if (!shouldAllowExternalLoad(url)) |
635 return &globalDescriptor; | 637 return &globalDescriptor; |
636 | 638 |
637 KURL finalURL; | 639 KURL finalURL; |
638 RefPtr<SharedBuffer> data; | 640 RefPtr<SharedBuffer> data; |
639 | 641 |
640 { | 642 { |
641 ResourceFetcher* fetcher = XMLDocumentParserScope::currentFetcher; | 643 ResourceFetcher* fetcher = XMLDocumentParserScope::currentFetcher; |
642 XMLDocumentParserScope scope(0); | 644 XMLDocumentParserScope scope(0); |
643 // FIXME: We should restore the original global error handler as well. | 645 // FIXME: We should restore the original global error handler as well. |
644 | 646 |
645 if (fetcher->frame()) { | 647 if (fetcher->frame()) { |
646 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames:: xml, ResourceFetcher::defaultResourceOptions()); | 648 FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames:: xml, ResourceFetcher::defaultResourceOptions()); |
647 ResourcePtr<Resource> resource = fetcher->fetchSynchronously(request ); | 649 ResourcePtr<Resource> resource = fetcher->fetchSynchronously(request ); |
648 if (resource && !resource->errorOccurred()) { | 650 if (resource && !resource->errorOccurred()) { |
649 data = resource->resourceBuffer(); | 651 data = resource->resourceBuffer(); |
650 finalURL = resource->response().url(); | 652 finalURL = resource->response().url(); |
651 } | 653 } |
652 } | 654 } |
653 } | 655 } |
654 | 656 |
655 // We have to check the URL again after the load to catch redirects. | 657 // We have to check the URL again after the load to catch redirects. |
656 // See <https://bugs.webkit.org/show_bug.cgi?id=21963>. | 658 // See <https://bugs.webkit.org/show_bug.cgi?id=21963>. |
657 if (!shouldAllowExternalLoad(finalURL)) | 659 if (!shouldAllowExternalLoad(finalURL)) |
658 return &globalDescriptor; | 660 return &globalDescriptor; |
659 | 661 |
kouhei (in TOK)
2014/09/08 17:07:58
to here.
tasak
2014/09/09 03:07:06
Done.
Thanks.
| |
660 return new SharedBufferReader(data); | 662 return new SharedBufferReader(data); |
661 } | 663 } |
662 | 664 |
663 static int readFunc(void* context, char* buffer, int len) | 665 static int readFunc(void* context, char* buffer, int len) |
664 { | 666 { |
665 // Do 0-byte reads in case of a null descriptor | 667 // Do 0-byte reads in case of a null descriptor |
666 if (context == &globalDescriptor) | 668 if (context == &globalDescriptor) |
667 return 0; | 669 return 0; |
668 | 670 |
669 SharedBufferReader* data = static_cast<SharedBufferReader*>(context); | 671 SharedBufferReader* data = static_cast<SharedBufferReader*>(context); |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1635 sax.initialized = XML_SAX2_MAGIC; | 1637 sax.initialized = XML_SAX2_MAGIC; |
1636 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); | 1638 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); |
1637 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1639 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1638 parseChunk(parser->context(), parseString); | 1640 parseChunk(parser->context(), parseString); |
1639 finishParsing(parser->context()); | 1641 finishParsing(parser->context()); |
1640 attrsOK = state.gotAttributes; | 1642 attrsOK = state.gotAttributes; |
1641 return state.attributes; | 1643 return state.attributes; |
1642 } | 1644 } |
1643 | 1645 |
1644 } // namespace blink | 1646 } // namespace blink |
OLD | NEW |