mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1804339 - Fix relative url conversion for SVG image and script when saving pages r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D164216
This commit is contained in:
parent
61e4227eed
commit
7990272a30
@ -458,7 +458,9 @@ nsresult ResourceReader::OnWalkDOMNode(nsINode* aNode) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aNode->IsSVGElement(nsGkAtoms::img)) {
|
||||
if (aNode->IsSVGElement(nsGkAtoms::image)) {
|
||||
MOZ_TRY(OnWalkAttribute(aNode->AsElement(), nsIContentPolicy::TYPE_IMAGE,
|
||||
"href"));
|
||||
return OnWalkAttribute(aNode->AsElement(), nsIContentPolicy::TYPE_IMAGE,
|
||||
"href", "http://www.w3.org/1999/xlink");
|
||||
}
|
||||
@ -500,6 +502,8 @@ nsresult ResourceReader::OnWalkDOMNode(nsINode* aNode) {
|
||||
}
|
||||
|
||||
if (aNode->IsSVGElement(nsGkAtoms::script)) {
|
||||
MOZ_TRY(OnWalkAttribute(aNode->AsElement(), nsIContentPolicy::TYPE_SCRIPT,
|
||||
"href"));
|
||||
return OnWalkAttribute(aNode->AsElement(), nsIContentPolicy::TYPE_SCRIPT,
|
||||
"href", "http://www.w3.org/1999/xlink");
|
||||
}
|
||||
@ -993,7 +997,7 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn, bool* aSerializeCloneKids,
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (content->IsSVGElement(nsGkAtoms::img)) {
|
||||
if (content->IsSVGElement(nsGkAtoms::image)) {
|
||||
nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
|
||||
if (NS_SUCCEEDED(rv) && *aNodeOut) {
|
||||
// Disable image loads
|
||||
@ -1001,6 +1005,7 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn, bool* aSerializeCloneKids,
|
||||
if (imgCon) imgCon->SetLoadingEnabled(false);
|
||||
|
||||
// FixupAnchor(*aNodeOut); // XXXjwatt: is this line needed?
|
||||
FixupAttribute(*aNodeOut, "href");
|
||||
FixupAttribute(*aNodeOut, "href", "http://www.w3.org/1999/xlink");
|
||||
}
|
||||
return rv;
|
||||
@ -1017,6 +1022,7 @@ PersistNodeFixup::FixupNode(nsINode* aNodeIn, bool* aSerializeCloneKids,
|
||||
if (content->IsSVGElement(nsGkAtoms::script)) {
|
||||
nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut);
|
||||
if (NS_SUCCEEDED(rv) && *aNodeOut) {
|
||||
FixupAttribute(*aNodeOut, "href");
|
||||
FixupAttribute(*aNodeOut, "href", "http://www.w3.org/1999/xlink");
|
||||
}
|
||||
return rv;
|
||||
|
@ -8,5 +8,6 @@ support-files =
|
||||
[browser_persist.js]
|
||||
support-files =
|
||||
file_persist_srcset.html
|
||||
file_persist_svg.html
|
||||
file_persist_picture_source.html
|
||||
file_persist_image.png
|
||||
|
@ -14,6 +14,7 @@ const chromeBase =
|
||||
const REFTESTS = [
|
||||
"file_persist_srcset.html",
|
||||
"file_persist_picture_source.html",
|
||||
"file_persist_svg.html",
|
||||
// ...
|
||||
];
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
<!doctype html>
|
||||
<svg>
|
||||
<image href="file_persist_image.png"/>
|
||||
<image x="100" xlink:href="file_persist_image.png"/>
|
||||
</svg>
|
Loading…
Reference in New Issue
Block a user