1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/storage/test/unit/test_bug-365166.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/licenses/publicdomain/ */ 1.6 + 1.7 +// Testcase for bug 365166 - crash [@ strlen] calling 1.8 +// mozIStorageStatement::getColumnName of a statement created with 1.9 +// "PRAGMA user_version" or "PRAGMA schema_version" 1.10 +function run_test() { 1.11 + test('user'); 1.12 + test('schema'); 1.13 + 1.14 + function test(param) 1.15 + { 1.16 + var colName = param + "_version"; 1.17 + var sql = "PRAGMA " + colName; 1.18 + 1.19 + var file = getTestDB(); 1.20 + var storageService = Components.classes["@mozilla.org/storage/service;1"]. 1.21 + getService(Components.interfaces.mozIStorageService); 1.22 + var conn = storageService.openDatabase(file); 1.23 + var statement = conn.createStatement(sql); 1.24 + try { 1.25 + // This shouldn't crash: 1.26 + do_check_eq(statement.getColumnName(0), colName); 1.27 + } finally { 1.28 + statement.reset(); 1.29 + statement.finalize(); 1.30 + } 1.31 + } 1.32 +}