summaryrefslogtreecommitdiff
path: root/src/isolate.rs
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-02-12 21:14:02 -0500
committerRyan Dahl <ry@tinyclouds.org>2019-02-18 23:04:59 -0500
commit42408febe8cdf9e30ff8d1a3bb13f4994906c53b (patch)
tree92ab3408d426f1d18a511aa16130357ed074410a /src/isolate.rs
parent27afbd135162b435c8af22b18622656ccab12174 (diff)
Add window.location
Diffstat (limited to 'src/isolate.rs')
-rw-r--r--src/isolate.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/isolate.rs b/src/isolate.rs
index 8775c6f4a..661e49edd 100644
--- a/src/isolate.rs
+++ b/src/isolate.rs
@@ -100,6 +100,22 @@ impl IsolateState {
}
}
+ pub fn main_module(&self) -> Option<String> {
+ if self.argv.len() <= 1 {
+ None
+ } else {
+ let specifier = self.argv[1].clone();
+ let referrer = ".";
+ match self.dir.resolve_module_url(&specifier, referrer) {
+ Ok(url) => Some(url.to_string()),
+ Err(e) => {
+ debug!("Potentially swallowed error {}", e);
+ None
+ }
+ }
+ }
+ }
+
#[cfg(test)]
pub fn mock() -> Arc<IsolateState> {
let argv = vec![String::from("./deno"), String::from("hello.js")];