fix: crash on nativeImage on Windows on ARM (#25396)

* fix: nativeImage on WOA

* Remove old ldflag

* maybe this will work ¯\_(ツ)_/¯
This commit is contained in:
John Kleinschmidt 2020-09-10 14:42:41 -04:00 коммит произвёл GitHub
Родитель dd781c4f63
Коммит acf5d487d2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 9 добавлений и 13 удалений

Просмотреть файл

@ -1154,6 +1154,11 @@ if (is_mac) {
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
]
if (target_cpu == "arm64") {
configs -= [ "//build/config/win:cfi_linker" ]
ldflags += [ "/guard:cf,nolongjmp" ]
}
# This is to support renaming of electron.exe. node-gyp has hard-coded
# executable names which it will recognise as node. This module definition
# file claims that the electron executable is in fact named "node.exe",

Просмотреть файл

@ -173,13 +173,7 @@ describe('nativeImage module', () => {
const imageB = nativeImage.createFromBitmap(imageA.toBitmap(), imageA.getSize());
expect(imageB.getSize()).to.deep.equal({ width: 538, height: 190 });
let imageC;
// TODO fix nativeImage.createFromBuffer from bitmaps on WOA. See https://github.com/electron/electron/issues/25069
if (process.platform === 'win32' && process.arch === 'arm64') {
imageC = nativeImage.createFromBuffer(imageA.toPNG(), { ...imageA.getSize(), scaleFactor: 2.0 });
} else {
imageC = nativeImage.createFromBuffer(imageA.toBitmap(), { ...imageA.getSize(), scaleFactor: 2.0 });
}
const imageC = nativeImage.createFromBuffer(imageA.toBitmap(), { ...imageA.getSize(), scaleFactor: 2.0 });
expect(imageC.getSize()).to.deep.equal({ width: 269, height: 95 });
});
@ -192,8 +186,7 @@ describe('nativeImage module', () => {
});
});
// TODO fix nativeImage.createFromBuffer on WOA. See https://github.com/electron/electron/issues/25069
ifdescribe(!(process.platform === 'win32' && process.arch === 'arm64'))('createFromBuffer(buffer, options)', () => {
describe('createFromBuffer(buffer, options)', () => {
it('returns an empty image when the buffer is empty', () => {
expect(nativeImage.createFromBuffer(Buffer.from([])).isEmpty()).to.be.true();
});
@ -347,8 +340,7 @@ describe('nativeImage module', () => {
});
describe('createFromPath(path)', () => {
// TODO fix nativeImage.createFromPath on WOA. See https://github.com/electron/electron/issues/25069
ifit(!(process.platform === 'win32' && process.arch === 'arm64'))('returns an empty image for invalid paths', () => {
it('returns an empty image for invalid paths', () => {
expect(nativeImage.createFromPath('').isEmpty()).to.be.true();
expect(nativeImage.createFromPath('does-not-exist.png').isEmpty()).to.be.true();
expect(nativeImage.createFromPath('does-not-exist.ico').isEmpty()).to.be.true();
@ -520,8 +512,7 @@ describe('nativeImage module', () => {
});
describe('addRepresentation()', () => {
// TODO fix nativeImage.createFromBuffer on WOA. See https://github.com/electron/electron/issues/25069
ifit(!(process.platform === 'win32' && process.arch === 'arm64'))('does not add representation when the buffer is too small', () => {
it('does not add representation when the buffer is too small', () => {
const image = nativeImage.createEmpty();
image.addRepresentation({