rt/vm/src/main/java/org/apidesign/vm4brwsr/Zips.java
changeset 1375 a6c71e376889
parent 1358 65dd5a650eab
child 1387 350f8aee0f60
     1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/Zips.java	Wed Oct 09 17:59:11 2013 +0200
     1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/Zips.java	Sun Oct 20 20:36:03 2013 +0200
     1.3 @@ -49,7 +49,7 @@
     1.4      @JavaScriptBody(args = { "arr", "index", "value" }, body = "arr[index] = value; return value;")
     1.5      private static native Object set(Object arr, int index, Object value);
     1.6      
     1.7 -    public static byte[] loadFromCp(Object classpath, String res) 
     1.8 +    public static byte[] loadFromCp(Object classpath, String res, int skip) 
     1.9      throws IOException, ClassNotFoundException {
    1.10          for (int i = 0; i < length(classpath); i++) {
    1.11              Object c = at(classpath, i);
    1.12 @@ -75,9 +75,10 @@
    1.13                  if (c instanceof Zips) {
    1.14                      checkRes = ((Zips)c).findRes(res);
    1.15                  } else {
    1.16 -                    checkRes = callFunction(c, res);
    1.17 +                    checkRes = callFunction(c, res, skip);
    1.18 +                    skip = 0;
    1.19                  }
    1.20 -                if (checkRes != null) {
    1.21 +                if (checkRes != null && --skip < 0) {
    1.22                      return checkRes;
    1.23                  }
    1.24              }
    1.25 @@ -85,11 +86,11 @@
    1.26          return null;
    1.27      }
    1.28      
    1.29 -    @JavaScriptBody(args = { "fn", "res" }, body = 
    1.30 -        "if (typeof fn === 'function') return fn(res);\n"
    1.31 +    @JavaScriptBody(args = { "fn", "res", "skip" }, body = 
    1.32 +        "if (typeof fn === 'function') return fn(res, skip);\n"
    1.33        + "return null;"
    1.34      )
    1.35 -    private static native byte[] callFunction(Object fn, String res);
    1.36 +    private static native byte[] callFunction(Object fn, String res, int skip);
    1.37      
    1.38      @JavaScriptBody(args = { "msg" }, body = "if (typeof console !== 'undefined') console.log(msg.toString());")
    1.39      private static native void log(String msg);