Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3698,7 +3698,7 @@ Future<CanvasKitModule> _downloadOneOf(Iterable<String> urls) async {
}

String _resolveUrl(String url) {
return DomURL(url.toJS, domWindow.document.baseUri?.toJS).toJSString().toDart;
return createDomURL(url, domWindow.document.baseUri).toJSString().toDart;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could wrap the .toJSString().toDart in a toString() method in the DomURLExtension :)

}

/// Downloads the CanvasKit JavaScript file at [url].
Expand Down
8 changes: 6 additions & 2 deletions lib/web_ui/lib/src/engine/dom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2368,12 +2368,16 @@ extension DomPopStateEventExtension on DomPopStateEvent {
dynamic get state => _state?.toObjectDeep;
}

@JS()
@JS('URL')
@staticInterop
class DomURL {
external factory DomURL(JSString url, JSString? base);
external factory DomURL.arg1(JSString url);
external factory DomURL.arg2(JSString url, JSString? base);
}

DomURL createDomURL(String url, [String? base]) =>
base == null ? DomURL.arg1(url.toJS) : DomURL.arg2(url.toJS, base.toJS);

extension DomURLExtension on DomURL {
@JS('createObjectURL')
external JSString _createObjectURL(JSAny object);
Expand Down