зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1415081 - part 7 - Fix the use of NS_ReadInputStreamToString in HTMLCanvasElement, r=smaug
This commit is contained in:
Родитель
fbd0acbfa7
Коммит
fc0aff8605
|
@ -961,20 +961,15 @@ HTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint64_t imgSize;
|
||||
rv = stream->Available(&imgSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(imgSize <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
|
||||
|
||||
void* imgData = nullptr;
|
||||
rv = NS_ReadInputStreamToBuffer(stream, &imgData, (uint32_t)imgSize);
|
||||
rv = NS_ReadInputStreamToBuffer(stream, &imgData, -1, &imgSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(OwnerDoc()->GetScopeObject());
|
||||
|
||||
// The File takes ownership of the buffer
|
||||
RefPtr<File> file =
|
||||
File::CreateMemoryFile(win, imgData, (uint32_t)imgSize, aName, type,
|
||||
PR_Now());
|
||||
File::CreateMemoryFile(win, imgData, imgSize, aName, type, PR_Now());
|
||||
|
||||
file.forget(aResult);
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче