Closed Bug 1553430 Opened 6 years ago Closed 3 years ago

xlink:href in <animate> doesn't work in sourceless iframes (on about:blank)

Categories

(Core :: SVG, defect, P3)

67 Branch
defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox67 --- affected
firefox68 --- affected
firefox69 --- affected

People

(Reporter: mlbli, Unassigned)

References

Details

Attachments

(1 file)

Attached file index.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1 Safari/605.1.15

Steps to reproduce:

Have an SVG with <animate /> in a source-less iframe that links to an element in the same SVG using xlink:href.

Actual results:

The animation doesn't start

Expected results:

The animation should start

OK, so the animate stuff ends up creating a URI like:

#0	0x0000000109c81807 in mozilla::net::nsIOService::NewURI(nsTSubstring<char> const&, char const*, nsIURI*, nsIURI**) at netwerk/base/nsIOService.cpp:809
#1	0x0000000109c9830a in NS_NewURI(nsIURI**, nsTSubstring<char> const&, char const*, nsIURI*, nsIIOService*) [inlined] at netwerk/base/nsNetUtil.cpp:1628
#2	0x0000000109c982d7 in NS_NewURI(nsIURI**, nsTSubstring<char> const&, mozilla::NotNull<mozilla::Encoding const*>, nsIURI*, nsIIOService*) at netwerk/base/nsNetUtil.cpp:1640
#3	0x0000000109c98529 in NS_NewURI(nsIURI**, nsTSubstring<char16_t> const&, mozilla::NotNull<mozilla::Encoding const*>, nsIURI*, nsIIOService*) at netwerk/base/nsNetUtil.cpp:1666
#4	0x000000010bf6518a in mozilla::dom::SVGAnimationElement::UpdateHrefTarget(nsTSubstring<char16_t> const&) at dom/svg/SVGAnimationElement.cpp:362
#5	0x000000010bf650e3 in mozilla::dom::SVGAnimationElement::BindToTree(mozilla::dom::Document*, nsIContent*, nsIContent*) at dom/svg/SVGAnimationElement.cpp:157
#6	0x000000010ac931f5 in mozilla::dom::Element::BindToTree(mozilla::dom::Document*, nsIContent*, nsIContent*) at dom/base/Element.cpp:1744
#7	0x000000010bf6b06a in mozilla::dom::SVGElement::BindToTree(mozilla::dom::Document*, nsIContent*, nsIContent*) at dom/svg/SVGElement.cpp:230
#8	0x000000010ac931f5 in mozilla::dom::Element::BindToTree(mozilla::dom::Document*, nsIContent*, nsIContent*) at dom/base/Element.cpp:1744
#9	0x000000010bf6b06a in mozilla::dom::SVGElement::BindToTree(mozilla::dom::Document*, nsIContent*, nsIContent*) at dom/svg/SVGElement.cpp:230
#10	0x000000010ac931f5 in mozilla::dom::Element::BindToTree(mozilla::dom::Document*, nsIContent*, nsIContent*) at dom/base/Element.cpp:1744
#11	0x000000010bf6b06a in mozilla::dom::SVGElement::BindToTree(mozilla::dom::Document*, nsIContent*, nsIContent*) at dom/svg/SVGElement.cpp:230
#12	0x000000010bf9c400 in mozilla::dom::SVGSVGElement::BindToTree(mozilla::dom::Document*, nsIContent*, nsIContent*) at dom/svg/SVGSVGElement.cpp:393
#13	0x000000010ac931f5 in mozilla::dom::Element::BindToTree(mozilla::dom::Document*, nsIContent*, nsIContent*) at dom/base/Element.cpp:1744
#14	0x000000010bb2de36 in nsGenericHTMLElement::BindToTree(mozilla::dom::Document*, nsIContent*, nsIContent*) at dom/html/nsGenericHTMLElement.cpp:424
#15	0x000000010ad5f852 in nsINode::InsertChildBefore(nsIContent*, nsIContent*, bool) at dom/base/nsINode.cpp:1248
#16	0x000000010ad62738 in nsINode::ReplaceOrInsertBefore(bool, nsINode*, nsINode*, mozilla::ErrorResult&) at dom/base/nsINode.cpp:2363
#17	0x000000010afc60e9 in nsINode::InsertBefore(nsINode&, nsINode*, mozilla::ErrorResult&) [inlined] at dom/base/nsINode.h:1679

and passes "#circle-558014329836164" as href and "https://bug1553430.bmoattachments.org/attachment.cgi?id=9066655" as base URI.

I'm a bit confused why https://bug1157953.bmoattachments.org/attachment.cgi?id=8786769 (from bug 1157953) does work - it looks like we never hit newURI in that case, and maybe SVG resolves things separately, preserving the relative URI (but not for animated values?), or something? I also don't know if/how bug 1157953 comment 24 still applies or if the spec changed.

Blocks: 1157953
Status: UNCONFIRMED → NEW
Component: Untriaged → SVG
Ever confirmed: true
Product: Firefox → Core
Summary: xlink:href in <animate> doesn't work in sourceless iframes → xlink:href in <animate> doesn't work in sourceless iframes (on about:blank)

CSS explicitly stores url(#pattern) as that exact thing, not a fully resolved URL, and always resolves it as a same-document reference no matter what the document URL and base URL are. This is specified in the CSS spec, and is why attachment 8786769 [details] works.

For xlink:href, that's not the specified behavior; the specified behavior is to resolve relative to the base URL (which in this case differs from the document URL, by the way).

As far as I can tell, we're correctly following the spec here...

The priority flag is not set for this bug.
:heycam, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(cam)
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID

I do wonder whether we should push back on the spec. This sort of thing makes SVG hard to use in data:, blobs, srcdoc documents, etc, etc...

Flags: needinfo?(longsonr)

We could certainly try.

Flags: needinfo?(longsonr)

From WG discussions earlier this week it sounds like people want to solve this somehow. I'm going to leave this bug open.

Status: RESOLVED → REOPENED
Flags: needinfo?(cam)
Priority: -- → P3
Resolution: INVALID → ---

animates now.

Status: REOPENED → RESOLVED
Closed: 6 years ago3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: