summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling.html
blob: 621a8cbaecc787f4549cb54a7ac223cf79eb0b74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!doctype html>
<meta charset=utf-8>
<title>Test that javascript: evaluation only performs a navigation to the
  result when the result is a string value.</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<iframe src="javascript:'1'"></iframe>
<iframe src="javascript:1"></iframe>
<iframe src="javascript:({ toString: function() { return '1'; } })"></iframe>
<iframe src="javascript:undefined"></iframe>
<iframe src="javascript:null"></iframe>
<iframe src="javascript:true"></iframe>
<iframe src="javascript:new String('1')"></iframe>
<script>
  var t = async_test();
  onload = t.step_func_done(function() {
    assert_equals(frames[0].document.documentElement.textContent,
                  "1", "string return should cause navigation");
    // The rest of the test is disabled for now, until
    //  https://github.com/whatwg/html/issues/1895 gets sorted out
/*
    assert_equals(frames[1].document.documentElement.textContent,
                  "", "number return should not cause navigation");
    assert_equals(frames[2].document.documentElement.textContent,
                  "", "object return should not cause navigation");
    assert_equals(frames[3].document.documentElement.textContent,
                  "", "undefined return should not cause navigation");
    assert_equals(frames[4].document.documentElement.textContent,
                  "", "null return should not cause navigation");
    assert_equals(frames[5].document.documentElement.textContent,
                  "", "null return should not cause navigation");
    assert_equals(frames[6].document.documentElement.textContent,
                  "", "String object return should not cause navigation");
*/
  });
</script>