Skip to content

Commit

Permalink
Declare the js context as nullable in skwasm surface callback (#45810)
Browse files Browse the repository at this point in the history
Declaring this as non-nullable causes breakage with an incoming JS interop change from the SDK. Marking this as nullable fixes the issue.

This doesn't actually change any behavior. The breakages were in `test/ui/image_golden_test.dart`. No changes to the test are required (they did catch the issue when the dart roll happened).
  • Loading branch information
eyebrowsoffire authored and harryterkelsen committed Oct 23, 2023
1 parent 0cdcfae commit 3c9bcea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/web_ui/lib/src/engine/skwasm/skwasm_impl/surface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class SkwasmSurface {
return completer.future;
}

void _callbackHandler(JSNumber callbackId, JSNumber context, JSAny jsContext) {
void _callbackHandler(JSNumber callbackId, JSNumber context, JSAny? jsContext) {
final Completer<JSAny> completer = _pendingCallbacks.remove(callbackId.toDartInt)!;
if (jsContext.isUndefinedOrNull) {
completer.complete(context);
Expand Down
3 changes: 2 additions & 1 deletion lib/web_ui/skwasm/library_skwasm_support.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ mergeInto(LibraryManager.library, {
object.close();
}
associatedObjectsMap.delete(data.pointer);
return;
default:
console.warn('unrecognized skwasm message');
console.warn(`unrecognized skwasm message: ${skwasmMessage}`);
}
};
if (!threadId) {
Expand Down

0 comments on commit 3c9bcea

Please sign in to comment.