dom/indexedDB/test/unit/test_invalid_version.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:59464c5cefc7
1 /**
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
4 */
5
6 var testGenerator = testSteps();
7
8 function testSteps()
9 {
10 const name = this.window ? window.location.pathname : "Splendid Test";
11
12 try {
13 indexedDB.open(name, 0);
14 ok(false, "Should have thrown!");
15 }
16 catch (e) {
17 ok(e instanceof TypeError, "Got TypeError.");
18 is(e.name, "TypeError", "Good error name.");
19 }
20
21 try {
22 indexedDB.open(name, -1);
23 ok(false, "Should have thrown!");
24 }
25 catch (e) {
26 ok(e instanceof TypeError, "Got TypeError.");
27 is(e.name, "TypeError", "Good error name.");
28 }
29
30 try {
31 indexedDB.open(name, { version: 0 });
32 ok(false, "Should have thrown!");
33 }
34 catch (e) {
35 ok(e instanceof TypeError, "Got TypeError.");
36 is(e.name, "TypeError", "Good error name.");
37 }
38
39 try {
40 indexedDB.open(name, { version: -1 });
41 ok(false, "Should have thrown!");
42 }
43 catch (e) {
44 ok(e instanceof TypeError, "Got TypeError.");
45 is(e.name, "TypeError", "Good error name.");
46 }
47
48 finishTest();
49 yield undefined;
50 }

mercurial