зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1576463 - canvas toDataURL and toBlob should not throw for serialization errors, r=jya
Differential Revision: https://phabricator.services.mozilla.com/D45121 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d5f8e358d2
Коммит
91b2277029
|
@ -106,6 +106,8 @@ class EncodingCompleteEvent : public CancelableRunnable {
|
|||
MOZ_ASSERT(blob);
|
||||
|
||||
rv = callback->ReceiveBlob(blob.forget());
|
||||
} else {
|
||||
rv = callback->ReceiveBlob(nullptr);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -35,10 +35,15 @@ void CanvasRenderingContextHelper::ToBlob(
|
|||
nsresult ReceiveBlob(already_AddRefed<Blob> aBlob) override {
|
||||
RefPtr<Blob> blob = aBlob;
|
||||
|
||||
RefPtr<Blob> newBlob = Blob::Create(mGlobal, blob->Impl());
|
||||
RefPtr<Blob> newBlob;
|
||||
|
||||
if (blob) {
|
||||
newBlob = Blob::Create(mGlobal, blob->Impl());
|
||||
}
|
||||
|
||||
RefPtr<BlobCallback> callback(mBlobCallback.forget());
|
||||
ErrorResult rv;
|
||||
|
||||
callback->Call(newBlob, rv);
|
||||
|
||||
mGlobal = nullptr;
|
||||
|
|
|
@ -603,7 +603,10 @@ void HTMLCanvasElement::ToDataURL(JSContext* aCx, const nsAString& aType,
|
|||
return;
|
||||
}
|
||||
|
||||
aRv = ToDataURLImpl(aCx, aSubjectPrincipal, aType, aParams, aDataURL);
|
||||
nsresult rv = ToDataURLImpl(aCx, aSubjectPrincipal, aType, aParams, aDataURL);
|
||||
if (NS_FAILED(rv)) {
|
||||
aDataURL.AssignLiteral("data:,");
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLCanvasElement::SetMozPrintCallback(PrintCallback* aCallback) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче