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

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 537983002: Mixed Content: introduce WebURLRequest::RequestContext checks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 years, 3 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 | « no previous file | Source/core/loader/ImageLoader.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) 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 ASSERT(document()); 292 ASSERT(document());
293 request.mutableResourceRequest().setTimeoutInterval(10); 293 request.mutableResourceRequest().setTimeoutInterval(10);
294 ResourceLoaderOptions options(request.options()); 294 ResourceLoaderOptions options(request.options());
295 options.synchronousPolicy = RequestSynchronously; 295 options.synchronousPolicy = RequestSynchronously;
296 request.setOptions(options); 296 request.setOptions(options);
297 return requestResource(Resource::Raw, request); 297 return requestResource(Resource::Raw, request);
298 } 298 }
299 299
300 ResourcePtr<ImageResource> ResourceFetcher::fetchImage(FetchRequest& request) 300 ResourcePtr<ImageResource> ResourceFetcher::fetchImage(FetchRequest& request)
301 { 301 {
302 if (request.resourceRequest().requestContext() == WebURLRequest::RequestCont extUnspecified)
303 request.mutableResourceRequest().setRequestContext(WebURLRequest::Reques tContextImage);
302 if (LocalFrame* f = frame()) { 304 if (LocalFrame* f = frame()) {
303 if (f->document()->pageDismissalEventBeingDispatched() != Document::NoDi smissal) { 305 if (f->document()->pageDismissalEventBeingDispatched() != Document::NoDi smissal) {
304 KURL requestURL = request.resourceRequest().url(); 306 KURL requestURL = request.resourceRequest().url();
305 if (requestURL.isValid() && canRequest(Resource::Image, request.reso urceRequest(), requestURL, request.options(), request.forPreload(), request.orig inRestriction())) 307 if (requestURL.isValid() && canRequest(Resource::Image, request.reso urceRequest(), requestURL, request.options(), request.forPreload(), request.orig inRestriction()))
306 PingLoader::loadImage(f, requestURL); 308 PingLoader::loadImage(f, requestURL);
307 return 0; 309 return 0;
308 } 310 }
309 } 311 }
310 312
311 if (request.resourceRequest().url().protocolIsData()) 313 if (request.resourceRequest().url().protocolIsData())
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 LocalFrame* effectiveFrame = frame(); 632 LocalFrame* effectiveFrame = frame();
631 MixedContentBlockingTreatment effectiveTreatment = options.mixedContentBlock ingTreatment; 633 MixedContentBlockingTreatment effectiveTreatment = options.mixedContentBlock ingTreatment;
632 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) { 634 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) {
633 effectiveTreatment = TreatAsActiveContent; 635 effectiveTreatment = TreatAsActiveContent;
634 // FIXME: Deal with RemoteFrames. 636 // FIXME: Deal with RemoteFrames.
635 if (frame()->tree().parent()->isLocalFrame()) 637 if (frame()->tree().parent()->isLocalFrame())
636 effectiveFrame = toLocalFrame(frame()->tree().parent()); 638 effectiveFrame = toLocalFrame(frame()->tree().parent());
637 } 639 }
638 640
639 // FIXME: Should we consider forPreload here? 641 // FIXME: Should we consider forPreload here?
640 if (!checkInsecureContent(type, url, effectiveFrame, effectiveTreatment)) 642 if (!checkInsecureContent(type, url, effectiveFrame, effectiveTreatment)) {
643 ASSERT(MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReq uest, url));
641 return false; 644 return false;
645 }
642 646
647 ASSERT(!MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReques t, url));
643 return true; 648 return true;
644 } 649 }
645 650
646 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour ceOrigin, const KURL& url) const 651 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour ceOrigin, const KURL& url) const
647 { 652 {
648 // Redirects can change the response URL different from one of request. 653 // Redirects can change the response URL different from one of request.
649 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource ->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict ionForType)) 654 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource ->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict ionForType))
650 return false; 655 return false;
651 656
652 if (!sourceOrigin && document()) 657 if (!sourceOrigin && document())
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 1571
1567 void ResourceFetcher::trace(Visitor* visitor) 1572 void ResourceFetcher::trace(Visitor* visitor)
1568 { 1573 {
1569 visitor->trace(m_document); 1574 visitor->trace(m_document);
1570 visitor->trace(m_loaders); 1575 visitor->trace(m_loaders);
1571 visitor->trace(m_multipartLoaders); 1576 visitor->trace(m_multipartLoaders);
1572 ResourceLoaderHost::trace(visitor); 1577 ResourceLoaderHost::trace(visitor);
1573 } 1578 }
1574 1579
1575 } 1580 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698