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

promise_test(t => {
  const promise = CreateDetachedFrame().requestStorageAccess();
  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);
    t.done();
  });
}, "[non-fully-active] document.requestStorageAccess() should not resolve when run in a detached frame");

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