зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset abd8b7b6dbd1 (bug 1075302) for e10s bustage on a CLOSED TREE
This commit is contained in:
Родитель
fab0916f80
Коммит
5a0d84e7aa
|
@ -115,8 +115,6 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
|
|||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
|
||||
[test_blob_worker_crash.html]
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
|
||||
[test_blob_worker_xhr_post.html]
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
|
||||
[test_blocked_order.html]
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 931116
|
||||
[test_bug937006.html]
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>Indexed Database Property 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 BLOB_DATA = ["fun ", "times ", "all ", "around!"];
|
||||
const BLOB_TYPE = "text/plain";
|
||||
const BLOB_SIZE = BLOB_DATA.join("").length;
|
||||
|
||||
info("Setting up");
|
||||
|
||||
let request = indexedDB.open(window.location.pathname, 1);
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;
|
||||
request.onsuccess = unexpectedSuccessHandler;
|
||||
let event = yield undefined;
|
||||
|
||||
let db = event.target.result;
|
||||
db.onerror = errorHandler;
|
||||
|
||||
ok(db, "Created database");
|
||||
|
||||
info("Creating objectStore");
|
||||
|
||||
let objectStore = db.createObjectStore("foo", { autoIncrement: true });
|
||||
|
||||
request.onupgradeneeded = unexpectedSuccessHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
ok(true, "Opened database");
|
||||
|
||||
let blob = new Blob(BLOB_DATA, { type: BLOB_TYPE });
|
||||
|
||||
info("Adding blob to database");
|
||||
|
||||
objectStore = db.transaction("foo", "readwrite").objectStore("foo");
|
||||
objectStore.add(blob).onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
let blobKey = event.target.result;
|
||||
ok(blobKey, "Got a key for the blob");
|
||||
|
||||
info("Getting blob from the database");
|
||||
|
||||
objectStore = db.transaction("foo").objectStore("foo");
|
||||
objectStore.get(blobKey).onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
blob = event.target.result;
|
||||
|
||||
ok(blob instanceof Blob, "Got a blob");
|
||||
is(blob.size, BLOB_SIZE, "Correct size");
|
||||
is(blob.type, BLOB_TYPE, "Correct type");
|
||||
|
||||
let slice = blob.slice(0, BLOB_DATA[0].length, BLOB_TYPE);
|
||||
|
||||
ok(slice instanceof Blob, "Slice returned a blob");
|
||||
is(slice.size, BLOB_DATA[0].length, "Correct size for slice");
|
||||
is(slice.type, BLOB_TYPE, "Correct type for slice");
|
||||
|
||||
info("Sending slice to a worker");
|
||||
|
||||
function workerScript() {
|
||||
onmessage = function(event) {
|
||||
var blob = event.data;
|
||||
var xhr = new XMLHttpRequest();
|
||||
// We just want to make sure the error case doesn't fire; it's fine for
|
||||
// us to just want a 404.
|
||||
xhr.open('POST', 'http://mochi.test:8888/does-not-exist', true);
|
||||
xhr.onload = function() {
|
||||
postMessage({ status: xhr.status });
|
||||
};
|
||||
xhr.onerror = function() {
|
||||
postMessage({ status: 'error' });
|
||||
}
|
||||
xhr.send(blob);
|
||||
}
|
||||
}
|
||||
|
||||
let workerScriptUrl =
|
||||
URL.createObjectURL(new Blob(["(", workerScript.toSource(), ")()"]));
|
||||
|
||||
let xhrWorker = new Worker(workerScriptUrl);
|
||||
xhrWorker.postMessage(slice);
|
||||
xhrWorker.onmessage = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
is(event.data.status, 404, "XHR generated the expected 404");
|
||||
xhrWorker.terminate();
|
||||
|
||||
URL.revokeObjectURL(workerScriptUrl);
|
||||
|
||||
finishTest();
|
||||
yield undefined;
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript;version=1.7" src="helpers.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onload="runTest();"></body>
|
||||
|
||||
</html>
|
|
@ -419,48 +419,15 @@ public:
|
|||
NS_IMETHOD
|
||||
Available(uint64_t* aAvailable) MOZ_OVERRIDE
|
||||
{
|
||||
if (!IsOnOwningThread()) {
|
||||
nsresult rv = BlockAndWaitForStream();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mStream->Available(aAvailable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (NS_IsMainThread()) {
|
||||
NS_WARNING("Someone is trying to do main-thread I/O...");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// See if we already have our real stream.
|
||||
nsCOMPtr<nsIInputStream> inputStream;
|
||||
{
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
|
||||
inputStream = mStream;
|
||||
}
|
||||
|
||||
// If we do then just call through.
|
||||
if (inputStream) {
|
||||
rv = inputStream->Available(aAvailable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If the stream is already closed then we can't do anything.
|
||||
if (!mBlobImpl) {
|
||||
// See large comment in FileInputStreamWrapper::Available.
|
||||
if (IsOnOwningThread()) {
|
||||
return NS_BASE_STREAM_CLOSED;
|
||||
}
|
||||
|
||||
// Otherwise fake it...
|
||||
NS_WARNING("Available() called before real stream has been delivered, "
|
||||
"guessing the amount of data available!");
|
||||
nsresult rv = BlockAndWaitForStream();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mBlobImpl->GetSize(aAvailable);
|
||||
rv = mStream->Available(aAvailable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче