1 // Try calling the browser-side bound functions with varying (invalid) 2 // inputs. There is no notion of "success" for this test, other than 3 // verifying the correct C++ bindings were reached with expected values. 4 5 function MyObject() { 6 this.x = "3"; 7 } 8 9 MyObject.prototype.toString = function() { 10 throw "exception from calling toString()"; 11 } 12 13 function FindProxyForURL(url, host) { 14 // Call dnsResolve with some wonky arguments. 15 dnsResolve(); 16 dnsResolve(null); 17 dnsResolve(undefined); 18 dnsResolve(""); 19 dnsResolve({foo: 'bar'}); 20 dnsResolve(fn); 21 dnsResolve(['3']); 22 dnsResolve("arg1", "arg2", "arg3", "arg4"); 23 24 // Call alert with some wonky arguments. 25 alert(); 26 alert(null); 27 alert(undefined); 28 alert({foo:'bar'}); 29 30 // This should throw an exception when we toString() the argument 31 // to alert in the bindings. 32 try { 33 alert(new MyObject()); 34 } catch (e) { 35 alert(e); 36 } 37 38 // Call myIpAddress() with wonky arguments 39 myIpAddress(null); 40 myIpAddress(null, null); 41 42 // Call myIpAddressEx() correctly (no arguments). 43 myIpAddressEx(); 44 45 // Call dnsResolveEx() (note that isResolvableEx() implicity calls it.) 46 isResolvableEx("is_resolvable"); 47 dnsResolveEx("foobar"); 48 49 return "DIRECT"; 50 } 51 52 function fn() {} 53 54