Skip to content
Permalink
Browse files
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:



Canonical link: https://commits.webkit.org/54687@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63850 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
weinig committed Jul 21, 2010
1 parent 6ceda08 commit 42da540804715493d2f77d69e4f1a549ab7d6522
Showing 10 changed files with 228 additions and 126 deletions.
@@ -1,3 +1,12 @@
2010-07-21 Sam Weinig <sam@webkit.org>

Reviewed by Anders Carlsson.

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

* platform/mac-wk2/Skipped:

2010-07-21 Tony Chang <tony@chromium.org>

Not reviewed, updating chromium test expectations.
@@ -1,5 +1,5 @@
#
# Copyright (C) 2008 Apple Inc. All rights reserved.
# Copyright (C) 2010 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -718,16 +718,6 @@ platform/mac/editing/input/wrapped-line-char-rect.html
# <https://bugs.webkit.org/show_bug.cgi?id=42194>
compositing/iframes/layout-on-compositing-change.html
editing/deleting/5390681-2.html
http/tests/local/send-dragged-file.html
http/tests/local/send-sliced-dragged-file.html
http/tests/local/blob/send-data-blob.html
http/tests/local/blob/send-sliced-data-blob.html
http/tests/local/formdata/send-form-data-with-sliced-file.html
http/tests/local/formdata/send-form-data.html
http/tests/local/formdata/upload-events.html
http/tests/misc/drag-over-iframe-invalid-source-crash.html
http/tests/security/listener/xss-window-onclick-addEventListener.html
http/tests/security/listener/xss-window-onclick-shortcut.html
editing/deleting/5729680.html
editing/deleting/forward-delete-key.html
editing/input/option-page-up-down.html
@@ -746,6 +736,8 @@ editing/pasteboard/drag-drop-url-text.html
editing/pasteboard/drag-image-in-about-blank-frame.html
editing/pasteboard/drag-image-to-contenteditable-in-iframe.html
editing/pasteboard/drop-inputtext-acquires-style.html
editing/pasteboard/file-input-files-access.html
editing/pasteboard/files-during-page-drags.html
editing/pasteboard/get-data-text-plain-drop.html
editing/selection/14971.html
editing/selection/4895428-1.html
@@ -849,6 +841,7 @@ fast/events/drag-and-drop-dataTransfer-types-nocrash.html
fast/events/drag-and-drop-fire-drag-dragover.html
fast/events/drag-and-drop.html
fast/events/drag-in-frames.html
fast/events/drag-outside-window.html
fast/events/drag-parent-node.html
fast/events/drag-to-navigate.html
fast/events/event-input-contentEditable.html
@@ -997,6 +990,7 @@ fast/forms/textfield-inside-anchor.html
fast/forms/textfield-onchange-deletion.html
fast/forms/textfield-outline.html
fast/forms/textfield-to-password-on-focus.html
fast/frames/frame-dead-region.html
fast/frames/frame-deep-nested-resize.html
fast/frames/hover-timer-crash.html
fast/frames/iframe-window-focus.html
@@ -1022,16 +1016,26 @@ fast/text/international/khmer-selection.html
fast/text/international/thai-offsetForPosition-inside-character.html
fast/text/offsetForPosition-cluster-at-zero.html
fast/text/reset-drag-on-mouse-down.html
http/tests/local/blob/send-data-blob.html
http/tests/local/blob/send-hybrid-blob.html
http/tests/local/blob/send-sliced-data-blob.html
http/tests/local/drag-over-remote-content.html
http/tests/local/formdata/send-form-data-with-sliced-file.html
http/tests/local/formdata/send-form-data.html
http/tests/local/formdata/upload-events.html
http/tests/local/send-dragged-file.html
http/tests/local/send-sliced-dragged-file.html
http/tests/misc/bubble-drag-events.html
http/tests/misc/drag-over-iframe-invalid-source-crash.html
http/tests/misc/isindex-with-no-form.html
http/tests/navigation/no-referrer-same-window.html
http/tests/navigation/no-referrer-subframe.html
http/tests/navigation/redirect-preserves-referrer.html
http/tests/security/clipboard/clipboard-file-access.html
http/tests/security/dataTransfer-set-data-file-url.html
http/tests/security/drag-over-remote-content-iframe.html
http/tests/security/listener/xss-window-onclick-addEventListener.html
http/tests/security/listener/xss-window-onclick-shortcut.html
media/media-fullscreen-inline.html
platform/mac/editing/deleting/backward-delete.html
platform/mac/editing/pasteboard/dataTransfer-set-data-file-url.html
@@ -1372,7 +1376,7 @@ plugins
http/tests/plugins
java
platform/mac/plugins

fast/loader/loadInProgress.html

# WebKit2 needs layoutTestController.overridePreference
# <https://bugs.webkit.org/show_bug.cgi?id=42197>
@@ -2066,7 +2070,7 @@ fast/loader/stateobjects/pushstate-updates-location.html
fast/loader/stateobjects/pushstate-with-fragment-urls-and-hashchange.html
fast/loader/stateobjects/pushstate-within-popstate-handler-assert.html
fast/loader/stateobjects/pushstate-then-replacestate.html

fast/loader/stateobjects/document-destroyed-navigate-back.html
http/tests/loading/state-object-security-exception.html

# WebKitTestRunner needs textInputController
@@ -2160,70 +2164,6 @@ editing/deleting/smart-editing-disabled.html
editing/execCommand/delete-image-in-anchor.html
editing/selection/extend-forward-after-set-base-and-extent.html
editing/selection/select-line.html


# WebKitTestRunner needs to support printing ALERT, PROMPT and CONFIRM messages
# <https://bugs.webkit.org/show_bug.cgi?id=42539>
editing/pasteboard/paste-noscript-xhtml.xhtml
editing/selection/5241148.html
editing/selection/5497643.html
fast/dom/Element/id-in-frameset.html
fast/dom/Geolocation/notimer-after-unload.html
fast/dom/script-element-gc.html
fast/dom/serialize-nodes.xhtml
fast/dom/set-inner-text-newlines.html
fast/dom/Window/alert-undefined.html
fast/events/attribute-listener-cloned-from-frameless-doc.xhtml
fast/events/drag-outside-window.html
fast/events/onload-webkit-before-webcore.html
fast/events/onunload-clears-onbeforeunload.html
fast/events/onunload.html
fast/events/onunload-not-on-body.html
fast/events/onunload-window-property.html
fast/events/pageshow-pagehide-on-back-uncached.html
fast/events/resize-subframe.html
fast/frames/frame-dead-region.html
fast/frames/frame-js-url-clientWidth.html
fast/frames/frame-name-reset.html
fast/frames/frameElement-widthheight.html
fast/frames/iframe-display-none.html
fast/frames/location-change.html
fast/frames/location-change-no-file-access.html
fast/frames/sandboxed-iframe-navigation-top-by-name-denied.html
fast/frames/set-unloaded-frame-location.html
fast/inspector-support/cssURLQuotes.html
fast/loader/for-window-event-onload-scripts.html
fast/loader/hashchange-event.html
fast/loader/loadInProgress.html
fast/loader/local-svg-parsed-as-svg.svg
fast/loader/non-deferred-substitute-load.html
fast/loader/onhashchange-attribute-listeners.html
fast/loader/simultaneous-reloads-assert.html
fast/loader/stateobjects/document-destroyed-navigate-back.html
fast/parser/parseCommentsInTitles.html
fast/xsl/subframe-location.html
http/tests/cookies/third-party-cookie-relaxing.html
http/tests/misc/DOMContentLoaded-event.html
http/tests/misc/embedCrasher.html
http/tests/misc/frame-default-enc-different-domain.html
http/tests/misc/frame-default-enc-same-domain.html
http/tests/misc/onload-remove-iframe-crash-2.html
http/tests/navigation/history-back-across-form-submission-to-fragment.html
http/tests/security/data-url-inline.css.html
http/tests/security/popup-blocked-from-fake-event.html
http/tests/security/popup-blocked-from-window-open.html
http/tests/xmlhttprequest/readystatechange.html
platform/mac/plugins/bindings-test-objc.html
storage/open-database-creation-callback-isolated-world.html
storage/statement-error-callback-isolated-world.html
storage/statement-success-callback-isolated-world.html
storage/transaction-callback-isolated-world.html
storage/transaction-error-callback-isolated-world.html
storage/transaction-success-callback-isolated-world.html
svg/hixie/dynamic/001.xml
websocket/tests/alert-in-event-handler.html
websocket/tests/websocket-pending-activity.html

# WebKitTestRunner needs layoutTestController.clearAllDatabases
# <https://bugs.webkit.org/show_bug.cgi?id=42540>
storage/change-version.html
@@ -2238,6 +2178,12 @@ storage/sql-error-codes.html
storage/statement-error-callback.html
storage/success-callback.html
storage/transaction-error-callback.html
storage/open-database-creation-callback-isolated-world.html
storage/statement-error-callback-isolated-world.html
storage/statement-success-callback-isolated-world.html
storage/transaction-callback-isolated-world.html
storage/transaction-error-callback-isolated-world.html
storage/transaction-success-callback-isolated-world.html

# WebKitTestRunner needs layoutTestController.pathToLocalResource
# <https://bugs.webkit.org/show_bug.cgi?id=42541>
@@ -2298,6 +2244,7 @@ fast/dom/Geolocation/reentrant-success.html
fast/dom/Geolocation/success.html
fast/dom/Geolocation/timeout.html
fast/dom/Geolocation/watch.html
fast/dom/Geolocation/notimer-after-unload.html

# WebKitTestRunner needs layoutTestController.setMockGeolocationPosition
fast/dom/Geolocation/timeout-clear-watch.html
@@ -2443,6 +2390,7 @@ fast/loader/stop-provisional-loads.html
# <https://bugs.webkit.org/show_bug.cgi?id=42692>
fast/xmlhttprequest/xmlhttprequest-no-file-access.html
fast/xmlhttprequest/xmlhttprequest-nonexistent-file.html
fast/frames/location-change-no-file-access.html

# WebKitTestRunner needs layoutTestController.setPrinting
# <https://bugs.webkit.org/show_bug.cgi?id=42693>
@@ -2481,6 +2429,19 @@ http/tests/security/no-referrer.html
# <https://bugs.webkit.org/show_bug.cgi?id=42700>
http/tests/security/setDomainRelaxationForbiddenForURLScheme.html

# WebKit2 needs layoutTestController.setDeferMainResourceDataLoad
# <https://bugs.webkit.org/show_bug.cgi?id=42777>
fast/loader/non-deferred-substitute-load.html

# WebKit2 needs layoutTestController.setAlwaysAcceptCookies
# <https://bugs.webkit.org/show_bug.cgi?id=42778>
http/tests/cookies/third-party-cookie-relaxing.html

# WebKit2 needs layoutTestController.setCloseRemainingWindowsWhenComplete
# <https://bugs.webkit.org/show_bug.cgi?id=42779>
http/tests/security/popup-blocked-from-fake-event.html
http/tests/security/popup-blocked-from-window-open.html

# WebKitTestRunner needs GCController
# <https://bugs.webkit.org/show_bug.cgi?id=42701>
fast/dom/gc-10.html
@@ -2495,6 +2456,7 @@ platform/mac/fast/text/attributed-substring-from-range.html

# WebKitTestRunner needs to print onunload handler information
# <https://bugs.webkit.org/show_bug.cgi?id=42703>
fast/events/onunload-clears-onbeforeunload.html
fast/events/pageshow-pagehide.html
fast/events/stop-load-in-unload-handler-using-document-write.html
fast/events/stop-load-in-unload-handler-using-window-stop.html
@@ -2512,10 +2474,14 @@ fast/loader/unload-hyperlink.html
fast/loader/unload-javascript-url.html
fast/loader/unload-reload.html
fast/loader/unload-window-location.html
http/tests/xmlhttprequest/xhr-onunload.html
http/tests/xmlhttprequest/frame-load-cancelled-abort.html
http/tests/xmlhttprequest/frame-unload-abort-crash.html
http/tests/xmlhttprequest/send-undefined-and-null.html
http/tests/xmlhttprequest/xhr-onunload.html
fast/events/onunload.html
fast/events/onunload-not-on-body.html
fast/events/pageshow-pagehide-on-back-uncached.html
http/tests/navigation/history-back-across-form-submission-to-fragment.html

# WebKitTestRunner needs to print history delegate information
# <https://bugs.webkit.org/show_bug.cgi?id=42704>
@@ -2540,7 +2506,6 @@ http/tests/loading/slow-parsing-subframe.html
http/tests/loading/text-content-type-with-binary-extension.html



# THINGS WE DON'T HAVE AND DON'T WANT

# WebKitTestRunner doesn't have appleScriptController
@@ -2553,11 +2518,10 @@ platform/mac/fast/dom/objc-wrapper-identity.html
platform/mac/fast/dom/wrapper-classes-objc.html
platform/mac/fast/dom/wrapper-round-tripping.html
platform/mac/fast/objc/longlongTest.html
platform/mac/plugins/bindings-test-objc.html

# WebKitTestRunner doesn't have eventSender.enableDOMUIEventLogging
platform/mac/fast/events/objc-event-api.html

# WebKitTestRunner doesn't have eventSender.fireKeyboardEventsToElement
platform/mac/fast/events/objc-keyboard-event-creation.html


@@ -1,3 +1,28 @@
2010-07-21 Sam Weinig <sam@webkit.org>

Reviewed by Anders Carlsson.

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

- 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):

2010-07-21 Simon Fraser <simon.fraser@apple.com>

Windows build fix.
@@ -60,14 +60,20 @@ struct WKBundlePageLoaderClient {
typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;

// UI Client
typedef void (*WKBundlePageAddMessageToConsoleCallback)(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
typedef void (*WKBundlePageSetStatusbarTextCallback)(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);
typedef void (*WKBundlePageWillAddMessageToConsoleCallback)(WKBundlePageRef page, WKStringRef message, uint32_t lineNumber, const void *clientInfo);
typedef void (*WKBundlePageWillSetStatusbarTextCallback)(WKBundlePageRef page, WKStringRef statusbarText, const void *clientInfo);
typedef void (*WKBundlePageWillRunJavaScriptAlertCallback)(WKBundlePageRef page, WKStringRef alertText, WKBundleFrameRef frame, const void *clientInfo);
typedef void (*WKBundlePageWillRunJavaScriptConfirmCallback)(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo);
typedef void (*WKBundlePageWillRunJavaScriptPromptCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo);

struct WKBundlePageUIClient {
int version;
const void * clientInfo;
WKBundlePageAddMessageToConsoleCallback addMessageToConsole;
WKBundlePageSetStatusbarTextCallback setStatusbarText;
WKBundlePageWillAddMessageToConsoleCallback willAddMessageToConsole;
WKBundlePageWillSetStatusbarTextCallback willSetStatusbarText;
WKBundlePageWillRunJavaScriptAlertCallback willRunJavaScriptAlert;
WKBundlePageWillRunJavaScriptConfirmCallback willRunJavaScriptConfirm;
WKBundlePageWillRunJavaScriptPromptCallback willRunJavaScriptPrompt;
};
typedef struct WKBundlePageUIClient WKBundlePageUIClient;

@@ -46,16 +46,34 @@ void InjectedBundlePageUIClient::initialize(WKBundlePageUIClient* client)
memset(&m_client, 0, sizeof(m_client));
}

void InjectedBundlePageUIClient::addMessageToConsole(WebPage* page, const String& message, int32_t lineNumber)
void InjectedBundlePageUIClient::willAddMessageToConsole(WebPage* page, const String& message, int32_t lineNumber)
{
if (m_client.addMessageToConsole)
m_client.addMessageToConsole(toRef(page), toRef(message.impl()), lineNumber, m_client.clientInfo);
if (m_client.willAddMessageToConsole)
m_client.willAddMessageToConsole(toRef(page), toRef(message.impl()), lineNumber, m_client.clientInfo);
}

void InjectedBundlePageUIClient::setStatusbarText(WebPage* page, const String& statusbarText)
void InjectedBundlePageUIClient::willSetStatusbarText(WebPage* page, const String& statusbarText)
{
if (m_client.setStatusbarText)
m_client.setStatusbarText(toRef(page), toRef(statusbarText.impl()), m_client.clientInfo);
if (m_client.willSetStatusbarText)
m_client.willSetStatusbarText(toRef(page), toRef(statusbarText.impl()), m_client.clientInfo);
}

void InjectedBundlePageUIClient::willRunJavaScriptAlert(WebPage* page, const String& alertText, WebFrame* frame)
{
if (m_client.willRunJavaScriptAlert)
m_client.willRunJavaScriptAlert(toRef(page), toRef(alertText.impl()), toRef(frame), m_client.clientInfo);
}

void InjectedBundlePageUIClient::willRunJavaScriptConfirm(WebPage* page, const String& message, WebFrame* frame)
{
if (m_client.willRunJavaScriptConfirm)
m_client.willRunJavaScriptConfirm(toRef(page), toRef(message.impl()), toRef(frame), m_client.clientInfo);
}

void InjectedBundlePageUIClient::willRunJavaScriptPrompt(WebPage* page, const String& message, const String& defaultValue, WebFrame* frame)
{
if (m_client.willRunJavaScriptPrompt)
m_client.willRunJavaScriptPrompt(toRef(page), toRef(message.impl()), toRef(defaultValue.impl()), toRef(frame), m_client.clientInfo);
}

} // namespace WebKit
@@ -34,15 +34,19 @@ namespace WebCore {

namespace WebKit {

class WebFrame;
class WebPage;

class InjectedBundlePageUIClient {
public:
InjectedBundlePageUIClient();
void initialize(WKBundlePageUIClient*);

void addMessageToConsole(WebPage*, const WebCore::String& message, int32_t lineNumber);
void setStatusbarText(WebPage*, const WebCore::String&);
void willAddMessageToConsole(WebPage*, const WebCore::String& message, int32_t lineNumber);
void willSetStatusbarText(WebPage*, const WebCore::String&);
void willRunJavaScriptAlert(WebPage*, const WebCore::String&, WebFrame*);
void willRunJavaScriptConfirm(WebPage*, const WebCore::String&, WebFrame*);
void willRunJavaScriptPrompt(WebPage*, const WebCore::String&, const WebCore::String&, WebFrame*);

private:
WKBundlePageUIClient m_client;

0 comments on commit 42da540

Please sign in to comment.