Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upForm constraint validation #25447
Form constraint validation #25447
Conversation
highfive
commented
Jan 6, 2020
|
Heads up! This PR modifies the following files:
|
|
|
|
Error syncing changes upstream. Logs saved in error-snapshot-1578481317370. |
|
|
|
Opened new PR for upstreamable changes. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#21135. |
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#21135. |
3 similar comments
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#21135. |
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#21135. |
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#21135. |
|
I think it's ready for a review. Some notes:
@jdm Let me know what you think! |
|
PR title changed; changed existing PR. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#21135. |
|
Great work! I found this code to be quite readable. Thanks for adding all of the useful specification links! |
| JS_ClearPendingException(*cx); | ||
| } | ||
|
|
||
| !ok || !rval.is_null() |
This comment has been minimized.
This comment has been minimized.
jdm
Jan 23, 2020
Member
Don't we want ok && !rval.is_null()? Am I misunderstanding what JS_ExecuteRegExpNoStatics returns?
This comment has been minimized.
This comment has been minimized.
teapotd
Jan 23, 2020
Author
Contributor
It returns false on error. If pattern doesn't match it returns true and set rval to null:
I guess errors should be treated the same way as invalid patterns, i.e. element shouldn't suffer from pattern mismatch.
This comment has been minimized.
This comment has been minimized.
teapotd
Apr 1, 2020
Author
Contributor
I changed it to return Result<bool, ()> instead of bool to make it less confusing and errors are ignored in suffers_from_pattern_mismatch.
Add RegExp bindings I finally got around to finishing [form validation](servo/servo#25447) in Servo and it looks like RegExp bindings got lost after SpiderMonkey update. This PR adds `js/RegExp.h` to `jsglue.hpp`.
Add RegExp bindings I finally got around to finishing [form validation](servo/servo#25447) in Servo and it looks like RegExp bindings got lost after SpiderMonkey update. This PR adds `js/RegExp.h` to `jsglue.hpp`.
|
|
|
@bors-servo retry |
Form constraint validation It's almost done, there are few things remaining: - ~Range underflow, range overflow and step mismatch implementation require #25405~ - ~There are some test failures due to missing DOM parts (#25003)~ - ~`pattern` attribute uses JS regexp syntax. Currently I used regex crate, but it's probably incompatible. Should we use SpiderMonkey's regexp via jsapi?~ - Currently validation errors are reported using `println!`. Are there any better options? - ~["While the user interface is representing input that the user agent cannot convert to punycode, the control is suffering from bad input."](https://html.spec.whatwg.org/multipage/#e-mail-state-(type%3Demail)%3Asuffering-from-bad-input)~ r? @jdm --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #11444 - [x] There are tests for these changes
|
|
|
@bors-servo retry |
|
|
|
|
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#21135. |
|
@bors-servo r+ |
|
|
|
|
teapotd commentedJan 6, 2020
•
edited
It's almost done, there are few things remaining:
Range underflow, range overflow and step mismatch implementation require #25405There are some test failures due to missing DOM parts (#25003)patternattribute uses JS regexp syntax. Currently I used regex crate, but it's probably incompatible. Should we use SpiderMonkey's regexp via jsapi?println!. Are there any better options?"While the user interface is representing input that the user agent cannot convert to punycode, the control is suffering from bad input."r? @jdm
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors