OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 20 matching lines...) Expand all Loading... | |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/html/HTMLImportsController.h" | 32 #include "core/html/HTMLImportsController.h" |
33 | 33 |
34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
35 #include "core/html/HTMLDocument.h" | 35 #include "core/html/HTMLDocument.h" |
36 #include "core/html/HTMLLinkElement.h" | 36 #include "core/html/HTMLLinkElement.h" |
37 #include "core/loader/CrossOriginAccessControl.h" | 37 #include "core/loader/CrossOriginAccessControl.h" |
38 #include "core/loader/DocumentWriter.h" | 38 #include "core/loader/DocumentWriter.h" |
39 #include "core/loader/cache/CachedScript.h" | 39 #include "core/loader/cache/CachedScript.h" |
40 #include "core/loader/cache/ResourceFetcher.h" | 40 #include "core/loader/cache/ResourceFetcher.h" |
41 #include "core/page/ContentSecurityPolicy.h" | |
41 #include "weborigin/SecurityOrigin.h" | 42 #include "weborigin/SecurityOrigin.h" |
42 | 43 |
43 namespace WebCore { | 44 namespace WebCore { |
44 | 45 |
45 PassRefPtr<LinkImport> LinkImport::create(HTMLLinkElement* owner) | 46 PassRefPtr<LinkImport> LinkImport::create(HTMLLinkElement* owner) |
46 { | 47 { |
47 return adoptRef(new LinkImport(owner)); | 48 return adoptRef(new LinkImport(owner)); |
48 } | 49 } |
49 | 50 |
50 LinkImport::LinkImport(HTMLLinkElement* owner) | 51 LinkImport::LinkImport(HTMLLinkElement* owner) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 } | 84 } |
84 | 85 |
85 HTMLImportsController* controller = m_owner->document()->import()->controlle r(); | 86 HTMLImportsController* controller = m_owner->document()->import()->controlle r(); |
86 if (RefPtr<HTMLImportLoader> found = controller->findLinkFor(builder.url())) { | 87 if (RefPtr<HTMLImportLoader> found = controller->findLinkFor(builder.url())) { |
87 m_loader = found; | 88 m_loader = found; |
88 return; | 89 return; |
89 } | 90 } |
90 | 91 |
91 FetchRequest request = builder.build(true); | 92 FetchRequest request = builder.build(true); |
92 request.setPotentiallyCrossOriginEnabled(controller->securityOrigin(), DoNot AllowStoredCredentials); | 93 request.setPotentiallyCrossOriginEnabled(controller->securityOrigin(), DoNot AllowStoredCredentials); |
93 CachedResourceHandle<CachedRawResource> resource = controller->fetcher()->re questRawResource(request); | 94 CachedResourceHandle<CachedRawResource> resource = m_owner->document()->fetc her()->requestImport(request); |
abarth-chromium
2013/07/25 04:53:09
requestImport -> fetchImport ? :)
Not worth re
| |
94 if (!resource) | 95 if (!resource) |
95 return; | 96 return; |
96 | 97 |
97 m_loader = HTMLImportLoader::create(controller, builder.url(), resource); | 98 m_loader = HTMLImportLoader::create(controller, builder.url(), resource); |
98 } | 99 } |
99 | 100 |
100 void LinkImport::ownerRemoved() | 101 void LinkImport::ownerRemoved() |
101 { | 102 { |
102 m_owner = 0; | 103 m_owner = 0; |
103 m_loader.clear(); | 104 m_loader.clear(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 controller->didLoad(this); | 174 controller->didLoad(this); |
174 } | 175 } |
175 | 176 |
176 HTMLImportLoader::State HTMLImportLoader::startParsing(const ResourceResponse& r esponse) | 177 HTMLImportLoader::State HTMLImportLoader::startParsing(const ResourceResponse& r esponse) |
177 { | 178 { |
178 // Current canAccess() implementation isn't sufficient for catching cross-do main redirects: http://crbug.com/256976 | 179 // Current canAccess() implementation isn't sufficient for catching cross-do main redirects: http://crbug.com/256976 |
179 if (!controller()->fetcher()->canAccess(m_resource.get())) | 180 if (!controller()->fetcher()->canAccess(m_resource.get())) |
180 return StateError; | 181 return StateError; |
181 | 182 |
182 m_importedDocument = HTMLDocument::create(DocumentInit(response.url(), 0, th is)); | 183 m_importedDocument = HTMLDocument::create(DocumentInit(response.url(), 0, th is)); |
184 m_importedDocument->initContentSecurityPolicy(ContentSecurityPolicyResponseH eaders(response)); | |
183 m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeTyp e(), response.textEncodingName()); | 185 m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeTyp e(), response.textEncodingName()); |
184 | 186 |
185 return StateLoading; | 187 return StateLoading; |
186 } | 188 } |
187 | 189 |
188 HTMLImportLoader::State HTMLImportLoader::finish() | 190 HTMLImportLoader::State HTMLImportLoader::finish() |
189 { | 191 { |
190 if (!m_parent) | 192 if (!m_parent) |
191 return StateError; | 193 return StateError; |
192 // The writer instance indicates that a part of the document can be already loaded. | 194 // The writer instance indicates that a part of the document can be already loaded. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
322 { | 324 { |
323 return m_master; | 325 return m_master; |
324 } | 326 } |
325 | 327 |
326 void HTMLImportsController::wasDetachedFromDocument() | 328 void HTMLImportsController::wasDetachedFromDocument() |
327 { | 329 { |
328 clear(); | 330 clear(); |
329 } | 331 } |
330 | 332 |
331 } // namespace WebCore | 333 } // namespace WebCore |
OLD | NEW |