[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

hausmann at webkit.org hausmann at webkit.org
Thu Feb 4 21:27:54 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit b92d8b884f29a2ded6e5f6a4ed451daffc29a765
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 26 10:40:58 2010 +0000

    WebCore: [Qt] JavaScript prompt is currently broken.
    https://bugs.webkit.org/show_bug.cgi?id=30914
    
    Patch by Holger Hans Peter Freyther <zecke at selfish.org> on 2010-01-26
    Reviewed by Simon Hausmann.
    
    Remove the manual test case in favor of an automated
    test case in WebKit/qt/tests/qwebpage.
    
    * manual-tests/qt/java-script-prompt.html: Removed.
    
    WebKit/qt: [Qt] JavaScript prompt is currently broken
    https://bugs.webkit.org/show_bug.cgi?id=30914
    
    Patch by Holger Hans Peter Freyther <zecke at selfish.org> on 2010-01-26
    Reviewed by Simon Hausmann.
    
    In r52152 a patch was landed to convert a null QString
    to an empty WebCore::String in case the prompt was accepted
    but the default implementation returned the null QString.
    
    The patch tried to avoid assign to result twice and
    was not checking the QString if it is null but the default
    value. This lead to always returning an empty string on
    successful prompts. Fix it by checking the variable 'x'
    for isNull.
    
    The manual test case used didn't cover the case of non
    empty input, replace it with an automatic test case that
    should cover all cases.
    
    * WebCoreSupport/ChromeClientQt.cpp:
    (WebCore::ChromeClientQt::runJavaScriptPrompt): Fix the bug.
    * tests/qwebpage/tst_qwebpage.cpp: Add automatic test case
    (JSPromptPage::JSPromptPage):
    (JSPromptPage::javaScriptPrompt):
    (tst_QWebPage::testJSPrompt):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53847 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e209121..cfe041a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-26  Holger Hans Peter Freyther  <zecke at selfish.org>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] JavaScript prompt is currently broken.
+        https://bugs.webkit.org/show_bug.cgi?id=30914
+
+        Remove the manual test case in favor of an automated
+        test case in WebKit/qt/tests/qwebpage.
+
+        * manual-tests/qt/java-script-prompt.html: Removed.
+
 2010-01-26  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/manual-tests/qt/java-script-prompt.html b/WebCore/manual-tests/qt/java-script-prompt.html
deleted file mode 100644
index 3d9dc81..0000000
--- a/WebCore/manual-tests/qt/java-script-prompt.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<html>
-<head>
- <title>Prompt Test</title>
- <script type="text/ecmascript">
-
-function handle_prompt() {
-  var RESULTS = "ERROR";
-  var msg = "Accept this message without changing the default value:";
-  var retVal = prompt(msg);
-  if((retVal=="undefined")||(retVal=="")) RESULTS="SUCCESS" ;
-
-  document.getElementById("result").innerHTML += RESULTS + "<br>";
-}
-
- </script>
-</head>
-<body>
-<p>This is a manual test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=30914">#30914</a></p>
-<p>Instructions for the test:</p>
-<ul>
-    <li>Press the Prompt button.</li>
-    <li>Do not enter anything in the lineedit.</li>
-    <li>Press Ok, you should see SUCCESS appearing on the page.</li>
-    <li>Press the Prompt button again.</li>
-    <li>Do not enter anything in the lineedit.</li>
-    <li>Press Cancel, you should see ERROR appearing on the page.</li>
-</ul>
-<input type="button" onclick="javascript:handle_prompt()" value="Prompt" />
-<p>Result is below:</p>
-<div id="result"></div>
-</body>
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 0c93ee1..340c375 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,31 @@
+2010-01-26  Holger Hans Peter Freyther  <zecke at selfish.org>
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] JavaScript prompt is currently broken
+        https://bugs.webkit.org/show_bug.cgi?id=30914
+
+        In r52152 a patch was landed to convert a null QString
+        to an empty WebCore::String in case the prompt was accepted
+        but the default implementation returned the null QString.
+
+        The patch tried to avoid assign to result twice and
+        was not checking the QString if it is null but the default
+        value. This lead to always returning an empty string on
+        successful prompts. Fix it by checking the variable 'x'
+        for isNull.
+
+        The manual test case used didn't cover the case of non
+        empty input, replace it with an automatic test case that
+        should cover all cases.
+
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::runJavaScriptPrompt): Fix the bug.
+        * tests/qwebpage/tst_qwebpage.cpp: Add automatic test case
+        (JSPromptPage::JSPromptPage):
+        (JSPromptPage::javaScriptPrompt):
+        (tst_QWebPage::testJSPrompt):
+
 2010-01-25  Simon Hausmann  <hausmann at webkit.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 5a269dd..f1e6a86 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -291,7 +291,7 @@ bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const
 
     // Fix up a quirk in the QInputDialog class. If no input happened the string should be empty
     // but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914.
-    if (rc && result.isNull())
+    if (rc && x.isNull())
         result = String("");
     else
         result = x;
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 12bd7bd..f48fb73 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -1,6 +1,7 @@
 /*
     Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
     Copyright (C) 2009 Girish Ramakrishnan <girish at forwardbias.in>
+    Copyright (C) 2010 Holger Hans Peter Freyther
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -108,6 +109,7 @@ private slots:
     void screenshot();
 
     void originatingObjectInNetworkRequests();
+    void testJSPrompt();
 
 private:
     QWebView* m_view;
@@ -1759,5 +1761,72 @@ void tst_QWebPage::originatingObjectInNetworkRequests()
 #endif
 }
 
+/**
+ * Test fixups for https://bugs.webkit.org/show_bug.cgi?id=30914
+ *
+ * From JS we test the following conditions.
+ *
+ *   OK     + QString() => SUCCESS, empty string (but not null)
+ *   OK     + "text"    => SUCCESS, "text"
+ *   CANCEL + QString() => CANCEL, null string
+ *   CANCEL + "text"    => CANCEL, null string
+ */
+class JSPromptPage : public QWebPage {
+    Q_OBJECT
+public:
+    JSPromptPage()
+    {}
+
+    bool javaScriptPrompt(QWebFrame* frame, const QString& msg, const QString& defaultValue, QString* result)
+    {
+        if (msg == QLatin1String("test1")) {
+            *result = QString();
+            return true;
+        } else if (msg == QLatin1String("test2")) {
+            *result = QLatin1String("text");
+            return true;
+        } else if (msg == QLatin1String("test3")) {
+            *result = QString();
+            return false;
+        } else if (msg == QLatin1String("test4")) {
+            *result = QLatin1String("text");
+            return false;
+        }
+
+        qFatal("Unknown msg.");
+        return QWebPage::javaScriptPrompt(frame, msg, defaultValue, result);
+    }
+};
+
+void tst_QWebPage::testJSPrompt()
+{
+    JSPromptPage page;
+    bool res;
+
+    // OK + QString()
+    res = page.mainFrame()->evaluateJavaScript(
+            "var retval = prompt('test1');"
+            "retval=='' && retval.length == 0;").toBool();
+    QVERIFY(res);
+
+    // OK + "text"
+    res = page.mainFrame()->evaluateJavaScript(
+            "var retval = prompt('test2');"
+            "retval=='text' && retval.length == 4;").toBool();
+    QVERIFY(res);
+
+    // Cancel + QString()
+    res = page.mainFrame()->evaluateJavaScript(
+            "var retval = prompt('test3');"
+            "retval===null;").toBool();
+    QVERIFY(res);
+
+    // Cancel + "text"
+    res = page.mainFrame()->evaluateJavaScript(
+            "var retval = prompt('test4');"
+            "retval===null;").toBool();
+    QVERIFY(res);
+}
+
 QTEST_MAIN(tst_QWebPage)
 #include "tst_qwebpage.moc"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list