dom/tests/mochitest/sessionstorage/file_http.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/sessionstorage/file_http.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +<html>
     1.5 +<head>
     1.6 +<script>
     1.7 +
     1.8 +window.addEventListener("message", onMessageReceived, false);
     1.9 +
    1.10 +function postMsg(msg)
    1.11 +{
    1.12 +  parent.postMessage(msg, "http://mochi.test:8888");
    1.13 +}
    1.14 +
    1.15 +function onMessageReceived(event)
    1.16 +{
    1.17 +  if (event.data == "check") {
    1.18 +    postMsg(sessionStorage.getItem("foo"));
    1.19 +
    1.20 +    var gotValue = "threw";
    1.21 +    try {
    1.22 +      gotValue = sessionStorage.getItem("foo-https");
    1.23 +    } catch (e) {
    1.24 +    }
    1.25 +
    1.26 +    postMsg(gotValue);
    1.27 +
    1.28 +    postMsg("the end");
    1.29 +  }
    1.30 +}
    1.31 +
    1.32 +function start()
    1.33 +{
    1.34 +  sessionStorage.setItem("foo", "insecure");
    1.35 +  postMsg(sessionStorage.getItem("foo"));
    1.36 +}
    1.37 +
    1.38 +</script>
    1.39 +</head>
    1.40 +<body onload="start();">
    1.41 +insecure
    1.42 +</body>
    1.43 +</html>

mercurial