| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <title>[Browsing Context] : [APIs for creating browsing_contexts by name]</title> |
| <link rel="author" title="Duhyeong Kim" href="mailto:dduskim@gmail.com"> |
| <link rel="help" href="https://html.spec.whatwg.org/multipage/#apis-for-creating-and-navigating-browsing-contexts-by-name"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <div id="log"></div> |
| <script> |
| async_test(function() { |
| var currentUrl = 'http://' + window.location.host + '/'; |
| var win = window.open(currentUrl, '', 'height=1,width=1'); |
| this.add_cleanup(function() { win.close(); }); |
| win.onload = this.step_func_done(function () { |
| assert_equals(win.location.href, currentUrl, 'should be equal to result url'); |
| }); |
| }, 'first argument: absolute url'); |
| |
| test(function() { |
| var win = window.open('', '', 'height=1,width=1'); |
| this.add_cleanup(function() { win.close(); }); |
| assert_equals(win.location.href, 'about:blank', 'win.location.href'); |
| }, 'first argument: empty url'); |
| |
| test(function () { |
| var win = window.open('', 'testWindow', 'height=1,width=1'); |
| win.close(); |
| assert_equals(win.name, 'testWindow', 'should have a browsing context name'); |
| }, 'second argument: passing a non-empty name'); |
| |
| test(function () { |
| var win = window.open('', '', 'height=1,width=1'); |
| this.add_cleanup(function() { win.close(); }); |
| assert_equals(win.name, '', 'window should not have a name'); |
| win.name = 'testWindow'; |
| assert_equals(win.name, 'testWindow', 'window should have a name'); |
| }, 'second argument: setting name after opening'); |
| </script> |