we (web engine): Experimental web browser project to understand the limits of Claude
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix String.prototype.search lastIndex handling and remove unimplemented regex flags

- search() now saves/restores lastIndex so global/sticky regexps
always search from position 0 per the ES spec
- Remove 'v' (UnicodeSets) and 'd' (HasIndices) from lexer's accepted
regex flags since they're not implemented in the regex engine

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+5 -4
+4
crates/js/src/builtins.rs
··· 2266 2266 }; 2267 2267 2268 2268 // search always starts from 0 and ignores global/lastIndex. 2269 + // Save and restore lastIndex so exec_internal's global/sticky handling doesn't interfere. 2270 + let saved_last_index = regexp_get_last_index(ctx.gc, &regexp_val); 2271 + regexp_set_last_index(ctx.gc, &regexp_val, 0.0); 2269 2272 let result = regexp_exec_internal(ctx.gc, &regexp_val, &s)?; 2273 + regexp_set_last_index(ctx.gc, &regexp_val, saved_last_index); 2270 2274 match result { 2271 2275 Value::Null => Ok(Value::Number(-1.0)), 2272 2276 Value::Object(r) => {
+1 -4
crates/js/src/lexer.rs
··· 980 980 981 981 // Flags 982 982 let mut flags = std::string::String::new(); 983 - while matches!( 984 - self.peek(), 985 - Some(b'g' | b'i' | b'm' | b's' | b'u' | b'v' | b'y' | b'd') 986 - ) { 983 + while matches!(self.peek(), Some(b'g' | b'i' | b'm' | b's' | b'u' | b'y')) { 987 984 flags.push(self.advance().unwrap() as char); 988 985 } 989 986