From d1d1f4f251edb5d13cc96648ab31c9c21fbcee7f Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Wed, 2 Jun 2021 21:06:21 +0100 Subject: [PATCH] LibJS: Remove declarations of some TODO()'d BigInt and Promise functions In hindsight declaring these prematurely wasn't the greatest idea - that just makes any script checking for their existence believe they'll work, and what follows next is a crash of the js or WebContent process. If we omit the declarations, a polyfill can be provided instead. This also affects the test262, which tests these - instead of reporting a bunch of assertion crash errors, we should simply report test failure for 'not a function', which in turn makes it easier to spot any actual bugs causing crashes. --- Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp | 7 ++++--- Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp index 04eb0be99a..49e2da55fb 100644 --- a/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/BigIntConstructor.cpp @@ -26,9 +26,10 @@ void BigIntConstructor::initialize(GlobalObject& global_object) define_property(vm.names.prototype, global_object.bigint_prototype(), 0); define_property(vm.names.length, Value(1), Attribute::Configurable); - u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.asIntN, as_int_n, 2, attr); - define_native_function(vm.names.asUintN, as_uint_n, 2, attr); + // TODO: Implement these functions below and uncomment this. + // u8 attr = Attribute::Writable | Attribute::Configurable; + // define_native_function(vm.names.asIntN, as_int_n, 2, attr); + // define_native_function(vm.names.asUintN, as_uint_n, 2, attr); } BigIntConstructor::~BigIntConstructor() diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp index 6348145f73..561988717e 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp @@ -28,10 +28,11 @@ void PromiseConstructor::initialize(GlobalObject& global_object) define_property(vm.names.length, Value(1)); u8 attr = Attribute::Writable | Attribute::Configurable; - define_native_function(vm.names.all, all, 1, attr); - define_native_function(vm.names.allSettled, all_settled, 1, attr); - define_native_function(vm.names.any, any, 1, attr); - define_native_function(vm.names.race, race, 1, attr); + // TODO: Implement these functions below and uncomment this. + // define_native_function(vm.names.all, all, 1, attr); + // define_native_function(vm.names.allSettled, all_settled, 1, attr); + // define_native_function(vm.names.any, any, 1, attr); + // define_native_function(vm.names.race, race, 1, attr); define_native_function(vm.names.reject, reject, 1, attr); define_native_function(vm.names.resolve, resolve, 1, attr); }