Repository navigation
feat(browser): Let the extension reach local files, and say when it may not - #799
Merged
Merged
Conversation
…ay not
Chrome shows an extension's "Allow access to file URLs" switch only if it
could want file access; ours could not, so the switch never showed, and
through the debugger it could neither open a file:// page ("Navigating to
local URL is not allowed") nor give a file input its files ("Not allowed").
activeTab makes it one that could, with no install warning. The extension
says in its hello whether the switch is on: off, browser_open/navigate of a
file and upload tell the agent what the user has to turn on, and Settings →
Browser says so too. browser_open takes a local file's path as well.
Co-Authored-By: BaoCode <noreply@baocode.dev>
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.
Two things agents could not do through the extension: open a local HTML file, and upload files. Both need Chrome's per-extension "Allow access to file URLs", which Chrome only shows to an extension that could want file access (Chromium:
PermissionsParsersetswants_file_accessfor a file:// host pattern or foractiveTab). Ours had neither, so the switch never appeared.activeTab(no install warning, unlike a host permission), version 0.2.0fileAccess(chrome.extension.isAllowedFileSchemeAccess()); the extension reloads when the user flips it, and says hello againbrowser_open/browser_navigateof a file:// URL and theuploadaction tell the agent what the user has to turn on; Settings → Browser shows it as a status rowbrowser_opentakes a local file's path tooTested:
browser_bridge_test; live with the installed Chrome: opening a local file by its path, uploads (devtools live test), and with file access turned off (via developerPrivate) the hello'sfileAccess: false, the agent's message, and Chrome's own errors without the check ("Navigating to local URL is not allowed", "Not allowed").🤖 Generated with BaoCode