mirror of
https://github.com/bellard/quickjs.git
synced 2025-05-12 11:06:10 +08:00
changed js_throw_type_error ES5 workaround to be more compatible with test262
This commit is contained in:
parent
c505ac0f39
commit
d546fbfdb7
2
TODO
2
TODO
@ -62,6 +62,6 @@ Optimization ideas:
|
||||
Test262o: 0/11262 errors, 463 excluded
|
||||
Test262o commit: 7da91bceb9ce7613f87db47ddd1292a2dda58b42 (es5-tests branch)
|
||||
|
||||
Result: 39/76964 errors, 3147 excluded, 6912 skipped
|
||||
Result: 35/76964 errors, 3147 excluded, 6912 skipped
|
||||
Test262 commit: 56e77d6325067a545ea7e8ff5be5d9284334e33c
|
||||
|
||||
|
20
quickjs.c
20
quickjs.c
@ -14721,21 +14721,15 @@ static __exception int js_operator_delete(JSContext *ctx, JSValue *sp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static JSValue js_throw_type_error(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
return JS_ThrowTypeError(ctx, "invalid property access");
|
||||
}
|
||||
|
||||
/* XXX: not 100% compatible, but mozilla seems to use a similar
|
||||
implementation to ensure that caller in non strict mode does not
|
||||
throw (ES5 compatibility) */
|
||||
static JSValue js_function_proto_caller(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
static JSValue js_throw_type_error(JSContext *ctx, JSValueConst this_val,
|
||||
int argc, JSValueConst *argv)
|
||||
{
|
||||
JSFunctionBytecode *b = JS_GetFunctionBytecode(this_val);
|
||||
if (!b || (b->js_mode & JS_MODE_STRICT) || !b->has_prototype) {
|
||||
return js_throw_type_error(ctx, this_val, 0, NULL);
|
||||
if (!b || (b->js_mode & JS_MODE_STRICT) || !b->has_prototype || argc >= 1) {
|
||||
return JS_ThrowTypeError(ctx, "invalid property access");
|
||||
}
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
@ -50719,16 +50713,14 @@ void JS_AddIntrinsicBaseObjects(JSContext *ctx)
|
||||
ctx->throw_type_error = JS_NewCFunction(ctx, js_throw_type_error, NULL, 0);
|
||||
|
||||
/* add caller and arguments properties to throw a TypeError */
|
||||
obj1 = JS_NewCFunction(ctx, js_function_proto_caller, NULL, 0);
|
||||
JS_DefineProperty(ctx, ctx->function_proto, JS_ATOM_caller, JS_UNDEFINED,
|
||||
obj1, ctx->throw_type_error,
|
||||
ctx->throw_type_error, ctx->throw_type_error,
|
||||
JS_PROP_HAS_GET | JS_PROP_HAS_SET |
|
||||
JS_PROP_HAS_CONFIGURABLE | JS_PROP_CONFIGURABLE);
|
||||
JS_DefineProperty(ctx, ctx->function_proto, JS_ATOM_arguments, JS_UNDEFINED,
|
||||
obj1, ctx->throw_type_error,
|
||||
ctx->throw_type_error, ctx->throw_type_error,
|
||||
JS_PROP_HAS_GET | JS_PROP_HAS_SET |
|
||||
JS_PROP_HAS_CONFIGURABLE | JS_PROP_CONFIGURABLE);
|
||||
JS_FreeValue(ctx, obj1);
|
||||
JS_FreeValue(ctx, js_object_seal(ctx, JS_UNDEFINED, 1, (JSValueConst *)&ctx->throw_type_error, 1));
|
||||
|
||||
ctx->global_obj = JS_NewObject(ctx);
|
||||
|
@ -1,26 +1,6 @@
|
||||
test262/test/annexB/language/comments/single-line-html-close-first-line-1.js:1: unexpected error type: SyntaxError: unexpected token in expression: '>'
|
||||
test262/test/annexB/language/comments/single-line-html-close-first-line-2.js:1: unexpected error type: SyntaxError: unexpected token in expression: '>'
|
||||
test262/test/annexB/language/comments/single-line-html-close-first-line-3.js:1: unexpected error type: SyntaxError: unexpected token in expression: '>'
|
||||
test262/test/built-ins/Function/prototype/arguments/prop-desc.js:31: Test262Error: Function.prototype.arguments property getter/setter are the same function Expected SameValue(«function () {
|
||||
[native code]
|
||||
}», «function () {
|
||||
[native code]
|
||||
}») to be true
|
||||
test262/test/built-ins/Function/prototype/arguments/prop-desc.js:31: strict mode: Test262Error: Function.prototype.arguments property getter/setter are the same function Expected SameValue(«function () {
|
||||
[native code]
|
||||
}», «function () {
|
||||
[native code]
|
||||
}») to be true
|
||||
test262/test/built-ins/Function/prototype/caller/prop-desc.js:29: Test262Error: Caller property getter/setter are the same function Expected SameValue(«function () {
|
||||
[native code]
|
||||
}», «function () {
|
||||
[native code]
|
||||
}») to be true
|
||||
test262/test/built-ins/Function/prototype/caller/prop-desc.js:29: strict mode: Test262Error: Caller property getter/setter are the same function Expected SameValue(«function () {
|
||||
[native code]
|
||||
}», «function () {
|
||||
[native code]
|
||||
}») to be true
|
||||
test262/test/language/destructuring/binding/keyed-destructuring-property-reference-target-evaluation-order-with-bindings.js:73: Test262Error: Actual [binding::source, binding::sourceKey, sourceKey, get source, binding::defaultValue, binding::varTarget] and expected [binding::source, binding::sourceKey, sourceKey, binding::varTarget, get source, binding::defaultValue] should have the same contents.
|
||||
test262/test/language/expressions/assignment/destructuring/iterator-destructuring-property-reference-target-evaluation-order.js:42: Test262Error: Actual [source, iterator, target, target-key, target-key-tostring, iterator-step, iterator-done, set] and expected [source, iterator, target, target-key, iterator-step, iterator-done, target-key-tostring, set] should have the same contents.
|
||||
test262/test/language/expressions/assignment/destructuring/iterator-destructuring-property-reference-target-evaluation-order.js:42: strict mode: Test262Error: Actual [source, iterator, target, target-key, target-key-tostring, iterator-step, iterator-done, set] and expected [source, iterator, target, target-key, iterator-step, iterator-done, target-key-tostring, set] should have the same contents.
|
||||
|
Loading…
x
Reference in New Issue
Block a user