Closed Bug 476077 Opened 16 years ago Closed 15 years ago

page JS can't dynamically update favicon

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Other
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: Dolske, Assigned: mfinkle)

Details

Attachments

(1 file)

The code on http://isthetreegreen.com dynamically changes the favicon in JS...

<link id="favicon" rel="icon" href="foo.png">
...
var icon = document.getElementById("favicon");
var parent = icon.parentNode;
parent.removeChild(icon);
icon.setAttribute("href", "bar.png");
parent.appendChild(icon);

This works in Firefox, but not Fennec.

Oddly, this works when the page is initially loaded, but I'm guessing that's because there's some latency between Fennec loading the page and showing the favicon.
Actually, this used to work, but we removed the "change immediately on <link>" because of pageload preformance. We now wait until the page loads to set the favicon. Of course, if the page is already loaded, the update never happens.

So we need to only delay the update if the page is loading. After a pageload, we should update immediately.
Attached patch patchSplinter Review
This patch should update the favicon, but not affect pageload time. The this._favicon.src is set to "" when we start a pageload and is set to the page's favicon or the default page favicon after a pageload is complete.
Assignee: nobody → mark.finkle
Attachment #359757 - Flags: review?(gavin.sharp)
Attachment #359757 - Flags: review?(gavin.sharp) → review+
http://hg.mozilla.org/mobile-browser/rev/b6d3d2b8cdec

Taras - you might want to recheck pageload timing
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
verified FIXED On build:

Mozilla/5.0 (X11; U; Linux armv7l; en-US; rv:1.9.2b1pre) Gecko/20091001
Fennec/1.0b4pre
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: