1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:57:35 +00:00

LibWeb: Use prototype and constructor methods from new Intrinsics

This will let us remove the helpers from Window that simply defer to the
Intrinsics that are hanging off the [[HostDefined]] slot on the realm
This commit is contained in:
Andrew Kaster 2022-09-30 17:40:20 -06:00 committed by Linus Groh
parent beb3519a49
commit f1367e0e4c
10 changed files with 19 additions and 31 deletions

View file

@ -24,7 +24,7 @@ namespace Web::Bindings {
LocationObject::LocationObject(JS::Realm& realm)
: PlatformObject(realm)
{
set_prototype(&verify_cast<HTML::Window>(realm.global_object()).cached_web_prototype("Location"));
set_prototype(&cached_web_prototype(realm, "Location"));
}
LocationObject::~LocationObject() = default;
@ -315,7 +315,7 @@ JS::ThrowCompletionOr<bool> LocationObject::internal_define_own_property(JS::Pro
}
// 2. Throw a "SecurityError" DOMException.
return throw_completion(WebIDL::SecurityError::create(global_object(), String::formatted("Can't define property '{}' on cross-origin object", property_key)));
return throw_completion(WebIDL::SecurityError::create(realm(), String::formatted("Can't define property '{}' on cross-origin object", property_key)));
}
// 7.10.5.7 [[Get]] ( P, Receiver ), https://html.spec.whatwg.org/multipage/history.html#location-get
@ -352,7 +352,7 @@ JS::ThrowCompletionOr<bool> LocationObject::internal_delete(JS::PropertyKey cons
return JS::Object::internal_delete(property_key);
// 2. Throw a "SecurityError" DOMException.
return throw_completion(WebIDL::SecurityError::create(global_object(), String::formatted("Can't delete property '{}' on cross-origin object", property_key)));
return throw_completion(WebIDL::SecurityError::create(realm(), String::formatted("Can't delete property '{}' on cross-origin object", property_key)));
}
// 7.10.5.10 [[OwnPropertyKeys]] ( ), https://html.spec.whatwg.org/multipage/history.html#location-ownpropertykeys