refactor: correctly serialize nativeImage/buffer with typeUtils (#23666)

* refactor: correctly serialize nativeImage/buffer with typeUtils

* test: add serialization specs

* fix: construct from dataURL

* test: test for dataURL specificity
This commit is contained in:
Shelley Vohr 2020-05-20 13:42:42 -07:00 committed by GitHub
parent 33d6a99d40
commit 4b23a85475
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 166 additions and 16 deletions

View file

@ -41,7 +41,8 @@ function wrapArgs (args, visited = new Set()) {
for (const scaleFactor of value.getScaleFactors()) {
const size = value.getSize(scaleFactor);
const buffer = value.toBitmap({ scaleFactor });
images.push({ buffer, scaleFactor, size });
const dataURL = value.toDataURL({ scaleFactor });
images.push({ buffer, scaleFactor, size, dataURL });
}
return { type: 'nativeimage', value: images };
} else if (Array.isArray(value)) {