NEW 69211
Empty URLs in CSS must resolve to an invalid resource
https://bugs.webkit.org/show_bug.cgi?id=69211
Summary Empty URLs in CSS must resolve to an invalid resource
Javier
Reported 2011-10-01 03:59:38 PDT
Created attachment 109404 [details] show problem with css The following happens to me often in Mac 10.6.8 and Windows 7: When I modify the css data in the Developer tools> Elements panel> Styles subpanel, if I click on the link to my css, see point 1 in the image, the result is the point 2 in the Resources panel and 3 in the console of the image. If I refresh the browser it works correctly again, so I guess it's no problem of my css.
Attachments
show problem with css (476.43 KB, image/jpeg)
2011-10-01 03:59 PDT, Javier
no flags
add url() to background:#fff (339.56 KB, image/jpeg)
2011-10-01 04:34 PDT, Javier
no flags
Test case (95 bytes, text/html)
2011-10-02 02:35 PDT, Vsevolod Vlasov
no flags
Javier
Comment 1 2011-10-01 04:34:10 PDT
Created attachment 109405 [details] add url() to background:#fff
Javier
Comment 2 2011-10-01 04:34:55 PDT
Comment on attachment 109405 [details] add url() to background:#fff Finally, I have found when this problem happens. If I have a background: # 930 and I add url (image / photo.jpg) the problem appears
Alexey Proskuryakov
Comment 3 2011-10-01 22:00:07 PDT
Does the same happens if you add an empty url() in you CSS file, not in Web Inspector?
Ilya Tikhonovsky
Comment 4 2011-10-01 23:09:04 PDT
(In reply to comment #3) > Does the same happens if you add an empty url() in you CSS file, not in Web Inspector? I made an experiment and found that <div style="background: url()"> in html file forces the browser to load html file second time. The warning "Resource interpreted as Other but transferred with MIME type undefined." appears in console too. You are right. This is not a Web Inspector specific problem.
Alexey Proskuryakov
Comment 5 2011-10-01 23:40:12 PDT
Could you please attach your test case? This sounds like a missed case in bug 30303 and related bugs.
Vsevolod Vlasov
Comment 6 2011-10-02 02:18:50 PDT
(In reply to comment #5) > Could you please attach your test case? > > This sounds like a missed case in bug 30303 and related bugs. http://www.w3.org/TR/CSS2/syndata.html#uri Relative URIs (as defined in [RFC3986]) are resolved to full URIs using a base URI. RFC 3986, section 5, defines the normative algorithm for this process. For CSS style sheets, the base URI is that of the style sheet, not that of the source document. So according to spec adding url() to css triggers another load if this stylesheet as an image, this is not a bug. From this moment on CachedResource stored in MemoryCache for this url has Image type, and it is not possible to correctly show it in Web Inspector. See also http://code.google.com/p/chromium/issues/detail?id=84605 for the same problem.
Vsevolod Vlasov
Comment 7 2011-10-02 02:20:30 PDT
Sorry for a typo: So according to spec adding url() to css triggers another load OF this stylesheet as an image, this is not a bug.
Vsevolod Vlasov
Comment 8 2011-10-02 02:35:17 PDT
Created attachment 109418 [details] Test case Alexey, I've read this bug you mentioned, it's the same issue but for CSS. Since I can't think of any good reason to use stylesheet as an image, I think this could be fixed the same way. Currently Firefox has the same behavior as WebKit. See test attached.
Javier
Comment 9 2011-10-02 02:41:02 PDT
(In reply to comment #8) > Created an attachment (id=109418) [details] > Test case > > Alexey, I've read this bug you mentioned, it's the same issue but for CSS. > Since I can't think of any good reason to use stylesheet as an image, I think this could be fixed the same way. > > Currently Firefox has the same behavior as WebKit. See test attached. I do not know if this is a webkit bug but when you click on the link to the css in the Developer tools> Elements panel> Styles subpanel, you should go to the css, because the path is to the css.
Alexander Pavlov (apavlov)
Comment 10 2012-02-14 01:41:52 PST
*** Bug 78377 has been marked as a duplicate of this bug. ***
Sam Sneddon [:gsnedders]
Comment 11 2021-07-13 13:48:52 PDT
See https://drafts.csswg.org/css-values-3/#url-empty, with tests at https://github.com/web-platform-tests/wpt/blob/master/css/css-values/urls/empty.html https://github.com/w3c/csswg-drafts/commit/e0518924c87638861e6b89cc303667b9421cf152 changed the behaviour per spec to "resolve to an invalid resource (similar to what the url about:invalid does)". Per https://github.com/w3c/csswg-drafts/issues/6447, CSS Values doesn't actually define _what_ the computed value is, though Gecko has implemented this with about:invalid. https://bugs.chromium.org/p/chromium/issues/detail?id=910954 is the Blink bug for this.
Radar WebKit Bug Importer
Comment 12 2021-07-13 13:50:05 PDT
Ahmad Saleem
Comment 13 2022-08-07 05:16:37 PDT
Safari is only browsers passing this test case: https://wpt.fyi/results/css/css-values/urls/empty.html?label=master&label=experimental&aligned&view=subtest&q=css-value gsnedders@apple.com - Do we need this? or we can mark this as "RESOLVED CONFIGURATION CHANGED"? Thanks!
Sam Sneddon [:gsnedders]
Comment 14 2022-08-08 06:13:45 PDT
While we pass both that and https://wpt.fyi/results/css/css-images/empty-background-image.html?label=master&label=experimental&aligned&view=subtest (which purportedly tests the actual behaviour of empty URLs, albeit relying on Navigation Timing as a source of truth), I'm still not totally sure we actually treat them as invalid and avoid the request entirely—I can't see anywhere in the code where we do. Simon?
Note You need to log in before you can comment on or make changes to this bug.