2003/08/14 05:16:08
[org.ibex.core.git] / src / org / xwt / Proxy.java
index 6067464..def26ca 100644 (file)
@@ -114,22 +114,22 @@ public class Proxy {
                 if (Log.on) Log.log(Proxy.class, script);
             }
 
-           JS.Callable scr = JS.parse("PAC script at " + url, 0, new StringReader(script), proxyAutoConfigRootScope);
-            scr.call(new org.xwt.js.Array());
+            JS.CompiledFunction scr = JS.parse("PAC script at " + url, 0, new StringReader(script));
+            scr.call(new JS.Array(), proxyAutoConfigRootScope);
             return (JS.Callable)proxyAutoConfigRootScope.get("FindProxyForURL");
         } catch (Exception e) {
             if (Log.on) {
                 Log.log(Platform.class, "WPAD detection failed due to:");
                 if (e instanceof JS.Exn) {
-                   try {
-                       org.xwt.js.Array arr = new org.xwt.js.Array();
-                       arr.addElement(((JS.Exn)e).getObject());
-                       // FIXME
-                       //XWT.recursivePrintObject.call();
-                   } catch (Exception e2) {
-                       Log.log(Platform.class, e);
-                   }
-               }
+                    try {
+                        org.xwt.js.JS.Array arr = new org.xwt.js.JS.Array();
+                        arr.addElement(((JS.Exn)e).getObject());
+                        // FIXME
+                        //XWT.recursivePrintObject.call();
+                    } catch (Exception e2) {
+                        Log.log(Platform.class, e);
+                    }
+                }
                 else Log.log(Platform.class, e);
             }
             return null;
@@ -155,7 +155,8 @@ public class Proxy {
             if (Log.on) Log.log(Authorization.class, "displaying proxy authorization dialog");
             MessageQueue.add(new Message() {
                     public void perform() {
-                        Box b = new Box("org.xwt.builtin.proxy_authorization", null);
+                        Box b = new Box();
+                        Template.getTemplate("org.xwt.builtin.proxy_authorization", null).apply(b, null, null, null, 0, 0);
                         b.put("realm", realm);
                         b.put("proxyIP", proxyIP);
                     }
@@ -172,9 +173,9 @@ public class Proxy {
 
     public static class ProxyAutoConfigRootScope extends JS.Scope {
 
-       public ProxyAutoConfigRootScope() { super(null); }
+        public ProxyAutoConfigRootScope() { super(null); }
         
-       // FIXME: needs "standard objects"
+        // FIXME: needs "standard objects"
 
         public Object get(Object name) {
             if (name.equals("isPlainHostName")) return isPlainHostName;
@@ -202,19 +203,19 @@ public class Proxy {
             };
         
         private static final JS.Callable isPlainHostName = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     return (args.elementAt(0).toString().indexOf('.') == -1) ? Boolean.TRUE : Boolean.FALSE;
                 }
             };
         
         private static final JS.Callable dnsDomainIs = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     return (args.elementAt(0).toString().endsWith(args.elementAt(1).toString())) ? Boolean.TRUE : Boolean.FALSE;
                 }
             };
         
         private static final JS.Callable localHostOrDomainIs = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     return (args.elementAt(0).toString().equals(args.elementAt(1).toString()) || 
                             (args.elementAt(0).toString().indexOf('.') == -1 && args.elementAt(1).toString().startsWith(args.elementAt(0).toString()))) ?
                         Boolean.TRUE : Boolean.FALSE;
@@ -222,7 +223,7 @@ public class Proxy {
             };
         
         private static final JS.Callable isResolvable = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     try {
                         return (InetAddress.getByName(args.elementAt(0).toString()) != null) ? Boolean.TRUE : Boolean.FALSE;
                     } catch (UnknownHostException e) {
@@ -232,7 +233,7 @@ public class Proxy {
             };
         
         private static final JS.Callable isInNet = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     if (args.length() != 3) return Boolean.FALSE;
                     try {
                         byte[] host = InetAddress.getByName(args.elementAt(0).toString()).getAddress();
@@ -250,7 +251,7 @@ public class Proxy {
             };
         
         private static final JS.Callable dnsResolve = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     try {
                         return InetAddress.getByName(args.elementAt(0).toString()).getHostAddress();
                     } catch (UnknownHostException e) {
@@ -260,7 +261,7 @@ public class Proxy {
             };
         
         private static final JS.Callable myIpAddress = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     try {
                         return InetAddress.getLocalHost().getHostAddress();
                     } catch (UnknownHostException e) {
@@ -271,7 +272,7 @@ public class Proxy {
             };
         
         private static final JS.Callable dnsDomainLevels = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     String s = args.elementAt(0).toString();
                     int i = 0;
                     while((i = s.indexOf('.', i)) != -1) i++;
@@ -289,7 +290,7 @@ public class Proxy {
         }
         
         private static final JS.Callable shExpMatch = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     StringTokenizer st = new StringTokenizer(args.elementAt(1).toString(), "*", false);
                     String[] arr = new String[st.countTokens()];
                     String s = args.elementAt(0).toString();
@@ -301,7 +302,7 @@ public class Proxy {
         public static String[] days = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
         
         private static final JS.Callable weekdayRange = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     TimeZone tz = (args.length() < 3 || args.elementAt(2) == null || !args.elementAt(2).equals("GMT")) ? TimeZone.getTimeZone("UTC") : TimeZone.getDefault();
                     Calendar c = new GregorianCalendar();
                     c.setTimeZone(tz);
@@ -327,13 +328,13 @@ public class Proxy {
             };
         
         private static final JS.Callable dateRange = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     throw new JS.Exn("XWT does not support dateRange() in PAC scripts");
                 }
             };
         
         private static final JS.Callable timeRange = new JS.Callable() {
-                public Object call(org.xwt.js.Array args) throws JS.Exn {
+                public Object call(org.xwt.js.JS.Array args) throws JS.Exn {
                     throw new JS.Exn("XWT does not support timeRange() in PAC scripts");
                 }
             };