Bug 18362

Summary: protocol 'data' does not change/clear the page title
Product: WebKit Reporter: Ariya Hidayat <ariya.hidayat>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: ariya.hidayat, mitz
Priority: P3    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: Linux   
Attachments:
Description Flags
patch to clear the title when loading starts none

Description Ariya Hidayat 2008-04-08 06:10:50 PDT
Steps to reproduce:
(1) Open any website, e.g. slashdot.org
(2) The title is changed
(3) Put the following in the URL 
  data:text/html,<form></form>
and after that press Enter

What happens:
The title does not change

Expected:
The title should be emptied.
Comment 1 Ariya Hidayat 2008-04-08 07:46:16 PDT
Created attachment 20405 [details]
patch to clear the title when loading starts

This is a potential (unfortunately, rather ugly) workaround. It ensures that the loader's client gets an empty string so that if there no <title> element in the document, the title which is displayed by the loader's client is properly cleared at the beginning.
Comment 2 mitz 2008-04-08 07:53:58 PDT
In Safari, the window title changes to the URL, so I am not sure why this patch is needed.
Comment 3 Ariya Hidayat 2008-04-08 08:00:16 PDT
> In Safari, the window title changes to the URL, so I am not sure why 
> this patch is needed.

I think it is Safari-specific.

It is debatable whether the title should change to an empty or the URL. But the point is that WebKit does not notify the loader/client that the currently loaded URI does not have a title.
Comment 4 Ariya Hidayat 2008-04-08 08:53:03 PDT
Another proposal for solution:

IF
(1) the document has no <title> nor JavaScript that sets the title
(2) the loader never calls dispatchDidReceiveTitle() of its client
(3) the document finished loading

THEN
before calling dispatchDidFinishLoading() of the loader's client, it should also call dispatchDidReceiveTitle() with an empty title.
Comment 5 mitz 2008-04-08 09:05:50 PDT
(In reply to comment #3)
> WebKit does not notify the loader/client that the currently
> loaded URI does not have a title.

It seems sensible to notify when something has changed. I am not sure what is the change reflected by the proposed notification.
Comment 6 Ariya Hidayat 2008-04-08 13:45:23 PDT
On #webkit, Mitz Pettel suggested that this should be taken care by the platform loader client, i.e. it should assume that the currently loaded URI/document has no title. IMO this is likely the optimal approach.
Comment 7 Maciej Stachowiak 2008-04-22 22:31:49 PDT
Comment on attachment 20405 [details]
patch to clear the title when loading starts

Removing review flag since the patch is apparently withdrawn.