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

Side by Side Diff: third_party/WebKit/Source/core/html/ImageDocument.cpp

Issue 2261403004: ImageDocumentParser should stop sending data to ImageResource once decoding fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/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) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (!length) 137 if (!length)
138 return; 138 return;
139 139
140 LocalFrame* frame = document()->frame(); 140 LocalFrame* frame = document()->frame();
141 Settings* settings = frame->settings(); 141 Settings* settings = frame->settings();
142 if (!frame->loader().client()->allowImage(!settings || settings->imagesEnabl ed(), document()->url())) 142 if (!frame->loader().client()->allowImage(!settings || settings->imagesEnabl ed(), document()->url()))
143 return; 143 return;
144 144
145 if (document()->cachedImage()) { 145 if (document()->cachedImage()) {
146 RELEASE_ASSERT(length <= std::numeric_limits<unsigned>::max()); 146 RELEASE_ASSERT(length <= std::numeric_limits<unsigned>::max());
147 document()->cachedImage()->appendData(data, length); 147 // If decoding has already failed, there's no point in sending additiona l data to the ImageResource.
148 if (document()->cachedImage()->getStatus() != Resource::DecodeError)
149 document()->cachedImage()->appendData(data, length);
148 } 150 }
149 151
150 if (!isDetached()) 152 if (!isDetached())
151 document()->imageUpdated(); 153 document()->imageUpdated();
152 } 154 }
153 155
154 void ImageDocumentParser::finish() 156 void ImageDocumentParser::finish()
155 { 157 {
156 if (!isStopped() && document()->imageElement() && document()->cachedImage()) { 158 if (!isStopped() && document()->imageElement() && document()->cachedImage()) {
157 ImageResource* cachedImage = document()->cachedImage(); 159 ImageResource* cachedImage = document()->cachedImage();
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 442 }
441 443
442 bool ImageEventListener::operator==(const EventListener& listener) const 444 bool ImageEventListener::operator==(const EventListener& listener) const
443 { 445 {
444 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener)) 446 if (const ImageEventListener* imageEventListener = ImageEventListener::cast( &listener))
445 return m_doc == imageEventListener->m_doc; 447 return m_doc == imageEventListener->m_doc;
446 return false; 448 return false;
447 } 449 }
448 450
449 } // namespace blink 451 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698