mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
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:
parent
e18e7d6019
commit
ea8a6b43f7
Notes:
github-actions[bot]
2025-04-14 15:02:44 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: ea8a6b43f7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4342
Reviewed-by: https://github.com/trflynn89
3 changed files with 10 additions and 5 deletions
|
@ -65,7 +65,7 @@ HTML::TransferType ImageBitmap::primary_interface() const
|
||||||
{
|
{
|
||||||
// FIXME: Implement this
|
// FIXME: Implement this
|
||||||
dbgln("(STUBBED) ImageBitmap::primary_interface()");
|
dbgln("(STUBBED) ImageBitmap::primary_interface()");
|
||||||
return {};
|
return TransferType::Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-imagebitmap-width
|
// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-imagebitmap-width
|
||||||
|
|
|
@ -1291,9 +1291,11 @@ static bool is_interface_exposed_on_target_realm(TransferType name, JS::Realm& r
|
||||||
case TransferType::MessagePort:
|
case TransferType::MessagePort:
|
||||||
return intrinsics.is_exposed("MessagePort"sv);
|
return intrinsics.is_exposed("MessagePort"sv);
|
||||||
break;
|
break;
|
||||||
default:
|
case TransferType::Unknown:
|
||||||
dbgln("Unknown interface type for transfer: {}", to_underlying(name));
|
dbgln("Unknown interface type for transfer: {}", to_underlying(name));
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1310,6 +1312,8 @@ static WebIDL::ExceptionOr<GC::Ref<Bindings::PlatformObject>> create_transferred
|
||||||
case TransferType::ResizableArrayBuffer:
|
case TransferType::ResizableArrayBuffer:
|
||||||
dbgln("ArrayBuffer ({}) is not a platform object.", to_underlying(name));
|
dbgln("ArrayBuffer ({}) is not a platform object.", to_underlying(name));
|
||||||
break;
|
break;
|
||||||
|
case TransferType::Unknown:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,10 @@ struct DeserializedRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class TransferType : u8 {
|
enum class TransferType : u8 {
|
||||||
MessagePort,
|
Unknown = 0,
|
||||||
ArrayBuffer,
|
MessagePort = 1,
|
||||||
ResizableArrayBuffer,
|
ArrayBuffer = 2,
|
||||||
|
ResizableArrayBuffer = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
WebIDL::ExceptionOr<SerializationRecord> structured_serialize(JS::VM& vm, JS::Value);
|
WebIDL::ExceptionOr<SerializationRecord> structured_serialize(JS::VM& vm, JS::Value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue