Bug 1071177 - Test

This commit is contained in:
Tom Schuster 2014-10-07 11:29:03 +02:00
parent 5601d3a0c1
commit 38d0b6e5f6
2 changed files with 23 additions and 0 deletions

View File

@ -115,6 +115,21 @@ function xray_test()
sendSyncMessage("cpows:xray_test", {}, {element: element});
}
function symbol_test()
{
let iterator = Symbol.iterator;
let named = Symbol.for("cpow-test");
// let unique = Symbol();
let object = {
[iterator]: iterator,
[named]: named,
// [unique]: unique,
// "unique": unique
};
sendSyncMessage("cpows:symbol_test", {}, object);
}
// Parent->Child references should go X->parent.privilegedJunkScope->child.privilegedJunkScope->Y
// Child->Parent references should go X->child.privilegedJunkScope->parent.unprivilegedJunkScope->Y
function compartment_test()

View File

@ -205,6 +205,13 @@
is(element.foo, undefined, "DOM element does not expose content properties");
}
function recvSymbolTest(message) {
let object = message.objects;
is(object[Symbol.iterator], Symbol.iterator, "Should use Symbol.iterator");
is(Symbol.keyFor(object[Symbol.for("cpow-test")]), "cpow-test", "Symbols aren't registered correctly");
// is(object.unique, object[object.unique], "Unique symbols as ids and values don't seem to work");
}
let systemGlobal = this;
function recvCompartmentTest(message) {
let getUnprivilegedObject = message.objects.getUnprivilegedObject;
@ -300,6 +307,7 @@
mm.addMessageListener("cpows:dom_test", recvDomTest);
mm.addMessageListener("cpows:dom_test_after_gc", recvDomTestAfterGC);
mm.addMessageListener("cpows:xray_test", recvXrayTest);
mm.addMessageListener("cpows:symbol_test", recvSymbolTest);
mm.addMessageListener("cpows:compartment_test", recvCompartmentTest);
mm.addMessageListener("cpows:regexp_test", recvRegExpTest);
mm.addMessageListener("cpows:lifetime_test_1", recvLifetimeTest1);