WebKit Bugzilla
Attachment 356670 Details for
Bug 192437
: [Cocoa] Share ClassMethodSwizzler and InstanceMethodSwizzler between TestWebKitAPI and WebKitTestRunner
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192437-20181205155025.patch (text/plain), 48.04 KB, created by
Wenson Hsieh
on 2018-12-05 15:50:26 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Wenson Hsieh
Created:
2018-12-05 15:50:26 PST
Size:
48.04 KB
patch
obsolete
>Subversion Revision: 238904 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 1935499eddd5b105149e8cce90945d086a218602..5c095680cf84041f7a6acb5ce53953c3c26e4035 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,40 @@ >+2018-12-05 Wenson Hsieh <wenson_hsieh@apple.com> >+ >+ [Cocoa] Share ClassMethodSwizzler and InstanceMethodSwizzler between TestWebKitAPI and WebKitTestRunner >+ https://bugs.webkit.org/show_bug.cgi?id=192437 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: >+ * TestRunnerShared/cocoa/ClassMethodSwizzler.h: Renamed from Tools/TestWebKitAPI/ClassMethodSwizzler.h. >+ * TestRunnerShared/cocoa/ClassMethodSwizzler.mm: Renamed from Tools/TestWebKitAPI/ClassMethodSwizzler.mm. >+ (ClassMethodSwizzler::ClassMethodSwizzler): >+ (ClassMethodSwizzler::~ClassMethodSwizzler): >+ * TestRunnerShared/cocoa/InstanceMethodSwizzler.h: Renamed from Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.h. >+ * TestRunnerShared/cocoa/InstanceMethodSwizzler.mm: Renamed from Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.mm. >+ (InstanceMethodSwizzler::InstanceMethodSwizzler): >+ (InstanceMethodSwizzler::~InstanceMethodSwizzler): >+ >+ Move these swizzling helper classes into TestRunnerShared. >+ >+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: >+ * TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm: >+ * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm: >+ (safeBrowsingView): >+ * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDefaultNavigationDelegate.mm: >+ * TestWebKitAPI/cocoa/TestWKWebView.mm: >+ (-[TestWKWebView initWithFrame:configuration:addToWindow:]): >+ >+ Remove namespacing around ClassMethodSwizzler and InstanceMethodSwizzler in a few API tests. >+ >+ * WebKitTestRunner/TestController.h: >+ * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: >+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm: >+ (WTR::ClassMethodSwizzler::ClassMethodSwizzler): Deleted. >+ (WTR::ClassMethodSwizzler::~ClassMethodSwizzler): Deleted. >+ >+ Remove this duplicate implementation of ClassMethodSwizzler in WebKitTestRunner. >+ > 2018-12-05 Jonathan Bedard <jbedard@apple.com> > > webkitpy: Sort tests by associated device type >diff --git a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj >index 573aeee9789796ebbb681e12d1206e78f6818dd2..56701e9dd49491716f6ef33edfa313664a83de73 100644 >--- a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj >+++ b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj >@@ -147,6 +147,8 @@ > C23EA2081BC9F05100C980B7 /* FontWithFeatures.otf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = C23EA2061BC9EABA00C980B7 /* FontWithFeatures.otf */; }; > C23EA2091BC9F05100C980B7 /* FontWithFeatures.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = C23EA2071BC9EABA00C980B7 /* FontWithFeatures.ttf */; }; > E1B7816511AF31B7007E1BC2 /* MockGeolocationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */; }; >+ F44A531D21B89A4D00DBB99C /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531A21B89A4400DBB99C /* ClassMethodSwizzler.mm */; }; >+ F44A531E21B89A5000DBB99C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531C21B89A4500DBB99C /* InstanceMethodSwizzler.mm */; }; > F4C3578D20E8444E00FA0748 /* LayoutTestSpellChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4C3578820E8442700FA0748 /* LayoutTestSpellChecker.mm */; }; > F4D423611DD5048200678290 /* TextInputControllerIOS.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D4235F1DD5045300678290 /* TextInputControllerIOS.m */; }; > /* End PBXBuildFile section */ >@@ -409,6 +411,10 @@ > C23EA2071BC9EABA00C980B7 /* FontWithFeatures.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = FontWithFeatures.ttf; path = fonts/FontWithFeatures.ttf; sourceTree = "<group>"; }; > E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockGeolocationProvider.h; path = mac/MockGeolocationProvider.h; sourceTree = "<group>"; }; > E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MockGeolocationProvider.mm; path = mac/MockGeolocationProvider.mm; sourceTree = "<group>"; }; >+ F44A531921B89A4400DBB99C /* InstanceMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstanceMethodSwizzler.h; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.h; sourceTree = "<group>"; }; >+ F44A531A21B89A4400DBB99C /* ClassMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ClassMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.mm; sourceTree = "<group>"; }; >+ F44A531B21B89A4400DBB99C /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClassMethodSwizzler.h; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.h; sourceTree = "<group>"; }; >+ F44A531C21B89A4500DBB99C /* InstanceMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InstanceMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.mm; sourceTree = "<group>"; }; > F4C3578820E8442700FA0748 /* LayoutTestSpellChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LayoutTestSpellChecker.mm; path = ../TestRunnerShared/cocoa/LayoutTestSpellChecker.mm; sourceTree = "<group>"; }; > F4C3578920E8442700FA0748 /* LayoutTestSpellChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayoutTestSpellChecker.h; path = ../TestRunnerShared/cocoa/LayoutTestSpellChecker.h; sourceTree = "<group>"; }; > F4D4235F1DD5045300678290 /* TextInputControllerIOS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TextInputControllerIOS.m; path = ios/TextInputControllerIOS.m; sourceTree = "<group>"; }; >@@ -817,6 +823,10 @@ > F4B6C31820E84382008AC225 /* cocoa */ = { > isa = PBXGroup; > children = ( >+ F44A531B21B89A4400DBB99C /* ClassMethodSwizzler.h */, >+ F44A531A21B89A4400DBB99C /* ClassMethodSwizzler.mm */, >+ F44A531921B89A4400DBB99C /* InstanceMethodSwizzler.h */, >+ F44A531C21B89A4500DBB99C /* InstanceMethodSwizzler.mm */, > F4C3578920E8442700FA0748 /* LayoutTestSpellChecker.h */, > F4C3578820E8442700FA0748 /* LayoutTestSpellChecker.mm */, > ); >@@ -1075,6 +1085,7 @@ > AA5A15F016E15CD000F7C561 /* AccessibilityUIElementIOS.mm in Sources */, > BC0E26150E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm in Sources */, > BCA18B390C9B021900114369 /* AppleScriptController.m in Sources */, >+ F44A531D21B89A4D00DBB99C /* ClassMethodSwizzler.mm in Sources */, > 53CBB832134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp in Sources */, > 1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.m in Sources */, > BCA18C470C9B5B9400114369 /* DumpRenderTree.mm in Sources */, >@@ -1090,6 +1101,7 @@ > BCF6C6500C98E9C000AC063E /* GCController.cpp in Sources */, > BCA18B230C9B014B00114369 /* GCControllerMac.mm in Sources */, > 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */, >+ F44A531E21B89A5000DBB99C /* InstanceMethodSwizzler.mm in Sources */, > 312943F91E71F2B4001EE2CC /* IOSLayoutTestCommunication.cpp in Sources */, > 2CE88FA217124D8C00734FC0 /* JavaScriptThreading.cpp in Sources */, > 0F18E7061D6BA0230027E547 /* JSUIScriptController.cpp in Sources */, >diff --git a/Tools/TestRunnerShared/cocoa/ClassMethodSwizzler.h b/Tools/TestRunnerShared/cocoa/ClassMethodSwizzler.h >new file mode 100644 >index 0000000000000000000000000000000000000000..28db10a4799630c64c55d0786c00ee09489145e2 >--- /dev/null >+++ b/Tools/TestRunnerShared/cocoa/ClassMethodSwizzler.h >@@ -0,0 +1,39 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#pragma once >+ >+#include <objc/runtime.h> >+#include <wtf/Noncopyable.h> >+ >+class ClassMethodSwizzler { >+ WTF_MAKE_NONCOPYABLE(ClassMethodSwizzler); >+public: >+ ClassMethodSwizzler(Class, SEL, IMP); >+ ~ClassMethodSwizzler(); >+ >+ Method m_method; >+ IMP m_originalImplementation; >+}; >diff --git a/Tools/TestRunnerShared/cocoa/ClassMethodSwizzler.mm b/Tools/TestRunnerShared/cocoa/ClassMethodSwizzler.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..b2b9b0002ccb36378ab5c06c145bf96bb9edb76f >--- /dev/null >+++ b/Tools/TestRunnerShared/cocoa/ClassMethodSwizzler.mm >@@ -0,0 +1,38 @@ >+/* >+ * Copyright (C) 2018 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. >+ */ >+ >+#import "config.h" >+#import "ClassMethodSwizzler.h" >+ >+ClassMethodSwizzler::ClassMethodSwizzler(Class cls, SEL originalSelector, IMP implementation) >+ : m_method(class_getClassMethod(objc_getMetaClass(NSStringFromClass(cls).UTF8String), originalSelector)) >+ , m_originalImplementation(method_setImplementation(m_method, implementation)) >+{ >+} >+ >+ClassMethodSwizzler::~ClassMethodSwizzler() >+{ >+ method_setImplementation(m_method, m_originalImplementation); >+} >diff --git a/Tools/TestRunnerShared/cocoa/InstanceMethodSwizzler.h b/Tools/TestRunnerShared/cocoa/InstanceMethodSwizzler.h >new file mode 100644 >index 0000000000000000000000000000000000000000..b8a0b0b18d131ecc99b26a391c890f9f6c6c072e >--- /dev/null >+++ b/Tools/TestRunnerShared/cocoa/InstanceMethodSwizzler.h >@@ -0,0 +1,39 @@ >+/* >+ * Copyright (C) 2011-2018 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. >+ */ >+ >+#pragma once >+ >+#include <objc/runtime.h> >+#include <wtf/Noncopyable.h> >+ >+class InstanceMethodSwizzler { >+ WTF_MAKE_NONCOPYABLE(InstanceMethodSwizzler); >+public: >+ InstanceMethodSwizzler(Class, SEL, IMP); >+ ~InstanceMethodSwizzler(); >+ >+ Method m_method; >+ IMP m_originalImplementation; >+}; >diff --git a/Tools/TestRunnerShared/cocoa/InstanceMethodSwizzler.mm b/Tools/TestRunnerShared/cocoa/InstanceMethodSwizzler.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..32c461149612e0f7ea5d2ab4a3ff3c58957690c9 >--- /dev/null >+++ b/Tools/TestRunnerShared/cocoa/InstanceMethodSwizzler.mm >@@ -0,0 +1,38 @@ >+/* >+ * Copyright (C) 2011-2018 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. >+ */ >+ >+#include "config.h" >+#include "InstanceMethodSwizzler.h" >+ >+InstanceMethodSwizzler::InstanceMethodSwizzler(Class cls, SEL selector, IMP implementation) >+ : m_method(class_getInstanceMethod(cls, selector)) >+ , m_originalImplementation(method_setImplementation(m_method, implementation)) >+{ >+} >+ >+InstanceMethodSwizzler::~InstanceMethodSwizzler() >+{ >+ method_setImplementation(m_method, m_originalImplementation); >+} >diff --git a/Tools/TestWebKitAPI/ClassMethodSwizzler.h b/Tools/TestWebKitAPI/ClassMethodSwizzler.h >deleted file mode 100644 >index 6c52777877374c42dde533c122b5dbf7723c2fe2..0000000000000000000000000000000000000000 >--- a/Tools/TestWebKitAPI/ClassMethodSwizzler.h >+++ /dev/null >@@ -1,43 +0,0 @@ >-/* >- * Copyright (C) 2018 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. >- */ >- >-#pragma once >- >-#include <objc/runtime.h> >-#include <wtf/Noncopyable.h> >- >-namespace TestWebKitAPI { >- >-class ClassMethodSwizzler { >- WTF_MAKE_NONCOPYABLE(ClassMethodSwizzler); >-public: >- ClassMethodSwizzler(Class, SEL, IMP); >- ~ClassMethodSwizzler(); >- >- Method m_method; >- IMP m_originalImplementation; >-}; >- >-} // namespace TestWebKitAPI >diff --git a/Tools/TestWebKitAPI/ClassMethodSwizzler.mm b/Tools/TestWebKitAPI/ClassMethodSwizzler.mm >deleted file mode 100644 >index f4df73f9c1d89daaaa397c230619ee7c152b001e..0000000000000000000000000000000000000000 >--- a/Tools/TestWebKitAPI/ClassMethodSwizzler.mm >+++ /dev/null >@@ -1,42 +0,0 @@ >-/* >- * Copyright (C) 2018 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. >- */ >- >-#import "config.h" >-#import "ClassMethodSwizzler.h" >- >-namespace TestWebKitAPI { >- >-ClassMethodSwizzler::ClassMethodSwizzler(Class cls, SEL originalSelector, IMP implementation) >- : m_method(class_getClassMethod(objc_getMetaClass(NSStringFromClass(cls).UTF8String), originalSelector)) >- , m_originalImplementation(method_setImplementation(m_method, implementation)) >-{ >-} >- >-ClassMethodSwizzler::~ClassMethodSwizzler() >-{ >- method_setImplementation(m_method, m_originalImplementation); >-} >- >-} // namespace TestWebKitAPI >diff --git a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >index 6d7fa37d9ccef498e32838c0cd63715862b0449d..f2e14b8f73504213ae6876790128bc9a422ce723 100644 >--- a/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >+++ b/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >@@ -287,7 +287,6 @@ > 5C4A84951F7EEFFC00ACFC54 /* Configuration.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C4A84941F7EEFD400ACFC54 /* Configuration.mm */; }; > 5C69BDD51F82A7EF000F4F4B /* JavaScriptDuringNavigation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C69BDD41F82A7EB000F4F4B /* JavaScriptDuringNavigation.mm */; }; > 5C7148952123A40A00FDE3C5 /* WKWebsiteDatastore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C7148942123A40700FDE3C5 /* WKWebsiteDatastore.mm */; }; >- 5C726D6F1D3EE06E00C5E1A1 /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C726D6E1D3EE06800C5E1A1 /* InstanceMethodSwizzler.mm */; }; > 5C7964101EB0278D0075D74C /* EventModifiers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C79640F1EB0269B0075D74C /* EventModifiers.cpp */; }; > 5C7C74CB1FB529BA002F9ABE /* WebViewScheduleInRunLoop.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C7C74CA1FB528D4002F9ABE /* WebViewScheduleInRunLoop.mm */; }; > 5C838F7F1DB04F900082858F /* LoadInvalidURLRequest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 57901FAE1CAF137100ED64F9 /* LoadInvalidURLRequest.mm */; }; >@@ -828,6 +827,8 @@ > F43E3BC120DADBC500A4E7ED /* fixed-nav-bar.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F43E3BC020DADB8000A4E7ED /* fixed-nav-bar.html */; }; > F442851D2140DF2900CCDA22 /* NSFontPanelTesting.mm in Sources */ = {isa = PBXBuildFile; fileRef = F442851C2140DF2900CCDA22 /* NSFontPanelTesting.mm */; }; > F4451C761EB8FD890020C5DA /* two-paragraph-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4451C751EB8FD7C0020C5DA /* two-paragraph-contenteditable.html */; }; >+ F44A531121B8990300DBB99C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531021B8976900DBB99C /* InstanceMethodSwizzler.mm */; }; >+ F44A531221B8990A00DBB99C /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A530E21B8976900DBB99C /* ClassMethodSwizzler.mm */; }; > F44C79FF20F9E8710014478C /* ParserYieldTokenTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44C79FE20F9E8710014478C /* ParserYieldTokenTests.mm */; }; > F44C7A0020F9EEBF0014478C /* ParserYieldTokenPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */; }; > F44C7A0520FAAE3C0014478C /* text-with-deferred-script.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F44C7A0420FAAE320014478C /* text-with-deferred-script.html */; }; >@@ -837,7 +838,6 @@ > F45033F5206BEC95009351CE /* TextAutosizingBoost.mm in Sources */ = {isa = PBXBuildFile; fileRef = F45033F4206BEC95009351CE /* TextAutosizingBoost.mm */; }; > F4512E131F60C44600BB369E /* DataTransferItem-getAsEntry.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4512E121F60C43400BB369E /* DataTransferItem-getAsEntry.html */; }; > F4517B672054C49500C26721 /* TestWKWebViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4517B662054C49500C26721 /* TestWKWebViewController.mm */; }; >- F4517B7F2055101B00C26721 /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4517B692054E0AC00C26721 /* ClassMethodSwizzler.mm */; }; > F4538EF71E8473E600B5C953 /* large-red-square.png in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4538EF01E846B4100B5C953 /* large-red-square.png */; }; > F456AB1C213EDBA300CB2CEF /* FontManagerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F456AB1B213EDBA300CB2CEF /* FontManagerTests.mm */; }; > F457A9B8202D5CDC00F7E9D5 /* PasteMixedContent.mm in Sources */ = {isa = PBXBuildFile; fileRef = F457A9B6202D5CDC00F7E9D5 /* PasteMixedContent.mm */; }; >@@ -1630,8 +1630,6 @@ > 5C5E633D1D0B67940085A025 /* UniqueRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UniqueRef.cpp; sourceTree = "<group>"; }; > 5C69BDD41F82A7EB000F4F4B /* JavaScriptDuringNavigation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JavaScriptDuringNavigation.mm; sourceTree = "<group>"; }; > 5C7148942123A40700FDE3C5 /* WKWebsiteDatastore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebsiteDatastore.mm; sourceTree = "<group>"; }; >- 5C726D6D1D3EE06800C5E1A1 /* InstanceMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstanceMethodSwizzler.h; path = cocoa/InstanceMethodSwizzler.h; sourceTree = "<group>"; }; >- 5C726D6E1D3EE06800C5E1A1 /* InstanceMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InstanceMethodSwizzler.mm; path = cocoa/InstanceMethodSwizzler.mm; sourceTree = "<group>"; }; > 5C79640F1EB0269B0075D74C /* EventModifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventModifiers.cpp; sourceTree = "<group>"; }; > 5C7C74CA1FB528D4002F9ABE /* WebViewScheduleInRunLoop.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewScheduleInRunLoop.mm; sourceTree = "<group>"; }; > 5C8BC798218CF3E900813886 /* NetworkProcess.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkProcess.mm; sourceTree = "<group>"; }; >@@ -2125,6 +2123,10 @@ > F442851B2140DF2900CCDA22 /* NSFontPanelTesting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSFontPanelTesting.h; sourceTree = "<group>"; }; > F442851C2140DF2900CCDA22 /* NSFontPanelTesting.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NSFontPanelTesting.mm; sourceTree = "<group>"; }; > F4451C751EB8FD7C0020C5DA /* two-paragraph-contenteditable.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "two-paragraph-contenteditable.html"; sourceTree = "<group>"; }; >+ F44A530D21B8976900DBB99C /* InstanceMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstanceMethodSwizzler.h; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.h; sourceTree = "<group>"; }; >+ F44A530E21B8976900DBB99C /* ClassMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ClassMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.mm; sourceTree = "<group>"; }; >+ F44A530F21B8976900DBB99C /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClassMethodSwizzler.h; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.h; sourceTree = "<group>"; }; >+ F44A531021B8976900DBB99C /* InstanceMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InstanceMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.mm; sourceTree = "<group>"; }; > F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ParserYieldTokenPlugIn.mm; sourceTree = "<group>"; }; > F44C79FD20F9E8710014478C /* ParserYieldTokenTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParserYieldTokenTests.h; sourceTree = "<group>"; }; > F44C79FE20F9E8710014478C /* ParserYieldTokenTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ParserYieldTokenTests.mm; sourceTree = "<group>"; }; >@@ -2137,8 +2139,6 @@ > F4512E121F60C43400BB369E /* DataTransferItem-getAsEntry.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "DataTransferItem-getAsEntry.html"; sourceTree = "<group>"; }; > F4517B652054C49500C26721 /* TestWKWebViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestWKWebViewController.h; sourceTree = "<group>"; }; > F4517B662054C49500C26721 /* TestWKWebViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TestWKWebViewController.mm; sourceTree = "<group>"; }; >- F4517B682054E0AC00C26721 /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ClassMethodSwizzler.h; sourceTree = "<group>"; }; >- F4517B692054E0AC00C26721 /* ClassMethodSwizzler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ClassMethodSwizzler.mm; sourceTree = "<group>"; }; > F4538EF01E846B4100B5C953 /* large-red-square.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "large-red-square.png"; sourceTree = "<group>"; }; > F456AB1B213EDBA300CB2CEF /* FontManagerTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FontManagerTests.mm; sourceTree = "<group>"; }; > F457A9B3202D535300F7E9D5 /* DataTransfer.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DataTransfer.html; sourceTree = "<group>"; }; >@@ -2329,14 +2329,14 @@ > isa = PBXGroup; > children = ( > A13EBB441B87332B00097110 /* WebProcessPlugIn */, >- F4517B682054E0AC00C26721 /* ClassMethodSwizzler.h */, >- F4517B692054E0AC00C26721 /* ClassMethodSwizzler.mm */, >+ F44A530F21B8976900DBB99C /* ClassMethodSwizzler.h */, >+ F44A530E21B8976900DBB99C /* ClassMethodSwizzler.mm */, > F47DFB2721A885E700021FB6 /* DataDetectorsCoreSPI.h */, > F46128B4211C861A00D9FADB /* DragAndDropSimulator.h */, > F44D06481F3962E3001A0E29 /* EditingTestHarness.h */, > F44D06491F3962E3001A0E29 /* EditingTestHarness.mm */, >- 5C726D6D1D3EE06800C5E1A1 /* InstanceMethodSwizzler.h */, >- 5C726D6E1D3EE06800C5E1A1 /* InstanceMethodSwizzler.mm */, >+ F44A530D21B8976900DBB99C /* InstanceMethodSwizzler.h */, >+ F44A531021B8976900DBB99C /* InstanceMethodSwizzler.mm */, > 0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */, > 2D1C04A51D76298B000A6816 /* TestNavigationDelegate.h */, > 2D1C04A61D76298B000A6816 /* TestNavigationDelegate.mm */, >@@ -3844,7 +3844,7 @@ > 57303BCB2008376500355965 /* CBORReaderTest.cpp in Sources */, > 57303BC9200824D300355965 /* CBORValueTest.cpp in Sources */, > 57303BCA20082C0100355965 /* CBORWriterTest.cpp in Sources */, >- F4517B7F2055101B00C26721 /* ClassMethodSwizzler.mm in Sources */, >+ F44A531221B8990A00DBB99C /* ClassMethodSwizzler.mm in Sources */, > 7CCE7EE61A411AE600447C4C /* CloseFromWithinCreatePage.cpp in Sources */, > 7CCE7EB71A411A7E00447C4C /* CloseNewWindowInNavigationPolicyDelegate.mm in Sources */, > 7CCE7EE51A411AE600447C4C /* CloseThenTerminate.cpp in Sources */, >@@ -3987,8 +3987,8 @@ > 7CCE7EFD1A411AE600447C4C /* InjectedBundleInitializationUserDataCallbackWins.cpp in Sources */, > 7C83E0B81D0A64BD00FEBCF3 /* InjectedBundleMakeAllShadowRootsOpen.cpp in Sources */, > 7CCE7EC31A411A7E00447C4C /* InspectorBar.mm in Sources */, >+ F44A531121B8990300DBB99C /* InstanceMethodSwizzler.mm in Sources */, > 7CCE7EDA1A411A8700447C4C /* InstanceMethodSwizzler.mm in Sources */, >- 5C726D6F1D3EE06E00C5E1A1 /* InstanceMethodSwizzler.mm in Sources */, > 2DB0232F1E4E871800707123 /* InteractionDeadlockAfterCrash.mm in Sources */, > 7A909A811D877480007E10F8 /* IntPoint.cpp in Sources */, > 7A909A821D877480007E10F8 /* IntRect.cpp in Sources */, >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm >index 16abd60ed6429e4fa6623bbe696d28d0b1c2369a..b37c7cb2688a2a28a0f424f0208df35816a6d063 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm >@@ -130,7 +130,7 @@ TEST(WKWebView, ClearAppCache) > { > #if PLATFORM(IOS_FAMILY) > // On iOS, MobileSafari and webbookmarksd need to share the same AppCache directory. >- TestWebKitAPI::InstanceMethodSwizzler swizzle([NSBundle class], @selector(bundleIdentifier), reinterpret_cast<IMP>(swizzledBundleIdentifierWebBookmarksD)); >+ InstanceMethodSwizzler swizzle([NSBundle class], @selector(bundleIdentifier), reinterpret_cast<IMP>(swizzledBundleIdentifierWebBookmarksD)); > #endif > > // Start with a clean slate of WebsiteData. >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm >index fc2f9b094c0d5a3fb3792805dd38e668ec66ccc9..54284cb630469c4cf487325152ef63d9598d5f25 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm >@@ -145,7 +145,7 @@ static NSURL *resourceURL(NSString *resource) > > TEST(SafeBrowsing, Preference) > { >- TestWebKitAPI::ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]); >+ ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]); > > __block bool done = false; > auto delegate = adoptNS([TestNavigationDelegate new]); >@@ -168,7 +168,7 @@ TEST(SafeBrowsing, Preference) > > static RetainPtr<WKWebView> safeBrowsingView() > { >- TestWebKitAPI::ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]); >+ ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]); > > static auto delegate = adoptNS([SafeBrowsingNavigationDelegate new]); > auto webView = adoptNS([WKWebView new]); >@@ -269,7 +269,7 @@ @end > > TEST(SafeBrowsing, MissingFramework) > { >- TestWebKitAPI::ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [NullLookupContext methodForSelector:@selector(sharedLookupContext)]); >+ ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [NullLookupContext methodForSelector:@selector(sharedLookupContext)]); > auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)]); > [webView synchronouslyLoadTestPageNamed:@"simple"]; > } >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDefaultNavigationDelegate.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDefaultNavigationDelegate.mm >index 2a3068c0a6b049340e0ba0065cbbe6864d0c04ee..58c56cb83abc254f76125332c6c61dcbb091b01f 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDefaultNavigationDelegate.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDefaultNavigationDelegate.mm >@@ -45,7 +45,7 @@ static void newOpenURL(id self, SEL _cmd, NSURL* value) > > TEST(WKWebView, DefaultNavigationDelegate) > { >- TestWebKitAPI::InstanceMethodSwizzler swizzle([NSWorkspace class], @selector(openURL:), reinterpret_cast<IMP>(newOpenURL)); >+ InstanceMethodSwizzler swizzle([NSWorkspace class], @selector(openURL:), reinterpret_cast<IMP>(newOpenURL)); > > WKWebView *webView = [[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]; > >diff --git a/Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.h b/Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.h >deleted file mode 100644 >index fe31a8aa96e075da1d81de568c81515c0802b769..0000000000000000000000000000000000000000 >--- a/Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.h >+++ /dev/null >@@ -1,46 +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. >- */ >- >-#ifndef InstanceMethodSwizzler_h >-#define InstanceMethodSwizzler_h >- >-#include <objc/runtime.h> >-#include <wtf/Noncopyable.h> >- >-namespace TestWebKitAPI { >- >-class InstanceMethodSwizzler { >- WTF_MAKE_NONCOPYABLE(InstanceMethodSwizzler); >-public: >- InstanceMethodSwizzler(Class, SEL, IMP); >- ~InstanceMethodSwizzler(); >- >- Method m_method; >- IMP m_originalImplementation; >-}; >- >-} // namespace TestWebKitAPI >- >-#endif // InstanceMethodSwizzler_h >diff --git a/Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.mm b/Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.mm >deleted file mode 100644 >index 4c37da4b8dc50fb21f45c4f3f7d6f01737eaa0e9..0000000000000000000000000000000000000000 >--- a/Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.mm >+++ /dev/null >@@ -1,42 +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. >- */ >- >-#include "config.h" >-#include "InstanceMethodSwizzler.h" >- >-namespace TestWebKitAPI { >- >-InstanceMethodSwizzler::InstanceMethodSwizzler(Class cls, SEL selector, IMP implementation) >- : m_method(class_getInstanceMethod(cls, selector)) >- , m_originalImplementation(method_setImplementation(m_method, implementation)) >-{ >-} >- >-InstanceMethodSwizzler::~InstanceMethodSwizzler() >-{ >- method_setImplementation(m_method, m_originalImplementation); >-} >- >-} // namespace TestWebKitAPI >diff --git a/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm b/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm >index e8eadf86d3e83cfe8441f207bff443b19db9516e..54416bfa8197593b6224c5be66a89e52194d0153 100644 >--- a/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm >+++ b/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm >@@ -253,7 +253,7 @@ @implementation TestWKWebView { > RetainPtr<TestWKWebViewHostWindow> _hostWindow; > RetainPtr<TestMessageHandler> _testHandler; > #if PLATFORM(IOS_FAMILY) >- std::unique_ptr<TestWebKitAPI::ClassMethodSwizzler> _sharedCalloutBarSwizzler; >+ std::unique_ptr<ClassMethodSwizzler> _sharedCalloutBarSwizzler; > #endif > } > >@@ -288,7 +288,7 @@ - (instancetype)initWithFrame:(CGRect)frame configuration:(WKWebViewConfiguratio > > #if PLATFORM(IOS_FAMILY) > // FIXME: Remove this workaround once <https://webkit.org/b/175204> is fixed. >- _sharedCalloutBarSwizzler = std::make_unique<TestWebKitAPI::ClassMethodSwizzler>([UICalloutBar class], @selector(sharedCalloutBar), reinterpret_cast<IMP>(suppressUICalloutBar)); >+ _sharedCalloutBarSwizzler = std::make_unique<ClassMethodSwizzler>([UICalloutBar class], @selector(sharedCalloutBar), reinterpret_cast<IMP>(suppressUICalloutBar)); > #endif > > return self; >diff --git a/Tools/WebKitTestRunner/TestController.h b/Tools/WebKitTestRunner/TestController.h >index b3764e6ce4b02935841a83fa6c0a088f68edee55..1aa57154ca84fcca4347d47c93cf53724ca0b45b 100644 >--- a/Tools/WebKitTestRunner/TestController.h >+++ b/Tools/WebKitTestRunner/TestController.h >@@ -25,6 +25,7 @@ > > #pragma once > >+#include "ClassMethodSwizzler.h" > #include "GeolocationProviderMock.h" > #include "WebNotificationProvider.h" > #include "WorkQueueManager.h" >@@ -38,12 +39,6 @@ > #include <wtf/Vector.h> > #include <wtf/text/StringHash.h> > >-#if PLATFORM(COCOA) >- >-#include <objc/runtime.h> >- >-#endif >- > OBJC_CLASS NSString; > OBJC_CLASS WKWebViewConfiguration; > >@@ -56,19 +51,6 @@ class EventSenderProxy; > struct TestCommand; > struct TestOptions; > >-#if PLATFORM(COCOA) >-// FIXME: This should be shared with TestWebKitAPI. >-class ClassMethodSwizzler { >- WTF_MAKE_NONCOPYABLE(ClassMethodSwizzler); >-public: >- ClassMethodSwizzler(Class, SEL, IMP); >- ~ClassMethodSwizzler(); >- >- Method m_method; >- IMP m_originalImplementation; >-}; >-#endif // PLATFORM(COCOA) >- > class AsyncTask { > public: > AsyncTask(WTF::Function<void ()>&& task, WTF::Seconds timeout) >diff --git a/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj b/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj >index 64d6a0219f333cd6b7a05de67cc53c604b9eb9ab..a5b556bebe1181c9ff31271c2f033e33a65b4e73 100644 >--- a/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj >+++ b/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj >@@ -135,6 +135,8 @@ > E132AA3D17CE776F00611DF0 /* WebKitTestRunnerEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = E132AA3B17CE776F00611DF0 /* WebKitTestRunnerEvent.mm */; }; > E1C642C317CBCC7300D66A3C /* PoseAsClass.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */; }; > E1C642C617CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */; }; >+ F44A531721B899E200DBB99C /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531421B899DA00DBB99C /* ClassMethodSwizzler.mm */; }; >+ F44A531821B899E500DBB99C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531621B899DA00DBB99C /* InstanceMethodSwizzler.mm */; }; > F46240B1217013E500917B16 /* UIScriptControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46240AF2170128300917B16 /* UIScriptControllerCocoa.mm */; }; > F4C3578C20E8444600FA0748 /* LayoutTestSpellChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4C3578A20E8444000FA0748 /* LayoutTestSpellChecker.mm */; }; > /* End PBXBuildFile section */ >@@ -379,6 +381,10 @@ > E1C642C217CBCC7300D66A3C /* PoseAsClass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PoseAsClass.h; sourceTree = "<group>"; }; > E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitTestRunnerPasteboard.mm; sourceTree = "<group>"; }; > E1C642C517CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitTestRunnerPasteboard.h; sourceTree = "<group>"; }; >+ F44A531321B899DA00DBB99C /* InstanceMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstanceMethodSwizzler.h; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.h; sourceTree = "<group>"; }; >+ F44A531421B899DA00DBB99C /* ClassMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ClassMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.mm; sourceTree = "<group>"; }; >+ F44A531521B899DA00DBB99C /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClassMethodSwizzler.h; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.h; sourceTree = "<group>"; }; >+ F44A531621B899DA00DBB99C /* InstanceMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InstanceMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.mm; sourceTree = "<group>"; }; > F46240AF2170128300917B16 /* UIScriptControllerCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UIScriptControllerCocoa.mm; sourceTree = "<group>"; }; > F4C3578A20E8444000FA0748 /* LayoutTestSpellChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LayoutTestSpellChecker.mm; path = ../TestRunnerShared/cocoa/LayoutTestSpellChecker.mm; sourceTree = "<group>"; }; > F4C3578B20E8444000FA0748 /* LayoutTestSpellChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayoutTestSpellChecker.h; path = ../TestRunnerShared/cocoa/LayoutTestSpellChecker.h; sourceTree = "<group>"; }; >@@ -841,6 +847,10 @@ > F4B6C31620E84369008AC225 /* cocoa */ = { > isa = PBXGroup; > children = ( >+ F44A531521B899DA00DBB99C /* ClassMethodSwizzler.h */, >+ F44A531421B899DA00DBB99C /* ClassMethodSwizzler.mm */, >+ F44A531321B899DA00DBB99C /* InstanceMethodSwizzler.h */, >+ F44A531621B899DA00DBB99C /* InstanceMethodSwizzler.mm */, > F4C3578B20E8444000FA0748 /* LayoutTestSpellChecker.h */, > F4C3578A20E8444000FA0748 /* LayoutTestSpellChecker.mm */, > ); >@@ -1062,10 +1072,12 @@ > isa = PBXSourcesBuildPhase; > buildActionMask = 2147483647; > files = ( >+ F44A531721B899E200DBB99C /* ClassMethodSwizzler.mm in Sources */, > A185103A1B9AE0DA00744AEB /* CrashReporterInfo.mm in Sources */, > A185103E1B9AE12200744AEB /* CyclicRedundancyCheck.cpp in Sources */, > 2DD4C49B1D6E7D3B0007379C /* EventSerializerMac.mm in Sources */, > A185103F1B9AE12900744AEB /* GeolocationProviderMock.cpp in Sources */, >+ F44A531821B899E500DBB99C /* InstanceMethodSwizzler.mm in Sources */, > 31DA8A3D1E7205CC00E1DF2F /* IOSLayoutTestCommunication.cpp in Sources */, > 0F73B5511BA78968004B3EF4 /* JSUIScriptController.cpp in Sources */, > 0F18E7181D6BC4560027E547 /* JSWrapper.cpp in Sources */, >diff --git a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >index 2274270396bbe5e53b0b932526a8694d1c07cf45..69a4ac62ae165c35895bf07b216448ee2ee8a845 100644 >--- a/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >+++ b/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm >@@ -205,17 +205,6 @@ void TestController::platformRunUntil(bool& done, WTF::Seconds timeout) > [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:endDate]; > } > >-ClassMethodSwizzler::ClassMethodSwizzler(Class cls, SEL originalSelector, IMP implementation) >- : m_method(class_getClassMethod(objc_getMetaClass(NSStringFromClass(cls).UTF8String), originalSelector)) >- , m_originalImplementation(method_setImplementation(m_method, implementation)) >-{ >-} >- >-ClassMethodSwizzler::~ClassMethodSwizzler() >-{ >- method_setImplementation(m_method, m_originalImplementation); >-} >- > static NSCalendar *swizzledCalendar() > { > return [NSCalendar calendarWithIdentifier:TestController::singleton().getOverriddenCalendarIdentifier().get()];
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
thorton
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192437
: 356670 |
356672
|
356677