Title: [128943] trunk
Revision
128943
Author
[email protected]
Date
2012-09-18 16:49:31 -0700 (Tue, 18 Sep 2012)

Log 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 <[email protected]> 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (128942 => 128943)


--- trunk/LayoutTests/ChangeLog	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/LayoutTests/ChangeLog	2012-09-18 23:49:31 UTC (rev 128943)
@@ -1,3 +1,20 @@
+2012-09-18  Byungwoo Lee  <[email protected]>
+
+        Title string should be changed when document.title is set to ''.
+        https://bugs.webkit.org/show_bug.cgi?id=96793
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        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.
+
 2012-09-18  Julien Chaffraix  <[email protected]>
 
         More unreviewed rebaseline after r128906.

Modified: trunk/LayoutTests/fast/dom/title-text-property-2-expected.txt (128942 => 128943)


--- trunk/LayoutTests/fast/dom/title-text-property-2-expected.txt	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/LayoutTests/fast/dom/title-text-property-2-expected.txt	2012-09-18 23:49:31 UTC (rev 128943)
@@ -1,3 +1,4 @@
-TITLE CHANGED: 1. setting document.title
-TITLE CHANGED: 2. setting title.text
+TITLE CHANGED: '1. setting document.title'
+TITLE CHANGED: '2. setting title.text'
+TITLE CHANGED: ''
 

Added: trunk/LayoutTests/fast/dom/title-text-property-assigning-empty-string-expected.txt (0 => 128943)


--- trunk/LayoutTests/fast/dom/title-text-property-assigning-empty-string-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/title-text-property-assigning-empty-string-expected.txt	2012-09-18 23:49:31 UTC (rev 128943)
@@ -0,0 +1,3 @@
+TITLE CHANGED: 'New non-empty title'
+TITLE CHANGED: ''
+

Added: trunk/LayoutTests/fast/dom/title-text-property-assigning-empty-string.html (0 => 128943)


--- trunk/LayoutTests/fast/dom/title-text-property-assigning-empty-string.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/title-text-property-assigning-empty-string.html	2012-09-18 23:49:31 UTC (rev 128943)
@@ -0,0 +1,17 @@
+<html>
+<head>
+<script>
+function runTests() {
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.dumpTitleChanges();
+    }
+
+    document.title = 'New non-empty title';
+    document.title = '';
+}
+</script>
+</head>
+<body _onload_='runTests();'>
+</body>
+</html>

Modified: trunk/LayoutTests/fast/dom/title-text-property-expected.txt (128942 => 128943)


--- trunk/LayoutTests/fast/dom/title-text-property-expected.txt	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/LayoutTests/fast/dom/title-text-property-expected.txt	2012-09-18 23:49:31 UTC (rev 128943)
@@ -1,4 +1,4 @@
-TITLE CHANGED: This is the new title
-Original title is: Original Title
-Setting new title to: This is the new title
-New title is: This is the new title
+TITLE CHANGED: 'This is the new title'
+Original title is: 'Original Title'
+Setting new title to: 'This is the new title'
+New title is: 'This is the new title'

Modified: trunk/LayoutTests/fast/dom/title-text-property.html (128942 => 128943)


--- trunk/LayoutTests/fast/dom/title-text-property.html	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/LayoutTests/fast/dom/title-text-property.html	2012-09-18 23:49:31 UTC (rev 128943)
@@ -4,10 +4,10 @@
 <script>
 function debugOutput(str) {
     text = document.createTextNode(str);
-    debugDiv = document.getElementById('debugDiv');
-    div = document.createElement ('div');
+    console = document.getElementById('console');
+    div = document.createElement('div');
     div.appendChild(text);
-    debugDiv.appendChild(div);
+    console.appendChild(div);
 }
 
 function runTests() {
@@ -17,25 +17,25 @@
     }
 
     titleElem = document.getElementsByTagName('title').item(0);
-    debugOutput ('Original title is: ' + titleElem.text);
+    debugOutput('Original title is: \'' + titleElem.text + '\'');
 
     newTitle = 'This is the new title';
-    debugOutput ('Setting new title to: ' + newTitle);
+    debugOutput('Setting new title to: \'' + newTitle + '\'');
     titleElem.text = newTitle;
 
-    debugOutput ('New title is: ' + titleElem.text);
+    debugOutput('New title is: \'' + titleElem.text + '\'');
 }
 
 function test() {
     t = document.getElementsByTagName('title').item(0);
-    alert (t.text);
+    alert(t.text);
     t.text = 'new title';
-    alert (t.text);
+    alert(t.text);
 }
 </script>
 </head>
 <body _onload_='runTests();'>
-<div id='debugDiv'>
+<div id='console'>
 </div>
 </body>
 </html>

Modified: trunk/Source/WebCore/ChangeLog (128942 => 128943)


--- trunk/Source/WebCore/ChangeLog	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Source/WebCore/ChangeLog	2012-09-18 23:49:31 UTC (rev 128943)
@@ -1,3 +1,23 @@
+2012-09-18  Byungwoo Lee  <[email protected]>
+
+        Title string should be changed when document.title is set to ''.
+        https://bugs.webkit.org/show_bug.cgi?id=96793
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        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):
+
 2012-09-18  Simon Fraser  <[email protected]>
 
         fast/forms/search-event-delay.html is asserting in markAllMisspellingsAndBadGrammarInRanges()

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (128942 => 128943)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2012-09-18 23:49:31 UTC (rev 128943)
@@ -737,14 +737,12 @@
 
 void DocumentLoader::setTitle(const StringWithDirection& title)
 {
-    if (title.isEmpty())
+    if (m_pageTitle == title)
         return;
 
-    if (m_pageTitle != title) {
-        frameLoader()->willChangeTitle(this);
-        m_pageTitle = title;
-        frameLoader()->didChangeTitle(this);
-    }
+    frameLoader()->willChangeTitle(this);
+    m_pageTitle = title;
+    frameLoader()->didChangeTitle(this);
 }
 
 KURL DocumentLoader::urlForHistory() const

Modified: trunk/Source/WebKit2/ChangeLog (128942 => 128943)


--- trunk/Source/WebKit2/ChangeLog	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-18 23:49:31 UTC (rev 128943)
@@ -1,3 +1,16 @@
+2012-09-18  Byungwoo Lee  <[email protected]>
+
+        Title string should be changed when document.title is set to ''.
+        https://bugs.webkit.org/show_bug.cgi?id=96793
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        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):
+
 2012-09-18  Anders Carlsson  <[email protected]>
 
         Division by zero crash in BackingStore::scroll

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp (128942 => 128943)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp	2012-09-18 23:49:31 UTC (rev 128943)
@@ -360,3 +360,27 @@
     ASSERT_TRUE(fullScreenCallbackCalled);
     checkFullScreenProperty(webView(), false);
 }
+
+TEST_F(EWK2UnitTestBase, ewk_view_title_changed)
+{
+    const char* titleChangedHTML =
+        "<!doctype html><head><title>Title before changed</title></head>"
+        "<body _onload_=\"document.title='Title after changed';\"></body>";
+    ewk_view_html_string_load(webView(), titleChangedHTML, 0, 0);
+    waitUntilTitleChangedTo("Title after changed");
+    EXPECT_STREQ(ewk_view_title_get(webView()), "Title after changed");
+
+    titleChangedHTML =
+        "<!doctype html><head><title>Title before changed</title></head>"
+        "<body _onload_=\"document.title='';\"></body>";
+    ewk_view_html_string_load(webView(), titleChangedHTML, 0, 0);
+    waitUntilTitleChangedTo("");
+    EXPECT_STREQ(ewk_view_title_get(webView()), "");
+
+    titleChangedHTML =
+        "<!doctype html><head><title>Title before changed</title></head>"
+        "<body _onload_=\"document.title=null;\"></body>";
+    ewk_view_html_string_load(webView(), titleChangedHTML, 0, 0);
+    waitUntilTitleChangedTo("");
+    EXPECT_STREQ(ewk_view_title_get(webView()), "");
+}

Modified: trunk/Tools/ChangeLog (128942 => 128943)


--- trunk/Tools/ChangeLog	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Tools/ChangeLog	2012-09-18 23:49:31 UTC (rev 128943)
@@ -1,3 +1,32 @@
+2012-09-18  Byungwoo Lee  <[email protected]>
+
+        Title string should be changed when document.title is set to ''.
+        https://bugs.webkit.org/show_bug.cgi?id=96793
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        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):
+
 2012-09-18  Szilard Ledan  <[email protected]>
 
         EWS shouldn't sleep if there are new patches in its queue

Modified: trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp (128942 => 128943)


--- trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Tools/DumpRenderTree/blackberry/DumpRenderTree.cpp	2012-09-18 23:49:31 UTC (rev 128943)
@@ -637,7 +637,7 @@
         printf("%s - didReceiveTitle: %s\n", drtFrameDescription(frame).utf8().data(), title.utf8().data());
 
     if (gTestRunner->dumpTitleChanges())
-        printf("TITLE CHANGED: %s\n", title.utf8().data());
+        printf("TITLE CHANGED: '%s'\n", title.utf8().data());
 }
 
 // ChromeClient delegates.

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (128942 => 128943)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-09-18 23:49:31 UTC (rev 128943)
@@ -1192,7 +1192,7 @@
     }
 
     if (testRunner()->shouldDumpTitleChanges())
-        printf("TITLE CHANGED: %s\n", title8.data());
+        printf("TITLE CHANGED: '%s'\n", title8.data());
 
     setPageTitle(title);
     testRunner()->setTitleTextDirection(direction);

Modified: trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp (128942 => 128943)


--- trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp	2012-09-18 23:49:31 UTC (rev 128943)
@@ -513,7 +513,7 @@
     }
 
     if (!done && gTestRunner->dumpTitleChanges())
-        printf("TITLE CHANGED: %s\n", (titleText && titleText->string) ? titleText->string : "");
+        printf("TITLE CHANGED: '%s'\n", (titleText && titleText->string) ? titleText->string : "");
 
     if (!done && gTestRunner->dumpHistoryDelegateCallbacks())
         printf("WebView updated the title for history URL \"%s\" to \"%s\".\n", ewk_frame_uri_get(frame)

Modified: trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp (128942 => 128943)


--- trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2012-09-18 23:49:31 UTC (rev 128943)
@@ -944,7 +944,7 @@
 static void webViewTitleChanged(WebKitWebView* view, WebKitWebFrame* frame, const gchar* title, gpointer data)
 {
     if (gTestRunner->dumpTitleChanges() && !done)
-        printf("TITLE CHANGED: %s\n", title ? title : "");
+        printf("TITLE CHANGED: '%s'\n", title ? title : "");
 }
 
 static bool webViewNavigationPolicyDecisionRequested(WebKitWebView* view, WebKitWebFrame* frame,

Modified: trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm (128942 => 128943)


--- trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm	2012-09-18 23:49:31 UTC (rev 128943)
@@ -344,7 +344,7 @@
     }
 
     if (gTestRunner->dumpTitleChanges())
-        printf("TITLE CHANGED: %s\n", [title UTF8String]);
+        printf("TITLE CHANGED: '%s'\n", [title UTF8String]);
 }
 
 - (void)webView:(WebView *)sender didReceiveServerRedirectForProvisionalLoadForFrame:(WebFrame *)frame

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp (128942 => 128943)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2012-09-18 23:49:31 UTC (rev 128943)
@@ -1002,7 +1002,7 @@
 void DumpRenderTree::titleChanged(const QString &s)
 {
     if (m_controller->shouldDumpTitleChanges())
-        printf("TITLE CHANGED: %s\n", s.toUtf8().data());
+        printf("TITLE CHANGED: '%s'\n", s.toUtf8().data());
 }
 
 void DumpRenderTree::connectFrame(QWebFrame *frame)

Modified: trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp (128942 => 128943)


--- trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp	2012-09-18 23:49:31 UTC (rev 128943)
@@ -180,7 +180,7 @@
         printf("%s - didReceiveTitle: %S\n", descriptionSuitableForTestResult(frame).c_str(), title);
 
     if (::gTestRunner->dumpTitleChanges() && !done)
-        printf("TITLE CHANGED: %S\n", title ? title : L"");
+        printf("TITLE CHANGED: '%S'\n", title ? title : L"");
     return S_OK;
 }
 

Modified: trunk/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp (128942 => 128943)


--- trunk/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Tools/DumpRenderTree/wx/DumpRenderTreeWx.cpp	2012-09-18 23:49:31 UTC (rev 128943)
@@ -129,7 +129,7 @@
     void OnReceivedTitleEvent(WebViewReceivedTitleEvent& event)
     {
         if (gTestRunner->dumpTitleChanges() && !done)
-            wxFprintf(stdout, "TITLE CHANGED: %S\n", event.GetTitle());
+            wxFprintf(stdout, "TITLE CHANGED: '%S'\n", event.GetTitle());
     }
     
     void OnWindowObjectClearedEvent(WebViewWindowObjectClearedEvent& event)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (128942 => 128943)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-09-18 23:19:42 UTC (rev 128942)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-09-18 23:49:31 UTC (rev 128943)
@@ -1006,9 +1006,9 @@
     if (!InjectedBundle::shared().testRunner()->shouldDumpTitleChanges())
         return;
 
-    InjectedBundle::shared().stringBuilder()->appendLiteral("TITLE CHANGED: ");
+    InjectedBundle::shared().stringBuilder()->appendLiteral("TITLE CHANGED: '");
     InjectedBundle::shared().stringBuilder()->append(toWTFString(title));
-    InjectedBundle::shared().stringBuilder()->append('\n');
+    InjectedBundle::shared().stringBuilder()->appendLiteral("'\n");
 }
 
 void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, WKBundleScriptWorldRef world)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to