diff --git a/Libraries/LibWeb/Bindings/WindowObject.cpp b/Libraries/LibWeb/Bindings/WindowObject.cpp index ec740dfa79..5116b9c308 100644 --- a/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -85,8 +85,6 @@ void WindowObject::initialize() define_property("location", heap().allocate(*this, *this), JS::Attribute::Enumerable | JS::Attribute::Configurable); m_xhr_prototype = heap().allocate(*this, *this); - m_xhr_constructor = heap().allocate(*this, *this); - m_xhr_constructor->define_property("prototype", m_xhr_prototype, 0); add_constructor("XMLHttpRequest", m_xhr_constructor, m_xhr_prototype); } diff --git a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp index 636a7bd461..16bb2a4b8b 100644 --- a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp +++ b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp @@ -26,9 +26,9 @@ #include #include -#include #include #include +#include #include #include @@ -41,8 +41,11 @@ XMLHttpRequestConstructor::XMLHttpRequestConstructor(JS::GlobalObject& global_ob void XMLHttpRequestConstructor::initialize(JS::GlobalObject& global_object) { + auto& vm = this->vm(); NativeFunction::initialize(global_object); - define_property("length", JS::Value(1), JS::Attribute::Configurable); + auto& window = static_cast(global_object); + define_property(vm.names.prototype, window.xhr_prototype(), 0); + define_property(vm.names.length, JS::Value(1), JS::Attribute::Configurable); define_property("UNSENT", JS::Value((i32)XMLHttpRequest::ReadyState::Unsent), JS::Attribute::Enumerable); define_property("OPENED", JS::Value((i32)XMLHttpRequest::ReadyState::Opened), JS::Attribute::Enumerable);