зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1499105 - P3 - Mochitest updated to confirm IDBFileHandle::Read() throws on data larger than 4GB r=janv
Mochitest `dom/indexedDB/test/test_filehandle_write_read_data.html` has been modified to cover the scenario, where IDBFileHandle::ReadAsText() and IDBFileHandle::ReadAsArrayBuffer(), both of which in turn call IDBFileHandle::Read(), throw JavaScript TypeError. Differential Revision: https://phabricator.services.mozilla.com/D59515 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
e871eaa405
Коммит
f5684db67c
|
@ -15,6 +15,9 @@
|
|||
const name = window.location.pathname;
|
||||
|
||||
var testString = "Lorem ipsum his ponderum delicatissimi ne, at noster dolores urbanitas pro, cibo elaboraret no his. Ea dicunt maiorum usu. Ad appareat facilisis mediocritatem eos. Tale graeci mentitum in eos, hinc insolens at nam. Graecis nominavi aliquyam eu vix. Id solet assentior sadipscing pro. Et per atqui graecis, usu quot viris repudiandae ei, mollis evertitur an nam. At nam dolor ignota, liber labore omnesque ea mei, has movet voluptaria in. Vel an impetus omittantur. Vim movet option salutandi ex, ne mei ignota corrumpit. Mucius comprehensam id per. Est ea putant maiestatis.";
|
||||
var typeErrString = "TypeError: Data size for read is too large.";
|
||||
var uint32Max = 0xFFFFFFFF;
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
testString += testString;
|
||||
}
|
||||
|
@ -56,6 +59,14 @@
|
|||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
try {
|
||||
request = fileHandle.readAsText(uint32Max + 0x1);
|
||||
ok(false, "Should have thrown!");
|
||||
} catch (e) {
|
||||
ok(e instanceof TypeError, "Got TypeError");
|
||||
ok(e == typeErrString, "Correct error string");
|
||||
}
|
||||
|
||||
let resultString = event.target.result;
|
||||
ok(resultString == testString, "Correct string data");
|
||||
|
||||
|
@ -71,6 +82,14 @@
|
|||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
try {
|
||||
request = fileHandle.readAsArrayBuffer(uint32Max + 0x1);
|
||||
ok(false, "Should have thrown!");
|
||||
} catch (e) {
|
||||
ok(e instanceof TypeError, "Got TypeError");
|
||||
ok(e == typeErrString, "Correct error string");
|
||||
}
|
||||
|
||||
let resultBuffer = event.target.result;
|
||||
ok(compareBuffers(resultBuffer, testBuffer), "Correct array buffer data");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче