Summary: | 'source' property of RegExp instance cannot be "" | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Gavin Barraclough <barraclough> | ||||
Component: | JavaScriptCore | Assignee: | Gavin Barraclough <barraclough> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | adamk, arv, erikcorry, haraken, rossberg | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Attachments: |
|
Description
Gavin Barraclough
2012-02-29 13:25:43 PST
Created attachment 129505 [details]
Fix
We should update the spec for this. We should point out that the "source" property cannot be "" due to the toString behavior. (In reply to comment #3) > We should update the spec for this. We should point out that the "source" property cannot be "" due to the toString behavior. Aye, that sounds like a good plan – I got half way through filing a bug against test262 before realizing this. :-) Your patch fixed JSC only, and RegExp.html starts to fail on Chromium/V8. - Since this requires a fix in V8, I filed a bug in V8: http://code.google.com/p/v8/issues/detail?id=1983&thanks=1983&ts=1330565749 - I'll add the FAIL line to chromium/test_expectations.txt I thought Adam already took care of adding this to the test_expectations? (In reply to comment #6) > I thought Adam already took care of adding this to the test_expectations? Yeah, I found the line:) I just filed a bug in V8. Thanks. (In reply to comment #7) > (In reply to comment #6) > > I thought Adam already took care of adding this to the test_expectations? Ah, the V8 bug is already there. Sorry for the confusion. How about: re = new RegExp("\n"); eval(re.toString()); // Syntax error. Note that the spec of toString uses the 'source' property of the regexp object, which Section 15.10.4.1 specifies to be the properly escaped version of the original argument string. The same paragraph in that section also specifies explicitly that 'source' should be set to "(?:)" if the original string is empty. (In reply to comment #10) > Note that the spec of toString uses the 'source' property of the regexp object, which Section 15.10.4.1 specifies to be the properly escaped version of the original argument string. The same paragraph in that section also specifies explicitly that 'source' should be set to "(?:)" if the original string is empty. Ah, I had somehow managed to overlook that, thank you! I guess I can simplify my comment, and just reference this rather than deriving the behavior. :-) |