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

Side by Side Diff: Source/core/html/HTMLImportsController.cpp

Issue 19940002: [HTML Import] Respect Content Security Policy Model (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix mac build failure. Created 7 years, 5 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
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 HTMLImportsController* controller = m_owner->document()->import()->controlle r(); 85 HTMLImportsController* controller = m_owner->document()->import()->controlle r();
86 if (RefPtr<HTMLImportLoader> found = controller->findLinkFor(builder.url())) { 86 if (RefPtr<HTMLImportLoader> found = controller->findLinkFor(builder.url())) {
87 m_loader = found; 87 m_loader = found;
88 return; 88 return;
89 } 89 }
90 90
91 CachedResourceRequest request = builder.build(true); 91 CachedResourceRequest request = builder.build(true);
92 request.setPotentiallyCrossOriginEnabled(controller->securityOrigin(), DoNot AllowStoredCredentials); 92 request.setPotentiallyCrossOriginEnabled(controller->securityOrigin(), DoNot AllowStoredCredentials);
93 CachedResourceHandle<CachedRawResource> resource = controller->cachedResourc eLoader()->requestRawResource(request); 93 CachedResourceHandle<CachedRawResource> resource = controller->cachedResourc eLoader()->requestImport(request);
94 if (!resource) 94 if (!resource)
95 return; 95 return;
96 96
97 m_loader = HTMLImportLoader::create(controller, builder.url(), resource); 97 m_loader = HTMLImportLoader::create(controller, builder.url(), resource);
98 } 98 }
99 99
100 void LinkImport::ownerRemoved() 100 void LinkImport::ownerRemoved()
101 { 101 {
102 m_owner = 0; 102 m_owner = 0;
103 m_loader.clear(); 103 m_loader.clear();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 controller->didLoad(this); 173 controller->didLoad(this);
174 } 174 }
175 175
176 HTMLImportLoader::State HTMLImportLoader::startParsing(const ResourceResponse& r esponse) 176 HTMLImportLoader::State HTMLImportLoader::startParsing(const ResourceResponse& r esponse)
177 { 177 {
178 // Current canAccess() implementation isn't sufficient for catching cross-do main redirects: http://crbug.com/256976 178 // Current canAccess() implementation isn't sufficient for catching cross-do main redirects: http://crbug.com/256976
179 if (!controller()->cachedResourceLoader()->canAccess(m_resource.get())) 179 if (!controller()->cachedResourceLoader()->canAccess(m_resource.get()))
180 return StateError; 180 return StateError;
181 181
182 m_importedDocument = HTMLDocument::create(DocumentInit(response.url(), 0, th is)); 182 m_importedDocument = HTMLDocument::create(DocumentInit(response.url(), 0, th is));
183 m_importedDocument->initContentSecurityPolicy();
183 m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeTyp e(), response.textEncodingName()); 184 m_writer = DocumentWriter::create(m_importedDocument.get(), response.mimeTyp e(), response.textEncodingName());
184 185
185 return StateLoading; 186 return StateLoading;
186 } 187 }
187 188
188 HTMLImportLoader::State HTMLImportLoader::finish() 189 HTMLImportLoader::State HTMLImportLoader::finish()
189 { 190 {
190 if (!m_parent) 191 if (!m_parent)
191 return StateError; 192 return StateError;
192 // The writer instance indicates that a part of the document can be already loaded. 193 // 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
322 { 323 {
323 return m_master; 324 return m_master;
324 } 325 }
325 326
326 void HTMLImportsController::wasDetachedFromDocument() 327 void HTMLImportsController::wasDetachedFromDocument()
327 { 328 {
328 clear(); 329 clear();
329 } 330 }
330 331
331 } // namespace WebCore 332 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698