Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / clone-exception.html
blobe649701b073e935b9b713aa9de1c2efeee7c085a
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <script src="resources/shared.js"></script>
4 <script>
6 description("Ensure DataCloneError is consistently thrown by IndexedDB methods");
8 var NON_CLONEABLE = self;
9 var INVALID_KEY = {};
11 setDBNameFromPath();
12 waitForRequests([
13 indexedDB.deleteDatabase(dbname + '1'),
14 indexedDB.deleteDatabase(dbname + '2'),
15 indexedDB.deleteDatabase(dbname + '3')
16 ], doFirstOpen);
18 function doFirstOpen()
20 preamble();
21 request = evalAndLog("indexedDB.open(dbname + '1')");
22 request.onupgradeneeded = function onUpgradeNeeded(e) {
23 preamble();
24 db = e.target.result;
25 evalAndExpectException("db.createObjectStore('store').put(NON_CLONEABLE, 0);", "25", "'DataCloneError'");
26 doSecondOpen();
30 function doSecondOpen()
32 preamble();
33 request = evalAndLog("indexedDB.open(dbname + '2')");
34 request.onupgradeneeded = function onUpgradeNeeded(e) {
35 preamble();
36 db = e.target.result;
37 evalAndExpectException("db.createObjectStore('store').put(NON_CLONEABLE, 0);", "25", "'DataCloneError'");
38 doThirdOpen();
42 function doThirdOpen()
44 preamble();
45 request = evalAndLog("indexedDB.open(dbname + '3')");
46 request.onupgradeneeded = function onUpgradeNeeded(e) {
47 preamble();
48 db = e.target.result;
49 evalAndExpectException("db.createObjectStore('store').put(NON_CLONEABLE, INVALID_KEY);", "25", "'DataCloneError'");
50 finishJSTest();
54 </script>