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:
		
					parent
					
						
							
								dd781c4f63
							
						
					
				
			
			
				commit
				
					
						acf5d487d2
					
				
			
		
					 2 changed files with 9 additions and 13 deletions
				
			
		
							
								
								
									
										5
									
								
								BUILD.gn
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								BUILD.gn
									
										
									
									
									
								
							|  | @ -1154,6 +1154,11 @@ if (is_mac) { | ||||||
|         "/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll", |         "/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 |       # This is to support renaming of electron.exe. node-gyp has hard-coded | ||||||
|       # executable names which it will recognise as node. This module definition |       # executable names which it will recognise as node. This module definition | ||||||
|       # file claims that the electron executable is in fact named "node.exe", |       # 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()); |       const imageB = nativeImage.createFromBitmap(imageA.toBitmap(), imageA.getSize()); | ||||||
|       expect(imageB.getSize()).to.deep.equal({ width: 538, height: 190 }); |       expect(imageB.getSize()).to.deep.equal({ width: 538, height: 190 }); | ||||||
| 
 | 
 | ||||||
|       let imageC; |       const imageC = nativeImage.createFromBuffer(imageA.toBitmap(), { ...imageA.getSize(), scaleFactor: 2.0 }); | ||||||
|       // 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 }); |  | ||||||
|       } |  | ||||||
|       expect(imageC.getSize()).to.deep.equal({ width: 269, height: 95 }); |       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
 |   describe('createFromBuffer(buffer, options)', () => { | ||||||
|   ifdescribe(!(process.platform === 'win32' && process.arch === 'arm64'))('createFromBuffer(buffer, options)', () => { |  | ||||||
|     it('returns an empty image when the buffer is empty', () => { |     it('returns an empty image when the buffer is empty', () => { | ||||||
|       expect(nativeImage.createFromBuffer(Buffer.from([])).isEmpty()).to.be.true(); |       expect(nativeImage.createFromBuffer(Buffer.from([])).isEmpty()).to.be.true(); | ||||||
|     }); |     }); | ||||||
|  | @ -347,8 +340,7 @@ describe('nativeImage module', () => { | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   describe('createFromPath(path)', () => { |   describe('createFromPath(path)', () => { | ||||||
|     // TODO fix nativeImage.createFromPath on WOA.  See https://github.com/electron/electron/issues/25069
 |     it('returns an empty image for invalid paths', () => { | ||||||
|     ifit(!(process.platform === 'win32' && process.arch === 'arm64'))('returns an empty image for invalid paths', () => { |  | ||||||
|       expect(nativeImage.createFromPath('').isEmpty()).to.be.true(); |       expect(nativeImage.createFromPath('').isEmpty()).to.be.true(); | ||||||
|       expect(nativeImage.createFromPath('does-not-exist.png').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(); |       expect(nativeImage.createFromPath('does-not-exist.ico').isEmpty()).to.be.true(); | ||||||
|  | @ -520,8 +512,7 @@ describe('nativeImage module', () => { | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   describe('addRepresentation()', () => { |   describe('addRepresentation()', () => { | ||||||
|     // TODO fix nativeImage.createFromBuffer on WOA.  See https://github.com/electron/electron/issues/25069
 |     it('does not add representation when the buffer is too small', () => { | ||||||
|     ifit(!(process.platform === 'win32' && process.arch === 'arm64'))('does not add representation when the buffer is too small', () => { |  | ||||||
|       const image = nativeImage.createEmpty(); |       const image = nativeImage.createEmpty(); | ||||||
| 
 | 
 | ||||||
|       image.addRepresentation({ |       image.addRepresentation({ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 John Kleinschmidt
				John Kleinschmidt