delete String.prototype.replace and delete String.prototype.toLowerCase have no effect in JSC. This is causing compatibility issues with V8, Firefox and MSIE as detailed in http://code.google.com/p/chromium/issues/detail?id=1717
AFAIKS it is a violation of the spec, which doesn't list the DontDelete property for String.prototype.replace. Here is a test snippet:
alert("String.prototype.replace is " + ("foo".replace ? "not deletable" : "deletable"));
Result for JSC: not deletable
Result for other JS implementations: deletable
Tested in Safari Version 4 Public Beta (4528.16)
Further investigation of JSC reveals that delete returns true despite the fact that it doesn't work. All the methods on String.prototype have the same issue. In addition, the methods on Array.prototype and Date.prototype and the following properties on Math (not Math.prototype) have the same issues:
"random", "abs", "acos", "asin", "atan", "ceil", "cos", "exp", "floor", "log",
"round", "sin", "sqrt", "tan", "atan2", "pow", "max", "min",
The following properties are also on Math, but they work as intended (have
DONT_DELETE and READ_ONLY).
"E", "LN10", "LN2", "LOG2E", "LOG10E", "PI", "SQRT1_2", "SQRT2"
Strangely, the functions on Object.prototype and RegExp.prototype, Boolean.prototype, Number.prototype and Function.prototype work fine. They can be deleted, as can the properties on the global object (escape, unescape, etc) and String.fromCharCode (On String itself, not the prototype).
Looking at the chromium bug it would appear that making these properties deletable would cause a site regression, so i'm not sure why that's desired?
Because you would be following the standard and the behaviour of Firefox, MSIE, Chrome and Opera. The site is obviously broken, deleting a property and then trying to use it.
If you decide not to fix the fact that deletion fails it would at least be nice to fix the incorrect return value from the delete operator.
Retitling bug to represent actual bug.
Will talk to brendan tomorrow to find out why the ECMA262-5 document doesn't specify deletability of standard properties, as i know there have been changes from ECMA262-3
(In reply to comment #3)
> Because you would be following the standard and the behaviour of Firefox, MSIE,
> Chrome and Opera.
A minor note would be not one of these browsers is standard compliant -- they will all have quirks to deal with some bugs they had in the past or have implemented to deal with sites that expect the quirks from other browsers.
Well except chrome of course. But that's just embedding webkit so it gets all the quirk history of safari instead :D
As a fact of life you're going to need to accept that if you claim to be webkit you need to be quirk compatible with JSC. (After all my understanding is that you implemented __defineGetter__ for the WebInspector, and __defineGetter__ is a quirk we originally added support for FFX compat. Yay standards! \o/ )
This bug causes http://code.google.com/p/chromium/issues/detail?id=39662
These properties all work correctly for me in ToT, please reopen if you can repro any issues here.