Skip to content

Commit

Permalink
IndexedDB: add WPT to verify factory behavior when doc not fully active
Browse files Browse the repository at this point in the history
WPT for w3c/IndexedDB#412

Bug: 1473972
Change-Id: I83ce4c771232cae663753a8e12ff5b959dc9f484
  • Loading branch information
Evan Stade authored and chromium-wpt-export-bot committed Aug 18, 2023
1 parent 29c8bd8 commit b9c0a17
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions IndexedDB/open-without-active-document.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!doctype html>
<title>indexedDB methods throw after document deactivation.</title>
<meta charset="utf8">
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/support-promises.js"></script>
<script>
'use strict';

promise_test(async testCase => {
await deleteAllDatabases(testCase);

let frame = document.createElement('iframe');
frame.src = location;
document.body.append(frame);
let frameIdb = frame.contentWindow.indexedDB;

let dbName = databaseName(testCase);
let req1 = frameIdb.open(dbName);
assert_not_equals(req1, null);
frame.remove();

let req2;
assert_throws_dom('FooError',
() => { req2 = frameIdb.open(dbName); },
'After document is inactive, open() should throw.');
assert_equals(req2, null);
}, 'Foo');

</script>

0 comments on commit b9c0a17

Please sign in to comment.