| Index: third_party/WebKit/LayoutTests/http/tests/security/sandbox-iframe-blocks-top-navigation.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/security/sandbox-iframe-blocks-top-navigation.html b/third_party/WebKit/LayoutTests/http/tests/security/sandbox-iframe-blocks-top-navigation.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7248e8740204adece4fd2e1e6fbfbb9b9615f0e4
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/security/sandbox-iframe-blocks-top-navigation.html
|
| @@ -0,0 +1,23 @@
|
| +<!DOCTYPE html>
|
| +<script src="/resources/testharness.js"></script>
|
| +<script src="/resources/testharnessreport.js"></script>
|
| +<script>
|
| + async_test(t => {
|
| + window.addEventListener("message", t.step_func_done(e => {
|
| + assert_equals(e.data.name, 'SecurityError', 'Should throw a security error.');
|
| + assert_equals(e.data.location, 'about:srcdoc', 'Exception is same-origin with the embedee.');
|
| + }));
|
| + }, "Sandboxed frames should throw when navigating the top-level window.");
|
| +</script>
|
| +<iframe sandbox="allow-scripts"
|
| + srcdoc="<script>
|
| + try {
|
| + top.location = '/security/frameNavigation/resources/fail.html';
|
| + top.postMessage('No Exception', '*');
|
| + } catch (e) {
|
| + top.postMessage({
|
| + 'name': e.name,
|
| + 'location': e.constructor.constructor('return location.href')()
|
| + }, '*');
|
| + }
|
| + </script>"></iframe>
|
|
|