docshell/test/test_bug634834.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/test/test_bug634834.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=634834
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 634834</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=634834">Mozilla Bug 634834</a>
    1.17 +
    1.18 +<script type='application/javascript;version=1.7'>
    1.19 +SimpleTest.waitForExplicitFinish();
    1.20 +
    1.21 +function iframe_loaded() {
    1.22 +  var loadedAfterPushstate = false;
    1.23 +  $('iframe').onload = function() {
    1.24 +    loadedAfterPushstate = true;
    1.25 +  }
    1.26 +
    1.27 +  var obj = { name: 'name' };
    1.28 +  obj.__defineGetter__('a', function() {
    1.29 +    $('iframe').contentWindow.location = 'http://example.com';
    1.30 +
    1.31 +    // Wait until we've loaded example.com.
    1.32 +    do {
    1.33 +        var r = new XMLHttpRequest();
    1.34 +        r.open("GET", location.href, false);
    1.35 +        r.overrideMimeType("text/plain");
    1.36 +        try { r.send(null); }
    1.37 +        catch (e) {}
    1.38 +    } while (!loadedAfterPushstate);
    1.39 +  });
    1.40 +
    1.41 +  try {
    1.42 +    $('iframe').contentWindow.history.pushState(obj, '');
    1.43 +    ok(false, 'pushState should throw exception.');
    1.44 +  }
    1.45 +  catch(e) {
    1.46 +    ok(true, 'pushState threw an exception.');
    1.47 +  }
    1.48 +  SimpleTest.finish();
    1.49 +}
    1.50 +
    1.51 +</script>
    1.52 +
    1.53 +<iframe id='iframe' src='file_bug634834.html' onload='iframe_loaded()'></iframe>
    1.54 +
    1.55 +</body>
    1.56 +</html>

mercurial