From 0c2091475950841b022345820d3119926b9a9bf1 Mon Sep 17 00:00:00 2001 From: Ben Turner Date: Mon, 27 Aug 2012 12:40:06 -0700 Subject: [PATCH] Bug 786003 - 'Add a few extra tests for blobs in IndexedDB'. r=jst. --- dom/indexedDB/test/Makefile.in | 1 + dom/indexedDB/test/test_blob_archive.html | 127 ++++++++++++++++++++++ dom/indexedDB/test/test_blob_simple.html | 18 +++ 3 files changed, 146 insertions(+) create mode 100644 dom/indexedDB/test/test_blob_archive.html diff --git a/dom/indexedDB/test/Makefile.in b/dom/indexedDB/test/Makefile.in index 94acf3fe982..85eeb3feb15 100644 --- a/dom/indexedDB/test/Makefile.in +++ b/dom/indexedDB/test/Makefile.in @@ -29,6 +29,7 @@ MOCHITEST_FILES = \ test_autoIncrement_indexes.html \ test_autoIncrement.html \ test_bfcache.html \ + test_blob_archive.html \ test_blob_simple.html \ test_clear.html \ test_complex_keyPaths.html \ diff --git a/dom/indexedDB/test/test_blob_archive.html b/dom/indexedDB/test/test_blob_archive.html new file mode 100644 index 00000000000..0c2fb417fc2 --- /dev/null +++ b/dom/indexedDB/test/test_blob_archive.html @@ -0,0 +1,127 @@ + + + + Indexed Database Property Test + + + + + + + + + + + + diff --git a/dom/indexedDB/test/test_blob_simple.html b/dom/indexedDB/test/test_blob_simple.html index e0831069302..9387d2a6240 100644 --- a/dom/indexedDB/test/test_blob_simple.html +++ b/dom/indexedDB/test/test_blob_simple.html @@ -53,6 +53,24 @@ is(event.target.result, BLOB_DATA.join(""), "Correct text"); + info("Trying blob url"); + + objectStore = db.transaction("foo").objectStore("foo"); + objectStore.get(key).onsuccess = grabEventAndContinueHandler; + event = yield; + + let blobURL = URL.createObjectURL(event.target.result.blob); + + let xhr = new XMLHttpRequest(); + xhr.open("GET", blobURL); + xhr.onload = grabEventAndContinueHandler; + xhr.send(); + yield; + + URL.revokeObjectURL(blobURL); + + is(xhr.responseText, BLOB_DATA.join(""), "Correct responseText"); + objectStore = db.transaction("foo").objectStore("foo"); objectStore.mozGetAll().onsuccess = grabEventAndContinueHandler; event = yield;