Properly handle Windows file: URLs on Node.js (#30098)

This adds logic to the JS implementation of URI to determine whether
the code is running on Windows under Node.js.
This commit is contained in:
Natalie Weizenbaum 2017-07-12 14:57:01 -07:00 committed by GitHub
parent a7865761d4
commit 5a74d8ab09
3 changed files with 18 additions and 2 deletions

View file

@ -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.

View file

@ -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

View file

@ -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