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
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)) {