Closed Bug 1248460 Opened 8 years ago Closed 8 years ago

Calling tabs.duplicated on a pinned tab

Categories

(WebExtensions :: Untriaged, defect, P4)

defect

Tracking

(firefox47 fixed)

RESOLVED FIXED
mozilla47
Iteration:
47.3 - Mar 7
Tracking Status
firefox47 --- fixed

People

(Reporter: andy+bugzilla, Assigned: andy+bugzilla)

References

(Depends on 1 open bug)

Details

(Whiteboard: [tabs]triaged)

Attachments

(1 file)

Should create a pinned tab next to the existing one, which is what it does on chrome. Currently it creates it next to all the pinned tabs and the new tab is not pinned.
Iteration: --- → 47.3 - Mar 7
Comment on attachment 8724419 [details]
MozReview Request: bug 1248460 pin during SSTabRestoring r=kmag

https://reviewboard.mozilla.org/r/37023/#review33593

::: browser/components/extensions/ext-tabs.js:789
(Diff revision 1)
> +          newTab.addEventListener("SSTabRestoring", function listener() {

Is there a reason we have to wait for this event before making these changes?

::: browser/components/extensions/ext-tabs.js:803
(Diff revision 1)
> +            gBrowser.selectTabAtIndex(newTab._tPos);

This should really just be `gBrowser.selectedTab = newTab`

::: browser/components/extensions/test/browser/browser_ext_tabs_duplicate.js:78
(Diff revision 1)
> +    if (tab.linkedBrowser.currentURI.spec === "http://example.net/") {

This is going to get into an infinite loop if this test fails.

Maybe `while (gBrowser.tabs[0].currentURI.spec == "http://example.net/")`?
Attachment #8724419 - Flags: review?(kmaglione+bmo)
https://reviewboard.mozilla.org/r/37023/#review33593

> Is there a reason we have to wait for this event before making these changes?

According to the docs: https://developer.mozilla.org/en/docs/Session_store_API

"If you want to set permissions or otherwise manipulate a restored tab before the page is loaded into it, you should watch SSTabRestoring. If you want to do something after the page is loaded, you should watch SSTabRestored."

If you set tab.pinned before the tab is restored, then you lose the pinned data. If you set in the SSTabRestored event, there is a really awkward jump as the tab appears and then moves over to be pinned. We still need SSTabRestored so we can send the callback when its completed.

> This should really just be `gBrowser.selectedTab = newTab`

Sure.

> This is going to get into an infinite loop if this test fails.
> 
> Maybe `while (gBrowser.tabs[0].currentURI.spec == "http://example.net/")`?

And its shorter too, good call.
Comment on attachment 8724419 [details]
MozReview Request: bug 1248460 pin during SSTabRestoring r=kmag

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/37023/diff/1-2/
Attachment #8724419 - Flags: review?(kmaglione+bmo)
https://reviewboard.mozilla.org/r/37023/#review33593

> According to the docs: https://developer.mozilla.org/en/docs/Session_store_API
> 
> "If you want to set permissions or otherwise manipulate a restored tab before the page is loaded into it, you should watch SSTabRestoring. If you want to do something after the page is loaded, you should watch SSTabRestored."
> 
> If you set tab.pinned before the tab is restored, then you lose the pinned data. If you set in the SSTabRestored event, there is a really awkward jump as the tab appears and then moves over to be pinned. We still need SSTabRestored so we can send the callback when its completed.

OK. Please add a comment.
Comment on attachment 8724419 [details]
MozReview Request: bug 1248460 pin during SSTabRestoring r=kmag

https://reviewboard.mozilla.org/r/37023/#review33747

Looks good. Thanks
Attachment #8724419 - Flags: review?(kmaglione+bmo) → review+
Comment on attachment 8724419 [details]
MozReview Request: bug 1248460 pin during SSTabRestoring r=kmag

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/37023/diff/2-3/
Attachment #8724419 - Attachment description: MozReview Request: bug 1248460 pin during SSTabRestoring r?kmag → MozReview Request: bug 1248460 pin during SSTabRestoring r=kmag
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/b525f31f69ff
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Depends on: 1402810
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: