diff --git a/CHANGELOG.md b/CHANGELOG.md index 782fa28d4b54..39b5c66ea85e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,10 @@ the system level timeout duration, a timeout may occur sooner than specified in 'timeout'. +* `dart:core` + * The `Uri` class now correctly handles paths while running on Node.js on + Windows. + ### Dart VM * Support for MIPS has been remvoed. diff --git a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart index fb5447e02cd3..efd0bce54b0e 100644 --- a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart +++ b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart @@ -602,7 +602,13 @@ class Uri { @patch class _Uri { @patch - static bool get _isWindows => false; + static bool get _isWindows => _isWindowsCached; + + static final bool _isWindowsCached = JS( + 'bool', + 'typeof process != "undefined" && ' + 'Object.prototype.toString.call(process) == "[object process]" && ' + 'process.platform == "win32"'); // Matches a String that _uriEncodes to itself regardless of the kind of // component. This corresponds to [_unreservedTable], i.e. characters that diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart index b95f9f130bb4..7507985aa3ad 100644 --- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart +++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart @@ -611,7 +611,13 @@ class Uri { @patch class _Uri { @patch - static bool get _isWindows => false; + static bool get _isWindows => _isWindowsCached; + + static final bool _isWindowsCached = JS( + 'bool', + 'typeof process != "undefined" && ' + 'Object.prototype.toString.call(process) == "[object process]" && ' + 'process.platform == "win32"'); // Matches a String that _uriEncodes to itself regardless of the kind of // component. This corresponds to [_unreservedTable], i.e. characters that