Skip to content
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

Can't open custom entry point from the list of available ones #6438

Closed
2 tasks
vitvakatu opened this issue Apr 26, 2023 · 7 comments · Fixed by #6507
Closed
2 tasks

Can't open custom entry point from the list of available ones #6438

vitvakatu opened this issue Apr 26, 2023 · 7 comments · Fixed by #6507
Assignees
Labels
--bug Type: bug d-intermediate Difficulty: some prior knowledge required g-electron GUI: electron application specific p-low Low priority

Comments

@vitvakatu
Copy link
Contributor

vitvakatu commented Apr 26, 2023

Discord username

No response

What type of issue is this?

Permanent – Occurring repeatably

Is this issue blocking you from using Enso?

  • Yes, I can't use Enso because of this issue.

Is this a regression?

  • Yes, previous version of Enso did not have this issue.

What issue are you facing?

When running IDE with a non-existing startup.entry (like _ or foo), I see the list of available entry points.

After clicking on some of the entries, I see an error message like in #5786

Screenshot 2023-04-26 at 18 43 32

However, this time IDE crashes.

Logs:

❯ dist/ide/mac-arm64/Enso.app/Contents/MacOS/Enso -startup.entry=_
The single argument '-startup.entry=_' does not denote a readable file: Error: ENOENT: no such file or directory, access '-startup.entry=_'
╭ Setting Chrome options
│ Setting '--disable-gpu-sandbox' because 'performance.disableGpuSandbox' was enabled.
│ Setting '--disable-gpu-vsync' because 'performance.disableGpuVsync' was enabled.
│ Setting '--no-sandbox' because 'performance.disableSandbox' was enabled.
│ Setting '--disable-smooth-scrolling' because 'performance.disableSmoothScrolling' was enabled.
│ Setting '--enable-native-gpu-memory-buffers' because 'performance.enableNativeGpuMemoryBuffers' was enabled.
│ Setting '--force_high_performance_gpu' because 'performance.forceHighPerformanceGpu' was enabled.
│ Setting '--ignore-gpu-blocklist' because 'performance.ignoreGpuBlocklist' was enabled.
│ See '-help-extended' to learn why these options were enabled.
╰ Done in 0.8 ms.
╭ Starting the application
│ ╭ Starting the backend process with the following options: .
│ │ Backend has been spawned (pid = 41637).
│ ╰ Done in 3.5 ms.
│ ╭ Starting the content server.
│ │ Server started on port 8080.
│ │ Serving files from '/Users/ilyabogdanov/projects/enso/Users/ilyabogdanov/projects/enso/dist/ide/mac-arm64/Enso.app/Contents/Resources/app.asar/assets'.
│ ╰ Done in 7.6 ms.
│ ╭ Creating the window.
│ ╰ Done in 29.4 ms.
│ Loading the window address 'http://localhost:8080?startup.entry=_&startup.platform=darwin&engine.preferredVersion=2023.1.1-nightly.2023.4.26'.
╰ Done in 51.9 ms.
[info] [2023-04-26T14:39:34.156Z] [org.enso.projectmanager.boot.ProjectManager$] Starting Project Manager...
[info] [2023-04-26T14:39:34.176Z] [org.enso.projectmanager.boot.ProjectManager$] Started server at 127.0.0.1:30535, press enter to kill server
Uncaught exception: ReferenceError: origin is not defined
Exception origin: uncaughtException
[warn] [2023-04-26T14:39:39.519Z] [org.enso.projectmanager.boot.ProjectManager$] Failed to read line.
[info] [2023-04-26T14:39:39.519Z] [org.enso.projectmanager.boot.ProjectManager$] Stopping server...
[info] [2023-04-26T14:39:39.52Z] [akka.actor.CoordinatedShutdown] Running CoordinatedShutdown with reason [ActorSystemTerminateReason]

Opening an entry point directly with -startup.entry=interface works fine for any entry point.

Expected behaviour

I should be able to open an entry point.

How we can reproduce it?

No response

Screenshots or screencasts

No response

Enso Version

dcfbf84

Browser or standalone distribution

Standalone distribution

Browser Version or standalone distribution

dcfbf84

Operating System

MacOS

Operating System Version

MacOS Ventura 13.3.1 (22E261)

Hardware you are using

No response

@MichaelMauderer
Copy link
Contributor

Can reproduce this on a Linux machine. But this only seems to occur in the Electron app. When doing the same in a browser, it seems to work without issue.

@MichaelMauderer MichaelMauderer moved this from ❓New to 📤 Backlog in Issues Board Apr 27, 2023
@MichaelMauderer MichaelMauderer added -build-script Category: build script g-electron GUI: electron application specific and removed -build-script Category: build script labels Apr 27, 2023
@MichaelMauderer MichaelMauderer added d-intermediate Difficulty: some prior knowledge required and removed triage labels Apr 27, 2023
@somebody1234
Copy link
Contributor

the error line info indicates the bug happens here (parsedUrl.origin !== origin):

function preventNavigation() {
electron.app.on('web-contents-created', (_event, contents) => {
contents.on('will-navigate', (event, navigationUrl) => {
const parsedUrl = new URL(navigationUrl)
if (parsedUrl.origin !== origin && !TRUSTED_HOSTS.includes(parsedUrl.host)) {
event.preventDefault()
console.error(`Prevented navigation to '${navigationUrl}'.`)
}
})
})
}

not 100% sure what specifically causes the bug, since origin is defined in electron, and parsedUrl would throw if it was an invalid url, so that shouldn't be it either

@somebody1234
Copy link
Contributor

so it seems like window, alert, origin etc are all missing for some reason...

@somebody1234
Copy link
Contributor

oh, maybe security.ts is running on the main process, not in a window

@somebody1234
Copy link
Contributor

not sure if there's a way to figure out the origin without being in a window. i can think of a couple of solutions but none of them aren't A Bad Idea:tm:

  • it's theoretically possible to pass the port from the server to this file (app/ide-desktop/lib/client/src/bin/server.ts)
  • alternatively, send a message containing the origin via IPC from the window - but make sure the console side (?) only accepts the first such message

note for whoever wants to tackle this, the URLs will need to be updated (heading number incremented) so might as well do that at the same time:
(only these three URLs though)

 * https://www.electronjs.org/docs/tutorial/security#12-verify-webview-options-before-creation. */
 * https://www.electronjs.org/docs/tutorial/security#13-disable-or-limit-navigation. */
 * https://www.electronjs.org/docs/tutorial/security#14-disable-or-limit-creation-of-new-windows. */

@farmaazon farmaazon added the p-low Low priority label May 2, 2023
@somebody1234
Copy link
Contributor

the same cause is also affecting the dashboard: cloud-v2#413

@PabloBuchu
Copy link
Contributor

@vitvakatu you may want to QA this PR #6507 which should fix the problem and we can merge it

@github-project-automation github-project-automation bot moved this from 📤 Backlog to 🟢 Accepted in Issues Board May 5, 2023
@farmaazon farmaazon moved this from 🟢 Accepted to 🗄️ Archived in Issues Board May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--bug Type: bug d-intermediate Difficulty: some prior knowledge required g-electron GUI: electron application specific p-low Low priority
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants