new TemplateHelper().parseit(r.getInputStream(), r.t);
return r.t;
} catch (Exception e) {
- if (Log.on) Log.log(r.t.fileName, e);
+ if (Log.on) Log.log(r.t == null ? "null" : r.t.fileName, e);
return null;
}
}
if (staticscript == null) return staticJSScope;
JSFunction temp = staticscript;
staticscript = null;
- JSContext.invoke(temp.cloneWithNewParentJSSCope(staticJSScope));
+ temp.cloneWithNewParentJSScope(staticJSScope).call(new JSArray());
return staticJSScope;
}
for (int i=0; children != null && i<children.size(); i++) {
Box kid = new BoxTree();
((Template)children.elementAt(i)).apply(kid, xwt, pis);
- b.putAndTriggerTraps(b.numChildren(), kid);
+ b.putAndTriggerJSTraps(JSObj.N(b.numchildren), kid);
}
- if (script != null) JSContext.invoke(script.cloneWithNewParentJSScope(pis));
+ if (script != null) script.cloneWithNewParentJSScope(pis).call(new JSArray());
for(int i=0; keys != null && i<keys.length; i++)
- if (vals[i] instanceof String && ((String)vals[i]).charAt(0) == '$') b.putAndTriggerTraps(keys[i], pis.get(vals[i]));
- else if ("image".equals(keys[i])) b.putAndTriggerTraps("image", resolveStringToResource((String)vals[i], xwt, true));
- else if (keys[i] != null) b.putAndTriggerTraps(keys[i], vals[i]);
+ if (vals[i] instanceof String && ((String)vals[i]).charAt(0) == '$') b.putAndTriggerJSTraps(keys[i], pis.get(vals[i]));
+ else if ("image".equals(keys[i])) b.putAndTriggerJSTraps("image", resolveStringToResource((String)vals[i], xwt, true));
+ else if (keys[i] != null) b.putAndTriggerJSTraps(keys[i], vals[i]);
}
private JSFunction parseScript(boolean isstatic) {
JSFunction thisscript = null;
try {
- thisscript = JS.parse(t.fileName + (isstatic ? "._" : ""), t.content_start, new StringReader(t.content.toString()));
+ String contentString = t.content.toString();
+ if (contentString.trim().length() > 0)
+ thisscript = JS.parse(t.fileName + (isstatic ? "._" : ""), t.content_start, new StringReader(contentString));
} catch (IOException ioe) {
if (Log.on) Log.log(this, " ERROR: " + ioe.getMessage());
thisscript = null;