mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 809587 - Increment the JS malloc counter when doing canvas.toBlob(). r=khuey
This commit is contained in:
parent
1105101292
commit
d267acb3ce
@ -622,6 +622,11 @@ nsHTMLCanvasElement::ToBlob(nsIFileCallback* aCallback,
|
||||
nsRefPtr<nsDOMMemoryFile> blob =
|
||||
new nsDOMMemoryFile(imgData, imgSize, type);
|
||||
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (cx) {
|
||||
JS_updateMallocCounter(cx, imgSize);
|
||||
}
|
||||
|
||||
nsRefPtr<ToBlobRunnable> runnable = new ToBlobRunnable(aCallback, blob);
|
||||
return NS_DispatchToCurrentThread(runnable);
|
||||
}
|
||||
@ -667,6 +672,11 @@ nsHTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
|
||||
rv = NS_ReadInputStreamToBuffer(stream, &imgData, (uint32_t)imgSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (cx) {
|
||||
JS_updateMallocCounter(cx, imgSize);
|
||||
}
|
||||
|
||||
// The DOMFile takes ownership of the buffer
|
||||
nsRefPtr<nsDOMMemoryFile> file =
|
||||
new nsDOMMemoryFile(imgData, (uint32_t)imgSize, aName, type);
|
||||
|
Loading…
Reference in New Issue
Block a user