Changeset 52152 in webkit


Ignore:
Timestamp:
Dec 15, 2009 8:17:46 AM (14 years ago)
Author:
zecke@webkit.org
Message:

[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.
Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r52151 r52152  
     12009-12-14  Holger Hans Peter Freyther  <zecke@selfish.org>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Add manual test for JavaScript prompt corner case
     6        https://bugs.webkit.org/show_bug.cgi?id=30914
     7
     8        The patch is based on the work done by Gupta Manish.
     9
     10        Verify behavior of the JavaScript prompt function. Currently
     11        Qt is not behaving like other WebKit ports and Firefox in
     12        regards to accepting the prompt but not entering a text.
     13
     14        * manual-tests/qt/java-script-prompt.html: Added.
     15
    1162009-12-15  Luiz Agostini  <luiz.agostini@openbossa.org>
    217
  • trunk/WebKit/qt/Api/qwebpage.cpp

    r52103 r52152  
    18551855
    18561856    If the prompt was cancelled by the user the implementation should return false; otherwise the
    1857     result should be written to \a result and true should be returned.
     1857    result should be written to \a result and true should be returned. If the prompt was not cancelled by the
     1858    user, the implementation should return true and the result string must not be null.
    18581859
    18591860    The default implementation uses QInputDialog::getText.
  • trunk/WebKit/qt/ChangeLog

    r52144 r52152  
     12009-12-14  Holger Hans Peter Freyther  <zecke@selfish.org>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Fix JavaScript prompt behavior for empty/null strings.
     6        https://bugs.webkit.org/show_bug.cgi?id=30914
     7
     8        The patch is based on the work done by Gupta Manish.
     9
     10        In the default implementation of the JavaScript prompt
     11        we are using a QInputDialog to get the text and this has
     12        one quirk with regard to not entering any text.
     13
     14        In other WebKit ports and in Firefox an empty string is
     15        returned but in the Qt case it is a null string.
     16
     17        Change the API documentation in QWebPage to mention we want to
     18        have a non null string but do the fixup in the ChromeClientQt
     19        to support existing code.
     20
     21        * Api/qwebpage.cpp:
     22        (QWebPage::javaScriptPrompt): Change API documentation
     23        * WebCoreSupport/ChromeClientQt.cpp:
     24        (WebCore::ChromeClientQt::runJavaScriptPrompt): Fixup null QString
     25
    1262009-11-24  Holger Hans Peter Freyther  <zecke@selfish.org>
    227
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r50351 r52152  
    284284    FrameLoaderClientQt *fl = static_cast<FrameLoaderClientQt*>(f->loader()->client());
    285285    bool rc = m_webPage->javaScriptPrompt(fl->webFrame(), (QString)message, (QString)defaultValue, &x);
    286     result = x;
     286
     287    // Fix up a quirk in the QInputDialog class. If no input happened the string should be empty
     288    // but it is null. See https://bugs.webkit.org/show_bug.cgi?id=30914.
     289    if (rc && result.isNull())
     290        result = String("");
     291    else
     292        result = x;
     293
    287294    return rc;
    288295}
Note: See TracChangeset for help on using the changeset viewer.