Diff
Modified: branches/safari-603-branch/Tools/ChangeLog (210380 => 210381)
--- branches/safari-603-branch/Tools/ChangeLog 2017-01-05 23:49:03 UTC (rev 210380)
+++ branches/safari-603-branch/Tools/ChangeLog 2017-01-05 23:49:08 UTC (rev 210381)
@@ -1,5 +1,35 @@
2017-01-05 Matthew Hanson <matthew_han...@apple.com>
+ Merge r210048. rdar://problem/29316054
+
+ 2016-12-20 Megan Gardner <megan_gard...@apple.com>
+
+ Throw Exception when test doesn't clean up HID Events properly
+ https://bugs.webkit.org/show_bug.cgi?id=166271
+
+ Reviewed by Simon Fraser.
+
+ Add in a check when UIScriptController is deleted to make sure that the HID event
+ callback dictionary is empty. If it is not, and a HID event is hit, this will cause
+ the program to crash without any good information. Crashes are race-y, and will still
+ happen with malformed test, but the information will be much more helpful.
+
+ * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::checkForClean):
+ * TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
+ (UIScriptContext::~UIScriptContext):
+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+ (WTR::UIScriptController::checkForClean):
+ * TestRunnerShared/UIScriptContext/UIScriptController.h:
+ * WebKitTestRunner/ios/HIDEventGenerator.h:
+ * WebKitTestRunner/ios/HIDEventGenerator.mm:
+ (-[HIDEventGenerator checkHIDCallbacksClear]):
+ * WebKitTestRunner/ios/TestControllerIOS.mm:
+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::checkForClean):
+
+2017-01-05 Matthew Hanson <matthew_han...@apple.com>
+
Merge r210273. rdar://problem/29834093
2017-01-04 Tim Horton <timothy_hor...@apple.com>
Modified: branches/safari-603-branch/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (210380 => 210381)
--- branches/safari-603-branch/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm 2017-01-05 23:49:03 UTC (rev 210380)
+++ branches/safari-603-branch/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm 2017-01-05 23:49:08 UTC (rev 210381)
@@ -37,6 +37,10 @@
extern DumpRenderTreeWebScrollView *gWebScrollView;
namespace WTR {
+
+void UIScriptController::checkForOutstandingCallbacks()
+{
+}
void UIScriptController::doAsyncTask(JSValueRef callback)
{
Modified: branches/safari-603-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp (210380 => 210381)
--- branches/safari-603-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp 2017-01-05 23:49:03 UTC (rev 210380)
+++ branches/safari-603-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp 2017-01-05 23:49:08 UTC (rev 210381)
@@ -52,6 +52,7 @@
UIScriptContext::~UIScriptContext()
{
+ m_controller->checkForOutstandingCallbacks();
m_controller->contextDestroyed();
}
Modified: branches/safari-603-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (210380 => 210381)
--- branches/safari-603-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2017-01-05 23:49:03 UTC (rev 210380)
+++ branches/safari-603-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2017-01-05 23:49:08 UTC (rev 210381)
@@ -37,6 +37,12 @@
{
}
+#if !PLATFORM(IOS)
+void UIScriptController::checkForOutstandingCallbacks()
+{
+}
+#endif
+
void UIScriptController::contextDestroyed()
{
m_context = nullptr;
Modified: branches/safari-603-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (210380 => 210381)
--- branches/safari-603-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2017-01-05 23:49:03 UTC (rev 210380)
+++ branches/safari-603-branch/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2017-01-05 23:49:08 UTC (rev 210381)
@@ -47,6 +47,7 @@
}
void contextDestroyed();
+ void checkForOutstandingCallbacks();
void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception);
Modified: branches/safari-603-branch/Tools/WebKitTestRunner/ios/HIDEventGenerator.h (210380 => 210381)
--- branches/safari-603-branch/Tools/WebKitTestRunner/ios/HIDEventGenerator.h 2017-01-05 23:49:03 UTC (rev 210380)
+++ branches/safari-603-branch/Tools/WebKitTestRunner/ios/HIDEventGenerator.h 2017-01-05 23:49:08 UTC (rev 210381)
@@ -98,6 +98,7 @@
- (void)sendEventStream:(NSDictionary *)eventInfo completionBlock:(void (^)(void))completionBlock;
- (void)markerEventReceived:(IOHIDEventRef)event;
+- (BOOL)checkForOutstandingCallbacks;
// Keyboard
- (void)keyPress:(NSString *)character completionBlock:(void (^)(void))completionBlock;
Modified: branches/safari-603-branch/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm (210380 => 210381)
--- branches/safari-603-branch/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm 2017-01-05 23:49:03 UTC (rev 210380)
+++ branches/safari-603-branch/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm 2017-01-05 23:49:08 UTC (rev 210381)
@@ -769,6 +769,11 @@
}
}
+- (BOOL)checkForOutstandingCallbacks
+{
+ return !([_eventCallbacks count] > 0);
+}
+
static inline bool shouldWrapWithShiftKeyEventForCharacter(NSString *key)
{
if (key.length != 1)
Modified: branches/safari-603-branch/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (210380 => 210381)
--- branches/safari-603-branch/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2017-01-05 23:49:03 UTC (rev 210380)
+++ branches/safari-603-branch/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2017-01-05 23:49:08 UTC (rev 210381)
@@ -26,6 +26,7 @@
#import "config.h"
#import "TestController.h"
+#import "HIDEventGenerator.h"
#import "PlatformWebView.h"
#import "TestInvocation.h"
#import "TestRunnerWKWebView.h"
Modified: branches/safari-603-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (210380 => 210381)
--- branches/safari-603-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2017-01-05 23:49:03 UTC (rev 210380)
+++ branches/safari-603-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2017-01-05 23:49:08 UTC (rev 210381)
@@ -53,6 +53,12 @@
@"height": @(rect.size.height)
};
}
+
+void UIScriptController::checkForOutstandingCallbacks()
+{
+ if (![[HIDEventGenerator sharedHIDEventGenerator] checkForOutstandingCallbacks])
+ [NSException raise:@"WebKitTestRunnerTestProblem" format:@"The test completed before all synthesized events had been handled. Perhaps you're calling notifyDone() too early?"];
+}
void UIScriptController::doAsyncTask(JSValueRef callback)
{