summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-06 20:24:45 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-06 20:27:44 +0200
commitbdffc9e7fb7b721710d3ef38cc457a5e66f3542a (patch)
tree283ef9d6e1e1fd408d4458977fce315972686055 /Libraries/LibWeb
parent5495f06af55bc371b3f4b3e09960ce0fbbe49590 (diff)
downloadserenity-bdffc9e7fb7b721710d3ef38cc457a5e66f3542a.zip
LibJS: Support array holes, encoded as empty JS::Value
This patch adds a new kind of JS::Value, the empty value. It's what you get when you do JSValue() (or most commonly, {} in C++.) An empty Value signifies the absence of a value, and should never be visible to JavaScript itself. As of right now, it's used for array holes and as a return value when an exception has been thrown and we just want to unwind. This patch is a bit of a mess as I had to fix a whole bunch of code that was relying on JSValue() being undefined, etc.
Diffstat (limited to 'Libraries/LibWeb')
-rw-r--r--Libraries/LibWeb/Bindings/WindowObject.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Libraries/LibWeb/Bindings/WindowObject.cpp b/Libraries/LibWeb/Bindings/WindowObject.cpp
index 5bd017a228..c101f6d6d1 100644
--- a/Libraries/LibWeb/Bindings/WindowObject.cpp
+++ b/Libraries/LibWeb/Bindings/WindowObject.cpp
@@ -78,7 +78,7 @@ JS::Value WindowObject::alert(JS::Interpreter& interpreter)
if (arguments.size() < 1)
return {};
impl->alert(arguments[0].to_string());
- return {};
+ return JS::js_undefined();
}
JS::Value WindowObject::set_interval(JS::Interpreter& interpreter)
@@ -95,7 +95,7 @@ JS::Value WindowObject::set_interval(JS::Interpreter& interpreter)
if (!callback_object->is_function())
return interpreter.throw_exception<JS::Error>("TypeError", "Not a function");
impl->set_interval(*static_cast<JS::Function*>(callback_object), arguments[1].to_i32());
- return {};
+ return JS::js_undefined();
}
JS::Value WindowObject::set_timeout(JS::Interpreter& interpreter)
@@ -117,7 +117,7 @@ JS::Value WindowObject::set_timeout(JS::Interpreter& interpreter)
interval = arguments[1].to_i32();
impl->set_timeout(*static_cast<JS::Function*>(callback_object), interval);
- return {};
+ return JS::js_undefined();
}
JS::Value WindowObject::request_animation_frame(JS::Interpreter& interpreter)
@@ -145,7 +145,7 @@ JS::Value WindowObject::cancel_animation_frame(JS::Interpreter& interpreter)
if (arguments.size() < 1)
return {};
impl->cancel_animation_frame(arguments[0].to_i32());
- return {};
+ return JS::js_undefined();
}
JS::Value WindowObject::document_getter(JS::Interpreter& interpreter)