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

Use vscode-file:// instead of file:// #101837

Closed
wants to merge 55 commits into from
Closed

Use vscode-file:// instead of file:// #101837

wants to merge 55 commits into from

Conversation

alexdima
Copy link
Member

@alexdima alexdima commented Jul 7, 2020

Fixes #98682

@alexdima
Copy link
Member Author

alexdima commented Jul 7, 2020

@deepak1556 👍 This now looks OK from my side. I was able to eliminate the change in loader.js and hide it behind a setting preferScriptTags. I could also eliminate the need to enumerate all our nodeModules, and now there is a new loader option called amdModulesPattern that is a regex that helps distinguish which modules are AMD and which modules are nodejs. I've also adopted this last option on master, so there are no conflicts, etc. I suggest you further involve @bpasero to review, there is still some ugly string math in this PR and @jrieken for guidance on how to validate that the times are not regressing.

LMK if there's anything more needed from my side.

@deepak1556 deepak1556 added this to the July 2020 milestone Jul 7, 2020
@deepak1556
Copy link
Collaborator

Thanks @alexdima

Todo:

  • Fix tests
  • Enable v8CacheOption
  • Run perf bot against this branch

@jrieken
Copy link
Member

jrieken commented Jul 8, 2020

Assuming this is still starting the renderer from src/vs/code/electron-browser/workbench/workbench.js then you can check these two perf marks: willLoadWorkbenchMain and didLoadWorkbenchMain. They are printed in the "F1 > Startup Performance" editor like so:

Screenshot 2020-07-08 at 08 51 29

On my dev box times are ~480ms without cached data and ~280ms with cached data. Cached data files are stored in <data_dir>/CachedData/<version_hash> and for the workbench main file there should be around 9MB of cached data.

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments inline. On top of that, there are window.loadURL calls missing from this change:

  • issue reporter
  • process explorer
  • auth dialog?

src/main.js Outdated Show resolved Hide resolved
src/vs/code/electron-main/sharedProcess.ts Outdated Show resolved Hide resolved
src/vs/code/electron-main/window.ts Outdated Show resolved Hide resolved
src/main.js Outdated Show resolved Hide resolved
@bpasero bpasero self-requested a review July 20, 2020 13:49
Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some more feedback. Maybe we could do an iterative approach where this is being enabled first for:

  • auth dialog
  • issue reporter
  • process explorer

It looks like the adoption is missing for these still.

src/vs/code/electron-main/sharedProcess.ts Outdated Show resolved Hide resolved
src/vs/code/electron-main/window.ts Outdated Show resolved Hide resolved
src/main.js Show resolved Hide resolved
src/main.js Show resolved Hide resolved
src/main.js Outdated Show resolved Hide resolved
src/main.js Outdated Show resolved Hide resolved
src/main.js Outdated Show resolved Hide resolved
src/main.js Outdated Show resolved Hide resolved
src/bootstrap-window.js Outdated Show resolved Hide resolved
@alexdima
Copy link
Member Author

Just to clarify, I created the PR to be able to leave comments...

@deepak1556 I expect that you will address the comments :).

@deepak1556
Copy link
Collaborator

Sorry for the silence here, I was mostly focusing on Electron 9 last week. Gonna prioritize this PR from today.

@bpasero
Copy link
Member

bpasero commented Sep 24, 2020

More work:

  • bcfc1a9 and 81ec8ec move the logic of URI conversion fully into LocalFileAccessImpl with some new behaviour: if the file path contains a authority we take it as is instead of adding our own (I renamed app to vscode-app). This helps preserving the authority for Windows UNC paths
  • 3fe9d3f adds tests

I am running another build to check if this fixes UNC support 🤞

@bpasero
Copy link
Member

bpasero commented Sep 24, 2020

I cannot get UNC loading to work and start to think this could be an Electron issue, reported as electron/electron#25618

@bpasero
Copy link
Member

bpasero commented Sep 24, 2020

With f5513f0, webview should work. Since preload script only supports file protocol, I am explicitly restoring the URL for that piece.

//cc @mjbvz I am not sure if there are other dependencies to file URI in webview land. The thing that will change with this PR is that require.toUrl, as well as the related method getUriFromAmdModule in amd.ts will no longer return a file:// URI but a vscode-file:// URI if called from within a renderer.

@mjbvz
Copy link
Collaborator

mjbvz commented Sep 24, 2020

@bpasero Thanks. I think this is all that is needed for webviews. All other resources are loaded in the webviews themselves. Webviews do not allow using file: urls and instead load local resources using the vcsode-webview-resource scheme

Once we move to iframe based webviews, we no longer need to use a preload script either

@bpasero
Copy link
Member

bpasero commented Sep 25, 2020

@mjbvz thank you for confirming 👍

@bpasero
Copy link
Member

bpasero commented Sep 25, 2020

Given the size of this PR and stale comments, I decided to move the FileAccess work to master with a no-op implementation and the changes that we still need into #107437. The discussion should continue there.

@bpasero bpasero closed this Sep 25, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2020
@bpasero bpasero deleted the robo/vscode-file branch January 6, 2021 14:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove dependency on node require for startup code path
6 participants