case "undocumented": return new Sub("undocumented");
case "undocumented.internal": return new Sub("undocumented.internal");
//#end
-
- return null;
+ return null;
}
public Object get(Object name) {
case "res.uncab": return new Res.Cab((Res)a);
case "res.cache": try { return new Res.CachedRes((Res)a, "resources", true); }
catch (Res.NotCacheableException e) { throw new JS.Exn("this resource cannot be cached"); }
- case "res.url": return Res.fromString((String)a);
+ case "res.url":
+ String url = (String)a;
+ if (url.startsWith("http://")) return new Res.HTTP(url);
+ else if (url.startsWith("https://")) return new Res.HTTP(url);
+ else if (url.startsWith("data:")) return new Res.ByteArray(Base64.decode(url.substring(5)), null);
+ else if (url.startsWith("utf8:")) return new Res.ByteArray(url.substring(5).getBytes(), null);
+ throw new JS.Exn("invalid resource specifier " + url);
+
case "thread.sleep": sleep(JS.toInt(a)); return null;
case "log.println": Log.logJS(this, a== null ? "**null**" : a.toString()); return null;
case "log.dump": Log.recursiveLog("","",a); return null;