Changeset 63850 in webkit


Ignore:
Timestamp:
Jul 21, 2010 1:10:22 PM (14 years ago)
Author:
weinig@apple.com
Message:

Patch for https://bugs.webkit.org/show_bug.cgi?id=42539
WebKitTestRunner needs to support printing ALERT, PROMPT and CONFIRM messages

Reviewed by Anders Carlsson.

WebKit2:

  • Convert injected bundle UIClient functions to will-style, at least until we establish more concrete use cases for them past the TestRunner.
  • WebProcess/InjectedBundle/API/c/WKBundlePage.h:
  • WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:

(WebKit::InjectedBundlePageUIClient::willAddMessageToConsole):
(WebKit::InjectedBundlePageUIClient::willSetStatusbarText):
(WebKit::InjectedBundlePageUIClient::willRunJavaScriptAlert):
(WebKit::InjectedBundlePageUIClient::willRunJavaScriptConfirm):
(WebKit::InjectedBundlePageUIClient::willRunJavaScriptPrompt):

  • WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::addMessageToConsole):
(WebKit::WebChromeClient::runJavaScriptAlert):
(WebKit::WebChromeClient::runJavaScriptConfirm):
(WebKit::WebChromeClient::runJavaScriptPrompt):
(WebKit::WebChromeClient::setStatusbarText):

WebKitTools:

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::_willAddMessageToConsole):
(WTR::InjectedBundlePage::_willSetStatusbarText):
(WTR::InjectedBundlePage::_willRunJavaScriptAlert):
(WTR::InjectedBundlePage::_willRunJavaScriptConfirm):
(WTR::InjectedBundlePage::_willRunJavaScriptPrompt):
(WTR::InjectedBundlePage::willAddMessageToConsole):
(WTR::InjectedBundlePage::willSetStatusbarText):
(WTR::InjectedBundlePage::willRunJavaScriptAlert):
(WTR::InjectedBundlePage::willRunJavaScriptConfirm):
(WTR::InjectedBundlePage::willRunJavaScriptPrompt):

  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:

LayoutTests:

  • platform/mac-wk2/Skipped:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63840 r63850  
     12010-07-21  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Patch for https://bugs.webkit.org/show_bug.cgi?id=42539
     6        WebKitTestRunner needs to support printing ALERT, PROMPT and CONFIRM messages
     7
     8        * platform/mac-wk2/Skipped:
     9
    1102010-07-21  Tony Chang  <tony@chromium.org>
    211
  • trunk/LayoutTests/platform/mac-wk2/Skipped

    r63787 r63850  
    11#
    2 # Copyright (C) 2008 Apple Inc. All rights reserved.
     2# Copyright (C) 2010 Apple Inc. All rights reserved.
    33#
    44# Redistribution and use in source and binary forms, with or without
     
    719719compositing/iframes/layout-on-compositing-change.html
    720720editing/deleting/5390681-2.html
    721 http/tests/local/send-dragged-file.html
    722 http/tests/local/send-sliced-dragged-file.html
    723 http/tests/local/blob/send-data-blob.html
    724 http/tests/local/blob/send-sliced-data-blob.html
    725 http/tests/local/formdata/send-form-data-with-sliced-file.html
    726 http/tests/local/formdata/send-form-data.html
    727 http/tests/local/formdata/upload-events.html
    728 http/tests/misc/drag-over-iframe-invalid-source-crash.html
    729 http/tests/security/listener/xss-window-onclick-addEventListener.html
    730 http/tests/security/listener/xss-window-onclick-shortcut.html
    731721editing/deleting/5729680.html
    732722editing/deleting/forward-delete-key.html
     
    747737editing/pasteboard/drag-image-to-contenteditable-in-iframe.html
    748738editing/pasteboard/drop-inputtext-acquires-style.html
     739editing/pasteboard/file-input-files-access.html
     740editing/pasteboard/files-during-page-drags.html
    749741editing/pasteboard/get-data-text-plain-drop.html
    750742editing/selection/14971.html
     
    850842fast/events/drag-and-drop.html
    851843fast/events/drag-in-frames.html
     844fast/events/drag-outside-window.html
    852845fast/events/drag-parent-node.html
    853846fast/events/drag-to-navigate.html
     
    998991fast/forms/textfield-outline.html
    999992fast/forms/textfield-to-password-on-focus.html
     993fast/frames/frame-dead-region.html
    1000994fast/frames/frame-deep-nested-resize.html
    1001995fast/frames/hover-timer-crash.html
     
    10231017fast/text/offsetForPosition-cluster-at-zero.html
    10241018fast/text/reset-drag-on-mouse-down.html
     1019http/tests/local/blob/send-data-blob.html
    10251020http/tests/local/blob/send-hybrid-blob.html
     1021http/tests/local/blob/send-sliced-data-blob.html
    10261022http/tests/local/drag-over-remote-content.html
     1023http/tests/local/formdata/send-form-data-with-sliced-file.html
     1024http/tests/local/formdata/send-form-data.html
     1025http/tests/local/formdata/upload-events.html
     1026http/tests/local/send-dragged-file.html
     1027http/tests/local/send-sliced-dragged-file.html
    10271028http/tests/misc/bubble-drag-events.html
     1029http/tests/misc/drag-over-iframe-invalid-source-crash.html
    10281030http/tests/misc/isindex-with-no-form.html
    10291031http/tests/navigation/no-referrer-same-window.html
     
    10331035http/tests/security/dataTransfer-set-data-file-url.html
    10341036http/tests/security/drag-over-remote-content-iframe.html
     1037http/tests/security/listener/xss-window-onclick-addEventListener.html
     1038http/tests/security/listener/xss-window-onclick-shortcut.html
    10351039media/media-fullscreen-inline.html
    10361040platform/mac/editing/deleting/backward-delete.html
     
    13731377java
    13741378platform/mac/plugins
    1375 
     1379fast/loader/loadInProgress.html
    13761380
    13771381# WebKit2 needs layoutTestController.overridePreference
     
    20672071fast/loader/stateobjects/pushstate-within-popstate-handler-assert.html
    20682072fast/loader/stateobjects/pushstate-then-replacestate.html
    2069 
     2073fast/loader/stateobjects/document-destroyed-navigate-back.html
    20702074http/tests/loading/state-object-security-exception.html
    20712075
     
    21612165editing/selection/extend-forward-after-set-base-and-extent.html
    21622166editing/selection/select-line.html
    2163 
    2164 
    2165 # WebKitTestRunner needs to support printing ALERT, PROMPT and CONFIRM messages
    2166 # <https://bugs.webkit.org/show_bug.cgi?id=42539>
    2167 editing/pasteboard/paste-noscript-xhtml.xhtml
    2168 editing/selection/5241148.html
    2169 editing/selection/5497643.html
    2170 fast/dom/Element/id-in-frameset.html
    2171 fast/dom/Geolocation/notimer-after-unload.html
    2172 fast/dom/script-element-gc.html
    2173 fast/dom/serialize-nodes.xhtml
    2174 fast/dom/set-inner-text-newlines.html
    2175 fast/dom/Window/alert-undefined.html
    2176 fast/events/attribute-listener-cloned-from-frameless-doc.xhtml
    2177 fast/events/drag-outside-window.html
    2178 fast/events/onload-webkit-before-webcore.html
    2179 fast/events/onunload-clears-onbeforeunload.html
    2180 fast/events/onunload.html
    2181 fast/events/onunload-not-on-body.html
    2182 fast/events/onunload-window-property.html
    2183 fast/events/pageshow-pagehide-on-back-uncached.html
    2184 fast/events/resize-subframe.html
    2185 fast/frames/frame-dead-region.html
    2186 fast/frames/frame-js-url-clientWidth.html
    2187 fast/frames/frame-name-reset.html
    2188 fast/frames/frameElement-widthheight.html
    2189 fast/frames/iframe-display-none.html
    2190 fast/frames/location-change.html
    2191 fast/frames/location-change-no-file-access.html
    2192 fast/frames/sandboxed-iframe-navigation-top-by-name-denied.html
    2193 fast/frames/set-unloaded-frame-location.html
    2194 fast/inspector-support/cssURLQuotes.html
    2195 fast/loader/for-window-event-onload-scripts.html
    2196 fast/loader/hashchange-event.html
    2197 fast/loader/loadInProgress.html
    2198 fast/loader/local-svg-parsed-as-svg.svg
    2199 fast/loader/non-deferred-substitute-load.html
    2200 fast/loader/onhashchange-attribute-listeners.html
    2201 fast/loader/simultaneous-reloads-assert.html
    2202 fast/loader/stateobjects/document-destroyed-navigate-back.html
    2203 fast/parser/parseCommentsInTitles.html
    2204 fast/xsl/subframe-location.html
    2205 http/tests/cookies/third-party-cookie-relaxing.html
    2206 http/tests/misc/DOMContentLoaded-event.html
    2207 http/tests/misc/embedCrasher.html
    2208 http/tests/misc/frame-default-enc-different-domain.html
    2209 http/tests/misc/frame-default-enc-same-domain.html
    2210 http/tests/misc/onload-remove-iframe-crash-2.html
    2211 http/tests/navigation/history-back-across-form-submission-to-fragment.html
    2212 http/tests/security/data-url-inline.css.html
    2213 http/tests/security/popup-blocked-from-fake-event.html
    2214 http/tests/security/popup-blocked-from-window-open.html
    2215 http/tests/xmlhttprequest/readystatechange.html
    2216 platform/mac/plugins/bindings-test-objc.html
    2217 storage/open-database-creation-callback-isolated-world.html
    2218 storage/statement-error-callback-isolated-world.html
    2219 storage/statement-success-callback-isolated-world.html
    2220 storage/transaction-callback-isolated-world.html
    2221 storage/transaction-error-callback-isolated-world.html
    2222 storage/transaction-success-callback-isolated-world.html
    2223 svg/hixie/dynamic/001.xml
    2224 websocket/tests/alert-in-event-handler.html
    2225 websocket/tests/websocket-pending-activity.html
    2226 
    22272167# WebKitTestRunner needs layoutTestController.clearAllDatabases
    22282168# <https://bugs.webkit.org/show_bug.cgi?id=42540>
     
    22392179storage/success-callback.html
    22402180storage/transaction-error-callback.html
     2181storage/open-database-creation-callback-isolated-world.html
     2182storage/statement-error-callback-isolated-world.html
     2183storage/statement-success-callback-isolated-world.html
     2184storage/transaction-callback-isolated-world.html
     2185storage/transaction-error-callback-isolated-world.html
     2186storage/transaction-success-callback-isolated-world.html
    22412187
    22422188# WebKitTestRunner needs layoutTestController.pathToLocalResource
     
    22992245fast/dom/Geolocation/timeout.html
    23002246fast/dom/Geolocation/watch.html
     2247fast/dom/Geolocation/notimer-after-unload.html
    23012248
    23022249# WebKitTestRunner needs layoutTestController.setMockGeolocationPosition
     
    24442391fast/xmlhttprequest/xmlhttprequest-no-file-access.html
    24452392fast/xmlhttprequest/xmlhttprequest-nonexistent-file.html
     2393fast/frames/location-change-no-file-access.html
    24462394
    24472395# WebKitTestRunner needs layoutTestController.setPrinting
     
    24822430http/tests/security/setDomainRelaxationForbiddenForURLScheme.html
    24832431
     2432# WebKit2 needs layoutTestController.setDeferMainResourceDataLoad
     2433# <https://bugs.webkit.org/show_bug.cgi?id=42777>
     2434fast/loader/non-deferred-substitute-load.html
     2435
     2436# WebKit2 needs layoutTestController.setAlwaysAcceptCookies
     2437# <https://bugs.webkit.org/show_bug.cgi?id=42778>
     2438http/tests/cookies/third-party-cookie-relaxing.html
     2439
     2440# WebKit2 needs layoutTestController.setCloseRemainingWindowsWhenComplete
     2441# <https://bugs.webkit.org/show_bug.cgi?id=42779>
     2442http/tests/security/popup-blocked-from-fake-event.html
     2443http/tests/security/popup-blocked-from-window-open.html
     2444
    24842445# WebKitTestRunner needs GCController
    24852446# <https://bugs.webkit.org/show_bug.cgi?id=42701>
     
    24962457# WebKitTestRunner needs to print onunload handler information
    24972458# <https://bugs.webkit.org/show_bug.cgi?id=42703>
     2459fast/events/onunload-clears-onbeforeunload.html
    24982460fast/events/pageshow-pagehide.html
    24992461fast/events/stop-load-in-unload-handler-using-document-write.html
     
    25132475fast/loader/unload-reload.html
    25142476fast/loader/unload-window-location.html
    2515 http/tests/xmlhttprequest/xhr-onunload.html
    25162477http/tests/xmlhttprequest/frame-load-cancelled-abort.html
    25172478http/tests/xmlhttprequest/frame-unload-abort-crash.html
    25182479http/tests/xmlhttprequest/send-undefined-and-null.html
     2480http/tests/xmlhttprequest/xhr-onunload.html
     2481fast/events/onunload.html
     2482fast/events/onunload-not-on-body.html
     2483fast/events/pageshow-pagehide-on-back-uncached.html
     2484http/tests/navigation/history-back-across-form-submission-to-fragment.html
    25192485
    25202486# WebKitTestRunner needs to print history delegate information
     
    25412507
    25422508
    2543 
    25442509# THINGS WE DON'T HAVE AND DON'T WANT
    25452510
     
    25542519platform/mac/fast/dom/wrapper-round-tripping.html
    25552520platform/mac/fast/objc/longlongTest.html
     2521platform/mac/plugins/bindings-test-objc.html
    25562522
    25572523# WebKitTestRunner doesn't have eventSender.enableDOMUIEventLogging
     
    25602526# WebKitTestRunner doesn't have eventSender.fireKeyboardEventsToElement
    25612527platform/mac/fast/events/objc-keyboard-event-creation.html
    2562 
    2563 
  • trunk/WebKit2/ChangeLog

    r63848 r63850  
     12010-07-21  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Patch for https://bugs.webkit.org/show_bug.cgi?id=42539
     6        WebKitTestRunner needs to support printing ALERT, PROMPT and CONFIRM messages
     7
     8        - Convert injected bundle UIClient functions to will-style, at least until we establish
     9          more concrete use cases for them past the TestRunner.
     10
     11        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
     12        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
     13        (WebKit::InjectedBundlePageUIClient::willAddMessageToConsole):
     14        (WebKit::InjectedBundlePageUIClient::willSetStatusbarText):
     15        (WebKit::InjectedBundlePageUIClient::willRunJavaScriptAlert):
     16        (WebKit::InjectedBundlePageUIClient::willRunJavaScriptConfirm):
     17        (WebKit::InjectedBundlePageUIClient::willRunJavaScriptPrompt):
     18        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
     19        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     20        (WebKit::WebChromeClient::addMessageToConsole):
     21        (WebKit::WebChromeClient::runJavaScriptAlert):
     22        (WebKit::WebChromeClient::runJavaScriptConfirm):
     23        (WebKit::WebChromeClient::runJavaScriptPrompt):
     24        (WebKit::WebChromeClient::setStatusbarText):
     25
    1262010-07-21  Simon Fraser  <simon.fraser@apple.com>
    227
  • trunk/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h

    r63627 r63850  
    6161
    6262// UI Client
    63 typedef void (*WKBundlePageAddMessageToConsoleCallback)(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
    64 typedef void (*WKBundlePageSetStatusbarTextCallback)(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);
     63typedef void (*WKBundlePageWillAddMessageToConsoleCallback)(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
     64typedef void (*WKBundlePageWillSetStatusbarTextCallback)(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);
     65typedef void (*WKBundlePageWillRunJavaScriptAlertCallback)(WKBundlePageRef page, WKStringRef alertText, WKBundleFrameRef frame, const void *clientInfo);
     66typedef void (*WKBundlePageWillRunJavaScriptConfirmCallback)(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo);
     67typedef void (*WKBundlePageWillRunJavaScriptPromptCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo);
    6568
    6669struct WKBundlePageUIClient {
    6770    int                                                                 version;
    6871    const void *                                                        clientInfo;
    69     WKBundlePageAddMessageToConsoleCallback                             addMessageToConsole;
    70     WKBundlePageSetStatusbarTextCallback                                setStatusbarText;
     72    WKBundlePageWillAddMessageToConsoleCallback                         willAddMessageToConsole;
     73    WKBundlePageWillSetStatusbarTextCallback                            willSetStatusbarText;
     74    WKBundlePageWillRunJavaScriptAlertCallback                          willRunJavaScriptAlert;
     75    WKBundlePageWillRunJavaScriptConfirmCallback                        willRunJavaScriptConfirm;
     76    WKBundlePageWillRunJavaScriptPromptCallback                         willRunJavaScriptPrompt;
    7177};
    7278typedef struct WKBundlePageUIClient WKBundlePageUIClient;
  • trunk/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp

    r63627 r63850  
    4747}
    4848
    49 void InjectedBundlePageUIClient::addMessageToConsole(WebPage* page, const String& message, int32_t lineNumber)
     49void InjectedBundlePageUIClient::willAddMessageToConsole(WebPage* page, const String& message, int32_t lineNumber)
    5050{
    51     if (m_client.addMessageToConsole)
    52         m_client.addMessageToConsole(toRef(page), toRef(message.impl()), lineNumber, m_client.clientInfo);
     51    if (m_client.willAddMessageToConsole)
     52        m_client.willAddMessageToConsole(toRef(page), toRef(message.impl()), lineNumber, m_client.clientInfo);
    5353}
    5454
    55 void InjectedBundlePageUIClient::setStatusbarText(WebPage* page, const String& statusbarText)
     55void InjectedBundlePageUIClient::willSetStatusbarText(WebPage* page, const String& statusbarText)
    5656{
    57     if (m_client.setStatusbarText)
    58         m_client.setStatusbarText(toRef(page), toRef(statusbarText.impl()), m_client.clientInfo);
     57    if (m_client.willSetStatusbarText)
     58        m_client.willSetStatusbarText(toRef(page), toRef(statusbarText.impl()), m_client.clientInfo);
     59}
     60
     61void InjectedBundlePageUIClient::willRunJavaScriptAlert(WebPage* page, const String& alertText, WebFrame* frame)
     62{
     63    if (m_client.willRunJavaScriptAlert)
     64        m_client.willRunJavaScriptAlert(toRef(page), toRef(alertText.impl()), toRef(frame), m_client.clientInfo);
     65}
     66
     67void InjectedBundlePageUIClient::willRunJavaScriptConfirm(WebPage* page, const String& message, WebFrame* frame)
     68{
     69    if (m_client.willRunJavaScriptConfirm)
     70        m_client.willRunJavaScriptConfirm(toRef(page), toRef(message.impl()), toRef(frame), m_client.clientInfo);
     71}
     72
     73void InjectedBundlePageUIClient::willRunJavaScriptPrompt(WebPage* page, const String& message, const String& defaultValue, WebFrame* frame)
     74{
     75    if (m_client.willRunJavaScriptPrompt)
     76        m_client.willRunJavaScriptPrompt(toRef(page), toRef(message.impl()), toRef(defaultValue.impl()), toRef(frame), m_client.clientInfo);
    5977}
    6078
  • trunk/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h

    r63627 r63850  
    3535namespace WebKit {
    3636
     37class WebFrame;
    3738class WebPage;
    3839
     
    4243    void initialize(WKBundlePageUIClient*);
    4344
    44     void addMessageToConsole(WebPage*, const WebCore::String& message, int32_t lineNumber);
    45     void setStatusbarText(WebPage*, const WebCore::String&);
     45    void willAddMessageToConsole(WebPage*, const WebCore::String& message, int32_t lineNumber);
     46    void willSetStatusbarText(WebPage*, const WebCore::String&);
     47    void willRunJavaScriptAlert(WebPage*, const WebCore::String&, WebFrame*);
     48    void willRunJavaScriptConfirm(WebPage*, const WebCore::String&, WebFrame*);
     49    void willRunJavaScriptPrompt(WebPage*, const WebCore::String&, const WebCore::String&, WebFrame*);
    4650
    4751private:
  • trunk/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r63843 r63850  
    188188{
    189189    // Notify the bundle client.
    190     m_page->injectedBundleUIClient().addMessageToConsole(m_page, message, lineNumber);
     190    m_page->injectedBundleUIClient().willAddMessageToConsole(m_page, message, lineNumber);
    191191
    192192    notImplemented();
     
    213213{
    214214    WebFrame* webFrame =  static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
     215
     216    // Notify the bundle client.
     217    m_page->injectedBundleUIClient().willRunJavaScriptAlert(m_page, alertText, webFrame);
     218
    215219    WebProcess::shared().connection()->sendSync(WebPageProxyMessage::RunJavaScriptAlert, m_page->pageID(),
    216220                                                CoreIPC::In(webFrame->frameID(), alertText),
     
    219223}
    220224
    221 bool WebChromeClient::runJavaScriptConfirm(Frame*, const String&)
    222 {
    223     notImplemented();
    224     return false;
    225 }
    226 
    227 bool WebChromeClient::runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result)
    228 {
    229     notImplemented();
     225bool WebChromeClient::runJavaScriptConfirm(Frame* frame, const String& message)
     226{
     227    WebFrame* webFrame =  static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
     228
     229    // Notify the bundle client.
     230    m_page->injectedBundleUIClient().willRunJavaScriptConfirm(m_page, message, webFrame);
     231
     232    // Implement for UIProcess.
     233    return false;
     234}
     235
     236bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
     237{
     238    WebFrame* webFrame =  static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame();
     239
     240    // Notify the bundle client.
     241    m_page->injectedBundleUIClient().willRunJavaScriptPrompt(m_page, message, defaultValue, webFrame);
     242
     243    // Implement for UIProcess.
    230244    return false;
    231245}
     
    234248{
    235249    // Notify the bundle client.
    236     m_page->injectedBundleUIClient().setStatusbarText(m_page, statusbarText);
     250    m_page->injectedBundleUIClient().willSetStatusbarText(m_page, statusbarText);
    237251
    238252    notImplemented();
  • trunk/WebKitTools/ChangeLog

    r63829 r63850  
     12010-07-21  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Patch for https://bugs.webkit.org/show_bug.cgi?id=42539
     6        WebKitTestRunner needs to support printing ALERT, PROMPT and CONFIRM messages
     7
     8        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     9        (WTR::InjectedBundlePage::InjectedBundlePage):
     10        (WTR::InjectedBundlePage::_willAddMessageToConsole):
     11        (WTR::InjectedBundlePage::_willSetStatusbarText):
     12        (WTR::InjectedBundlePage::_willRunJavaScriptAlert):
     13        (WTR::InjectedBundlePage::_willRunJavaScriptConfirm):
     14        (WTR::InjectedBundlePage::_willRunJavaScriptPrompt):
     15        (WTR::InjectedBundlePage::willAddMessageToConsole):
     16        (WTR::InjectedBundlePage::willSetStatusbarText):
     17        (WTR::InjectedBundlePage::willRunJavaScriptAlert):
     18        (WTR::InjectedBundlePage::willRunJavaScriptConfirm):
     19        (WTR::InjectedBundlePage::willRunJavaScriptPrompt):
     20        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
     21
    1222010-07-21  Adam Roben  <aroben@apple.com>
    223
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r63797 r63850  
    3838namespace WTR {
    3939
     40static PassOwnPtr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
     41{
     42    RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, wkStringRef));
     43    CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString.get()), kCFStringEncodingUTF8) + 1;
     44    OwnPtr<Vector<char> > buffer(new Vector<char>(bufferLength));
     45    if (!CFStringGetCString(cfString.get(), buffer->data(), bufferLength, kCFStringEncodingUTF8)) {
     46        buffer->shrink(1);
     47        (*buffer)[0] = 0;
     48    } else
     49        buffer->shrink(strlen(buffer->data()) + 1);
     50    return buffer.release();
     51}
     52
    4053InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
    4154    : m_page(page)
     
    5972        0,
    6073        this,
    61         _addMessageToConsole,
    62         _setStatusbarText
     74        _willAddMessageToConsole,
     75        _willSetStatusbarText,
     76        _willRunJavaScriptAlert,
     77        _willRunJavaScriptConfirm,
     78        _willRunJavaScriptPrompt
    6379    };
    6480    WKBundlePageSetUIClient(m_page, &uiClient);
    65 
    6681}
    6782
     
    128143void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame)
    129144{
    130 }
    131 
    132 static PassOwnPtr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
    133 {
    134     RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, wkStringRef));
    135     CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString.get()), kCFStringEncodingUTF8) + 1;
    136     OwnPtr<Vector<char> > buffer(new Vector<char>(bufferLength));
    137     if (!CFStringGetCString(cfString.get(), buffer->data(), bufferLength, kCFStringEncodingUTF8)) {
    138         buffer->shrink(1);
    139         (*buffer)[0] = 0;
    140     } else
    141         buffer->shrink(strlen(buffer->data()) + 1);
    142     return buffer.release();
    143145}
    144146
     
    195197// UI Client Callbacks
    196198
    197 void InjectedBundlePage::_addMessageToConsole(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo)
    198 {
    199     static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->addMessageToConsole(message, lineNumber);
    200 }
    201 
    202 void InjectedBundlePage::_setStatusbarText(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo)
    203 {
    204     static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->setStatusbarText(statusbarText);
    205 }
    206 
    207 void InjectedBundlePage::addMessageToConsole(WKStringRef message, uint32_t lineNumber)
     199void InjectedBundlePage::_willAddMessageToConsole(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo)
     200{
     201    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willAddMessageToConsole(message, lineNumber);
     202}
     203
     204void InjectedBundlePage::_willSetStatusbarText(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo)
     205{
     206    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willSetStatusbarText(statusbarText);
     207}
     208
     209void InjectedBundlePage::_willRunJavaScriptAlert(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo)
     210{
     211    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willRunJavaScriptAlert(message, frame);
     212}
     213
     214void InjectedBundlePage::_willRunJavaScriptConfirm(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo)
     215{
     216    return static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willRunJavaScriptConfirm(message, frame);
     217}
     218
     219void InjectedBundlePage::_willRunJavaScriptPrompt(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo)
     220{
     221    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willRunJavaScriptPrompt(message, defaultValue, frame);
     222}
     223
     224void InjectedBundlePage::willAddMessageToConsole(WKStringRef message, uint32_t lineNumber)
    208225{
    209226    // FIXME: Strip file: urls.
     
    212229}
    213230
    214 void InjectedBundlePage::setStatusbarText(WKStringRef statusbarText)
     231void InjectedBundlePage::willSetStatusbarText(WKStringRef statusbarText)
    215232{
    216233    if (!InjectedBundle::shared().layoutTestController()->shouldDumpStatusCallbacks())
     
    221238}
    222239
     240void InjectedBundlePage::willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef)
     241{
     242    OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
     243    InjectedBundle::shared().os() << "ALERT: " << utf8Message->data() << "\n";
     244}
     245
     246void InjectedBundlePage::willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef)
     247{
     248    OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
     249    InjectedBundle::shared().os() << "CONFIRM: " << utf8Message->data() << "\n";
     250}
     251
     252void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef)
     253{
     254    OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(message);
     255    OwnPtr<Vector<char> > utf8DefaultValue = WKStringToUTF8(defaultValue);
     256    InjectedBundle::shared().os() << "PROMPT: " << utf8Message->data() << ", default text: " << utf8DefaultValue->data() <<  "\n";
     257}
     258
    223259} // namespace WTR
  • trunk/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h

    r63627 r63850  
    6161
    6262    // UI Client
    63     static void _addMessageToConsole(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
    64     static void _setStatusbarText(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);
    65 
    66     void addMessageToConsole(WKStringRef message, uint32_t lineNumber);
    67     void setStatusbarText(WKStringRef statusbarText);
     63    static void _willAddMessageToConsole(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void* clientInfo);
     64    static void _willSetStatusbarText(WKBundlePageRef page, WKStringRef statusbarText, const void* clientInfo);
     65    static void _willRunJavaScriptAlert(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo);
     66    static void _willRunJavaScriptConfirm(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo);
     67    static void _willRunJavaScriptPrompt(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void* clientInfo);
     68    void willAddMessageToConsole(WKStringRef message, uint32_t lineNumber);
     69    void willSetStatusbarText(WKStringRef statusbarText);
     70    void willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef);
     71    void willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef);
     72    void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef);
    6873
    6974    WKBundlePageRef m_page;
Note: See TracChangeset for help on using the changeset viewer.