OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>IDBFactory.open() - errors in version argument</title> |
| 3 <script src=../../../resources/testharness.js></script> |
| 4 <script src=../../../resources/testharnessreport.js></script> |
| 5 <script src=support.js></script> |
| 6 |
| 7 <script> |
| 8 function should_throw(val, name) { |
| 9 if (!name) { |
| 10 name = ((typeof val == "object" && val) ? "object" : format_value(val)) |
| 11 } |
| 12 test(function() { |
| 13 assert_throws(new TypeError(), function() { |
| 14 window.indexedDB.open('test', val); |
| 15 }); |
| 16 }, "Calling open() with version argument " + name + " should throw TypeError
.") |
| 17 } |
| 18 |
| 19 should_throw(-1) |
| 20 should_throw(-0.5) |
| 21 should_throw(0) |
| 22 should_throw(0.5) |
| 23 should_throw(0.8) |
| 24 should_throw(0x20000000000000) |
| 25 should_throw(NaN) |
| 26 should_throw(Infinity) |
| 27 should_throw(-Infinity) |
| 28 should_throw("foo") |
| 29 should_throw(undefined) |
| 30 should_throw(null) |
| 31 should_throw(false) |
| 32 |
| 33 should_throw({ |
| 34 toString: function() { assert_unreached("toString should not be called for T
oPrimitive [Number]"); }, |
| 35 valueOf: function() { return 0; } |
| 36 }) |
| 37 should_throw({ |
| 38 toString: function() { return 0; }, |
| 39 valueOf: function() { return {}; } |
| 40 }, 'object (second)') |
| 41 should_throw({ |
| 42 toString: function() { return {}; }, |
| 43 valueOf: function() { return {}; }, |
| 44 }, 'object (third)') |
| 45 |
| 46 /* Valid */ |
| 47 |
| 48 function should_work(val) { |
| 49 var t = async_test("Calling open() with version argument 1.5 should not thro
w.") |
| 50 var rq = createdb(t) |
| 51 rq.onupgradeneeded = function() { |
| 52 t.done() |
| 53 } |
| 54 } |
| 55 |
| 56 should_work(1.5) |
| 57 |
| 58 </script> |
| 59 |
| 60 <div id=log></div> |
OLD | NEW |