Changeset 266988 in webkit
- Timestamp:
- Sep 12, 2020 11:21:39 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r266984 r266988 1 2020-09-12 Darin Adler <darin@apple.com> 2 3 Send TestRendered event after running a test but before dumping 4 https://bugs.webkit.org/show_bug.cgi?id=216428 5 6 Reviewed by Sam Weinig. 7 8 * platform/gtk/TestExpectations: 9 * platform/mac/TestExpectations: 10 Unskip two tests that no longer time out since we are sending this event. 11 12 * platform/win/TestExpectations: 13 Add a failure expectation for a test that has a couple non-green pixels. 14 1 15 2020-09-12 Darin Adler <darin@apple.com> 2 16 -
trunk/LayoutTests/platform/gtk/TestExpectations
r266984 r266988 58 58 webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-ui/text-overflow-017.html [ Timeout ] 59 59 webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-values/vh_not_refreshing_on_chrome.html [ Timeout ] 60 webkit.org/b/186045 imported/w3c/web-platform-tests/html/semantics/forms/the-option-element/dynamic-content-change-rendering.html [ Timeout ]61 webkit.org/b/186045 imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/reset-algorithm-rendering.html [ Timeout ]62 63 60 64 61 # ResourceLoading -
trunk/LayoutTests/platform/mac/TestExpectations
r266955 r266988 2198 2198 webkit.org/b/186045 imported/w3c/web-platform-tests/css/css-values/vh_not_refreshing_on_chrome.html [ Skip ] 2199 2199 webkit.org/b/186045 imported/w3c/web-platform-tests/html/rendering/replaced-elements/embedded-content/cross-domain-iframe.sub.html [ Skip ] 2200 webkit.org/b/186045 imported/w3c/web-platform-tests/html/semantics/forms/the-option-element/dynamic-content-change-rendering.html [ Skip ]2201 webkit.org/b/186045 imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/reset-algorithm-rendering.html [ Skip ]2202 2200 2203 2201 #<rdar://63026283> [ macOS iOS ] media/modern-media-controls/playback-support/playback-support-autoplay.html is a flaky failure/timeout -
trunk/LayoutTests/platform/win/TestExpectations
r266978 r266988 4536 4536 4537 4537 webkit.org/b/215636 fast/text/emoji-gender-2-3.html [ ImageOnlyFailure ] 4538 webkit.org/b/215636 4539 webkit.org/b/215636 4540 webkit.org/b/215636 4541 webkit.org/b/215636 4542 webkit.org/b/215636 4543 webkit.org/b/215636 4544 4545 webkit.org/b/215636 4546 webkit.org/b/215636 4547 webkit.org/b/215636 4548 webkit.org/b/215636 4549 webkit.org/b/215636 4550 webkit.org/b/215636 4551 webkit.org/b/215636 4552 webkit.org/b/215636 4538 webkit.org/b/215636 fast/text/emoji-gender-2-4.html [ ImageOnlyFailure ] 4539 webkit.org/b/215636 fast/text/emoji-gender-2-5.html [ ImageOnlyFailure ] 4540 webkit.org/b/215636 fast/text/emoji-gender-2-6.html [ ImageOnlyFailure ] 4541 webkit.org/b/215636 fast/text/emoji-gender-2-7.html [ ImageOnlyFailure ] 4542 webkit.org/b/215636 fast/text/emoji-gender-2-8.html [ ImageOnlyFailure ] 4543 webkit.org/b/215636 fast/text/emoji-gender-2-9.html [ ImageOnlyFailure ] 4544 4545 webkit.org/b/215636 fast/text/emoji-gender-fe0f-3.html [ ImageOnlyFailure ] 4546 webkit.org/b/215636 fast/text/emoji-gender-fe0f-4.html [ ImageOnlyFailure ] 4547 webkit.org/b/215636 fast/text/emoji-gender-fe0f-5.html [ ImageOnlyFailure ] 4548 webkit.org/b/215636 fast/text/emoji-gender-fe0f-6.html [ ImageOnlyFailure ] 4549 webkit.org/b/215636 fast/text/emoji-gender-fe0f-7.html [ ImageOnlyFailure ] 4550 webkit.org/b/215636 fast/text/emoji-gender-fe0f-8.html [ ImageOnlyFailure ] 4551 webkit.org/b/215636 fast/text/emoji-gender-fe0f-9.html [ ImageOnlyFailure ] 4552 webkit.org/b/215636 fast/text/emoji-gender.html [ ImageOnlyFailure ] 4553 4553 4554 4554 webkit.org/b/215827 animations/steps-transform-rendering-updates.html [ Failure ] … … 4567 4567 # Emoji synthesis is only currently disabled on Cocoa platforms 4568 4568 fast/text/emoji-synthesis.html [ ImageOnlyFailure ] 4569 4570 # This test is basically passing, but off by a pixel or two. Not sure this is important enough to track with a bug. 4571 webanimations/accelerated-css-animation-with-easing.html [ Pass ImageOnlyFailure ] -
trunk/Tools/ChangeLog
r266984 r266988 1 2020-09-12 Darin Adler <darin@apple.com> 2 3 Send TestRendered event after running a test but before dumping 4 https://bugs.webkit.org/show_bug.cgi?id=216428 5 6 Reviewed by Sam Weinig. 7 8 * DumpRenderTree/CMakeLists.txt: Added the new files and directories. 9 * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: Ditto. 10 11 * DumpRenderTree/PlatformWin.cmake: Temporarily disable precompiled headers 12 on WinCairo since they were not working properly with JSBasics.cpp. 13 14 * DumpRenderTree/mac/FrameLoadDelegate.mm: 15 (-[FrameLoadDelegate readyToDumpState]): Added. Calls sendTestRenderedEvent. 16 (-[FrameLoadDelegate processWork:]): Call readyToDumpState. 17 (-[FrameLoadDelegate webView:locationChangeDone:forDataSource:]): Ditto. 18 19 * DumpRenderTree/win/FrameLoadDelegate.cpp: 20 (readyToDumpState): Added. Calls sendTestRenderedEvent. 21 (FrameLoadDelegate::processWork): Call readyToDumpState. 22 (FrameLoadDelegate::locationChangeDone): Ditto. 23 24 * TestRunnerShared/Bindings/JSBasics.cpp: Added. 25 (WTR::JSValueMakeBooleanOrNull): Moved from JSWrappable.h. 26 (WTR::JSValueToNullableBoolean): Ditto. 27 (WTR::JSValueMakeStringOrNull): Ditto. 28 (WTR::createJSString): Ditto. 29 (WTR::makeValue): Ditto. 30 (WTR::objectProperty): Ditto. 31 (WTR::setProperty): Added. Sets a named property value to a boolean. 32 (WTR::call): Moved from JSWrappable.h. 33 (WTR::callConstructor): Added. Gets a global constructor and calls it. 34 35 * TestRunnerShared/Bindings/JSBasics.h: Added. Declares the above functions. 36 37 * TestRunnerShared/Bindings/JSWrappable.h: 38 (WTR::JSValueMakeBooleanOrNull): Deleted. 39 (WTR::JSValueToNullableBoolean): Deleted. 40 (WTR::JSValueMakeStringOrNull): Deleted. 41 (WTR::createJSString): Deleted. 42 (WTR::makeValue): Deleted. 43 (WTR::objectProperty): Deleted. 44 (WTR::call): Deleted. 45 (WTR::hasRefTestWaitAttribute): Deleted. 46 47 * TestRunnerShared/Bindings/JSWrapper.h: Updated includes. 48 49 * TestRunnerShared/ReftestFunctions.cpp: Added. 50 (WTR::sendTestRenderedEvent): Added. Creates and dispatches a TestRendered event. 51 (WTR::hasReftestWaitAttribute): Moved from JSWrappable.h and renamed to use a 52 lowercase T since that's how web-platform-tests names things. 53 54 * TestRunnerShared/ReftestFunctions.h: Added. Declares the above functions. 55 56 * WebKitTestRunner/CMakeLists.txt: Added the new files and directories. 57 58 * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp: 59 (WTR::InjectedBundlePage::frameDidChangeLocation): Call sendTestRenderedEvent 60 before calling dumpAfterWaitAttributeIsRemoved. 61 62 * WebKitTestRunner/InjectedBundle/mac/AccessibilityTextMarkerMac.mm: Added a 63 missing include of "config.h" to fix build failures I was seeing. An alternative, 64 since this is a Cocoa-only source file, would be to put config.h into a 65 precompiled prefix header. 66 * WebKitTestRunner/InjectedBundle/mac/AccessibilityTextMarkerRangeMac.mm: Ditto. 67 68 * WebKitTestRunner/PlatformWin.cmake: Temporarily disable precompiled headers 69 on WinCairo since they were not working properly with JSBasics.cpp. 70 71 * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Added the new 72 files and directories. 73 1 74 2020-09-12 Darin Adler <darin@apple.com> 2 75 -
trunk/Tools/DumpRenderTree/CMakeLists.txt
r263979 r266988 7 7 8 8 set(DumpRenderTree_SOURCES 9 ${WebKitTestRunner_SHARED_DIR}/ReftestFunctions.cpp 10 ${WebKitTestRunner_SHARED_DIR}/Bindings/JSBasics.cpp 9 11 ${WebKitTestRunner_SHARED_DIR}/Bindings/JSWrapper.cpp 10 12 … … 35 37 ${DumpRenderTree_DERIVED_SOURCES_DIR} 36 38 ${DumpRenderTree_DIR} 39 ${WebKitTestRunner_SHARED_DIR} 37 40 ${WebKitTestRunner_SHARED_DIR}/Bindings 38 41 ${WebKitTestRunner_UISCRIPTCONTEXT_DIR} -
trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
r265271 r266988 112 112 80045AEE147718E7008290A8 /* AccessibilityNotificationHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 80045AEC147718E7008290A8 /* AccessibilityNotificationHandler.mm */; }; 113 113 8465E2C70FFA8DF2003B8342 /* PixelDumpSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8465E2C60FFA8DF2003B8342 /* PixelDumpSupport.cpp */; }; 114 93C78826250C6D3A00C0AA24 /* ReftestFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C78824250C6D3900C0AA24 /* ReftestFunctions.cpp */; }; 115 93C7882E250C717200C0AA24 /* JSBasics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C78829250C713400C0AA24 /* JSBasics.cpp */; }; 114 116 9830F31F15C81181005AB206 /* DumpRenderTreeCommon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */; }; 115 117 A1158D581892740C0088C17B /* DumpRenderTreeBrowserView.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1158D56189273EB0088C17B /* DumpRenderTreeBrowserView.mm */; }; … … 335 337 9335435F03D75502008635CE /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 336 338 9340995408540CAF007F3BC8 /* DumpRenderTree */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DumpRenderTree; sourceTree = BUILT_PRODUCTS_DIR; }; 339 93C78824250C6D3900C0AA24 /* ReftestFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReftestFunctions.cpp; sourceTree = "<group>"; }; 340 93C78825250C6D3900C0AA24 /* ReftestFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReftestFunctions.h; sourceTree = "<group>"; }; 341 93C78829250C713400C0AA24 /* JSBasics.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSBasics.cpp; sourceTree = "<group>"; }; 342 93C7882B250C713400C0AA24 /* JSBasics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSBasics.h; sourceTree = "<group>"; }; 337 343 9830F31E15C81181005AB206 /* DumpRenderTreeCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DumpRenderTreeCommon.cpp; sourceTree = "<group>"; }; 338 344 A1103B5B1892498F00738C87 /* LayoutTestHelper.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = LayoutTestHelper.xcconfig; path = mac/Configurations/LayoutTestHelper.xcconfig; sourceTree = "<group>"; }; … … 720 726 isa = PBXGroup; 721 727 children = ( 728 93C78828250C713400C0AA24 /* Bindings */, 722 729 F4B6C31820E84382008AC225 /* cocoa */, 723 730 F4FED31623581EF3003C139C /* mac */, … … 725 732 3148A0551E6F90F400D3B316 /* IOSLayoutTestCommunication.cpp */, 726 733 3148A0561E6F90F400D3B316 /* IOSLayoutTestCommunication.h */, 734 93C78824250C6D3900C0AA24 /* ReftestFunctions.cpp */, 735 93C78825250C6D3900C0AA24 /* ReftestFunctions.h */, 727 736 ); 728 737 name = TestRunnerShared; … … 767 776 ); 768 777 name = Resources; 778 sourceTree = "<group>"; 779 }; 780 93C78828250C713400C0AA24 /* Bindings */ = { 781 isa = PBXGroup; 782 children = ( 783 93C78829250C713400C0AA24 /* JSBasics.cpp */, 784 93C7882B250C713400C0AA24 /* JSBasics.h */, 785 ); 786 path = Bindings; 769 787 sourceTree = "<group>"; 770 788 }; … … 1216 1234 312943F91E71F2B4001EE2CC /* IOSLayoutTestCommunication.cpp in Sources */, 1217 1235 2CE88FA217124D8C00734FC0 /* JavaScriptThreading.cpp in Sources */, 1236 93C7882E250C717200C0AA24 /* JSBasics.cpp in Sources */, 1218 1237 0F18E7061D6BA0230027E547 /* JSUIScriptController.cpp in Sources */, 1219 1238 0F18E7131D6BC43A0027E547 /* JSWrapper.cpp in Sources */, … … 1232 1251 BCA18B660C9B08C200114369 /* PolicyDelegate.mm in Sources */, 1233 1252 F4010B7B24DA201F00A876E2 /* PoseAsClass.mm in Sources */, 1253 93C78826250C6D3A00C0AA24 /* ReftestFunctions.cpp in Sources */, 1234 1254 BCA18B680C9B08C200114369 /* ResourceLoadDelegate.mm in Sources */, 1235 1255 A30A21F82051D8C40008FF42 /* TestOptions.cpp in Sources */, -
trunk/Tools/DumpRenderTree/PlatformWin.cmake
r263759 r266988 73 73 endif () 74 74 75 WEBKIT_ADD_PRECOMPILED_HEADER("DumpRenderTreePrefix.h" "win/DumpRenderTreePrefix.cpp" DumpRenderTree_SOURCES) 75 if (NOT WTF_PLATFORM_WIN_CAIRO) 76 WEBKIT_ADD_PRECOMPILED_HEADER("DumpRenderTreePrefix.h" "win/DumpRenderTreePrefix.cpp" DumpRenderTree_SOURCES) 77 endif () 76 78 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MSVC_RUNTIME_LINKER_FLAGS}") 77 79 -
trunk/Tools/DumpRenderTree/mac/FrameLoadDelegate.mm
r266817 r266988 39 39 #import "ObjCPlugin.h" 40 40 #import "ObjCPluginFunction.h" 41 #import "ReftestFunctions.h" 41 42 #import "TestRunner.h" 42 43 #import "TextInputController.h" … … 142 143 WebThreadLock(); 143 144 #endif 144 145 if (WTR::hasRefTestWaitAttribute(mainFrame.globalContext)) 145 if (WTR::hasReftestWaitAttribute(mainFrame.globalContext)) 146 146 [self performSelector:@selector(dumpAfterWaitAttributeIsRemoved:) withObject:nil afterDelay:0]; 147 147 else … … 149 149 } 150 150 151 // Exec messages in the work queue until they're all done, or one of them starts a new load 151 - (void)readyToDumpState 152 { 153 #if PLATFORM(IOS_FAMILY) 154 WebThreadLock(); 155 #endif 156 WTR::sendTestRenderedEvent(mainFrame.globalContext); 157 [self dumpAfterWaitAttributeIsRemoved:nil]; 158 } 159 160 // Execute messages in the work queue until they're all done, or one of them starts a new load. 152 161 - (void)processWork:(id)dummy 153 162 { … … 159 168 WebThreadLock(); 160 169 #endif 161 162 // if we finish all the commands, we're ready to dump state 170 // If we finish all the commands, we're ready to dump state. 163 171 if (DRT::WorkQueue::singleton().processWork() && !gTestRunner->waitToDump()) 164 [self dumpAfterWaitAttributeIsRemoved:nil];172 [self readyToDumpState]; 165 173 } 166 174 … … 180 188 [self performSelector:@selector(processWork:) withObject:nil afterDelay:0]; 181 189 else 182 [self dumpAfterWaitAttributeIsRemoved:nil];190 [self readyToDumpState]; 183 191 } 184 192 } -
trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp
r266817 r266988 37 37 #include "GCController.h" 38 38 #include "JSWrapper.h" 39 #include "ReftestFunctions.h" 39 40 #include "TestRunner.h" 40 41 #include "TextInputController.h" … … 192 193 { 193 194 static UINT_PTR timerID; 194 if (frame && WTR::hasRef TestWaitAttribute(frame->globalContext())) {195 if (frame && WTR::hasReftestWaitAttribute(frame->globalContext())) { 195 196 if (!timerID) 196 197 timerID = ::SetTimer(nullptr, 0, 0, dumpAfterWaitAttributeIsRemoved); … … 204 205 } 205 206 207 static void readyToDumpState() 208 { 209 if (frame) 210 WTR::sendTestRenderedEvent(frame->globalContext()); 211 dumpAfterWaitAttributeIsRemoved(); 212 } 213 206 214 void FrameLoadDelegate::processWork() 207 215 { … … 212 220 // if we finish all the commands, we're ready to dump state 213 221 if (DRT::WorkQueue::singleton().processWork() && !::gTestRunner->waitToDump()) 214 dumpAfterWaitAttributeIsRemoved();222 readyToDumpState(); 215 223 } 216 224 … … 261 269 } 262 270 263 dumpAfterWaitAttributeIsRemoved();271 readyToDumpState(); 264 272 } 265 273 -
trunk/Tools/TestRunnerShared/Bindings/JSBasics.cpp
r266987 r266988 1 1 /* 2 * Copyright (C) 20 10 Apple Inc. All rights reserved.2 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 27 28 #include <JavaScriptCore/JSRetainPtr.h> 29 #include <JavaScriptCore/JavaScript.h> 30 #include <initializer_list> 31 #include <wtf/Optional.h> 32 #include <wtf/RefCounted.h> 26 #include "config.h" 27 #include "JSBasics.h" 33 28 34 29 namespace WTR { 35 30 36 class JSWrappable : public RefCounted<JSWrappable> { 37 public: 38 virtual ~JSWrappable() { } 39 virtual JSClassRef wrapperClass() = 0; 40 }; 41 42 inline JSValueRef JSValueMakeBooleanOrNull(JSContextRef context, Optional<bool> value) 31 JSValueRef JSValueMakeBooleanOrNull(JSContextRef context, Optional<bool> value) 43 32 { 44 33 return value ? JSValueMakeBoolean(context, value.value()) : JSValueMakeNull(context); 45 34 } 46 35 47 inlineOptional<bool> JSValueToNullableBoolean(JSContextRef context, JSValueRef value)36 Optional<bool> JSValueToNullableBoolean(JSContextRef context, JSValueRef value) 48 37 { 49 38 return JSValueIsUndefined(context, value) || JSValueIsNull(context, value) ? WTF::nullopt : Optional<bool>(JSValueToBoolean(context, value)); 50 39 } 51 40 52 inlineJSValueRef JSValueMakeStringOrNull(JSContextRef context, JSStringRef stringOrNull)41 JSValueRef JSValueMakeStringOrNull(JSContextRef context, JSStringRef stringOrNull) 53 42 { 54 43 return stringOrNull ? JSValueMakeString(context, stringOrNull) : JSValueMakeNull(context); 55 44 } 56 45 57 inlineJSRetainPtr<JSStringRef> createJSString(const char* string)46 JSRetainPtr<JSStringRef> createJSString(const char* string) 58 47 { 59 48 return adopt(JSStringCreateWithUTF8CString(string)); 60 49 } 61 50 62 inlineJSValueRef makeValue(JSContextRef context, const char* string)51 JSValueRef makeValue(JSContextRef context, const char* string) 63 52 { 64 53 return JSValueMakeString(context, createJSString(string).get()); 65 54 } 66 55 67 inlineJSObjectRef objectProperty(JSContextRef context, JSObjectRef object, const char* name)56 JSObjectRef objectProperty(JSContextRef context, JSObjectRef object, const char* name) 68 57 { 69 58 if (!object) … … 75 64 } 76 65 77 inlineJSObjectRef objectProperty(JSContextRef context, JSObjectRef object, std::initializer_list<const char*> names)66 JSObjectRef objectProperty(JSContextRef context, JSObjectRef object, std::initializer_list<const char*> names) 78 67 { 79 68 for (auto name : names) … … 82 71 } 83 72 84 inline JSValueRef call(JSContextRef context, JSObjectRef object, const char* name, std::initializer_list<JSValueRef> arguments) 73 void setProperty(JSContextRef context, JSObjectRef object, const char* name, bool value) 74 { 75 JSObjectSetProperty(context, object, createJSString(name).get(), JSValueMakeBoolean(context, value), kJSPropertyAttributeNone, nullptr); 76 } 77 78 JSValueRef call(JSContextRef context, JSObjectRef object, const char* name, std::initializer_list<JSValueRef> arguments) 85 79 { 86 80 if (!object) … … 92 86 } 93 87 94 // FIXME: Move this somewhere better. We want to share it, so it belongs in TestRunnerShared, but not as part of JSWrappable. 95 inline bool hasRefTestWaitAttribute(JSContextRef context) 88 JSObjectRef callConstructor(JSGlobalContextRef context, const char* name, std::initializer_list<JSValueRef> arguments) 96 89 { 97 if (!context)98 return false;99 auto classList = objectProperty(context, JSContextGetGlobalObject(context), { "document", "documentElement", "classList" });100 return JS ValueToBoolean(context, call(context, classList, "contains", { makeValue(context, "reftest-wait") }));90 auto constructor = objectProperty(context, JSContextGetGlobalObject(context), { name }); 91 if (!constructor) 92 return nullptr; 93 return JSObjectCallAsConstructor(context, constructor, arguments.size(), arguments.begin(), nullptr); 101 94 } 102 95 -
trunk/Tools/TestRunnerShared/Bindings/JSBasics.h
r266987 r266988 1 1 /* 2 * Copyright (C) 20 10 Apple Inc. All rights reserved.2 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "JSWrappable.h" 28 #include <JavaScriptCore/JSRetainPtr.h> 29 #include <JavaScriptCore/JavaScript.h> 30 #include <initializer_list> 31 #include <wtf/Optional.h> 29 32 30 33 namespace WTR { 31 34 32 // FIXME: If necessary, we can do wrapper caching here. 33 class JSWrapper { 34 public: 35 static JSValueRef wrap(JSContextRef, JSWrappable*); 36 static JSWrappable* unwrap(JSContextRef, JSValueRef); 35 JSValueRef JSValueMakeBooleanOrNull(JSContextRef, Optional<bool>); 36 Optional<bool> JSValueToNullableBoolean(JSContextRef, JSValueRef); 37 37 38 static void initialize(JSContextRef, JSObjectRef); 39 static void finalize(JSObjectRef); 40 }; 38 JSValueRef JSValueMakeStringOrNull(JSContextRef, JSStringRef); 41 39 42 inline JSValueRef toJS(JSContextRef context, JSWrappable* impl) 43 { 44 return JSWrapper::wrap(context, impl); 45 } 46 47 inline void setProperty(JSContextRef context, JSObjectRef object, const char* propertyName, JSWrappable* value, JSPropertyAttributes attributes, JSValueRef* exception) 48 { 49 JSObjectSetProperty(context, object, createJSString(propertyName).get(), JSWrapper::wrap(context, value), attributes, exception); 50 } 40 JSRetainPtr<JSStringRef> createJSString(const char*); 41 JSValueRef makeValue(JSContextRef, const char*); 42 JSObjectRef objectProperty(JSContextRef, JSObjectRef, const char* name); 43 JSObjectRef objectProperty(JSContextRef, JSObjectRef, std::initializer_list<const char*> names); 44 void setProperty(JSContextRef, JSObjectRef, const char* name, bool value); 45 JSValueRef call(JSContextRef, JSObjectRef, const char* name, std::initializer_list<JSValueRef> arguments); 46 JSObjectRef callConstructor(JSGlobalContextRef, const char* name, std::initializer_list<JSValueRef> arguments); 51 47 52 48 } // namespace WTR -
trunk/Tools/TestRunnerShared/Bindings/JSWrappable.h
r266817 r266988 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include <JavaScriptCore/JSRetainPtr.h>29 28 #include <JavaScriptCore/JavaScript.h> 30 #include <initializer_list>31 #include <wtf/Optional.h>32 29 #include <wtf/RefCounted.h> 33 30 … … 40 37 }; 41 38 42 inline JSValueRef JSValueMakeBooleanOrNull(JSContextRef context, Optional<bool> value)43 {44 return value ? JSValueMakeBoolean(context, value.value()) : JSValueMakeNull(context);45 }46 47 inline Optional<bool> JSValueToNullableBoolean(JSContextRef context, JSValueRef value)48 {49 return JSValueIsUndefined(context, value) || JSValueIsNull(context, value) ? WTF::nullopt : Optional<bool>(JSValueToBoolean(context, value));50 }51 52 inline JSValueRef JSValueMakeStringOrNull(JSContextRef context, JSStringRef stringOrNull)53 {54 return stringOrNull ? JSValueMakeString(context, stringOrNull) : JSValueMakeNull(context);55 }56 57 inline JSRetainPtr<JSStringRef> createJSString(const char* string)58 {59 return adopt(JSStringCreateWithUTF8CString(string));60 }61 62 inline JSValueRef makeValue(JSContextRef context, const char* string)63 {64 return JSValueMakeString(context, createJSString(string).get());65 }66 67 inline JSObjectRef objectProperty(JSContextRef context, JSObjectRef object, const char* name)68 {69 if (!object)70 return nullptr;71 auto value = JSObjectGetProperty(context, object, createJSString(name).get(), nullptr);72 if (!JSValueIsObject(context, value))73 return nullptr;74 return const_cast<JSObjectRef>(value);75 }76 77 inline JSObjectRef objectProperty(JSContextRef context, JSObjectRef object, std::initializer_list<const char*> names)78 {79 for (auto name : names)80 object = objectProperty(context, object, name);81 return object;82 }83 84 inline JSValueRef call(JSContextRef context, JSObjectRef object, const char* name, std::initializer_list<JSValueRef> arguments)85 {86 if (!object)87 return nullptr;88 auto function = objectProperty(context, object, name);89 if (!function)90 return nullptr;91 return JSObjectCallAsFunction(context, function, object, arguments.size(), arguments.begin(), nullptr);92 }93 94 // FIXME: Move this somewhere better. We want to share it, so it belongs in TestRunnerShared, but not as part of JSWrappable.95 inline bool hasRefTestWaitAttribute(JSContextRef context)96 {97 if (!context)98 return false;99 auto classList = objectProperty(context, JSContextGetGlobalObject(context), { "document", "documentElement", "classList" });100 return JSValueToBoolean(context, call(context, classList, "contains", { makeValue(context, "reftest-wait") }));101 }102 103 39 } // namespace WTR -
trunk/Tools/TestRunnerShared/Bindings/JSWrapper.h
r266817 r266988 26 26 #pragma once 27 27 28 #include "JSBasics.h" 28 29 #include "JSWrappable.h" 29 30 -
trunk/Tools/TestRunnerShared/ReftestFunctions.cpp
r266987 r266988 1 1 /* 2 * Copyright (C) 20 10 Apple Inc. All rights reserved.2 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #pragma once 26 #include "config.h" 27 #include "ReftestFunctions.h" 27 28 28 #include "JS Wrappable.h"29 #include "JSBasics.h" 29 30 30 31 namespace WTR { 31 32 32 // FIXME: If necessary, we can do wrapper caching here. 33 class JSWrapper { 34 public: 35 static JSValueRef wrap(JSContextRef, JSWrappable*); 36 static JSWrappable* unwrap(JSContextRef, JSValueRef); 37 38 static void initialize(JSContextRef, JSObjectRef); 39 static void finalize(JSObjectRef); 40 }; 41 42 inline JSValueRef toJS(JSContextRef context, JSWrappable* impl) 33 void sendTestRenderedEvent(JSGlobalContextRef context) 43 34 { 44 return JSWrapper::wrap(context, impl); 35 if (!context) 36 return; 37 auto initializer = JSObjectMake(context, nullptr, nullptr); 38 setProperty(context, initializer, "bubbles", true); 39 auto event = callConstructor(context, "Event", { makeValue(context, "TestRendered"), initializer }); 40 auto documentElement = objectProperty(context, JSContextGetGlobalObject(context), { "document", "documentElement" }); 41 call(context, documentElement, "dispatchEvent", { event }); 45 42 } 46 43 47 inline void setProperty(JSContextRef context, JSObjectRef object, const char* propertyName, JSWrappable* value, JSPropertyAttributes attributes, JSValueRef* exception)44 bool hasReftestWaitAttribute(JSGlobalContextRef context) 48 45 { 49 JSObjectSetProperty(context, object, createJSString(propertyName).get(), JSWrapper::wrap(context, value), attributes, exception); 46 if (!context) 47 return false; 48 auto classList = objectProperty(context, JSContextGetGlobalObject(context), { "document", "documentElement", "classList" }); 49 return JSValueToBoolean(context, call(context, classList, "contains", { makeValue(context, "reftest-wait") })); 50 50 } 51 51 52 } // namespace WTR52 } -
trunk/Tools/TestRunnerShared/ReftestFunctions.h
r266987 r266988 1 1 /* 2 * Copyright (C) 20 10 Apple Inc. All rights reserved.2 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "JSWrappable.h" 28 typedef struct OpaqueJSContext* JSGlobalContextRef; 29 29 30 30 namespace WTR { 31 31 32 // FIXME: If necessary, we can do wrapper caching here. 33 class JSWrapper { 34 public: 35 static JSValueRef wrap(JSContextRef, JSWrappable*); 36 static JSWrappable* unwrap(JSContextRef, JSValueRef); 32 void sendTestRenderedEvent(JSGlobalContextRef); 33 bool hasReftestWaitAttribute(JSGlobalContextRef); 37 34 38 static void initialize(JSContextRef, JSObjectRef);39 static void finalize(JSObjectRef);40 };41 42 inline JSValueRef toJS(JSContextRef context, JSWrappable* impl)43 {44 return JSWrapper::wrap(context, impl);45 35 } 46 47 inline void setProperty(JSContextRef context, JSObjectRef object, const char* propertyName, JSWrappable* value, JSPropertyAttributes attributes, JSValueRef* exception)48 {49 JSObjectSetProperty(context, object, createJSString(propertyName).get(), JSWrapper::wrap(context, value), attributes, exception);50 }51 52 } // namespace WTR -
trunk/Tools/WebKitTestRunner/CMakeLists.txt
r263979 r266988 8 8 9 9 set(WebKitTestRunner_SOURCES 10 ${WebKitTestRunner_BINDINGS_DIR}/JSBasics.cpp 10 11 ${WebKitTestRunner_BINDINGS_DIR}/JSWrapper.cpp 11 12 … … 48 49 49 50 set(WebKitTestRunnerInjectedBundle_SOURCES 51 ${WebKitTestRunner_SHARED_DIR}/ReftestFunctions.cpp 52 53 ${WebKitTestRunner_BINDINGS_DIR}/JSBasics.cpp 50 54 ${WebKitTestRunner_BINDINGS_DIR}/JSWrapper.cpp 51 55 … … 65 69 set(WebKitTestRunnerInjectedBundle_INCLUDE_DIRECTORIES 66 70 ${CMAKE_BINARY_DIR} 71 ${WebKitTestRunner_SHARED_DIR} 67 72 ${WebKitTestRunner_BINDINGS_DIR} 68 73 ${WebKitTestRunner_DERIVED_SOURCES_DIR}/InjectedBundle -
trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
r266984 r266988 1 1 /* 2 * Copyright (C) 2010-20 16Apple Inc. All rights reserved.2 * Copyright (C) 2010-2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #include "ActivateFonts.h" 30 30 #include "InjectedBundle.h" 31 #include "ReftestFunctions.h" 31 32 #include "StringFunctions.h" 32 33 #include "WebCoreTestSupport.h" … … 1956 1957 #endif 1957 1958 1958 static bool hasRef TestWaitAttribute(WKBundlePageRef page)1959 static bool hasReftestWaitAttribute(WKBundlePageRef page) 1959 1960 { 1960 1961 auto frame = WKBundlePageGetMainFrame(page); 1961 return frame && hasRef TestWaitAttribute(WKBundleFrameGetJavaScriptContext(frame));1962 return frame && hasReftestWaitAttribute(WKBundleFrameGetJavaScriptContext(frame)); 1962 1963 } 1963 1964 1964 1965 static void dumpAfterWaitAttributeIsRemoved(WKBundlePageRef page) 1965 1966 { 1966 if (hasRef TestWaitAttribute(page)) {1967 if (hasReftestWaitAttribute(page)) { 1967 1968 WKRetain(page); 1968 1969 // Use a 1ms interval between tries to allow lower priority run loop sources with zero delays to run. … … 2005 2006 } 2006 2007 2008 if (auto frame = WKBundlePageGetMainFrame(page->page())) 2009 sendTestRenderedEvent(WKBundleFrameGetJavaScriptContext(frame)); 2007 2010 dumpAfterWaitAttributeIsRemoved(page->page()); 2008 2011 } -
trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityTextMarkerMac.mm
r259843 r266988 24 24 */ 25 25 26 #import "config.h" 26 27 #import "AccessibilityTextMarker.h" 27 28 -
trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityTextMarkerRangeMac.mm
r232452 r266988 24 24 */ 25 25 26 #import "config.h" 26 27 #import "AccessibilityTextMarkerRange.h" 27 28 -
trunk/Tools/WebKitTestRunner/PlatformWin.cmake
r260539 r266988 40 40 # header, and add it back to work around this. 41 41 list(REMOVE_ITEM WebKitTestRunner_SOURCES ${WebKitTestRunner_BINDINGS_DIR}/JSWrapper.cpp) 42 WEBKIT_ADD_PRECOMPILED_HEADER("WebKitTestRunnerPrefix.h" "win/WebKitTestRunnerPrefix.cpp" WebKitTestRunner_SOURCES) 42 if (NOT WTF_PLATFORM_WIN_CAIRO) 43 WEBKIT_ADD_PRECOMPILED_HEADER("WebKitTestRunnerPrefix.h" "win/WebKitTestRunnerPrefix.cpp" WebKitTestRunner_SOURCES) 44 endif () 43 45 list(APPEND WebKitTestRunner_SOURCES ${WebKitTestRunner_BINDINGS_DIR}/JSWrapper.cpp) 44 46 -
trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
r266342 r266988 123 123 8097338A14874A5A008156D9 /* AccessibilityNotificationHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8097338914874A5A008156D9 /* AccessibilityNotificationHandler.mm */; }; 124 124 9376417A210D737200A3DAAE /* WebKitTestRunnerWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93764176210D736000A3DAAE /* WebKitTestRunnerWindow.mm */; }; 125 93C78823250C6C2E00C0AA24 /* ReftestFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C7881F250C69E400C0AA24 /* ReftestFunctions.cpp */; }; 126 93C78831250C719F00C0AA24 /* JSBasics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C78830250C719900C0AA24 /* JSBasics.cpp */; }; 127 93C78832250C71B700C0AA24 /* JSBasics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C78830250C719900C0AA24 /* JSBasics.cpp */; }; 125 128 A185103A1B9AE0DA00744AEB /* CrashReporterInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FEB90A31905BC6A000FDBF3 /* CrashReporterInfo.mm */; }; 126 129 A185103B1B9AE0E200744AEB /* TestControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DCE2CD11B84524500C7F832 /* TestControllerCocoa.mm */; }; … … 353 356 93764176210D736000A3DAAE /* WebKitTestRunnerWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitTestRunnerWindow.mm; sourceTree = "<group>"; }; 354 357 93764177210D736100A3DAAE /* WebKitTestRunnerWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitTestRunnerWindow.h; sourceTree = "<group>"; }; 358 93C7881F250C69E400C0AA24 /* ReftestFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ReftestFunctions.cpp; path = ../TestRunnerShared/ReftestFunctions.cpp; sourceTree = "<group>"; }; 359 93C78820250C69E400C0AA24 /* ReftestFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ReftestFunctions.h; path = ../TestRunnerShared/ReftestFunctions.h; sourceTree = "<group>"; }; 360 93C7882F250C719900C0AA24 /* JSBasics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = JSBasics.h; path = ../TestRunnerShared/Bindings/JSBasics.h; sourceTree = "<group>"; }; 361 93C78830250C719900C0AA24 /* JSBasics.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = JSBasics.cpp; path = ../TestRunnerShared/Bindings/JSBasics.cpp; sourceTree = "<group>"; }; 355 362 9B0D132E2036D346008FC8FB /* WebKitTestRunnerApp-iOS.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "WebKitTestRunnerApp-iOS.entitlements"; sourceTree = "<group>"; }; 356 363 9B36A270209453A0003E0651 /* WhatToDump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WhatToDump.h; sourceTree = "<group>"; }; … … 537 544 3148A0531E6F85B600D3B316 /* IOSLayoutTestCommunication.cpp */, 538 545 3148A0541E6F85B600D3B316 /* IOSLayoutTestCommunication.h */, 546 93C7881F250C69E400C0AA24 /* ReftestFunctions.cpp */, 547 93C78820250C69E400C0AA24 /* ReftestFunctions.h */, 539 548 ); 540 549 name = TestRunnerShared; … … 544 553 isa = PBXGroup; 545 554 children = ( 555 93C78830250C719900C0AA24 /* JSBasics.cpp */, 556 93C7882F250C719900C0AA24 /* JSBasics.h */, 546 557 0F18E7141D6BC4560027E547 /* JSWrappable.h */, 547 558 0F18E7151D6BC4560027E547 /* JSWrapper.cpp */, … … 1185 1196 F44A531821B899E500DBB99C /* InstanceMethodSwizzler.mm in Sources */, 1186 1197 31DA8A3D1E7205CC00E1DF2F /* IOSLayoutTestCommunication.cpp in Sources */, 1198 93C78832250C71B700C0AA24 /* JSBasics.cpp in Sources */, 1187 1199 0F73B5511BA78968004B3EF4 /* JSUIScriptController.cpp in Sources */, 1188 1200 0F18E7181D6BC4560027E547 /* JSWrapper.cpp in Sources */, … … 1242 1254 29A8FCDD145F0337009045A6 /* JSAccessibilityTextMarkerRange.cpp in Sources */, 1243 1255 29210EE1144CDB2600835BB5 /* JSAccessibilityUIElement.cpp in Sources */, 1256 93C78831250C719F00C0AA24 /* JSBasics.cpp in Sources */, 1244 1257 BC8FD8D2120E545B00F3E71A /* JSEventSendingController.cpp in Sources */, 1245 1258 BC14E4EA120E03D800826C0C /* JSGCController.cpp in Sources */, … … 1247 1260 5641E2D014335E95008307E5 /* JSTextInputController.cpp in Sources */, 1248 1261 0F6E89031D6BC5A2008ED0FA /* JSWrapper.cpp in Sources */, 1262 93C78823250C6C2E00C0AA24 /* ReftestFunctions.cpp in Sources */, 1249 1263 2E63EDA61891BDC0002A7AFC /* TestRunner.cpp in Sources */, 1250 1264 C0CE720B1247C93300BC0EC4 /* TestRunnerMac.mm in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.