1 var throwOnToStringObject
= { };
2 throwOnToStringObject
.toString = function () { throw "Cannot call toString on this object." };
4 var throwOnGetLengthObject
= { };
5 throwOnGetLengthObject
.__defineGetter__("length", function () { throw "Cannot get length of this object."; });
7 var throwOnGetZeroObject
= { length
: 1 };
8 throwOnGetZeroObject
.__defineGetter__("0", function () { throw "Cannot get 0 property of this object."; });
10 var expectNoException
= [
20 '"", { length: 1, 0: "arg0" }',
22 '"", null, undefined',
23 '"", null, function(){}',
24 '"", null, null, null',
25 '"", null, null, undefined',
26 '"", null, null, function(){}',
29 var expectException
= [
31 'throwOnToStringObject',
32 '"", throwOnGetLengthObject',
33 '"", throwOnGetZeroObject',
34 '"", [ throwOnToStringObject ]',
43 '"", null, null, { }',
46 function tryExecuteSql(transaction
, parameterList
)
49 eval('transaction.executeSql(' + parameterList
+ ')');
56 function runTransactionTest(transaction
, parameterList
, expectException
)
58 var exception
= tryExecuteSql(transaction
, parameterList
);
59 if (expectException
) {
61 log("PASS. executeSql(" + parameterList
+ ") threw an exception as expected.");
63 log("*FAIL*. executeSql(" + parameterList
+ ") did not throw an exception");
66 log("*FAIL*. executeSql(" + parameterList
+ ") threw an exception: " + exception
);
68 log("PASS. executeSql(" + parameterList
+ ") did not throw an exception");
72 function runTransactionTests(transaction
)
74 for (i
in expectNoException
)
75 runTransactionTest(transaction
, expectNoException
[i
], false);
76 for (i
in expectException
)
77 runTransactionTest(transaction
, expectException
[i
], true);
79 if (window
.testRunner
)
80 testRunner
.notifyDone();
86 var db
= openDatabaseWithSuffix("ExecuteSQLArgsTest", "1.0", "Test of handling of the arguments to SQLTransaction.executeSql", 1);
87 db
.transaction(runTransactionTests
);