Repository navigation
fix: direct WebToEpub link missing host permission - #3149
Open
matthewsong18 wants to merge 1 commit into
Open
matthewsong18 wants to merge 1 commit into
matthewsong18 wants to merge 1 commit into
Conversation
Opening popup.html from a bookmark or homepage ran the toolbar launcher, which opened a second tab and tried to inject into the first one. Firefox rejected that injection with a missing host permission error. Detect when WebToEpub is already open in a browser tab and initialize the interface there. Only import a source page when the URL supplies a valid tab ID.
Collaborator
|
@matthewsong18 can you merge it yourself? |
Contributor
Author
@gamebeaker Sorry, I'm not sure what you mean? Do you mean merge the PR into the main branch? Or merge updates from main into here? I don't have permission to merge if you mean the first. |
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.
Problem
Opening
popup.htmldirectly from the address bar, a bookmark, or theFirefox homepage ran the same code as clicking the extension icon.
WebToEpub opened a second tab and used the first WebToEpub tab as the
source page.
Firefox lets WebToEpub read its own
moz-extension://URL, so theexisting URL check doesn't stop it and let it attempt injection. Firefox blocks content
scripts on extension pages and returned
Missing host permission for the tab.Fix
tabs.getCurrent()when the URL has no query string. If WebToEpubis already open in a browser tab, initialize the interface there.
idparameter. A direct link without an ID opens the interface without
importing a page.
Refactor
isRunningInTabMode()toisOpenInBrowserTab()to make itclear that the check is about where WebToEpub is open.
configureForTabMode()toimportPageFromTabIdInUrl()todescribe what it does and where it gets the source tab ID.
Testing
popup.htmldirectly.popup.htmland check that theinterface loads in one tab without an error.
Refer to #3148