mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +00:00
LibWeb: Add "navigator" object and expose navigator.userAgent
A lot of web content looks for this property. We'll probably have to tweak this as we go, but at least now we have it. :^)
This commit is contained in:
parent
6e5f9e20eb
commit
a2b0cc8f08
4 changed files with 104 additions and 2 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <LibJS/Runtime/Error.h>
|
||||
#include <LibJS/Runtime/Function.h>
|
||||
#include <LibWeb/Bindings/DocumentWrapper.h>
|
||||
#include <LibWeb/Bindings/NavigatorObject.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
|
@ -45,6 +46,8 @@ WindowObject::WindowObject(Window& impl)
|
|||
put_native_function("setInterval", set_interval);
|
||||
put_native_function("requestAnimationFrame", request_animation_frame);
|
||||
put_native_function("cancelAnimationFrame", cancel_animation_frame);
|
||||
|
||||
put("navigator", heap().allocate<NavigatorObject>());
|
||||
}
|
||||
|
||||
WindowObject::~WindowObject()
|
||||
|
@ -110,7 +113,6 @@ JS::Value WindowObject::request_animation_frame(JS::Interpreter& interpreter)
|
|||
return JS::Value(impl->request_animation_frame(*static_cast<JS::Function*>(callback_object)));
|
||||
}
|
||||
|
||||
|
||||
JS::Value WindowObject::cancel_animation_frame(JS::Interpreter& interpreter)
|
||||
{
|
||||
auto* impl = impl_from(interpreter);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue