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

Side by Side Diff: Source/core/loader/ImageLoader.cpp

Issue 113633005: Cancel load event on a failed image resource fetch. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test for broken images Created 7 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
« no previous file with comments | « LayoutTests/http/tests/misc/image-onerror-no-load-event-expected.txt ('k') | no next file » | 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv ed.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return; 284 return;
285 } 285 }
286 286
287 if (resource->wasCanceled()) { 287 if (resource->wasCanceled()) {
288 m_hasPendingLoadEvent = false; 288 m_hasPendingLoadEvent = false;
289 // Only consider updating the protection ref-count of the Element immedi ately before returning 289 // Only consider updating the protection ref-count of the Element immedi ately before returning
290 // from this function as doing so might result in the destruction of thi s ImageLoader. 290 // from this function as doing so might result in the destruction of thi s ImageLoader.
291 updatedHasPendingEvent(); 291 updatedHasPendingEvent();
292 return; 292 return;
293 } 293 }
294 if (resource->errorOccurred()) {
295 loadEventSender().cancelEvent(this);
296 m_hasPendingLoadEvent = false;
294 297
298 m_hasPendingErrorEvent = true;
299 errorEventSender().dispatchEventSoon(this);
300
301 // Only consider updating the protection ref-count of the Element immedi ately before returning
302 // from this function as doing so might result in the destruction of thi s ImageLoader.
303 updatedHasPendingEvent();
304 return;
305 }
295 loadEventSender().dispatchEventSoon(this); 306 loadEventSender().dispatchEventSoon(this);
296 } 307 }
297 308
298 RenderImageResource* ImageLoader::renderImageResource() 309 RenderImageResource* ImageLoader::renderImageResource()
299 { 310 {
300 RenderObject* renderer = m_element->renderer(); 311 RenderObject* renderer = m_element->renderer();
301 312
302 if (!renderer) 313 if (!renderer)
303 return 0; 314 return 0;
304 315
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 handle->notifyImageSourceChanged(); 486 handle->notifyImageSourceChanged();
476 } 487 }
477 } 488 }
478 489
479 inline void ImageLoader::clearFailedLoadURL() 490 inline void ImageLoader::clearFailedLoadURL()
480 { 491 {
481 m_failedLoadURL = AtomicString(); 492 m_failedLoadURL = AtomicString();
482 } 493 }
483 494
484 } 495 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/misc/image-onerror-no-load-event-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698