|
|
Chromium Code Reviews|
Created:
6 years, 6 months ago by mnaganov (inactive) Modified:
6 years, 5 months ago CC:
blink-reviews, Nate Chapin, gavinp+loader_chromium.org Base URL:
svn://svn.chromium.org/blink/trunk Project:
blink Visibility:
Public. |
DescriptionFix loading of data: URI images wrt loadsImagesAutomatically setting
This fixes AwSettingsTest#testBlockNetworkImagesDoesNotBlockDataUrlImage
in Chrome broken after Blink r176642
BUG=356292, 387101
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=177425
Patch Set 1 #
Total comments: 6
Patch Set 2 : Addressed comments and fixed SVG image tests #
Total comments: 2
Patch Set 3 : A better approach #
Total comments: 2
Patch Set 4 : Comments addressed #Patch Set 5 : Fixed reload-subresource-when-type-changes.html failure #Patch Set 6 : Now correctly #
Messages
Total messages: 25 (0 generated)
Nate is high lord of the loader soup.
Thanks for routing the issue, Eric! Nate, here is some context about this issue: https://code.google.com/p/chromium/issues/detail?id=356292#c17
https://codereview.chromium.org/355043002/diff/1/LayoutTests/loader/data-uri-... File LayoutTests/loader/data-uri-images-load-when-loading-images-automatically-disabled.html (right): https://codereview.chromium.org/355043002/diff/1/LayoutTests/loader/data-uri-... LayoutTests/loader/data-uri-images-load-when-loading-images-automatically-disabled.html:7: testRunner.waitUntilDone(); You shouldn't have to wait until done? onload won't be sent until all subresources are loaded... We don't dump until onload is sent. https://codereview.chromium.org/355043002/diff/1/LayoutTests/loader/data-uri-... LayoutTests/loader/data-uri-images-load-when-loading-images-automatically-disabled.html:22: setTimeout(timeout, 15000); You souldn't need this. content_shell knows how to time out itself. :) I would set this to *way* smaller if you want to have your own timeout. Also, I think images have an onerror handler you could use instead. https://codereview.chromium.org/355043002/diff/1/Source/core/fetch/ResourceFe... File Source/core/fetch/ResourceFetcher.cpp (right): https://codereview.chromium.org/355043002/diff/1/Source/core/fetch/ResourceFe... Source/core/fetch/ResourceFetcher.cpp:874: ResourcePtr<Resource> resource = type == Resource::Image && request.resourceRequest().url().protocolIsData() ? Do we want to just push this logic down into createResource?
Argh, it looks like the change breaks "data:image/svg+xml" images, so I need to reconsider it. https://codereview.chromium.org/355043002/diff/1/LayoutTests/loader/data-uri-... File LayoutTests/loader/data-uri-images-load-when-loading-images-automatically-disabled.html (right): https://codereview.chromium.org/355043002/diff/1/LayoutTests/loader/data-uri-... LayoutTests/loader/data-uri-images-load-when-loading-images-automatically-disabled.html:7: testRunner.waitUntilDone(); On 2014/06/26 16:24:35, eseidel wrote: > You shouldn't have to wait until done? onload won't be sent until all > subresources are loaded... We don't dump until onload is sent. Thanks for the tip! Indeed, this isn't needed. https://codereview.chromium.org/355043002/diff/1/LayoutTests/loader/data-uri-... LayoutTests/loader/data-uri-images-load-when-loading-images-automatically-disabled.html:22: setTimeout(timeout, 15000); On 2014/06/26 16:24:35, eseidel wrote: > You souldn't need this. content_shell knows how to time out itself. :) I would > set this to *way* smaller if you want to have your own timeout. Also, I think > images have an onerror handler you could use instead. Removed the timeout. I can't use onerror because loadsImagesAutomatically doesn't forbid loading images, it just defers loading. Anyway, the test now prints "PASS" on success, or leaves a message I have added as a default body text. https://codereview.chromium.org/355043002/diff/1/Source/core/fetch/ResourceFe... File Source/core/fetch/ResourceFetcher.cpp (right): https://codereview.chromium.org/355043002/diff/1/Source/core/fetch/ResourceFe... Source/core/fetch/ResourceFetcher.cpp:874: ResourcePtr<Resource> resource = type == Resource::Image && request.resourceRequest().url().protocolIsData() ? On 2014/06/26 16:24:35, eseidel wrote: > Do we want to just push this logic down into createResource? I don't think so, because imageResourceFromDataURIRequest uses createResource by itself so we will create an infinite loop :)
OK, SVG tests should work now. data:image/svg+xml is a special case within a special case.
https://codereview.chromium.org/355043002/diff/20001/Source/core/fetch/Resour... File Source/core/fetch/ResourceFetcher.cpp (right): https://codereview.chromium.org/355043002/diff/20001/Source/core/fetch/Resour... Source/core/fetch/ResourceFetcher.cpp:154: if (!data || mimetype == "image/svg+xml") Comments would be helpful. :) https://codereview.chromium.org/355043002/diff/20001/Source/core/fetch/Resour... Source/core/fetch/ResourceFetcher.cpp:875: if (type == Resource::Image && request.resourceRequest().url().protocolIsData()) Are any other callers going to want this wrapping around imageResource/createResource? Should this be a in re-usable helper?
I think I have found a better approach -- just make ResourceFetcher::requestPreload to use the same fetch function as ImageLoader does. BTW, I have noticed that ResourceFetcher::fetchUserCSSStyleSheet also contains special logic that may be bypassed by ResourceFetcher::requestPreload. Maybe this needs to be fixed too?
eseidel@, japhet@: Can you please take a look?
LGTM https://codereview.chromium.org/355043002/diff/40001/LayoutTests/loader/data-... File LayoutTests/loader/data-uri-images-load-when-loading-images-automatically-disabled.html (right): https://codereview.chromium.org/355043002/diff/40001/LayoutTests/loader/data-... LayoutTests/loader/data-uri-images-load-when-loading-images-automatically-disabled.html:6: if (window.testRunner) { Nit: No {}
Thanks, Nate! I see that Eric has disabled the preloader again, but I'm anyway committing as it adds a layout test and fixes preloader behaviour for images. https://codereview.chromium.org/355043002/diff/40001/LayoutTests/loader/data-... File LayoutTests/loader/data-uri-images-load-when-loading-images-automatically-disabled.html (right): https://codereview.chromium.org/355043002/diff/40001/LayoutTests/loader/data-... LayoutTests/loader/data-uri-images-load-when-loading-images-automatically-disabled.html:6: if (window.testRunner) { On 2014/07/01 19:12:43, Nate Chapin wrote: > Nit: No {} Done.
The CQ bit was checked by mnaganov@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mnaganov@chromium.org/355043002/60001
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_dbg on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_dbg/builds/1...)
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_blink_dbg on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_dbg/builds/1...)
The CQ bit was checked by mnaganov@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mnaganov@chromium.org/355043002/80001
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_blink_dbg on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_dbg/builds/1...) linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/1...) mac_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/mac_blink_rel/builds/13972) win_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/15093)
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_blink_dbg on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_dbg/builds/1...)
The CQ bit was checked by mnaganov@chromium.org
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mnaganov@chromium.org/355043002/100001
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: win_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/15136)
Message was sent while issue was closed.
Change committed as 177425 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
