-
Notifications
You must be signed in to change notification settings - Fork 2
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
Finish shimming require & others in extension host #213
Conversation
a7d80d2
to
2594d96
Compare
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.
Looks awesome! So excited to have this out of the way. It has been nagging my brain for months now. Glad it was this easy. Just one request.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @irahopkinson)
src/extension-host/services/extension.service.ts
line 224 at r1 (raw file):
// Replace fetch with papi.fetch. // eslint-disable-next-line no-global-assign globalThis.fetch = papi.fetch;
Thanks for making this change! Cool :)
Could you please also make this change for web views so the frontend can also now use fetch
appropriately?
Probably would just be replacing this line with window.fetch = papi.fetch;
I guess filing an issue would also be ok.
- try imports in 'evil' extension - don't need to put require and others back since the extension host is in its own process - replace `fetch` with `papi.fetch` - also remove `.promise` after #202
2594d96
to
8fa705c
Compare
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.
Reviewable status: 3 of 4 files reviewed, 1 unresolved discussion (waiting on @tjcouch-sil)
src/extension-host/services/extension.service.ts
line 224 at r1 (raw file):
Previously, tjcouch-sil (TJ Couch) wrote…
Thanks for making this change! Cool :)
Could you please also make this change for web views so the frontend can also now use
fetch
appropriately?Probably would just be replacing this line with
window.fetch = papi.fetch;
I guess filing an issue would also be ok.
Done. Thanks for remembering that needed changing too.
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.
Thanks for the hard work on this!
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @irahopkinson)
src/extension-host/services/extension.service.ts
line 224 at r1 (raw file):
Previously, irahopkinson (Ira Hopkinson) wrote…
Done. Thanks for remembering that needed changing too.
No prob! If you wouldn't mind, could you please temporarily change hello-world.web-view.tsx
to use fetch
instead of papi.fetch
, put a breakpoint in internet.service.ts
on line 10 inside the papiFetch
in DevTools in the renderer, and see if it hits just to be absolutely sure the shim worked? I think it did; just want a sanity check to be certain.
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @irahopkinson)
src/extension-host/services/extension.service.ts
line 224 at r1 (raw file):
Previously, tjcouch-sil (TJ Couch) wrote…
No prob! If you wouldn't mind, could you please temporarily change
hello-world.web-view.tsx
to usefetch
instead ofpapi.fetch
, put a breakpoint ininternet.service.ts
on line 10 inside thepapiFetch
in DevTools in the renderer, and see if it hits just to be absolutely sure the shim worked? I think it did; just want a sanity check to be certain.
Yep, I tried that and it stopped on the breakpoint. I checked the compiled JS and despite the source calling fetch
the compile code still has papi.fetch
, because of the assignment of window.fetch = papi.fetch;
, which in hindsight should be expected.
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.
Reviewable status: complete! all files reviewed, all discussions resolved
src/extension-host/services/extension.service.ts
line 224 at r1 (raw file):
Previously, irahopkinson (Ira Hopkinson) wrote…
Yep, I tried that and it stopped on the breakpoint. I checked the compiled JS and despite the source calling
fetch
the compile code still haspapi.fetch
, because of the assignment ofwindow.fetch = papi.fetch;
, which in hindsight should be expected.
Hmm actually I would expect the built hello-world.web-view.tsx
not to have papi.fetch
in it if you removed it because the web view doesn't know that code got shimmed in. In the web view's perspective, it's just calling fetch. Do you know if it didn't build for some reason or something...?
- try imports in 'evil' extension - don't need to put require and others back since the extension host is in its own process - replace `fetch` with `papi.fetch` - also remove `.promise` after #202
fetch
withpapi.fetch
.promise
after Replace {unsubscriber, promise} with Promise<UnsubscriberAsync> #202This change is