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

Side by Side Diff: Source/web/AssociatedURLLoader.cpp

Issue 570563003: Implement CSP check for manifest fetching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed nit from mkwst Created 6 years, 2 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/testing/URLTestHelpers.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) 2010, 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2010, 2011, 2012 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::ForcePreflight, ForcePreflight ); 308 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::ForcePreflight, ForcePreflight );
309 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::PreventPreflight, PreventPrefl ight); 309 COMPILE_ASSERT_MATCHING_ENUM(WebURLLoaderOptions::PreventPreflight, PreventPrefl ight);
310 310
311 void AssociatedURLLoader::loadSynchronously(const WebURLRequest& request, WebURL Response& response, WebURLError& error, WebData& data) 311 void AssociatedURLLoader::loadSynchronously(const WebURLRequest& request, WebURL Response& response, WebURLError& error, WebData& data)
312 { 312 {
313 ASSERT(0); // Synchronous loading is not supported. 313 ASSERT(0); // Synchronous loading is not supported.
314 } 314 }
315 315
316 void AssociatedURLLoader::loadAsynchronously(const WebURLRequest& request, WebUR LLoaderClient* client) 316 void AssociatedURLLoader::loadAsynchronously(const WebURLRequest& request, WebUR LLoaderClient* client)
317 { 317 {
318 ASSERT(!m_loader);
318 ASSERT(!m_client); 319 ASSERT(!m_client);
319 320
320 m_client = client; 321 m_client = client;
321 ASSERT(m_client); 322 ASSERT(m_client);
322 323
323 bool allowLoad = true; 324 bool allowLoad = true;
324 WebURLRequest newRequest(request); 325 WebURLRequest newRequest(request);
325 if (m_options.untrustedHTTP) { 326 if (m_options.untrustedHTTP) {
326 WebString method = newRequest.httpMethod(); 327 WebString method = newRequest.httpMethod();
327 allowLoad = isValidHTTPToken(method) && FetchUtils::isUsefulMethod(metho d); 328 allowLoad = isValidHTTPToken(method) && FetchUtils::isUsefulMethod(metho d);
(...skipping 20 matching lines...) Expand all
348 if (webcoreRequest.requestContext() == WebURLRequest::RequestContextUnsp ecified) { 349 if (webcoreRequest.requestContext() == WebURLRequest::RequestContextUnsp ecified) {
349 // FIXME: We load URLs without setting a TargetType (and therefore a request context) in several 350 // FIXME: We load URLs without setting a TargetType (and therefore a request context) in several
350 // places in content/ (P2PPortAllocatorSession::AllocateLegacyRelayS ession, for example). Remove 351 // places in content/ (P2PPortAllocatorSession::AllocateLegacyRelayS ession, for example). Remove
351 // this once those places are patched up. 352 // this once those places are patched up.
352 newRequest.setRequestContext(WebURLRequest::RequestContextInternal); 353 newRequest.setRequestContext(WebURLRequest::RequestContextInternal);
353 } 354 }
354 355
355 Document* webcoreDocument = m_frameImpl->frame()->document(); 356 Document* webcoreDocument = m_frameImpl->frame()->document();
356 ASSERT(webcoreDocument); 357 ASSERT(webcoreDocument);
357 m_loader = DocumentThreadableLoader::create(*webcoreDocument, m_clientAd apter.get(), webcoreRequest, options, resourceLoaderOptions); 358 m_loader = DocumentThreadableLoader::create(*webcoreDocument, m_clientAd apter.get(), webcoreRequest, options, resourceLoaderOptions);
358 } else { 359 }
360
361 if (!m_loader) {
359 // FIXME: return meaningful error codes. 362 // FIXME: return meaningful error codes.
360 m_clientAdapter->setDelayedError(ResourceError()); 363 m_clientAdapter->setDelayedError(ResourceError());
361 } 364 }
362 m_clientAdapter->enableErrorNotifications(); 365 m_clientAdapter->enableErrorNotifications();
363 } 366 }
364 367
365 void AssociatedURLLoader::cancel() 368 void AssociatedURLLoader::cancel()
366 { 369 {
367 if (m_clientAdapter) 370 if (m_clientAdapter)
368 m_clientAdapter->clearClient(); 371 m_clientAdapter->clearClient();
369 if (m_loader) 372 if (m_loader)
370 m_loader->cancel(); 373 m_loader->cancel();
371 } 374 }
372 375
373 void AssociatedURLLoader::setDefersLoading(bool defersLoading) 376 void AssociatedURLLoader::setDefersLoading(bool defersLoading)
374 { 377 {
375 if (m_loader) 378 if (m_loader)
376 m_loader->setDefersLoading(defersLoading); 379 m_loader->setDefersLoading(defersLoading);
377 } 380 }
378 381
379 } // namespace blink 382 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/testing/URLTestHelpers.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698