Diff
Modified: trunk/LayoutTests/ChangeLog (190259 => 190260)
--- trunk/LayoutTests/ChangeLog 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/LayoutTests/ChangeLog 2015-09-26 00:17:27 UTC (rev 190260)
@@ -1,3 +1,29 @@
+2015-09-25 Simon Fraser <[email protected]>
+
+ [iOS WK2] Add viewport tests and fix runUIScript() timing issues
+ https://bugs.webkit.org/show_bug.cgi?id=149577
+
+ Reviewed by Tim Horton.
+
+ New viewport tests which read the scale etc. in the UI process.
+
+ * TestExpectations:
+ * fast/viewport/ios/resources/viewport-test-utils.js: Added.
+ (getUIScript):
+ (tableFromJSON):
+ (getViewport):
+ (runTest):
+ * fast/viewport/ios/width-is-device-width-expected.txt: Added.
+ * fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt: Added.
+ * fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall.html: Added.
+ * fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden.html: Added.
+ * fast/viewport/ios/width-is-device-width-overflowing-expected.txt: Added.
+ * fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit-expected.txt: Added.
+ * fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit.html: Added.
+ * fast/viewport/ios/width-is-device-width-overflowing.html: Added.
+ * fast/viewport/ios/width-is-device-width.html: Added.
+ * platform/ios-simulator-wk2/TestExpectations:
+
2015-09-25 Antti Koivisto <[email protected]>
Implement scoped styling for shadow DOM
Modified: trunk/LayoutTests/TestExpectations (190259 => 190260)
--- trunk/LayoutTests/TestExpectations 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/LayoutTests/TestExpectations 2015-09-26 00:17:27 UTC (rev 190260)
@@ -15,6 +15,7 @@
tiled-drawing [ Skip ]
swipe [ Skip ]
fast/zooming/ios [ Skip ]
+fast/viewport/ios [ Skip ]
fast/forms/attributed-strings.html [ Skip ]
fast/scrolling/latching [ Skip ]
Added: trunk/LayoutTests/fast/viewport/ios/resources/viewport-test-utils.js (0 => 190260)
--- trunk/LayoutTests/fast/viewport/ios/resources/viewport-test-utils.js (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/resources/viewport-test-utils.js 2015-09-26 00:17:27 UTC (rev 190260)
@@ -0,0 +1,67 @@
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function getUIScript()
+{
+ return "(function() { \
+ var result = { \
+ 'scale' : uiController.zoomScale, \
+ 'maxScale' : uiController.maximumZoomScale, \
+ 'minScale' : uiController.minimumZoomScale, \
+ 'visibleRect' : uiController.contentVisibleRect \
+ }; \
+ return JSON.stringify(result, function(key, value) { \
+ if (typeof value === \"number\") \
+ return value.toFixed(5); \
+ return value; \
+ }); \
+ })();";
+}
+
+function tableFromJSON(value)
+{
+ var result = JSON.parse(value);
+
+ var table = document.createElement('table');
+
+
+ for (var property in result) {
+ var row = document.createElement('tr');
+
+ var th = document.createElement('th');
+ th.textContent = property;
+
+ var td = document.createElement('td');
+ var value = result[property];
+ if (typeof value === "object")
+ value = JSON.stringify(value);
+
+ td.textContent = value;
+
+ row.appendChild(th);
+ row.appendChild(td);
+ table.appendChild(row);
+ }
+
+ return table;
+}
+
+function getViewport()
+{
+ var metaTag = document.head.querySelectorAll('meta')[0];
+ document.getElementById('viewport').textContent = metaTag.getAttribute('content');
+}
+
+function runTest()
+{
+ getViewport();
+
+ if (testRunner.runUIScript) {
+ testRunner.runUIScript(getUIScript(), function(resultString) {
+ document.getElementById('result').appendChild(tableFromJSON(resultString));
+ testRunner.notifyDone();
+ });
+ }
+}
Added: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-expected.txt (0 => 190260)
--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-expected.txt 2015-09-26 00:17:27 UTC (rev 190260)
@@ -0,0 +1,6 @@
+Viewport: width=device-width
+
+scale 1.00000
+maxScale 5.00000
+minScale 1.00000
+visibleRect {"left":"0.00000","top":"0.00000","width":"320.00000","height":"480.00000"}
Added: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt (0 => 190260)
--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall-expected.txt 2015-09-26 00:17:27 UTC (rev 190260)
@@ -0,0 +1,7 @@
+Viewport: width=device-width
+
+scale 1.05263
+maxScale 5.00000
+minScale 1.05263
+visibleRect {"left":"0.00000","top":"0.00000","width":"303.99999","height":"455.99998"}
+
Added: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall.html (0 => 190260)
--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall.html (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden-tall.html 2015-09-26 00:17:27 UTC (rev 190260)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <meta name="viewport" content="width=device-width">
+ <script src=""
+ <style>
+ body {
+ overflow: hidden;
+ height: 1000px;
+ }
+ .wide {
+ height: 1px;
+ width: 1000px;
+ background-color: gray;
+ }
+ </style>
+</head>
+<body _onload_="runTest()">
+
+<p>Viewport: <span id="viewport"></span></p>
+<div id="result"></div>
+
+<div class="wide"></div>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden.html (0 => 190260)
--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden.html (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-body-overflow-hidden.html 2015-09-26 00:17:27 UTC (rev 190260)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <meta name="viewport" content="width=device-width">
+ <script src=""
+ <style>
+ body {
+ overflow: hidden;
+ }
+ .wide {
+ height: 1px;
+ width: 1000px;
+ background-color: gray;
+ }
+ </style>
+</head>
+<body _onload_="runTest()">
+
+<p>Viewport: <span id="viewport"></span></p>
+<div id="result"></div>
+
+<div class="wide"></div>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-expected.txt (0 => 190260)
--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-expected.txt 2015-09-26 00:17:27 UTC (rev 190260)
@@ -0,0 +1,7 @@
+Viewport: width=device-width
+
+scale 0.31746
+maxScale 5.00000
+minScale 0.31746
+visibleRect {"left":"0.00000","top":"0.00000","width":"1007.99997","height":"1511.99995"}
+
Added: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit-expected.txt (0 => 190260)
--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit-expected.txt 2015-09-26 00:17:27 UTC (rev 190260)
@@ -0,0 +1,7 @@
+Viewport: width=device-width, shrink-to-fit=no
+
+scale 1.00000
+maxScale 5.00000
+minScale 1.00000
+visibleRect {"left":"0.00000","top":"0.00000","width":"320.00000","height":"480.00000"}
+
Added: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit.html (0 => 190260)
--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit.html (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing-no-shrink-to-fit.html 2015-09-26 00:17:27 UTC (rev 190260)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <meta name="viewport" content="width=device-width, shrink-to-fit=no">
+ <script src=""
+ <style>
+ .wide {
+ height: 1px;
+ width: 1000px;
+ background-color: gray;
+ }
+ </style>
+</head>
+<body _onload_="runTest()">
+
+<p>Viewport: <span id="viewport"></span></p>
+<div id="result"></div>
+
+<div class="wide"></div>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing.html (0 => 190260)
--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing.html (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width-overflowing.html 2015-09-26 00:17:27 UTC (rev 190260)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <meta name="viewport" content="width=device-width">
+ <script src=""
+ <style>
+ .wide {
+ height: 1px;
+ width: 1000px;
+ background-color: gray;
+ }
+ </style>
+</head>
+<body _onload_="runTest()">
+
+<p>Viewport: <span id="viewport"></span></p>
+<div id="result"></div>
+
+<div class="wide"></div>
+
+</body>
+</html>
Added: trunk/LayoutTests/fast/viewport/ios/width-is-device-width.html (0 => 190260)
--- trunk/LayoutTests/fast/viewport/ios/width-is-device-width.html (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/width-is-device-width.html 2015-09-26 00:17:27 UTC (rev 190260)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <meta name="viewport" content="width=device-width">
+ <script src=""
+</head>
+<body _onload_="runTest()">
+
+<p>Viewport: <span id="viewport"></span></p>
+<div id="result"></div>
+
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (190259 => 190260)
--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations 2015-09-26 00:17:27 UTC (rev 190260)
@@ -9,6 +9,7 @@
fast/harness/ui-side-scripts.html [ Pass ]
fast/harness/concurrent-ui-side-scripts.html [ Pass ]
fast/zooming/ios [ Pass ]
+fast/viewport/ios [ Pass ]
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific directories.
Modified: trunk/Source/WebKit2/ChangeLog (190259 => 190260)
--- trunk/Source/WebKit2/ChangeLog 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Source/WebKit2/ChangeLog 2015-09-26 00:17:27 UTC (rev 190260)
@@ -1,3 +1,35 @@
+2015-09-25 Simon Fraser <[email protected]>
+
+ [iOS WK2] Add viewport tests and fix runUIScript() timing issues
+ https://bugs.webkit.org/show_bug.cgi?id=149577
+
+ Reviewed by Tim Horton.
+
+ When calling testRunner.runUIScript() from a page load event, the script could run
+ in the UI process before the current remote layer tree transaction had been handled
+ there. This meant that runUIScript() could query state which was about to change.
+
+ Fix by delaying the execution of the UI script until a layer tree transaction has
+ been handled by the UI process, leveraging the existing DrawingAreaProxy::dispatchAfterEnsuringDrawing().
+
+ This is done using a new C SPI function WKPageCallAfterNextPresentationUpdate(),
+ which is mirrored in the Obj-C SPI as -_doAfterNextPresentationUpdate:.
+
+ Move WKWebView SPI which is testing-related into a WKTesting category. It is expected
+ that this will grow significantly.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageCallAfterNextPresentationUpdate):
+ * UIProcess/API/C/WKPagePrivate.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::callAfterNextPresentationUpdate):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
+ * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
+ (WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing):
+
2015-09-25 Alexey Proskuryakov <[email protected]>
[Mac] Media tests start to time out after a few days of bot uptime
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (190259 => 190260)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2015-09-26 00:17:27 UTC (rev 190260)
@@ -2469,6 +2469,12 @@
toImpl(pageRef)->clearWheelEventTestTrigger();
}
+void WKPageCallAfterNextPresentationUpdate(WKPageRef pageRef, void* context, WKPagePostPresentationUpdateFunction callback)
+{
+ toImpl(pageRef)->callAfterNextPresentationUpdate([context, callback](WebKit::CallbackBase::Error error) {
+ callback(error != WebKit::CallbackBase::Error::None ? toAPI(API::Error::create().ptr()) : 0, context);
+ });
+}
#if ENABLE(NETSCAPE_PLUGIN_API)
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h (190259 => 190260)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h 2015-09-26 00:17:27 UTC (rev 190260)
@@ -121,6 +121,9 @@
WK_EXPORT void WKPageLoadURLWithShouldOpenExternalURLsPolicy(WKPageRef page, WKURLRef url, bool shouldOpenExternalURLs);
+typedef void (*WKPagePostPresentationUpdateFunction)(WKErrorRef, void*);
+WK_EXPORT void WKPageCallAfterNextPresentationUpdate(WKPageRef page, void* context, WKPagePostPresentationUpdateFunction function);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (190259 => 190260)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-09-26 00:17:27 UTC (rev 190260)
@@ -3020,21 +3020,6 @@
return _viewportMetaTagWidth;
}
-- (CGRect)_contentVisibleRect
-{
- return [self convertRect:[self bounds] toView:self._currentContentView];
-}
-
-- (CGPoint)_convertPointFromContentsToView:(CGPoint)point
-{
- return [self convertPoint:point fromView:self._currentContentView];
-}
-
-- (CGPoint)_convertPointFromViewToContents:(CGPoint)point
-{
- return [self convertPoint:point toView:self._currentContentView];
-}
-
- (_WKWebViewPrintFormatter *)_webViewPrintFormatter
{
UIViewPrintFormatter *viewPrintFormatter = self.viewPrintFormatter;
@@ -3107,14 +3092,52 @@
return [_wkView _automaticallyAdjustsContentInsets];
}
-#endif
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
#endif
@end
-#if !TARGET_OS_IPHONE
+@implementation WKWebView (WKTesting)
+
+#if PLATFORM(IOS)
+
+- (CGRect)_contentVisibleRect
+{
+ return [self convertRect:[self bounds] toView:self._currentContentView];
+}
+
+- (CGPoint)_convertPointFromContentsToView:(CGPoint)point
+{
+ return [self convertPoint:point fromView:self._currentContentView];
+}
+
+- (CGPoint)_convertPointFromViewToContents:(CGPoint)point
+{
+ return [self convertPoint:point toView:self._currentContentView];
+}
+
+#endif // PLATFORM(IOS)
+
+// Execute the supplied block after the next transaction from the WebProcess.
+- (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock
+{
+ typeof(updateBlock) updateBlockCopy = nil;
+ if (updateBlock)
+ updateBlockCopy = Block_copy(updateBlock);
+
+ _page->callAfterNextPresentationUpdate([updateBlockCopy](WebKit::CallbackBase::Error error) {
+ updateBlockCopy();
+ Block_release(updateBlockCopy);
+ });
+}
+
+@end
+
+
+#if PLATFORM(MAC)
+
@implementation WKWebView (WKIBActions)
- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item
@@ -3167,7 +3190,7 @@
@end
-#endif
+#endif // PLATFORM(MAC)
#if PLATFORM(IOS)
@implementation WKWebView (_WKWebViewPrintFormatter)
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (190259 => 190260)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2015-09-26 00:17:27 UTC (rev 190260)
@@ -125,13 +125,8 @@
// The viewport meta tag width is negative if the value is not defined.
@property (nonatomic, readonly) CGFloat _viewportMetaTagWidth;
-@property (nonatomic, readonly) CGRect _contentVisibleRect;
-
@property (nonatomic, readonly) _WKWebViewPrintFormatter *_webViewPrintFormatter;
-- (CGPoint)_convertPointFromContentsToView:(CGPoint)point;
-- (CGPoint)_convertPointFromViewToContents:(CGPoint)point;
-
- (void)_beginInteractiveObscuredInsetsChange;
- (void)_endInteractiveObscuredInsetsChange;
- (void)_hideContentUntilNextUpdate;
@@ -217,4 +212,18 @@
@end
+
+@interface WKWebView (WKTesting)
+
+#if TARGET_OS_IPHONE
+@property (nonatomic, readonly) CGRect _contentVisibleRect WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+- (CGPoint)_convertPointFromContentsToView:(CGPoint)point WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+- (CGPoint)_convertPointFromViewToContents:(CGPoint)point WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
#endif
+
+- (void)_doAfterNextPresentationUpdate:(void (^)(void))updateBlock WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+
+@end
+
+
+#endif
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (190259 => 190260)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-09-26 00:17:27 UTC (rev 190260)
@@ -6084,6 +6084,11 @@
m_process->send(Messages::WebPage::ClearWheelEventTestTrigger(), m_pageID);
}
+void WebPageProxy::callAfterNextPresentationUpdate(std::function<void (CallbackBase::Error)> callback)
+{
+ m_drawingArea->dispatchAfterEnsuringDrawing(callback);
+}
+
void WebPageProxy::setShouldScaleViewToFitDocument(bool shouldScaleViewToFitDocument)
{
if (m_shouldScaleViewToFitDocument == shouldScaleViewToFitDocument)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (190259 => 190260)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-09-26 00:17:27 UTC (rev 190260)
@@ -1057,7 +1057,9 @@
void didChangeBackgroundColor();
void didLayoutForCustomContentProvider();
+ // For testing
void clearWheelEventTestTrigger();
+ void callAfterNextPresentationUpdate(std::function<void (CallbackBase::Error)>);
void didLayout(uint32_t layoutMilestones);
Modified: trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h (190259 => 190260)
--- trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h 2015-09-26 00:17:27 UTC (rev 190260)
@@ -53,6 +53,7 @@
virtual void commitTransientZoom(double scale, WebCore::FloatPoint origin) override;
virtual void waitForDidUpdateViewState() override;
+ virtual void dispatchAfterEnsuringDrawing(std::function<void (CallbackBase::Error)>) override;
virtual void willSendUpdateGeometry() override;
Modified: trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm (190259 => 190260)
--- trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Source/WebKit2/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm 2015-09-26 00:17:27 UTC (rev 190260)
@@ -206,6 +206,14 @@
m_webPageProxy.process().send(Messages::DrawingArea::CommitTransientZoom(scale, origin), m_webPageProxy.pageID());
}
+void TiledCoreAnimationDrawingAreaProxy::dispatchAfterEnsuringDrawing(std::function<void (CallbackBase::Error)> callback)
+{
+ // This callback is primarily used for testing in RemoteLayerTreeDrawingArea. We could in theory wait for a CA commit here.
+ dispatch_async(dispatch_get_main_queue(), ^{
+ callback(CallbackBase::Error::None);
+ });
+}
+
} // namespace WebKit
#endif // !PLATFORM(IOS)
Modified: trunk/Tools/ChangeLog (190259 => 190260)
--- trunk/Tools/ChangeLog 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Tools/ChangeLog 2015-09-26 00:17:27 UTC (rev 190260)
@@ -1,3 +1,22 @@
+2015-09-25 Simon Fraser <[email protected]>
+
+ [iOS WK2] Add viewport tests and fix runUIScript() timing issues
+ https://bugs.webkit.org/show_bug.cgi?id=149577
+
+ Reviewed by Tim Horton.
+
+ When calling testRunner.runUIScript() from a page load event, the script could run
+ in the UI process before the current remote layer tree transaction had been handled
+ there. This meant that runUIScript() could query state which was about to change.
+
+ Fix by delaying the execution of the UI script until a layer tree transaction has
+ been handled by the UI process, leveraging the existing DrawingAreaProxy::dispatchAfterEnsuringDrawing().
+
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+ (WTR::TestInvocation::runUISideScriptAfterUpdateCallback):
+ * WebKitTestRunner/TestInvocation.h:
+
2015-09-25 Alexey Proskuryakov <[email protected]>
[Mac] Media tests start to time out after a few days of bot uptime
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (190259 => 190260)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2015-09-26 00:17:27 UTC (rev 190260)
@@ -668,10 +668,11 @@
WKRetainPtr<WKStringRef> scriptKey(AdoptWK, WKStringCreateWithUTF8CString("Script"));
WKRetainPtr<WKStringRef> callbackIDKey(AdoptWK, WKStringCreateWithUTF8CString("CallbackID"));
- unsigned callbackID = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, callbackIDKey.get())));
- WKStringRef scriptString = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, scriptKey.get()));
-
- runUISideScript(scriptString, callbackID);
+ UIScriptInvocationData* invocationData = new UIScriptInvocationData();
+ invocationData->testInvocation = this;
+ invocationData->callbackID = (unsigned)WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, callbackIDKey.get())));
+ invocationData->scriptString = static_cast<WKStringRef>(WKDictionaryGetItemForKey(messageBodyDictionary, scriptKey.get()));
+ WKPageCallAfterNextPresentationUpdate(TestController::singleton().mainWebView()->page(), invocationData, runUISideScriptAfterUpdateCallback);
return;
}
@@ -720,6 +721,13 @@
return nullptr;
}
+void TestInvocation::runUISideScriptAfterUpdateCallback(WKErrorRef, void* context)
+{
+ UIScriptInvocationData* data = ""
+ data->testInvocation->runUISideScript(data->scriptString.get(), data->callbackID);
+ delete data;
+}
+
void TestInvocation::runUISideScript(WKStringRef script, unsigned scriptCallbackID)
{
if (!m_UIScriptContext)
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (190259 => 190260)
--- trunk/Tools/WebKitTestRunner/TestInvocation.h 2015-09-26 00:13:00 UTC (rev 190259)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h 2015-09-26 00:17:27 UTC (rev 190260)
@@ -74,6 +74,13 @@
bool compareActualHashToExpectedAndDumpResults(const char[33]);
static void forceRepaintDoneCallback(WKErrorRef, void* context);
+
+ struct UIScriptInvocationData {
+ unsigned callbackID;
+ WebKit::WKRetainPtr<WKStringRef> scriptString;
+ TestInvocation* testInvocation;
+ };
+ static void runUISideScriptAfterUpdateCallback(WKErrorRef, void* context);
bool shouldLogFrameLoadDelegates() const;
bool shouldLogHistoryClientCallbacks() const;