| Index: third_party/WebKit/LayoutTests/storage/indexeddb/key_conversion_exceptions.html
|
| diff --git a/third_party/WebKit/LayoutTests/storage/indexeddb/key_conversion_exceptions.html b/third_party/WebKit/LayoutTests/storage/indexeddb/key_conversion_exceptions.html
|
| deleted file mode 100644
|
| index 23ed89be9955e6a222933918f20a323f1d8a7b53..0000000000000000000000000000000000000000
|
| --- a/third_party/WebKit/LayoutTests/storage/indexeddb/key_conversion_exceptions.html
|
| +++ /dev/null
|
| @@ -1,204 +0,0 @@
|
| -<!DOCTYPE html>
|
| -<title>IndexedDB: Exceptions thrown during key conversion</title>
|
| -<script src="../../resources/testharness.js"></script>
|
| -<script src="../../resources/testharnessreport.js"></script>
|
| -<script>
|
| -
|
| -function simple_idb_test(upgrade_callback, description) {
|
| - async_test(function(t) {
|
| - var dbname = document.location + '-' + t.name;
|
| - var del = indexedDB.deleteDatabase(dbname);
|
| - del.onerror = t.unreached_func('deleteDatabase should succeed');
|
| - var open = indexedDB.open(dbname);
|
| - open.onerror = t.unreached_func('open should succeed');
|
| - open.onupgradeneeded = t.step_func(function(e) {
|
| - upgrade_callback(t, open.result);
|
| - });
|
| - open.onsuccess = t.step_func(function() {
|
| - open.result.close();
|
| - t.done();
|
| - });
|
| - }, description);
|
| -}
|
| -
|
| -// Key that throws during conversion.
|
| -function throwing_key(name) {
|
| - var throws = [];
|
| - throws.length = 1;
|
| - Object.defineProperty(throws, '0', {get: function() {
|
| - var err = new Error('throwing from getter');
|
| - err.name = name;
|
| - throw err;
|
| - }, enumerable: true});
|
| - return throws;
|
| -}
|
| -
|
| -var valid_key = [];
|
| -var invalid_key = {};
|
| -
|
| -// Calls method on receiver with the specified number of args (default 1)
|
| -// and asserts that the method fails appropriately (rethrowing if
|
| -// conversion throws, or DataError if not a valid key), and that
|
| -// the first argument is fully processed before the second argument
|
| -// (if appropriate).
|
| -function check_method(receiver, method, args) {
|
| - args = args || 1;
|
| - if (args < 2) {
|
| - assert_throws({name:'getter'}, function() {
|
| - receiver[method](throwing_key('getter'));
|
| - }, 'key conversion with throwing getter should rethrow');
|
| -
|
| - assert_throws('DataError', function() {
|
| - receiver[method](invalid_key);
|
| - }, 'key conversion with invalid key should throw DataError');
|
| - } else {
|
| - assert_throws({name:'getter 1'}, function() {
|
| - receiver[method](throwing_key('getter 1'), throwing_key('getter 2'));
|
| - }, 'first key conversion with throwing getter should rethrow');
|
| -
|
| - assert_throws('DataError', function() {
|
| - receiver[method](invalid_key, throwing_key('getter 2'));
|
| - }, 'first key conversion with invalid key should throw DataError');
|
| -
|
| - assert_throws({name:'getter 2'}, function() {
|
| - receiver[method](valid_key, throwing_key('getter 2'));
|
| - }, 'second key conversion with throwing getter should rethrow');
|
| -
|
| - assert_throws('DataError', function() {
|
| - receiver[method](valid_key, invalid_key);
|
| - }, 'second key conversion with invalid key should throw DataError');
|
| - }
|
| -}
|
| -
|
| -// Static key comparison utility on IDBFactory.
|
| -test(function(t) {
|
| - check_method(indexedDB, 'cmp', 2);
|
| -}, 'IDBFactory cmp() static with throwing/invalid keys');
|
| -
|
| -// Continue methods on IDBCursor.
|
| -simple_idb_test(function(t, db) {
|
| - var store = db.createObjectStore('store');
|
| - store.put('a', 1).onerror = t.unreached_func('put should succeed');
|
| -
|
| - var request = store.openCursor();
|
| - request.onerror = t.unreached_func('openCursor should succeed');
|
| - request.onsuccess = t.step_func(function() {
|
| - var cursor = request.result;
|
| - assert_not_equals(cursor, null, 'cursor should find a value');
|
| - check_method(cursor, 'continue');
|
| - });
|
| -}, 'IDBCursor continue() method with throwing/invalid keys');
|
| -
|
| -simple_idb_test(function(t, db) {
|
| - var store = db.createObjectStore('store');
|
| - var index = store.createIndex('index', 'prop');
|
| - store.put({prop: 'a'}, 1).onerror = t.unreached_func('put should succeed');
|
| -
|
| - var request = index.openCursor();
|
| - request.onerror = t.unreached_func('openCursor should succeed');
|
| - request.onsuccess = t.step_func(function() {
|
| - var cursor = request.result;
|
| - assert_not_equals(cursor, null, 'cursor should find a value');
|
| -
|
| - check_method(cursor, 'continuePrimaryKey', 2);
|
| - });
|
| -}, 'IDBCursor continuePrimaryKey() method with throwing/invalid keys');
|
| -
|
| -// Mutation methods on IDBCursor.
|
| -simple_idb_test(function(t, db) {
|
| - var store = db.createObjectStore('store', {keyPath: 'prop'});
|
| - store.put({prop: 1}).onerror = t.unreached_func('put should succeed');
|
| -
|
| - var request = store.openCursor();
|
| - request.onerror = t.unreached_func('openCursor should succeed');
|
| - request.onsuccess = t.step_func(function() {
|
| - var cursor = request.result;
|
| - assert_not_equals(cursor, null, 'cursor should find a value');
|
| -
|
| - var value = {};
|
| - value.prop = throwing_key('getter');
|
| - assert_throws({name: 'getter'}, function() {
|
| - cursor.update(value);
|
| - }, 'throwing getter should rethrow during clone');
|
| -
|
| - // Throwing from the getter during key conversion is
|
| - // not possible since (1) a clone is used, (2) only own
|
| - // properties are cloned, and (3) only own properties
|
| - // are used for key path evaluation.
|
| -
|
| - value.prop = invalid_key;
|
| - assert_throws('DataError', function() {
|
| - cursor.update(value);
|
| - }, 'key conversion with invalid key should throw DataError');
|
| - });
|
| -}, 'IDBCursor update() method with throwing/invalid keys');
|
| -
|
| -// Static constructors on IDBKeyRange
|
| -['only', 'lowerBound', 'upperBound'].forEach(function(method) {
|
| - test(function(t) {
|
| - check_method(IDBKeyRange, method);
|
| - }, 'IDBKeyRange ' + method + '() static with throwing/invalid keys');
|
| -});
|
| -
|
| -test(function(t) {
|
| - check_method(IDBKeyRange, 'bound', 2);
|
| -}, 'IDBKeyRange bound() static with throwing/invalid keys');
|
| -
|
| -// Insertion methods on IDBObjectStore.
|
| -['add', 'put'].forEach(function(method) {
|
| - simple_idb_test(function(t, db) {
|
| - var out_of_line = db.createObjectStore('out-of-line keys');
|
| - var in_line = db.createObjectStore('in-line keys', {keyPath: 'prop'});
|
| -
|
| - assert_throws({name:'getter'}, function() {
|
| - out_of_line[method]('value', throwing_key('getter'));
|
| - }, 'key conversion with throwing getter should rethrow');
|
| -
|
| - assert_throws('DataError', function() {
|
| - out_of_line[method]('value', invalid_key);
|
| - }, 'key conversion with invalid key should throw DataError');
|
| -
|
| - var value = {};
|
| - value.prop = throwing_key('getter');
|
| - assert_throws({name:'getter'}, function() {
|
| - in_line[method](value);
|
| - }, 'throwing getter should rethrow during clone');
|
| -
|
| - // Throwing from the getter during key conversion is
|
| - // not possible since (1) a clone is used, (2) only own
|
| - // properties are cloned, and (3) only own properties
|
| - // are used for key path evaluation.
|
| -
|
| - value.prop = invalid_key;
|
| - assert_throws('DataError', function() {
|
| - in_line[method](value);
|
| - }, 'key conversion with invalid key should throw DataError');
|
| - }, 'IDBObjectStore ' + method + '() method with throwing/invalid keys');
|
| -});
|
| -
|
| -// Generic (key-or-key-path) methods on IDBObjectStore.
|
| -[
|
| - // TODO(jsbell): Add 'getAllKeys'
|
| - 'delete', 'get', 'getAll', 'count', 'openCursor', 'openKeyCursor'
|
| -].forEach(function(method) {
|
| - simple_idb_test(function(t, db) {
|
| - var store = db.createObjectStore('store');
|
| -
|
| - check_method(store, method);
|
| - }, 'IDBObjectStore ' + method + '() method with throwing/invalid keys');
|
| -});
|
| -
|
| -// Generic (key-or-key-path) methods on IDBIndex.
|
| -[
|
| - // TODO(jsbell): Add 'getAllKeys'
|
| - 'get', 'getKey', 'getAll', 'count', 'openCursor', 'openKeyCursor'
|
| -].forEach(function(method) {
|
| - simple_idb_test(function(t, db) {
|
| - var store = db.createObjectStore('store');
|
| - var index = store.createIndex('index', 'keyPath');
|
| -
|
| - check_method(index, method);
|
| - }, 'IDBIndex ' + method + '() method with throwing/invalid keys');
|
| -});
|
| -
|
| -</script>
|
|
|