LibWeb/HTML: Port Window.isSecureContext to IDL

This commit is contained in:
Linus Groh 2023-03-06 11:12:48 +00:00
parent 188aac5077
commit 94f1eff291
Notes: sideshowbarker 2024-07-17 02:39:10 +09:00
3 changed files with 1 additions and 10 deletions

View file

@ -1102,7 +1102,6 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
define_native_accessor(realm, "localStorage", local_storage_getter, {}, attr);
define_native_accessor(realm, "sessionStorage", session_storage_getter, {}, attr);
define_native_accessor(realm, "isSecureContext", is_secure_context_getter, {}, attr);
// Legacy
define_native_accessor(realm, "event", event_getter, event_setter, JS::Attribute::Enumerable);
@ -1829,14 +1828,6 @@ JS_DEFINE_NATIVE_FUNCTION(Window::structured_clone)
}));
}
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-issecurecontext
JS_DEFINE_NATIVE_FUNCTION(Window::is_secure_context_getter)
{
auto* impl = TRY(impl_from(vm));
// The isSecureContext getter steps are to return true if this's relevant settings object is a secure context, or false otherwise.
return JS::Value(HTML::is_secure_context(impl->associated_document().relevant_settings_object()));
}
JS_DEFINE_NATIVE_FUNCTION(Window::local_storage_getter)
{
auto* impl = TRY(impl_from(vm));

View file

@ -257,7 +257,6 @@ private:
JS_DECLARE_NATIVE_FUNCTION(local_storage_getter);
JS_DECLARE_NATIVE_FUNCTION(session_storage_getter);
JS_DECLARE_NATIVE_FUNCTION(is_secure_context_getter);
JS_DECLARE_NATIVE_FUNCTION(set_interval);
JS_DECLARE_NATIVE_FUNCTION(set_timeout);

View file

@ -38,6 +38,7 @@ interface Window : EventTarget {
// FIXME: Replace these with 'Window includes WindowOrWorkerGlobalScope;' once we have feature parity
[Replaceable] readonly attribute USVString origin;
readonly attribute boolean isSecureContext;
};
Window includes GlobalEventHandlers;
Window includes WindowEventHandlers;