-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider Electron version and update checks according to new defaults (#23, #58) #66
Changes from all commits
ba67bd8
85896b8
29a8627
3d1beb7
6c864b9
5278088
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"0.1.0": { | ||
"allowRunningInsecureContent": false, | ||
"contextIsolation": false, | ||
"enableRemoteModule": true, | ||
"experimentalFeatures": false, | ||
"images": true, | ||
"javascript": true, | ||
"nativeWindowOpen": false, | ||
"navigateOnDragDrop": false, | ||
"nodeIntegration": true, | ||
"nodeIntegrationInWorker": false, | ||
"offscreen": false, | ||
"plugins": false, | ||
"safeDialogs": false, | ||
"sandbox": false, | ||
"spellcheck": true, | ||
"textAreasAreResizable": true, | ||
"webSecurity": true, | ||
"webgl": true, | ||
"webviewTag": true | ||
}, | ||
"5.0.0": { | ||
"allowRunningInsecureContent": false, | ||
"contextIsolation": false, | ||
"enableRemoteModule": true, | ||
"experimentalFeatures": false, | ||
"images": true, | ||
"javascript": true, | ||
"nativeWindowOpen": false, | ||
"navigateOnDragDrop": false, | ||
"nodeIntegration": false, | ||
"nodeIntegrationInSubFrames": false, | ||
"nodeIntegrationInWorker": false, | ||
"offscreen": false, | ||
"plugins": false, | ||
"safeDialogs": false, | ||
"sandbox": false, | ||
"spellcheck": true, | ||
"textAreasAreResizable": true, | ||
"webSecurity": true, | ||
"webgl": true, | ||
"webviewTag": false | ||
}, | ||
"10.0.0": { | ||
"allowRunningInsecureContent": false, | ||
"contextIsolation": false, | ||
"enableRemoteModule": false, | ||
"enableWebSQL": true, | ||
"experimentalFeatures": false, | ||
"images": true, | ||
"javascript": true, | ||
"nativeWindowOpen": false, | ||
"navigateOnDragDrop": false, | ||
"nodeIntegration": false, | ||
"nodeIntegrationInSubFrames": false, | ||
"nodeIntegrationInWorker": false, | ||
"offscreen": false, | ||
"plugins": false, | ||
"safeDialogs": false, | ||
"sandbox": false, | ||
"spellcheck": true, | ||
"textAreasAreResizable": true, | ||
"webSecurity": true, | ||
"webgl": true, | ||
"webviewTag": false | ||
} | ||
} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,12 @@ describe('Loader classes', () => { | |
|
||
it('extracts file from ASAR', () => { | ||
loader.load(test_files.get('asar')); | ||
loader.list_files.size.should.equal(60); | ||
loader.list_files.size.should.equal(61); | ||
}); | ||
|
||
it('finds Electron version number in package.json', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to have some other tests checking e.g. if the minimum v0.1.0 fallback is actually used when the version can't be found, but we can add this a later PR too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I definitely agree but I'll have to leave this to someone else. |
||
loader.load(test_files.get('asar')); | ||
loader.electronVersion.should.equal('6.1.11'); | ||
}); | ||
}), | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally creating something that dynamically confirms if these security flags are set correctly and working as intended would be preferable, but I can see how using
getWebPreferences()
is a lot easier in our case. I would settle for this defaults file as of now, maybe planning a more comprehensive version for a next release. Things currently missing that could be useful for future checks:enableRemoteModule
(Default should be true)safeDialogs
(Default should be false)navigateOnDragDrop
(Default should be false)spellCheck
(Default should be true)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add those manually for now.
As per this,
enableRemoteModule
will default tofalse
from version 10.0.0, so I will also include a dump from the latest beta of 10. I'll also update the remote module check accordingly.The other prefs don't seem to have ever had their default changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh. This also revealed a bug that should have been obvious in hindsight. :D
(Lexicographically) sorting the version keys using
.sort()
of course produces the wrong result as soon as we get into the double digit major versions. I'll correct this to usesemver
'scompare()
as the correct compare function instead.