Bug 32307
Summary: | SVG (and other content) embedded via object tag cannot be loaded from application cache | ||
---|---|---|---|
Product: | WebKit | Reporter: | Koralewski Benoit <benoit> |
Component: | Page Loading | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | ahmad.saleem792, andersca, ap, bfulgham, cdumez, michaeln, rniwa, zimmermann |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All |
Koralewski Benoit
An html file including a svg file in an object tag, a manifest with the two files.
index.html :
--------------------------------------------------------------
!DOCTYPE html>
<html manifest = "test.manifest">
<body>
<object data="foo.svg" type="image/svg+xml" ></object>
</body>
</html>
foo.svg :
--------------------------------------------------------------
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle id="myCircle"
cx="100" cy="75" r="50"
fill="blue"
stroke="firebrick"
stroke-width="3" />
<text x="60" y="155">Hello World</text>
</svg>
test.manifest :
--------------------------------------------------------------
CACHE MANIFEST
index.html
foo.svg
In offline mode the svg don't appear !
Ps: it works in firefox
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
One workaround is to use <img> instead of <object>.
Alexey Proskuryakov
It's is broken due to this code in MainResourceLoader::continueAfterContentPolicy():
if (status < 200 || status >= 300) {
bool hostedByObject = frameLoader()->isHostedByObjectElement();
frameLoader()->handleFallbackContent();
// object elements are no longer rendered after we fallback, so don't
// keep trying to process data from their load
if (hostedByObject)
cancel();
}
A response generated in MainResourceLoader::handleDataLoadNow() from substitute data has status of 0, so the substitute data is not used for OBJECT.
Alexey Proskuryakov
This code was added in <http://trac.webkit.org/changeset/13615>.
Nikolas Zimmermann
Changed component to SVG, so it shows up in my all-svg-bugs search.
Alexey Proskuryakov
This is not really about SVG, it's a general issue with OBJECT and appcache.
Michael Nordman
This looks like it may be related to https://bugs.webkit.org/show_bug.cgi?id=55500
Alexey Proskuryakov
This is related, but is not a duplicate. The additional problem here is that SubstituteData doesn't even have a field for response code, so we don't pass it from ApplicationCacheResource to MainResourceLoader.
This should be a very easy fix.
Ahmad Saleem
I changed the test case from Comment 0 into JSFiddle:
Link - https://jsfiddle.net/2fmvz7da/
Only Firefox Nightly 106 show "Image" while other Chrome Canary 107, Safari 15.6.1 and Safari Technology Preview 152 does not show SVG inside object.
Just wanted to share updated testing results. Thanks!
Ahmad Saleem
Just to update - my testing can be wrong because I didn't test it in offline mode. Thanks!
Alexey Proskuryakov
Once an appcache is saved, it intercepts loads even when online. So in a correct test, the SVG will show up the very first time, but not after that.
This JSFiddle is not a correct test, as this issue is about subresources that are part of appcache, and are loaded separately from the main resource.