summaryrefslogtreecommitdiff
path: root/Tools/WebKitTestRunner/InjectedBundle
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/WebKitTestRunner/InjectedBundle')
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp22
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h6
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.cpp2
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.h6
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.cpp2
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.h6
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp60
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h59
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl45
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityTextMarker.idl29
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityTextMarkerRange.idl29
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl246
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm570
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl72
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/GCController.idl31
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl223
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl32
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp327
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h16
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/GCController.cpp8
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp254
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h30
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp4
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp542
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h7
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp422
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/TestRunner.h66
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/TextInputController.cpp10
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp29
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp69
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.h3
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp498
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp10
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.cpp6
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.h2
-rw-r--r--Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp25
36 files changed, 702 insertions, 3066 deletions
diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp
index 8b223fe4c..f5d1bd58b 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp
@@ -32,9 +32,9 @@
#include "JSAccessibilityController.h"
#include <JavaScriptCore/JSRetainPtr.h>
-#include <WebKit/WKBundle.h>
-#include <WebKit/WKBundlePage.h>
-#include <WebKit/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundle.h>
+#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundlePagePrivate.h>
namespace WTR {
@@ -61,20 +61,10 @@ JSClassRef AccessibilityController::wrapperClass()
return JSAccessibilityController::accessibilityControllerClass();
}
-void AccessibilityController::enableEnhancedAccessibility(bool enable)
-{
- WKAccessibilityEnableEnhancedAccessibility(enable);
-}
-
-bool AccessibilityController::enhancedAccessibilityEnabled()
-{
- return WKAccessibilityEnhancedAccessibilityEnabled();
-}
-
#if !PLATFORM(GTK) && !PLATFORM(EFL)
PassRefPtr<AccessibilityUIElement> AccessibilityController::rootElement()
{
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
void* root = WKAccessibilityRootObject(page);
return AccessibilityUIElement::create(static_cast<PlatformUIElement>(root));
@@ -82,7 +72,7 @@ PassRefPtr<AccessibilityUIElement> AccessibilityController::rootElement()
PassRefPtr<AccessibilityUIElement> AccessibilityController::focusedElement()
{
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
void* root = WKAccessibilityFocusedObject(page);
return AccessibilityUIElement::create(static_cast<PlatformUIElement>(root));
@@ -97,7 +87,7 @@ PassRefPtr<AccessibilityUIElement> AccessibilityController::elementAtPoint(int x
// Unsupported methods on various platforms.
// As they're implemented on other platforms this list should be modified.
-#if (!PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(EFL)) || !HAVE(ACCESSIBILITY)
+#if (!PLATFORM(GTK) && !PLATFORM(MAC) && !PLATFORM(EFL)) || !HAVE(ACCESSIBILITY)
bool AccessibilityController::addNotificationListener(JSValueRef) { return false; }
bool AccessibilityController::removeNotificationListener() { return false; }
PassRefPtr<AccessibilityUIElement> AccessibilityController::accessibleElementById(JSStringRef attribute) { return nullptr; }
diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h
index e099544a1..7ce1a45c3 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h
@@ -44,10 +44,6 @@ public:
void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
virtual JSClassRef wrapperClass();
- // Enhanced accessibility.
- void enableEnhancedAccessibility(bool);
- bool enhancedAccessibilityEnabled();
-
JSRetainPtr<JSStringRef> platformName();
// Controller Methods - platform-independent implementations.
@@ -70,7 +66,7 @@ public:
private:
AccessibilityController();
-#if PLATFORM(COCOA) || PLATFORM(IOS)
+#if PLATFORM(MAC)
RetainPtr<NotificationHandler> m_globalNotificationHandler;
#endif
diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.cpp b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.cpp
index 051114db1..a7a4b7def 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.cpp
@@ -60,7 +60,7 @@ AccessibilityTextMarker::~AccessibilityTextMarker()
PlatformTextMarker AccessibilityTextMarker::platformTextMarker() const
{
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
return m_textMarker.get();
#else
return m_textMarker;
diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.h b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.h
index 74341718c..c4d4d0481 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarker.h
@@ -31,7 +31,7 @@
#include <wtf/PassRefPtr.h>
#include <wtf/Platform.h>
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
typedef CFTypeRef PlatformTextMarker;
#else
@@ -59,14 +59,14 @@ private:
AccessibilityTextMarker(PlatformTextMarker);
AccessibilityTextMarker(const AccessibilityTextMarker&);
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
RetainPtr<PlatformTextMarker> m_textMarker;
#else
PlatformTextMarker m_textMarker;
#endif
};
-#if !PLATFORM(COCOA)
+#if !PLATFORM(MAC)
inline bool AccessibilityTextMarker::isEqual(AccessibilityTextMarker*) { return false; }
#endif
diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.cpp b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.cpp
index 53d8bfbe8..3613f3728 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.cpp
@@ -60,7 +60,7 @@ AccessibilityTextMarkerRange::~AccessibilityTextMarkerRange()
PlatformTextMarkerRange AccessibilityTextMarkerRange::platformTextMarkerRange() const
{
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
return m_textMarkerRange.get();
#else
return m_textMarkerRange;
diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.h b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.h
index d3e685b2d..e57a29cd7 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityTextMarkerRange.h
@@ -31,7 +31,7 @@
#include <wtf/PassRefPtr.h>
#include <wtf/Platform.h>
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
typedef CFTypeRef PlatformTextMarkerRange;
#else
@@ -57,14 +57,14 @@ private:
AccessibilityTextMarkerRange(PlatformTextMarkerRange);
AccessibilityTextMarkerRange(const AccessibilityTextMarkerRange&);
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
RetainPtr<PlatformTextMarkerRange> m_textMarkerRange;
#else
PlatformTextMarkerRange m_textMarkerRange;
#endif
};
-#if !PLATFORM(COCOA)
+#if !PLATFORM(MAC)
inline bool AccessibilityTextMarkerRange::isEqual(AccessibilityTextMarkerRange*) { return false; }
#endif
diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp
index e5b293a5c..00e965ff3 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp
@@ -53,30 +53,6 @@ bool AccessibilityUIElement::isValid() const
return m_element;
}
-// iOS specific methods
-#if !PLATFORM(IOS)
-JSRetainPtr<JSStringRef> AccessibilityUIElement::identifier() { return nullptr; }
-JSRetainPtr<JSStringRef> AccessibilityUIElement::traits() { return nullptr; }
-int AccessibilityUIElement::elementTextPosition() { return 0; }
-int AccessibilityUIElement::elementTextLength() { return 0; }
-JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForSelection() { return nullptr; }
-JSValueRef AccessibilityUIElement::elementsForRange(unsigned, unsigned) { return nullptr; }
-void AccessibilityUIElement::increaseTextSelection() { }
-void AccessibilityUIElement::decreaseTextSelection() { }
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::linkedElement() { return nullptr; }
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::headerElementAtIndex(unsigned) { return nullptr; }
-void AccessibilityUIElement::assistiveTechnologySimulatedFocus() { return; }
-bool AccessibilityUIElement::scrollPageUp() { return false; }
-bool AccessibilityUIElement::scrollPageDown() { return false; }
-bool AccessibilityUIElement::scrollPageLeft() { return false; }
-bool AccessibilityUIElement::scrollPageRight() { return false; }
-bool AccessibilityUIElement::hasContainedByFieldsetTrait() { return false; }
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::fieldsetAncestorElement() { return nullptr; }
-bool AccessibilityUIElement::isSearchField() const { return false; }
-bool AccessibilityUIElement::isTextArea() const { return false; }
-
-#endif
-
// Unsupported methods on various platforms. As they're implemented on other platforms this list should be modified.
#if (!PLATFORM(GTK) && !PLATFORM(EFL)) || !HAVE(ACCESSIBILITY)
JSRetainPtr<JSStringRef> AccessibilityUIElement::characterAtOffset(int) { return 0; }
@@ -85,7 +61,7 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::lineAtOffset(int) { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::sentenceAtOffset(int) { return 0; }
#endif
-#if (!PLATFORM(COCOA) && !PLATFORM(GTK) && !PLATFORM(EFL)) || !HAVE(ACCESSIBILITY)
+#if (!PLATFORM(MAC) && !PLATFORM(GTK) && !PLATFORM(EFL)) || !HAVE(ACCESSIBILITY)
AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement) { }
AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement&) { }
AccessibilityUIElement::~AccessibilityUIElement() { }
@@ -123,7 +99,6 @@ bool AccessibilityUIElement::isDecrementActionSupported() { return false; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::role() { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::subrole() { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::roleDescription() { return 0; }
-JSRetainPtr<JSStringRef> AccessibilityUIElement::computedRoleString() { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::title() { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::description() { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::language() { return 0; }
@@ -150,8 +125,6 @@ bool AccessibilityUIElement::isSelectedOptionActive() const { return false; }
bool AccessibilityUIElement::isSelectable() const { return false; }
bool AccessibilityUIElement::isMultiSelectable() const { return false; }
void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement*) const { }
-void AccessibilityUIElement::setSelectedChildAtIndex(unsigned) const { }
-void AccessibilityUIElement::removeSelectionAtIndex(unsigned) const { }
unsigned AccessibilityUIElement::selectedChildrenCount() const { return 0; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::selectedChildAtIndex(unsigned) const { return 0; }
bool AccessibilityUIElement::isExpanded() const { return false; }
@@ -180,15 +153,12 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::rowIndexRange() { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::columnIndexRange() { return 0; }
int AccessibilityUIElement::rowCount() { return 0; }
int AccessibilityUIElement::columnCount() { return 0; }
-JSValueRef AccessibilityUIElement::rowHeaders() const { return nullptr; }
-JSValueRef AccessibilityUIElement::columnHeaders() const { return nullptr; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::selectedRowAtIndex(unsigned) { return 0; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::disclosedByRow() { return 0; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::disclosedRowAtIndex(unsigned) { return 0; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::rowAtIndex(unsigned) { return 0; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned) { return 0; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned) { return 0; }
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaControlsElementAtIndex(unsigned) { return nullptr; }
bool AccessibilityUIElement::ariaIsGrabbed() const { return false; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::ariaDropEffects() const { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::classList() const { return 0; }
@@ -197,19 +167,16 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::rangeForLine(int) { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::rangeForPosition(int, int) { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::boundsForRange(unsigned, unsigned) { return 0; }
bool AccessibilityUIElement::setSelectedTextRange(unsigned, unsigned) { return false; }
-bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange*) { return false; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForRange(unsigned, unsigned) { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) { return 0; }
bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned) { return false; }
-unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef, AccessibilityUIElement*, bool, JSValueRef, JSStringRef, bool, bool) { return 0; }
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement*, bool, JSValueRef, JSStringRef, bool, bool) { return 0; }
-JSRetainPtr<JSStringRef> AccessibilityUIElement::selectTextWithCriteria(JSContextRef, JSStringRef, JSValueRef, JSStringRef, JSStringRef) { return nullptr; }
+unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef, AccessibilityUIElement*, bool, JSValueRef, JSStringRef, bool) { return 0; }
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement*, bool, JSValueRef, JSStringRef, bool) { return 0; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::cellForColumnAndRow(unsigned, unsigned) { return 0; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::horizontalScrollbar() const { return 0; }
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::verticalScrollbar() const { return 0; }
bool AccessibilityUIElement::addNotificationListener(JSValueRef) { return false; }
bool AccessibilityUIElement::removeNotificationListener() { return false; }
-PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::lineTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; }
PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForElement(AccessibilityUIElement*) { return 0; }
int AccessibilityUIElement::textMarkerRangeLength(AccessibilityTextMarkerRange*) { return 0; }
PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForMarkers(AccessibilityTextMarker*, AccessibilityTextMarker*) { return 0; }
@@ -229,8 +196,6 @@ int AccessibilityUIElement::indexForTextMarker(AccessibilityTextMarker*) { retur
bool AccessibilityUIElement::isTextMarkerValid(AccessibilityTextMarker*) { return false; }
PassRefPtr<AccessibilityTextMarker> AccessibilityUIElement::textMarkerForIndex(int) { return 0; }
void AccessibilityUIElement::scrollToMakeVisible() { }
-void AccessibilityUIElement::scrollToGlobalPoint(int, int) { }
-void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int, int, int, int) { }
JSRetainPtr<JSStringRef> AccessibilityUIElement::supportedActions() const { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::mathPostscriptsDescription() const { return 0; }
JSRetainPtr<JSStringRef> AccessibilityUIElement::mathPrescriptsDescription() const { return 0; }
@@ -238,24 +203,5 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::pathDescription() const { retur
#endif
-#if !PLATFORM(MAC) || !HAVE(ACCESSIBILITY)
-PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::selectedTextMarkerRange() { return nullptr; }
-void AccessibilityUIElement::resetSelectedTextMarkerRange() { }
-void AccessibilityUIElement::setBoolAttributeValue(JSStringRef, bool) { }
-#endif
-
-#if (!PLATFORM(MAC) && !PLATFORM(IOS)) || !HAVE(ACCESSIBILITY)
-PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; }
-PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; }
-PassRefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousWordStartTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; }
-PassRefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextWordEndTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; }
-PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; }
-PassRefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; }
-PassRefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; }
-PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker(AccessibilityTextMarker*) { return nullptr; }
-PassRefPtr<AccessibilityTextMarker> AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; }
-PassRefPtr<AccessibilityTextMarker> AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker*) { return nullptr; }
-#endif
-
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
index 3f39a1781..807b82446 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h
@@ -35,7 +35,7 @@
#include <wtf/Platform.h>
#include <wtf/Vector.h>
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
#ifdef __OBJC__
typedef id PlatformUIElement;
#else
@@ -44,13 +44,13 @@ typedef struct objc_object* PlatformUIElement;
#elif HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
#include "AccessibilityNotificationHandlerAtk.h"
#include <atk/atk.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
typedef GRefPtr<AtkObject> PlatformUIElement;
#else
typedef void* PlatformUIElement;
#endif
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
#ifdef __OBJC__
typedef id NotificationHandler;
#else
@@ -105,7 +105,6 @@ public:
JSValueRef uiElementArrayAttributeValue(JSStringRef attribute) const;
PassRefPtr<AccessibilityUIElement> uiElementAttributeValue(JSStringRef attribute) const;
bool boolAttributeValue(JSStringRef attribute);
- void setBoolAttributeValue(JSStringRef attribute, bool value);
bool isAttributeSupported(JSStringRef attribute);
bool isAttributeSettable(JSStringRef attribute);
bool isPressActionSupported();
@@ -114,7 +113,6 @@ public:
JSRetainPtr<JSStringRef> role();
JSRetainPtr<JSStringRef> subrole();
JSRetainPtr<JSStringRef> roleDescription();
- JSRetainPtr<JSStringRef> computedRoleString();
JSRetainPtr<JSStringRef> title();
JSRetainPtr<JSStringRef> description();
JSRetainPtr<JSStringRef> language();
@@ -142,8 +140,6 @@ public:
bool isSelectable() const;
bool isMultiSelectable() const;
void setSelectedChild(AccessibilityUIElement*) const;
- void setSelectedChildAtIndex(unsigned) const;
- void removeSelectionAtIndex(unsigned) const;
unsigned selectedChildrenCount() const;
PassRefPtr<AccessibilityUIElement> selectedChildAtIndex(unsigned) const;
@@ -191,7 +187,6 @@ public:
// ARIA specific
PassRefPtr<AccessibilityUIElement> ariaOwnsElementAtIndex(unsigned);
PassRefPtr<AccessibilityUIElement> ariaFlowToElementAtIndex(unsigned);
- PassRefPtr<AccessibilityUIElement> ariaControlsElementAtIndex(unsigned);
// ARIA Drag and Drop
bool ariaIsGrabbed() const;
@@ -207,9 +202,8 @@ public:
JSRetainPtr<JSStringRef> stringForRange(unsigned location, unsigned length);
JSRetainPtr<JSStringRef> attributedStringForRange(unsigned location, unsigned length);
bool attributedStringRangeIsMisspelled(unsigned location, unsigned length);
- unsigned uiElementCountForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly);
- PassRefPtr<AccessibilityUIElement> uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly);
- JSRetainPtr<JSStringRef> selectTextWithCriteria(JSContextRef, JSStringRef ambiguityResolution, JSValueRef searchStrings, JSStringRef replacementString, JSStringRef activity);
+ unsigned uiElementCountForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly);
+ PassRefPtr<AccessibilityUIElement> uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly);
// Text-specific
JSRetainPtr<JSStringRef> characterAtOffset(int offset);
@@ -225,15 +219,10 @@ public:
PassRefPtr<AccessibilityUIElement> verticalScrollbar() const;
void scrollToMakeVisible();
- void scrollToGlobalPoint(int x, int y);
- void scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height);
// Text markers.
- PassRefPtr<AccessibilityTextMarkerRange> lineTextMarkerRangeForTextMarker(AccessibilityTextMarker*);
PassRefPtr<AccessibilityTextMarkerRange> textMarkerRangeForElement(AccessibilityUIElement*);
PassRefPtr<AccessibilityTextMarkerRange> textMarkerRangeForMarkers(AccessibilityTextMarker* startMarker, AccessibilityTextMarker* endMarker);
- PassRefPtr<AccessibilityTextMarkerRange> selectedTextMarkerRange();
- void resetSelectedTextMarkerRange();
PassRefPtr<AccessibilityTextMarker> startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*);
PassRefPtr<AccessibilityTextMarker> endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange*);
PassRefPtr<AccessibilityTextMarker> endTextMarkerForBounds(int x, int y, int width, int height);
@@ -250,17 +239,6 @@ public:
PassRefPtr<AccessibilityTextMarker> textMarkerForIndex(int);
PassRefPtr<AccessibilityTextMarker> startTextMarker();
PassRefPtr<AccessibilityTextMarker> endTextMarker();
- bool setSelectedVisibleTextRange(AccessibilityTextMarkerRange*);
- PassRefPtr<AccessibilityTextMarkerRange> leftWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*);
- PassRefPtr<AccessibilityTextMarkerRange> rightWordTextMarkerRangeForTextMarker(AccessibilityTextMarker*);
- PassRefPtr<AccessibilityTextMarker> previousWordStartTextMarkerForTextMarker(AccessibilityTextMarker*);
- PassRefPtr<AccessibilityTextMarker> nextWordEndTextMarkerForTextMarker(AccessibilityTextMarker*);
- PassRefPtr<AccessibilityTextMarkerRange> paragraphTextMarkerRangeForTextMarker(AccessibilityTextMarker*);
- PassRefPtr<AccessibilityTextMarker> nextParagraphEndTextMarkerForTextMarker(AccessibilityTextMarker*);
- PassRefPtr<AccessibilityTextMarker> previousParagraphStartTextMarkerForTextMarker(AccessibilityTextMarker*);
- PassRefPtr<AccessibilityTextMarkerRange> sentenceTextMarkerRangeForTextMarker(AccessibilityTextMarker*);
- PassRefPtr<AccessibilityTextMarker> nextSentenceEndTextMarkerForTextMarker(AccessibilityTextMarker*);
- PassRefPtr<AccessibilityTextMarker> previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker*);
// Returns an ordered list of supported actions for an element.
JSRetainPtr<JSStringRef> supportedActions() const;
@@ -275,29 +253,6 @@ public:
// Make sure you call remove, because you can't rely on objects being deallocated in a timely fashion.
bool removeNotificationListener();
- JSRetainPtr<JSStringRef> identifier();
- JSRetainPtr<JSStringRef> traits();
- int elementTextPosition();
- int elementTextLength();
- JSRetainPtr<JSStringRef> stringForSelection();
- JSValueRef elementsForRange(unsigned location, unsigned length);
- void increaseTextSelection();
- void decreaseTextSelection();
- PassRefPtr<AccessibilityUIElement> linkedElement();
- PassRefPtr<AccessibilityUIElement> headerElementAtIndex(unsigned index);
- void assistiveTechnologySimulatedFocus();
- bool isSearchField() const;
- bool isTextArea() const;
-
- bool scrollPageUp();
- bool scrollPageDown();
- bool scrollPageLeft();
- bool scrollPageRight();
-
- // Fieldset
- bool hasContainedByFieldsetTrait();
- PassRefPtr<AccessibilityUIElement> fieldsetAncestorElement();
-
private:
AccessibilityUIElement(PlatformUIElement);
AccessibilityUIElement(const AccessibilityUIElement&);
@@ -306,7 +261,7 @@ private:
// A retained, platform specific object used to help manage notifications for this object.
#if HAVE(ACCESSIBILITY)
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
NotificationHandler m_notificationHandler;
void getLinkedUIElements(Vector<RefPtr<AccessibilityUIElement> >&);
@@ -315,7 +270,7 @@ private:
void getUIElementsWithAttribute(JSStringRef, Vector<RefPtr<AccessibilityUIElement> >&) const;
#endif
-#if PLATFORM(COCOA) || PLATFORM(GTK) || PLATFORM(EFL)
+#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL)
void getChildren(Vector<RefPtr<AccessibilityUIElement> >&);
void getChildrenWithRange(Vector<RefPtr<AccessibilityUIElement> >&, unsigned location, unsigned length);
#endif
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl
deleted file mode 100644
index 3831154e0..000000000
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-interface AccessibilityController {
- void enableEnhancedAccessibility(boolean enable);
- readonly attribute boolean enhancedAccessibilityEnabled;
-
- readonly attribute DOMString platformName;
- readonly attribute AccessibilityUIElement rootElement;
- readonly attribute AccessibilityUIElement focusedElement;
- AccessibilityUIElement elementAtPoint(int x, int y);
- AccessibilityUIElement accessibleElementById(DOMString id);
-
- boolean addNotificationListener(object functionCallback);
- boolean removeNotificationListener();
-
- void logFocusEvents();
- void logValueChangeEvents();
- void logScrollingStartEvents();
- void logAccessibilityEvents();
- void resetToConsistentState();
-};
-
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityTextMarker.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityTextMarker.idl
deleted file mode 100644
index 149c95f34..000000000
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityTextMarker.idl
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-interface AccessibilityTextMarker {
- boolean isEqual(AccessibilityTextMarker otherMarker);
-};
-
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityTextMarkerRange.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityTextMarkerRange.idl
deleted file mode 100644
index 962c584e6..000000000
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityTextMarkerRange.idl
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-interface AccessibilityTextMarkerRange {
- boolean isEqual(AccessibilityTextMarkerRange otherMarkerRange);
-};
-
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
deleted file mode 100644
index 2398be687..000000000
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-interface AccessibilityUIElement {
- boolean isEqual(AccessibilityUIElement otherElement);
-
- // Document information
- readonly attribute DOMString documentEncoding;
- readonly attribute DOMString documentURI;
-
- // Element access.
- AccessibilityUIElement elementAtPoint(int x, int y);
- AccessibilityUIElement childAtIndex(unsigned long index);
- unsigned long indexOfChild(AccessibilityUIElement child);
- AccessibilityUIElement linkedUIElementAtIndex(unsigned long index);
- AccessibilityUIElement selectedChildAtIndex(unsigned long index);
- void setSelectedChild(AccessibilityUIElement element);
- void setSelectedChildAtIndex(unsigned long index);
- void removeSelectionAtIndex(unsigned long index);
- AccessibilityUIElement titleUIElement();
- AccessibilityUIElement parentElement();
-
- readonly attribute DOMString role;
- readonly attribute DOMString subrole;
- readonly attribute DOMString roleDescription;
- readonly attribute DOMString computedRoleString;
- readonly attribute DOMString title;
- readonly attribute DOMString description;
- readonly attribute DOMString language;
- readonly attribute DOMString helpText;
- readonly attribute DOMString valueDescription;
- readonly attribute DOMString url;
- readonly attribute DOMString speak;
- readonly attribute DOMString orientation;
- readonly attribute int insertionPointLineNumber;
- readonly attribute DOMString selectedTextRange;
-
- DOMString stringAttributeValue(DOMString attr);
- double numberAttributeValue(DOMString attr);
- object uiElementArrayAttributeValue(DOMString attr);
- AccessibilityUIElement uiElementAttributeValue(DOMString attr);
- boolean boolAttributeValue(DOMString attr);
- void setBoolAttributeValue(DOMString attr, boolean value);
- boolean isAttributeSupported(DOMString attr);
- boolean isAttributeSettable(DOMString attr);
- boolean isPressActionSupported();
- boolean isIncrementActionSupported();
- boolean isDecrementActionSupported();
-
- readonly attribute DOMString stringValue;
- readonly attribute int intValue;
- readonly attribute int minValue;
- readonly attribute int maxValue;
-
- readonly attribute boolean isEnabled;
- readonly attribute boolean isRequired;
- readonly attribute boolean isFocused;
- readonly attribute boolean isFocusable;
- readonly attribute boolean isSelectable;
- readonly attribute boolean isSelected;
- readonly attribute boolean isSelectedOptionActive;
- readonly attribute boolean isMultiSelectable;
- readonly attribute boolean isExpanded;
- readonly attribute boolean isChecked;
- readonly attribute boolean isIndeterminate;
- readonly attribute boolean isVisible;
- readonly attribute boolean isCollapsed;
- readonly attribute boolean hasPopup;
- readonly attribute boolean isIgnored;
- readonly attribute boolean isOffScreen;
- readonly attribute boolean isValid;
- readonly attribute int hierarchicalLevel;
- readonly attribute boolean ariaIsGrabbed;
- readonly attribute DOMString ariaDropEffects;
- readonly attribute DOMString classList;
-
- readonly attribute int x;
- readonly attribute int y;
- readonly attribute int width;
- readonly attribute int height;
- readonly attribute int clickPointX;
- readonly attribute int clickPointY;
-
- readonly attribute int childrenCount;
- readonly attribute int selectedChildrenCount;
- readonly attribute int rowCount;
- readonly attribute int columnCount;
-
- // Actions.
- void increment();
- void decrement();
- void press();
- void showMenu();
-
- // Attribute info.
- DOMString allAttributes();
- DOMString attributesOfChildren();
- DOMString attributesOfLinkedUIElements();
- DOMString attributesOfDocumentLinks();
-
- // Text info.
- DOMString characterAtOffset(int offset);
- DOMString wordAtOffset(int offset);
- DOMString lineAtOffset(int offset);
- DOMString sentenceAtOffset(int offset);
-
- // Table info.
- DOMString attributesOfColumnHeaders();
- DOMString attributesOfRowHeaders();
- DOMString attributesOfColumns();
- DOMString attributesOfRows();
- DOMString attributesOfVisibleCells();
- DOMString attributesOfHeader();
- AccessibilityUIElement cellForColumnAndRow(unsigned long column, unsigned long row);
- AccessibilityUIElement selectedRowAtIndex(unsigned long index);
- AccessibilityUIElement disclosedByRow();
- AccessibilityUIElement disclosedRowAtIndex(unsigned long index);
- AccessibilityUIElement rowAtIndex(unsigned long index);
- int indexInTable();
- DOMString rowIndexRange();
- DOMString columnIndexRange();
- int rowCount();
- int columnCount();
- object columnHeaders();
- object rowHeaders();
-
- AccessibilityUIElement ariaOwnsElementAtIndex(unsigned long index);
- AccessibilityUIElement ariaFlowToElementAtIndex(unsigned long index);
- AccessibilityUIElement ariaControlsElementAtIndex(unsigned long index);
-
- // Paramaterized attributes.
- DOMString parameterizedAttributeNames();
- int lineForIndex(int index);
- DOMString rangeForLine(int index);
- DOMString rangeForPosition(int x, int y);
- DOMString boundsForRange(unsigned long location, unsigned long length);
- DOMString stringForRange(unsigned long location, unsigned long length);
- DOMString attributedStringForRange(unsigned long location, unsigned long length);
- boolean attributedStringRangeIsMisspelled(unsigned long location, unsigned long length);
- [PassContext] unsigned int uiElementCountForSearchPredicate(AccessibilityUIElement startElement, boolean isDirectionNext, object searchKey, DOMString searchText, boolean visibleOnly, boolean immediateDescendantsOnly);
- [PassContext] AccessibilityUIElement uiElementForSearchPredicate(AccessibilityUIElement startElement, boolean isDirectionNext, object searchKey, DOMString searchText, boolean visibleOnly, boolean immediateDescendantsOnly);
- [PassContext] DOMString selectTextWithCriteria(DOMString ambiguityResolution, object searchStrings, DOMString replacementString, DOMString activity);
- boolean setSelectedTextRange(unsigned long location, unsigned long length);
-
- // Scroll area attributes.
- readonly attribute AccessibilityUIElement horizontalScrollbar;
- readonly attribute AccessibilityUIElement verticalScrollbar;
-
- void scrollToMakeVisible();
- void scrollToGlobalPoint(int x, int y);
- void scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height);
-
- void takeFocus();
- boolean scrollPageDown();
- boolean scrollPageUp();
- boolean scrollPageLeft();
- boolean scrollPageRight();
-
- // Text markers.
- AccessibilityTextMarkerRange lineTextMarkerRangeForTextMarker(AccessibilityTextMarker textMarker);
- AccessibilityTextMarkerRange textMarkerRangeForElement(AccessibilityUIElement element);
- AccessibilityTextMarkerRange textMarkerRangeForMarkers(AccessibilityTextMarker startMarker, AccessibilityTextMarker endMarker);
- AccessibilityTextMarkerRange selectedTextMarkerRange();
- void resetSelectedTextMarkerRange();
- AccessibilityTextMarker startTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange range);
- AccessibilityTextMarker endTextMarkerForTextMarkerRange(AccessibilityTextMarkerRange range);
- AccessibilityTextMarker endTextMarkerForBounds(int x, int y, int width, int height);
- AccessibilityTextMarker startTextMarkerForBounds(int x, int y, int width, int height);
- AccessibilityTextMarker textMarkerForPoint(int x, int y);
- AccessibilityTextMarker previousTextMarker(AccessibilityTextMarker marker);
- AccessibilityTextMarker nextTextMarker(AccessibilityTextMarker marker);
- AccessibilityUIElement accessibilityElementForTextMarker(AccessibilityTextMarker marker);
- DOMString stringForTextMarkerRange(AccessibilityTextMarkerRange range);
- int textMarkerRangeLength(AccessibilityTextMarkerRange range);
- boolean attributedStringForTextMarkerRangeContainsAttribute(DOMString attr, AccessibilityTextMarkerRange range);
- int indexForTextMarker(AccessibilityTextMarker marker);
- boolean isTextMarkerValid(AccessibilityTextMarker marker);
- AccessibilityTextMarker textMarkerForIndex(int textIndex);
- readonly attribute AccessibilityTextMarker startTextMarker;
- readonly attribute AccessibilityTextMarker endTextMarker;
- boolean setSelectedVisibleTextRange(AccessibilityTextMarkerRange range);
- AccessibilityTextMarkerRange leftWordTextMarkerRangeForTextMarker(AccessibilityTextMarker textMarker);
- AccessibilityTextMarkerRange rightWordTextMarkerRangeForTextMarker(AccessibilityTextMarker textMarker);
- AccessibilityTextMarker previousWordStartTextMarkerForTextMarker(AccessibilityTextMarker textMarker);
- AccessibilityTextMarker nextWordEndTextMarkerForTextMarker(AccessibilityTextMarker textMarker);
- AccessibilityTextMarkerRange paragraphTextMarkerRangeForTextMarker(AccessibilityTextMarker textMarker);
- AccessibilityTextMarker previousParagraphStartTextMarkerForTextMarker(AccessibilityTextMarker textMarker);
- AccessibilityTextMarker nextParagraphEndTextMarkerForTextMarker(AccessibilityTextMarker textMarker);
- AccessibilityTextMarkerRange sentenceTextMarkerRangeForTextMarker(AccessibilityTextMarker textMarker);
- AccessibilityTextMarker previousSentenceStartTextMarkerForTextMarker(AccessibilityTextMarker textMarker);
- AccessibilityTextMarker nextSentenceEndTextMarkerForTextMarker(AccessibilityTextMarker textMarker);
-
- // Returns an ordered list of supported actions for an element.
- readonly attribute DOMString supportedActions;
- readonly attribute DOMString mathPostscriptsDescription;
- readonly attribute DOMString mathPrescriptsDescription;
-
- readonly attribute DOMString pathDescription;
-
- // iOS specific accessibility methods.
- readonly attribute DOMString identifier;
- readonly attribute DOMString traits;
- readonly attribute int elementTextPosition;
- readonly attribute int elementTextLength;
- readonly attribute DOMString stringForSelection;
- object elementsForRange(unsigned long location, unsigned long length);
- void increaseTextSelection();
- void decreaseTextSelection();
- AccessibilityUIElement linkedElement();
- AccessibilityUIElement headerElementAtIndex(unsigned long index);
- // This will simulate the accessibilityDidBecomeFocused API in UIKit.
- void assistiveTechnologySimulatedFocus();
- readonly attribute boolean isSearchField;
- readonly attribute boolean isTextArea;
-
- // Fieldset
- readonly attribute boolean hasContainedByFieldsetTrait;
- AccessibilityUIElement fieldsetAncestorElement();
-
- // Notification support.
- boolean addNotificationListener(object callbackFunction);
- boolean removeNotificationListener();
-};
-
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm b/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm
deleted file mode 100644
index 19486c485..000000000
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm
+++ /dev/null
@@ -1,570 +0,0 @@
-# Copyright (C) 2010 Apple Inc. All rights reserved.
-# Copyright (C) 2012 Samsung Electronics
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-# THE POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use warnings;
-use File::Spec;
-
-package CodeGeneratorTestRunner;
-
-sub new
-{
- my ($class, $codeGenerator, $writeDependencies, $verbose, $idlFilePath) = @_;
-
- my $reference = {
- codeGenerator => $codeGenerator,
- idlFilePath => $idlFilePath,
- };
-
- bless($reference, $class);
- return $reference;
-}
-
-sub GenerateInterface
-{
-}
-
-sub WriteData
-{
- my ($self, $interface, $outputDir) = @_;
-
- foreach my $file ($self->_generateHeaderFile($interface), $self->_generateImplementationFile($interface)) {
- open(FILE, ">", File::Spec->catfile($outputDir, $$file{name})) or die "Failed to open $$file{name} for writing: $!";
- print FILE @{$$file{contents}};
- close(FILE) or die "Failed to close $$file{name} after writing: $!";
- }
-}
-
-sub _className
-{
- my ($idlType) = @_;
-
- return "JS" . _implementationClassName($idlType);
-}
-
-sub _classRefGetter
-{
- my ($self, $idlType) = @_;
- return $$self{codeGenerator}->WK_lcfirst(_implementationClassName($idlType)) . "Class";
-}
-
-sub _parseLicenseBlock
-{
- my ($fileHandle) = @_;
-
- my ($copyright, $readCount, $buffer, $currentCharacter, $previousCharacter);
- my $startSentinel = "/*";
- my $lengthOfStartSentinel = length($startSentinel);
- $readCount = read($fileHandle, $buffer, $lengthOfStartSentinel);
- return "" if ($readCount < $lengthOfStartSentinel || $buffer ne $startSentinel);
- $copyright = $buffer;
-
- while ($readCount = read($fileHandle, $currentCharacter, 1)) {
- $copyright .= $currentCharacter;
- return $copyright if $currentCharacter eq "/" && $previousCharacter eq "*";
- $previousCharacter = $currentCharacter;
- }
-
- return "";
-}
-
-sub _parseLicenseBlockFromFile
-{
- my ($path) = @_;
- open my $fileHandle, "<", $path or die "Failed to open $path for reading: $!";
- my $licenseBlock = _parseLicenseBlock($fileHandle);
- close($fileHandle);
- return $licenseBlock;
-}
-
-sub _defaultLicenseBlock
-{
- return <<EOF;
-/*
- * 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
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-EOF
-}
-
-sub _licenseBlock
-{
- my ($self) = @_;
- return $self->{licenseBlock} if $self->{licenseBlock};
-
- my $licenseBlock = _parseLicenseBlockFromFile($self->{idlFilePath}) || _defaultLicenseBlock();
- $self->{licenseBlock} = $licenseBlock;
- return $licenseBlock;
-}
-
-sub _generateHeaderFile
-{
- my ($self, $interface) = @_;
-
- my @contents = ();
-
- my $idlType = $interface->name;
- my $className = _className($idlType);
- my $implementationClassName = _implementationClassName($idlType);
- my $filename = $className . ".h";
-
- push(@contents, $self->_licenseBlock());
-
- my $parentClassName = _parentClassName($interface);
-
- push(@contents, <<EOF);
-
-#ifndef ${className}_h
-#define ${className}_h
-
-#include "${parentClassName}.h"
-EOF
- push(@contents, <<EOF);
-
-namespace WTR {
-
-class ${implementationClassName};
-
-class ${className} : public ${parentClassName} {
-public:
- static JSClassRef @{[$self->_classRefGetter($idlType)]}();
-
-private:
- static const JSStaticFunction* staticFunctions();
- static const JSStaticValue* staticValues();
-EOF
-
- if (my @functions = @{$interface->functions}) {
- push(@contents, "\n // Functions\n\n");
- foreach my $function (@functions) {
- push(@contents, " static JSValueRef @{[$function->signature->name]}(JSContextRef, JSObjectRef, JSObjectRef, size_t, const JSValueRef[], JSValueRef*);\n");
- }
- }
-
- if (my @attributes = @{$interface->attributes}) {
- push(@contents, "\n // Attributes\n\n");
- foreach my $attribute (@attributes) {
- push(@contents, " static JSValueRef @{[$self->_getterName($attribute)]}(JSContextRef, JSObjectRef, JSStringRef, JSValueRef*);\n");
- push(@contents, " static bool @{[$self->_setterName($attribute)]}(JSContextRef, JSObjectRef, JSStringRef, JSValueRef, JSValueRef*);\n") unless $attribute->isReadOnly;
- }
- }
-
- push(@contents, <<EOF);
-};
-
-${implementationClassName}* to${implementationClassName}(JSContextRef, JSValueRef);
-
-} // namespace WTR
-
-#endif // ${className}_h
-EOF
-
- return { name => $filename, contents => \@contents };
-}
-
-sub _generateImplementationFile
-{
- my ($self, $interface) = @_;
-
- my @contentsPrefix = ();
- my %contentsIncludes = ();
- my @contents = ();
-
- my $idlType = $interface->name;
- my $className = _className($idlType);
- my $implementationClassName = _implementationClassName($idlType);
- my $filename = $className . ".cpp";
-
- push(@contentsPrefix, $self->_licenseBlock());
-
- my $classRefGetter = $self->_classRefGetter($idlType);
- my $parentClassName = _parentClassName($interface);
-
- $contentsIncludes{"${className}.h"} = 1;
- $contentsIncludes{"${implementationClassName}.h"} = 1;
-
- push(@contentsPrefix, <<EOF);
-
-EOF
-
- push(@contents, <<EOF);
-#include <JavaScriptCore/JSRetainPtr.h>
-#include <wtf/GetPtr.h>
-
-namespace WTR {
-
-${implementationClassName}* to${implementationClassName}(JSContextRef context, JSValueRef value)
-{
- if (!context || !value || !${className}::${classRefGetter}() || !JSValueIsObjectOfClass(context, value, ${className}::${classRefGetter}()))
- return 0;
- return static_cast<${implementationClassName}*>(JSWrapper::unwrap(context, value));
-}
-
-JSClassRef ${className}::${classRefGetter}()
-{
- static JSClassRef jsClass;
- if (!jsClass) {
- JSClassDefinition definition = kJSClassDefinitionEmpty;
- definition.className = "${idlType}";
- definition.parentClass = @{[$self->_parentClassRefGetterExpression($interface)]};
- definition.staticValues = staticValues();
- definition.staticFunctions = staticFunctions();
-EOF
-
- push(@contents, " definition.initialize = initialize;\n") unless _parentInterface($interface);
- push(@contents, " definition.finalize = finalize;\n") unless _parentInterface($interface);
-
- push(@contents, <<EOF);
- jsClass = JSClassCreate(&definition);
- }
- return jsClass;
-}
-
-EOF
-
- push(@contents, $self->_staticFunctionsGetterImplementation($interface), "\n");
- push(@contents, $self->_staticValuesGetterImplementation($interface));
-
- if (my @functions = @{$interface->functions}) {
- push(@contents, "\n// Functions\n");
-
- foreach my $function (@functions) {
- push(@contents, <<EOF);
-
-JSValueRef ${className}::@{[$function->signature->name]}(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
-{
- ${implementationClassName}* impl = to${implementationClassName}(context, thisObject);
- if (!impl)
- return JSValueMakeUndefined(context);
-
-EOF
- my $functionCall;
- if ($function->signature->extendedAttributes->{"CustomArgumentHandling"}) {
- $functionCall = "impl->" . $function->signature->name . "(context, argumentCount, arguments, exception)";
- } else {
- my @parameters = ();
- my @specifiedParameters = @{$function->parameters};
-
- $self->_includeHeaders(\%contentsIncludes, $function->signature->type, $function->signature);
-
- if ($function->signature->extendedAttributes->{"PassContext"}) {
- push(@parameters, "context");
- }
-
- foreach my $i (0..$#specifiedParameters) {
- my $parameter = $specifiedParameters[$i];
-
- $self->_includeHeaders(\%contentsIncludes, $idlType, $parameter);
-
- push(@contents, " " . $self->_platformTypeVariableDeclaration($parameter, $parameter->name, "arguments[$i]", "argumentCount > $i") . "\n");
-
- push(@parameters, $self->_parameterExpression($parameter));
- }
-
- $functionCall = "impl->" . $function->signature->name . "(" . join(", ", @parameters) . ")";
- }
-
- push(@contents, " ${functionCall};\n\n") if $function->signature->type eq "void";
- push(@contents, " return " . $self->_returnExpression($function->signature, $functionCall) . ";\n}\n");
- }
- }
-
- if (my @attributes = @{$interface->attributes}) {
- push(@contents, "\n// Attributes\n");
- foreach my $attribute (@attributes) {
- $self->_includeHeaders(\%contentsIncludes, $attribute->signature->type, $attribute->signature);
-
- my $getterName = $self->_getterName($attribute);
- my $getterExpression = "impl->${getterName}()";
-
- push(@contents, <<EOF);
-
-JSValueRef ${className}::${getterName}(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef* exception)
-{
- ${implementationClassName}* impl = to${implementationClassName}(context, object);
- if (!impl)
- return JSValueMakeUndefined(context);
-
- return @{[$self->_returnExpression($attribute->signature, $getterExpression)]};
-}
-EOF
-
- unless ($attribute->isReadOnly) {
- push(@contents, <<EOF);
-
-bool ${className}::@{[$self->_setterName($attribute)]}(JSContextRef context, JSObjectRef object, JSStringRef, JSValueRef value, JSValueRef* exception)
-{
- ${implementationClassName}* impl = to${implementationClassName}(context, object);
- if (!impl)
- return false;
-
-EOF
-
- my $platformValue = $self->_platformTypeConstructor($attribute->signature, "value");
-
- push(@contents, <<EOF);
- impl->@{[$self->_setterName($attribute)]}(${platformValue});
-
- return true;
-}
-EOF
- }
- }
- }
-
- push(@contents, <<EOF);
-
-} // namespace WTR
-
-EOF
-
- unshift(@contents, map { "#include \"$_\"\n" } sort keys(%contentsIncludes));
- unshift(@contents, "#include \"config.h\"\n");
- unshift(@contents, @contentsPrefix);
-
- return { name => $filename, contents => \@contents };
-}
-
-sub _getterName
-{
- my ($self, $attribute) = @_;
-
- my $signature = $attribute->signature;
- my $name = $signature->name;
-
- return $name;
-}
-
-sub _includeHeaders
-{
- my ($self, $headers, $idlType, $signature) = @_;
-
- return unless defined $idlType;
- return if $idlType eq "boolean";
- return if $idlType eq "object";
- return if $$self{codeGenerator}->IsNonPointerType($idlType);
- return if $$self{codeGenerator}->IsStringType($idlType);
-
- $$headers{_className($idlType) . ".h"} = 1;
- $$headers{_implementationClassName($idlType) . ".h"} = 1;
-}
-
-sub _implementationClassName
-{
- my ($idlType) = @_;
-
- return $idlType;
-}
-
-sub _parentClassName
-{
- my ($interface) = @_;
-
- my $parentInterface = _parentInterface($interface);
- return $parentInterface ? _className($parentInterface) : "JSWrapper";
-}
-
-sub _parentClassRefGetterExpression
-{
- my ($self, $interface) = @_;
-
- my $parentInterface = _parentInterface($interface);
- return $parentInterface ? $self->_classRefGetter($parentInterface) . "()" : "0";
-}
-
-sub _parentInterface
-{
- my ($interface) = @_;
- return $interface->parent;
-}
-
-sub _platformType
-{
- my ($self, $idlType, $signature) = @_;
-
- return undef unless defined $idlType;
-
- return "bool" if $idlType eq "boolean";
- return "JSValueRef" if $idlType eq "object";
- return "JSRetainPtr<JSStringRef>" if $$self{codeGenerator}->IsStringType($idlType);
- return "double" if $$self{codeGenerator}->IsNonPointerType($idlType);
- return _implementationClassName($idlType);
-}
-
-sub _platformTypeConstructor
-{
- my ($self, $signature, $argumentName) = @_;
-
- my $idlType = $signature->type;
-
- return "JSValueToBoolean(context, $argumentName)" if $idlType eq "boolean";
- return "$argumentName" if $idlType eq "object";
- return "JSRetainPtr<JSStringRef>(Adopt, JSValueToStringCopy(context, $argumentName, 0))" if $$self{codeGenerator}->IsStringType($idlType);
- return "JSValueToNumber(context, $argumentName, 0)" if $$self{codeGenerator}->IsNonPointerType($idlType);
- return "to" . _implementationClassName($idlType) . "(context, $argumentName)";
-}
-
-sub _platformTypeVariableDeclaration
-{
- my ($self, $signature, $variableName, $argumentName, $condition) = @_;
-
- my $platformType = $self->_platformType($signature->type, $signature);
- my $constructor = $self->_platformTypeConstructor($signature, $argumentName);
-
- my %nonPointerTypes = (
- "bool" => 1,
- "double" => 1,
- "JSRetainPtr<JSStringRef>" => 1,
- "JSValueRef" => 1,
- );
-
- my $nullValue = "0";
- if ($platformType eq "JSValueRef") {
- $nullValue = "JSValueMakeUndefined(context)";
- } elsif (defined $nonPointerTypes{$platformType} && $platformType ne "double") {
- $nullValue = "$platformType()";
- }
-
- $platformType .= "*" unless defined $nonPointerTypes{$platformType};
-
- return "$platformType $variableName = $condition && $constructor;" if $condition && $platformType eq "bool";
- return "$platformType $variableName = $condition ? $constructor : $nullValue;" if $condition;
- return "$platformType $variableName = $constructor;";
-}
-
-sub _returnExpression
-{
- my ($self, $signature, $expression) = @_;
-
- my $returnIDLType = $signature->type;
-
- return "JSValueMakeUndefined(context)" if $returnIDLType eq "void";
- return "JSValueMakeBoolean(context, ${expression})" if $returnIDLType eq "boolean";
- return "${expression}" if $returnIDLType eq "object";
- return "JSValueMakeNumber(context, ${expression})" if $$self{codeGenerator}->IsNonPointerType($returnIDLType);
- return "JSValueMakeStringOrNull(context, ${expression}.get())" if $$self{codeGenerator}->IsStringType($returnIDLType);
- return "toJS(context, WTF::getPtr(${expression}))";
-}
-
-sub _parameterExpression
-{
- my ($self, $parameter) = @_;
-
- my $idlType = $parameter->type;
- my $name = $parameter->name;
-
- return "${name}.get()" if $$self{codeGenerator}->IsStringType($idlType);
- return $name;
-}
-
-sub _setterName
-{
- my ($self, $attribute) = @_;
-
- my $name = $attribute->signature->name;
-
- return "set" . $$self{codeGenerator}->WK_ucfirst($name);
-}
-
-sub _staticFunctionsGetterImplementation
-{
- my ($self, $interface) = @_;
-
- my $mapFunction = sub {
- my $name = $_->signature->name;
- my @attributes = qw(kJSPropertyAttributeDontDelete kJSPropertyAttributeReadOnly);
- push(@attributes, "kJSPropertyAttributeDontEnum") if $_->signature->extendedAttributes->{"DontEnum"};
-
- return "{ \"$name\", $name, " . join(" | ", @attributes) . " }";
- };
-
- return $self->_staticFunctionsOrValuesGetterImplementation($interface, "function", "{ 0, 0, 0 }", $mapFunction, $interface->functions);
-}
-
-sub _staticFunctionsOrValuesGetterImplementation
-{
- my ($self, $interface, $functionOrValue, $arrayTerminator, $mapFunction, $functionsOrAttributes) = @_;
-
- my $className = _className($interface->name);
- my $uppercaseFunctionOrValue = $$self{codeGenerator}->WK_ucfirst($functionOrValue);
-
- my $result = <<EOF;
-const JSStatic${uppercaseFunctionOrValue}* ${className}::static${uppercaseFunctionOrValue}s()
-{
-EOF
-
- my @initializers = map(&$mapFunction, @{$functionsOrAttributes});
- return $result . " return 0;\n}\n" unless @initializers;
-
- $result .= <<EOF
- static const JSStatic${uppercaseFunctionOrValue} ${functionOrValue}s[] = {
- @{[join(",\n ", @initializers)]},
- ${arrayTerminator}
- };
- return ${functionOrValue}s;
-}
-EOF
-}
-
-sub _staticValuesGetterImplementation
-{
- my ($self, $interface) = @_;
-
- my $mapFunction = sub {
- return if $_->signature->extendedAttributes->{"NoImplementation"};
-
- my $attributeName = $_->signature->name;
- my $getterName = $self->_getterName($_);
- my $setterName = $_->isReadOnly ? "0" : $self->_setterName($_);
- my @attributes = qw(kJSPropertyAttributeDontDelete);
- push(@attributes, "kJSPropertyAttributeReadOnly") if $_->isReadOnly;
- push(@attributes, "kJSPropertyAttributeDontEnum") if $_->signature->extendedAttributes->{"DontEnum"};
-
- return "{ \"$attributeName\", $getterName, $setterName, " . join(" | ", @attributes) . " }";
- };
-
- return $self->_staticFunctionsOrValuesGetterImplementation($interface, "value", "{ 0, 0, 0, 0 }", $mapFunction, $interface->attributes);
-}
-
-1;
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl
deleted file mode 100644
index f3280bb94..000000000
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2010, 2011, 2014-2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-interface EventSendingController {
- void mouseDown(long buttonNumber, object modifierArray);
- void mouseUp(long buttonNumber, object modifierArray);
- void mouseMoveTo(long x, long y);
- void mouseForceClick();
- void startAndCancelMouseForceClick();
- void mouseForceDown();
- void mouseForceUp();
- void mouseForceChanged(double force);
- void mouseScrollBy(long x, long y);
- void mouseScrollByWithWheelAndMomentumPhases(long x, long y, DOMString phase, DOMString momentum);
- void swipeGestureWithWheelAndMomentumPhases(long x, long y, DOMString phase, DOMString momentum);
- void continuousMouseScrollBy(long x, long y, optional boolean paged);
- object contextClick();
- void scheduleAsynchronousClick();
-
- void leapForward(long milliseconds);
-
- void keyDown(DOMString key, object modifierArray, long location);
- void scheduleAsynchronousKeyDown(DOMString key);
-
- // Zoom functions.
- void textZoomIn();
- void textZoomOut();
- void zoomPageIn();
- void zoomPageOut();
- void scalePageBy(double scale, double x, double y);
-
- void monitorWheelEvents();
- void callAfterScrollingCompletes(object functionCallback);
-
-#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
- // Touch events.
- void addTouchPoint(long x, long y);
- void updateTouchPoint(long index, long x, long y);
- void setTouchModifier(DOMString modifier, boolean enable);
- void setTouchPointRadius(long radiusX, long radiusY);
- void touchStart();
- void touchMove();
- void touchEnd();
- void touchCancel();
- void clearTouchPoints();
- void releaseTouchPoint(long index);
- void cancelTouchPoint(long index);
-#endif
-};
-
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/GCController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/GCController.idl
deleted file mode 100644
index fb933834d..000000000
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/GCController.idl
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-interface GCController {
- void collect();
- void collectOnAlternateThread(boolean waitUntilDone);
- unsigned long long getJSObjectCount();
-};
-
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
deleted file mode 100644
index a86202b28..000000000
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-interface TestRunner {
- // The basics.
- void dumpAsText(boolean dumpPixels);
- void dumpChildFramesAsText();
- void waitForPolicyDelegate();
- void waitUntilDone();
- void notifyDone();
- double preciseTime();
-
- // Other dumping.
- void dumpBackForwardList();
- void dumpChildFrameScrollPositions();
- void dumpEditingCallbacks();
- void dumpSelectionRect();
- void dumpStatusCallbacks();
- void dumpTitleChanges();
- void dumpFullScreenCallbacks();
- void dumpFrameLoadCallbacks();
- void dumpProgressFinishedCallback();
- void dumpResourceLoadCallbacks();
- void dumpResourceResponseMIMETypes();
- void dumpWillCacheResponse();
- void dumpApplicationCacheDelegateCallbacks();
- void dumpDatabaseCallbacks();
- void dumpDOMAsWebArchive();
- void dumpPolicyDelegateCallbacks();
-
- // Special options.
- void keepWebHistory();
- void setAcceptsEditing(boolean value);
- void setCanOpenWindows(boolean value);
- void setCloseRemainingWindowsWhenComplete(boolean value);
- void setXSSAuditorEnabled(boolean value);
- void setAllowUniversalAccessFromFileURLs(boolean value);
- void setAllowFileAccessFromFileURLs(boolean value);
- void setPluginsEnabled(boolean value);
- void setJavaScriptCanAccessClipboard(boolean value);
- void setPrivateBrowsingEnabled(boolean value);
- void setPopupBlockingEnabled(boolean value);
- void setAuthorAndUserStylesEnabled(boolean value);
- void setCustomPolicyDelegate(boolean enabled, boolean permissive);
- void addOriginAccessWhitelistEntry(DOMString sourceOrigin, DOMString destinationProtocol, DOMString destinationHost, boolean allowDestinationSubdomains);
- void removeOriginAccessWhitelistEntry(DOMString sourceOrigin, DOMString destinationProtocol, DOMString destinationHost, boolean allowDestinationSubdomains);
- void setUserStyleSheetEnabled(boolean value);
- void setUserStyleSheetLocation(DOMString location);
- void setSpatialNavigationEnabled(boolean value);
- void setTabKeyCyclesThroughElements(boolean enabled);
- void setSerializeHTTPLoads();
- void dispatchPendingLoadRequests();
- void setCacheModel(int model);
- void setAsynchronousSpellCheckingEnabled(boolean value);
- void setPrinting();
- void setShouldDecideNavigationPolicyAfterDelay(boolean value);
- void setNavigationGesturesEnabled(boolean value);
-
- // Special DOM functions.
- void clearBackForwardList();
- void execCommand(DOMString name, DOMString argument);
- boolean isCommandEnabled(DOMString name);
- unsigned long windowCount();
-
- // Special DOM variables.
- attribute boolean globalFlag;
-
- // Repaint testing.
- void testRepaint();
- void repaintSweepHorizontally();
- void display();
-
- // Printing
- boolean isPageBoxVisible(int pageIndex);
-
- [PassContext] void setValueForUser(object element, DOMString value);
-
- // UserContent testing.
- void addUserScript(DOMString source, boolean runAtStart, boolean allFrames);
- void addUserStyleSheet(DOMString source, boolean allFrames);
-
- // Local storage API
- void clearAllDatabases();
- void setDatabaseQuota(unsigned long long quota);
- DOMString pathToLocalResource(DOMString url);
-
- attribute double databaseDefaultQuota;
- attribute double databaseMaxQuota;
-
- // Application Cache API
- void clearAllApplicationCaches();
- void setAppCacheMaximumSize(unsigned long long size);
- long long applicationCacheDiskUsageForOrigin(DOMString origin);
- void clearApplicationCacheForOrigin(DOMString name);
- void disallowIncreaseForApplicationCacheQuota();
- object originsWithApplicationCache();
-
- // Text search testing.
- boolean findString(DOMString target, object optionsArray);
-
- // Evaluating script in a special context.
- [PassContext] void evaluateScriptInIsolatedWorld(unsigned long worldID, DOMString script);
-
- // For Web Inspector tests
- void showWebInspector();
- void closeWebInspector();
- void evaluateInWebInspector(DOMString script);
- readonly attribute DOMString inspectorTestStubURL;
-
- void setPOSIXLocale(DOMString locale);
-
- void setTextDirection(DOMString direction);
-
- void setWillSendRequestReturnsNull(boolean flag);
- void setWillSendRequestReturnsNullOnRedirect(boolean flag);
- void setWillSendRequestAddsHTTPBody(DOMString body);
-
- void setShouldStayOnPageAfterHandlingBeforeUnload(boolean flag);
-
- void setDefersLoading(boolean flag);
- void setStopProvisionalFrameLoads();
-
- // Focus testing.
- void addChromeInputField(object callback);
- void removeChromeInputField(object callback);
- void focusWebView(object callback);
-
- void clearTestRunnerCallbacks();
-
- void setBackingScaleFactor(double backingScaleFactor, object callback);
-
- void setWindowIsKey(boolean isKey);
-
- // Cookies testing
- void setAlwaysAcceptCookies(boolean accept);
-
- void overridePreference(DOMString preference, DOMString value);
-
- // Page Visibility API
- void setPageVisibility(DOMString state);
- void resetPageVisibility();
-
- // Control full screen behavior.
- void setHasCustomFullScreenBehavior(boolean value);
-
- // Web notifications support
- void grantWebNotificationPermission(DOMString origin);
- void denyWebNotificationPermission(DOMString origin);
- void removeAllWebNotificationPermissions();
- void simulateWebNotificationClick(object notification);
-
- // Geolocation
- void setGeolocationPermission(boolean value);
- void setMockGeolocationPosition(double latitude, double longitude, double accuracy, [Default=Undefined] optional object altitude, optional object altitudeAccuracy, optional object heading, optional object speed);
- void setMockGeolocationPositionUnavailableError(DOMString errorMessage);
- boolean isGeolocationProviderActive();
-
- // MediaStream
- void setUserMediaPermission(boolean value);
- void setUserMediaPermissionForOrigin(boolean permission, DOMString url);
-
- // Audio testing.
- [PassContext] void setAudioResult(object data);
-
- boolean callShouldCloseOnWebView();
-
- // Work queue.
- void queueBackNavigation(unsigned long howFarBackward);
- void queueForwardNavigation(unsigned long howFarForward);
- void queueLoad(DOMString url, DOMString target, optional boolean shouldOpenExternalURLs);
- void queueLoadHTMLString(DOMString content, optional DOMString baseURL, optional DOMString unreachableURL);
- void queueReload();
- void queueLoadingScript(DOMString script);
- void queueNonLoadingScript(DOMString script);
-
- // Authentication
- void setHandlesAuthenticationChallenges(boolean value);
- void setAuthenticationUsername(DOMString username);
- void setAuthenticationPassword(DOMString password);
-
- // Secure text input mode (Mac only)
- readonly attribute boolean secureEventInputIsEnabled;
-
- // Override plugin load policy.
- void setBlockAllPlugins(boolean shouldBlock);
-
- // Hooks to the JSC compiler.
- object failNextNewCodeBlock();
- object numberOfDFGCompiles(object function);
- object neverInlineFunction(object function);
-
- // Swipe gestures
- void installDidBeginSwipeCallback(object callback);
- void installWillEndSwipeCallback(object callback);
- void installDidEndSwipeCallback(object callback);
- void installDidRemoveSwipeSnapshotCallback(object callback);
-
- // UI Process Testing
- void runUIScript(DOMString script, object callback);
-};
-
diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl
deleted file mode 100644
index d95a6985d..000000000
--- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TextInputController.idl
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-interface TextInputController {
- void setMarkedText(DOMString string, long from, long length);
- boolean hasMarkedText();
- void unmarkText();
- void insertText(DOMString string);
-};
-
diff --git a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
index 0faa2f398..65e355652 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2014-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -30,13 +30,13 @@
#include "InjectedBundlePage.h"
#include "JSEventSendingController.h"
#include "StringFunctions.h"
-#include <WebKit/WKBundle.h>
-#include <WebKit/WKBundleFrame.h>
-#include <WebKit/WKBundlePagePrivate.h>
-#include <WebKit/WKBundlePrivate.h>
-#include <WebKit/WKContextMenuItem.h>
-#include <WebKit/WKMutableDictionary.h>
-#include <WebKit/WKNumber.h>
+#include <WebKit2/WKBundle.h>
+#include <WebKit2/WKBundleFrame.h>
+#include <WebKit2/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundlePrivate.h>
+#include <WebKit2/WKContextMenuItem.h>
+#include <WebKit2/WKMutableDictionary.h>
+#include <WebKit2/WKNumber.h>
#include <wtf/StdLibExtras.h>
namespace WTR {
@@ -208,8 +208,7 @@ static WKMutableDictionaryRef createMouseMessageBody(MouseState state, int butto
void EventSendingController::mouseDown(int button, JSValueRef modifierArray)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundlePageRef page = injectedBundle.page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
JSContextRef context = WKBundleFrameGetJavaScriptContext(frame);
WKEventModifiers modifiers = parseModifierArray(context, modifierArray);
@@ -217,12 +216,12 @@ void EventSendingController::mouseDown(int button, JSValueRef modifierArray)
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, createMouseMessageBody(MouseDown, button, modifiers));
- WKBundlePagePostSynchronousMessageForTesting(page, EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::mouseUp(int button, JSValueRef modifierArray)
{
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
JSContextRef context = WKBundleFrameGetJavaScriptContext(frame);
WKEventModifiers modifiers = parseModifierArray(context, modifierArray);
@@ -230,7 +229,7 @@ void EventSendingController::mouseUp(int button, JSValueRef modifierArray)
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, createMouseMessageBody(MouseUp, button, modifiers));
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::mouseMoveTo(int x, int y)
@@ -250,73 +249,7 @@ void EventSendingController::mouseMoveTo(int x, int y)
WKRetainPtr<WKDoubleRef> yRef(AdoptWK, WKDoubleCreate(y));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
- m_position = WKPointMake(x, y);
-
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
-}
-
-void EventSendingController::mouseForceClick()
-{
- WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
- WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
- WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseForceClick"));
- WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
-
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
-}
-
-void EventSendingController::startAndCancelMouseForceClick()
-{
- WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
- WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
- WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("StartAndCancelMouseForceClick"));
- WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
-
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
-}
-
-void EventSendingController::mouseForceDown()
-{
- WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
- WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
- WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseForceDown"));
- WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
-
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
-}
-
-void EventSendingController::mouseForceUp()
-{
- WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
- WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
- WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseForceUp"));
- WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
-
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
-}
-
-void EventSendingController::mouseForceChanged(double force)
-{
- WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
- WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
- WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseForceChanged"));
- WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
-
- WKRetainPtr<WKStringRef> forceKey(AdoptWK, WKStringCreateWithUTF8CString("Force"));
- WKRetainPtr<WKDoubleRef> forceRef(AdoptWK, WKDoubleCreate(force));
- WKDictionarySetItem(EventSenderMessageBody.get(), forceKey.get(), forceRef.get());
-
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::leapForward(int milliseconds)
@@ -332,7 +265,7 @@ void EventSendingController::leapForward(int milliseconds)
WKRetainPtr<WKUInt64Ref> timeRef(AdoptWK, WKUInt64Create(milliseconds));
WKDictionarySetItem(EventSenderMessageBody.get(), timeKey.get(), timeRef.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::scheduleAsynchronousClick()
@@ -344,11 +277,11 @@ void EventSendingController::scheduleAsynchronousClick()
// Asynchronous mouse down.
WKRetainPtr<WKMutableDictionaryRef> mouseDownMessageBody(AdoptWK, createMouseMessageBody(MouseDown, button, modifiers));
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), mouseDownMessageBody.get());
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), mouseDownMessageBody.get());
// Asynchronous mouse up.
WKRetainPtr<WKMutableDictionaryRef> mouseUpMessageBody(AdoptWK, createMouseMessageBody(MouseUp, button, modifiers));
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), mouseUpMessageBody.get());
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), mouseUpMessageBody.get());
}
static WKRetainPtr<WKMutableDictionaryRef> createKeyDownMessageBody(JSStringRef key, WKEventModifiers modifiers, int location)
@@ -375,7 +308,7 @@ static WKRetainPtr<WKMutableDictionaryRef> createKeyDownMessageBody(JSStringRef
void EventSendingController::keyDown(JSStringRef key, JSValueRef modifierArray, int location)
{
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
JSContextRef context = WKBundleFrameGetJavaScriptContext(frame);
WKEventModifiers modifiers = parseModifierArray(context, modifierArray);
@@ -383,7 +316,7 @@ void EventSendingController::keyDown(JSStringRef key, JSValueRef modifierArray,
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
WKRetainPtr<WKMutableDictionaryRef> keyDownMessageBody = createKeyDownMessageBody(key, modifiers, location);
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), keyDownMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), keyDownMessageBody.get(), 0);
}
void EventSendingController::scheduleAsynchronousKeyDown(JSStringRef key)
@@ -391,7 +324,7 @@ void EventSendingController::scheduleAsynchronousKeyDown(JSStringRef key)
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
WKRetainPtr<WKMutableDictionaryRef> keyDownMessageBody = createKeyDownMessageBody(key, 0 /* modifiers */, 0 /* location */);
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), keyDownMessageBody.get());
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), keyDownMessageBody.get());
}
void EventSendingController::mouseScrollBy(int x, int y)
@@ -411,106 +344,7 @@ void EventSendingController::mouseScrollBy(int x, int y)
WKRetainPtr<WKDoubleRef> yRef(AdoptWK, WKDoubleCreate(y));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
- WKBundlePageForceRepaint(InjectedBundle::singleton().page()->page()); // Triggers a scrolling tree commit.
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get());
-}
-
-static uint64_t cgEventPhaseFromString(JSStringRef phaseStr)
-{
- if (JSStringIsEqualToUTF8CString(phaseStr, "none"))
- return 0;
- if (JSStringIsEqualToUTF8CString(phaseStr, "began"))
- return 1; // kCGScrollPhaseBegan
- if (JSStringIsEqualToUTF8CString(phaseStr, "changed"))
- return 2; // kCGScrollPhaseChanged
- if (JSStringIsEqualToUTF8CString(phaseStr, "ended"))
- return 4; // kCGScrollPhaseEnded
- if (JSStringIsEqualToUTF8CString(phaseStr, "cancelled"))
- return 8; // kCGScrollPhaseCancelled
- if (JSStringIsEqualToUTF8CString(phaseStr, "maybegin"))
- return 128; // kCGScrollPhaseMayBegin
-
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-static uint64_t cgEventMomentumPhaseFromString(JSStringRef phaseStr)
-{
- if (JSStringIsEqualToUTF8CString(phaseStr, "none"))
- return 0; // kCGMomentumScrollPhaseNone
- if (JSStringIsEqualToUTF8CString(phaseStr, "begin"))
- return 1; // kCGMomentumScrollPhaseBegin
- if (JSStringIsEqualToUTF8CString(phaseStr, "continue"))
- return 2; // kCGMomentumScrollPhaseContinue
- if (JSStringIsEqualToUTF8CString(phaseStr, "end"))
- return 3; // kCGMomentumScrollPhaseEnd
-
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-void EventSendingController::mouseScrollByWithWheelAndMomentumPhases(int x, int y, JSStringRef phaseStr, JSStringRef momentumStr)
-{
- WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
- WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
- WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("MouseScrollByWithWheelAndMomentumPhases"));
- WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
-
- WKRetainPtr<WKStringRef> xKey(AdoptWK, WKStringCreateWithUTF8CString("X"));
- WKRetainPtr<WKDoubleRef> xRef(AdoptWK, WKDoubleCreate(x));
- WKDictionarySetItem(EventSenderMessageBody.get(), xKey.get(), xRef.get());
-
- WKRetainPtr<WKStringRef> yKey(AdoptWK, WKStringCreateWithUTF8CString("Y"));
- WKRetainPtr<WKDoubleRef> yRef(AdoptWK, WKDoubleCreate(y));
- WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
-
- uint64_t phase = cgEventPhaseFromString(phaseStr);
- uint64_t momentum = cgEventMomentumPhaseFromString(momentumStr);
-
- WKRetainPtr<WKStringRef> phaseKey(AdoptWK, WKStringCreateWithUTF8CString("Phase"));
- WKRetainPtr<WKUInt64Ref> phaseRef(AdoptWK, WKUInt64Create(phase));
- WKDictionarySetItem(EventSenderMessageBody.get(), phaseKey.get(), phaseRef.get());
-
- WKRetainPtr<WKStringRef> momentumKey(AdoptWK, WKStringCreateWithUTF8CString("Momentum"));
- WKRetainPtr<WKUInt64Ref> momentumRef(AdoptWK, WKUInt64Create(momentum));
- WKDictionarySetItem(EventSenderMessageBody.get(), momentumKey.get(), momentumRef.get());
-
- WKBundlePageForceRepaint(InjectedBundle::singleton().page()->page()); // Triggers a scrolling tree commit.
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get());
-}
-
-void EventSendingController::swipeGestureWithWheelAndMomentumPhases(int x, int y, JSStringRef phaseStr, JSStringRef momentumStr)
-{
- WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
- WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
- WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("SwipeGestureWithWheelAndMomentumPhases"));
- WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
-
- WKRetainPtr<WKStringRef> xKey(AdoptWK, WKStringCreateWithUTF8CString("X"));
- WKRetainPtr<WKDoubleRef> xRef(AdoptWK, WKDoubleCreate(x));
- WKDictionarySetItem(EventSenderMessageBody.get(), xKey.get(), xRef.get());
-
- WKRetainPtr<WKStringRef> yKey(AdoptWK, WKStringCreateWithUTF8CString("Y"));
- WKRetainPtr<WKDoubleRef> yRef(AdoptWK, WKDoubleCreate(y));
- WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
-
- uint64_t phase = cgEventPhaseFromString(phaseStr);
- uint64_t momentum = cgEventMomentumPhaseFromString(momentumStr);
-
- WKRetainPtr<WKStringRef> phaseKey(AdoptWK, WKStringCreateWithUTF8CString("Phase"));
- WKRetainPtr<WKUInt64Ref> phaseRef(AdoptWK, WKUInt64Create(phase));
- WKDictionarySetItem(EventSenderMessageBody.get(), phaseKey.get(), phaseRef.get());
-
- WKRetainPtr<WKStringRef> momentumKey(AdoptWK, WKStringCreateWithUTF8CString("Momentum"));
- WKRetainPtr<WKUInt64Ref> momentumRef(AdoptWK, WKUInt64Create(momentum));
- WKDictionarySetItem(EventSenderMessageBody.get(), momentumKey.get(), momentumRef.get());
-
- WKBundlePageForceRepaint(InjectedBundle::singleton().page()->page()); // Triggers a scrolling tree commit.
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get());
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::continuousMouseScrollBy(int x, int y, bool paged)
@@ -534,40 +368,31 @@ void EventSendingController::continuousMouseScrollBy(int x, int y, bool paged)
WKRetainPtr<WKUInt64Ref> pagedRef(AdoptWK, WKUInt64Create(paged));
WKDictionarySetItem(EventSenderMessageBody.get(), pagedKey.get(), pagedRef.get());
- // FIXME: This message should be asynchronous, as scrolling is intrinsically asynchronous.
- // See also: <https://bugs.webkit.org/show_bug.cgi?id=148256>.
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
JSValueRef EventSendingController::contextClick()
{
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
#if ENABLE(CONTEXT_MENUS)
-#if PLATFORM(GTK) || PLATFORM(EFL)
// Do mouse context click.
mouseDown(2, 0);
mouseUp(2, 0);
- WKRetainPtr<WKArrayRef> menuEntries = adoptWK(WKBundlePageCopyContextMenuItems(page));
-#else
- WKRetainPtr<WKArrayRef> menuEntries = adoptWK(WKBundlePageCopyContextMenuAtPointInWindow(page, m_position));
-#endif
- JSValueRef arrayResult = JSObjectMakeArray(context, 0, 0, 0);
- if (!menuEntries)
- return arrayResult;
- JSObjectRef arrayObj = JSValueToObject(context, arrayResult, 0);
+ WKRetainPtr<WKArrayRef> menuEntries = adoptWK(WKBundlePageCopyContextMenuItems(page));
size_t entriesSize = WKArrayGetSize(menuEntries.get());
+ auto jsValuesArray = std::make_unique<JSValueRef[]>(entriesSize);
for (size_t i = 0; i < entriesSize; ++i) {
ASSERT(WKGetTypeID(WKArrayGetItemAtIndex(menuEntries.get(), i)) == WKContextMenuItemGetTypeID());
WKContextMenuItemRef item = static_cast<WKContextMenuItemRef>(WKArrayGetItemAtIndex(menuEntries.get(), i));
MenuItemPrivateData* privateData = new MenuItemPrivateData(page, item);
- JSObjectSetPropertyAtIndex(context, arrayObj, i, JSObjectMake(context, getMenuItemClass(), privateData), 0);
+ jsValuesArray[i] = JSObjectMake(context, getMenuItemClass(), privateData);
}
- return arrayResult;
+ return JSObjectMakeArray(context, entriesSize, jsValuesArray.get(), 0);
#else
return JSValueMakeUndefined(context);
#endif
@@ -575,96 +400,44 @@ JSValueRef EventSendingController::contextClick()
void EventSendingController::textZoomIn()
{
- auto& injectedBundle = InjectedBundle::singleton();
// Ensure page zoom is reset.
- WKBundlePageSetPageZoomFactor(injectedBundle.page()->page(), 1);
+ WKBundlePageSetPageZoomFactor(InjectedBundle::shared().page()->page(), 1);
- double zoomFactor = WKBundlePageGetTextZoomFactor(injectedBundle.page()->page());
- WKBundlePageSetTextZoomFactor(injectedBundle.page()->page(), zoomFactor * ZoomMultiplierRatio);
+ double zoomFactor = WKBundlePageGetTextZoomFactor(InjectedBundle::shared().page()->page());
+ WKBundlePageSetTextZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor * ZoomMultiplierRatio);
}
void EventSendingController::textZoomOut()
{
- auto& injectedBundle = InjectedBundle::singleton();
// Ensure page zoom is reset.
- WKBundlePageSetPageZoomFactor(injectedBundle.page()->page(), 1);
+ WKBundlePageSetPageZoomFactor(InjectedBundle::shared().page()->page(), 1);
- double zoomFactor = WKBundlePageGetTextZoomFactor(injectedBundle.page()->page());
- WKBundlePageSetTextZoomFactor(injectedBundle.page()->page(), zoomFactor / ZoomMultiplierRatio);
+ double zoomFactor = WKBundlePageGetTextZoomFactor(InjectedBundle::shared().page()->page());
+ WKBundlePageSetTextZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor / ZoomMultiplierRatio);
}
void EventSendingController::zoomPageIn()
{
- auto& injectedBundle = InjectedBundle::singleton();
// Ensure text zoom is reset.
- WKBundlePageSetTextZoomFactor(injectedBundle.page()->page(), 1);
+ WKBundlePageSetTextZoomFactor(InjectedBundle::shared().page()->page(), 1);
- double zoomFactor = WKBundlePageGetPageZoomFactor(injectedBundle.page()->page());
- WKBundlePageSetPageZoomFactor(injectedBundle.page()->page(), zoomFactor * ZoomMultiplierRatio);
+ double zoomFactor = WKBundlePageGetPageZoomFactor(InjectedBundle::shared().page()->page());
+ WKBundlePageSetPageZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor * ZoomMultiplierRatio);
}
void EventSendingController::zoomPageOut()
{
- auto& injectedBundle = InjectedBundle::singleton();
// Ensure text zoom is reset.
- WKBundlePageSetTextZoomFactor(injectedBundle.page()->page(), 1);
+ WKBundlePageSetTextZoomFactor(InjectedBundle::shared().page()->page(), 1);
- double zoomFactor = WKBundlePageGetPageZoomFactor(injectedBundle.page()->page());
- WKBundlePageSetPageZoomFactor(injectedBundle.page()->page(), zoomFactor / ZoomMultiplierRatio);
+ double zoomFactor = WKBundlePageGetPageZoomFactor(InjectedBundle::shared().page()->page());
+ WKBundlePageSetPageZoomFactor(InjectedBundle::shared().page()->page(), zoomFactor / ZoomMultiplierRatio);
}
void EventSendingController::scalePageBy(double scale, double x, double y)
{
WKPoint origin = { x, y };
- WKBundlePageSetScaleAtOrigin(InjectedBundle::singleton().page()->page(), scale, origin);
-}
-
-void EventSendingController::monitorWheelEvents()
-{
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
-
- WKBundlePageStartMonitoringScrollOperations(page);
-}
-
-struct ScrollCompletionCallbackData {
- JSContextRef m_context;
- JSObjectRef m_function;
-
- ScrollCompletionCallbackData(JSContextRef context, JSObjectRef function)
- : m_context(context), m_function(function)
- {
- }
-};
-
-static void executeCallback(void* context)
-{
- if (!context)
- return;
-
- std::unique_ptr<ScrollCompletionCallbackData> callBackData(reinterpret_cast<ScrollCompletionCallbackData*>(context));
-
- JSObjectCallAsFunction(callBackData->m_context, callBackData->m_function, nullptr, 0, nullptr, nullptr);
- JSValueUnprotect(callBackData->m_context, callBackData->m_function);
-}
-
-void EventSendingController::callAfterScrollingCompletes(JSValueRef functionCallback)
-{
- if (!functionCallback)
- return;
-
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
- JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
-
- JSObjectRef functionCallbackObject = JSValueToObject(context, functionCallback, nullptr);
- if (!functionCallbackObject)
- return;
-
- JSValueProtect(context, functionCallbackObject);
-
- auto scrollCompletionCallbackData = std::make_unique<ScrollCompletionCallbackData>(context, functionCallbackObject);
-
- WKBundlePageRegisterScrollOperationCompletionCallback(page, executeCallback, scrollCompletionCallbackData.release());
+ WKBundlePageSetScaleAtOrigin(InjectedBundle::shared().page()->page(), scale, origin);
}
#if ENABLE(TOUCH_EVENTS)
@@ -685,7 +458,7 @@ void EventSendingController::addTouchPoint(int x, int y)
WKRetainPtr<WKUInt64Ref> yRef(AdoptWK, WKUInt64Create(y));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::updateTouchPoint(int index, int x, int y)
@@ -709,7 +482,7 @@ void EventSendingController::updateTouchPoint(int index, int x, int y)
WKRetainPtr<WKUInt64Ref> yRef(AdoptWK, WKUInt64Create(y));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::setTouchModifier(const JSStringRef &modifier, bool enable)
@@ -739,7 +512,7 @@ void EventSendingController::setTouchModifier(const JSStringRef &modifier, bool
WKRetainPtr<WKUInt64Ref> enableRef(AdoptWK, WKUInt64Create(enable));
WKDictionarySetItem(EventSenderMessageBody.get(), enableKey.get(), enableRef.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
@@ -760,7 +533,7 @@ void EventSendingController::setTouchPointRadius(int radiusX, int radiusY)
WKRetainPtr<WKUInt64Ref> yRef(AdoptWK, WKUInt64Create(radiusY));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::touchStart()
@@ -772,7 +545,7 @@ void EventSendingController::touchStart()
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("TouchStart"));
WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::touchMove()
@@ -784,7 +557,7 @@ void EventSendingController::touchMove()
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("TouchMove"));
WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::touchEnd()
@@ -796,7 +569,7 @@ void EventSendingController::touchEnd()
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("TouchEnd"));
WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::touchCancel()
@@ -808,7 +581,7 @@ void EventSendingController::touchCancel()
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("TouchCancel"));
WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::clearTouchPoints()
@@ -820,7 +593,7 @@ void EventSendingController::clearTouchPoints()
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("ClearTouchPoints"));
WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::releaseTouchPoint(int index)
@@ -836,7 +609,7 @@ void EventSendingController::releaseTouchPoint(int index)
WKRetainPtr<WKUInt64Ref> indexRef(AdoptWK, WKUInt64Create(index));
WKDictionarySetItem(EventSenderMessageBody.get(), indexKey.get(), indexRef.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::cancelTouchPoint(int index)
@@ -852,7 +625,7 @@ void EventSendingController::cancelTouchPoint(int index)
WKRetainPtr<WKUInt64Ref> indexRef(AdoptWK, WKUInt64Create(index));
WKDictionarySetItem(EventSenderMessageBody.get(), indexKey.get(), indexRef.get());
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
#endif
diff --git a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h
index c23c36dfa..c6a9131e4 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2014-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,8 +27,8 @@
#define EventSendingController_h
#include "JSWrappable.h"
-#include <WebKit/WKEvent.h>
-#include <WebKit/WKGeometry.h>
+#include <WebKit2/WKEvent.h>
+#include <WebKit2/WKGeometry.h>
#include <wtf/PassRefPtr.h>
namespace WTR {
@@ -46,20 +46,11 @@ public:
void mouseDown(int button, JSValueRef modifierArray);
void mouseUp(int button, JSValueRef modifierArray);
void mouseMoveTo(int x, int y);
- void mouseForceClick();
- void startAndCancelMouseForceClick();
- void mouseForceDown();
- void mouseForceUp();
- void mouseForceChanged(double force);
void mouseScrollBy(int x, int y);
- void mouseScrollByWithWheelAndMomentumPhases(int x, int y, JSStringRef phase, JSStringRef momentum);
- void swipeGestureWithWheelAndMomentumPhases(int x, int y, JSStringRef phase, JSStringRef momentum);
void continuousMouseScrollBy(int x, int y, bool paged);
JSValueRef contextClick();
void leapForward(int milliseconds);
void scheduleAsynchronousClick();
- void monitorWheelEvents();
- void callAfterScrollingCompletes(JSValueRef functionCallback);
void keyDown(JSStringRef key, JSValueRef modifierArray, int location);
void scheduleAsynchronousKeyDown(JSStringRef key);
@@ -88,7 +79,6 @@ public:
private:
EventSendingController();
- WKPoint m_position;
};
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/GCController.cpp b/Tools/WebKitTestRunner/InjectedBundle/GCController.cpp
index fd0cc3a78..10c21dba8 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/GCController.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/GCController.cpp
@@ -28,7 +28,7 @@
#include "InjectedBundle.h"
#include "JSGCController.h"
-#include <WebKit/WKBundlePrivate.h>
+#include <WebKit2/WKBundlePrivate.h>
namespace WTR {
@@ -52,17 +52,17 @@ JSClassRef GCController::wrapperClass()
void GCController::collect()
{
- WKBundleGarbageCollectJavaScriptObjects(InjectedBundle::singleton().bundle());
+ WKBundleGarbageCollectJavaScriptObjects(InjectedBundle::shared().bundle());
}
void GCController::collectOnAlternateThread(bool waitUntilDone)
{
- WKBundleGarbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(InjectedBundle::singleton().bundle(), waitUntilDone);
+ WKBundleGarbageCollectJavaScriptObjectsOnAlternateThreadForDebugging(InjectedBundle::shared().bundle(), waitUntilDone);
}
size_t GCController::getJSObjectCount()
{
- return WKBundleGetJavaScriptObjectsCount(InjectedBundle::singleton().bundle());
+ return WKBundleGetJavaScriptObjectsCount(InjectedBundle::shared().bundle());
}
// Object Creation
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
index 72c045830..f71fe9360 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
@@ -29,19 +29,20 @@
#include "ActivateFonts.h"
#include "InjectedBundlePage.h"
#include "StringFunctions.h"
-#include <WebKit/WKBundle.h>
-#include <WebKit/WKBundlePage.h>
-#include <WebKit/WKBundlePagePrivate.h>
-#include <WebKit/WKBundlePrivate.h>
-#include <WebKit/WKRetainPtr.h>
-#include <WebKit/WebKit2_C.h>
+#include <WebKit2/WKBundle.h>
+#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundlePrivate.h>
+#include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WebKit2_C.h>
+#include <wtf/PassOwnPtr.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/Vector.h>
namespace WTR {
-InjectedBundle& InjectedBundle::singleton()
+InjectedBundle& InjectedBundle::shared()
{
static InjectedBundle& shared = *new InjectedBundle;
return shared;
@@ -100,18 +101,23 @@ void InjectedBundle::initialize(WKBundleRef bundle, WKTypeRef initializationUser
platformInitialize(initializationUserData);
activateFonts();
+ WKBundleActivateMacFontAscentHack(m_bundle);
}
void InjectedBundle::didCreatePage(WKBundlePageRef page)
{
- m_pages.append(std::make_unique<InjectedBundlePage>(page));
+ m_pages.append(adoptPtr(new InjectedBundlePage(page)));
}
void InjectedBundle::willDestroyPage(WKBundlePageRef page)
{
- m_pages.removeFirstMatching([page] (const std::unique_ptr<InjectedBundlePage>& current) {
- return current->page() == page;
- });
+ size_t size = m_pages.size();
+ for (size_t i = 0; i < size; ++i) {
+ if (m_pages[i]->page() == page) {
+ m_pages.remove(i);
+ break;
+ }
+ }
}
void InjectedBundle::didInitializePageGroup(WKBundlePageGroupRef pageGroup)
@@ -133,13 +139,6 @@ void InjectedBundle::resetLocalSettings()
void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
{
- WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
- WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown"));
- WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
-}
-
-void InjectedBundle::didReceiveMessageToPage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody)
-{
if (WKStringIsEqualToUTF8CString(messageName, "BeginTest")) {
ASSERT(messageBody);
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
@@ -156,13 +155,11 @@ void InjectedBundle::didReceiveMessageToPage(WKBundlePageRef page, WKStringRef m
WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithUTF8CString("Ack"));
WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString("BeginTest"));
- WKBundlePagePostMessage(page, ackMessageName.get(), ackMessageBody.get());
+ WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get());
beginTesting(messageBodyDictionary);
return;
- }
-
- if (WKStringIsEqualToUTF8CString(messageName, "Reset")) {
+ } else if (WKStringIsEqualToUTF8CString(messageName, "Reset")) {
ASSERT(messageBody);
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
@@ -173,93 +170,48 @@ void InjectedBundle::didReceiveMessageToPage(WKBundlePageRef page, WKStringRef m
if (shouldGC)
WKBundleGarbageCollectJavaScriptObjects(m_bundle);
- WKRetainPtr<WKStringRef> allowedHostsKey(AdoptWK, WKStringCreateWithUTF8CString("AllowedHosts"));
- WKTypeRef allowedHostsValue = WKDictionaryGetItemForKey(messageBodyDictionary, allowedHostsKey.get());
- if (allowedHostsValue && WKGetTypeID(allowedHostsValue) == WKArrayGetTypeID()) {
- WKArrayRef allowedHostsArray = static_cast<WKArrayRef>(allowedHostsValue);
- for (size_t i = 0, size = WKArrayGetSize(allowedHostsArray); i < size; ++i) {
- WKTypeRef item = WKArrayGetItemAtIndex(allowedHostsArray, i);
- if (item && WKGetTypeID(item) == WKStringGetTypeID())
- m_allowedHosts.append(toWTFString(static_cast<WKStringRef>(item)));
- }
- }
-
m_state = Idle;
m_dumpPixels = false;
- m_pixelResultIsPending = false;
resetLocalSettings();
m_testRunner->removeAllWebNotificationPermissions();
- InjectedBundle::page()->resetAfterTest();
+ page()->resetAfterTest();
return;
}
-
if (WKStringIsEqualToUTF8CString(messageName, "CallAddChromeInputFieldCallback")) {
m_testRunner->callAddChromeInputFieldCallback();
return;
}
-
if (WKStringIsEqualToUTF8CString(messageName, "CallRemoveChromeInputFieldCallback")) {
m_testRunner->callRemoveChromeInputFieldCallback();
return;
}
-
if (WKStringIsEqualToUTF8CString(messageName, "CallFocusWebViewCallback")) {
m_testRunner->callFocusWebViewCallback();
return;
}
-
if (WKStringIsEqualToUTF8CString(messageName, "CallSetBackingScaleFactorCallback")) {
m_testRunner->callSetBackingScaleFactorCallback();
return;
- }
-
- if (WKStringIsEqualToUTF8CString(messageName, "CallDidBeginSwipeCallback")) {
- m_testRunner->callDidBeginSwipeCallback();
- return;
- }
-
- if (WKStringIsEqualToUTF8CString(messageName, "CallWillEndSwipeCallback")) {
- m_testRunner->callWillEndSwipeCallback();
- return;
- }
-
- if (WKStringIsEqualToUTF8CString(messageName, "CallDidEndSwipeCallback")) {
- m_testRunner->callDidEndSwipeCallback();
- return;
- }
-
- if (WKStringIsEqualToUTF8CString(messageName, "CallDidRemoveSwipeSnapshotCallback")) {
- m_testRunner->callDidRemoveSwipeSnapshotCallback();
- return;
- }
-
- if (WKStringIsEqualToUTF8CString(messageName, "CallUISideScriptCallback")) {
- WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
-
- WKRetainPtr<WKStringRef> resultKey(AdoptWK, WKStringCreateWithUTF8CString("Result"));
- WKRetainPtr<WKStringRef> callbackIDKey(AdoptWK, WKStringCreateWithUTF8CString("CallbackID"));
-
- unsigned callbackID = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, callbackIDKey.get())));
-
- WKStringRef resultString = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, resultKey.get()));
- auto resultJSString = toJS(resultString);
-
- m_testRunner->runUIScriptCallback(callbackID, resultJSString.get());
- return;
- }
-
+ }
if (WKStringIsEqualToUTF8CString(messageName, "WorkQueueProcessedCallback")) {
if (!topLoadingFrame() && !m_testRunner->waitToDump())
- InjectedBundle::page()->dump();
+ page()->dump();
return;
}
WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown"));
- WKBundlePagePostMessage(page, errorMessageName.get(), errorMessageBody.get());
+ WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
+}
+
+void InjectedBundle::didReceiveMessageToPage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody)
+{
+ WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
+ WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown"));
+ WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
}
bool InjectedBundle::booleanForKey(WKDictionaryRef dictionary, const char* key)
@@ -286,6 +238,8 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings)
m_textInputController = TextInputController::create();
m_accessibilityController = AccessibilityController::create();
+ WKBundleSetShouldTrackVisitedLinks(m_bundle, false);
+ WKBundleRemoveAllVisitedLinks(m_bundle);
WKBundleSetAllowUniversalAccessFromFileURLs(m_bundle, m_pageGroup, true);
WKBundleSetJavaScriptCanAccessClipboard(m_bundle, m_pageGroup, true);
WKBundleSetPrivateBrowsingEnabled(m_bundle, m_pageGroup, false);
@@ -296,10 +250,13 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings)
WKBundleSetAllowFileAccessFromFileURLs(m_bundle, m_pageGroup, true);
WKBundleSetPluginsEnabled(m_bundle, m_pageGroup, true);
WKBundleSetPopupBlockingEnabled(m_bundle, m_pageGroup, false);
+ WKBundleSetAlwaysAcceptCookies(m_bundle, false);
+ WKBundleSetSerialLoadingEnabled(m_bundle, false);
+ WKBundleSetShadowDOMEnabled(m_bundle, true);
+ WKBundleSetSeamlessIFramesEnabled(m_bundle, true);
+ WKBundleSetCacheModel(m_bundle, 1 /*CacheModelDocumentBrowser*/);
-#if PLATFORM(IOS)
- WKBundlePageSetUseTestingViewportConfiguration(page()->page(), !booleanForKey(settings, "UseFlexibleViewport"));
-#endif
+ WKBundleRemoveAllUserContent(m_bundle, m_pageGroup);
m_testRunner->setShouldDumpFrameLoadCallbacks(booleanForKey(settings, "DumpFrameLoadDelegates"));
m_testRunner->setUserStyleSheetEnabled(false);
@@ -307,15 +264,13 @@ void InjectedBundle::beginTesting(WKDictionaryRef settings)
m_testRunner->setCloseRemainingWindowsWhenComplete(false);
m_testRunner->setAcceptsEditing(true);
m_testRunner->setTabKeyCyclesThroughElements(true);
- m_testRunner->clearTestRunnerCallbacks();
- if (m_timeout > 0)
- m_testRunner->setCustomTimeout(m_timeout);
+ m_testRunner->setCustomTimeout(m_timeout);
page()->prepare();
WKBundleClearAllDatabases(m_bundle);
- WKBundlePageClearApplicationCache(page()->page());
+ WKBundleClearApplicationCache(m_bundle);
WKBundleResetOriginAccessWhitelists(m_bundle);
// [WK2] REGRESSION(r128623): It made layout tests extremely slow
@@ -332,21 +287,13 @@ void InjectedBundle::done()
page()->stopLoading();
setTopLoadingFrame(0);
- m_testRunner->invalidateWaitToDumpWatchdogTimer();
-
m_accessibilityController->resetToConsistentState();
WKRetainPtr<WKStringRef> doneMessageName(AdoptWK, WKStringCreateWithUTF8CString("Done"));
WKRetainPtr<WKMutableDictionaryRef> doneMessageBody(AdoptWK, WKMutableDictionaryCreate());
- WKRetainPtr<WKStringRef> pixelResultIsPendingKey = adoptWK(WKStringCreateWithUTF8CString("PixelResultIsPending"));
- WKRetainPtr<WKBooleanRef> pixelResultIsPending(AdoptWK, WKBooleanCreate(m_pixelResultIsPending));
- WKDictionarySetItem(doneMessageBody.get(), pixelResultIsPendingKey.get(), pixelResultIsPending.get());
-
- if (!m_pixelResultIsPending) {
- WKRetainPtr<WKStringRef> pixelResultKey = adoptWK(WKStringCreateWithUTF8CString("PixelResult"));
- WKDictionarySetItem(doneMessageBody.get(), pixelResultKey.get(), m_pixelResult.get());
- }
+ WKRetainPtr<WKStringRef> pixelResultKey = adoptWK(WKStringCreateWithUTF8CString("PixelResult"));
+ WKDictionarySetItem(doneMessageBody.get(), pixelResultKey.get(), m_pixelResult.get());
WKRetainPtr<WKStringRef> repaintRectsKey = adoptWK(WKStringCreateWithUTF8CString("RepaintRects"));
WKDictionarySetItem(doneMessageBody.get(), repaintRectsKey.get(), m_repaintRects.get());
@@ -354,7 +301,7 @@ void InjectedBundle::done()
WKRetainPtr<WKStringRef> audioResultKey = adoptWK(WKStringCreateWithUTF8CString("AudioResult"));
WKDictionarySetItem(doneMessageBody.get(), audioResultKey.get(), m_audioResult.get());
- WKBundlePagePostMessage(page()->page(), doneMessageName.get(), doneMessageBody.get());
+ WKBundlePostMessage(m_bundle, doneMessageName.get(), doneMessageBody.get());
closeOtherPages();
@@ -387,67 +334,60 @@ void InjectedBundle::outputText(const String& output)
return;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("TextOutput"));
WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithUTF8CString(output.utf8().data()));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
void InjectedBundle::postNewBeforeUnloadReturnValue(bool value)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("BeforeUnloadReturnValue"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
void InjectedBundle::postAddChromeInputField()
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("AddChromeInputField"));
- WKBundlePagePostMessage(page()->page(), messageName.get(), 0);
+ WKBundlePostMessage(m_bundle, messageName.get(), 0);
}
void InjectedBundle::postRemoveChromeInputField()
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("RemoveChromeInputField"));
- WKBundlePagePostMessage(page()->page(), messageName.get(), 0);
+ WKBundlePostMessage(m_bundle, messageName.get(), 0);
}
void InjectedBundle::postFocusWebView()
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("FocusWebView"));
- WKBundlePagePostMessage(page()->page(), messageName.get(), 0);
+ WKBundlePostMessage(m_bundle, messageName.get(), 0);
}
void InjectedBundle::postSetBackingScaleFactor(double backingScaleFactor)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetBackingScaleFactor"));
WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(backingScaleFactor));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
void InjectedBundle::postSetWindowIsKey(bool isKey)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetWindowIsKey"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(isKey));
- WKBundlePagePostSynchronousMessageForTesting(page()->page(), messageName.get(), messageBody.get(), 0);
+ WKBundlePostSynchronousMessage(m_bundle, messageName.get(), messageBody.get(), 0);
}
void InjectedBundle::postSimulateWebNotificationClick(uint64_t notificationID)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SimulateWebNotificationClick"));
WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(notificationID));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
-}
-
-void InjectedBundle::postSetAddsVisitedLinks(bool addsVisitedLinks)
-{
- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAddsVisitedLinks"));
- WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(addsVisitedLinks));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
void InjectedBundle::setGeolocationPermission(bool enabled)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetGeolocationPermission"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(enabled));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
void InjectedBundle::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
@@ -500,45 +440,13 @@ void InjectedBundle::setMockGeolocationPosition(double latitude, double longitud
WKRetainPtr<WKDoubleRef> speedWK(AdoptWK, WKDoubleCreate(speed));
WKDictionarySetItem(messageBody.get(), speedKeyWK.get(), speedWK.get());
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
void InjectedBundle::setMockGeolocationPositionUnavailableError(WKStringRef errorMessage)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGeolocationPositionUnavailableError"));
- WKBundlePagePostMessage(page()->page(), messageName.get(), errorMessage);
-}
-
-bool InjectedBundle::isGeolocationProviderActive() const
-{
- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("IsGeolocationClientActive"));
- WKTypeRef resultToPass = 0;
- WKBundlePagePostSynchronousMessageForTesting(page()->page(), messageName.get(), 0, &resultToPass);
- WKRetainPtr<WKBooleanRef> isActive(AdoptWK, static_cast<WKBooleanRef>(resultToPass));
-
- return WKBooleanGetValue(isActive.get());
-}
-
-void InjectedBundle::setUserMediaPermission(bool enabled)
-{
- auto messageName = adoptWK(WKStringCreateWithUTF8CString("SetUserMediaPermission"));
- auto messageBody = adoptWK(WKBooleanCreate(enabled));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
-}
-
-void InjectedBundle::setUserMediaPermissionForOrigin(bool permission, WKStringRef url)
-{
- auto messageName = adoptWK(WKStringCreateWithUTF8CString("SetUserMediaPermissionForOrigin"));
- WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> permissionKeyWK(AdoptWK, WKStringCreateWithUTF8CString("permission"));
- WKRetainPtr<WKBooleanRef> permissionWK(AdoptWK, WKBooleanCreate(permission));
- WKDictionarySetItem(messageBody.get(), permissionKeyWK.get(), permissionWK.get());
-
- WKRetainPtr<WKStringRef> urlKeyWK(AdoptWK, WKStringCreateWithUTF8CString("url"));
- WKDictionarySetItem(messageBody.get(), urlKeyWK.get(), url);
-
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), errorMessage);
}
void InjectedBundle::setCustomPolicyDelegate(bool enabled, bool permissive)
@@ -555,26 +463,23 @@ void InjectedBundle::setCustomPolicyDelegate(bool enabled, bool permissive)
WKRetainPtr<WKBooleanRef> permissiveWK(AdoptWK, WKBooleanCreate(permissive));
WKDictionarySetItem(messageBody.get(), permissiveKeyWK.get(), permissiveWK.get());
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
-void InjectedBundle::setHidden(bool hidden)
+void InjectedBundle::setVisibilityState(WKPageVisibilityState visibilityState, bool isInitialState)
{
- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetHidden"));
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetVisibilityState"));
WKRetainPtr<WKMutableDictionaryRef> messageBody(AdoptWK, WKMutableDictionaryCreate());
- WKRetainPtr<WKStringRef> isInitialKeyWK(AdoptWK, WKStringCreateWithUTF8CString("hidden"));
- WKRetainPtr<WKBooleanRef> isInitialWK(AdoptWK, WKBooleanCreate(hidden));
+ WKRetainPtr<WKStringRef> visibilityStateKeyWK(AdoptWK, WKStringCreateWithUTF8CString("visibilityState"));
+ WKRetainPtr<WKUInt64Ref> visibilityStateWK(AdoptWK, WKUInt64Create(visibilityState));
+ WKDictionarySetItem(messageBody.get(), visibilityStateKeyWK.get(), visibilityStateWK.get());
+
+ WKRetainPtr<WKStringRef> isInitialKeyWK(AdoptWK, WKStringCreateWithUTF8CString("isInitialState"));
+ WKRetainPtr<WKBooleanRef> isInitialWK(AdoptWK, WKBooleanCreate(isInitialState));
WKDictionarySetItem(messageBody.get(), isInitialKeyWK.get(), isInitialWK.get());
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
-}
-
-void InjectedBundle::setCacheModel(int model)
-{
- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetCacheModel"));
- WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(model));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
bool InjectedBundle::shouldProcessWorkQueue() const
@@ -584,7 +489,7 @@ bool InjectedBundle::shouldProcessWorkQueue() const
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("IsWorkQueueEmpty"));
WKTypeRef resultToPass = 0;
- WKBundlePagePostSynchronousMessageForTesting(page()->page(), messageName.get(), 0, &resultToPass);
+ WKBundlePostSynchronousMessage(m_bundle, messageName.get(), 0, &resultToPass);
WKRetainPtr<WKBooleanRef> isEmpty(AdoptWK, static_cast<WKBooleanRef>(resultToPass));
return !WKBooleanGetValue(isEmpty.get());
@@ -593,7 +498,7 @@ bool InjectedBundle::shouldProcessWorkQueue() const
void InjectedBundle::processWorkQueue()
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("ProcessWorkQueue"));
- WKBundlePagePostMessage(page()->page(), messageName.get(), 0);
+ WKBundlePostMessage(m_bundle, messageName.get(), 0);
}
void InjectedBundle::queueBackNavigation(unsigned howFarBackward)
@@ -602,7 +507,7 @@ void InjectedBundle::queueBackNavigation(unsigned howFarBackward)
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueBackNavigation"));
WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(howFarBackward));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
void InjectedBundle::queueForwardNavigation(unsigned howFarForward)
@@ -611,10 +516,10 @@ void InjectedBundle::queueForwardNavigation(unsigned howFarForward)
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueForwardNavigation"));
WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(howFarForward));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
}
-void InjectedBundle::queueLoad(WKStringRef url, WKStringRef target, bool shouldOpenExternalURLs)
+void InjectedBundle::queueLoad(WKStringRef url, WKStringRef target)
{
m_useWorkQueue = true;
@@ -628,11 +533,7 @@ void InjectedBundle::queueLoad(WKStringRef url, WKStringRef target, bool shouldO
WKRetainPtr<WKStringRef> targetKey(AdoptWK, WKStringCreateWithUTF8CString("target"));
WKDictionarySetItem(loadData.get(), targetKey.get(), target);
- WKRetainPtr<WKStringRef> shouldOpenExternalURLsKey(AdoptWK, WKStringCreateWithUTF8CString("shouldOpenExternalURLs"));
- WKRetainPtr<WKBooleanRef> shouldOpenExternalURLsValue(AdoptWK, WKBooleanCreate(shouldOpenExternalURLs));
- WKDictionarySetItem(loadData.get(), shouldOpenExternalURLsKey.get(), shouldOpenExternalURLsValue.get());
-
- WKBundlePagePostMessage(page()->page(), messageName.get(), loadData.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), loadData.get());
}
void InjectedBundle::queueLoadHTMLString(WKStringRef content, WKStringRef baseURL, WKStringRef unreachableURL)
@@ -656,7 +557,7 @@ void InjectedBundle::queueLoadHTMLString(WKStringRef content, WKStringRef baseUR
WKDictionarySetItem(loadData.get(), unreachableURLKey.get(), unreachableURL);
}
- WKBundlePagePostMessage(page()->page(), messageName.get(), loadData.get());
+ WKBundlePostMessage(m_bundle, messageName.get(), loadData.get());
}
void InjectedBundle::queueReload()
@@ -664,7 +565,7 @@ void InjectedBundle::queueReload()
m_useWorkQueue = true;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueReload"));
- WKBundlePagePostMessage(page()->page(), messageName.get(), 0);
+ WKBundlePostMessage(m_bundle, messageName.get(), 0);
}
void InjectedBundle::queueLoadingScript(WKStringRef script)
@@ -672,7 +573,7 @@ void InjectedBundle::queueLoadingScript(WKStringRef script)
m_useWorkQueue = true;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueLoadingScript"));
- WKBundlePagePostMessage(page()->page(), messageName.get(), script);
+ WKBundlePostMessage(m_bundle, messageName.get(), script);
}
void InjectedBundle::queueNonLoadingScript(WKStringRef script)
@@ -680,14 +581,7 @@ void InjectedBundle::queueNonLoadingScript(WKStringRef script)
m_useWorkQueue = true;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueNonLoadingScript"));
- WKBundlePagePostMessage(page()->page(), messageName.get(), script);
-}
-
-bool InjectedBundle::isAllowedHost(WKStringRef host)
-{
- if (m_allowedHosts.isEmpty())
- return false;
- return m_allowedHosts.contains(toWTFString(host));
+ WKBundlePostMessage(m_bundle, messageName.get(), script);
}
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
index 0f0e1f130..170c8ac70 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
@@ -31,10 +31,11 @@
#include "GCController.h"
#include "TestRunner.h"
#include "TextInputController.h"
-#include <WebKit/WKBase.h>
-#include <WebKit/WKRetainPtr.h>
+#include <WebKit2/WKBase.h>
+#include <WebKit2/WKRetainPtr.h>
#include <sstream>
#include <wtf/Forward.h>
+#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
@@ -44,7 +45,7 @@ class InjectedBundlePage;
class InjectedBundle {
public:
- static InjectedBundle& singleton();
+ static InjectedBundle& shared();
// Initialize the InjectedBundle.
void initialize(WKBundleRef, WKTypeRef initializationUserData);
@@ -66,8 +67,7 @@ public:
void done();
void setAudioResult(WKDataRef audioData) { m_audioResult = audioData; }
- void setPixelResult(WKImageRef image) { m_pixelResult = image; m_pixelResultIsPending = false; }
- void setPixelResultIsPending(bool isPending) { m_pixelResultIsPending = isPending; }
+ void setPixelResult(WKImageRef image) { m_pixelResult = image; }
void setRepaintRects(WKArrayRef rects) { m_repaintRects = rects; }
bool isTestRunning() { return m_state == Testing; }
@@ -86,40 +86,29 @@ public:
void postSetBackingScaleFactor(double);
void postSetWindowIsKey(bool);
void postSimulateWebNotificationClick(uint64_t notificationID);
- void postSetAddsVisitedLinks(bool);
// Geolocation.
void setGeolocationPermission(bool);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
void setMockGeolocationPositionUnavailableError(WKStringRef errorMessage);
- bool isGeolocationProviderActive() const;
-
- // MediaStream.
- void setUserMediaPermission(bool);
- void setUserMediaPermissionForOrigin(bool permission, WKStringRef url);
// Policy delegate.
void setCustomPolicyDelegate(bool enabled, bool permissive);
// Page Visibility.
- void setHidden(bool);
-
- // Cache.
- void setCacheModel(int);
+ void setVisibilityState(WKPageVisibilityState, bool isInitialState);
// Work queue.
bool shouldProcessWorkQueue() const;
void processWorkQueue();
void queueBackNavigation(unsigned howFarBackward);
void queueForwardNavigation(unsigned howFarForward);
- void queueLoad(WKStringRef url, WKStringRef target, bool shouldOpenExternalURLs = false);
+ void queueLoad(WKStringRef url, WKStringRef target);
void queueLoadHTMLString(WKStringRef content, WKStringRef baseURL = 0, WKStringRef unreachableURL = 0);
void queueReload();
void queueLoadingScript(WKStringRef script);
void queueNonLoadingScript(WKStringRef script);
- bool isAllowedHost(WKStringRef);
-
private:
InjectedBundle();
~InjectedBundle();
@@ -145,7 +134,7 @@ private:
WKBundleRef m_bundle;
WKBundlePageGroupRef m_pageGroup;
- Vector<std::unique_ptr<InjectedBundlePage>> m_pages;
+ Vector<OwnPtr<InjectedBundlePage> > m_pages;
RefPtr<AccessibilityController> m_accessibilityController;
RefPtr<TestRunner> m_testRunner;
@@ -166,13 +155,10 @@ private:
bool m_useWaitToDumpWatchdogTimer;
bool m_useWorkQueue;
int m_timeout;
- bool m_pixelResultIsPending { false };
WKRetainPtr<WKDataRef> m_audioResult;
WKRetainPtr<WKImageRef> m_pixelResult;
WKRetainPtr<WKArrayRef> m_repaintRects;
-
- Vector<String> m_allowedHosts;
};
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp
index 4f1272214..58af68221 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundleMain.cpp
@@ -26,10 +26,10 @@
#include "config.h"
#include "InjectedBundle.h"
-#include <WebKit/WKBundleInitialize.h>
+#include <WebKit2/WKBundleInitialize.h>
extern "C"
void WKBundleInitialize(WKBundleRef bundle, WKTypeRef initializationUserData)
{
- WTR::InjectedBundle::singleton().initialize(bundle, initializationUserData);
+ WTR::InjectedBundle::shared().initialize(bundle, initializationUserData);
}
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index d3a3638f6..e161156a7 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -31,20 +31,19 @@
#include "WebCoreTestSupport.h"
#include <cmath>
#include <JavaScriptCore/JSRetainPtr.h>
-#include <WebKit/WKArray.h>
-#include <WebKit/WKBundle.h>
-#include <WebKit/WKBundleBackForwardList.h>
-#include <WebKit/WKBundleBackForwardListItem.h>
-#include <WebKit/WKBundleFrame.h>
-#include <WebKit/WKBundleFramePrivate.h>
-#include <WebKit/WKBundleHitTestResult.h>
-#include <WebKit/WKBundleNavigationAction.h>
-#include <WebKit/WKBundleNavigationActionPrivate.h>
-#include <WebKit/WKBundleNodeHandlePrivate.h>
-#include <WebKit/WKBundlePagePrivate.h>
-#include <WebKit/WKBundlePrivate.h>
-#include <WebKit/WKSecurityOriginRef.h>
-#include <WebKit/WKURLRequest.h>
+#include <WebKit2/WKArray.h>
+#include <WebKit2/WKBundle.h>
+#include <WebKit2/WKBundleBackForwardList.h>
+#include <WebKit2/WKBundleBackForwardListItem.h>
+#include <WebKit2/WKBundleFrame.h>
+#include <WebKit2/WKBundleFramePrivate.h>
+#include <WebKit2/WKBundleHitTestResult.h>
+#include <WebKit2/WKBundleNavigationAction.h>
+#include <WebKit2/WKBundleNodeHandlePrivate.h>
+#include <WebKit2/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundlePrivate.h>
+#include <WebKit2/WKSecurityOrigin.h>
+#include <WebKit2/WKURLRequest.h>
#include <wtf/HashMap.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
@@ -241,7 +240,7 @@ static inline WTF::String pathSuitableForTestResult(WKURLRef fileUrl)
if (!isLocalFileScheme(schemeString.get()))
return toWTFString(adoptWK(WKURLCopyString(fileUrl)));
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(mainFrame));
if (!mainFrameURL)
mainFrameURL = adoptWK(WKBundleFrameCopyProvisionalURL(mainFrame));
@@ -269,8 +268,8 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
: m_page(page)
, m_world(AdoptWK, WKBundleScriptWorldCreateWorld())
{
- WKBundlePageLoaderClientV8 loaderClient = {
- { 8, this },
+ WKBundlePageLoaderClientV7 loaderClient = {
+ { 7, this },
didStartProvisionalLoadForFrame,
didReceiveServerRedirectForProvisionalLoadForFrame,
didFailProvisionalLoadWithErrorForFrame,
@@ -305,8 +304,7 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
0, // featuresUsedInPage
0, // willLoadURLRequest
0, // willLoadDataRequest
- 0, // willDestroyFrame_unavailable
- 0, // userAgentForURL
+ 0, // willDestroyFrame
};
WKBundlePageSetPageLoaderClient(m_page, &loaderClient.base);
@@ -419,17 +417,9 @@ void InjectedBundlePage::prepare()
void InjectedBundlePage::resetAfterTest()
{
WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page);
-
- // WebKit currently doesn't reset focus even when navigating to a new page. This may or may not be a bug
- // (see <https://bugs.webkit.org/show_bug.cgi?id=138334>), however for tests, we want to start each one with a clean state.
- WKBundleFrameFocus(frame);
-
JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
WebCoreTestSupport::resetInternalsObject(context);
assignedUrlsCache.clear();
-
- // User scripts need to be removed after the test and before loading about:blank, as otherwise they would run in about:blank, and potentially leak results into a subsequest test.
- WKBundlePageRemoveAllUserContent(m_page);
}
// Loader Client Callbacks
@@ -467,7 +457,7 @@ static void dumpLoadEvent(WKBundleFrameRef frame, const char* eventName)
stringBuilder.appendLiteral(" - ");
stringBuilder.append(eventName);
stringBuilder.append('\n');
- InjectedBundle::singleton().outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
static inline void dumpRequestDescriptionSuitableForTestResult(WKURLRequestRef request, StringBuilder& stringBuilder)
@@ -656,61 +646,49 @@ bool InjectedBundlePage::shouldCacheResponse(WKBundlePageRef page, WKBundleFrame
void InjectedBundlePage::didStartProvisionalLoadForFrame(WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->testURL()) {
- WKRetainPtr<WKURLRef> testURL = adoptWK(WKBundleFrameCopyProvisionalURL(frame));
- injectedBundle.testRunner()->setTestURL(testURL.get());
- }
-
platformDidStartProvisionalLoadForFrame(frame);
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
dumpLoadEvent(frame, "didStartProvisionalLoadForFrame");
- if (!injectedBundle.topLoadingFrame())
- injectedBundle.setTopLoadingFrame(frame);
+ if (!InjectedBundle::shared().topLoadingFrame())
+ InjectedBundle::shared().setTopLoadingFrame(frame);
- if (injectedBundle.testRunner()->shouldStopProvisionalFrameLoads())
+ if (InjectedBundle::shared().testRunner()->shouldStopProvisionalFrameLoads())
dumpLoadEvent(frame, "stopping load in didStartProvisionalLoadForFrame callback");
}
void InjectedBundlePage::didReceiveServerRedirectForProvisionalLoadForFrame(WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
return;
dumpLoadEvent(frame, "didReceiveServerRedirectForProvisionalLoadForFrame");
}
-void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef error)
+void InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
dumpLoadEvent(frame, "didFailProvisionalLoadWithError");
- if (WKErrorGetErrorCode(error) == kWKErrorCodeCannotShowURL)
- dumpLoadEvent(frame, "(kWKErrorCodeCannotShowURL)");
- }
frameDidChangeLocation(frame);
}
void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
return;
dumpLoadEvent(frame, "didCommitLoadForFrame");
@@ -718,14 +696,13 @@ void InjectedBundlePage::didCommitLoadForFrame(WKBundleFrameRef frame)
void InjectedBundlePage::didFinishProgress()
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpProgressFinishedCallback())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpProgressFinishedCallback())
return;
- injectedBundle.outputText("postProgressFinishedNotification\n");
+ InjectedBundle::shared().outputText("postProgressFinishedNotification\n");
}
enum FrameNamePolicy { ShouldNotIncludeFrameName, ShouldIncludeFrameName };
@@ -846,8 +823,9 @@ void InjectedBundlePage::dumpDOMAsWebArchive(WKBundleFrameRef frame, StringBuild
void InjectedBundlePage::dump()
{
- auto& injectedBundle = InjectedBundle::singleton();
- ASSERT(injectedBundle.isTestRunning());
+ ASSERT(InjectedBundle::shared().isTestRunning());
+
+ InjectedBundle::shared().testRunner()->invalidateWaitToDumpWatchdogTimer();
// Force a paint before dumping. This matches DumpRenderTree on Windows. (DumpRenderTree on Mac
// does this at a slightly different time.) See <http://webkit.org/b/55469> for details.
@@ -858,13 +836,13 @@ void InjectedBundlePage::dump()
String url = toWTFString(adoptWK(WKURLCopyString(urlRef.get())));
WKRetainPtr<WKStringRef> mimeType = adoptWK(WKBundleFrameCopyMIMETypeForResourceWithURL(frame, urlRef.get()));
if (url.find("dumpAsText/") != notFound || WKStringIsEqualToUTF8CString(mimeType.get(), "text/plain"))
- injectedBundle.testRunner()->dumpAsText(false);
+ InjectedBundle::shared().testRunner()->dumpAsText(false);
StringBuilder stringBuilder;
- switch (injectedBundle.testRunner()->whatToDump()) {
+ switch (InjectedBundle::shared().testRunner()->whatToDump()) {
case TestRunner::RenderTree: {
- if (injectedBundle.testRunner()->isPrinting())
+ if (InjectedBundle::shared().testRunner()->isPrinting())
stringBuilder.append(toWTFString(adoptWK(WKBundlePageCopyRenderTreeExternalRepresentationForPrinting(m_page)).get()));
else
stringBuilder.append(toWTFString(adoptWK(WKBundlePageCopyRenderTreeExternalRepresentation(m_page)).get()));
@@ -883,52 +861,34 @@ void InjectedBundlePage::dump()
break;
}
- if (injectedBundle.testRunner()->shouldDumpAllFrameScrollPositions())
+ if (InjectedBundle::shared().testRunner()->shouldDumpAllFrameScrollPositions())
dumpAllFrameScrollPositions(stringBuilder);
- else if (injectedBundle.testRunner()->shouldDumpMainFrameScrollPosition())
+ else if (InjectedBundle::shared().testRunner()->shouldDumpMainFrameScrollPosition())
dumpFrameScrollPosition(WKBundlePageGetMainFrame(m_page), stringBuilder);
- if (injectedBundle.testRunner()->shouldDumpBackForwardListsForAllWindows())
- injectedBundle.dumpBackForwardListsForAllPages(stringBuilder);
+ if (InjectedBundle::shared().testRunner()->shouldDumpBackForwardListsForAllWindows())
+ InjectedBundle::shared().dumpBackForwardListsForAllPages(stringBuilder);
- if (injectedBundle.shouldDumpPixels() && injectedBundle.testRunner()->shouldDumpPixels()) {
-#if PLATFORM(IOS)
- // IOS doesn't implement PlatformWebView::windowSnapshotImage() yet, so we need to generate the snapshot in the web process.
- bool shouldCreateSnapshot = true;
-#else
- bool shouldCreateSnapshot = injectedBundle.testRunner()->isPrinting();
-#endif
- if (shouldCreateSnapshot) {
- WKSnapshotOptions options = kWKSnapshotOptionsShareable;
- WKRect snapshotRect = WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page));
-
- if (injectedBundle.testRunner()->isPrinting())
- options |= kWKSnapshotOptionsPrinting;
- else {
- options |= kWKSnapshotOptionsInViewCoordinates;
- if (injectedBundle.testRunner()->shouldDumpSelectionRect())
- options |= kWKSnapshotOptionsPaintSelectionRectangle;
- }
-
- injectedBundle.setPixelResult(adoptWK(WKBundlePageCreateSnapshotWithOptions(m_page, snapshotRect, options)).get());
- } else
- injectedBundle.setPixelResultIsPending(true);
+ if (InjectedBundle::shared().shouldDumpPixels() && InjectedBundle::shared().testRunner()->shouldDumpPixels()) {
+ WKSnapshotOptions options = kWKSnapshotOptionsShareable | kWKSnapshotOptionsInViewCoordinates;
+ if (InjectedBundle::shared().testRunner()->shouldDumpSelectionRect())
+ options |= kWKSnapshotOptionsPaintSelectionRectangle;
- if (WKBundlePageIsTrackingRepaints(m_page) && !injectedBundle.testRunner()->isPrinting())
- injectedBundle.setRepaintRects(adoptWK(WKBundlePageCopyTrackedRepaintRects(m_page)).get());
+ InjectedBundle::shared().setPixelResult(adoptWK(WKBundlePageCreateSnapshotWithOptions(m_page, WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page)), options)).get());
+ if (WKBundlePageIsTrackingRepaints(m_page))
+ InjectedBundle::shared().setRepaintRects(adoptWK(WKBundlePageCopyTrackedRepaintRects(m_page)).get());
}
- injectedBundle.outputText(stringBuilder.toString());
- injectedBundle.done();
+ InjectedBundle::shared().outputText(stringBuilder.toString());
+ InjectedBundle::shared().done();
}
void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
dumpLoadEvent(frame, "didFinishLoadForFrame");
frameDidChangeLocation(frame, /*shouldDump*/ true);
@@ -936,11 +896,10 @@ void InjectedBundlePage::didFinishLoadForFrame(WKBundleFrameRef frame)
void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WKErrorRef)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
dumpLoadEvent(frame, "didFailLoadWithError");
frameDidChangeLocation(frame);
@@ -948,31 +907,29 @@ void InjectedBundlePage::didFailLoadWithErrorForFrame(WKBundleFrameRef frame, WK
void InjectedBundlePage::didReceiveTitleForFrame(WKStringRef title, WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
StringBuilder stringBuilder;
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks()) {
dumpFrameDescriptionSuitableForTestResult(frame, stringBuilder);
stringBuilder.appendLiteral(" - didReceiveTitle: ");
stringBuilder.append(toWTFString(title));
stringBuilder.append('\n');
}
- if (injectedBundle.testRunner()->shouldDumpTitleChanges()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpTitleChanges()) {
stringBuilder.appendLiteral("TITLE CHANGED: '");
stringBuilder.append(toWTFString(title));
stringBuilder.appendLiteral("'\n");
}
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, WKBundleScriptWorldRef world)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
JSGlobalContextRef context = WKBundleFrameGetJavaScriptContextForWorld(frame, world);
@@ -983,23 +940,22 @@ void InjectedBundlePage::didClearWindowForFrame(WKBundleFrameRef frame, WKBundle
return;
}
- JSValueRef exception = nullptr;
- injectedBundle.testRunner()->makeWindowObject(context, window, &exception);
- injectedBundle.gcController()->makeWindowObject(context, window, &exception);
- injectedBundle.eventSendingController()->makeWindowObject(context, window, &exception);
- injectedBundle.textInputController()->makeWindowObject(context, window, &exception);
- injectedBundle.accessibilityController()->makeWindowObject(context, window, &exception);
+ JSValueRef exception = 0;
+ InjectedBundle::shared().testRunner()->makeWindowObject(context, window, &exception);
+ InjectedBundle::shared().gcController()->makeWindowObject(context, window, &exception);
+ InjectedBundle::shared().eventSendingController()->makeWindowObject(context, window, &exception);
+ InjectedBundle::shared().textInputController()->makeWindowObject(context, window, &exception);
+ InjectedBundle::shared().accessibilityController()->makeWindowObject(context, window, &exception);
WebCoreTestSupport::injectInternalsObject(context);
}
void InjectedBundlePage::didCancelClientRedirectForFrame(WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
return;
dumpLoadEvent(frame, "didCancelClientRedirectForFrame");
@@ -1007,11 +963,10 @@ void InjectedBundlePage::didCancelClientRedirectForFrame(WKBundleFrameRef frame)
void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundlePageRef, WKBundleFrameRef frame, WKURLRef url, double delay, double date)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
return;
StringBuilder stringBuilder;
@@ -1019,31 +974,19 @@ void InjectedBundlePage::willPerformClientRedirectForFrame(WKBundlePageRef, WKBu
stringBuilder.appendLiteral(" - willPerformClientRedirectToURL: ");
stringBuilder.append(pathSuitableForTestResult(url));
stringBuilder.appendLiteral(" \n");
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::didSameDocumentNavigationForFrame(WKBundleFrameRef frame, WKSameDocumentNavigationType type)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
- return;
-
- if (!injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
- return;
-
- if (type != kWKSameDocumentNavigationAnchorNavigation)
- return;
-
- dumpLoadEvent(frame, "didChangeLocationWithinPageForFrame");
}
void InjectedBundlePage::didFinishDocumentLoadForFrame(WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
dumpLoadEvent(frame, "didFinishDocumentLoadForFrame");
unsigned pendingFrameUnloadEvents = WKBundleFrameGetPendingUnloadCount(frame);
@@ -1053,44 +996,40 @@ void InjectedBundlePage::didFinishDocumentLoadForFrame(WKBundleFrameRef frame)
stringBuilder.appendLiteral(" - has ");
stringBuilder.appendNumber(pendingFrameUnloadEvents);
stringBuilder.appendLiteral(" onunload handler(s)\n");
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
}
void InjectedBundlePage::didHandleOnloadEventsForFrame(WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
dumpLoadEvent(frame, "didHandleOnloadEventsForFrame");
}
-void InjectedBundlePage::didDisplayInsecureContentForFrame(WKBundleFrameRef)
+void InjectedBundlePage::didDisplayInsecureContentForFrame(WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
- injectedBundle.outputText("didDisplayInsecureContent\n");
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
+ InjectedBundle::shared().outputText("didDisplayInsecureContent\n");
}
-void InjectedBundlePage::didRunInsecureContentForFrame(WKBundleFrameRef)
+void InjectedBundlePage::didRunInsecureContentForFrame(WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
- injectedBundle.outputText("didRunInsecureContent\n");
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
+ InjectedBundle::shared().outputText("didRunInsecureContent\n");
}
-void InjectedBundlePage::didDetectXSSForFrame(WKBundleFrameRef)
+void InjectedBundlePage::didDetectXSSForFrame(WKBundleFrameRef frame)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpFrameLoadCallbacks())
- injectedBundle.outputText("didDetectXSS\n");
+ if (InjectedBundle::shared().testRunner()->shouldDumpFrameLoadCallbacks())
+ InjectedBundle::shared().outputText("didDetectXSS\n");
}
void InjectedBundlePage::didInitiateLoadForResource(WKBundlePageRef page, WKBundleFrameRef, uint64_t identifier, WKURLRequestRef request, bool)
{
- if (!InjectedBundle::singleton().isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
WKRetainPtr<WKURLRef> url = adoptWK(WKURLRequestCopyURL(request));
@@ -1109,16 +1048,10 @@ static inline bool isHTTPOrHTTPSScheme(WKStringRef scheme)
return WKStringIsEqualToUTF8CStringIgnoringCase(scheme, "http") || WKStringIsEqualToUTF8CStringIgnoringCase(scheme, "https");
}
-static inline bool isAllowedHost(WKStringRef host)
-{
- return InjectedBundle::singleton().isAllowedHost(host);
-}
-
WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef page, WKBundleFrameRef frame, uint64_t identifier, WKURLRequestRef request, WKURLResponseRef response)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.isTestRunning()
- && injectedBundle.testRunner()->shouldDumpResourceLoadCallbacks()) {
+ if (InjectedBundle::shared().isTestRunning()
+ && InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) {
StringBuilder stringBuilder;
dumpResourceURL(identifier, stringBuilder);
stringBuilder.appendLiteral(" - willSendRequest ");
@@ -1126,16 +1059,16 @@ WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef page
stringBuilder.appendLiteral(" redirectResponse ");
dumpResponseDescriptionSuitableForTestResult(response, stringBuilder);
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
- if (injectedBundle.isTestRunning() && injectedBundle.testRunner()->willSendRequestReturnsNull())
- return nullptr;
+ if (InjectedBundle::shared().isTestRunning() && InjectedBundle::shared().testRunner()->willSendRequestReturnsNull())
+ return 0;
WKRetainPtr<WKURLRef> redirectURL = adoptWK(WKURLResponseCopyURL(response));
- if (injectedBundle.isTestRunning() && injectedBundle.testRunner()->willSendRequestReturnsNullOnRedirect() && redirectURL) {
- injectedBundle.outputText("Returning null for this redirect\n");
- return nullptr;
+ if (InjectedBundle::shared().isTestRunning() && InjectedBundle::shared().testRunner()->willSendRequestReturnsNullOnRedirect() && redirectURL) {
+ InjectedBundle::shared().outputText("Returning null for this redirect\n");
+ return 0;
}
WKRetainPtr<WKURLRef> url = adoptWK(WKURLRequestCopyURL(request));
@@ -1147,31 +1080,23 @@ WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef page
&& !WKStringIsEqualToUTF8CString(host.get(), "255.255.255.255") // Used in some tests that expect to get back an error.
&& !isLocalHost(host.get())) {
bool mainFrameIsExternal = false;
- if (injectedBundle.isTestRunning()) {
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(m_page);
+ if (InjectedBundle::shared().isTestRunning()) {
+ WKBundleFrameRef mainFrame = InjectedBundle::shared().topLoadingFrame();
WKRetainPtr<WKURLRef> mainFrameURL = adoptWK(WKBundleFrameCopyURL(mainFrame));
if (!mainFrameURL || WKStringIsEqualToUTF8CString(adoptWK(WKURLCopyString(mainFrameURL.get())).get(), "about:blank"))
mainFrameURL = adoptWK(WKBundleFrameCopyProvisionalURL(mainFrame));
- WKRetainPtr<WKStringRef> mainFrameHost = adoptWK(WKURLCopyHostName(mainFrameURL.get()));
- WKRetainPtr<WKStringRef> mainFrameScheme = adoptWK(WKURLCopyScheme(mainFrameURL.get()));
+ WKRetainPtr<WKStringRef> mainFrameHost = WKURLCopyHostName(mainFrameURL.get());
+ WKRetainPtr<WKStringRef> mainFrameScheme = WKURLCopyScheme(mainFrameURL.get());
mainFrameIsExternal = isHTTPOrHTTPSScheme(mainFrameScheme.get()) && !isLocalHost(mainFrameHost.get());
}
- if (!mainFrameIsExternal && !isAllowedHost(host.get())) {
+ if (!mainFrameIsExternal) {
StringBuilder stringBuilder;
stringBuilder.appendLiteral("Blocked access to external URL ");
stringBuilder.append(toWTFString(urlString));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
- return nullptr;
- }
- }
-
- if (injectedBundle.isTestRunning()) {
- String body = injectedBundle.testRunner()->willSendRequestHTTPBody();
- if (!body.isEmpty()) {
- CString cBody = body.utf8();
- return WKURLRequestCopySettingHTTPBody(request, WKDataCreate(reinterpret_cast<const unsigned char*>(cBody.data()), cBody.length()));
+ InjectedBundle::shared().outputText(stringBuilder.toString());
+ return 0;
}
}
@@ -1181,21 +1106,20 @@ WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef page
void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef page, WKBundleFrameRef, uint64_t identifier, WKURLResponseRef response)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (injectedBundle.testRunner()->shouldDumpResourceLoadCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) {
StringBuilder stringBuilder;
dumpResourceURL(identifier, stringBuilder);
stringBuilder.appendLiteral(" - didReceiveResponse ");
dumpResponseDescriptionSuitableForTestResult(response, stringBuilder);
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
- if (!injectedBundle.testRunner()->shouldDumpResourceResponseMIMETypes())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpResourceResponseMIMETypes())
return;
WKRetainPtr<WKURLRef> url = adoptWK(WKURLResponseCopyURL(response));
@@ -1206,16 +1130,8 @@ void InjectedBundlePage::didReceiveResponseForResource(WKBundlePageRef page, WKB
stringBuilder.append(toWTFString(urlString));
stringBuilder.appendLiteral(" has MIME type ");
stringBuilder.append(toWTFString(mimeTypeString));
-
- String platformMimeType = platformResponseMimeType(response);
- if (!platformMimeType.isEmpty() && platformMimeType != toWTFString(mimeTypeString)) {
- stringBuilder.appendLiteral(" but platform response has ");
- stringBuilder.append(platformMimeType);
- }
-
stringBuilder.append('\n');
-
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::didReceiveContentLengthForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, uint64_t)
@@ -1224,26 +1140,24 @@ void InjectedBundlePage::didReceiveContentLengthForResource(WKBundlePageRef, WKB
void InjectedBundlePage::didFinishLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpResourceLoadCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks())
return;
StringBuilder stringBuilder;
dumpResourceURL(identifier, stringBuilder);
stringBuilder.appendLiteral(" - didFinishLoading\n");
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::didFailLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKErrorRef error)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpResourceLoadCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks())
return;
StringBuilder stringBuilder;
@@ -1252,22 +1166,21 @@ void InjectedBundlePage::didFailLoadForResource(WKBundlePageRef, WKBundleFrameRe
dumpErrorDescriptionSuitableForTestResult(error, stringBuilder);
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
bool InjectedBundlePage::shouldCacheResponse(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return true;
- if (!injectedBundle.testRunner()->shouldDumpWillCacheResponse())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpWillCacheResponse())
return true;
StringBuilder stringBuilder;
stringBuilder.appendNumber(identifier);
stringBuilder.appendLiteral(" - willCacheResponse: called\n");
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
// The default behavior is the cache the response.
return true;
@@ -1298,26 +1211,10 @@ void InjectedBundlePage::unableToImplementPolicy(WKBundlePageRef page, WKBundleF
WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForNavigationAction(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleNavigationActionRef navigationAction, WKURLRequestRef request, WKTypeRef* userData)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return WKBundlePagePolicyActionUse;
- if (injectedBundle.testRunner()->shouldDumpPolicyCallbacks()) {
- StringBuilder stringBuilder;
- stringBuilder.appendLiteral(" - decidePolicyForNavigationAction \n");
- dumpRequestDescriptionSuitableForTestResult(request, stringBuilder);
- stringBuilder.appendLiteral(" is main frame - ");
- stringBuilder.append(WKBundleFrameIsMainFrame(frame) ? "yes" : "no");
- stringBuilder.appendLiteral(" should open URLs externally - ");
- stringBuilder.append(WKBundleNavigationActionGetShouldOpenExternalURLs(navigationAction) ? "yes" : "no");
- stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
- }
-
- if (injectedBundle.testRunner()->shouldDecideNavigationPolicyAfterDelay())
- return WKBundlePagePolicyActionPassThrough;
-
- if (!injectedBundle.testRunner()->isPolicyDelegateEnabled())
+ if (!InjectedBundle::shared().testRunner()->isPolicyDelegateEnabled())
return WKBundlePagePolicyActionUse;
WKRetainPtr<WKURLRef> url = adoptWK(WKURLRequestCopyURL(request));
@@ -1342,10 +1239,10 @@ WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForNavigationAction(WKB
}
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
- injectedBundle.testRunner()->notifyDone();
+ InjectedBundle::shared().outputText(stringBuilder.toString());
+ InjectedBundle::shared().testRunner()->notifyDone();
- if (injectedBundle.testRunner()->isPolicyDelegatePermissive())
+ if (InjectedBundle::shared().testRunner()->isPolicyDelegatePermissive())
return WKBundlePagePolicyActionUse;
return WKBundlePagePolicyActionPassThrough;
}
@@ -1357,13 +1254,13 @@ WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForNewWindowAction(WKBu
WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForResponse(WKBundlePageRef page, WKBundleFrameRef, WKURLResponseRef response, WKURLRequestRef, WKTypeRef*)
{
- if (InjectedBundle::singleton().testRunner()->isPolicyDelegateEnabled() && WKURLResponseIsAttachment(response)) {
+ if (WKURLResponseIsAttachment(response)) {
StringBuilder stringBuilder;
WKRetainPtr<WKStringRef> filename = adoptWK(WKURLResponseCopySuggestedFilename(response));
stringBuilder.appendLiteral("Policy delegate: resource is an attachment, suggested file name \'");
stringBuilder.append(toWTFString(filename));
stringBuilder.appendLiteral("\'\n");
- InjectedBundle::singleton().outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
WKRetainPtr<WKStringRef> mimeType = adoptWK(WKURLResponseCopyMIMEType(response));
@@ -1433,8 +1330,7 @@ static WTF::String lastFileURLPathComponent(const WTF::String& path)
void InjectedBundlePage::willAddMessageToConsole(WKStringRef message, uint32_t lineNumber)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
WTF::String messageString = toWTFString(message);
@@ -1456,49 +1352,46 @@ void InjectedBundlePage::willAddMessageToConsole(WKStringRef message, uint32_t l
}
stringBuilder.append(messageString);
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::willSetStatusbarText(WKStringRef statusbarText)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpStatusCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpStatusCallbacks())
return;
StringBuilder stringBuilder;
stringBuilder.appendLiteral("UI DELEGATE STATUS CALLBACK: setStatusText:");
stringBuilder.append(toWTFString(statusbarText));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
StringBuilder stringBuilder;
stringBuilder.appendLiteral("ALERT: ");
stringBuilder.append(toWTFString(message));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
StringBuilder stringBuilder;
stringBuilder.appendLiteral("CONFIRM: ");
stringBuilder.append(toWTFString(message));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef)
@@ -1509,13 +1402,12 @@ void InjectedBundlePage::willRunJavaScriptPrompt(WKStringRef message, WKStringRe
stringBuilder.appendLiteral(", default text: ");
stringBuilder.append(toWTFString(defaultValue));
stringBuilder.append('\n');
- InjectedBundle::singleton().outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::didReachApplicationCacheOriginQuota(WKSecurityOriginRef origin, int64_t totalBytesNeeded)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpApplicationCacheDelegateCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpApplicationCacheDelegateCallbacks()) {
// For example, numbers from 30000 - 39999 will output as 30000.
// Rounding up or down does not really matter for these tests. It's
// sufficient to just get a range of 10000 to determine if we were
@@ -1528,37 +1420,36 @@ void InjectedBundlePage::didReachApplicationCacheOriginQuota(WKSecurityOriginRef
stringBuilder.appendLiteral(" totalSpaceNeeded:~");
stringBuilder.appendNumber(truncatedSpaceNeeded);
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
- if (injectedBundle.testRunner()->shouldDisallowIncreaseForApplicationCacheQuota())
+ if (InjectedBundle::shared().testRunner()->shouldDisallowIncreaseForApplicationCacheQuota())
return;
// Reset default application cache quota.
- WKBundlePageResetApplicationCacheOriginQuota(injectedBundle.page()->page(), adoptWK(WKSecurityOriginCopyToString(origin)).get());
+ WKBundleResetApplicationCacheOriginQuota(InjectedBundle::shared().bundle(), adoptWK(WKSecurityOriginCopyToString(origin)).get());
}
uint64_t InjectedBundlePage::didExceedDatabaseQuota(WKSecurityOriginRef origin, WKStringRef databaseName, WKStringRef databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpDatabaseCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpDatabaseCallbacks()) {
StringBuilder stringBuilder;
stringBuilder.appendLiteral("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:");
stringBuilder.append(securityOriginToStr(origin));
stringBuilder.appendLiteral(" database:");
stringBuilder.append(toWTFString(databaseName));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
uint64_t defaultQuota = 5 * 1024 * 1024;
- double testDefaultQuota = injectedBundle.testRunner()->databaseDefaultQuota();
+ double testDefaultQuota = InjectedBundle::shared().testRunner()->databaseDefaultQuota();
if (testDefaultQuota >= 0)
defaultQuota = testDefaultQuota;
unsigned long long newQuota = defaultQuota;
- double maxQuota = injectedBundle.testRunner()->databaseMaxQuota();
+ double maxQuota = InjectedBundle::shared().testRunner()->databaseMaxQuota();
if (maxQuota >= 0) {
if (defaultQuota < expectedUsageBytes && expectedUsageBytes <= maxQuota) {
newQuota = expectedUsageBytes;
@@ -1567,7 +1458,7 @@ uint64_t InjectedBundlePage::didExceedDatabaseQuota(WKSecurityOriginRef origin,
stringBuilder.appendLiteral("UI DELEGATE DATABASE CALLBACK: increased quota to ");
stringBuilder.appendNumber(newQuota);
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
}
return newQuota;
@@ -1632,40 +1523,37 @@ void InjectedBundlePage::didChangeSelection(WKBundlePageRef page, WKStringRef no
bool InjectedBundlePage::shouldBeginEditing(WKBundleRangeHandleRef range)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return true;
- if (injectedBundle.testRunner()->shouldDumpEditingCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) {
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: shouldBeginEditingInDOMRange:");
stringBuilder.append(rangeToStr(m_page, m_world.get(), range));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
- return injectedBundle.testRunner()->shouldAllowEditing();
+ return InjectedBundle::shared().testRunner()->shouldAllowEditing();
}
bool InjectedBundlePage::shouldEndEditing(WKBundleRangeHandleRef range)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return true;
- if (injectedBundle.testRunner()->shouldDumpEditingCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) {
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: shouldEndEditingInDOMRange:");
stringBuilder.append(rangeToStr(m_page, m_world.get(), range));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
- return injectedBundle.testRunner()->shouldAllowEditing();
+ return InjectedBundle::shared().testRunner()->shouldAllowEditing();
}
bool InjectedBundlePage::shouldInsertNode(WKBundleNodeHandleRef node, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType action)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return true;
static const char* insertactionstring[] = {
@@ -1674,7 +1562,7 @@ bool InjectedBundlePage::shouldInsertNode(WKBundleNodeHandleRef node, WKBundleRa
"WebViewInsertActionDropped",
};
- if (injectedBundle.testRunner()->shouldDumpEditingCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) {
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: shouldInsertNode:");
stringBuilder.append(dumpPath(m_page, m_world.get(), node));
@@ -1683,15 +1571,14 @@ bool InjectedBundlePage::shouldInsertNode(WKBundleNodeHandleRef node, WKBundleRa
stringBuilder.appendLiteral(" givenAction:");
stringBuilder.append(insertactionstring[action]);
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
- return injectedBundle.testRunner()->shouldAllowEditing();
+ return InjectedBundle::shared().testRunner()->shouldAllowEditing();
}
bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeHandleRef rangeToReplace, WKInsertActionType action)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return true;
static const char *insertactionstring[] = {
@@ -1700,7 +1587,7 @@ bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeHandleR
"WebViewInsertActionDropped",
};
- if (injectedBundle.testRunner()->shouldDumpEditingCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) {
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: shouldInsertText:");
stringBuilder.append(toWTFString(text));
@@ -1709,31 +1596,29 @@ bool InjectedBundlePage::shouldInsertText(WKStringRef text, WKBundleRangeHandleR
stringBuilder.appendLiteral(" givenAction:");
stringBuilder.append(insertactionstring[action]);
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
- return injectedBundle.testRunner()->shouldAllowEditing();
+ return InjectedBundle::shared().testRunner()->shouldAllowEditing();
}
bool InjectedBundlePage::shouldDeleteRange(WKBundleRangeHandleRef range)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return true;
- if (injectedBundle.testRunner()->shouldDumpEditingCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) {
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: shouldDeleteDOMRange:");
stringBuilder.append(rangeToStr(m_page, m_world.get(), range));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
- return injectedBundle.testRunner()->shouldAllowEditing();
+ return InjectedBundle::shared().testRunner()->shouldAllowEditing();
}
bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeHandleRef fromRange, WKBundleRangeHandleRef toRange, WKAffinityType affinity, bool stillSelecting)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return true;
static const char *affinitystring[] = {
@@ -1745,7 +1630,7 @@ bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeHandleRef fromRa
"TRUE"
};
- if (injectedBundle.testRunner()->shouldDumpEditingCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) {
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: shouldChangeSelectedDOMRange:");
stringBuilder.append(rangeToStr(m_page, m_world.get(), fromRange));
@@ -1756,105 +1641,98 @@ bool InjectedBundlePage::shouldChangeSelectedRange(WKBundleRangeHandleRef fromRa
stringBuilder.appendLiteral(" stillSelecting:");
stringBuilder.append(boolstring[stillSelecting]);
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
- return injectedBundle.testRunner()->shouldAllowEditing();
+ return InjectedBundle::shared().testRunner()->shouldAllowEditing();
}
bool InjectedBundlePage::shouldApplyStyle(WKBundleCSSStyleDeclarationRef style, WKBundleRangeHandleRef range)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return true;
- if (injectedBundle.testRunner()->shouldDumpEditingCallbacks()) {
+ if (InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks()) {
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: shouldApplyStyle:");
stringBuilder.append(styleDecToStr(style));
stringBuilder.appendLiteral(" toElementsInDOMRange:");
stringBuilder.append(rangeToStr(m_page, m_world.get(), range));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
- return injectedBundle.testRunner()->shouldAllowEditing();
+ return InjectedBundle::shared().testRunner()->shouldAllowEditing();
}
void InjectedBundlePage::didBeginEditing(WKStringRef notificationName)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpEditingCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks())
return;
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: webViewDidBeginEditing:");
stringBuilder.append(toWTFString(notificationName));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::didEndEditing(WKStringRef notificationName)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpEditingCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks())
return;
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: webViewDidEndEditing:");
stringBuilder.append(toWTFString(notificationName));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::didChange(WKStringRef notificationName)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpEditingCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks())
return;
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: webViewDidChange:");
stringBuilder.append(toWTFString(notificationName));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
void InjectedBundlePage::didChangeSelection(WKStringRef notificationName)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (!injectedBundle.testRunner()->shouldDumpEditingCallbacks())
+ if (!InjectedBundle::shared().testRunner()->shouldDumpEditingCallbacks())
return;
StringBuilder stringBuilder;
stringBuilder.appendLiteral("EDITING DELEGATE: webViewDidChangeSelection:");
stringBuilder.append(toWTFString(notificationName));
stringBuilder.append('\n');
- injectedBundle.outputText(stringBuilder.toString());
+ InjectedBundle::shared().outputText(stringBuilder.toString());
}
#if ENABLE(FULLSCREEN_API)
bool InjectedBundlePage::supportsFullScreen(WKBundlePageRef pageRef, WKFullScreenKeyboardRequestType requestType)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpFullScreenCallbacks())
- injectedBundle.outputText("supportsFullScreen() == true\n");
+ if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks())
+ InjectedBundle::shared().outputText("supportsFullScreen() == true\n");
return true;
}
void InjectedBundlePage::enterFullScreenForElement(WKBundlePageRef pageRef, WKBundleNodeHandleRef elementRef)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpFullScreenCallbacks())
- injectedBundle.outputText("enterFullScreenForElement()\n");
+ if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks())
+ InjectedBundle::shared().outputText("enterFullScreenForElement()\n");
- if (!injectedBundle.testRunner()->hasCustomFullScreenBehavior()) {
+ if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) {
WKBundlePageWillEnterFullScreen(pageRef);
WKBundlePageDidEnterFullScreen(pageRef);
}
@@ -1862,11 +1740,10 @@ void InjectedBundlePage::enterFullScreenForElement(WKBundlePageRef pageRef, WKBu
void InjectedBundlePage::exitFullScreenForElement(WKBundlePageRef pageRef, WKBundleNodeHandleRef elementRef)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpFullScreenCallbacks())
- injectedBundle.outputText("exitFullScreenForElement()\n");
+ if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks())
+ InjectedBundle::shared().outputText("exitFullScreenForElement()\n");
- if (!injectedBundle.testRunner()->hasCustomFullScreenBehavior()) {
+ if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) {
WKBundlePageWillExitFullScreen(pageRef);
WKBundlePageDidExitFullScreen(pageRef);
}
@@ -1874,25 +1751,22 @@ void InjectedBundlePage::exitFullScreenForElement(WKBundlePageRef pageRef, WKBun
void InjectedBundlePage::beganEnterFullScreen(WKBundlePageRef, WKRect, WKRect)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpFullScreenCallbacks())
- injectedBundle.outputText("beganEnterFullScreen()\n");
+ if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks())
+ InjectedBundle::shared().outputText("beganEnterFullScreen()\n");
}
void InjectedBundlePage::beganExitFullScreen(WKBundlePageRef, WKRect, WKRect)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpFullScreenCallbacks())
- injectedBundle.outputText("beganExitFullScreen()\n");
+ if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks())
+ InjectedBundle::shared().outputText("beganExitFullScreen()\n");
}
void InjectedBundlePage::closeFullScreen(WKBundlePageRef pageRef)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (injectedBundle.testRunner()->shouldDumpFullScreenCallbacks())
- injectedBundle.outputText("closeFullScreen()\n");
+ if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks())
+ InjectedBundle::shared().outputText("closeFullScreen()\n");
- if (!injectedBundle.testRunner()->hasCustomFullScreenBehavior()) {
+ if (!InjectedBundle::shared().testRunner()->hasCustomFullScreenBehavior()) {
WKBundlePageWillExitFullScreen(pageRef);
WKBundlePageDidExitFullScreen(pageRef);
}
@@ -1988,37 +1862,31 @@ void InjectedBundlePage::dumpBackForwardList(StringBuilder& stringBuilder)
stringBuilder.appendLiteral("===============================================\n");
}
-#if !PLATFORM(COCOA)
+#if !PLATFORM(MAC)
void InjectedBundlePage::platformDidStartProvisionalLoadForFrame(WKBundleFrameRef)
{
}
-
-String InjectedBundlePage::platformResponseMimeType(WKURLResponseRef)
-{
- return String();
-}
#endif
void InjectedBundlePage::frameDidChangeLocation(WKBundleFrameRef frame, bool shouldDump)
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (frame != injectedBundle.topLoadingFrame())
+ if (frame != InjectedBundle::shared().topLoadingFrame())
return;
- injectedBundle.setTopLoadingFrame(nullptr);
+ InjectedBundle::shared().setTopLoadingFrame(0);
- if (injectedBundle.testRunner()->waitToDump())
+ if (InjectedBundle::shared().testRunner()->waitToDump())
return;
- if (injectedBundle.shouldProcessWorkQueue()) {
- injectedBundle.processWorkQueue();
+ if (InjectedBundle::shared().shouldProcessWorkQueue()) {
+ InjectedBundle::shared().processWorkQueue();
return;
}
if (shouldDump)
- injectedBundle.page()->dump();
+ InjectedBundle::shared().page()->dump();
else
- injectedBundle.done();
+ InjectedBundle::shared().done();
}
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
index 746fc33c5..f01b50b54 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h
@@ -26,9 +26,9 @@
#ifndef InjectedBundlePage_h
#define InjectedBundlePage_h
-#include <WebKit/WKBundlePage.h>
-#include <WebKit/WKBundleScriptWorld.h>
-#include <WebKit/WKRetainPtr.h>
+#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundleScriptWorld.h>
+#include <WebKit2/WKRetainPtr.h>
#include <wtf/text/WTFString.h>
namespace WTR {
@@ -169,7 +169,6 @@ private:
void dumpDOMAsWebArchive(WKBundleFrameRef, WTF::StringBuilder&);
void platformDidStartProvisionalLoadForFrame(WKBundleFrameRef);
- String platformResponseMimeType(WKURLResponseRef);
void frameDidChangeLocation(WKBundleFrameRef, bool shouldDump = false);
diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
index e3f8f563c..2b30f5df6 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
@@ -33,20 +33,20 @@
#include "StringFunctions.h"
#include "TestController.h"
#include <JavaScriptCore/JSCTestRunnerUtils.h>
-#include <WebKit/WKBundle.h>
-#include <WebKit/WKBundleBackForwardList.h>
-#include <WebKit/WKBundleFrame.h>
-#include <WebKit/WKBundleFramePrivate.h>
-#include <WebKit/WKBundleInspector.h>
-#include <WebKit/WKBundleNodeHandlePrivate.h>
-#include <WebKit/WKBundlePage.h>
-#include <WebKit/WKBundlePagePrivate.h>
-#include <WebKit/WKBundlePrivate.h>
-#include <WebKit/WKBundleScriptWorld.h>
-#include <WebKit/WKData.h>
-#include <WebKit/WKRetainPtr.h>
-#include <WebKit/WKSerializedScriptValue.h>
-#include <WebKit/WebKit2_C.h>
+#include <WebKit2/WKBundle.h>
+#include <WebKit2/WKBundleBackForwardList.h>
+#include <WebKit2/WKBundleFrame.h>
+#include <WebKit2/WKBundleFramePrivate.h>
+#include <WebKit2/WKBundleInspector.h>
+#include <WebKit2/WKBundleNodeHandlePrivate.h>
+#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundlePrivate.h>
+#include <WebKit2/WKBundleScriptWorld.h>
+#include <WebKit2/WKData.h>
+#include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WKSerializedScriptValue.h>
+#include <WebKit2/WebKit2_C.h>
#include <wtf/CurrentTime.h>
#include <wtf/HashMap.h>
#include <wtf/StdLibExtras.h>
@@ -55,6 +55,8 @@
namespace WTR {
+const double TestRunner::waitToDumpWatchdogTimerInterval = 30;
+
PassRefPtr<TestRunner> TestRunner::create()
{
return adoptRef(new TestRunner);
@@ -91,14 +93,10 @@ TestRunner::TestRunner()
, m_policyDelegatePermissive(false)
, m_globalFlag(false)
, m_customFullScreenBehavior(false)
- , m_timeout(30000)
, m_databaseDefaultQuota(-1)
, m_databaseMaxQuota(-1)
, m_userStyleSheetEnabled(false)
, m_userStyleSheetLocation(adoptWK(WKStringCreateWithUTF8CString("")))
-#if PLATFORM(GTK)
- , m_waitToDumpWatchdogTimer(RunLoop::main(), this, &TestRunner::waitToDumpWatchdogTimerFired)
-#endif
{
platformInitialize();
}
@@ -114,7 +112,7 @@ JSClassRef TestRunner::wrapperClass()
void TestRunner::display()
{
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
WKBundlePageForceRepaint(page);
WKBundlePageSetTracksRepaints(page, true);
WKBundlePageResetTrackedRepaints(page);
@@ -132,7 +130,7 @@ void TestRunner::setCustomPolicyDelegate(bool enabled, bool permissive)
m_policyDelegateEnabled = enabled;
m_policyDelegatePermissive = permissive;
- InjectedBundle::singleton().setCustomPolicyDelegate(enabled, permissive);
+ InjectedBundle::shared().setCustomPolicyDelegate(enabled, permissive);
}
void TestRunner::waitForPolicyDelegate()
@@ -144,39 +142,39 @@ void TestRunner::waitForPolicyDelegate()
void TestRunner::waitUntilDone()
{
m_waitToDump = true;
- if (InjectedBundle::singleton().useWaitToDumpWatchdogTimer())
+ if (InjectedBundle::shared().useWaitToDumpWatchdogTimer())
initializeWaitToDumpWatchdogTimerIfNeeded();
}
void TestRunner::waitToDumpWatchdogTimerFired()
{
invalidateWaitToDumpWatchdogTimer();
- auto& injectedBundle = InjectedBundle::singleton();
- injectedBundle.outputText("FAIL: Timed out waiting for notifyDone to be called\n\n");
- injectedBundle.done();
+ InjectedBundle::shared().outputText("FAIL: Timed out waiting for notifyDone to be called\n\n");
+ InjectedBundle::shared().done();
}
void TestRunner::notifyDone()
{
- auto& injectedBundle = InjectedBundle::singleton();
- if (!injectedBundle.isTestRunning())
+ if (!InjectedBundle::shared().isTestRunning())
return;
- if (m_waitToDump && !injectedBundle.topLoadingFrame())
- injectedBundle.page()->dump();
-
- // We don't call invalidateWaitToDumpWatchdogTimer() here, even if we continue to wait for a load to finish.
- // The test is still subject to timeout checking - it is better to detect an async timeout inside WebKitTestRunner
- // than to let webkitpy do that, because WebKitTestRunner will dump partial results.
+ if (m_waitToDump && !InjectedBundle::shared().topLoadingFrame())
+ InjectedBundle::shared().page()->dump();
m_waitToDump = false;
}
+void TestRunner::setCustomTimeout(int timeout)
+{
+ m_timeout = timeout;
+}
+
void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
{
WKRetainPtr<WKStringRef> sourceWK = toWK(source);
+ WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
- WKBundlePageAddUserScript(InjectedBundle::singleton().page()->page(), sourceWK.get(),
+ WKBundleAddUserScript(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
(runAtStart ? kWKInjectAtDocumentStart : kWKInjectAtDocumentEnd),
(allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
}
@@ -184,27 +182,27 @@ void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFram
void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames)
{
WKRetainPtr<WKStringRef> sourceWK = toWK(source);
+ WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
- WKBundlePageAddUserStyleSheet(InjectedBundle::singleton().page()->page(), sourceWK.get(),
+ WKBundleAddUserStyleSheet(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
(allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
}
void TestRunner::keepWebHistory()
{
- InjectedBundle::singleton().postSetAddsVisitedLinks(true);
+ WKBundleSetShouldTrackVisitedLinks(InjectedBundle::shared().bundle(), true);
}
void TestRunner::execCommand(JSStringRef name, JSStringRef argument)
{
- WKBundlePageExecuteEditingCommand(InjectedBundle::singleton().page()->page(), toWK(name).get(), toWK(argument).get());
+ WKBundlePageExecuteEditingCommand(InjectedBundle::shared().page()->page(), toWK(name).get(), toWK(argument).get());
}
bool TestRunner::findString(JSStringRef target, JSValueRef optionsArrayAsValue)
{
WKFindOptions options = 0;
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(injectedBundle.page()->page());
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
JSRetainPtr<JSStringRef> lengthPropertyName(Adopt, JSStringCreateWithUTF8CString("length"));
JSObjectRef optionsArray = JSValueToObject(context, optionsArrayAsValue, 0);
@@ -235,37 +233,37 @@ bool TestRunner::findString(JSStringRef target, JSValueRef optionsArrayAsValue)
}
}
- return WKBundlePageFindString(injectedBundle.page()->page(), toWK(target).get(), options);
+ return WKBundlePageFindString(InjectedBundle::shared().page()->page(), toWK(target).get(), options);
}
void TestRunner::clearAllDatabases()
{
- WKBundleClearAllDatabases(InjectedBundle::singleton().bundle());
+ WKBundleClearAllDatabases(InjectedBundle::shared().bundle());
}
void TestRunner::setDatabaseQuota(uint64_t quota)
{
- return WKBundleSetDatabaseQuota(InjectedBundle::singleton().bundle(), quota);
+ return WKBundleSetDatabaseQuota(InjectedBundle::shared().bundle(), quota);
}
void TestRunner::clearAllApplicationCaches()
{
- WKBundlePageClearApplicationCache(InjectedBundle::singleton().page()->page());
+ WKBundleClearApplicationCache(InjectedBundle::shared().bundle());
}
void TestRunner::clearApplicationCacheForOrigin(JSStringRef origin)
{
- WKBundlePageClearApplicationCacheForOrigin(InjectedBundle::singleton().page()->page(), toWK(origin).get());
+ WKBundleClearApplicationCacheForOrigin(InjectedBundle::shared().bundle(), toWK(origin).get());
}
void TestRunner::setAppCacheMaximumSize(uint64_t size)
{
- WKBundlePageSetAppCacheMaximumSize(InjectedBundle::singleton().page()->page(), size);
+ WKBundleSetAppCacheMaximumSize(InjectedBundle::shared().bundle(), size);
}
long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef origin)
{
- return WKBundlePageGetAppCacheUsageForOrigin(InjectedBundle::singleton().page()->page(), toWK(origin).get());
+ return WKBundleGetAppCacheUsageForOrigin(InjectedBundle::shared().bundle(), toWK(origin).get());
}
void TestRunner::disallowIncreaseForApplicationCacheQuota()
@@ -277,24 +275,21 @@ static inline JSValueRef stringArrayToJS(JSContextRef context, WKArrayRef string
{
const size_t count = WKArrayGetSize(strings);
- JSValueRef arrayResult = JSObjectMakeArray(context, 0, 0, 0);
- JSObjectRef arrayObj = JSValueToObject(context, arrayResult, 0);
+ auto jsStringsArray = std::make_unique<JSValueRef[]>(count);
for (size_t i = 0; i < count; ++i) {
WKStringRef stringRef = static_cast<WKStringRef>(WKArrayGetItemAtIndex(strings, i));
JSRetainPtr<JSStringRef> stringJS = toJS(stringRef);
- JSObjectSetPropertyAtIndex(context, arrayObj, i, JSValueMakeString(context, stringJS.get()), 0);
+ jsStringsArray[i] = JSValueMakeString(context, stringJS.get());
}
- return arrayResult;
+ return JSObjectMakeArray(context, count, jsStringsArray.get(), 0);
}
JSValueRef TestRunner::originsWithApplicationCache()
{
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKRetainPtr<WKArrayRef> origins(AdoptWK, WKBundleCopyOriginsWithApplicationCache(InjectedBundle::shared().bundle()));
- WKRetainPtr<WKArrayRef> origins(AdoptWK, WKBundlePageCopyOriginsWithApplicationCache(page));
-
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
return stringArrayToJS(context, origins.get());
@@ -302,7 +297,7 @@ JSValueRef TestRunner::originsWithApplicationCache()
bool TestRunner::isCommandEnabled(JSStringRef name)
{
- return WKBundlePageIsEditingCommandEnabled(InjectedBundle::singleton().page()->page(), toWK(name).get());
+ return WKBundlePageIsEditingCommandEnabled(InjectedBundle::shared().page()->page(), toWK(name).get());
}
void TestRunner::setCanOpenWindows(bool)
@@ -314,67 +309,58 @@ void TestRunner::setCanOpenWindows(bool)
void TestRunner::setXSSAuditorEnabled(bool enabled)
{
WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitXSSAuditorEnabled"));
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
+ WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), key.get(), enabled);
}
void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetAllowUniversalAccessFromFileURLs(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+ WKBundleSetAllowUniversalAccessFromFileURLs(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
}
void TestRunner::setAllowFileAccessFromFileURLs(bool enabled)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetAllowFileAccessFromFileURLs(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+ WKBundleSetAllowFileAccessFromFileURLs(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
}
void TestRunner::setPluginsEnabled(bool enabled)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetPluginsEnabled(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+ WKBundleSetPluginsEnabled(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
}
void TestRunner::setJavaScriptCanAccessClipboard(bool enabled)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetJavaScriptCanAccessClipboard(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+ WKBundleSetJavaScriptCanAccessClipboard(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
}
void TestRunner::setPrivateBrowsingEnabled(bool enabled)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetPrivateBrowsingEnabled(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+ WKBundleSetPrivateBrowsingEnabled(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
}
void TestRunner::setPopupBlockingEnabled(bool enabled)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetPopupBlockingEnabled(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+ WKBundleSetPopupBlockingEnabled(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
}
void TestRunner::setAuthorAndUserStylesEnabled(bool enabled)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetAuthorAndUserStylesEnabled(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+ WKBundleSetAuthorAndUserStylesEnabled(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
}
void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
{
- WKBundleAddOriginAccessWhitelistEntry(InjectedBundle::singleton().bundle(), toWK(sourceOrigin).get(), toWK(destinationProtocol).get(), toWK(destinationHost).get(), allowDestinationSubdomains);
+ WKBundleAddOriginAccessWhitelistEntry(InjectedBundle::shared().bundle(), toWK(sourceOrigin).get(), toWK(destinationProtocol).get(), toWK(destinationHost).get(), allowDestinationSubdomains);
}
void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
{
- WKBundleRemoveOriginAccessWhitelistEntry(InjectedBundle::singleton().bundle(), toWK(sourceOrigin).get(), toWK(destinationProtocol).get(), toWK(destinationHost).get(), allowDestinationSubdomains);
+ WKBundleRemoveOriginAccessWhitelistEntry(InjectedBundle::shared().bundle(), toWK(sourceOrigin).get(), toWK(destinationProtocol).get(), toWK(destinationHost).get(), allowDestinationSubdomains);
}
bool TestRunner::isPageBoxVisible(int pageIndex)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(injectedBundle.page()->page());
- return WKBundleIsPageBoxVisible(injectedBundle.bundle(), mainFrame, pageIndex);
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
+ return WKBundleIsPageBoxVisible(InjectedBundle::shared().bundle(), mainFrame, pageIndex);
}
void TestRunner::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value)
@@ -388,22 +374,21 @@ void TestRunner::setValueForUser(JSContextRef context, JSValueRef element, JSStr
void TestRunner::setAudioResult(JSContextRef context, JSValueRef data)
{
- auto& injectedBundle = InjectedBundle::singleton();
// FIXME (123058): Use a JSC API to get buffer contents once such is exposed.
- WKRetainPtr<WKDataRef> audioData(AdoptWK, WKBundleCreateWKDataFromUInt8Array(injectedBundle.bundle(), context, data));
- injectedBundle.setAudioResult(audioData.get());
+ WKRetainPtr<WKDataRef> audioData(AdoptWK, WKBundleCreateWKDataFromUInt8Array(InjectedBundle::shared().bundle(), context, data));
+ InjectedBundle::shared().setAudioResult(audioData.get());
m_whatToDump = Audio;
m_dumpPixels = false;
}
unsigned TestRunner::windowCount()
{
- return InjectedBundle::singleton().pageCount();
+ return InjectedBundle::shared().pageCount();
}
void TestRunner::clearBackForwardList()
{
- WKBundleBackForwardListClear(WKBundlePageGetBackForwardList(InjectedBundle::singleton().page()->page()));
+ WKBundleBackForwardListClear(WKBundlePageGetBackForwardList(InjectedBundle::shared().page()->page()));
}
// Object Creation
@@ -415,18 +400,24 @@ void TestRunner::makeWindowObject(JSContextRef context, JSObjectRef windowObject
void TestRunner::showWebInspector()
{
- WKBundleInspectorShow(WKBundlePageGetInspector(InjectedBundle::singleton().page()->page()));
+#if ENABLE(INSPECTOR)
+ WKBundleInspectorShow(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()));
+#endif // ENABLE(INSPECTOR)
}
void TestRunner::closeWebInspector()
{
- WKBundleInspectorClose(WKBundlePageGetInspector(InjectedBundle::singleton().page()->page()));
+#if ENABLE(INSPECTOR)
+ WKBundleInspectorClose(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()));
+#endif // ENABLE(INSPECTOR)
}
-void TestRunner::evaluateInWebInspector(JSStringRef script)
+void TestRunner::evaluateInWebInspector(long callID, JSStringRef script)
{
+#if ENABLE(INSPECTOR)
WKRetainPtr<WKStringRef> scriptWK = toWK(script);
- WKBundleInspectorEvaluateScriptForTest(WKBundlePageGetInspector(InjectedBundle::singleton().page()->page()), scriptWK.get());
+ WKBundleInspectorEvaluateScriptForTest(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()), callID, scriptWK.get());
+#endif // ENABLE(INSPECTOR)
}
typedef WTF::HashMap<unsigned, WKRetainPtr<WKBundleScriptWorldRef> > WorldMap;
@@ -463,7 +454,7 @@ void TestRunner::evaluateScriptInIsolatedWorld(JSContextRef context, unsigned wo
WKBundleFrameRef frame = WKBundleFrameForJavaScriptContext(context);
if (!frame)
- frame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ frame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSGlobalContextRef jsContext = WKBundleFrameGetJavaScriptContextForWorld(frame, world.get());
JSEvaluateScript(jsContext, script, 0, 0, 0, 0);
@@ -478,28 +469,35 @@ void TestRunner::setPOSIXLocale(JSStringRef locale)
void TestRunner::setTextDirection(JSStringRef direction)
{
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
return WKBundleFrameSetTextDirection(mainFrame, toWK(direction).get());
}
void TestRunner::setShouldStayOnPageAfterHandlingBeforeUnload(bool shouldStayOnPage)
{
- InjectedBundle::singleton().postNewBeforeUnloadReturnValue(!shouldStayOnPage);
+ InjectedBundle::shared().postNewBeforeUnloadReturnValue(!shouldStayOnPage);
}
void TestRunner::setDefersLoading(bool shouldDeferLoading)
{
- WKBundlePageSetDefersLoading(InjectedBundle::singleton().page()->page(), shouldDeferLoading);
+ WKBundlePageSetDefersLoading(InjectedBundle::shared().page()->page(), shouldDeferLoading);
}
void TestRunner::setPageVisibility(JSStringRef state)
{
- InjectedBundle::singleton().setHidden(JSStringIsEqualToUTF8CString(state, "hidden") || JSStringIsEqualToUTF8CString(state, "prerender"));
+ WKPageVisibilityState visibilityState = kWKPageVisibilityStateVisible;
+
+ if (JSStringIsEqualToUTF8CString(state, "hidden"))
+ visibilityState = kWKPageVisibilityStateHidden;
+ else if (JSStringIsEqualToUTF8CString(state, "prerender"))
+ visibilityState = kWKPageVisibilityStatePrerender;
+
+ InjectedBundle::shared().setVisibilityState(visibilityState, false);
}
void TestRunner::resetPageVisibility()
{
- InjectedBundle::singleton().setHidden(false);
+ InjectedBundle::shared().setVisibilityState(kWKPageVisibilityStateVisible, true);
}
typedef WTF::HashMap<unsigned, JSValueRef> CallbackMap;
@@ -513,12 +511,7 @@ enum {
AddChromeInputFieldCallbackID = 1,
RemoveChromeInputFieldCallbackID,
FocusWebViewCallbackID,
- SetBackingScaleFactorCallbackID,
- DidBeginSwipeCallbackID,
- WillEndSwipeCallbackID,
- DidEndSwipeCallbackID,
- DidRemoveSwipeSnapshotCallbackID,
- FirstUIScriptCallbackID = 100
+ SetBackingScaleFactorCallbackID
};
static void cacheTestRunnerCallback(unsigned index, JSValueRef callback)
@@ -526,67 +519,50 @@ static void cacheTestRunnerCallback(unsigned index, JSValueRef callback)
if (!callback)
return;
- if (callbackMap().contains(index)) {
- InjectedBundle::singleton().outputText(String::format("FAIL: Tried to install a second TestRunner callback for the same event (id %d)\n\n", index));
- return;
- }
-
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
JSValueProtect(context, callback);
callbackMap().add(index, callback);
}
-static void callTestRunnerCallback(unsigned index, size_t argumentCount = 0, const JSValueRef arguments[] = nullptr)
+static void callTestRunnerCallback(unsigned index)
{
if (!callbackMap().contains(index))
return;
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
JSObjectRef callback = JSValueToObject(context, callbackMap().take(index), 0);
- JSObjectCallAsFunction(context, callback, JSContextGetGlobalObject(context), argumentCount, arguments, 0);
+ JSObjectCallAsFunction(context, callback, JSContextGetGlobalObject(context), 0, 0, 0);
JSValueUnprotect(context, callback);
}
-void TestRunner::clearTestRunnerCallbacks()
-{
- for (auto& iter : callbackMap()) {
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
- JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
- JSObjectRef callback = JSValueToObject(context, iter.value, 0);
- JSValueUnprotect(context, callback);
- }
-
- callbackMap().clear();
-}
-
void TestRunner::addChromeInputField(JSValueRef callback)
{
cacheTestRunnerCallback(AddChromeInputFieldCallbackID, callback);
- InjectedBundle::singleton().postAddChromeInputField();
+ InjectedBundle::shared().postAddChromeInputField();
}
void TestRunner::removeChromeInputField(JSValueRef callback)
{
cacheTestRunnerCallback(RemoveChromeInputFieldCallbackID, callback);
- InjectedBundle::singleton().postRemoveChromeInputField();
+ InjectedBundle::shared().postRemoveChromeInputField();
}
void TestRunner::focusWebView(JSValueRef callback)
{
cacheTestRunnerCallback(FocusWebViewCallbackID, callback);
- InjectedBundle::singleton().postFocusWebView();
+ InjectedBundle::shared().postFocusWebView();
}
void TestRunner::setBackingScaleFactor(double backingScaleFactor, JSValueRef callback)
{
cacheTestRunnerCallback(SetBackingScaleFactorCallbackID, callback);
- InjectedBundle::singleton().postSetBackingScaleFactor(backingScaleFactor);
+ InjectedBundle::shared().postSetBackingScaleFactor(backingScaleFactor);
}
void TestRunner::setWindowIsKey(bool isKey)
{
- InjectedBundle::singleton().postSetWindowIsKey(isKey);
+ InjectedBundle::shared().postSetWindowIsKey(isKey);
}
void TestRunner::callAddChromeInputFieldCallback()
@@ -616,18 +592,13 @@ static inline bool toBool(JSStringRef value)
void TestRunner::overridePreference(JSStringRef preference, JSStringRef value)
{
- auto& injectedBundle = InjectedBundle::singleton();
// FIXME: handle non-boolean preferences.
- WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), toWK(preference).get(), toBool(value));
+ WKBundleOverrideBoolPreferenceForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), toWK(preference).get(), toBool(value));
}
void TestRunner::setAlwaysAcceptCookies(bool accept)
{
- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAlwaysAcceptCookies"));
-
- WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(accept));
-
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), 0);
+ WKBundleSetAlwaysAcceptCookies(InjectedBundle::shared().bundle(), accept);
}
double TestRunner::preciseTime()
@@ -641,8 +612,7 @@ void TestRunner::setUserStyleSheetEnabled(bool enabled)
WKRetainPtr<WKStringRef> emptyUrl = adoptWK(WKStringCreateWithUTF8CString(""));
WKStringRef location = enabled ? m_userStyleSheetLocation.get() : emptyUrl.get();
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetUserStyleSheetLocation(injectedBundle.bundle(), injectedBundle.pageGroup(), location);
+ WKBundleSetUserStyleSheetLocation(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), location);
}
void TestRunner::setUserStyleSheetLocation(JSStringRef location)
@@ -655,81 +625,68 @@ void TestRunner::setUserStyleSheetLocation(JSStringRef location)
void TestRunner::setSpatialNavigationEnabled(bool enabled)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetSpatialNavigationEnabled(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+ WKBundleSetSpatialNavigationEnabled(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
}
void TestRunner::setTabKeyCyclesThroughElements(bool enabled)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetTabKeyCyclesThroughElements(injectedBundle.bundle(), injectedBundle.page()->page(), enabled);
+ WKBundleSetTabKeyCyclesThroughElements(InjectedBundle::shared().bundle(), InjectedBundle::shared().page()->page(), enabled);
}
void TestRunner::setSerializeHTTPLoads()
{
- // WK2 doesn't reorder loads.
+ WKBundleSetSerialLoadingEnabled(InjectedBundle::shared().bundle(), true);
}
void TestRunner::dispatchPendingLoadRequests()
{
- // WK2 doesn't keep pending requests.
+ WKBundleDispatchPendingLoadRequests(InjectedBundle::shared().bundle());
}
void TestRunner::setCacheModel(int model)
{
- InjectedBundle::singleton().setCacheModel(model);
+ WKBundleSetCacheModel(InjectedBundle::shared().bundle(), model);
}
void TestRunner::setAsynchronousSpellCheckingEnabled(bool enabled)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetAsynchronousSpellCheckingEnabled(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+ WKBundleSetAsynchronousSpellCheckingEnabled(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), enabled);
}
void TestRunner::grantWebNotificationPermission(JSStringRef origin)
{
WKRetainPtr<WKStringRef> originWK = toWK(origin);
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetWebNotificationPermission(injectedBundle.bundle(), injectedBundle.page()->page(), originWK.get(), true);
+ WKBundleSetWebNotificationPermission(InjectedBundle::shared().bundle(), InjectedBundle::shared().page()->page(), originWK.get(), true);
}
void TestRunner::denyWebNotificationPermission(JSStringRef origin)
{
WKRetainPtr<WKStringRef> originWK = toWK(origin);
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleSetWebNotificationPermission(injectedBundle.bundle(), injectedBundle.page()->page(), originWK.get(), false);
+ WKBundleSetWebNotificationPermission(InjectedBundle::shared().bundle(), InjectedBundle::shared().page()->page(), originWK.get(), false);
}
void TestRunner::removeAllWebNotificationPermissions()
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleRemoveAllWebNotificationPermissions(injectedBundle.bundle(), injectedBundle.page()->page());
+ WKBundleRemoveAllWebNotificationPermissions(InjectedBundle::shared().bundle(), InjectedBundle::shared().page()->page());
}
void TestRunner::simulateWebNotificationClick(JSValueRef notification)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(injectedBundle.page()->page());
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
- uint64_t notificationID = WKBundleGetWebNotificationID(injectedBundle.bundle(), context, notification);
- injectedBundle.postSimulateWebNotificationClick(notificationID);
+ uint64_t notificationID = WKBundleGetWebNotificationID(InjectedBundle::shared().bundle(), context, notification);
+ InjectedBundle::shared().postSimulateWebNotificationClick(notificationID);
}
void TestRunner::setGeolocationPermission(bool enabled)
{
// FIXME: this should be done by frame.
- InjectedBundle::singleton().setGeolocationPermission(enabled);
-}
-
-bool TestRunner::isGeolocationProviderActive()
-{
- return InjectedBundle::singleton().isGeolocationProviderActive();
+ InjectedBundle::shared().setGeolocationPermission(enabled);
}
void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, JSValueRef jsAltitude, JSValueRef jsAltitudeAccuracy, JSValueRef jsHeading, JSValueRef jsSpeed)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(injectedBundle.page()->page());
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
bool providesAltitude = false;
@@ -760,51 +717,38 @@ void TestRunner::setMockGeolocationPosition(double latitude, double longitude, d
speed = JSValueToNumber(context, jsSpeed, 0);
}
- injectedBundle.setMockGeolocationPosition(latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
+ InjectedBundle::shared().setMockGeolocationPosition(latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
}
void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message)
{
WKRetainPtr<WKStringRef> messageWK = toWK(message);
- InjectedBundle::singleton().setMockGeolocationPositionUnavailableError(messageWK.get());
-}
-
-void TestRunner::setUserMediaPermission(bool enabled)
-{
- // FIXME: this should be done by frame.
- InjectedBundle::singleton().setUserMediaPermission(enabled);
-}
-
-void TestRunner::setUserMediaPermissionForOrigin(bool permission, JSStringRef url)
-{
- WKRetainPtr<WKStringRef> urlWK = toWK(url);
- InjectedBundle::singleton().setUserMediaPermissionForOrigin(permission, urlWK.get());
+ InjectedBundle::shared().setMockGeolocationPositionUnavailableError(messageWK.get());
}
bool TestRunner::callShouldCloseOnWebView()
{
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
return WKBundleFrameCallShouldCloseOnWebView(mainFrame);
}
void TestRunner::queueBackNavigation(unsigned howFarBackward)
{
- InjectedBundle::singleton().queueBackNavigation(howFarBackward);
+ InjectedBundle::shared().queueBackNavigation(howFarBackward);
}
void TestRunner::queueForwardNavigation(unsigned howFarForward)
{
- InjectedBundle::singleton().queueForwardNavigation(howFarForward);
+ InjectedBundle::shared().queueForwardNavigation(howFarForward);
}
-void TestRunner::queueLoad(JSStringRef url, JSStringRef target, bool shouldOpenExternalURLs)
+void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
{
- auto& injectedBundle = InjectedBundle::singleton();
- WKRetainPtr<WKURLRef> baseURLWK(AdoptWK, WKBundleFrameCopyURL(WKBundlePageGetMainFrame(injectedBundle.page()->page())));
+ WKRetainPtr<WKURLRef> baseURLWK(AdoptWK, WKBundleFrameCopyURL(WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page())));
WKRetainPtr<WKURLRef> urlWK(AdoptWK, WKURLCreateWithBaseURL(baseURLWK.get(), toWTFString(toWK(url)).utf8().data()));
WKRetainPtr<WKStringRef> urlStringWK(AdoptWK, WKURLCopyString(urlWK.get()));
- injectedBundle.queueLoad(urlStringWK.get(), toWK(target).get(), shouldOpenExternalURLs);
+ InjectedBundle::shared().queueLoad(urlStringWK.get(), toWK(target).get());
}
void TestRunner::queueLoadHTMLString(JSStringRef content, JSStringRef baseURL, JSStringRef unreachableURL)
@@ -813,45 +757,45 @@ void TestRunner::queueLoadHTMLString(JSStringRef content, JSStringRef baseURL, J
WKRetainPtr<WKStringRef> baseURLWK = baseURL ? toWK(baseURL) : WKRetainPtr<WKStringRef>();
WKRetainPtr<WKStringRef> unreachableURLWK = unreachableURL ? toWK(unreachableURL) : WKRetainPtr<WKStringRef>();
- InjectedBundle::singleton().queueLoadHTMLString(contentWK.get(), baseURLWK.get(), unreachableURLWK.get());
+ InjectedBundle::shared().queueLoadHTMLString(contentWK.get(), baseURLWK.get(), unreachableURLWK.get());
}
void TestRunner::queueReload()
{
- InjectedBundle::singleton().queueReload();
+ InjectedBundle::shared().queueReload();
}
void TestRunner::queueLoadingScript(JSStringRef script)
{
WKRetainPtr<WKStringRef> scriptWK = toWK(script);
- InjectedBundle::singleton().queueLoadingScript(scriptWK.get());
+ InjectedBundle::shared().queueLoadingScript(scriptWK.get());
}
void TestRunner::queueNonLoadingScript(JSStringRef script)
{
WKRetainPtr<WKStringRef> scriptWK = toWK(script);
- InjectedBundle::singleton().queueNonLoadingScript(scriptWK.get());
+ InjectedBundle::shared().queueNonLoadingScript(scriptWK.get());
}
void TestRunner::setHandlesAuthenticationChallenges(bool handlesAuthenticationChallenges)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetHandlesAuthenticationChallenge"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(handlesAuthenticationChallenges));
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get());
}
void TestRunner::setAuthenticationUsername(JSStringRef username)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationUsername"));
WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(username));
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get());
}
void TestRunner::setAuthenticationPassword(JSStringRef password)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationPassword"));
WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(password));
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get());
}
bool TestRunner::secureEventInputIsEnabled() const
@@ -859,7 +803,7 @@ bool TestRunner::secureEventInputIsEnabled() const
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SecureEventInputIsEnabled"));
WKTypeRef returnData = 0;
- WKBundlePagePostSynchronousMessageForTesting(InjectedBundle::singleton().page()->page(), messageName.get(), 0, &returnData);
+ WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), messageName.get(), 0, &returnData);
return WKBooleanGetValue(static_cast<WKBooleanRef>(returnData));
}
@@ -867,119 +811,21 @@ void TestRunner::setBlockAllPlugins(bool shouldBlock)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetBlockAllPlugins"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(shouldBlock));
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
-}
-
-JSValueRef TestRunner::failNextNewCodeBlock()
-{
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
- JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
- return JSC::failNextNewCodeBlock(context);
+ WKBundlePostMessage(InjectedBundle::shared().bundle(), messageName.get(), messageBody.get());
}
JSValueRef TestRunner::numberOfDFGCompiles(JSValueRef theFunction)
{
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
return JSC::numberOfDFGCompiles(context, theFunction);
}
JSValueRef TestRunner::neverInlineFunction(JSValueRef theFunction)
{
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
+ WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::shared().page()->page());
JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
return JSC::setNeverInline(context, theFunction);
}
-void TestRunner::setShouldDecideNavigationPolicyAfterDelay(bool value)
-{
- m_shouldDecideNavigationPolicyAfterDelay = value;
- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetShouldDecideNavigationPolicyAfterDelay"));
- WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
-}
-
-void TestRunner::setNavigationGesturesEnabled(bool value)
-{
- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetNavigationGesturesEnabled"));
- WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
-}
-
-static unsigned nextUIScriptCallbackID()
-{
- static unsigned callbackID = FirstUIScriptCallbackID;
- return callbackID++;
-}
-
-void TestRunner::runUIScript(JSStringRef script, JSValueRef callback)
-{
- unsigned callbackID = nextUIScriptCallbackID();
- cacheTestRunnerCallback(callbackID, callback);
-
- WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("RunUIProcessScript"));
-
- WKRetainPtr<WKMutableDictionaryRef> testDictionary(AdoptWK, WKMutableDictionaryCreate());
-
- WKRetainPtr<WKStringRef> scriptKey(AdoptWK, WKStringCreateWithUTF8CString("Script"));
- WKRetainPtr<WKStringRef> scriptValue(AdoptWK, WKStringCreateWithJSString(script));
-
- WKRetainPtr<WKStringRef> callbackIDKey(AdoptWK, WKStringCreateWithUTF8CString("CallbackID"));
- WKRetainPtr<WKUInt64Ref> callbackIDValue = adoptWK(WKUInt64Create(callbackID));
-
- WKDictionarySetItem(testDictionary.get(), scriptKey.get(), scriptValue.get());
- WKDictionarySetItem(testDictionary.get(), callbackIDKey.get(), callbackIDValue.get());
-
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), testDictionary.get());
-}
-
-void TestRunner::runUIScriptCallback(unsigned callbackID, JSStringRef result)
-{
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
- JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
-
- JSValueRef resultValue = JSValueMakeString(context, result);
- callTestRunnerCallback(callbackID, 1, &resultValue);
-}
-
-void TestRunner::installDidBeginSwipeCallback(JSValueRef callback)
-{
- cacheTestRunnerCallback(DidBeginSwipeCallbackID, callback);
-}
-
-void TestRunner::installWillEndSwipeCallback(JSValueRef callback)
-{
- cacheTestRunnerCallback(WillEndSwipeCallbackID, callback);
-}
-
-void TestRunner::installDidEndSwipeCallback(JSValueRef callback)
-{
- cacheTestRunnerCallback(DidEndSwipeCallbackID, callback);
-}
-
-void TestRunner::installDidRemoveSwipeSnapshotCallback(JSValueRef callback)
-{
- cacheTestRunnerCallback(DidRemoveSwipeSnapshotCallbackID, callback);
-}
-
-void TestRunner::callDidBeginSwipeCallback()
-{
- callTestRunnerCallback(DidBeginSwipeCallbackID);
-}
-
-void TestRunner::callWillEndSwipeCallback()
-{
- callTestRunnerCallback(WillEndSwipeCallbackID);
-}
-
-void TestRunner::callDidEndSwipeCallback()
-{
- callTestRunnerCallback(DidEndSwipeCallbackID);
-}
-
-void TestRunner::callDidRemoveSwipeSnapshotCallback()
-{
- callTestRunnerCallback(DidRemoveSwipeSnapshotCallbackID);
-}
-
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
index 67c5c6c8b..cefb6a5d1 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
@@ -27,25 +27,24 @@
#define TestRunner_h
#include "JSWrappable.h"
-#include "StringFunctions.h"
#include <JavaScriptCore/JSRetainPtr.h>
-#include <WebKit/WKBundleScriptWorld.h>
-#include <WebKit/WKRetainPtr.h>
+#include <WebKit2/WKBundleScriptWorld.h>
+#include <WebKit2/WKRetainPtr.h>
#include <string>
#include <wtf/PassRefPtr.h>
-#include <wtf/text/WTFString.h>
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
#include <CoreFoundation/CFRunLoop.h>
typedef RetainPtr<CFRunLoopTimerRef> PlatformTimerRef;
#elif PLATFORM(GTK)
-#include <wtf/RunLoop.h>
-namespace WTR {
-class TestRunner;
-typedef RunLoop::Timer<TestRunner> PlatformTimerRef;
-}
+typedef unsigned int PlatformTimerRef;
#elif PLATFORM(EFL)
+#if USE(EO)
+typedef struct _Eo_Opaque Ecore_Timer;
+#else
+typedef struct _Ecore_Timer Ecore_Timer;
+#endif
typedef Ecore_Timer* PlatformTimerRef;
#endif
@@ -62,8 +61,6 @@ public:
void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
// The basics.
- WKURLRef testURL() const { return m_testURL.get(); }
- void setTestURL(WKURLRef url) { m_testURL = url; }
void dumpAsText(bool dumpPixels);
void waitForPolicyDelegate();
void dumpChildFramesAsText() { m_whatToDump = AllFramesText; }
@@ -87,7 +84,6 @@ public:
void dumpApplicationCacheDelegateCallbacks() { m_dumpApplicationCacheDelegateCallbacks = true; }
void dumpDatabaseCallbacks() { m_dumpDatabaseCallbacks = true; }
void dumpDOMAsWebArchive() { m_whatToDump = DOMAsWebArchive; }
- void dumpPolicyDelegateCallbacks() { m_dumpPolicyCallbacks = true; }
void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; }
@@ -185,7 +181,6 @@ public:
bool shouldDumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; }
bool shouldDumpDatabaseCallbacks() const { return m_dumpDatabaseCallbacks; }
bool shouldDumpSelectionRect() const { return m_dumpSelectionRect; }
- bool shouldDumpPolicyCallbacks() const { return m_dumpPolicyCallbacks; }
bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; }
bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; }
@@ -203,8 +198,7 @@ public:
void showWebInspector();
void closeWebInspector();
- void evaluateInWebInspector(JSStringRef script);
- JSRetainPtr<JSStringRef> inspectorTestStubURL();
+ void evaluateInWebInspector(long callId, JSStringRef script);
void setPOSIXLocale(JSStringRef);
@@ -212,8 +206,6 @@ public:
void setWillSendRequestReturnsNull(bool f) { m_willSendRequestReturnsNull = f; }
bool willSendRequestReturnsNullOnRedirect() const { return m_willSendRequestReturnsNullOnRedirect; }
void setWillSendRequestReturnsNullOnRedirect(bool f) { m_willSendRequestReturnsNullOnRedirect = f; }
- void setWillSendRequestAddsHTTPBody(JSStringRef body) { m_willSendRequestHTTPBody = toWTFString(toWK(body)); }
- String willSendRequestHTTPBody() const { return m_willSendRequestHTTPBody; }
void setTextDirection(JSStringRef);
@@ -264,23 +256,18 @@ public:
void setGeolocationPermission(bool);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy, JSValueRef altitude, JSValueRef altitudeAccuracy, JSValueRef heading, JSValueRef speed);
void setMockGeolocationPositionUnavailableError(JSStringRef message);
- bool isGeolocationProviderActive();
-
- // MediaStream
- void setUserMediaPermission(bool);
- void setUserMediaPermissionForOrigin(bool permission, JSStringRef url);
void setPageVisibility(JSStringRef state);
void resetPageVisibility();
bool callShouldCloseOnWebView();
- void setCustomTimeout(int duration) { m_timeout = duration; }
+ void setCustomTimeout(int duration);
// Work queue.
void queueBackNavigation(unsigned howFarBackward);
void queueForwardNavigation(unsigned howFarForward);
- void queueLoad(JSStringRef url, JSStringRef target, bool shouldOpenExternalURLs);
+ void queueLoad(JSStringRef url, JSStringRef target);
void queueLoadHTMLString(JSStringRef content, JSStringRef baseURL, JSStringRef unreachableURL);
void queueReload();
void queueLoadingScript(JSStringRef script);
@@ -288,36 +275,17 @@ public:
bool secureEventInputIsEnabled() const;
- JSValueRef failNextNewCodeBlock();
JSValueRef numberOfDFGCompiles(JSValueRef theFunction);
JSValueRef neverInlineFunction(JSValueRef theFunction);
- bool shouldDecideNavigationPolicyAfterDelay() const { return m_shouldDecideNavigationPolicyAfterDelay; }
- void setShouldDecideNavigationPolicyAfterDelay(bool);
- void setNavigationGesturesEnabled(bool);
-
- void runUIScript(JSStringRef script, JSValueRef callback);
- void runUIScriptCallback(unsigned callbackID, JSStringRef result);
-
- void installDidBeginSwipeCallback(JSValueRef);
- void installWillEndSwipeCallback(JSValueRef);
- void installDidEndSwipeCallback(JSValueRef);
- void installDidRemoveSwipeSnapshotCallback(JSValueRef);
- void callDidBeginSwipeCallback();
- void callWillEndSwipeCallback();
- void callDidEndSwipeCallback();
- void callDidRemoveSwipeSnapshotCallback();
-
- void clearTestRunnerCallbacks();
-
private:
+ static const double waitToDumpWatchdogTimerInterval;
+
TestRunner();
void platformInitialize();
void initializeWaitToDumpWatchdogTimerIfNeeded();
- WKRetainPtr<WKURLRef> m_testURL; // Set by InjectedBundlePage once provisional load starts.
-
WhatToDump m_whatToDump;
bool m_shouldDumpAllFrameScrollPositions;
bool m_shouldDumpBackForwardListsForAllWindows;
@@ -338,7 +306,6 @@ private:
bool m_dumpWillCacheResponse;
bool m_dumpApplicationCacheDelegateCallbacks;
bool m_dumpDatabaseCallbacks;
- bool m_dumpPolicyCallbacks { false };
bool m_disallowIncreaseForApplicationCacheQuota;
bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
bool m_testRepaint;
@@ -348,7 +315,6 @@ private:
bool m_willSendRequestReturnsNull;
bool m_willSendRequestReturnsNullOnRedirect;
bool m_shouldStopProvisionalFrameLoads;
- String m_willSendRequestHTTPBody;
bool m_policyDelegateEnabled;
bool m_policyDelegatePermissive;
@@ -361,13 +327,9 @@ private:
double m_databaseDefaultQuota;
double m_databaseMaxQuota;
- bool m_shouldDecideNavigationPolicyAfterDelay { false };
-
bool m_userStyleSheetEnabled;
WKRetainPtr<WKStringRef> m_userStyleSheetLocation;
- WKRetainPtr<WKArrayRef> m_allowedHosts;
-
PlatformTimerRef m_waitToDumpWatchdogTimer;
};
diff --git a/Tools/WebKitTestRunner/InjectedBundle/TextInputController.cpp b/Tools/WebKitTestRunner/InjectedBundle/TextInputController.cpp
index f4e68f695..0087aa301 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/TextInputController.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/TextInputController.cpp
@@ -30,7 +30,7 @@
#include "InjectedBundlePage.h"
#include "JSTextInputController.h"
#include "StringFunctions.h"
-#include <WebKit/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundlePagePrivate.h>
namespace WTR {
@@ -59,22 +59,22 @@ void TextInputController::makeWindowObject(JSContextRef context, JSObjectRef win
void TextInputController::setMarkedText(JSStringRef text, int from, int length)
{
- WKBundlePageSetComposition(InjectedBundle::singleton().page()->page(), toWK(text).get(), from, length);
+ WKBundlePageSetComposition(InjectedBundle::shared().page()->page(), toWK(text).get(), from, length);
}
bool TextInputController::hasMarkedText()
{
- return WKBundlePageHasComposition(InjectedBundle::singleton().page()->page());
+ return WKBundlePageHasComposition(InjectedBundle::shared().page()->page());
}
void TextInputController::unmarkText()
{
- WKBundlePageConfirmComposition(InjectedBundle::singleton().page()->page());
+ WKBundlePageConfirmComposition(InjectedBundle::shared().page()->page());
}
void TextInputController::insertText(JSStringRef text)
{
- WKBundlePageConfirmCompositionWithText(InjectedBundle::singleton().page()->page(), toWK(text).get());
+ WKBundlePageConfirmCompositionWithText(InjectedBundle::shared().page()->page(), toWK(text).get());
}
} // namespace WTR
diff --git a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp
index c1cb34951..3573a2a5c 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp
@@ -33,18 +33,33 @@
#include "InjectedBundle.h"
#include "InjectedBundlePage.h"
-#include <WebKit/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundlePagePrivate.h>
#include <atk/atk.h>
#include <cstdio>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GUniquePtr.h>
#include <wtf/text/StringBuilder.h>
namespace WTR {
void AccessibilityController::logAccessibilityEvents()
{
- // No longer implemented for ATK. Use addNotificationListener() instead to
- // check that relevant ATK signals are being emmitted in response to events.
+ // Ensure no callbacks are connected before.
+ resetToConsistentState();
+
+ // Ensure that accessibility is initialized for the WebView by querying for
+ // the root accessible object, which will create the full hierarchy.
+ rootElement();
+
+ if (!m_globalNotificationHandler)
+ m_globalNotificationHandler = AccessibilityNotificationHandler::create();
+ m_globalNotificationHandler->logAccessibilityEvents();
+
+ // Ensure the Atk interface types are registered, otherwise
+ // the AtkDocument signal handlers below won't get registered.
+ GObject* dummyAxObject = G_OBJECT(g_object_new(ATK_TYPE_OBJECT, nullptr));
+ AtkObject* dummyNoOpAxObject = atk_no_op_object_new(dummyAxObject);
+ g_object_unref(G_OBJECT(dummyNoOpAxObject));
+ g_object_unref(dummyAxObject);
}
void AccessibilityController::resetToConsistentState()
@@ -84,7 +99,7 @@ static AtkObject* childElementById(AtkObject* parent, const char* id)
PassRefPtr<AccessibilityUIElement> AccessibilityController::accessibleElementById(JSStringRef id)
{
- AtkObject* root = ATK_OBJECT(WKAccessibilityRootObject(InjectedBundle::singleton().page()->page()));
+ AtkObject* root = ATK_OBJECT(WKAccessibilityRootObject(InjectedBundle::shared().page()->page()));
if (!root)
return nullptr;
@@ -107,7 +122,7 @@ JSRetainPtr<JSStringRef> AccessibilityController::platformName()
PassRefPtr<AccessibilityUIElement> AccessibilityController::rootElement()
{
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
void* root = WKAccessibilityRootObject(page);
return AccessibilityUIElement::create(static_cast<AtkObject*>(root));
@@ -115,7 +130,7 @@ PassRefPtr<AccessibilityUIElement> AccessibilityController::rootElement()
PassRefPtr<AccessibilityUIElement> AccessibilityController::focusedElement()
{
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
void* root = WKAccessibilityFocusedObject(page);
return AccessibilityUIElement::create(static_cast<AtkObject*>(root));
diff --git a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp
index 11988ba98..b6af081c2 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp
@@ -25,12 +25,12 @@
#include "InjectedBundle.h"
#include "InjectedBundlePage.h"
#include "JSWrapper.h"
-#include <WebKit/WKBundleFrame.h>
-#include <WebKit/WKBundlePage.h>
-#include <WebKit/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundleFrame.h>
+#include <WebKit2/WKBundlePage.h>
+#include <WebKit2/WKBundlePagePrivate.h>
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GUniquePtr.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
@@ -43,6 +43,29 @@ typedef HashMap<AtkObject*, AccessibilityNotificationHandler*> NotificationHandl
WTF::Vector<unsigned> listenerIds;
NotificationHandlersMap notificationHandlers;
AccessibilityNotificationHandler* globalNotificationHandler = nullptr;
+bool loggingAccessibilityEvents = false;
+
+void printAccessibilityEvent(AtkObject* accessible, const char* signalName, const char* signalValue)
+{
+ // Do not handle state-change:defunct signals, as the AtkObject
+ // associated to them will not be valid at this point already.
+ if (!signalName || !g_strcmp0(signalName, "state-change:defunct"))
+ return;
+
+ if (!accessible || !ATK_IS_OBJECT(accessible))
+ return;
+
+ const char* objectName = atk_object_get_name(accessible);
+ AtkRole objectRole = atk_object_get_role(accessible);
+
+ // Try to always provide a name to be logged for the object.
+ if (!objectName || *objectName == '\0')
+ objectName = "(No name)";
+
+ GUniquePtr<char> signalNameAndValue(signalValue ? g_strdup_printf("%s = %s", signalName, signalValue) : g_strdup(signalName));
+ GUniquePtr<char> accessibilityEventString(g_strdup_printf("Accessibility object emitted \"%s\" / Name: \"%s\" / Role: %d\n", signalNameAndValue.get(), objectName, objectRole));
+ InjectedBundle::shared().outputText(String::fromUTF8(accessibilityEventString.get()));
+}
gboolean axObjectEventListener(GSignalInvocationHint* signalHint, unsigned numParamValues, const GValue* paramValues, gpointer data)
{
@@ -55,7 +78,7 @@ gboolean axObjectEventListener(GSignalInvocationHint* signalHint, unsigned numPa
return true;
#if PLATFORM(GTK) || PLATFORM(EFL)
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame);
#else
@@ -63,36 +86,47 @@ gboolean axObjectEventListener(GSignalInvocationHint* signalHint, unsigned numPa
#endif
GSignalQuery signalQuery;
+ GUniquePtr<char> signalName;
+ GUniquePtr<char> signalValue;
const char* notificationName = nullptr;
Vector<JSValueRef> extraArgs;
g_signal_query(signalHint->signal_id, &signalQuery);
if (!g_strcmp0(signalQuery.signal_name, "state-change")) {
+ signalName.reset(g_strdup_printf("state-change:%s", g_value_get_string(&paramValues[1])));
+ signalValue.reset(g_strdup_printf("%d", g_value_get_boolean(&paramValues[2])));
if (!g_strcmp0(g_value_get_string(&paramValues[1]), "checked"))
notificationName = "CheckedStateChanged";
else if (!g_strcmp0(g_value_get_string(&paramValues[1]), "invalid-entry"))
notificationName = "AXInvalidStatusChanged";
} else if (!g_strcmp0(signalQuery.signal_name, "focus-event")) {
+ signalName.reset(g_strdup("focus-event"));
+ signalValue.reset(g_strdup_printf("%d", g_value_get_boolean(&paramValues[1])));
if (g_value_get_boolean(&paramValues[1]))
notificationName = "AXFocusedUIElementChanged";
- } else if (!g_strcmp0(signalQuery.signal_name, "selection-changed")) {
- notificationName = "AXSelectedChildrenChanged";
} else if (!g_strcmp0(signalQuery.signal_name, "children-changed")) {
const gchar* childrenChangedDetail = g_quark_to_string(signalHint->detail);
+ signalName.reset(g_strdup_printf("children-changed:%s", childrenChangedDetail));
+ signalValue.reset(g_strdup_printf("%d", g_value_get_uint(&paramValues[1])));
notificationName = !g_strcmp0(childrenChangedDetail, "add") ? "AXChildrenAdded" : "AXChildrenRemoved";
} else if (!g_strcmp0(signalQuery.signal_name, "property-change")) {
+ signalName.reset(g_strdup_printf("property-change:%s", g_quark_to_string(signalHint->detail)));
if (!g_strcmp0(g_quark_to_string(signalHint->detail), "accessible-value"))
notificationName = "AXValueChanged";
} else if (!g_strcmp0(signalQuery.signal_name, "load-complete"))
notificationName = "AXLoadComplete";
else if (!g_strcmp0(signalQuery.signal_name, "text-caret-moved")) {
notificationName = "AXTextCaretMoved";
- GUniquePtr<char> signalValue(g_strdup_printf("%d", g_value_get_int(&paramValues[1])));
+ signalName.reset(g_strdup(signalQuery.signal_name));
+ signalValue.reset(g_strdup_printf("%d", g_value_get_int(&paramValues[1])));
JSRetainPtr<JSStringRef> jsSignalValue(Adopt, JSStringCreateWithUTF8CString(signalValue.get()));
extraArgs.append(JSValueMakeString(jsContext, jsSignalValue.get()));
- } else if (!g_strcmp0(signalQuery.signal_name, "text-insert") || !g_strcmp0(signalQuery.signal_name, "text-remove"))
- notificationName = "AXTextChanged";
+ } else
+ signalName.reset(g_strdup(signalQuery.signal_name));
+
+ if (loggingAccessibilityEvents)
+ printAccessibilityEvent(accessible, signalName.get(), signalValue.get());
if (!jsContext)
return true;
@@ -140,6 +174,12 @@ AccessibilityNotificationHandler::~AccessibilityNotificationHandler()
disconnectAccessibilityCallbacks();
}
+void AccessibilityNotificationHandler::logAccessibilityEvents()
+{
+ connectAccessibilityCallbacks();
+ loggingAccessibilityEvents = true;
+}
+
void AccessibilityNotificationHandler::setNotificationFunctionCallback(JSValueRef notificationFunctionCallback)
{
if (!notificationFunctionCallback) {
@@ -151,7 +191,7 @@ void AccessibilityNotificationHandler::setNotificationFunctionCallback(JSValueRe
m_notificationFunctionCallback = notificationFunctionCallback;
#if PLATFORM(GTK) || PLATFORM(EFL)
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame);
#else
@@ -182,7 +222,7 @@ void AccessibilityNotificationHandler::setNotificationFunctionCallback(JSValueRe
void AccessibilityNotificationHandler::removeAccessibilityNotificationHandler()
{
#if PLATFORM(GTK) || PLATFORM(EFL)
- WKBundlePageRef page = InjectedBundle::singleton().page()->page();
+ WKBundlePageRef page = InjectedBundle::shared().page()->page();
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
JSContextRef jsContext = WKBundleFrameGetJavaScriptContext(mainFrame);
#else
@@ -217,10 +257,7 @@ void AccessibilityNotificationHandler::connectAccessibilityCallbacks()
"ATK:AtkObject:property-change",
"ATK:AtkObject:visible-data-changed",
"ATK:AtkDocument:load-complete",
- "ATK:AtkSelection:selection-changed",
"ATK:AtkText:text-caret-moved",
- "ATK:AtkText:text-insert",
- "ATK:AtkText:text-remove",
0
};
@@ -234,7 +271,7 @@ void AccessibilityNotificationHandler::connectAccessibilityCallbacks()
unsigned id = atk_add_global_event_listener(axObjectEventListener, *signalName);
if (!id) {
String message = String::format("atk_add_global_event_listener failed for signal %s\n", *signalName);
- InjectedBundle::singleton().outputText(message);
+ InjectedBundle::shared().outputText(message);
continue;
}
diff --git a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.h b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.h
index bb3869ecd..3443bce2c 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.h
@@ -27,7 +27,7 @@
#include <atk/atkobject.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
namespace WTR {
@@ -42,6 +42,7 @@ public:
GRefPtr<AtkObject> platformElement() const { return m_platformElement; }
void setNotificationFunctionCallback(JSValueRef);
JSValueRef notificationFunctionCallback() const { return m_notificationFunctionCallback; }
+ void logAccessibilityEvents();
private:
AccessibilityNotificationHandler();
diff --git a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
index ded3a329d..440377937 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp
@@ -35,13 +35,10 @@
#include "NotImplemented.h"
#include <JavaScriptCore/JSStringRef.h>
#include <JavaScriptCore/OpaqueJSString.h>
-#if ATK_CHECK_VERSION(2,11,90)
-#include <WebKit/WKBundleFrame.h>
-#endif
#include <atk/atk.h>
#include <wtf/Assertions.h>
-#include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/gobject/GUniquePtr.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
@@ -51,13 +48,6 @@ namespace WTR {
namespace {
-#if ATK_CHECK_VERSION(2,11,92)
-enum RangeLimit {
- RangeLimitMinimum,
- RangeLimitMaximum
-};
-#endif
-
enum AtkAttributeType {
ObjectAttributeType,
TextAttributeType
@@ -71,8 +61,6 @@ enum AttributeDomain {
enum AttributesIndex {
// Attribute names.
InvalidNameIndex = 0,
- PosInSetIndex,
- SetSizeIndex,
PlaceholderNameIndex,
SortNameIndex,
@@ -88,8 +76,6 @@ enum AttributesIndex {
const String attributesMap[][2] = {
// Attribute names.
{ "AXInvalid", "invalid" },
- { "AXARIAPosInSet", "posinset" },
- { "AXARIASetSize", "setsize" },
{ "AXPlaceholderValue", "placeholder-text" } ,
{ "AXSortDirection", "sort" },
@@ -186,8 +172,9 @@ String getAttributeSetValueForId(AtkObject* accessible, AtkAttributeType type, S
return atkAttributeValueToCoreAttributeValue(type, id, attributeValue);
}
-String attributeSetToString(AtkAttributeSet* attributeSet, String separator=", ")
+String getAtkAttributeSetAsString(AtkObject* accessible, AtkAttributeType type)
{
+ AtkAttributeSet* attributeSet = getAttributeSet(accessible, type);
if (!attributeSet)
return String();
@@ -197,18 +184,13 @@ String attributeSetToString(AtkAttributeSet* attributeSet, String separator=", "
GUniquePtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL));
builder.append(attributeData.get());
if (attributes->next)
- builder.append(separator);
+ builder.append(", ");
}
atk_attribute_set_free(attributeSet);
return builder.toString();
}
-String getAtkAttributeSetAsString(AtkObject* accessible, AtkAttributeType type, String separator=", ")
-{
- return attributeSetToString(getAttributeSet(accessible, type), separator);
-}
-
bool checkElementState(PlatformUIElement element, AtkStateType stateType)
{
if (!ATK_IS_OBJECT(element.get()))
@@ -221,10 +203,7 @@ bool checkElementState(PlatformUIElement element, AtkStateType stateType)
JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
{
GUniquePtr<gchar> rangeString(g_strdup("{0, 0}"));
-#if ATK_CHECK_VERSION(2,11,90)
- if (!ATK_IS_TABLE_CELL(element.get()))
- return JSStringCreateWithUTF8CString(rangeString.get());
-#else
+
if (!ATK_IS_OBJECT(element.get()))
return JSStringCreateWithUTF8CString(rangeString.get());
@@ -236,20 +215,11 @@ JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
gint indexInParent = atk_object_get_index_in_parent(ATK_OBJECT(element.get()));
if (indexInParent == -1)
return JSStringCreateWithUTF8CString(rangeString.get());
-#endif
- gint row = -1;
- gint column = -1;
- gint rowSpan = -1;
- gint columnSpan = -1;
-#if ATK_CHECK_VERSION(2,11,90)
- atk_table_cell_get_row_column_span(ATK_TABLE_CELL(element.get()), &row, &column, &rowSpan, &columnSpan);
-#else
+ int row = -1;
+ int column = -1;
row = atk_table_get_row_at_index(ATK_TABLE(axTable), indexInParent);
column = atk_table_get_column_at_index(ATK_TABLE(axTable), indexInParent);
- rowSpan = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column);
- columnSpan = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column);
-#endif
// Get the actual values, if row and columns are valid values.
if (row != -1 && column != -1) {
@@ -257,10 +227,10 @@ JSStringRef indexRangeInTable(PlatformUIElement element, bool isRowRange)
int length = 0;
if (isRowRange) {
base = row;
- length = rowSpan;
+ length = atk_table_get_row_extent_at(ATK_TABLE(axTable), row, column);
} else {
base = column;
- length = columnSpan;
+ length = atk_table_get_column_extent_at(ATK_TABLE(axTable), row, column);
}
rangeString.reset(g_strdup_printf("{%d, %d}", base, length));
}
@@ -273,13 +243,6 @@ void alterCurrentValue(PlatformUIElement element, int factor)
if (!ATK_IS_VALUE(element.get()))
return;
-#if ATK_CHECK_VERSION(2,11,92)
- double currentValue;
- atk_value_get_value_and_text(ATK_VALUE(element.get()), &currentValue, nullptr);
-
- double increment = atk_value_get_increment(ATK_VALUE(element.get()));
- atk_value_set_value(ATK_VALUE(element.get()), currentValue + factor * increment);
-#else
GValue currentValue = G_VALUE_INIT;
atk_value_get_current_value(ATK_VALUE(element.get()), &currentValue);
@@ -295,7 +258,6 @@ void alterCurrentValue(PlatformUIElement element, int factor)
g_value_unset(&newValue);
g_value_unset(&increment);
g_value_unset(&currentValue);
-#endif
}
gchar* replaceCharactersForResults(gchar* str)
@@ -321,17 +283,17 @@ const gchar* roleToString(AtkObject* object)
#if ATK_CHECK_VERSION(2, 11, 3)
if (role == ATK_ROLE_LANDMARK) {
String xmlRolesValue = getAttributeSetValueForId(object, ObjectAttributeType, "xml-roles");
- if (equalLettersIgnoringASCIICase(xmlRolesValue, "banner"))
+ if (equalIgnoringCase(xmlRolesValue, "banner"))
return landmarkStringBanner;
- if (equalLettersIgnoringASCIICase(xmlRolesValue, "complementary"))
+ if (equalIgnoringCase(xmlRolesValue, "complementary"))
return landmarkStringComplementary;
- if (equalLettersIgnoringASCIICase(xmlRolesValue, "contentinfo"))
+ if (equalIgnoringCase(xmlRolesValue, "contentinfo"))
return landmarkStringContentinfo;
- if (equalLettersIgnoringASCIICase(xmlRolesValue, "main"))
+ if (equalIgnoringCase(xmlRolesValue, "main"))
return landmarkStringMain;
- if (equalLettersIgnoringASCIICase(xmlRolesValue, "navigation"))
+ if (equalIgnoringCase(xmlRolesValue, "navigation"))
return landmarkStringNavigation;
- if (equalLettersIgnoringASCIICase(xmlRolesValue, "search"))
+ if (equalIgnoringCase(xmlRolesValue, "search"))
return landmarkStringSearch;
}
#endif
@@ -343,8 +305,6 @@ const gchar* roleToString(AtkObject* object)
return "AXDialog";
case ATK_ROLE_CANVAS:
return "AXCanvas";
- case ATK_ROLE_CAPTION:
- return "AXCaption";
case ATK_ROLE_CHECK_BOX:
return "AXCheckBox";
case ATK_ROLE_COLOR_CHOOSER:
@@ -460,10 +420,6 @@ const gchar* roleToString(AtkObject* object)
#if ATK_CHECK_VERSION(2, 11, 3)
case ATK_ROLE_ARTICLE:
return "AXArticle";
- case ATK_ROLE_AUDIO:
- return "AXAudio";
- case ATK_ROLE_BLOCK_QUOTE:
- return "AXBlockquote";
case ATK_ROLE_DEFINITION:
return "AXDefinition";
case ATK_ROLE_LOG:
@@ -474,8 +430,6 @@ const gchar* roleToString(AtkObject* object)
return "AXMath";
case ATK_ROLE_TIMER:
return "AXTimer";
- case ATK_ROLE_VIDEO:
- return "AXVideo";
#endif
#if ATK_CHECK_VERSION(2, 11, 4)
case ATK_ROLE_DESCRIPTION_LIST:
@@ -485,20 +439,6 @@ const gchar* roleToString(AtkObject* object)
case ATK_ROLE_DESCRIPTION_VALUE:
return "AXDescriptionValue";
#endif
-#if ATK_CHECK_VERSION(2, 15, 2)
- case ATK_ROLE_STATIC:
- return "AXStatic";
-#endif
-#if ATK_CHECK_VERSION(2, 15, 4)
- case ATK_ROLE_MATH_FRACTION:
- return "AXMathFraction";
- case ATK_ROLE_MATH_ROOT:
- return "AXMathRoot";
- case ATK_ROLE_SUBSCRIPT:
- return "AXSubscript";
- case ATK_ROLE_SUPERSCRIPT:
- return "AXSuperscript";
-#endif
default:
// We want to distinguish ATK_ROLE_UNKNOWN from a known AtkRole which
// our DRT isn't properly handling.
@@ -506,19 +446,6 @@ const gchar* roleToString(AtkObject* object)
}
}
-String selectedText(AtkObject* accessible)
-{
- if (!ATK_IS_TEXT(accessible))
- return String();
-
- AtkText* text = ATK_TEXT(accessible);
-
- gint start, end;
- g_free(atk_text_get_selection(text, 0, &start, &end));
-
- return atk_text_get_text(text, start, end);
-}
-
String attributesOfElement(AccessibilityUIElement* element)
{
StringBuilder builder;
@@ -625,53 +552,6 @@ static Vector<RefPtr<AccessibilityUIElement> > getVisibleCells(AccessibilityUIEl
return visibleCells;
}
-#if ATK_CHECK_VERSION(2,11,90)
-static Vector<RefPtr<AccessibilityUIElement>> convertGPtrArrayToVector(const GPtrArray* array)
-{
- Vector<RefPtr<AccessibilityUIElement>> cells;
- for (guint i = 0; i < array->len; i++) {
- if (AtkObject* atkObject = static_cast<AtkObject*>(g_ptr_array_index(array, i)))
- cells.append(AccessibilityUIElement::create(atkObject));
- }
- return cells;
-}
-
-static JSValueRef convertToJSObjectArray(const Vector<RefPtr<AccessibilityUIElement>>& children)
-{
- WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
- JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
-
- size_t elementCount = children.size();
- auto valueElements = std::make_unique<JSValueRef[]>(elementCount);
- for (size_t i = 0; i < elementCount; i++)
- valueElements[i] = JSObjectMake(context, children[i]->wrapperClass(), children[i].get());
-
- return JSObjectMakeArray(context, elementCount, valueElements.get(), nullptr);
-}
-#endif
-
-#if ATK_CHECK_VERSION(2,11,92)
-static double rangeMinMaxValue(AtkValue* atkValue, RangeLimit rangeLimit)
-{
- AtkRange* range = atk_value_get_range(atkValue);
- if (!range)
- return 0;
-
- double rangeValue = 0;
- switch (rangeLimit) {
- case RangeLimitMinimum:
- rangeValue = atk_range_get_lower_limit(range);
- break;
- case RangeLimitMaximum:
- rangeValue = atk_range_get_upper_limit(range);
- break;
- };
-
- atk_range_free(range);
- return rangeValue;
-}
-#endif
-
} // namespace
AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
@@ -764,16 +644,28 @@ PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::childAtIndex(unsigned
return nullptr;
}
-static PassRefPtr<AccessibilityUIElement> accessibilityElementAtIndex(AtkObject* element, AtkRelationType relationType, unsigned index)
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::linkedUIElementAtIndex(unsigned index)
+{
+ // FIXME: implement
+ return nullptr;
+}
+
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index)
+{
+ // FIXME: implement
+ return nullptr;
+}
+
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
{
- if (!ATK_IS_OBJECT(element))
+ if (!ATK_IS_OBJECT(m_element.get()))
return nullptr;
- AtkRelationSet* relationSet = atk_object_ref_relation_set(element);
+ AtkRelationSet* relationSet = atk_object_ref_relation_set(ATK_OBJECT(m_element.get()));
if (!relationSet)
return nullptr;
- AtkRelation* relation = atk_relation_set_get_relation_by_type(relationSet, relationType);
+ AtkRelation* relation = atk_relation_set_get_relation_by_type(relationSet, ATK_RELATION_FLOWS_TO);
if (!relation)
return nullptr;
@@ -781,34 +673,12 @@ static PassRefPtr<AccessibilityUIElement> accessibilityElementAtIndex(AtkObject*
if (!targetList || !targetList->len || index >= targetList->len)
return nullptr;
- AtkObject* target = static_cast<AtkObject*>(g_ptr_array_index(targetList, index));
g_object_unref(relationSet);
+ AtkObject* target = static_cast<AtkObject*>(g_ptr_array_index(targetList, index));
return target ? AccessibilityUIElement::create(target) : nullptr;
}
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::linkedUIElementAtIndex(unsigned index)
-{
- // FIXME: implement
- return nullptr;
-}
-
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaOwnsElementAtIndex(unsigned index)
-{
- // FIXME: implement
- return nullptr;
-}
-
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index)
-{
- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_FLOWS_TO, index);
-}
-
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::ariaControlsElementAtIndex(unsigned index)
-{
- return accessibilityElementAtIndex(m_element.get(), ATK_RELATION_CONTROLLER_FOR, index);
-}
-
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::disclosedRowAtIndex(unsigned index)
{
// FIXME: implement
@@ -817,35 +687,20 @@ PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::disclosedRowAtIndex(u
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::rowAtIndex(unsigned index)
{
- // ATK doesn't have API to get an accessible row by index directly. It does, however, have
- // API to get cells in the row specified by index. The parent of a cell should be the row.
- AtkTable* axTable = ATK_TABLE(m_element.get());
- unsigned nColumns = columnCount();
- for (unsigned col = 0; col < nColumns; col++) {
- // Find the first cell in this row that only spans one row.
- if (atk_table_get_row_extent_at(axTable, index, col) == 1) {
- AtkObject* cell = atk_table_ref_at(axTable, index, col);
- return cell ? AccessibilityUIElement::create(atk_object_get_parent(cell)) : nullptr;
- }
- }
-
+ // FIXME: implement
return nullptr;
}
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::selectedChildAtIndex(unsigned index) const
{
- if (!ATK_SELECTION(m_element.get()))
- return nullptr;
-
- GRefPtr<AtkObject> child = adoptGRef(atk_selection_ref_selection(ATK_SELECTION(m_element.get()), index));
- return child ? AccessibilityUIElement::create(child.get()) : nullptr;
+ // FIXME: implement
+ return nullptr;
}
unsigned AccessibilityUIElement::selectedChildrenCount() const
{
- if (!ATK_IS_SELECTION(m_element.get()))
- return 0;
- return atk_selection_get_selection_count(ATK_SELECTION(m_element.get()));
+ // FIXME: implement
+ return 0;
}
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::selectedRowAtIndex(unsigned index)
@@ -931,13 +786,7 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::stringAttributeValue(JSStringRe
String atkAttributeName = coreAttributeToAtkAttribute(attribute);
- // The value of AXSelectedText is not exposed through any AtkAttribute.
- if (atkAttributeName == "AXSelectedText") {
- String string = selectedText(m_element.get());
- return JSStringCreateWithUTF8CString(string.utf8().data());
- }
-
- // Try object attributes before text attributes.
+ // Try object attributes first.
String attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, atkAttributeName);
// Try text attributes if the requested one was not found and we have an AtkText object.
@@ -963,19 +812,7 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::stringAttributeValue(JSStringRe
double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
{
- if (!ATK_IS_OBJECT(m_element.get()))
- return 0;
-
- String atkAttributeName = coreAttributeToAtkAttribute(attribute);
- if (atkAttributeName.isEmpty())
- return 0;
-
- if (atkAttributeName == "setsize" || atkAttributeName == "posinset") {
- String attributeValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, atkAttributeName);
- if (!attributeValue.isEmpty())
- return attributeValue.toDouble();
- }
-
+ // FIXME: implement
return 0;
}
@@ -987,40 +824,14 @@ JSValueRef AccessibilityUIElement::uiElementArrayAttributeValue(JSStringRef attr
JSValueRef AccessibilityUIElement::rowHeaders() const
{
-#if ATK_CHECK_VERSION(2,11,90)
- if (!ATK_IS_TABLE_CELL(m_element.get()))
- return nullptr;
-
- GRefPtr<GPtrArray> array = adoptGRef(atk_table_cell_get_row_header_cells(ATK_TABLE_CELL(m_element.get())));
- if (!array)
- return nullptr;
-
- Vector<RefPtr<AccessibilityUIElement>> rows = convertGPtrArrayToVector(array.get());
- return convertToJSObjectArray(rows);
-#else
+ // FIXME: implement
return nullptr;
-#endif
}
JSValueRef AccessibilityUIElement::columnHeaders() const
{
-#if ATK_CHECK_VERSION(2,11,90)
- if (!ATK_IS_TABLE_CELL(m_element.get()) && !ATK_IS_TABLE(m_element.get()))
- return nullptr;
-
- Vector<RefPtr<AccessibilityUIElement>> columns;
- if (ATK_IS_TABLE_CELL(m_element.get())) {
- GRefPtr<GPtrArray> array = adoptGRef(atk_table_cell_get_column_header_cells(ATK_TABLE_CELL(m_element.get())));
- if (!array)
- return nullptr;
-
- columns = convertGPtrArrayToVector(array.get());
- } else
- columns = getColumnHeaders(ATK_TABLE(m_element.get()));
- return convertToJSObjectArray(columns);
-#else
+ // FIXME: implement
return nullptr;
-#endif
}
PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementAttributeValue(JSStringRef attribute) const
@@ -1041,51 +852,8 @@ bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute)
return false;
String attributeString = jsStringToWTFString(attribute);
- if (attributeString != "AXValue")
- return false;
-
- // ATK does not have a single state or property to indicate whether or not the value
- // of an accessible object can be set. ATs look at several states and properties based
- // on the type of object. If nothing explicitly indicates the value can or cannot be
- // set, ATs make role- and interface-based decisions. We'll do something similar here.
-
- // This state is expected to be present only for text widgets and contenteditable elements.
- if (checkElementState(m_element.get(), ATK_STATE_EDITABLE))
- return true;
-
-#if ATK_CHECK_VERSION(2,11,2)
- // This state is applicable to checkboxes, radiobuttons, switches, etc.
- if (checkElementState(m_element.get(), ATK_STATE_CHECKABLE))
- return true;
-#endif
-
-#if ATK_CHECK_VERSION(2,15,3)
- // This state is expected to be present only for controls and only if explicitly set.
- if (checkElementState(m_element.get(), ATK_STATE_READ_ONLY))
- return false;
-#endif
-
- // We expose an object attribute to ATs when there is an author-provided ARIA property
- // and also when there is a supported ARIA role but no author-provided value.
- String isReadOnly = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "readonly");
- if (!isReadOnly.isEmpty())
- return isReadOnly == "true" ? false : true;
-
- // If we have a native listbox or combobox and the value can be set, the options should
- // have ATK_STATE_SELECTABLE.
- AtkRole role = atk_object_get_role(ATK_OBJECT(m_element.get()));
- if (role == ATK_ROLE_LIST_BOX || role == ATK_ROLE_COMBO_BOX) {
- if (GRefPtr<AtkObject> child = adoptGRef(atk_object_ref_accessible_child(ATK_OBJECT(m_element.get()), 0))) {
- if (atk_object_get_role(ATK_OBJECT(child.get())) == ATK_ROLE_MENU)
- child = adoptGRef(atk_object_ref_accessible_child(ATK_OBJECT(child.get()), 0));
- return child && checkElementState(child.get(), ATK_STATE_SELECTABLE);
- }
- }
-
- // If we have a native element which exposes a range whose value can be set, it should
- // be focusable and have a true range.
- if (ATK_IS_VALUE(m_element.get()) && checkElementState(m_element.get(), ATK_STATE_FOCUSABLE))
- return minValue() != maxValue();
+ if (attributeString == "AXValue")
+ return checkElementState(m_element.get(), ATK_STATE_EDITABLE);
return false;
}
@@ -1134,15 +902,6 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::roleDescription()
return JSStringCreateWithCharacters(0, 0);
}
-JSRetainPtr<JSStringRef> AccessibilityUIElement::computedRoleString()
-{
- String role = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "computed-role");
- if (!role.isEmpty())
- return JSStringCreateWithUTF8CString(role.utf8().data());
-
- return JSStringCreateWithCharacters(0, 0);
-}
-
JSRetainPtr<JSStringRef> AccessibilityUIElement::title()
{
if (!ATK_IS_OBJECT(m_element.get()))
@@ -1249,12 +1008,8 @@ double AccessibilityUIElement::x()
if (!ATK_IS_COMPONENT(m_element.get()))
return 0;
- int x;
-#if ATK_CHECK_VERSION(2,11,90)
- atk_component_get_extents(ATK_COMPONENT(m_element.get()), &x, nullptr, nullptr, nullptr, ATK_XY_SCREEN);
-#else
- atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, nullptr, ATK_XY_SCREEN);
-#endif
+ int x, y;
+ atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, &y, ATK_XY_SCREEN);
return x;
}
@@ -1263,12 +1018,8 @@ double AccessibilityUIElement::y()
if (!ATK_IS_COMPONENT(m_element.get()))
return 0;
- int y;
-#if ATK_CHECK_VERSION(2,11,90)
- atk_component_get_extents(ATK_COMPONENT(m_element.get()), nullptr, &y, nullptr, nullptr, ATK_XY_SCREEN);
-#else
- atk_component_get_position(ATK_COMPONENT(m_element.get()), nullptr, &y, ATK_XY_SCREEN);
-#endif
+ int x, y;
+ atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, &y, ATK_XY_SCREEN);
return y;
}
@@ -1277,12 +1028,8 @@ double AccessibilityUIElement::width()
if (!ATK_IS_COMPONENT(m_element.get()))
return 0;
- int width;
-#if ATK_CHECK_VERSION(2,11,90)
- atk_component_get_extents(ATK_COMPONENT(m_element.get()), nullptr, nullptr, &width, nullptr, ATK_XY_WINDOW);
-#else
- atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, nullptr);
-#endif
+ int width, height;
+ atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, &height);
return width;
}
@@ -1291,12 +1038,8 @@ double AccessibilityUIElement::height()
if (!ATK_IS_COMPONENT(m_element.get()))
return 0;
- int height;
-#if ATK_CHECK_VERSION(2,11,90)
- atk_component_get_extents(ATK_COMPONENT(m_element.get()), nullptr, nullptr, nullptr, &height, ATK_XY_WINDOW);
-#else
- atk_component_get_size(ATK_COMPONENT(m_element.get()), nullptr, &height);
-#endif
+ int width, height;
+ atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, &height);
return height;
}
@@ -1305,13 +1048,11 @@ double AccessibilityUIElement::clickPointX()
if (!ATK_IS_COMPONENT(m_element.get()))
return 0;
- int x, width;
-#if ATK_CHECK_VERSION(2,11,90)
- atk_component_get_extents(ATK_COMPONENT(m_element.get()), &x, nullptr, &width, nullptr, ATK_XY_WINDOW);
-#else
- atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, nullptr, ATK_XY_WINDOW);
- atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, nullptr);
-#endif
+ int x, y;
+ atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, &y, ATK_XY_WINDOW);
+
+ int width, height;
+ atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, &height);
return x + width / 2.0;
}
@@ -1321,13 +1062,11 @@ double AccessibilityUIElement::clickPointY()
if (!ATK_IS_COMPONENT(m_element.get()))
return 0;
- int y, height;
-#if ATK_CHECK_VERSION(2,11,90)
- atk_component_get_extents(ATK_COMPONENT(m_element.get()), nullptr, &y, nullptr, &height, ATK_XY_WINDOW);
-#else
- atk_component_get_position(ATK_COMPONENT(m_element.get()), nullptr, &y, ATK_XY_WINDOW);
- atk_component_get_size(ATK_COMPONENT(m_element.get()), nullptr, &height);
-#endif
+ int x, y;
+ atk_component_get_position(ATK_COMPONENT(m_element.get()), &x, &y, ATK_XY_WINDOW);
+
+ int width, height;
+ atk_component_get_size(ATK_COMPONENT(m_element.get()), &width, &height);
return y + height / 2.0;
}
@@ -1338,17 +1077,11 @@ double AccessibilityUIElement::intValue() const
return 0;
if (ATK_IS_VALUE(m_element.get())) {
-#if ATK_CHECK_VERSION(2,11,92)
- double value;
- atk_value_get_value_and_text(ATK_VALUE(m_element.get()), &value, nullptr);
- return value;
-#else
GValue value = G_VALUE_INIT;
atk_value_get_current_value(ATK_VALUE(m_element.get()), &value);
if (!G_VALUE_HOLDS_FLOAT(&value))
return 0;
return g_value_get_float(&value);
-#endif
}
// Consider headings as an special case when returning the "int value" of
@@ -1369,16 +1102,13 @@ double AccessibilityUIElement::minValue()
{
if (!ATK_IS_VALUE(m_element.get()))
return 0;
-#if ATK_CHECK_VERSION(2,11,92)
- return rangeMinMaxValue(ATK_VALUE(m_element.get()), RangeLimitMinimum);
-#else
+
GValue value = G_VALUE_INIT;
atk_value_get_minimum_value(ATK_VALUE(m_element.get()), &value);
if (!G_VALUE_HOLDS_FLOAT(&value))
return 0;
return g_value_get_float(&value);
-#endif
}
double AccessibilityUIElement::maxValue()
@@ -1386,16 +1116,12 @@ double AccessibilityUIElement::maxValue()
if (!ATK_IS_VALUE(m_element.get()))
return 0;
-#if ATK_CHECK_VERSION(2,11,92)
- return rangeMinMaxValue(ATK_VALUE(m_element.get()), RangeLimitMaximum);
-#else
GValue value = G_VALUE_INIT;
atk_value_get_maximum_value(ATK_VALUE(m_element.get()), &value);
if (!G_VALUE_HOLDS_FLOAT(&value))
return 0;
return g_value_get_float(&value);
-#endif
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::valueDescription()
@@ -1416,7 +1142,7 @@ bool AccessibilityUIElement::isPressActionSupported()
return false;
const gchar* actionName = atk_action_get_name(ATK_ACTION(m_element.get()), 0);
- return equalLettersIgnoringASCIICase(String(actionName), "press") || equalLettersIgnoringASCIICase(String(actionName), "jump");
+ return equalIgnoringCase(actionName, String("press")) || equalIgnoringCase(actionName, String("jump"));
}
bool AccessibilityUIElement::isIncrementActionSupported()
@@ -1516,16 +1242,8 @@ int AccessibilityUIElement::lineForIndex(int index)
JSRetainPtr<JSStringRef> AccessibilityUIElement::rangeForLine(int line)
{
- if (!ATK_IS_TEXT(m_element.get()))
- return JSStringCreateWithCharacters(0, 0);
-
- AtkText* text = ATK_TEXT(m_element.get());
- gint startOffset = 0, endOffset = 0;
- for (int i = 0; i <= line; ++i)
- atk_text_get_string_at_offset(text, endOffset, ATK_TEXT_GRANULARITY_LINE, &startOffset, &endOffset);
-
- GUniquePtr<gchar> range(g_strdup_printf("{%d, %d}", startOffset, endOffset - startOffset));
- return JSStringCreateWithUTF8CString(range.get());
+ // FIXME: implement
+ return JSStringCreateWithCharacters(0, 0);
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::rangeForPosition(int x, int y)
@@ -1536,14 +1254,8 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::rangeForPosition(int x, int y)
JSRetainPtr<JSStringRef> AccessibilityUIElement::boundsForRange(unsigned location, unsigned length)
{
- if (!ATK_IS_TEXT(m_element.get()))
- return JSStringCreateWithCharacters(0, 0);
-
- AtkTextRectangle rect;
- atk_text_get_range_extents(ATK_TEXT(m_element.get()), location, location + length, ATK_XY_WINDOW, &rect);
-
- GUniquePtr<gchar> bounds(g_strdup_printf("{%d, %d, %d, %d}", rect.x, rect.y, rect.width, rect.height));
- return JSStringCreateWithUTF8CString(bounds.get());
+ // FIXME: implement
+ return JSStringCreateWithCharacters(0, 0);
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForRange(unsigned location, unsigned length)
@@ -1557,29 +1269,8 @@ JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForRange(unsigned locatio
JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned location, unsigned length)
{
- if (!ATK_IS_TEXT(m_element.get()))
- return JSStringCreateWithCharacters(0, 0);
-
- StringBuilder builder;
-
- // The default text attributes apply to the entire element.
- builder.append("\n\tDefault text attributes:\n\t\t");
- builder.append(attributeSetToString(getAttributeSet(m_element.get(), TextAttributeType), "\n\t\t"));
-
- // The attribute run provides attributes specific to the range of text at the specified offset.
- AtkAttributeSet* attributeSet;
- AtkText* text = ATK_TEXT(m_element.get());
- gint start = 0, end = 0;
- for (int i = location; i < location + length; i = end) {
- AtkAttributeSet* attributeSet = atk_text_get_run_attributes(text, i, &start, &end);
- GUniquePtr<gchar> substring(replaceCharactersForResults(atk_text_get_text(text, start, end)));
- builder.append(String::format("\n\tRange attributes for '%s':\n\t\t", substring.get()));
- builder.append(attributeSetToString(attributeSet, "\n\t\t"));
- }
-
- atk_attribute_set_free(attributeSet);
-
- return JSStringCreateWithUTF8CString(builder.toString().utf8().data());
+ // FIXME: implement
+ return JSStringCreateWithCharacters(0, 0);
}
bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location, unsigned length)
@@ -1588,19 +1279,13 @@ bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned location
return false;
}
-unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
+unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
{
// FIXME: implement
return 0;
}
-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
-{
- // FIXME: implement
- return nullptr;
-}
-
-JSRetainPtr<JSStringRef> AccessibilityUIElement::selectTextWithCriteria(JSContextRef context, JSStringRef ambiguityResolution, JSValueRef searchStrings, JSStringRef replacementString, JSStringRef activity)
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
{
// FIXME: implement
return nullptr;
@@ -1760,22 +1445,6 @@ void AccessibilityUIElement::setSelectedChild(AccessibilityUIElement* element) c
// FIXME: implement
}
-void AccessibilityUIElement::setSelectedChildAtIndex(unsigned index) const
-{
- if (!ATK_IS_SELECTION(m_element.get()))
- return;
-
- atk_selection_add_selection(ATK_SELECTION(m_element.get()), index);
-}
-
-void AccessibilityUIElement::removeSelectionAtIndex(unsigned index) const
-{
- if (!ATK_IS_SELECTION(m_element.get()))
- return;
-
- atk_selection_remove_selection(ATK_SELECTION(m_element.get()), index);
-}
-
JSRetainPtr<JSStringRef> AccessibilityUIElement::accessibilityValue() const
{
// FIXME: implement
@@ -1889,7 +1558,7 @@ bool AccessibilityUIElement::hasPopup() const
return false;
String hasPopupValue = getAttributeSetValueForId(ATK_OBJECT(m_element.get()), ObjectAttributeType, "haspopup");
- return equalLettersIgnoringASCIICase(hasPopupValue, "true");
+ return equalIgnoringCase(hasPopupValue, "true");
}
void AccessibilityUIElement::takeFocus()
@@ -1913,12 +1582,6 @@ void AccessibilityUIElement::removeSelection()
}
// Text markers
-PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::lineTextMarkerRangeForTextMarker(AccessibilityTextMarker* textMarker)
-{
- // FIXME: implement
- return nullptr;
-}
-
PassRefPtr<AccessibilityTextMarkerRange> AccessibilityUIElement::textMarkerRangeForElement(AccessibilityUIElement* element)
{
// FIXME: implement
@@ -2027,25 +1690,10 @@ PassRefPtr<AccessibilityTextMarker> AccessibilityUIElement::endTextMarker()
return nullptr;
}
-bool AccessibilityUIElement::setSelectedVisibleTextRange(AccessibilityTextMarkerRange*)
-{
- return false;
-}
-
void AccessibilityUIElement::scrollToMakeVisible()
{
// FIXME: implement
}
-
-void AccessibilityUIElement::scrollToGlobalPoint(int x, int y)
-{
- // FIXME: implement
-}
-
-void AccessibilityUIElement::scrollToMakeVisibleWithSubFocus(int x, int y, int width, int height)
-{
- // FIXME: implement
-}
JSRetainPtr<JSStringRef> AccessibilityUIElement::supportedActions() const
{
diff --git a/Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp b/Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp
index 496c1bcbf..7c9dab7b9 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005, 2006 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2010 Igalia S.L.
*
@@ -12,7 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -34,8 +34,8 @@
#include "InjectedBundleUtilities.h"
#include <fontconfig/fontconfig.h>
#include <gtk/gtk.h>
-#include <wtf/glib/GLibUtilities.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GUniquePtr.h>
+#include <wtf/gobject/GlibUtilities.h>
namespace WTR {
@@ -68,7 +68,7 @@ CString getOutputDir()
static CString getFontsPath()
{
CString webkitOutputDir = getOutputDir();
- GUniquePtr<char> fontsPath(g_build_filename(webkitOutputDir.data(), "DependenciesGTK", "Root", "webkitgtk-test-fonts", nullptr));
+ GUniquePtr<char> fontsPath(g_build_filename(webkitOutputDir.data(), "Dependencies", "Root", "webkitgtk-test-fonts", nullptr));
if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
return fontsPath.get();
diff --git a/Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.cpp b/Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.cpp
index afbd3f74a..febdaad19 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.cpp
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -30,8 +30,8 @@
#include "InjectedBundleUtilities.h"
#include <gtk/gtk.h>
-#include <wtf/glib/GLibUtilities.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GUniquePtr.h>
+#include <wtf/gobject/GlibUtilities.h>
namespace WTR {
diff --git a/Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.h b/Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.h
index 4062c6d44..50f89dead 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.h
+++ b/Tools/WebKitTestRunner/InjectedBundle/gtk/InjectedBundleUtilities.h
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
diff --git a/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp b/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp
index a9f7f409c..254374884 100644
--- a/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp
+++ b/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp
@@ -30,25 +30,37 @@
#include "InjectedBundle.h"
#include "InjectedBundleUtilities.h"
#include <glib.h>
-#include <wtf/glib/GUniquePtr.h>
+#include <wtf/gobject/GUniquePtr.h>
namespace WTR {
+static gboolean waitToDumpWatchdogTimerCallback(gpointer)
+{
+ InjectedBundle::shared().testRunner()->waitToDumpWatchdogTimerFired();
+ return FALSE;
+}
+
void TestRunner::platformInitialize()
{
+ m_waitToDumpWatchdogTimer = 0;
}
void TestRunner::invalidateWaitToDumpWatchdogTimer()
{
- m_waitToDumpWatchdogTimer.stop();
+ if (!m_waitToDumpWatchdogTimer)
+ return;
+ g_source_remove(m_waitToDumpWatchdogTimer);
+ m_waitToDumpWatchdogTimer = 0;
}
void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded()
{
- if (m_waitToDumpWatchdogTimer.isActive())
+ if (m_waitToDumpWatchdogTimer)
return;
- m_waitToDumpWatchdogTimer.startOneShot(m_timeout / 1000.0);
+ m_waitToDumpWatchdogTimer = g_timeout_add(waitToDumpWatchdogTimerInterval * 1000,
+ waitToDumpWatchdogTimerCallback, 0);
+ g_source_set_name_by_id(m_waitToDumpWatchdogTimer, "[WebKit] waitToDumpWatchdogTimerCallback");
}
JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url)
@@ -66,9 +78,4 @@ JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url)
return JSStringCreateWithUTF8CString(testURI.get());
}
-JSRetainPtr<JSStringRef> TestRunner::inspectorTestStubURL()
-{
- return JSStringCreateWithUTF8CString("resource:///org/webkitgtk/inspector/UserInterface/TestStub.html");
-}
-
} // namespace WTR