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

Side by Side Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 197103005: Have XMLHttpRequest.responseXML return an XMLDocument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaseline additional test Created 6 years, 9 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 | « LayoutTests/http/tests/xmlhttprequest/svg-created-by-xhr-allowed-in-dashboard-expected.txt ('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) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 11 matching lines...) Expand all
22 22
23 #include "config.h" 23 #include "config.h"
24 #include "core/xml/XMLHttpRequest.h" 24 #include "core/xml/XMLHttpRequest.h"
25 25
26 #include "FetchInitiatorTypeNames.h" 26 #include "FetchInitiatorTypeNames.h"
27 #include "RuntimeEnabledFeatures.h" 27 #include "RuntimeEnabledFeatures.h"
28 #include "bindings/v8/ExceptionState.h" 28 #include "bindings/v8/ExceptionState.h"
29 #include "core/dom/ContextFeatures.h" 29 #include "core/dom/ContextFeatures.h"
30 #include "core/dom/DOMImplementation.h" 30 #include "core/dom/DOMImplementation.h"
31 #include "core/dom/ExceptionCode.h" 31 #include "core/dom/ExceptionCode.h"
32 #include "core/dom/XMLDocument.h"
32 #include "core/editing/markup.h" 33 #include "core/editing/markup.h"
33 #include "core/events/Event.h" 34 #include "core/events/Event.h"
34 #include "core/fetch/CrossOriginAccessControl.h" 35 #include "core/fetch/CrossOriginAccessControl.h"
35 #include "core/fileapi/Blob.h" 36 #include "core/fileapi/Blob.h"
36 #include "core/fileapi/File.h" 37 #include "core/fileapi/File.h"
37 #include "core/fileapi/Stream.h" 38 #include "core/fileapi/Stream.h"
38 #include "core/frame/csp/ContentSecurityPolicy.h" 39 #include "core/frame/csp/ContentSecurityPolicy.h"
39 #include "core/html/DOMFormData.h" 40 #include "core/html/DOMFormData.h"
40 #include "core/html/HTMLDocument.h" 41 #include "core/html/HTMLDocument.h"
41 #include "core/html/parser/TextResourceDecoder.h" 42 #include "core/html/parser/TextResourceDecoder.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // If it is text/html, then the responseType of "document" must have bee n supplied explicitly. 248 // If it is text/html, then the responseType of "document" must have bee n supplied explicitly.
248 if ((m_response.isHTTP() && !responseIsXML() && !isHTML) 249 if ((m_response.isHTTP() && !responseIsXML() && !isHTML)
249 || (isHTML && m_responseTypeCode == ResponseTypeDefault) 250 || (isHTML && m_responseTypeCode == ResponseTypeDefault)
250 || executionContext()->isWorkerGlobalScope()) { 251 || executionContext()->isWorkerGlobalScope()) {
251 m_responseDocument = nullptr; 252 m_responseDocument = nullptr;
252 } else { 253 } else {
253 DocumentInit init = DocumentInit::fromContext(document()->contextDoc ument(), m_url); 254 DocumentInit init = DocumentInit::fromContext(document()->contextDoc ument(), m_url);
254 if (isHTML) 255 if (isHTML)
255 m_responseDocument = HTMLDocument::create(init); 256 m_responseDocument = HTMLDocument::create(init);
256 else 257 else
257 m_responseDocument = Document::create(init); 258 m_responseDocument = XMLDocument::create(init);
258 // FIXME: Set Last-Modified. 259 // FIXME: Set Last-Modified.
259 m_responseDocument->setContent(m_responseText.flattenToString()); 260 m_responseDocument->setContent(m_responseText.flattenToString());
260 m_responseDocument->setSecurityOrigin(securityOrigin()); 261 m_responseDocument->setSecurityOrigin(securityOrigin());
261 m_responseDocument->setContextFeatures(document()->contextFeatures() ); 262 m_responseDocument->setContextFeatures(document()->contextFeatures() );
262 if (!m_responseDocument->wellFormed()) 263 if (!m_responseDocument->wellFormed())
263 m_responseDocument = nullptr; 264 m_responseDocument = nullptr;
264 } 265 }
265 m_createdDocument = true; 266 m_createdDocument = true;
266 } 267 }
267 268
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 return ActiveDOMObject::executionContext(); 1393 return ActiveDOMObject::executionContext();
1393 } 1394 }
1394 1395
1395 void XMLHttpRequest::trace(Visitor* visitor) 1396 void XMLHttpRequest::trace(Visitor* visitor)
1396 { 1397 {
1397 visitor->trace(m_responseBlob); 1398 visitor->trace(m_responseBlob);
1398 visitor->trace(m_responseStream); 1399 visitor->trace(m_responseStream);
1399 } 1400 }
1400 1401
1401 } // namespace WebCore 1402 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/svg-created-by-xhr-allowed-in-dashboard-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698