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
[Bug]: showItemInFolder hangs macOS Finder for about a minute #38540
Comments
Hello @nesvet. Thanks for reporting this and helping to make Electron better! Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use. Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests. Now adding the |
@nesvet As documented here: https://www.electronjs.org/docs/latest/api/shell, shell is only available in a non-sandboxed renderer. If you are seeing this issue in a non-sandboxed renderer please provide a gist testcase. |
@jkleinsc Hi! Sure, here it is: https://gist.github.com/Nesvet/8700b509a57043453b1e6e027cc0c85e |
Looks like this happened here: v25.0.0-nightly.20230330...v25.0.0-nightly.20230331 - likely 3fa0397 |
Having the same problem Simple test case: // index.js
const electron = require('electron');
electron.app.whenReady().then(() => {
const mainWindow = new electron.BrowserWindow({
webPreferences: {
contextIsolation: false,
nodeIntegration: true,
},
});
mainWindow.loadURL('data:text/html;charset=utf-8,<html></html>');
});
|
This feels like a pretty serious bug. Is there a workaround in the meantime ? |
Maybe to disable nodeIntegration |
Here's my workaround, which runs AppleScript behind the scenes:
|
We define the function in main process now and invoke it from renderer. This can be done through https://www.npmjs.com/package/@electron/remote or IPC. |
I see... I'l do this from now on. I've disabled remote myself for security reasons so am using IPC, but it's working great and would consider this issue closed. The code for those wondering: In main:
In renderer:
Because it's easy for devs to miss this even if electron produces security warnings, I'd suggest that electron should throw a top-level error if these kinds of API calls are made in a sandboxed environment, if it doesn't already. |
Preflight Checklist
Electron Version
25.0.1
What operating system are you using?
macOS
Operating System Version
macOS Ventura 13.4
What arch are you using?
x64
Last Known Working Electron version
24.4.0
Expected Behavior
This should open the folder and highlight the file in it
Actual Behavior
In renderer process it leads to Finder's "Not Responding" state for about a minute, and then it show the file. Meanwhile in main process it works as expected
Testcase Gist URL
https://gist.github.com/Nesvet/8700b509a57043453b1e6e027cc0c85e
Additional Information
No response
The text was updated successfully, but these errors were encountered: