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

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: Initial draft. 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 fetcher->context().canRequest(Resource::Image,
88 request.resourceRequest(), requestURL, 88 request.resourceRequest(), requestURL,
89 request.options(), request.forPreload(), 89 request.options(), request.forPreload(),
90 request.getOriginRestriction())) 90 request.getOriginRestriction()) ==
91 ResourceRequestBlockedReason::None) {
Mike West 2016/11/30 15:57:35 Nit: this is pretty ugly, but I'm not sure I have
engedy 2016/11/30 17:37:39 Introduced a helper variable, not sure it helped m
91 fetcher->context().sendImagePing(requestURL); 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 WebServiceWorkerResponseTypeOpaque; 720 WebServiceWorkerResponseTypeOpaque;
719 } 721 }
720 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 722 if (!getImage()->currentFrameHasSingleSecurityOrigin())
721 return false; 723 return false;
722 if (passesAccessControlCheck(securityOrigin)) 724 if (passesAccessControlCheck(securityOrigin))
723 return true; 725 return true;
724 return !securityOrigin->taintsCanvas(response().url()); 726 return !securityOrigin->taintsCanvas(response().url());
725 } 727 }
726 728
727 } // namespace blink 729 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698