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

Side by Side Diff: Source/core/fetch/ResourceFetcher.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
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
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 Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 break; 550 break;
551 } 551 }
552 552
553 // SVG Images have unique security rules that prevent all subresource reques ts 553 // SVG Images have unique security rules that prevent all subresource reques ts
554 // except for data urls. 554 // except for data urls.
555 if (type != Resource::MainResource) { 555 if (type != Resource::MainResource) {
556 if (frame() && frame()->chromeClient().isSVGImageChromeClient() && !url. protocolIsData()) 556 if (frame() && frame()->chromeClient().isSVGImageChromeClient() && !url. protocolIsData())
557 return false; 557 return false;
558 } 558 }
559 559
560 // FIXME: Once we use RequestContext for CSP (http://crbug.com/390497), remo ve this extra check.
561 if (resourceRequest.requestContext() == WebURLRequest::RequestContextManifes t) {
562 if (!shouldBypassMainWorldCSP && !csp->allowManifestFromSource(url, cspR eporting))
563 return false;
564 }
565
560 // Measure the number of legacy URL schemes ('ftp://') and the number of emb edded-credential 566 // Measure the number of legacy URL schemes ('ftp://') and the number of emb edded-credential
561 // ('http://user:password@...') resources embedded as subresources. in the h opes that we can 567 // ('http://user:password@...') resources embedded as subresources. in the h opes that we can
562 // block them at some point in the future. 568 // block them at some point in the future.
563 if (resourceRequest.frameType() != WebURLRequest::FrameTypeTopLevel) { 569 if (resourceRequest.frameType() != WebURLRequest::FrameTypeTopLevel) {
564 if (SchemeRegistry::shouldTreatURLSchemeAsLegacy(url.protocol()) && !Sch emeRegistry::shouldTreatURLSchemeAsLegacy(frame()->document()->securityOrigin()- >protocol())) 570 if (SchemeRegistry::shouldTreatURLSchemeAsLegacy(url.protocol()) && !Sch emeRegistry::shouldTreatURLSchemeAsLegacy(frame()->document()->securityOrigin()- >protocol()))
565 UseCounter::count(frame()->document(), UseCounter::LegacyProtocolEmb eddedAsSubresource); 571 UseCounter::count(frame()->document(), UseCounter::LegacyProtocolEmb eddedAsSubresource);
566 if (!url.user().isEmpty() || !url.pass().isEmpty()) 572 if (!url.user().isEmpty() || !url.pass().isEmpty())
567 UseCounter::count(frame()->document(), UseCounter::RequestedSubresou rceWithEmbeddedCredentials); 573 UseCounter::count(frame()->document(), UseCounter::RequestedSubresou rceWithEmbeddedCredentials);
568 } 574 }
569 575
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 1514
1509 void ResourceFetcher::trace(Visitor* visitor) 1515 void ResourceFetcher::trace(Visitor* visitor)
1510 { 1516 {
1511 visitor->trace(m_document); 1517 visitor->trace(m_document);
1512 visitor->trace(m_loaders); 1518 visitor->trace(m_loaders);
1513 visitor->trace(m_multipartLoaders); 1519 visitor->trace(m_multipartLoaders);
1514 ResourceLoaderHost::trace(visitor); 1520 ResourceLoaderHost::trace(visitor);
1515 } 1521 }
1516 1522
1517 } 1523 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698