mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-08-14 10:29:31 +00:00
75 lines
2.0 KiB
HTML
75 lines
2.0 KiB
HTML
|
<!--
|
||
|
Any copyright is dedicated to the Public Domain.
|
||
|
http://creativecommons.org/publicdomain/zero/1.0/
|
||
|
-->
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>File Handle Test</title>
|
||
|
|
||
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||
|
|
||
|
<script type="text/javascript;version=1.7">
|
||
|
function testSteps()
|
||
|
{
|
||
|
const name = window.location.pathname;
|
||
|
|
||
|
let request = indexedDB.open(name, 1);
|
||
|
request.onerror = errorHandler;
|
||
|
request.onsuccess = grabEventAndContinueHandler;
|
||
|
let event = yield undefined;
|
||
|
|
||
|
let db = event.target.result;
|
||
|
db.onerror = errorHandler;
|
||
|
|
||
|
request = db.createMutableFile("test.txt");
|
||
|
request.onerror = errorHandler;
|
||
|
request.onsuccess = grabEventAndContinueHandler;
|
||
|
event = yield undefined;
|
||
|
|
||
|
let mutableFile = event.target.result;
|
||
|
mutableFile.onerror = errorHandler;
|
||
|
|
||
|
let fileHandle = mutableFile.open();
|
||
|
|
||
|
fileHandle.oncomplete = unexpectedSuccessHandler;
|
||
|
fileHandle.onabort = grabEventAndContinueHandler;
|
||
|
|
||
|
let sawError = false;
|
||
|
|
||
|
request = fileHandle.getMetadata({ size: true });
|
||
|
request.onsuccess = unexpectedSuccessHandler;
|
||
|
request.onerror = function(event) {
|
||
|
is(event.target.error.name, "AbortError", "Good error");
|
||
|
sawError = true;
|
||
|
event.stopPropagation();
|
||
|
}
|
||
|
|
||
|
fileHandle.abort();
|
||
|
|
||
|
event = yield undefined;
|
||
|
|
||
|
is(event.type, "abort", "Got abort event");
|
||
|
is(sawError, true, "Saw getMetadata() error");
|
||
|
|
||
|
// Make sure the success event isn't queued somehow.
|
||
|
let comp = SpecialPowers.wrap(SpecialPowers.Components);
|
||
|
var thread = comp.classes["@mozilla.org/thread-manager;1"]
|
||
|
.getService(comp.interfaces.nsIThreadManager)
|
||
|
.currentThread;
|
||
|
while (thread.hasPendingEvents()) {
|
||
|
thread.processNextEvent(false);
|
||
|
}
|
||
|
|
||
|
finishTest();
|
||
|
yield undefined;
|
||
|
}
|
||
|
</script>
|
||
|
<script type="text/javascript;version=1.7" src="helpers.js"></script>
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body onload="runTest();"></body>
|
||
|
|
||
|
</html>
|