Repository navigation
Conversation
The tab which reopens a page assigned to a container was created in the window which had the focus last, at the index the tab it replaces has in its own window, and the tab it replaces was removed at once. When that tab was the only tab of another window, as for a link from another application which Firefox opens in a new window, the page moved to the window which had the focus last, and the link's window closed. The new tab is now created in the window of the tab it replaces, and that tab is removed only once the new one exists. Fixes mozilla#2000
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.
Before submitting your pull request
npm testand all tests passed.Description
When a page assigned to a container opens in a tab of another container,
onBeforeRequest()reopens it withtabs.create()and removes the tab it replaces when that tab was new.createTabWrapper()callstabs.create()withoutwindowId, so the new tab opens in the current window, the one which had the focus last:windowId"defaults to the current window"), whileindexis the position after the tab it replaces in that tab's own window. When the current window is another window than the one of the tab it replaces, this shows in two ways:browser.link.open_newwindow.override.externalis 2), while another window still counts as the current one, as during a start of Firefox which restores the previous session: the link's window disappears, and the page appears as a tab of a restored window.openerTabId, and the opener tab "must be in the same window as the newly created tab", so Firefox refuses to create the tab and the page does not open at all.This PR passes the window of the tab it replaces to
tabs.create(), through an optionalwindowIdparameter.onBeforeRequest()removes the tab it replaces only once the new tab exists, since removing the only tab of a window closes the window. When the new tab cannot be created, the tab stays and the error is logged. The callers inmessageHandler.js, which reopen the active tab from the popup, are unchanged.The confirm page test now also checks that the new tab opens in the window of the tab it replaces, which fails without the change, and the test of the removal waits for it, since the removal now follows the creation of the new tab.
Type of change
Select all that apply.
Tag issues related to this pull request: