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 | let request = indexedDB.open(name, 1); |
michael@0 | 20 | request.onerror = errorHandler; |
michael@0 | 21 | request.onupgradeneeded = grabEventAndContinueHandler; |
michael@0 | 22 | request.onsuccess = grabEventAndContinueHandler; |
michael@0 | 23 | let event = yield undefined; |
michael@0 | 24 | |
michael@0 | 25 | is(event.type, "upgradeneeded", "Got correct event type"); |
michael@0 | 26 | |
michael@0 | 27 | let db = event.target.result; |
michael@0 | 28 | db.onerror = errorHandler; |
michael@0 | 29 | |
michael@0 | 30 | event = yield undefined; |
michael@0 | 31 | |
michael@0 | 32 | request = db.mozCreateFileHandle("test.bin", "binary"); |
michael@0 | 33 | request.onsuccess = grabEventAndContinueHandler; |
michael@0 | 34 | event = yield undefined; |
michael@0 | 35 | |
michael@0 | 36 | let fileHandle = event.target.result; |
michael@0 | 37 | fileHandle.onerror = errorHandler; |
michael@0 | 38 | |
michael@0 | 39 | let lockedFile = fileHandle.open("readwrite"); |
michael@0 | 40 | |
michael@0 | 41 | let blob = getNullBlob(DEFAULT_QUOTA); |
michael@0 | 42 | |
michael@0 | 43 | request = lockedFile.write(blob); |
michael@0 | 44 | request.addEventListener("error", |
michael@0 | 45 | new ExpectError("QuotaExceededError", true)); |
michael@0 | 46 | request.onsuccess = unexpectedSuccessHandler; |
michael@0 | 47 | event = yield undefined; |
michael@0 | 48 | |
michael@0 | 49 | lockedFile.oncomplete = grabEventAndContinueHandler; |
michael@0 | 50 | event = yield undefined; |
michael@0 | 51 | |
michael@0 | 52 | is(event.type, "complete", "Got correct event type"); |
michael@0 | 53 | |
michael@0 | 54 | finishTest(); |
michael@0 | 55 | yield undefined; |
michael@0 | 56 | } |
michael@0 | 57 | </script> |
michael@0 | 58 | <script type="text/javascript;version=1.7" src="file.js"></script> |
michael@0 | 59 | <script type="text/javascript;version=1.7" src="helpers.js"></script> |
michael@0 | 60 | |
michael@0 | 61 | </head> |
michael@0 | 62 | |
michael@0 | 63 | <body onload="runTest(true);"></body> |
michael@0 | 64 | |
michael@0 | 65 | </html> |