dom/tests/mochitest/storageevent/interOriginFrame.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 function postMsg(message)
     2 {
     3   var l = SpecialPowers.wrap(parent.window.location);
     4   parent.postMessage(message, l.protocol + "//" + l.host);
     5 }
     7 window.addEventListener("message", onMessageReceived, false);
     9 function onMessageReceived(event)
    10 {
    11   if (event.data == "step") {
    12     var performed = false;
    13     try {
    14       performed = doStep();
    15     }
    16     catch (ex) {
    17       postMsg("FAILURE: exception threw at "+ location +":\n" + ex);
    18       finishTest();
    19     }
    21     if (performed)
    22       postMsg("perf");
    24     return;
    25   }
    27   if (parent)
    28     postMsg(event.data);
    29 }
    31 function ok(a, message)
    32 {
    33   if (!a)
    34     postMsg("FAILURE: " + message);
    35   else
    36     postMsg(message);
    37 }
    39 function is(a, b, message)
    40 {
    41   if (a != b)
    42     postMsg("FAILURE: " + message + ", expected "+b+" got "+a);
    43   else
    44     postMsg(message + ", expected "+b+" got "+a);
    45 }
    47 function todo(a, b, message)
    48 {
    49   postMsg("TODO: " + message + ", expected "+b+" got "+a);
    50 }
    52 function finishTest()
    53 {
    54   postMsg("done");
    55   return false;
    56 }

mercurial