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

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

Issue 2839633003: Consider empty url case when loading image (Closed)
Patch Set: added unit test Created 3 years, 8 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
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 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 // Make sure to only decrement the count when we exit this function 284 // Make sure to only decrement the count when we exit this function
285 std::unique_ptr<IncrementLoadEventDelayCount> load_delay_counter; 285 std::unique_ptr<IncrementLoadEventDelayCount> load_delay_counter;
286 load_delay_counter.swap(load_delay_counter_); 286 load_delay_counter.swap(load_delay_counter_);
287 287
288 Document& document = element_->GetDocument(); 288 Document& document = element_->GetDocument();
289 if (!document.IsActive()) 289 if (!document.IsActive())
290 return; 290 return;
291 291
292 AtomicString image_source_url = element_->ImageSourceURL(); 292 AtomicString image_source_url = element_->ImageSourceURL();
293 ImageResourceContent* new_image = nullptr; 293 ImageResourceContent* new_image = nullptr;
294 if (!url.IsNull()) { 294 if (!url.IsNull() && !url.IsEmpty()) {
295 // Unlike raw <img>, we block mixed content inside of <picture> or 295 // Unlike raw <img>, we block mixed content inside of <picture> or
296 // <img srcset>. 296 // <img srcset>.
297 ResourceLoaderOptions resource_loader_options = 297 ResourceLoaderOptions resource_loader_options =
298 ResourceFetcher::DefaultResourceOptions(); 298 ResourceFetcher::DefaultResourceOptions();
299 ResourceRequest resource_request(url); 299 ResourceRequest resource_request(url);
300 if (update_behavior == kUpdateForcedReload) { 300 if (update_behavior == kUpdateForcedReload) {
301 resource_request.SetCachePolicy(WebCachePolicy::kBypassingCache); 301 resource_request.SetCachePolicy(WebCachePolicy::kBypassingCache);
302 resource_request.SetPreviewsState(WebURLRequest::kPreviewsNoTransform); 302 resource_request.SetPreviewsState(WebURLRequest::kPreviewsNoTransform);
303 } 303 }
304 304
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 637 }
638 638
639 void ImageLoader::ElementDidMoveToNewDocument() { 639 void ImageLoader::ElementDidMoveToNewDocument() {
640 if (load_delay_counter_) 640 if (load_delay_counter_)
641 load_delay_counter_->DocumentChanged(element_->GetDocument()); 641 load_delay_counter_->DocumentChanged(element_->GetDocument());
642 ClearFailedLoadURL(); 642 ClearFailedLoadURL();
643 SetImage(0); 643 SetImage(0);
644 } 644 }
645 645
646 } // namespace blink 646 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698