<commit_before>require('proof')(9, async okay => {
    await require('./harness')(okay, 'key-conversion-exceptions')
    await harness(async function () {

        // Convenience function for tests that only need to run code in onupgradeneeded.
        function indexeddb_upgrade_only_test(upgrade_callback, description) {
          indexeddb_test(upgrade_callback, t => { t.done(); }, description);
        }

        // Key that throws during conversion.
        function throwing_key(name) {
            var throws = [];
            throws.length = 1;
            const err = new Error('throwing from getter');
            err.name = name;
            Object.defineProperty(throws, '0', {get: function() {
                throw err;
            }, enumerable: true});
            return [throws, err];
        }

        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) {
                const [key, err] = throwing_key('getter');
                assert_throws_exactly(err, () => {
                    receiver[method](key);
                }, 'key conversion with throwing getter should rethrow');

                assert_throws_dom('DataError', () => {
                    receiver[method](invalid_key);
                }, 'key conversion with invalid key should throw DataError');
            } else {
                debugger
                const [key1, err1] = throwing_key('getter 1');
                const [key2, err2] = throwing_key('getter 2');
                assert_throws_exactly(err1, () => {
                    receiver[method](key1, key2);
                }, 'first key conversion with throwing getter should rethrow');

                assert_throws_dom('DataError', () => {
                    receiver[method](invalid_key, key2);
                }, 'first key conversion with invalid key should throw DataError');

                assert_throws_exactly(err2, () => {
                    receiver[method](valid_key, key2);
                }, 'second key conversion with throwing getter should rethrow');

                assert_throws_dom('DataError', () => {
                    receiver[method](valid_key, invalid_key);
                }, 'second key conversion with invalid key should throw DataError');
            }
        }

        // Static key comparison utility on IDBFactory.
        test(t => {
            check_method(indexedDB, 'cmp', 2);
        }, 'IDBFactory cmp() static with throwing/invalid keys');
return
        // Continue methods on IDBCursor.
        indexeddb_upgrade_only_test((t, db) => {
            var store = db.createObjectStore('store');
            store.put('a', 1).onerror = t.unreached_func('put should succeed');
<commit_msg>Fix test count.<commit_after>require('proof')(63, async okay => {
    await require('./harness')(okay, 'key-conversion-exceptions')
    await harness(async function () {

        // Convenience function for tests that only need to run code in onupgradeneeded.
        function indexeddb_upgrade_only_test(upgrade_callback, description) {
          indexeddb_test(upgrade_callback, t => { t.done(); }, description);
        }

        // Key that throws during conversion.
        function throwing_key(name) {
            var throws = [];
            throws.length = 1;
            const err = new Error('throwing from getter');
            err.name = name;
            Object.defineProperty(throws, '0', {get: function() {
                throw err;
            }, enumerable: true});
            return [throws, err];
        }

        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) {
                const [key, err] = throwing_key('getter');
                assert_throws_exactly(err, () => {
                    receiver[method](key);
                }, 'key conversion with throwing getter should rethrow');

                assert_throws_dom('DataError', () => {
                    receiver[method](invalid_key);
                }, 'key conversion with invalid key should throw DataError');
            } else {
                debugger
                const [key1, err1] = throwing_key('getter 1');
                const [key2, err2] = throwing_key('getter 2');
                assert_throws_exactly(err1, () => {
                    receiver[method](key1, key2);
                }, 'first key conversion with throwing getter should rethrow');

                assert_throws_dom('DataError', () => {
                    receiver[method](invalid_key, key2);
                }, 'first key conversion with invalid key should throw DataError');

                assert_throws_exactly(err2, () => {
                    receiver[method](valid_key, key2);
                }, 'second key conversion with throwing getter should rethrow');

                assert_throws_dom('DataError', () => {
                    receiver[method](valid_key, invalid_key);
                }, 'second key conversion with invalid key should throw DataError');
            }
        }

        // Static key comparison utility on IDBFactory.
        test(t => {
            check_method(indexedDB, 'cmp', 2);
        }, 'IDBFactory cmp() static with throwing/invalid keys');

        // Continue methods on IDBCursor.
        indexeddb_upgrade_only_test((t, db) => {
            var store = db.createObjectStore('store');
            store.put('a', 1).onerror = t.unreached_func('put should succeed');

{'fraction_non_alphanumeric': 0.10795726359432307, 'fraction_numerical': 0.006538032211768458, 'mean_word_length': 1.8850045998160074, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2479400', 'n_tokens_mistral': 1631, 'n_tokens_neox': 1538, 'n_words': 457}