mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:17:34 +00:00
LibWeb: Implement Navigator.cookieEnabled
This commit is contained in:
parent
a4bc3fa255
commit
c500ebdcd5
2 changed files with 8 additions and 0 deletions
|
@ -34,6 +34,7 @@ void NavigatorObject::initialize(JS::GlobalObject& global_object)
|
||||||
define_direct_property("product", js_string(heap, "Gecko"), attr);
|
define_direct_property("product", js_string(heap, "Gecko"), attr);
|
||||||
|
|
||||||
define_native_accessor("userAgent", user_agent_getter, {}, JS::Attribute::Configurable | JS::Attribute::Enumerable);
|
define_native_accessor("userAgent", user_agent_getter, {}, JS::Attribute::Configurable | JS::Attribute::Enumerable);
|
||||||
|
define_native_accessor("cookieEnabled", cookie_enabled_getter, {}, JS::Attribute::Configurable | JS::Attribute::Enumerable);
|
||||||
|
|
||||||
// FIXME: Reflect actual connectivity status.
|
// FIXME: Reflect actual connectivity status.
|
||||||
define_direct_property("onLine", JS::Value(true), attr);
|
define_direct_property("onLine", JS::Value(true), attr);
|
||||||
|
@ -48,6 +49,12 @@ JS_DEFINE_NATIVE_FUNCTION(NavigatorObject::user_agent_getter)
|
||||||
return JS::js_string(vm, ResourceLoader::the().user_agent());
|
return JS::js_string(vm, ResourceLoader::the().user_agent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JS_DEFINE_NATIVE_FUNCTION(NavigatorObject::cookie_enabled_getter)
|
||||||
|
{
|
||||||
|
// No way of disabling cookies right now :^)
|
||||||
|
return JS::Value(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JS_DECLARE_NATIVE_FUNCTION(user_agent_getter);
|
JS_DECLARE_NATIVE_FUNCTION(user_agent_getter);
|
||||||
|
JS_DECLARE_NATIVE_FUNCTION(cookie_enabled_getter);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue