Closed Bug 648101 Opened 9 years ago Closed 9 years ago

browser.tabs.insertRelatedAfterCurrent misses links opened in foreground

Categories

(SeaMonkey :: Tabbed Browser, defect)

x86
Windows 7
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED
seamonkey2.1final

People

(Reporter: stanio, Assigned: neil)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0pre) Gecko/20110406 SeaMonkey/2.1b3pre
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0pre) Gecko/20110406 SeaMonkey/2.1b3pre

Using the default settings of:

browser.link.open_newwindow;3
browser.tabs.insertRelatedAfterCurrent;true
browser.tabs.loadDivertedInBackground;false

causes links meant to open a new window in a tab placed in the current window after the last tab, instead after the current one.  Having:

browser.tabs.loadDivertedInBackground;true

to load the diverted links in background places the new tabs after the current one, as expected.

Reproducible: Always

Steps to Reproduce:
data:text/html,<a href="http://www.seamonkey-project.org/" target="_blank">Go</a>

data:text/html,<form action="http://www.mozilla.org/" target="_blank"><input type="submit" value="Go"></form>
The same problem appears when explicitly opening links in a new tab given:

browser.tabs.loadInBackground;false

so it's not specific to diverted links - I've missed the point Neil has given in the newsgroup:

http://groups.google.com/group/mozilla.dev.apps.seamonkey/msg/14fa5bcb516277c0
Summary: browser.tabs.insertRelatedAfterCurrent misses diverted links opened in foreground → browser.tabs.insertRelatedAfterCurrent misses links opened in foreground
Attached patch Proposed patchSplinter Review
The problem here is that if we're switching to the tab (default for diverted tabs and optional for tabs opened via the UI) then the newly created tab becomes the current tab before we check whether it should be inserted after the current tab, so the fix is to move the code that selects the new tab until after we've decided whether to insert it after the current tab.

I also moved the TabOpen event because it looked odd to have it fire before all of the other stuff that was now after it, it seems reasonable to me to fire it only once everything else is completely processed. I'm just assuming this won't break Session Store or any tests.
Assignee: nobody → neil
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #524299 - Flags: review?(misak.bugzilla)
Comment on attachment 524299 [details] [diff] [review]
Proposed patch

I ran all the tests on my Linux box, no problems.
Attachment #524299 - Flags: review?(misak.bugzilla) → review+
Pushed changeset a44d9edd4600 to comm-central.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.1final
Version: unspecified → Trunk
Depends on: 898781
You need to log in before you can comment on or make changes to this bug.