Bug 11692 - REGRESSION(r17352): Disappearing page title
: REGRESSION(r17352): Disappearing page title
Status: RESOLVED FIXED
: WebKit
New Bugs
: 420+
: Macintosh Mac OS X 10.4
: P1 Normal
Assigned To:
: http://www.gocomics.com/foxtrot/
: Regression
:
:
  Show dependency treegraph
 
Reported: 2006-11-26 00:51 PST by
Modified: 2007-01-22 23:52 PST (History)


Attachments
Screenshot of "Flash Player Installation" in the title (26.47 KB, image/png)
2006-12-17 07:37 PST, David Kilzer (:ddkilzer)
no flags Details
Patch (1.24 KB, patch)
2007-01-22 18:54 PST, Mark Rowe (bdash)
mjs: review+
Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2006-11-26 00:51:21 PST
The page title (in both the title bar and tabs) seems to randomly disappear on certain websites, despite <title> being here in the source.  The title displays fine while the page is loading, but once its done, it disappears.

Steps to reproduce:
1. Load the url linked in this bug
2. Refresh the page a couple times - the title should disappear.  (Cmd + clicking a link on the page seems to be easier to reproduce for me though)
------- Comment #1 From 2006-11-26 01:13:32 PST -------
http://trac.webkit.org/projects/webkit/changeset/17352 appears to be the cause.
------- Comment #2 From 2006-12-17 07:32:21 PST -------
Why does the title tag look like this:

<title>Welcome to goComics Web Site featuring FoxTrot - Online Comics, Editorial Cartoons, Email Comics, Political Cartoons</title>

But when the page is loaded in Safari, the title bar looks like this:

Welcome to goComics Web Site featuring FoxTrot  - Flash Player Installation

Is Flash modifying the title via DOM manipulation somehow!?
------- Comment #3 From 2006-12-17 07:33:05 PST -------
(In reply to comment #1)
> http://trac.webkit.org/projects/webkit/changeset/17352 appears to be the cause.

See also Bug 11853.
------- Comment #4 From 2006-12-17 07:37:06 PST -------
Created an attachment (id=11894) [details]
Screenshot of "Flash Player Installation" in the title

Screenshot of locally-built debug build of WebKit r18256 using Safari 2.0.4 (419.3) on Mac OS X 10.4.8 (8L127).
------- Comment #5 From 2007-01-22 17:23:37 PST -------
The change of title to mention Flash Player installation is explained by some JS in the source of the page:

// Stored value of document title used by the installation process to close the window that started the installation process
// This is necessary to remove browser windows that will still be utilizing the older version of the player after installation is complete
// DO NOT MODIFY THE FOLLOWING TWO LINES
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
------- Comment #6 From 2007-01-22 18:12:48 PST -------
The title goes blank because somewhere along the lines a JS file related to advertising is loaded from <http://servedby.advertising.com/site=681019/size=160600/bnum=84894465/optn=1>:

var ADSERVER_POPS_VAL=0;
document.write('<HTML>');
document.write('<HEAD>');
document.write('<TITLE>&nbsp;</TITLE>');
document.write('</HEAD>');
document.write('<BODY>');
document.write('<OBJECT classid=\'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\' codebase=\'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\' WIDTH=160 HEIGHT=600>');
document.write('<PARAM NAME=movie VALUE=\'http://bannerfarm.ace.advertising.com/bannerfarm/96673/160x600.swf?clickTag=http://servedby.advertising.com/click/site=0000681019/mnum=0000370443&siteValue=0000681019\'>');
document.write('<PARAM NAME=quality VALUE=high>');
document.write('<PARAM NAME=wmode VALUE=opaque>');
document.write('<EMBED src=\'http://bannerfarm.ace.advertising.com/bannerfarm/96673/160x600.swf?clickTag=http://servedby.advertising.com/click/site=0000681019/mnum=0000370443&siteValue=0000681019\' quality=high wmode=opaque WIDTH=160 HEIGHT=600 TYPE=\'application/x-shockwave-flash\' PLUGINSPAGE=\'http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\'></EMBED>');
document.write('</OBJECT>');
document.write('</BODY>');
document.write('</HTML>');

I get the feeling it's supposed to be loaded in a popup window or perhaps an iframe rather than inline.  It's not clear to me why the title affects the main document but none of the other changes do.  After a few minutes of looking I can't see where it's loaded from.  More investigation is needed.
------- Comment #7 From 2007-01-22 18:49:57 PST -------
There are two factors at play here: in shipping Safari, sitting the document title via JavaScript to a non-breaking space (either via document.write or document.title) results in no change to the displayed title though document.title does reflect the change to the title.  In ToT we respect the change and display the new title.  This explains why the bug is not visible in shipping Safari.  The second factor is that if we encounter a <title> tag, set the document title via JavaScript, then encounter a second <title> tag we will set the document title to the contents of the second <title> tag.  In Firefox the title remains at what was set via JavaScript.  This explains why the bug isn't visible in Firefox.

I'll prepare a patch that makes our behaviour match Firefox.
------- Comment #8 From 2007-01-22 18:54:56 PST -------
Created an attachment (id=12616) [details]
Patch

No layout tests included, will add some after lunch.  It doesn't seem like we'll be able to test for the first issue that I mentioned in comment 7, but the second should be testable.
------- Comment #9 From 2007-01-22 18:56:40 PST -------
(From update of attachment 12616 [details])
r=me
------- Comment #10 From 2007-01-22 19:41:25 PST -------
Please see the WHATWG specs for <title> as well:
   http://whatwg.org/specs/web-apps/current-work/#the-title1
   http://whatwg.org/specs/web-apps/current-work/#title3

They were based on reverse engineering existing browsers and looking at existing content and should represent the optimum possible implementation path. Feedback is, of course, welcome.
------- Comment #11 From 2007-01-22 20:54:11 PST -------
Change landed in r19038.
------- Comment #12 From 2007-01-22 21:15:55 PST -------
Reading over the specification that Ian linked it's quite clear our current behaviour doesn't match up.  My change also introduced a layout test failure.  I'm working on a more complete fix at the moment.
------- Comment #13 From 2007-01-22 23:52:10 PST -------
Closing this bug as patch was landed.  Bug 12375 covers the layout test failure that was introduced.