1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/indexedDB/test/unit/test_invalid_version.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +/** 1.5 + * Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.7 + */ 1.8 + 1.9 +var testGenerator = testSteps(); 1.10 + 1.11 +function testSteps() 1.12 +{ 1.13 + const name = this.window ? window.location.pathname : "Splendid Test"; 1.14 + 1.15 + try { 1.16 + indexedDB.open(name, 0); 1.17 + ok(false, "Should have thrown!"); 1.18 + } 1.19 + catch (e) { 1.20 + ok(e instanceof TypeError, "Got TypeError."); 1.21 + is(e.name, "TypeError", "Good error name."); 1.22 + } 1.23 + 1.24 + try { 1.25 + indexedDB.open(name, -1); 1.26 + ok(false, "Should have thrown!"); 1.27 + } 1.28 + catch (e) { 1.29 + ok(e instanceof TypeError, "Got TypeError."); 1.30 + is(e.name, "TypeError", "Good error name."); 1.31 + } 1.32 + 1.33 + try { 1.34 + indexedDB.open(name, { version: 0 }); 1.35 + ok(false, "Should have thrown!"); 1.36 + } 1.37 + catch (e) { 1.38 + ok(e instanceof TypeError, "Got TypeError."); 1.39 + is(e.name, "TypeError", "Good error name."); 1.40 + } 1.41 + 1.42 + try { 1.43 + indexedDB.open(name, { version: -1 }); 1.44 + ok(false, "Should have thrown!"); 1.45 + } 1.46 + catch (e) { 1.47 + ok(e instanceof TypeError, "Got TypeError."); 1.48 + is(e.name, "TypeError", "Good error name."); 1.49 + } 1.50 + 1.51 + finishTest(); 1.52 + yield undefined; 1.53 +}