New issue
Advanced search Search tips

Issue 921168 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Default constructors for mojo structs with non-nullable strings generate an invalid instance

Project Member Reported by dcheng@chromium.org, Jan 11

Issue description

Since the default ctor for WTF::String() generates a null string, and we simply use the default ctor, even if the string is non-nullable, that means the default ctor ends up generating a struct that's not valid to send (or receive).

It should be possible to tweak the Blink variant to use the empty string for the default ctor when a string isn't marked nullable.
 
This should also be generalized to nested structs that aren't nullable: they should also be default constructed. Probably?
Cc: palmer@chromium.org
This affects all platforms except iOS, right?
It would affect iOS too. We still use some Mojo interfaces on iOS even though they're all in-process.

I agree with the premise of the bug. Certainly a non-nullable string field should be initialized with a valid empty string by default.

I'm not sure about nested structs. Unlike a default-constructed string object, struct fields are heap pointers and thus default-constructing them requires a heap allocation even if the field is going to be immediately replaced by something else. Maybe we don't care?
Labels: -OS-Windows
Oh right but the Blink bindings specifically for WTF::String, yeah, not iOS.

Sign in to add a comment