libservo: Flesh out permissions API (#35396)

- Update the script crate to better reflect the modern Permission
  specifcation -- removing the necessity for an `Insecure` variant of
  the permissions prompt.
- Have all allow/deny type requests in the internal API use an
  `AllowOrDeny` enum for clarity.
- Expose `PermissionsRequest` and `PermissionFeature` data types to the
  API and use them in the delegate method.
- Update both servoshell implementations to use the API.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
Martin Robinson 2025-02-10 16:50:33 +01:00 committed by GitHub
parent b72932bc88
commit f51a5661f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 211 additions and 207 deletions

View file

@ -29,7 +29,7 @@ use crate::dom::bluetoothpermissionresult::BluetoothPermissionResult;
use crate::dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID, UUID};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::permissions::{get_descriptor_permission_state, PermissionAlgorithm};
use crate::dom::permissions::{descriptor_permission_state, PermissionAlgorithm};
use crate::dom::promise::Promise;
use crate::script_runtime::{CanGc, JSContext};
use crate::task::TaskOnce;
@ -227,7 +227,7 @@ impl Bluetooth {
// Step 4 - 5.
if let PermissionState::Denied =
get_descriptor_permission_state(PermissionName::Bluetooth, None)
descriptor_permission_state(PermissionName::Bluetooth, None)
{
return p.reject_error(Error::NotFound);
}
@ -649,7 +649,7 @@ impl PermissionAlgorithm for Bluetooth {
// Step 1: We are not using the `global` variable.
// Step 2.
status.set_state(get_descriptor_permission_state(status.get_query(), None));
status.set_state(descriptor_permission_state(status.get_query(), None));
// Step 3.
if let PermissionState::Denied = status.get_state() {