RetroZilla/extensions/webservices/proxy/tests/iitest.html
2015-10-20 23:03:22 -04:00

106 lines
3.7 KiB
HTML

<script>
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var factory = new WebServiceProxyFactory();
const IDL_GENERATOR =
new Components.Constructor("@mozilla.org/interfaceinfotoidl;1",
"nsIInterfaceInfoToIDL");
const IInfo = new Components.Constructor("@mozilla.org/scriptableInterfaceInfo;1",
"nsIScriptableInterfaceInfo",
"init");
const IInfoNamed = new Components.Constructor("@mozilla.org/scriptableInterfaceInfo;1",
"nsIScriptableInterfaceInfo",
"initWithName");
var listener = {
onLoad : function(proxy) {
var name;
var ask = window.ask;
//alert("happy"); return;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var gen = new IDL_GENERATOR();
var IInfoNamedCtor = IInfoNamed;
// writing to our document whacks the preexisting stuff...
document.write("<pre>");
document.write("\n#include \"nsISupports.h\"\n\n");
document.write("// forward declarations...\n");
for(var name in proxy.interfaces) {
if(name == "nsISupports")
continue;
document.write("interface "+name+";\n");
}
document.write("\n");
var primary = proxy.primaryInterfaceName;
var primaryID = Components.ID(proxy.interfaces[primary].number);
var asyncListener = proxy.primaryAsyncListenerInterfaceName;
var asyncListenerID = Components.ID(proxy.interfaces[asyncListener].number);
document.write("//-------------------------------------\n");
document.write("// primary interface"+(proxy.isAsync ? " (async):":":"));
document.write(gen.generateIDL(primaryID, false, false));
if(proxy.isAsync) {
var asyncListener = proxy.primaryAsyncListenerInterfaceName;
var asyncListenerID = Components.ID(proxy.interfaces[asyncListener].number);
document.write("//-------------------------------------\n");
document.write("// asyncListener interface:");
document.write(gen.generateIDL(asyncListenerID, false, false));
}
for(var name in proxy.interfaces) {
var id = proxy.interfaces[name];
if(name == primary || (proxy.isAsync && name == asyncListener))
continue;
if(proxy.qualifier && 0 != id.name.indexOf(proxy.qualifier))
continue;
if(0 == id.name.indexOf("nsI"))
continue;
document.write("//-------------------------------------");
document.write(gen.generateIDL(Components.ID(id.number), false, false));
}
document.write("</pre>");
document.close();
},
onError : function(e) {
// alert("sad"); return;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
// writing to our document whacks the preexisting stuff...
document.write("<pre>");
document.write("error: "+e);
document.close();
}
};
const ISPRIMEURL = "http://green.nscp.aoltw.net/vidur/wsdl/statistics.wsdl";
//const ISPRIMEURL = "http://bugsfree.nscp.aoltw.net/pub/statistics.wsdl";
//const ISPRIMEURL = "http://bugsfree.nscp.aoltw.net/pub/statistics2.wsdl";
//const ISPRIMEURL = "http://213.23.125.181:8080/statistics.wsdl";
const ISPRIMEPORT = "SpheonJSAOPStatisticsPort";
factory.createProxyAsync(ISPRIMEURL, ISPRIMEPORT, "foo", true, listener);
//factory.createProxyAsync(ISPRIMEURL, ISPRIMEPORT, "foo", false, listener);
</script>