Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jul 12, 2017
Merged

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

merged 2 commits into from
Jul 12, 2017

Conversation

nex3
Copy link
Member

@nex3 nex3 commented Jul 7, 2017

This adds logic to the JS implementation of URI to determine whether
the code is running on Windows under Node.js.

This adds logic to the JS implementation of URI to determine whether
the code is running on Windows under Node.js.
@nex3 nex3 force-pushed the uri-is-windows branch from 628772f to 3c85060 Compare July 7, 2017 02:21
@nex3 nex3 requested a review from lrhn July 7, 2017 02:21
nex3 added a commit to sass/dart-sass that referenced this pull request Jul 7, 2017
nex3 added a commit to sass/dart-sass that referenced this pull request Jul 7, 2017
nex3 added a commit to sass/dart-sass that referenced this pull request Jul 7, 2017
nex3 added a commit to sass/dart-sass that referenced this pull request Jul 7, 2017
We aren't running Node tests here until dart-lang/sdk#30098 lands.
nex3 added a commit to sass/dart-sass that referenced this pull request Jul 7, 2017
Copy link
Member

@lrhn lrhn left a comment

Choose a reason for hiding this comment

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

LGTM if the test is fixed.

static bool get _isWindows => _isWindowsCached;

static final bool _isWindowsCached =
JS('bool', 'process !== undefined && process.platform == "win32"');
Copy link
Member

Choose a reason for hiding this comment

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

It looks unsafe. Using "process" with no prefix requires "process" to exist, otherwise the access throws.
Maybe use typeof to avoid that:

typeof process != "undefined" && Object.prototype.toString.call(process) === "[object process]" && process.platform === "win32"

(This also strengthens the check for node.js since that's the only known platform that has a object class named "process")

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@nex3 nex3 merged commit 5a74d8a into master Jul 12, 2017
@nex3 nex3 deleted the uri-is-windows branch July 12, 2017 21:57
nex3 added a commit to sass/dart-sass that referenced this pull request May 4, 2018
nex3 added a commit to sass/dart-sass that referenced this pull request May 28, 2018
nex3 added a commit to sass/dart-sass that referenced this pull request May 28, 2018
nex3 added a commit to sass/dart-sass that referenced this pull request Jun 14, 2018
This un-reverts pull request #320 from sass/remove-path-workaround,
which was reverted by commit 0fb5d25.
nex3 added a commit to sass/dart-sass that referenced this pull request Jun 14, 2018
This un-reverts pull request #320 from sass/remove-path-workaround,
which was reverted by commit 0fb5d25.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants