commit | 3e0d3a34b6c854d0c76633d178591fa72c3b780d | [log] [tgz] |
---|---|---|
author | Jeremy Roman <jbroman@chromium.org> | Thu Jan 31 14:07:01 2019 |
committer | Blink WPT Bot <blink-w3c-test-autoroller@chromium.org> | Thu Jan 31 14:19:21 2019 |
tree | 8899de34032ca5a596d8fe8ba31276454f648a14 | |
parent | 7fb15bfac1e7380aa74176886120edab9afb5d02 [diff] |
Test that the HTMLPortalElement/activate promise is rejected if detached. The simplest way to achieve this is to just make a portal and try to activate it straight away. This code was previously unreachable in our tests: https://analysis.chromium.org/p/chromium/coverage/file?host=chromium.googlesource.com&project=chromium/src&ref=refs/heads/master&revision=f3878c07b1c5501e27ea0964d8a0ba0196cf7680&path=//third_party/blink/renderer/core/html/portal/html_portal_element.cc Bug: 916310 Change-Id: I20cc6cbfb242e5466df6ffbbe0e30c065d6806ee Reviewed-on: https://chromium-review.googlesource.com/c/1447030 Reviewed-by: Adithya Srinivasan <adithyas@chromium.org> Commit-Queue: Jeremy Roman <jbroman@chromium.org> Cr-Commit-Position: refs/heads/master@{#627932}
diff --git a/portals/portals-activate-no-browsing-context.html b/portals/portals-activate-no-browsing-context.html new file mode 100644 index 0000000..9a822e9 --- /dev/null +++ b/portals/portals-activate-no-browsing-context.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +promise_test(async () => { + let activatePromise = document.createElement('portal').activate(); + await activatePromise.then(() => assert_unreached(), e => { + assert_true(e instanceof DOMException); + assert_equals(e.name, 'InvalidStateError'); + }); +}, "A portal with nothing in it cannot be activated"); +</script>