[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

zecke at webkit.org zecke at webkit.org
Thu Apr 8 00:36:50 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 74de4fab2afa65ec3893d69429e9b108aefca878
Author: zecke at webkit.org <zecke at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 15 16:17:46 2009 +0000

    [Qt] Fix JavaScript prompt behavior for empty/null strings.
    
    https://bugs.webkit.org/show_bug.cgi?id=30914
    
    The patch is based on the work done by Gupta Manish.
    
    In the default implementation of the JavaScript prompt
    we are using a QInputDialog to get the text and this has
    one quirk with regard to not entering any text.
    
    In other WebKit ports and in Firefox an empty string is
    returned but in the Qt case it is a null string.
    
    Change the API documentation in QWebPage to mention we want to
    have a non null string but do the fixup in the ChromeClientQt
    to support existing code.
    
    WebKit/qt:
    * Api/qwebpage.cpp:
    (QWebPage::javaScriptPrompt): Change API documentation
    * WebCoreSupport/ChromeClientQt.cpp:
    (WebCore::ChromeClientQt::runJavaScriptPrompt): Fixup null QString
    
    WebCore:
    * manual-tests/qt/java-script-prompt.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52152 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3f0d209..d0131ab 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2009-12-14  Holger Hans Peter Freyther  <zecke at selfish.org>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Add manual test for JavaScript prompt corner case
+        https://bugs.webkit.org/show_bug.cgi?id=30914
+
+        The patch is based on the work done by Gupta Manish.
+
+        Verify behavior of the JavaScript prompt function. Currently
+        Qt is not behaving like other WebKit ports and Firefox in
+        regards to accepting the prompt but not entering a text.
+
+        * manual-tests/qt/java-script-prompt.html: Added.
+
 2009-12-15  Luiz Agostini  <luiz.agostini at openbossa.org>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/manual-tests/qt/java-script-prompt.html b/WebCore/manual-tests/qt/java-script-prompt.html
new file mode 100644
index 0000000..3d9dc81
--- /dev/null
+++ b/WebCore/manual-tests/qt/java-script-prompt.html
@@ -0,0 +1,31 @@
+<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/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index 4febc93..3409591 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -1854,7 +1854,8 @@ bool QWebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg)
     The program may provide an optional message, \a msg, as well as a default value for the input in \a defaultValue.
 
     If the prompt was cancelled by the user the implementation should return false; otherwise the
-    result should be written to \a result and true should be returned.
+    result should be written to \a result and true should be returned. If the prompt was not cancelled by the
+    user, the implementation should return true and the result string must not be null.
 
     The default implementation uses QInputDialog::getText.
 */
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 3d077f8..74ef26a 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,28 @@
+2009-12-14  Holger Hans Peter Freyther  <zecke at selfish.org>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Fix JavaScript prompt behavior for empty/null strings.
+        https://bugs.webkit.org/show_bug.cgi?id=30914
+
+        The patch is based on the work done by Gupta Manish.
+
+        In the default implementation of the JavaScript prompt
+        we are using a QInputDialog to get the text and this has
+        one quirk with regard to not entering any text.
+
+        In other WebKit ports and in Firefox an empty string is
+        returned but in the Qt case it is a null string.
+
+        Change the API documentation in QWebPage to mention we want to
+        have a non null string but do the fixup in the ChromeClientQt
+        to support existing code.
+
+        * Api/qwebpage.cpp:
+        (QWebPage::javaScriptPrompt): Change API documentation
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::runJavaScriptPrompt): Fixup null QString
+
 2009-11-24  Holger Hans Peter Freyther  <zecke at selfish.org>
 
         Reviewed by Simon Hausmann.
diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index eb7ac9a..73cb4d7 100644
--- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -283,7 +283,14 @@ bool ChromeClientQt::runJavaScriptPrompt(Frame* f, const String& message, const
     QString x = result;
     FrameLoaderClientQt *fl = static_cast<FrameLoaderClientQt*>(f->loader()->client());
     bool rc = m_webPage->javaScriptPrompt(fl->webFrame(), (QString)message, (QString)defaultValue, &x);
-    result = x;
+
+    // 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())
+        result = String("");
+    else
+        result = x;
+
     return rc;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list