Replace HTML preview webview with iframe#9942
Open
jackkav wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the HTML response preview implementation from an Electron <webview> (requiring webviewTag: true) to a sandboxed <iframe> using srcDoc, while keeping the existing base-URL injection behavior and adding focused unit tests for the new helper logic.
Changes:
- Replace
<webview>-based HTML preview with a sandboxed<iframe srcDoc>. - Extract helper functions for base tag injection and sandbox token selection, and add unit tests for them.
- Remove
webviewTag: truefrom the main window’swebPreferences.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/insomnia/src/ui/components/viewers/response-web-view.tsx | Replace <webview> with <iframe>, add helper functions for injected HTML and sandbox config. |
| packages/insomnia/src/ui/components/viewers/response-web-view.test.ts | Add unit tests covering base-tag injection and sandbox token logic. |
| packages/insomnia/src/ui/components/viewers/response-viewer.tsx | Update ResponseWebView usage to pass disableHtmlPreviewJs instead of webpreferences. |
| packages/insomnia/src/main/window-utils.ts | Remove webviewTag: true from BrowserWindow webPreferences. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+9
to
+10
| export const getResponsePreviewHtml = (body: string, url: string) => body.replace('<head>', `<head><base href="${url}">`); | ||
|
|
Comment on lines
+11
to
+12
| export const getResponsePreviewSandbox = (disableHtmlPreviewJs: boolean) => | ||
| disableHtmlPreviewJs ? '' : 'allow-scripts'; |
✅ Circular References ReportGenerated at: 2026-05-21T08:08:52.371Z Summary
Click to view all circular references in PR (19)Click to view all circular references in base branch (19)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
webviewwith a sandboxediframeusingsrcDocwebviewTag: truerequirement and add focused coverage for the preview helpersNotes
response-web-viewtest passedtype-checkscript still reports existing unrelated baseline issues insrc/main/ipc/grpc.tsandsrc/ui/components/keydown-binder.ts