Bug 1101769 - Tests. r=billm
authorBobby Holley <bobbyholley@gmail.com>
Sun, 23 Nov 2014 15:23:22 -0800
changeset 217023 90d9478a29e25c3c77874c2a07a683764c905fd6
parent 217022 f456607aaa4c1dd4c842c4935fd9f5b12ec62f75
child 217024 e3601055862f52c106c1b891694cfffe27b83dd8
push id52205
push userbobbyholley@gmail.com
push dateSun, 23 Nov 2014 23:23:46 +0000
treeherdermozilla-inbound@90d9478a29e2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1101769
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1101769 - Tests. r=billm
dom/base/test/chrome/cpows_child.js
dom/base/test/chrome/cpows_parent.xul
--- a/dom/base/test/chrome/cpows_child.js
+++ b/dom/base/test/chrome/cpows_child.js
@@ -12,16 +12,17 @@ var is_remote;
     error_reporting_test();
     dom_test();
     xray_test();
     if (typeof Symbol === "function") {
       symbol_test();
     }
     compartment_test();
     regexp_test();
+    postmessage_test();
     sync_test();
     async_test();
     rpc_test();
     nested_sync_test();
     // The sync-ness of this call is important, because otherwise
     // we tear down the child's document while we are
     // still in the async test in the parent.
     // This test races with itself to be the final test.
@@ -174,16 +175,21 @@ function compartment_test()
                                                   testParentObject: testParentObject });
 }
 
 function regexp_test()
 {
   sendSyncMessage("cpows:regexp_test", {}, { regexp: /myRegExp/g });
 }
 
+function postmessage_test()
+{
+  sendSyncMessage("cpows:postmessage_test", {}, { win: content.window });
+}
+
 function sync_test()
 {
   dump('beginning cpow sync test\n');
   sync_obj = make_object();
   sendSyncMessage("cpows:sync",
     make_json(),
     make_object());
 }
--- a/dom/base/test/chrome/cpows_parent.xul
+++ b/dom/base/test/chrome/cpows_parent.xul
@@ -265,16 +265,22 @@
 
       // These go over regexp_toShared.
       is("filler myRegExp filler".search(regexp), 7, "String.prototype.match works right");
       var shell = /x/;
       shell.compile(regexp);
       is(regexp.toString(), shell.toString(), ".compile works right");
     }
 
+    function recvPostMessageTest(message) {
+      let win = message.objects.win;
+      win.postMessage('nookery', '*');
+      ok(true, "Didn't crash invoking postMessage over CPOW");
+    }
+
     let savedWilldieObj;
     let wontDie = {f:2, __exposedProps__: {"f": "r"}};
     function recvLifetimeTest1(message) {
       let obj = message.objects.obj;
       savedWilldieObj = obj.will_die;
       ok(savedWilldieObj.f == 1, "limited-lifetime CPOW works at first");
       obj.wont_die = wontDie;
       obj = null;
@@ -322,16 +328,17 @@
       mm.addMessageListener("cpows:dom_test", recvDomTest);
       mm.addMessageListener("cpows:dom_test_after_gc", recvDomTestAfterGC);
       mm.addMessageListener("cpows:xray_test", recvXrayTest);
       if (typeof Symbol === "function") {
         mm.addMessageListener("cpows:symbol_test", recvSymbolTest);
       }
       mm.addMessageListener("cpows:compartment_test", recvCompartmentTest);
       mm.addMessageListener("cpows:regexp_test", recvRegExpTest);
+      mm.addMessageListener("cpows:postmessage_test", recvPostMessageTest);
       mm.addMessageListener("cpows:lifetime_test_1", recvLifetimeTest1);
       mm.addMessageListener("cpows:lifetime_test_2", recvLifetimeTest2);
       mm.loadFrameScript("chrome://mochitests/content/chrome/dom/base/test/chrome/cpows_child.js", true);
     }
 
     function start() {
       run_tests('remote');
     }