dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.5 +<head>
     1.6 +<title>slave for storage event propagation</title>
     1.7 +
     1.8 +<script type="text/javascript" src="interOriginFrame.js"></script>
     1.9 +<script type="text/javascript">
    1.10 +
    1.11 +var currentStep = 2;
    1.12 +
    1.13 +var events = [];
    1.14 +
    1.15 +window.addEventListener("storage", function(event)
    1.16 +{
    1.17 +  events.push(event);
    1.18 +}, false);
    1.19 +
    1.20 +function doStep()
    1.21 +{
    1.22 +  function checkEvent(expectedKey, expectedOldValue, expectedNewValue)
    1.23 +  {
    1.24 +    var event = events.shift();
    1.25 +    is(event.key, expectedKey, "key name check");
    1.26 +    is(event.oldValue, expectedOldValue, "old value check");
    1.27 +    is(event.newValue, expectedNewValue, "new value check");
    1.28 +    is(event.url, "http://example.com/tests/dom/tests/mochitest/storageevent/frameLocalStorageMaster.html");
    1.29 +    ok(event.storageArea);
    1.30 +  }
    1.31 +
    1.32 +  switch (currentStep)
    1.33 +  {
    1.34 +    case 10:
    1.35 +      is(events.length, 5, "Expected 5 events");
    1.36 +      checkEvent("X", null, "1");
    1.37 +      checkEvent("X", "1", "2");
    1.38 +      checkEvent("X", "2", null);
    1.39 +      checkEvent("X", null, "2");
    1.40 +      checkEvent(null, null, null);
    1.41 +      break;
    1.42 +  }
    1.43 +
    1.44 +  // Increase by two to distinguish each test step order
    1.45 +  // in both master doStep and slave doStep functions.
    1.46 +  ++currentStep;
    1.47 +  ++currentStep;
    1.48 +
    1.49 +  return true;
    1.50 +}
    1.51 +
    1.52 +</script>
    1.53 +
    1.54 +</head>
    1.55 +
    1.56 +<body onload="postMsg('frame loaded');">
    1.57 +</body>
    1.58 +</html>

mercurial