src/Palete/Javascript.vala
[app.Builder.js] / src / Palete / Javascript.vala
index 59b70e7..137fcc1 100644 (file)
@@ -115,18 +115,18 @@ namespace Palete {
                 * then a method is called, with a string argument (json encoded)
                 * 
                 */
-               void executeFile(string fname, string method, string json)
+               public void executeFile(string fname, string method, string json)
                {
                        string file_data;
                        if (!FileUtils.test (fname, FileTest.EXISTS)) {
-                               throw new JavascriptError.MISSING_FILE(fname + " not found");
+                               throw new JavascriptError.MISSING_FILE("Plugin: file not found %s", fname);
                        }
                
                        FileUtils.get_contents(fname, out file_data);
                        
                        var jfile_data = new JSCore.String.with_utf8_c_string(file_data);
                        var jmethod = new JSCore.String.with_utf8_c_string(method);
-                       JSCore.Value json_args = new JSCore.String.with_utf8_c_string(json);
+                       var json_args = new JSCore.String.with_utf8_c_string(json);
                        
                        JSCore.Value ex;
                        
@@ -159,7 +159,7 @@ namespace Palete {
                                throw new JavascriptError.MISSING_METHOD ("Plugin: not a method  %s", method);
                        }
                        JSCore.Value[] args = {};
-                       args += json_args;
+                       args += new JSCore.Value.string(ctx,json_args);
                         
                        var res = oval.call_as_function(ctx, othis, args, out ex);