Bug 1526405 [wpt PR 15173] - Test that the HTMLPortalElement/activate promise is rejected if detached., a=testonly
authorJeremy Roman <jbroman@chromium.org>
Tue, 12 Feb 2019 14:08:21 +0000
changeset 459248 db8d4d86141b3ea9d2c41a9911c92c474a0645b5
parent 459247 3475e4caac77437f16b92461383d7d312c8de4f9
child 459249 22dec3239fde52948b03b4bf7e7dab3eb825d910
push id35557
push userdvarga@mozilla.com
push dateFri, 15 Feb 2019 01:42:08 +0000
treeherdermozilla-central@426ca85d2303 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1526405, 15173, 916310, 1447030, 627932
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1526405 [wpt PR 15173] - Test that the HTMLPortalElement/activate promise is rejected if detached., a=testonly Automatic update from web-platform-tests 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} -- wpt-commits: 3e0d3a34b6c854d0c76633d178591fa72c3b780d wpt-pr: 15173
testing/web-platform/tests/portals/portals-activate-no-browsing-context.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/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>