diff --git a/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart index 66676eea45d3..38d0b205ff9f 100644 --- a/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart +++ b/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart @@ -884,14 +884,9 @@ class Uri { @patch class _Uri { + // DDC is only used when targeting the browser, so this is always false. @patch - static bool get _isWindows => _isWindowsCached; - - static final bool _isWindowsCached = JS( - 'bool', - 'typeof process != "undefined" && ' - 'Object.prototype.toString.call(process) == "[object process]" && ' - 'process.platform == "win32"'); + static bool get _isWindows => false; // 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 7bd9fff32243..8ca49428ed4a 100644 --- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart +++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart @@ -822,11 +822,16 @@ class _Uri { @patch static bool get _isWindows => _isWindowsCached; - static final bool _isWindowsCached = JS( - 'bool', - 'typeof process != "undefined" && ' - 'Object.prototype.toString.call(process) == "[object process]" && ' - 'process.platform == "win32"'); + // Consider the possibility of using Windows behavior if app is + // compiled with `--server-mode` and running on Node or a similar platform. + static final bool _isWindowsCached = + !const bool.fromEnvironment('dart.library.html') && + 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