Open Bug 1837772 Opened 2 years ago Updated 1 year ago

A pattern with infinite backtracking should terminate, not hang the tab

Categories

(Core :: DOM: Core & HTML, defect, P2)

defect

Tracking

()

ASSIGNED

People

(Reporter: twisniewski, Assigned: vhilla)

References

(Depends on 1 open bug, )

Details

This seems to cause a bad tab hang on Firefox, which doesn't happen in Safari or Chrome. Fixing this would also let us pass the WPT https://wpt.fyi/results/html/semantics/forms/constraints/infinite_backtracking.html, which is one of only two in the html/semantics/forms/constraints section which we do not pass.

Actually this also appears to be part of interop2023, so marking it as such.

Severity: -- → S3
Priority: -- → P2
Depends on: 1839630

:zcorpan what is your perspective on introducing a backtracking limit?

For the pattern attribute on input elements, Chromium and WebKit apply the regular expression with a backtracking limit (see bug). This does not seem to be part of the #attr-input-pattern spec, but is now enforced through this WPT.

I am unsure if this limit also applies to other situations, they mention something about regex within css in the issue content. From a quick test, it does not seem to apply when using a regex in js.

As two browsers have this behavior, it might make sense to align with them and incorporate it into the standard. But ECMAScript does not seem to define a backtracking limit, so adding it to the standard might be more involved.

Assignee: nobody → vhilla
Status: NEW → ASSIGNED
Flags: needinfo?(zcorpan)

Hmm, since the limit behavior isn't specified it seems to be the test should be .tentative and not be part of Interop 2023. I'll file a test change issue.

But we can also specify the backtracking limit in HTML. Can you file an issue in whatwg/html?

Flags: needinfo?(zcorpan)

Filed https://github.com/web-platform-tests/interop/issues/371

I'm not sure how CSS can hit this issue. There are substring attribute selectors but you can't write a regex with them.

The test is now removed from Interop 2023.

I'm not sure how CSS can hit this issue.

I'm still not entirely sure but I think it's with the :invalid pseudo-class causing form validation, so the regexp is still in <input pattern>.

No longer blocks: interop-2023-forms
You need to log in before you can comment on or make changes to this bug.