Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: sdk/lib/_internal/js_runtime/lib/preambles/d8.js

Issue 2993153003: Remove use of cwd in d8 preamble (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/pkg.status ('k') | tests/corelib_2/corelib_2.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/preambles/d8.js
diff --git a/sdk/lib/_internal/js_runtime/lib/preambles/d8.js b/sdk/lib/_internal/js_runtime/lib/preambles/d8.js
index 75c0c459003976edd60f515b01f5719fc2d4ab09..ca9093756e46bee93a6cdc15d041a9c7a6811376 100644
--- a/sdk/lib/_internal/js_runtime/lib/preambles/d8.js
+++ b/sdk/lib/_internal/js_runtime/lib/preambles/d8.js
@@ -16,21 +16,13 @@ if (typeof global != "undefined") self = global; // Node.js.
// Location (Uri.base)
- var workingDirectory;
- // TODO(sgjesse): This does not work on Windows.
- if (typeof os == "object" && "system" in os) {
- // V8.
- workingDirectory = os.system("pwd");
- var length = workingDirectory.length;
- if (workingDirectory[length - 1] == '\n') {
- workingDirectory = workingDirectory.substring(0, length - 1);
- }
- } else if (typeof process != "undefined" &&
+ var baseUri = 'org-dartlang-d8-preamble:///mock/uri/base/';
+ if (typeof process != "undefined" &&
typeof process.cwd == "function") {
// Node.js.
- workingDirectory = process.cwd();
+ baseUri = 'file://' + process.cwd() + '/';
}
- self.location = { href: "file://" + workingDirectory + "/" };
+ self.location = { href: baseUri };
// Event loop.
« no previous file with comments | « pkg/pkg.status ('k') | tests/corelib_2/corelib_2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698