Index: mojo/dart/embedder/builtin.dart |
diff --git a/mojo/dart/embedder/builtin.dart b/mojo/dart/embedder/builtin.dart |
index 7077039becefb341cb9fb9df811e0792f3eab193..1adbc610115832a1f6421cfd27b29d5859e6c646 100644 |
--- a/mojo/dart/embedder/builtin.dart |
+++ b/mojo/dart/embedder/builtin.dart |
@@ -27,9 +27,25 @@ Uri _uriBase() { |
return _cachedUriBase; |
} |
+String _rawScript; |
+Uri _scriptUri() { |
+ if (_rawScript.startsWith('http:') || |
+ _rawScript.startsWith('https:') || |
+ _rawScript.startsWith('file:')) { |
+ return Uri.parse(_rawScript); |
+ } else { |
+ return Uri.base.resolveUri(new Uri.file(_rawScript)); |
+ } |
+} |
+ |
_setupHooks() { |
VMLibraryHooks.eventHandlerSendData = MojoHandleWatcher.timer; |
VMLibraryHooks.timerMillisecondClock = MojoCoreNatives.timerMillisecondClock; |
+ |
+ // TODO(zra): When the Dart issue here: |
+ // https://github.com/dart-lang/sdk/issues/25603 |
+ // is resolved, there will be no need to eagerly compute the script URI. |
+ VMLibraryHooks.platformScript = _scriptUri(); |
} |
_getUriBaseClosure() => _uriBase; |
@@ -39,4 +55,4 @@ _getPrintClosure() => _print; |
// The root library (aka the script) is imported into this library. The |
// embedder uses this to lookup the main entrypoint in the root library's |
// namespace. |
-Function _getMainClosure() => main; |
+Function _getMainClosure() => main; |