Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <!-- |
michael@0 | 2 | Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | --> |
michael@0 | 5 | <html> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Indexed Database Property Test</title> |
michael@0 | 8 | |
michael@0 | 9 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 10 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 11 | |
michael@0 | 12 | <script type="text/javascript;version=1.7"> |
michael@0 | 13 | function testSteps() |
michael@0 | 14 | { |
michael@0 | 15 | const READ_WRITE = "readwrite"; |
michael@0 | 16 | |
michael@0 | 17 | const name = window.location.pathname; |
michael@0 | 18 | |
michael@0 | 19 | const objectStoreName = "Blobs"; |
michael@0 | 20 | |
michael@0 | 21 | const fileData = { key: 1, file: getNullFile("random.bin", DEFAULT_QUOTA) }; |
michael@0 | 22 | |
michael@0 | 23 | let request = indexedDB.open(name, 1); |
michael@0 | 24 | request.onerror = errorHandler; |
michael@0 | 25 | request.onupgradeneeded = grabEventAndContinueHandler; |
michael@0 | 26 | request.onsuccess = grabEventAndContinueHandler; |
michael@0 | 27 | let event = yield undefined; |
michael@0 | 28 | |
michael@0 | 29 | is(event.type, "upgradeneeded", "Got correct event type"); |
michael@0 | 30 | |
michael@0 | 31 | let db = event.target.result; |
michael@0 | 32 | |
michael@0 | 33 | db.createObjectStore(objectStoreName, { }); |
michael@0 | 34 | |
michael@0 | 35 | event = yield undefined; |
michael@0 | 36 | |
michael@0 | 37 | is(event.type, "success", "Got correct event type"); |
michael@0 | 38 | |
michael@0 | 39 | trans = db.transaction([objectStoreName], READ_WRITE); |
michael@0 | 40 | let objectStore = trans.objectStore(objectStoreName); |
michael@0 | 41 | |
michael@0 | 42 | request = objectStore.add(fileData.file, fileData.key); |
michael@0 | 43 | request.addEventListener("error", |
michael@0 | 44 | new ExpectError("QuotaExceededError", true)); |
michael@0 | 45 | request.onsuccess = unexpectedSuccessHandler; |
michael@0 | 46 | event = yield undefined; |
michael@0 | 47 | |
michael@0 | 48 | trans.oncomplete = grabEventAndContinueHandler; |
michael@0 | 49 | event = yield undefined; |
michael@0 | 50 | |
michael@0 | 51 | is(event.type, "complete", "Got correct event type"); |
michael@0 | 52 | |
michael@0 | 53 | finishTest(); |
michael@0 | 54 | yield undefined; |
michael@0 | 55 | } |
michael@0 | 56 | </script> |
michael@0 | 57 | <script type="text/javascript;version=1.7" src="file.js"></script> |
michael@0 | 58 | <script type="text/javascript;version=1.7" src="helpers.js"></script> |
michael@0 | 59 | |
michael@0 | 60 | </head> |
michael@0 | 61 | |
michael@0 | 62 | <body onload="runTest(true);"></body> |
michael@0 | 63 | |
michael@0 | 64 | </html> |