Indicate regex flag used for pattern attribute in invalid pattern error message
Categories
(Core :: DOM: Forms, defect)
Tracking
()
People
(Reporter: nchevobbe, Assigned: vhilla)
Details
Attachments
(1 file)
Steps to reproduce
- Go to
data:text/html,<meta charset=utf8><input pattern="[a-]">
- Open the webconsole
- Type a character in the page input
- See the error message displayed in the console
Actual results
The message is the following:
Unable to check <input pattern='[a-]'> because the pattern is not a valid regexp: invalid character in class in regular expression
It's quite hard to understand what is going on at this point, as /[a-]/
is a valid Regexp
Expected results
We should indicate that the regex is not valid with the v
flag, which might indicate to the developer where the issue might come from.
Chrome console message is:
Uncaught SyntaxError: Invalid regular expression: /[a-]/v: Invalid character in character class
they even had an earlier one that was saying that the regex was valid with the u
flag but not with the v
flag, which was even more helpful, as you could look the differences between the two.
Updated•1 year ago
|
Comment 1•8 months ago
|
||
The same on e-mail pattern:
<input id="xy" maxlength="100" name="KeyAccOrderer" pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,14}$" type="email" value="andrejlnnk@web.de">
any input log: invalid character in class in regular expression
Assignee | ||
Comment 2•6 months ago
|
||
Updated•6 months ago
|
Comment 4•5 months ago
|
||
Backed out for causing bc failures on browser_misused_characters_in_strings.js.
[task 2024-06-04T08:51:07.732Z] 08:51:07 INFO - TEST-START | browser/base/content/test/static/browser_misused_characters_in_strings.js
[task 2024-06-04T08:51:07.777Z] 08:51:07 INFO - TEST-INFO | started process screentopng
[task 2024-06-04T08:51:07.962Z] 08:51:07 INFO - TEST-INFO | screentopng: exit 0
[task 2024-06-04T08:51:07.964Z] 08:51:07 INFO - Buffered messages logged at 08:51:07
[task 2024-06-04T08:51:07.965Z] 08:51:07 INFO - Entering test bound checkAllTheProperties
[task 2024-06-04T08:51:07.967Z] 08:51:07 INFO - TEST-PASS | browser/base/content/test/static/browser_misused_characters_in_strings.js | Found 113 .properties files to scan for misused characters -
[task 2024-06-04T08:51:07.971Z] 08:51:07 INFO - Buffered messages finished
[task 2024-06-04T08:51:07.971Z] 08:51:07 INFO - TEST-UNEXPECTED-FAIL | browser/base/content/test/static/browser_misused_characters_in_strings.js | jar:file:///builds/worker/workspace/build/application/firefox/omni.ja!/chrome/en-US/locale/en-US/global/dom/dom.properties with key=PatternAttributeCompileFailurev2 has a misused single-quote. Single-quoted strings should use Unicode ‘foo’ instead of 'foo'. -
[task 2024-06-04T08:51:07.971Z] 08:51:07 INFO - Stack trace:
[task 2024-06-04T08:51:07.971Z] 08:51:07 INFO - chrome://mochikit/content/browser-test.js:test_ok:1592
[task 2024-06-04T08:51:07.971Z] 08:51:07 INFO - chrome://mochitests/content/browser/browser/base/content/test/static/browser_misused_characters_in_strings.js:testForError:121
[task 2024-06-04T08:51:07.972Z] 08:51:07 INFO - chrome://mochitests/content/browser/browser/base/content/test/static/browser_misused_characters_in_strings.js:testForErrors:142
[task 2024-06-04T08:51:07.972Z] 08:51:07 INFO - chrome://mochitests/content/browser/browser/base/content/test/static/browser_misused_characters_in_strings.js:checkAllTheProperties:198
[task 2024-06-04T08:51:07.972Z] 08:51:07 INFO - chrome://mochikit/content/browser-test.js:handleTask:1139
[task 2024-06-04T08:51:07.972Z] 08:51:07 INFO - chrome://mochikit/content/browser-test.js:_runTaskBasedTest:1211
[task 2024-06-04T08:51:07.972Z] 08:51:07 INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1353
[task 2024-06-04T08:51:07.972Z] 08:51:07 INFO - chrome://mochikit/content/browser-test.js:nextTest/<:1128
[task 2024-06-04T08:51:07.972Z] 08:51:07 INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/<:1058
[task 2024-06-04T08:51:07.974Z] 08:51:07 INFO - Not taking screenshot here: see the one that was previously logged
[task 2024-06-04T08:51:07.976Z] 08:51:07 INFO - TEST-UNEXPECTED-FAIL | browser/base/content/test/static/browser_misused_characters_in_strings.js | jar:file:///builds/worker/workspace/build/application/firefox/omni.ja!/res/locale/dom/dom.properties with key=PatternAttributeCompileFailurev2 has a misused single-quote. Single-quoted strings should use Unicode ‘foo’ instead of 'foo'. -
[task 2024-06-04T08:51:07.976Z] 08:51:07 INFO - Stack trace:
[task 2024-06-04T08:51:07.977Z] 08:51:07 INFO - chrome://mochikit/content/browser-test.js:test_ok:1592
[task 2024-06-04T08:51:07.977Z] 08:51:07 INFO - chrome://mochitests/content/browser/browser/base/content/test/static/browser_misused_characters_in_strings.js:testForError:121
[task 2024-06-04T08:51:07.977Z] 08:51:07 INFO - chrome://mochitests/content/browser/browser/base/content/test/static/browser_misused_characters_in_strings.js:testForErrors:142
[task 2024-06-04T08:51:07.977Z] 08:51:07 INFO - chrome://mochitests/content/browser/browser/base/content/test/static/browser_misused_characters_in_strings.js:checkAllTheProperties:198
[task 2024-06-04T08:51:07.977Z] 08:51:07 INFO - chrome://mochikit/content/browser-test.js:handleTask:1139
[task 2024-06-04T08:51:07.977Z] 08:51:07 INFO - chrome://mochikit/content/browser-test.js:_runTaskBasedTest:1211
[task 2024-06-04T08:51:07.977Z] 08:51:07 INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1353
[task 2024-06-04T08:51:07.977Z] 08:51:07 INFO - chrome://mochikit/content/browser-test.js:nextTest/<:1128
[task 2024-06-04T08:51:07.977Z] 08:51:07 INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/<:1058
[task 2024-06-04T08:51:07.977Z] 08:51:07 INFO - Leaving test bound checkAllTheProperties
[task 2024-06-04T08:51:07.978Z] 08:51:07 INFO - Entering test bound checkAllTheDTDs
[task 2024-06-04T08:51:07.978Z] 08:51:07 INFO - TEST-PASS | browser/base/content/test/static/browser_misused_characters_in_strings.js | Found 1 .dtd files to scan for misused characters -
Assignee | ||
Comment 5•5 months ago
|
||
browser/base/content/test/static/browser_misused_characters_in_strings.js
had an exception for PatternAttributeCompileFailure
and when changing the string, I did not remember to fix the pre-existing issue.
Comment 7•5 months ago
|
||
bugherder |
Updated•4 months ago
|
Comment 8•4 months ago
|
||
Reproducible on a 2024-06-09 Nightly build on Windows 10 using the steps from Comment 0.
Verified as fixed on Firefox Nightly 130.0a1 and Firefox 129.0b4 on Windows 10, Ubuntu 22, macOS 14.
Description
•