1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

LibWeb: Apply suggested fixes.

This commit is contained in:
asynts 2020-12-08 23:54:47 +01:00 committed by Andreas Kling
parent 1c7a834278
commit 2981f10a5e
5 changed files with 15 additions and 11 deletions

View file

@ -26,6 +26,7 @@
#include <LibJS/Heap/Heap.h>
#include <LibWeb/Bindings/RangeConstructor.h>
#include <LibWeb/Bindings/RangePrototype.h>
#include <LibWeb/Bindings/RangeWrapper.h>
#include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/DOM/Range.h>
@ -39,14 +40,17 @@ RangeConstructor::RangeConstructor(JS::GlobalObject& global_object)
void RangeConstructor::initialize(JS::GlobalObject& global_object)
{
auto& vm = this->vm();
NativeFunction::initialize(global_object);
define_property("length", JS::Value(0), JS::Attribute::Configurable);
auto& window = static_cast<WindowObject&>(global_object);
define_property(vm.names.prototype, window.range_prototype(), 0);
define_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
}
JS::Value RangeConstructor::call()
{
return construct(*this);
vm().throw_exception<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "Range");
return {};
}
JS::Value RangeConstructor::construct(Function&)