Import from 1.9a8 tarball
[mozilla-extra.git] / extensions / webservices / proxy / tests / primeproxytest.html
blob864dc57c325a1fe11f8665c7feb7eeb8a5034345
1 <script>
3 var factory = new WebServiceProxyFactory();
4 var lastNumber = 0;
6 var listener = {
7 onLoad : function(proxy) {
8 window.proxy = proxy;
9 ask();
11 onError : function(e) {
12 alert("error: "+e);
16 function ask() {
18 var talkToMe = {
19 isPrimeNumberCallback : function(isPrime, cx) {
20 // just a stupid test of the (ignorable) callcontext...
21 if(cx.methodName != "isPrimeNumber")
22 alert("I'm very confused");
24 lastNumber = number;
25 lastAnswer = isPrime;
26 ask();
28 onError : function(e, cx) {
29 alert("error: "+e);
33 var str = "";
34 if(lastNumber) {
35 str = ""+lastNumber+ (lastAnswer ? " is prime" : " is not prime")+"\n\n";
37 str += "Enter number (0 to quit)";
39 var number = prompt(str, "");
41 number = parseInt(number, 10);
42 if(number && !isNaN(number)) {
43 try {
44 netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
45 talkToMe.number = number;
46 proxy.setListener(talkToMe);
47 proxy.isPrimeNumber(number);
48 } catch(e) {
49 alert("error: "+e);
56 const ISPRIMEURL = "http://green.nscp.aoltw.net/vidur/wsdl/statistics.wsdl";
57 //const ISPRIMEURL = "http://bugsfree.nscp.aoltw.net/pub/statistics.wsdl";
58 //const ISPRIMEURL = "http://bugsfree.nscp.aoltw.net/pub/statistics2.wsdl";
59 //const ISPRIMEURL = "http://213.23.125.181:8080/statistics.wsdl";
61 const ISPRIMEPORT = "SpheonJSAOPStatisticsPort";
63 factory.createProxyAsync(ISPRIMEURL, ISPRIMEPORT, "foo", true, listener);
64 //factory.createProxyAsync(ISPRIMEURL, ISPRIMEPORT, "foo", false, listener);
65 </script>