mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
9b5dc10c32
--HG-- rename : js/src/ipc/CPOWTypes.h => js/ipc/CPOWTypes.h rename : js/src/ipc/ContextWrapperChild.h => js/ipc/ContextWrapperChild.h rename : js/src/ipc/ContextWrapperParent.h => js/ipc/ContextWrapperParent.h rename : js/src/ipc/Makefile.in => js/ipc/Makefile.in rename : js/src/ipc/ObjectWrapperChild.cpp => js/ipc/ObjectWrapperChild.cpp rename : js/src/ipc/ObjectWrapperChild.h => js/ipc/ObjectWrapperChild.h rename : js/src/ipc/ObjectWrapperParent.cpp => js/ipc/ObjectWrapperParent.cpp rename : js/src/ipc/ObjectWrapperParent.h => js/ipc/ObjectWrapperParent.h rename : js/src/ipc/PContextWrapper.ipdl => js/ipc/PContextWrapper.ipdl rename : js/src/ipc/PObjectWrapper.ipdl => js/ipc/PObjectWrapper.ipdl rename : js/src/ipc/ipdl.mk => js/ipc/ipdl.mk rename : js/src/ipc/jar.mn => js/ipc/jar.mn rename : js/src/ipc/tests/Makefile.in => js/ipc/tests/Makefile.in rename : js/src/ipc/tests/adhoc/child.html => js/ipc/tests/adhoc/child.html rename : js/src/ipc/tests/adhoc/test.xul => js/ipc/tests/adhoc/test.xul rename : js/src/ipc/tests/unit/cpow_child.js => js/ipc/tests/unit/cpow_child.js rename : js/src/ipc/tests/unit/test_cpow.js => js/ipc/tests/unit/test_cpow.js
104 lines
3.0 KiB
XML
104 lines
3.0 KiB
XML
<?xml version="1.0"?>
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
width="800" height="600" orient="vertical">
|
|
|
|
<script type="application/javascript">
|
|
|
|
var cpow_tests = {
|
|
resolve: function(obj, keys) {
|
|
alert("resolving");
|
|
keys = keys.split(" ");
|
|
for (var i = 0; i != keys.length; ++i)
|
|
alert("has " + keys[i] + "? " + (keys[i] in obj));
|
|
alert("done resolving");
|
|
},
|
|
iterate: function(obj) {
|
|
alert("iterating");
|
|
for (var k in obj)
|
|
alert("key: " + k);
|
|
alert("done iterating");
|
|
},
|
|
navigate: function(child) {
|
|
alert("navigating");
|
|
child.location = prompt("Where to?");
|
|
setTimeout(function() {
|
|
alert(child.location.href);
|
|
}, 2000);
|
|
},
|
|
construct: function(foo) {
|
|
alert(new foo.ctor("answer", 42).answer);
|
|
alert(new foo.fakector("answer", 42).answer);
|
|
},
|
|
indirect_eval: function(child) {
|
|
alert(child.eval("location.href"));
|
|
alert(new child.Function("x", "return x+1")(42));
|
|
},
|
|
funcalls: function(foo) {
|
|
var fn = foo.f;
|
|
alert(foo.f(2));
|
|
alert(fn.call.call(fn, foo, 3));
|
|
},
|
|
equality: function(child) {
|
|
var foo = child.foo,
|
|
self = foo.self;
|
|
alert("foo == self? " + (foo == self));
|
|
alert("foo === self? " + (foo === self));
|
|
},
|
|
exceptions: function(child) {
|
|
var ball = "ball";
|
|
try {
|
|
child.foo.pitch(ball);
|
|
alert("shouldn't reach this point");
|
|
} catch (x) {
|
|
alert("ball === x? " + (ball === x));
|
|
}
|
|
}
|
|
}
|
|
|
|
function getCPOW() {
|
|
if (!getCPOW.cpow) {
|
|
var page = document.getElementById("page"),
|
|
owner = page.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
|
|
getCPOW.cpow = owner.crossProcessObjectWrapper;
|
|
alert("got fresh CPOW");
|
|
}
|
|
return getCPOW.cpow;
|
|
}
|
|
|
|
function test_cpow() {
|
|
var child = getCPOW();
|
|
cpow_tests.construct(child.foo);
|
|
cpow_tests.resolve(child.location, "href hostname");
|
|
cpow_tests.iterate(child.location);
|
|
cpow_tests.iterate(child.foo);
|
|
cpow_tests.funcalls(child.foo);
|
|
cpow_tests.navigate(child);
|
|
cpow_tests.equality(child);
|
|
cpow_tests.exceptions(child);
|
|
setTimeout(function() {
|
|
alert("going back");
|
|
child.history.back();
|
|
}, 3000);
|
|
}
|
|
|
|
function show_location() {
|
|
var child = getCPOW();
|
|
child.location += "#fragment";
|
|
alert(child.location.href);
|
|
alert(child.document.documentURI);
|
|
}
|
|
</script>
|
|
|
|
<toolbar id="controls">
|
|
<toolbarbutton onclick="test_cpow()" label="Run tests."/>
|
|
<toolbarbutton onclick="show_location()" label="Show location."/>
|
|
</toolbar>
|
|
|
|
<browser remote="true" width="200" height="200"
|
|
type="content"
|
|
src="child.html"
|
|
id="page" />
|
|
|
|
</window>
|