From 8491586ef99c8c83a7b89161d217bb47f751a726 Mon Sep 17 00:00:00 2001 From: Srujan Gaddam <58529443+srujzs@users.noreply.github.com> Date: Tue, 1 Aug 2023 12:39:27 -0700 Subject: [PATCH] Remove extends JSTypedArray from JSUint8Array1 (flutter/engine#44175) Any user @staticInterop types should only subtype the dart:js_interop types JSObject and or JSAny as user @staticInterop types erase to JSObject. In the future, the other JS types will be added as extension types, allowing users to implement them with their own extension types. Allows https://dart-review.googlesource.com/c/sdk/+/316865/1 to be landed. ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [X] I listed at least one issue that this PR fixes in the description above. - [ ] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I signed the [CLA]. - [ ] All existing and new tests are passing. --- .../src/flutter/lib/web_ui/lib/src/engine/canvaskit/image.dart | 2 +- .../lib/web_ui/lib/src/engine/js_interop/js_typed_data.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/image.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/image.dart index 2fcfa6b6f3..11af8b8a3d 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/image.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/canvaskit/image.dart @@ -204,7 +204,7 @@ Future readChunked(HttpFetchPayload payload, int contentLength, WebOn final JSUint8Array result = createUint8ArrayFromLength(contentLength); int position = 0; int cumulativeBytesLoaded = 0; - await payload.read((JSUint8Array1 chunk) { + await payload.read((JSUint8Array chunk) { cumulativeBytesLoaded += chunk.length.toDartInt; chunkCallback(cumulativeBytesLoaded, contentLength); result.set(chunk, position.toJS); diff --git a/engine/src/flutter/lib/web_ui/lib/src/engine/js_interop/js_typed_data.dart b/engine/src/flutter/lib/web_ui/lib/src/engine/js_interop/js_typed_data.dart index 8e0ae50b37..f82ce73af0 100644 --- a/engine/src/flutter/lib/web_ui/lib/src/engine/js_interop/js_typed_data.dart +++ b/engine/src/flutter/lib/web_ui/lib/src/engine/js_interop/js_typed_data.dart @@ -15,7 +15,7 @@ extension TypedArrayExtension on JSTypedArray { // the dart sdk yet @JS('Uint8Array') @staticInterop -class JSUint8Array1 extends JSTypedArray { +class JSUint8Array1 { external factory JSUint8Array1._create1(JSAny bufferOrLength); external factory JSUint8Array1._create3( JSArrayBuffer buffer,