mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
script: Add can_gc to WebIDL dictionary constructors (#39195)
More progress on can_gc! Testing: Internal change only, shouldn't change behavior. Fixes: #38708 --------- Signed-off-by: lumiscosity <averyrudelphe@gmail.com>
This commit is contained in:
parent
1b9dc3e672
commit
9584b9e57d
8 changed files with 26 additions and 17 deletions
|
@ -40,6 +40,7 @@ pub(crate) trait PermissionAlgorithm {
|
|||
fn create_descriptor(
|
||||
cx: JSContext,
|
||||
permission_descriptor_obj: *mut JSObject,
|
||||
can_gc: CanGc,
|
||||
) -> Result<Self::Descriptor, Error>;
|
||||
fn permission_query(
|
||||
cx: JSContext,
|
||||
|
@ -101,7 +102,7 @@ impl Permissions {
|
|||
};
|
||||
|
||||
// (Query, Request, Revoke) Step 1.
|
||||
let root_desc = match Permissions::create_descriptor(cx, permissionDesc) {
|
||||
let root_desc = match Permissions::create_descriptor(cx, permissionDesc, can_gc) {
|
||||
Ok(descriptor) => descriptor,
|
||||
Err(error) => {
|
||||
p.reject_error(error, can_gc);
|
||||
|
@ -116,7 +117,8 @@ impl Permissions {
|
|||
match root_desc.name {
|
||||
#[cfg(feature = "bluetooth")]
|
||||
PermissionName::Bluetooth => {
|
||||
let bluetooth_desc = match Bluetooth::create_descriptor(cx, permissionDesc) {
|
||||
let bluetooth_desc = match Bluetooth::create_descriptor(cx, permissionDesc, can_gc)
|
||||
{
|
||||
Ok(descriptor) => descriptor,
|
||||
Err(error) => {
|
||||
p.reject_error(error, can_gc);
|
||||
|
@ -221,12 +223,13 @@ impl PermissionAlgorithm for Permissions {
|
|||
fn create_descriptor(
|
||||
cx: JSContext,
|
||||
permission_descriptor_obj: *mut JSObject,
|
||||
can_gc: CanGc,
|
||||
) -> Result<PermissionDescriptor, Error> {
|
||||
rooted!(in(*cx) let mut property = UndefinedValue());
|
||||
property
|
||||
.handle_mut()
|
||||
.set(ObjectValue(permission_descriptor_obj));
|
||||
match PermissionDescriptor::new(cx, property.handle()) {
|
||||
match PermissionDescriptor::new(cx, property.handle(), can_gc) {
|
||||
Ok(ConversionResult::Success(descriptor)) => Ok(descriptor),
|
||||
Ok(ConversionResult::Failure(error)) => Err(Error::Type(error.into_owned())),
|
||||
Err(_) => Err(Error::JSFailed),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue