mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-24 14:17:58 +03:00
Add a test confirming that exceptions are not passed through C-space if a JS-side sqlite3_set_authorizer() callback throws.
FossilOrigin-Name: 5a77c2c7aaa556007274e1b85790934665c2c12661ca11d896eb7d09cd49ce72
This commit is contained in:
@@ -1389,7 +1389,22 @@ self.sqlite3InitModule = sqlite3InitModule;
|
||||
T.assert(n === db.selectValue('select count(*) from t'))
|
||||
.assert(authCount>0);
|
||||
authCount = 0;
|
||||
rc = ssa(db, null, 0);
|
||||
rc = ssa(db, function(pV, iCode, s0, s1, s2, s3){
|
||||
++authCount;
|
||||
throw new Error("Testing catching of authorizer.");
|
||||
}, 0);
|
||||
T.assert(0===rc);
|
||||
authCount = 0;
|
||||
err = undefined;
|
||||
try{ db.exec("select 1 from t") }
|
||||
catch(e){err = e}
|
||||
T.assert(err instanceof Error)
|
||||
.assert(err.message.indexOf('not authorized')>0)
|
||||
/* Note that the thrown message is trumped/overwritten
|
||||
by the authorizer process. */
|
||||
.assert(1===authCount);
|
||||
rc = ssa(db, 0, 0);
|
||||
authCount = 0;
|
||||
T.assert(0===rc);
|
||||
T.assert(n === db.selectValue('select count(*) from t'))
|
||||
.assert(0===authCount);
|
||||
|
||||
Reference in New Issue
Block a user