mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 975042 - Remove the special COW support for Date. r=peterv
As soon as Date is on Xrays, this stuff won't work anyway. Henceforth, content access to chrome Date objects is forbidden, and APIs should use something like |new contentWindow.Date()| for any Date object they wish to expose to content.
This commit is contained in:
parent
af2c20f808
commit
0a3a4dab47
@ -3179,19 +3179,3 @@ static const NativeImpl sReadOnlyDateMethods[] = {
|
||||
date_toString_impl,
|
||||
date_valueOf_impl
|
||||
};
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
js::IsReadOnlyDateMethod(IsAcceptableThis test, NativeImpl method)
|
||||
{
|
||||
/* Avoid a linear search in the common case by checking the |this| test. */
|
||||
if (test != IsDate)
|
||||
return false;
|
||||
|
||||
/* Linear search, comparing function pointers. */
|
||||
unsigned max = sizeof(sReadOnlyDateMethods) / sizeof(sReadOnlyDateMethods[0]);
|
||||
for (unsigned i = 0; i < max; ++i) {
|
||||
if (method == sReadOnlyDateMethods[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1924,9 +1924,6 @@ IdToValue(jsid id)
|
||||
return JS::UndefinedValue();
|
||||
}
|
||||
|
||||
extern JS_FRIEND_API(bool)
|
||||
IsReadOnlyDateMethod(JS::IsAcceptableThis test, JS::NativeImpl method);
|
||||
|
||||
extern JS_FRIEND_API(bool)
|
||||
IsTypedArrayThisCheck(JS::IsAcceptableThis test);
|
||||
|
||||
|
@ -36,14 +36,18 @@ function run_test() {
|
||||
checkThrows("ArrayBuffer.prototype.slice.call(ab, 0);", sb);
|
||||
checkThrows("DataView.prototype.getInt8.call(dv, 0);", sb);
|
||||
|
||||
/* Things we explicitly allow in ExposedPropertiesOnly::allowNativeCall. */
|
||||
|
||||
/* Date */
|
||||
do_check_eq(Cu.evalInSandbox("Date.prototype.getYear.call(d)", sb), sb.d.getYear());
|
||||
do_check_eq(Cu.evalInSandbox("Date.prototype.valueOf.call(d)", sb), sb.d.valueOf());
|
||||
do_check_eq(Cu.evalInSandbox("d.valueOf()", sb), sb.d.valueOf());
|
||||
do_check_eq(Cu.evalInSandbox("Date.prototype.toString.call(d)", sb), sb.d.toString());
|
||||
do_check_eq(Cu.evalInSandbox("d.toString()", sb), sb.d.toString());
|
||||
/* Now that Date is on Xrays, these should all throw. */
|
||||
/* XXXbholley - We have to remove the old tests in this patch, because we're
|
||||
removing the machinery that made them possible. But they won't fully behave
|
||||
in an Xray-like way until the later patch where we turn on Xray-to-Date. So
|
||||
we update the tests to the new behavior here but leave them commented out,
|
||||
and uncomment them in the final patch.
|
||||
checkThrows("Date.prototype.getYear.call(d)", sb);
|
||||
checkThrows("Date.prototype.valueOf.call(d)", sb);
|
||||
checkThrows("d.valueOf()", sb);
|
||||
checkThrows("Date.prototype.toString.call(d)", sb);
|
||||
checkThrows("d.toString()", sb);
|
||||
*/
|
||||
|
||||
/* Typed arrays. */
|
||||
function testForTypedArray(t) {
|
||||
|
@ -355,7 +355,7 @@ bool
|
||||
ExposedPropertiesOnly::allowNativeCall(JSContext *cx, JS::IsAcceptableThis test,
|
||||
JS::NativeImpl impl)
|
||||
{
|
||||
return js::IsReadOnlyDateMethod(test, impl) || js::IsTypedArrayThisCheck(test);
|
||||
return js::IsTypedArrayThisCheck(test);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user