Closed
Bug 623102
Opened 15 years ago
Closed 14 years ago
TM: cross compartment wrappers can hide regexpness
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
DUPLICATE
of bug 683361
People
(Reporter: cdleary, Assigned: cdleary)
Details
var re = new RegExp('foo(bar)?');
var sandbox = evalcx('');
sandbox.re = re;
evalcx('result = "foobar".replace(re, "works!");', sandbox);
assertEq(sandbox.result, "works!");
This fails because the regexp is cross-compartment wrapped and the str_replace code checks the clasp of the object to see if it is exactly &js_RegExpClass. I'm pretty sure the solution is to use a VALUE_IS_REGEXP that can see through wrappers of appropriate kinds to the primordial clasp.
This seems like a generally good category of bug to audit the code for: places where we test to see if a object has a particular clasp in order to perform correct (as opposed to optimized) behavior.
| Assignee | ||
Comment 1•15 years ago
|
||
Forgot to mention that split and replace's friends are similarly affected.
Comment 2•15 years ago
|
||
(In reply to comment #0)
>
> This seems like a generally good category of bug to audit the code for: places
> where we test to see if a object has a particular clasp in order to perform
> correct (as opposed to optimized) behavior.
Aren't there, like, bazillions of places where the clasp is inspected in this way?
| Assignee | ||
Comment 3•15 years ago
|
||
(In reply to comment #2)
> Aren't there, like, bazillions of places where the clasp is inspected in this
> way?
When I was talking with luke we figured that most of those were for performance reasons; i.e. fast paths for known clasps, falling back on a generally correct handling of wrapped objects.
If you know of a lot of places where the correctness is affected by inspecting clasp we should file an audit bug!
| Assignee | ||
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•