LibWeb: Rename current settings object to 'current principal'

Aligning the name with the the PR implementing the javascript
shadow realm proposal into the web platform. This commit
simply performs the rename before implementing the behaviour
change.

The actual change to the behaviour of the AO is not implemented in this
commit to support 'synthetic' shadow realms as the surrounding
infrastructure is not in place yet.

Not all specs have a MR open to align with this proposed change to the
HTML standard. But in this case we can just apply the same mechanical
change everywhere.
This commit is contained in:
Shannon Booth 2024-10-21 13:35:24 +13:00 committed by Andrew Kaster
commit b2f3ed8b5a
Notes: github-actions[bot] 2024-11-01 19:17:08 +00:00
16 changed files with 50 additions and 39 deletions

View file

@ -157,6 +157,7 @@ public:
}
// https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal
// https://whatpr.org/html/9893/structured-data.html#structuredserializeinternal
WebIDL::ExceptionOr<SerializationRecord> serialize(JS::Value value)
{
// 2. If memory[value] exists, then return memory[value].
@ -565,10 +566,10 @@ WebIDL::ExceptionOr<void> serialize_array_buffer(JS::VM& vm, Vector<u32>& vector
// FIXME: 1. If IsSharedArrayBuffer(value) is true, then:
if (false) {
// 1. If the current settings object's cross-origin isolated capability is false, then throw a "DataCloneError" DOMException.
// 1. If the current principal settings object's cross-origin isolated capability is false, then throw a "DataCloneError" DOMException.
// NOTE: This check is only needed when serializing (and not when deserializing) as the cross-origin isolated capability cannot change
// over time and a SharedArrayBuffer cannot leave an agent cluster.
if (current_settings_object().cross_origin_isolated_capability() == CanUseCrossOriginIsolatedAPIs::No)
if (current_principal_settings_object().cross_origin_isolated_capability() == CanUseCrossOriginIsolatedAPIs::No)
return WebIDL::DataCloneError::create(*vm.current_realm(), "Cannot serialize SharedArrayBuffer when cross-origin isolated"_string);
// 2. If forStorage is true, then throw a "DataCloneError" DOMException.