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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 2535383003: Collapse images disallowed by the Safe Browsing Subresource Filter. (Closed)
Patch Set: Rebase. Created 4 years 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
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) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 ImageResource* ImageResource::fetch(FetchRequest& request, 77 ImageResource* ImageResource::fetch(FetchRequest& request,
78 ResourceFetcher* fetcher) { 78 ResourceFetcher* fetcher) {
79 if (request.resourceRequest().requestContext() == 79 if (request.resourceRequest().requestContext() ==
80 WebURLRequest::RequestContextUnspecified) { 80 WebURLRequest::RequestContextUnspecified) {
81 request.mutableResourceRequest().setRequestContext( 81 request.mutableResourceRequest().setRequestContext(
82 WebURLRequest::RequestContextImage); 82 WebURLRequest::RequestContextImage);
83 } 83 }
84 if (fetcher->context().pageDismissalEventBeingDispatched()) { 84 if (fetcher->context().pageDismissalEventBeingDispatched()) {
85 KURL requestURL = request.resourceRequest().url(); 85 KURL requestURL = request.resourceRequest().url();
86 if (requestURL.isValid() && 86 if (requestURL.isValid()) {
87 fetcher->context().canRequest(Resource::Image, 87 ResourceRequestBlockedReason blockReason = fetcher->context().canRequest(
88 request.resourceRequest(), requestURL, 88 Resource::Image, request.resourceRequest(), requestURL,
89 request.options(), request.forPreload(), 89 request.options(), request.forPreload(),
90 request.getOriginRestriction())) 90 request.getOriginRestriction());
91 fetcher->context().sendImagePing(requestURL); 91 if (blockReason == ResourceRequestBlockedReason::None)
92 fetcher->context().sendImagePing(requestURL);
93 }
92 return nullptr; 94 return nullptr;
93 } 95 }
94 96
95 ImageResource* resource = toImageResource( 97 ImageResource* resource = toImageResource(
96 fetcher->requestResource(request, ImageResourceFactory(request))); 98 fetcher->requestResource(request, ImageResourceFactory(request)));
97 if (resource && 99 if (resource &&
98 request.placeholderImageRequestType() != FetchRequest::AllowPlaceholder && 100 request.placeholderImageRequestType() != FetchRequest::AllowPlaceholder &&
99 resource->m_isPlaceholder) { 101 resource->m_isPlaceholder) {
100 // If the image is a placeholder, but this fetch doesn't allow a 102 // If the image is a placeholder, but this fetch doesn't allow a
101 // placeholder, then load the original image. Note that the cache is not 103 // placeholder, then load the original image. Note that the cache is not
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 WebServiceWorkerResponseTypeOpaque; 715 WebServiceWorkerResponseTypeOpaque;
714 } 716 }
715 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 717 if (!getImage()->currentFrameHasSingleSecurityOrigin())
716 return false; 718 return false;
717 if (passesAccessControlCheck(securityOrigin)) 719 if (passesAccessControlCheck(securityOrigin))
718 return true; 720 return true;
719 return !securityOrigin->taintsCanvas(response().url()); 721 return !securityOrigin->taintsCanvas(response().url());
720 } 722 }
721 723
722 } // namespace blink 724 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/FetchContext.h ('k') | third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698