Closed Bug 557374 Opened 14 years ago Closed 14 years ago

history.pushState forgets favicon and feeds

Categories

(SeaMonkey :: Tabbed Browser, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
seamonkey2.1a1

People

(Reporter: neil, Assigned: neil)

References

()

Details

Attachments

(2 files, 1 obsolete file)

Steps to reproduce problem:
1. Browse to a site with a custom favicon and an RSS feed
2. Load the URL javascript:history.pushState(null, document.title, "?#");
3. The URL changes, and the favicon and RSS feed are forgotten.

Note that the link toolbar, if used, does not forget subscriptions. This because it uses a different notification model and assumes that the extra location change caused by the pushState is in fact caused by a tab switch.
In fact it looks like anchor navigation also causes favicons and feeds to be forgotten. Oops.
Attached patch Proposed patchSplinter Review
We only want to clear favicon and feed data when a toplevel load has a network request associated with it (which will generate a document with new favicon and feed data). But navigator.js will assume that the forwarded location change is due to a tab switch, so if we are in fact forwarding a location change for a toplevel load without a network request then we also need to resend the favicon and feed data, just as if we'd switched tabs.
Assignee: nobody → neil
Status: NEW → ASSIGNED
Attachment #437160 - Flags: review?(iann_bugzilla)
Comment on attachment 437160 [details] [diff] [review]
Proposed patch

>+++ b/suite/browser/tabbrowser.xml	Tue Apr 06 00:16:24 2010 +0100
> 
>+                    if (!aRequest && aWebProgress.DOMWindow == this.mBrowser.contentWindow) {
>+                      if (this.mBrowser.mIconURL && "onLinkIconAvailable" in element)
>+                        element.onLinkIconAvailable(this.mBrowser.mIconURL);
>+                      if ("onFeedAvailable" in element) {
>+                        this.mFeeds.forEach(
>+                          function notifyFeedAvailable(feed) {
>+                            element.onFeedAvailable(feed);
>+                          }
>+                        );
>+                      }
>+                    }
Is it worth looking at having a helper and sharing code with the updateCurrentBrowser method?
r=me either way
Attachment #437160 - Flags: review?(iann_bugzilla) → review+
(In reply to comment #2)
> Created an attachment (id=437160) [details]
> Proposed patch
Seems like the patch is bit rotted now.
Attached patch Proof of concept (obsolete) — Splinter Review
This was the best shared function that I could come up with. I guess it could be simplified if I could make mFeeds live on mBrowser, but I would have to be careful to delete it.

The patch has otherwise also been updated for bitrot (but most of that is commented out assuming the shared function is acceptable.)
Attachment #441644 - Flags: feedback?(iann_bugzilla)
Comment on attachment 441644 [details] [diff] [review]
Proof of concept

yeah, looks good to me - codewise
Attachment #441644 - Flags: feedback?(iann_bugzilla) → feedback+
This is attachment 441644 [details] [diff] [review] but with the /* */ code blocks completely removed.
Attachment #441644 - Attachment is obsolete: true
Attachment #441975 - Flags: review?(iann_bugzilla)
(In reply to comment #7)
> Created an attachment (id=441975) [details]
> With actual code removal
> 
> This is attachment 441644 [details] [diff] [review] but with the /* */ code blocks completely removed.

Does this.mTabListeners[this.mTabContainer.selectedIndex].mBrowser equal this.mPanelContainer.selectedPanel.firstChild (i.e. newBrowser) for the second change?
(In reply to comment #8)
> Does this.mTabListeners[this.mTabContainer.selectedIndex].mBrowser equal
> this.mPanelContainer.selectedPanel.firstChild (i.e. newBrowser) for the second
> change?
Yes; by that time the new browser is now the selected browser (and its tab is the selected tab and it is of course its own tab listener's browser).
Attachment #441975 - Flags: review?(iann_bugzilla) → review+
Pushed changeset 8d6f4763c863 to comm-central.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.1a1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: