Closed Bug 1954841 Opened 5 months ago Closed 4 months ago

XSLTProcessor.transformToFragment behavior has changed

Categories

(Core :: XSLT, defect)

Firefox 137
defect

Tracking

()

RESOLVED FIXED
139 Branch
Tracking Status
firefox-esr115 --- fixed
firefox-esr128 --- fixed
firefox137 --- fixed
firefox138 --- fixed
firefox139 --- fixed

People

(Reporter: brandon, Assigned: smaug)

References

Details

(Keywords: regression)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0

Steps to reproduce:

The XLSTProcessor.transformToFragment() function with the first parameter an element (not a document). It behaves differently than it did in Firefox 136.
A simple sample of this behavior can be seen at the following link:
https://jsfiddle.net/nuhgxskw/1/

Actual results:

The element itself submitted as the first parameter to transformToFragment cannot be found by XSLT template's match rule. In the provided jsfiddle, the template with match="root" is not applied.
(Note, documentElement here used is for illustrative purposes. A real web application passes elements from a middle of large XML. Cloning the element to a wrapper would also not be effective because of the content size.)

Expected results:

The template match="root" should be applied to match the passed element itself. That was the behavior of Firefox 136 and earlier. If this is a planned change, then it should be indicated in the documentation and release notes for Firefox 137: https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/137

Could you use https://mozilla.github.io/mozregression/ to determine a regression range?

Flags: needinfo?(brandon)

(In reply to Robert Longson [:longsonr] from comment #1)

Could you use https://mozilla.github.io/mozregression/ to determine a regression range?

My apologies for taking a few days to respond, I got the regression tool working and found some more detailed information. It appears that the change in behavior started with a nightly build that was published on February 5 2025, the build on Feb 4 works correctly. There are some more details about the test involving an "autoland" build, but I'm not familiar with that branch and not sure what information from it would be useful.
Pushlog link from the Feb 5 Nightly build: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=29c957dc0c6f710ef5e2471560a1f49e7c655db9&tochange=e96db7f2fc84bf31d8081316be884a96496fecb6

In the pushlog, I saw an entry by Peter Van der Beken to address Bug 1944313 (Propagate XSLT expression failure correctly). Could this be the the culprit for the change?

Flags: needinfo?(brandon)
Component: Untriaged → XSLT
Product: Firefox → Core

Andreas, you reviewed the patches for bug 1944313 so I am starting with you here. Thanks.

Flags: needinfo?(afarre)
Keywords: regression
Regressed by: CVE-2025-1932

It looks like FF 137 has been released and this bug has been included. Are there any updates to share, or a timeline of when it can be addressed? Thank you.

Severity: -- → S2

Maybe Olli has an idea?

Flags: needinfo?(afarre) → needinfo?(smaug)

The bug has a release status flag that shows some version of Firefox is affected, thus it will be considered confirmed.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Depends on: 1958091

Tracked in bug 1958091

Flags: needinfo?(smaug)

Do we know for sure whether this is a regression from bug 1941002 or bug 1944313? Those are both in the range in comment 2.

Flags: needinfo?(smaug)

Oh, great. Thanks.

Assignee: nobody → smaug
No longer regressed by: CVE-2025-1932

This change appears to be what has broken our application too.
We aren't using transformToFragment, but transformToDocument seems to have the same bug too.

Duplicate of this bug: 1959682

137.0.2 release notes say "Fixed functional regressions in our XSLT support introduced in 137." and point to this bug. Can anyone confirm?

Could you please confirm that this issue is fixed in 137.0.2? Thanks.

Flags: needinfo?(brandon)

Yes, this issue has been fixed in 137.0.2

Please file a new XSLT bug for this issue and we can discuss it further there. Thanks.

Flags: needinfo?(bkc)
See Also: → 1961252
Status: NEW → RESOLVED
Closed: 4 months ago
Flags: needinfo?(brandon)
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch
You need to log in before you can comment on or make changes to this bug.