summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/storage-access-api/requestStorageAccess-non-fully-active.sub.https.window.js
blob: b3aa19c25c0f097f9eacc9922634867c52a7b04e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// META: script=helpers.js
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
'use strict';

promise_test(t => {
  const promise = RunRequestStorageAccessInDetachedFrame();
  const description = "document.requestStorageAccess() call in a detached frame";
  // Can't use `promise_rejects_dom` here, since the error comes from the wrong global.
  return promise.then(t.unreached_func("Should have rejected: " + description), (e) => {
    assert_equals(e.name, 'InvalidStateError', description);
  });
}, "[non-fully-active] document.requestStorageAccess() should not resolve when run in a detached frame");

promise_test(t => {
  return promise_rejects_dom(t, 'InvalidStateError', RunRequestStorageAccessViaDomParser(),
   "document.requestStorageAccess() in a detached DOMParser result");
}, "[non-fully-active] document.requestStorageAccess() should not resolve when run in a detached DOMParser document");