From c4fbbe6aa1f6b4ecee01176c20ab80fecba2d19e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Odin=20H=C3=B8rthe=20Omdal?= Date: Thu, 4 Apr 2013 16:25:29 +0200 Subject: [PATCH 1/2] IndexedDB: BaptisteFontaine's tests from Test the Web Forward Paris (2012) --- .../TestTWF_Paris/BaptisteFontaine => }/key_invalid.htm | 0 .../TestTWF_Paris/BaptisteFontaine => }/key_valid.html | 0 .../{submissions/TestTWF_Paris/BaptisteFontaine => }/keyorder.htm | 0 .../{submissions/TestTWF_Paris/BaptisteFontaine => }/keypath.htm | 0 .../TestTWF_Paris/BaptisteFontaine => }/keypath_invalid.htm | 0 .../{submissions/TestTWF_Paris/BaptisteFontaine => }/support.js | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename IndexedDB/{submissions/TestTWF_Paris/BaptisteFontaine => }/key_invalid.htm (100%) rename IndexedDB/{submissions/TestTWF_Paris/BaptisteFontaine => }/key_valid.html (100%) rename IndexedDB/{submissions/TestTWF_Paris/BaptisteFontaine => }/keyorder.htm (100%) rename IndexedDB/{submissions/TestTWF_Paris/BaptisteFontaine => }/keypath.htm (100%) rename IndexedDB/{submissions/TestTWF_Paris/BaptisteFontaine => }/keypath_invalid.htm (100%) rename IndexedDB/{submissions/TestTWF_Paris/BaptisteFontaine => }/support.js (100%) diff --git a/IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/key_invalid.htm b/IndexedDB/key_invalid.htm similarity index 100% rename from IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/key_invalid.htm rename to IndexedDB/key_invalid.htm diff --git a/IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/key_valid.html b/IndexedDB/key_valid.html similarity index 100% rename from IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/key_valid.html rename to IndexedDB/key_valid.html diff --git a/IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/keyorder.htm b/IndexedDB/keyorder.htm similarity index 100% rename from IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/keyorder.htm rename to IndexedDB/keyorder.htm diff --git a/IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/keypath.htm b/IndexedDB/keypath.htm similarity index 100% rename from IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/keypath.htm rename to IndexedDB/keypath.htm diff --git a/IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/keypath_invalid.htm b/IndexedDB/keypath_invalid.htm similarity index 100% rename from IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/keypath_invalid.htm rename to IndexedDB/keypath_invalid.htm diff --git a/IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/support.js b/IndexedDB/support.js similarity index 100% rename from IndexedDB/submissions/TestTWF_Paris/BaptisteFontaine/support.js rename to IndexedDB/support.js From aebf381e526214d27dd3d28ef64c14ba711b77b4 Mon Sep 17 00:00:00 2001 From: Zhiqiang Zhang Date: Mon, 9 Dec 2013 16:15:21 +0800 Subject: [PATCH 2/2] Remove support.js as it is ready --- IndexedDB/support.js | 175 ------------------------------------------- 1 file changed, 175 deletions(-) delete mode 100644 IndexedDB/support.js diff --git a/IndexedDB/support.js b/IndexedDB/support.js deleted file mode 100644 index b8645e5469cdbc..00000000000000 --- a/IndexedDB/support.js +++ /dev/null @@ -1,175 +0,0 @@ -if (!window.indexedDB) -{ - if (window.msIndexedDB) - { - window.indexedDB = window.msIndexedDB; - } - else if (window.mozIndexedDB) - { - window.indexedDB = window.mozIndexedDB; - } - else if (window.webkitIndexedDB) - { - window.indexedDB = webkitIndexedDB; - IDBCursor = webkitIDBCursor; - IDBDatabaseException = webkitIDBDatabaseException; - IDBIndex = webkitIDBIndex; - IDBObjectStore = webkitIDBObjectStore; - IDBRequest = webkitIDBRequest; - IDBKeyRange = webkitIDBKeyRange; - IDBTransaction = webkitIDBTransaction; - } -} - -/* Delete created databases - * - * Go through each finished test, see if it has an associated database. Close - * that and delete the database. */ -add_completion_callback(function(tests) -{ - for (var i in tests) - { - if(tests[i].db) - { - tests[i].db.close(); - window.indexedDB.deleteDatabase(tests[i].db.name); - } - } -}); - -function createdb(test, dbname, version) -{ - var rq_open, - fake_open = {}, - dbname = (dbname ? dbname : "testdb-" + new Date().getTime() + Math.random() ); - - if (version) - rq_open = window.indexedDB.open(dbname, version); - else - rq_open = window.indexedDB.open(dbname); - - function auto_fail(evt) { - /* Fail handlers, if we haven't set on/whatever/, don't - * expect to get event whatever. */ - rq_open.manually_handled = {} - - rq_open.addEventListener(evt, - test.step_func(function(e) { - if (!rq_open.manually_handled[evt]) - assert_unreached("unexpected open." + evt + " event") - - if (e.target.result + "" == "[object IDBDatabase]" && !this.db) - { - this.db = e.target.result; - - this.db.onerror = fail(test, "unexpected db.error"); - this.db.onabort = fail(test, "unexpected db.abort"); - this.db.onversionchange = fail(test, "unexpected db.versionchange"); - } - }) - ) - rq_open.__defineSetter__("on" + evt, function(h) { - rq_open.manually_handled[evt] = true - if (!h) - rq_open.addEventListener(evt, function() {}) - else - rq_open.addEventListener(evt, test.step_func(h)) - }) - } - - auto_fail("upgradeneeded") - auto_fail("success") - auto_fail("blocked") - auto_fail("error") - - return rq_open -} - -function fail(test, desc) { - return test.step_func(function(e) { - console.log(desc, e); - - if (e && e.message && e.target.error) - assert_unreached(desc + " (" + e.target.error.name + ": " + e.message + ")"); - else if (e && e.message) - assert_unreached(desc + " (" + e.message + ")"); - else if (e && e.target.error) - assert_unreached(desc + " (" + e.target.error.name + ")"); - else - assert_unreached(desc); - }); -} - -// modified version of support.js’ createdb function, -// the returned DB object has a `setTest(t)` method which -// change the 'test' object used for fails reports, and return -// the DB object (for chained calls) -// Author: Baptiste Fontaine (batifon@yahoo.fr, bfn on IRC) -function createdb_for_multiple_tests(dbname, version) { - var rq_open, - fake_open = {}, - test = null, - dbname = (dbname ? dbname : "testdb-" + new Date().getTime() + Math.random() ); - - if (version) - rq_open = window.indexedDB.open(dbname, version); - else - rq_open = window.indexedDB.open(dbname); - - function auto_fail(evt, current_test) { - /* Fail handlers, if we haven't set on/whatever/, don't - * expect to get event whatever. */ - rq_open.manually_handled = {} - - rq_open.addEventListener(evt, - - function(e) { - - if (current_test !== test) { - return; - } - - test.step(function() { - if (!rq_open.manually_handled[evt]) { - assert_unreached("unexpected open." + evt + " event"); - } - - if (e.target.result + "" == "[object IDBDatabase]" && !this.db) { - this.db = e.target.result; - - this.db.onerror = fail(test, "unexpected db.error"); - this.db.onabort = fail(test, "unexpected db.abort"); - this.db.onversionchange = fail(test, "unexpected db.versionchange"); - } - }); - - } - - ) - rq_open.__defineSetter__("on" + evt, function(h) { - rq_open.manually_handled[evt] = true - if (!h) - rq_open.addEventListener(evt, function() {}) - else - rq_open.addEventListener(evt, test.step_func(h)) - }) - } - - // add a .setTest method to the DB object - Object.defineProperty(rq_open, 'setTest', { - enumerable : false, - value : function(t) { - - test = t; - - auto_fail("upgradeneeded", test); - auto_fail("success", test); - auto_fail("blocked", test); - auto_fail("error", test); - - return this; - } - }); - - return rq_open -}