-
Notifications
You must be signed in to change notification settings - Fork 16.5k
Description
- Output of
node_modules/.bin/electron --version
: v4.0.2 - Operating System (Platform and Version): OSX 10.14.1
- Output of
node_modules/.bin/electron --version
on last known working Electron version (if applicable):
Expected Behavior
dialog.showOpenDialog({
...
securityScopedBookmarks: <true> or <false>
})
MAS build
securityScopedBookmarks: false ==> bookmarks === []
securityScopedBookmarks: true
- Success:
bookmarks === ["SLKDJFLKSDJLSJDLFJSLKJFLS..SJLD"]
- Error:
bookmarks === ['']
Actual behavior
I get all sorts of unexpected behaviors. Note all of these are THE EXACT SAME CALLS.
- On my development machine
- If I do a showOpenDialog() via a renderer window
- At first, it returns
[]
- Then I try it via a main process
- Then I try again, and I get bookmarks back
- At first, it returns
- In main window
- I always get
bookmarks === []
- For
securityScopedBookmarks: true
this is wrong! I should getbookmarks === ['validbookmark']
orbookmarks === [""]
(ie: empty / error)
- For
- I always get
- In renderer, after trying it in main, I get valid bookmarks returned
- EVEN IF I SET
securityScopedBookmarks: false
- EVEN IF I SET
- If I do a showOpenDialog() via a renderer window
- On a clean virtual machine, I always get
bookmarks === []
Here is an example of the output of my test - I am getting a bookmark returned even when securityScopedBookmars is set to false!
ShowOpenDialog Results:
securityScopedBookmarks setting: false
isMas: true
filePaths: |/Users|
bookmarks: |Ym9va/wBAAAAAAQQMAAAADhIsl+6AwP9UEecjjev0G5JVbcbiOTvz+X/GU0cUJ3vHAEAAAQAAAADAwAAAAgAKAUAAAABAQAAVXNlcnMAAAAEAAAAAQYAABAAAAAIAAAABAMAACrJCQAAAAAABAAAAAEGAAAsAAAACAAAAAAEAABBvxq0KQAAABgAAAABAgAAAgAAAAAAAAAPAAAAAAAAAAAAAAAAAAAACAAAAAEJAABmaWxlOi8vLwwAAAABAQAATWFjaW50b3NoIEhECAAAAAQDAAAA4AHj6AAAAAgAAAAABAAAQb/byy9eqf0kAAAAAQEAADIwODk1QzIxLUVFRDItNEU3MS1BNzQ2LTBFMUVFMzgwMjFBQhgAAAABAgAAgQAAAAEAAADvEwAAAQAAAAAAAAAAAAAAAQAAAAEBAAAvAAAAAAAAAAEFAACoAAAA/v///wEAAAAAAAAADQAAAAQQAAAgAAAAAAAAAAUQAAA8AAAAAAAAABAQAABYAAAAAAAAAEAQAABIAAAAAAAAAAIgAAAIAQAAAAAAAAUgAAB4AAAAAAAAABAgAACIAAAAAAAAABEgAAC8AAAAAAAAABIgAACcAAAAAAAAABMgAACsAAAAAAAAACAgAADoAAAAAAAAADAgAAAUAQAAAAAAABDQAAAEAAAAAAAAAA==|
typeof bookmarks: object
isArray: true
length: 1
bookmarks ==== [""]: false
And here it is in a main process call (same app with same entitlements, provisioning profile, etc.). This one SHOULD succeed.
ShowOpenDialog Results:
securityScopedBookmarks setting: true
isMas: true
filePaths: |/Users|
bookmarks: ||
typeof bookmarks: object
isArray: true
length: 0
bookmarks ==== [""]: false
To Reproduce
Repo: https://github.com/rr326/ElectronSecurityScopedBookmarkTest
Instructions on the README
Additional Information
I have done EXTENSIVE testing to narrow this down. I assumed it was codesiging, or identities, or a provisioning profile, or even my virtual machine. It isn't.
For someone with a Mac setup, this repo will make it easy to test.
Also, looking at the code, the results I am seeing should not happen. It shouldn't even be possible! But I don't know C++ and also can't get Electron to build, so I'm at a dead end. The only thing I can imagine is somehow the settings to showOpenDialog()
are getting overwritten or changed somehow.
See the code here:
atom/browser/ui/file_dialog_mac.mm. Particularly OpenDialogComplettion and GetBookMarkDataFromNSURL
One strange thing - there are TWO ShowOpenDialog()
in this file. Is that ok?