test_invalid_version.js 1.1 KB

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