LibWeb: Reserve zero for not supported transfer type

Previously we were using 0 for both unsupported type and MessagePort,
which led to crashing on attempt to decode unsupported transfer type as
MessagePort.

Fixes crashing on
https://docs.mapbox.com/mapbox-gl-js/clip-layer-building-demo.html
This commit is contained in:
Aliaksandr Kalenik 2025-04-13 19:50:49 +02:00 committed by Alexander Kalenik
parent e18e7d6019
commit ea8a6b43f7
Notes: github-actions[bot] 2025-04-14 15:02:44 +00:00
3 changed files with 10 additions and 5 deletions

View file

@ -1291,9 +1291,11 @@ static bool is_interface_exposed_on_target_realm(TransferType name, JS::Realm& r
case TransferType::MessagePort:
return intrinsics.is_exposed("MessagePort"sv);
break;
default:
case TransferType::Unknown:
dbgln("Unknown interface type for transfer: {}", to_underlying(name));
break;
default:
VERIFY_NOT_REACHED();
}
return false;
}
@ -1310,6 +1312,8 @@ static WebIDL::ExceptionOr<GC::Ref<Bindings::PlatformObject>> create_transferred
case TransferType::ResizableArrayBuffer:
dbgln("ArrayBuffer ({}) is not a platform object.", to_underlying(name));
break;
case TransferType::Unknown:
break;
}
VERIFY_NOT_REACHED();
}