Changeset 128943 in webkit


Ignore:
Timestamp:
Sep 18, 2012 4:49:31 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Title string should be changed when document.title is set to .
https://bugs.webkit.org/show_bug.cgi?id=96793

Patch by Byungwoo Lee <bw80.lee@samsung.com> on 2012-09-18
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

DocumentLoader::setTitle() function returns without anything (changing
m_pageTitle and calling FrameLoaderClient::setTitle()) when new title
string is empty.
So, when document.title is set to , title string of a browser cannot
be changed.
For applying the change of document.title properly, empty string check
should be removed.

Test: fast/dom/title-text-property-assigning-empty-string.html

  • loader/DocumentLoader.cpp:

(WebCore::DocumentLoader::setTitle):

Source/WebKit2:

Added unit test for setting document.title and checking the title
string with title,changed signal and ewk_view_title_get() function.

  • UIProcess/API/efl/tests/test_ewk2_view.cpp:

(TEST_F):

Tools:

Change dump format of dumpTitleChanges more understandable.
Uses single quotation marks for the title string.

  • DumpRenderTree/blackberry/DumpRenderTree.cpp:

(BlackBerry::WebKit::DumpRenderTree::didReceiveTitleForFrame):

  • DumpRenderTree/chromium/WebViewHost.cpp:

(WebViewHost::didReceiveTitle):

  • DumpRenderTree/efl/DumpRenderTreeChrome.cpp:

(DumpRenderTreeChrome::onFrameTitleChanged):

  • DumpRenderTree/gtk/DumpRenderTree.cpp:

(webViewTitleChanged):

  • DumpRenderTree/mac/FrameLoadDelegate.mm:

(-[FrameLoadDelegate webView:didReceiveTitle:forFrame:]):

  • DumpRenderTree/qt/DumpRenderTreeQt.cpp:

(WebCore::DumpRenderTree::titleChanged):

  • DumpRenderTree/win/FrameLoadDelegate.cpp:

(FrameLoadDelegate::didReceiveTitle):

  • DumpRenderTree/wx/DumpRenderTreeWx.cpp:

(LayoutWebViewEventHandler::OnReceivedTitleEvent):

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::InjectedBundlePage::didReceiveTitleForFrame):

LayoutTests:

Added layout tests for assigning empty string to title text.
And modified expected results according to the change of
dumpTitleChanges.

  • fast/dom/title-text-property-2-expected.txt: Modified expected result.
  • fast/dom/title-text-property-assigning-empty-string-expected.txt: Added.
  • fast/dom/title-text-property-assigning-empty-string.html: Added.
  • fast/dom/title-text-property-expected.txt: Modified expected result.
  • fast/dom/title-text-property.html: Apply modified dumpTitleChanges.
Location:
trunk
Files:
2 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r128932 r128943  
     12012-09-18  Byungwoo Lee  <bw80.lee@samsung.com>
     2
     3        Title string should be changed when document.title is set to ''.
     4        https://bugs.webkit.org/show_bug.cgi?id=96793
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Added layout tests for assigning empty string to title text.
     9        And modified expected results according to the change of
     10        dumpTitleChanges.
     11
     12        * fast/dom/title-text-property-2-expected.txt: Modified expected result.
     13        * fast/dom/title-text-property-assigning-empty-string-expected.txt: Added.
     14        * fast/dom/title-text-property-assigning-empty-string.html: Added.
     15        * fast/dom/title-text-property-expected.txt: Modified expected result.
     16        * fast/dom/title-text-property.html: Apply modified dumpTitleChanges.
     17
    1182012-09-18  Julien Chaffraix  <jchaffraix@webkit.org>
    219
  • trunk/LayoutTests/fast/dom/title-text-property-2-expected.txt

    r11962 r128943  
    1 TITLE CHANGED: 1. setting document.title
    2 TITLE CHANGED: 2. setting title.text
     1TITLE CHANGED: '1. setting document.title'
     2TITLE CHANGED: '2. setting title.text'
     3TITLE CHANGED: ''
    34
  • trunk/LayoutTests/fast/dom/title-text-property-expected.txt

    r21687 r128943  
    1 TITLE CHANGED: This is the new title
    2 Original title is: Original Title
    3 Setting new title to: This is the new title
    4 New title is: This is the new title
     1TITLE CHANGED: 'This is the new title'
     2Original title is: 'Original Title'
     3Setting new title to: 'This is the new title'
     4New title is: 'This is the new title'
  • trunk/LayoutTests/fast/dom/title-text-property.html

    r120792 r128943  
    55function debugOutput(str) {
    66    text = document.createTextNode(str);
    7     debugDiv = document.getElementById('debugDiv');
    8     div = document.createElement ('div');
     7    console = document.getElementById('console');
     8    div = document.createElement('div');
    99    div.appendChild(text);
    10     debugDiv.appendChild(div);
     10    console.appendChild(div);
    1111}
    1212
     
    1818
    1919    titleElem = document.getElementsByTagName('title').item(0);
    20     debugOutput ('Original title is: ' + titleElem.text);
     20    debugOutput('Original title is: \'' + titleElem.text + '\'');
    2121
    2222    newTitle = 'This is the new title';
    23     debugOutput ('Setting new title to: ' + newTitle);
     23    debugOutput('Setting new title to: \'' + newTitle + '\'');
    2424    titleElem.text = newTitle;
    2525
    26     debugOutput ('New title is: ' + titleElem.text);
     26    debugOutput('New title is: \'' + titleElem.text + '\'');
    2727}
    2828
    2929function test() {
    3030    t = document.getElementsByTagName('title').item(0);
    31     alert (t.text);
     31    alert(t.text);
    3232    t.text = 'new title';
    33     alert (t.text);
     33    alert(t.text);
    3434}
    3535</script>
    3636</head>
    3737<body onload='runTests();'>
    38 <div id='debugDiv'>
     38<div id='console'>
    3939</div>
    4040</body>
  • trunk/Source/WebCore/ChangeLog

    r128941 r128943  
     12012-09-18  Byungwoo Lee  <bw80.lee@samsung.com>
     2
     3        Title string should be changed when document.title is set to ''.
     4        https://bugs.webkit.org/show_bug.cgi?id=96793
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        DocumentLoader::setTitle() function returns without anything (changing
     9        m_pageTitle and calling FrameLoaderClient::setTitle()) when new title
     10        string is empty.
     11        So, when document.title is set to '', title string of a browser cannot
     12        be changed.
     13        For applying the change of document.title properly, empty string check
     14        should be removed.
     15
     16        Test: fast/dom/title-text-property-assigning-empty-string.html
     17
     18        * loader/DocumentLoader.cpp:
     19        (WebCore::DocumentLoader::setTitle):
     20
    1212012-09-18  Simon Fraser  <simon.fraser@apple.com>
    222
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r128762 r128943  
    738738void DocumentLoader::setTitle(const StringWithDirection& title)
    739739{
    740     if (title.isEmpty())
    741         return;
    742 
    743     if (m_pageTitle != title) {
    744         frameLoader()->willChangeTitle(this);
    745         m_pageTitle = title;
    746         frameLoader()->didChangeTitle(this);
    747     }
     740    if (m_pageTitle == title)
     741        return;
     742
     743    frameLoader()->willChangeTitle(this);
     744    m_pageTitle = title;
     745    frameLoader()->didChangeTitle(this);
    748746}
    749747
  • trunk/Source/WebKit2/ChangeLog

    r128935 r128943  
     12012-09-18  Byungwoo Lee  <bw80.lee@samsung.com>
     2
     3        Title string should be changed when document.title is set to ''.
     4        https://bugs.webkit.org/show_bug.cgi?id=96793
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Added unit test for setting document.title and checking the title
     9        string with title,changed signal and ewk_view_title_get() function.
     10
     11        * UIProcess/API/efl/tests/test_ewk2_view.cpp:
     12        (TEST_F):
     13
    1142012-09-18  Anders Carlsson  <andersca@apple.com>
    215
  • trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp

    r128883 r128943  
    361361    checkFullScreenProperty(webView(), false);
    362362}
     363
     364TEST_F(EWK2UnitTestBase, ewk_view_title_changed)
     365{
     366    const char* titleChangedHTML =
     367        "<!doctype html><head><title>Title before changed</title></head>"
     368        "<body onload=\"document.title='Title after changed';\"></body>";
     369    ewk_view_html_string_load(webView(), titleChangedHTML, 0, 0);
     370    waitUntilTitleChangedTo("Title after changed");
     371    EXPECT_STREQ(ewk_view_title_get(webView()), "Title after changed");
     372
     373    titleChangedHTML =
     374        "<!doctype html><head><title>Title before changed</title></head>"
     375        "<body onload=\"document.title='';\"></body>";
     376    ewk_view_html_string_load(webView(), titleChangedHTML, 0, 0);
     377    waitUntilTitleChangedTo("");
     378    EXPECT_STREQ(ewk_view_title_get(webView()), "");
     379
     380    titleChangedHTML =
     381        "<!doctype html><head><title>Title before changed</title></head>"
     382        "<body onload=\"document.title=null;\"></body>";
     383    ewk_view_html_string_load(webView(), titleChangedHTML, 0, 0);
     384    waitUntilTitleChangedTo("");
     385    EXPECT_STREQ(ewk_view_title_get(webView()), "");
     386}
  • trunk/Tools/ChangeLog

    r128899 r128943  
     12012-09-18  Byungwoo Lee  <bw80.lee@samsung.com>
     2
     3        Title string should be changed when document.title is set to ''.
     4        https://bugs.webkit.org/show_bug.cgi?id=96793
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Change dump format of dumpTitleChanges more understandable.
     9        Uses single quotation marks for the title string.
     10
     11        * DumpRenderTree/blackberry/DumpRenderTree.cpp:
     12        (BlackBerry::WebKit::DumpRenderTree::didReceiveTitleForFrame):
     13        * DumpRenderTree/chromium/WebViewHost.cpp:
     14        (WebViewHost::didReceiveTitle):
     15        * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
     16        (DumpRenderTreeChrome::onFrameTitleChanged):
     17        * DumpRenderTree/gtk/DumpRenderTree.cpp:
     18        (webViewTitleChanged):
     19        * DumpRenderTree/mac/FrameLoadDelegate.mm:
     20        (-[FrameLoadDelegate webView:didReceiveTitle:forFrame:]):
     21        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
     22        (WebCore::DumpRenderTree::titleChanged):
     23        * DumpRenderTree/win/FrameLoadDelegate.cpp:
     24        (FrameLoadDelegate::didReceiveTitle):
     25        * DumpRenderTree/wx/DumpRenderTreeWx.cpp:
     26        (LayoutWebViewEventHandler::OnReceivedTitleEvent):
     27        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     28        (WTR::InjectedBundlePage::didReceiveTitleForFrame):
     29
    1302012-09-18  Szilard Ledan  <szledan@inf.u-szeged.hu>
    231
  • trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp

    r127040 r128943  
    638638
    639639    if (gTestRunner->dumpTitleChanges())
    640         printf("TITLE CHANGED: %s\n", title.utf8().data());
     640        printf("TITLE CHANGED: '%s'\n", title.utf8().data());
    641641}
    642642
  • trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp

    r128273 r128943  
    11931193
    11941194    if (testRunner()->shouldDumpTitleChanges())
    1195         printf("TITLE CHANGED: %s\n", title8.data());
     1195        printf("TITLE CHANGED: '%s'\n", title8.data());
    11961196
    11971197    setPageTitle(title);
  • trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp

    r128393 r128943  
    514514
    515515    if (!done && gTestRunner->dumpTitleChanges())
    516         printf("TITLE CHANGED: %s\n", (titleText && titleText->string) ? titleText->string : "");
     516        printf("TITLE CHANGED: '%s'\n", (titleText && titleText->string) ? titleText->string : "");
    517517
    518518    if (!done && gTestRunner->dumpHistoryDelegateCallbacks())
  • trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp

    r128596 r128943  
    945945{
    946946    if (gTestRunner->dumpTitleChanges() && !done)
    947         printf("TITLE CHANGED: %s\n", title ? title : "");
     947        printf("TITLE CHANGED: '%s'\n", title ? title : "");
    948948}
    949949
  • trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm

    r128129 r128943  
    345345
    346346    if (gTestRunner->dumpTitleChanges())
    347         printf("TITLE CHANGED: %s\n", [title UTF8String]);
     347        printf("TITLE CHANGED: '%s'\n", [title UTF8String]);
    348348}
    349349
  • trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp

    r128210 r128943  
    10031003{
    10041004    if (m_controller->shouldDumpTitleChanges())
    1005         printf("TITLE CHANGED: %s\n", s.toUtf8().data());
     1005        printf("TITLE CHANGED: '%s'\n", s.toUtf8().data());
    10061006}
    10071007
  • trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp

    r125516 r128943  
    181181
    182182    if (::gTestRunner->dumpTitleChanges() && !done)
    183         printf("TITLE CHANGED: %S\n", title ? title : L"");
     183        printf("TITLE CHANGED: '%S'\n", title ? title : L"");
    184184    return S_OK;
    185185}
  • trunk/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp

    r125516 r128943  
    130130    {
    131131        if (gTestRunner->dumpTitleChanges() && !done)
    132             wxFprintf(stdout, "TITLE CHANGED: %S\n", event.GetTitle());
     132            wxFprintf(stdout, "TITLE CHANGED: '%S'\n", event.GetTitle());
    133133    }
    134134   
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r128638 r128943  
    10071007        return;
    10081008
    1009     InjectedBundle::shared().stringBuilder()->appendLiteral("TITLE CHANGED: ");
     1009    InjectedBundle::shared().stringBuilder()->appendLiteral("TITLE CHANGED: '");
    10101010    InjectedBundle::shared().stringBuilder()->append(toWTFString(title));
    1011     InjectedBundle::shared().stringBuilder()->append('\n');
     1011    InjectedBundle::shared().stringBuilder()->appendLiteral("'\n");
    10121012}
    10131013
Note: See TracChangeset for help on using the changeset viewer.