Backed out changesets 0beb30c3e1af, 584f639cdb03, and 6a3b0b83d3f6 (bug 916128) for depending on bug 817700.

This commit is contained in:
Ryan VanderMeulen 2013-10-08 14:59:25 -04:00
parent 5b731001cd
commit a5c967b4f9
4 changed files with 19 additions and 70 deletions

View File

@ -1,13 +0,0 @@
<script>
o0 = document.createElement('canvas');
(document.body || document.documentElement).appendChild(o0);
o1 = o0.getContext('2d');
o2 = document.createElement('img');
//o2.src = "image2.png";
o3 = o1.createImageData(0.7409945472006207, 0.8815588599260801);
o1.save();
o1.mozCurrentTransform = [0.18777365986904448, 4, 4, -2048, 3, 32];
o0.width = 0.52;
o1.putImageData(o3, -32, -0.16596290333335356);
o0.toBlob(function() {}, "video/mp4", 16);
</script>

View File

@ -17,4 +17,3 @@ skip-if(Android||B2G) load 780392-1.html # bug 833371 for B2G
skip-if(Android||B2G) load 789933-1.html # bug 833371
load 794463-1.html
load 802926-1.html
load 916128-1.html

View File

@ -24,7 +24,6 @@ public:
, mScriptContext(aScriptContext)
, mEncoderThread(aEncoderThread)
, mCallback(&aCallback)
, mFailed(false)
{}
virtual ~EncodingCompleteEvent() {}
@ -32,28 +31,19 @@ public:
{
MOZ_ASSERT(NS_IsMainThread());
mozilla::ErrorResult rv;
nsRefPtr<nsDOMMemoryFile> blob =
new nsDOMMemoryFile(mImgData, mImgSize, mType);
if (!mFailed) {
nsRefPtr<nsDOMMemoryFile> blob =
new nsDOMMemoryFile(mImgData, mImgSize, mType);
if (mScriptContext) {
JSContext* jsContext = mScriptContext->GetNativeContext();
if (jsContext) {
JS_updateMallocCounter(jsContext, mImgSize);
}
if (mScriptContext) {
JSContext* jsContext = mScriptContext->GetNativeContext();
if (jsContext) {
JS_updateMallocCounter(jsContext, mImgSize);
}
mCallback->Call(blob, rv);
}
// These members aren't thread-safe. We're making sure that they're being
// released on the main thread here. Otherwise, they could be getting
// released by EncodingRunnable's destructor on the encoding thread
// (bug 916128).
mScriptContext = nullptr;
mCallback = nullptr;
mozilla::ErrorResult rv;
mCallback->Call(blob, rv);
NS_ENSURE_SUCCESS(rv.ErrorCode(), rv.ErrorCode());
mEncoderThread->Shutdown();
return rv.ErrorCode();
@ -66,11 +56,6 @@ public:
mType = aType;
}
void SetFailed()
{
mFailed = true;
}
private:
uint64_t mImgSize;
nsAutoString mType;
@ -78,7 +63,6 @@ private:
nsCOMPtr<nsIScriptContext> mScriptContext;
nsCOMPtr<nsIThread> mEncoderThread;
nsRefPtr<FileCallback> mCallback;
bool mFailed;
};
NS_IMPL_ISUPPORTS1(EncodingCompleteEvent, nsIRunnable);
@ -107,7 +91,7 @@ public:
{}
virtual ~EncodingRunnable() {}
nsresult ProcessImageData(uint64_t* aImgSize, void** aImgData)
NS_IMETHOD Run()
{
nsCOMPtr<nsIInputStream> stream;
nsresult rv = ImageEncoder::ExtractDataInternal(mType,
@ -133,33 +117,18 @@ public:
}
NS_ENSURE_SUCCESS(rv, rv);
rv = stream->Available(aImgSize);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(*aImgSize <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
rv = NS_ReadInputStreamToBuffer(stream, aImgData, *aImgSize);
NS_ENSURE_SUCCESS(rv, rv);
return rv;
}
NS_IMETHOD Run()
{
uint64_t imgSize;
void* imgData = nullptr;
rv = stream->Available(&imgSize);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(imgSize <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
nsresult rv = ProcessImageData(&imgSize, &imgData);
if (NS_FAILED(rv)) {
mEncodingCompleteEvent->SetFailed();
} else {
mEncodingCompleteEvent->SetMembers(imgData, imgSize, mType);
}
void* imgData = nullptr;
rv = NS_ReadInputStreamToBuffer(stream, &imgData, imgSize);
NS_ENSURE_SUCCESS(rv, rv);
mEncodingCompleteEvent->SetMembers(imgData, imgSize, mType);
rv = NS_DispatchToMainThread(mEncodingCompleteEvent, NS_DISPATCH_NORMAL);
if (NS_FAILED(rv)) {
// Better to leak than to crash.
mEncodingCompleteEvent.forget();
return rv;
}
NS_ENSURE_SUCCESS(rv, rv);
return rv;
}

View File

@ -154,18 +154,12 @@ HTMLCanvasElement::GetWidthHeight()
value->Type() == nsAttrValue::eInteger)
{
size.width = value->GetIntegerValue();
if (size.width <= 0) {
size.width = 1;
}
}
if ((value = GetParsedAttr(nsGkAtoms::height)) &&
value->Type() == nsAttrValue::eInteger)
{
size.height = value->GetIntegerValue();
if (size.height <= 0) {
size.height = 1;
}
}
return size;