From 17a3435cbaee02c3147f011d407a30e21dcb147e Mon Sep 17 00:00:00 2001 From: Albert Wang Date: Mon, 31 Aug 2020 13:55:57 -0700 Subject: [PATCH] Rename EDOBlacklistedType to EDOBlockedType per go/respectful-code. PiperOrigin-RevId: 329372445 --- CHANGELOG.md | 2 +- ...OBlacklistedType.h => NSObject+EDOBlockedType.h} | 12 ++++++------ ...OBlacklistedType.m => NSObject+EDOBlockedType.m} | 4 ++-- Service/Tests/FunctionalTests/EDOServiceUITest.m | 9 ++++----- Service/Tests/FunctionalTests/EDOTestDummyInTest.h | 4 ++-- Service/Tests/FunctionalTests/EDOTestDummyInTest.m | 4 ++-- eDistantObject.podspec | 2 +- eDistantObject.xcodeproj/project.pbxproj | 13 ++++++------- 8 files changed, 24 insertions(+), 26 deletions(-) rename Service/Sources/{NSObject+EDOBlacklistedType.h => NSObject+EDOBlockedType.h} (71%) rename Service/Sources/{NSObject+EDOBlacklistedType.m => NSObject+EDOBlockedType.m} (95%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40b88e4..bec4a8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ Updates: traces of both the callee process and previous caller processes. * You can - [block](https://github.com/google/eDistantObject/blob/master/Service/Sources/NSObject%2BEDOBlacklistedType.h#L38) + [block](https://github.com/google/eDistantObject/blob/master/Service/Sources/NSObject%2BEDOBlockedType.h#L38) certain class type to be wrapped as an eDO proxy, to help detect unexpected object creation in the wrong process. diff --git a/Service/Sources/NSObject+EDOBlacklistedType.h b/Service/Sources/NSObject+EDOBlockedType.h similarity index 71% rename from Service/Sources/NSObject+EDOBlacklistedType.h rename to Service/Sources/NSObject+EDOBlockedType.h index e071eda..de32ee3 100644 --- a/Service/Sources/NSObject+EDOBlacklistedType.h +++ b/Service/Sources/NSObject+EDOBlockedType.h @@ -19,25 +19,25 @@ NS_ASSUME_NONNULL_BEGIN /** - * This category provides APIs to statically blacklist a class to be used in remote invocation. + * This category provides APIs to statically block a class to be used in remote invocation. * * It provides a way to prevent certain types of instances being created in the wrong process * and sent to system APIs as a remote object. For example, iOS app cannot add a remote UIView - * as the subview of another native UIView. If a type is blacklisted in remote invocation, + * as the subview of another native UIView. If a type is blocked in remote invocation, * its instance, which is created in this process by mistake, will throw an exception when it * appears in a remote invocation. */ -@interface NSObject (EDOBlacklistedType) +@interface NSObject (EDOBlockedType) /** - * Blacklists this type to be a parameter of remote invocation. + * Blocks this type to be a parameter of remote invocation. * - * If a class is blacklisted, its instances are not allowed to be either parameters or return + * If a class is blocked, its instances are not allowed to be either parameters or return * values in remote invocation. */ + (void)edo_disallowRemoteInvocation; -/** The boolean to indicate if @c self is blacklisted in remote invocation. */ +/** The boolean to indicate if @c self is blocked in remote invocation. */ @property(readonly, class) BOOL edo_remoteInvocationDisallowed; @end diff --git a/Service/Sources/NSObject+EDOBlacklistedType.m b/Service/Sources/NSObject+EDOBlockedType.m similarity index 95% rename from Service/Sources/NSObject+EDOBlacklistedType.m rename to Service/Sources/NSObject+EDOBlockedType.m index 0a708e4..482dcfb 100644 --- a/Service/Sources/NSObject+EDOBlacklistedType.m +++ b/Service/Sources/NSObject+EDOBlockedType.m @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#import "Service/Sources/NSObject+EDOBlacklistedType.h" +#import "Service/Sources/NSObject+EDOBlockedType.h" #include @@ -23,7 +23,7 @@ #import "Service/Sources/EDOServiceException.h" #import "Service/Sources/NSObject+EDOParameter.h" -@implementation NSObject (EDOBlacklistedType) +@implementation NSObject (EDOBlockedType) + (void)edo_disallowRemoteInvocation { @synchronized(self.class) { diff --git a/Service/Tests/FunctionalTests/EDOServiceUITest.m b/Service/Tests/FunctionalTests/EDOServiceUITest.m index 838dbf9..10d3484 100644 --- a/Service/Tests/FunctionalTests/EDOServiceUITest.m +++ b/Service/Tests/FunctionalTests/EDOServiceUITest.m @@ -26,7 +26,7 @@ #import "Service/Sources/EDOHostService.h" #import "Service/Sources/EDORemoteException.h" #import "Service/Sources/EDOServiceError.h" -#import "Service/Sources/NSObject+EDOBlacklistedType.h" +#import "Service/Sources/NSObject+EDOBlockedType.h" #import "Service/Sources/NSObject+EDOValueObject.h" #import "Service/Tests/FunctionalTests/EDOTestDummyInTest.h" #import "Service/Tests/TestsBundle/EDOTestClassDummy.h" @@ -116,10 +116,9 @@ - (void)testProtocolParameter { NSInternalInconsistencyException); } -- (void)testBlacklistedParameter { +- (void)testBlockedParameter { [self launchApplicationWithPort:EDOTEST_APP_SERVICE_PORT initValue:0]; - EDOBlacklistedTestDummyInTest *testDummy = - [[EDOBlacklistedTestDummyInTest alloc] initWithValue:0]; + EDOBlockedTestDummyInTest *testDummy = [[EDOBlockedTestDummyInTest alloc] initWithValue:0]; EDOHostService *service = [EDOHostService serviceWithPort:2234 rootObject:testDummy queue:dispatch_get_main_queue()]; @@ -128,7 +127,7 @@ - (void)testBlacklistedParameter { XCTAssertNoThrow([remoteDummy callBackToTest:testDummy withValue:0]); XCTAssertNoThrow([remoteDummy createEDOWithPort:2234]); XCTAssertNoThrow([remoteDummy selWithInOutEDO:&testDummy]); - [EDOBlacklistedTestDummyInTest edo_disallowRemoteInvocation]; + [EDOBlockedTestDummyInTest edo_disallowRemoteInvocation]; XCTAssertThrows([remoteDummy callBackToTest:testDummy withValue:0]); XCTAssertThrows([remoteDummy createEDOWithPort:2234]); XCTAssertThrows([remoteDummy selWithInOutEDO:&testDummy]); diff --git a/Service/Tests/FunctionalTests/EDOTestDummyInTest.h b/Service/Tests/FunctionalTests/EDOTestDummyInTest.h index 81576d3..286492e 100644 --- a/Service/Tests/FunctionalTests/EDOTestDummyInTest.h +++ b/Service/Tests/FunctionalTests/EDOTestDummyInTest.h @@ -39,6 +39,6 @@ + (NSException *)exceptionWithReason:(NSString *)reason value:(int)value; @end -/** The test dummy class that is used in blacklisting test. */ -@interface EDOBlacklistedTestDummyInTest : EDOTestDummyInTest +/** The test dummy class that is used in blocklist test. */ +@interface EDOBlockedTestDummyInTest : EDOTestDummyInTest @end diff --git a/Service/Tests/FunctionalTests/EDOTestDummyInTest.m b/Service/Tests/FunctionalTests/EDOTestDummyInTest.m index 7cda99a..4f670cf 100644 --- a/Service/Tests/FunctionalTests/EDOTestDummyInTest.m +++ b/Service/Tests/FunctionalTests/EDOTestDummyInTest.m @@ -68,10 +68,10 @@ - (void)invokeBlock { @end -@implementation EDOBlacklistedTestDummyInTest +@implementation EDOBlockedTestDummyInTest - (EDOTestDummyInTest *)makeAnotherDummy:(int)value { - return [[EDOBlacklistedTestDummyInTest alloc] initWithValue:0]; + return [[EDOBlockedTestDummyInTest alloc] initWithValue:0]; } @end diff --git a/eDistantObject.podspec b/eDistantObject.podspec index 98baf58..d0f5489 100644 --- a/eDistantObject.podspec +++ b/eDistantObject.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| Service/Sources/EDOServiceError.h Service/Sources/EDOServiceException.h Service/Sources/EDOServicePort.h - Service/Sources/NSObject+EDOBlacklistedType.h + Service/Sources/NSObject+EDOBlockedType.h Service/Sources/NSObject+EDOValueObject.h Service/Sources/NSObject+EDOWeakObject.h Device/Sources/EDODeviceConnector.h diff --git a/eDistantObject.xcodeproj/project.pbxproj b/eDistantObject.xcodeproj/project.pbxproj index f8c1f57..f0103f8 100644 --- a/eDistantObject.xcodeproj/project.pbxproj +++ b/eDistantObject.xcodeproj/project.pbxproj @@ -7,9 +7,8 @@ objects = { /* Begin PBXBuildFile section */ - 7674100E237E01FB00D43A15 /* EDOExecutorMessageTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7674100D237E01FB00D43A15 /* EDOExecutorMessageTest.m */; }; + 7657C22224F9BEA70056F5A6 /* NSObject+EDOBlockedType.m in Sources */ = {isa = PBXBuildFile; fileRef = 7657C22124F9BEA70056F5A6 /* NSObject+EDOBlockedType.m */; }; 7685673323A1C10200EDBDB4 /* EDORemoteException.m in Sources */ = {isa = PBXBuildFile; fileRef = 7685673123A1C10100EDBDB4 /* EDORemoteException.m */; }; - 7690BE9423A9CCBD00C00D02 /* NSObject+EDOBlacklistedType.m in Sources */ = {isa = PBXBuildFile; fileRef = 7690BE9323A9CCBD00C00D02 /* NSObject+EDOBlacklistedType.m */; }; C52D85962220C4AB00E86E60 /* EDODeviceChannel.m in Sources */ = {isa = PBXBuildFile; fileRef = C52D857A2220ADBD00E86E60 /* EDODeviceChannel.m */; }; C52D85982220C4AB00E86E60 /* EDODeviceConnector.m in Sources */ = {isa = PBXBuildFile; fileRef = C52D857D2220ADBE00E86E60 /* EDODeviceConnector.m */; }; C52D859A2220C4AB00E86E60 /* EDODeviceDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = C52D85782220ADBC00E86E60 /* EDODeviceDetector.m */; }; @@ -231,12 +230,12 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 7657C22024F9BEA70056F5A6 /* NSObject+EDOBlockedType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSObject+EDOBlockedType.h"; path = "Service/Sources/NSObject+EDOBlockedType.h"; sourceTree = ""; }; + 7657C22124F9BEA70056F5A6 /* NSObject+EDOBlockedType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSObject+EDOBlockedType.m"; path = "Service/Sources/NSObject+EDOBlockedType.m"; sourceTree = ""; }; 7674100D237E01FB00D43A15 /* EDOExecutorMessageTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EDOExecutorMessageTest.m; path = Service/Tests/UnitTests/EDOExecutorMessageTest.m; sourceTree = ""; }; 7685673123A1C10100EDBDB4 /* EDORemoteException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EDORemoteException.m; path = Service/Sources/EDORemoteException.m; sourceTree = ""; }; 7685673223A1C10100EDBDB4 /* EDORemoteException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EDORemoteException.h; path = Service/Sources/EDORemoteException.h; sourceTree = ""; }; 7685673423A1C11F00EDBDB4 /* EDORemoteExceptionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EDORemoteExceptionTest.m; path = Service/Tests/UnitTests/EDORemoteExceptionTest.m; sourceTree = ""; }; - 7690BE9223A9CCBC00C00D02 /* NSObject+EDOBlacklistedType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSObject+EDOBlacklistedType.h"; path = "Service/Sources/NSObject+EDOBlacklistedType.h"; sourceTree = ""; }; - 7690BE9323A9CCBD00C00D02 /* NSObject+EDOBlacklistedType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSObject+EDOBlacklistedType.m"; path = "Service/Sources/NSObject+EDOBlacklistedType.m"; sourceTree = ""; }; C52D85772220ADBB00E86E60 /* EDODeviceDetector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = EDODeviceDetector.h; path = Device/Sources/EDODeviceDetector.h; sourceTree = ""; }; C52D85782220ADBC00E86E60 /* EDODeviceDetector.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = EDODeviceDetector.m; path = Device/Sources/EDODeviceDetector.m; sourceTree = ""; }; C52D85792220ADBC00E86E60 /* EDOUSBMuxUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = EDOUSBMuxUtil.m; path = Device/Sources/EDOUSBMuxUtil.m; sourceTree = ""; }; @@ -561,8 +560,8 @@ C5A2EFD12134D40E00421D72 /* Sources */ = { isa = PBXGroup; children = ( - 7690BE9223A9CCBC00C00D02 /* NSObject+EDOBlacklistedType.h */, - 7690BE9323A9CCBD00C00D02 /* NSObject+EDOBlacklistedType.m */, + 7657C22024F9BEA70056F5A6 /* NSObject+EDOBlockedType.h */, + 7657C22124F9BEA70056F5A6 /* NSObject+EDOBlockedType.m */, 7685673223A1C10100EDBDB4 /* EDORemoteException.h */, 7685673123A1C10100EDBDB4 /* EDORemoteException.m */, DC9BF6C022DFC8AD00E135B8 /* NSObject+EDOWeakObject.h */, @@ -1238,7 +1237,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 7690BE9423A9CCBD00C00D02 /* NSObject+EDOBlacklistedType.m in Sources */, C5A2F0682134D6A000421D72 /* EDOClassMessage.m in Sources */, C8A5E007213F896000D28052 /* NSBlock+EDOInvocation.m in Sources */, C5A2F0732134D6C100421D72 /* EDOObject+Invocation.m in Sources */, @@ -1252,6 +1250,7 @@ C5A2F07C2134D6C100421D72 /* EDOValueObject.m in Sources */, C5A2F0782134D6C100421D72 /* EDOProtocolObject.m in Sources */, C5A2F07E2134D6C100421D72 /* EDOValueType.m in Sources */, + 7657C22224F9BEA70056F5A6 /* NSObject+EDOBlockedType.m in Sources */, DC84AF0522D805EE00D43E26 /* EDODeallocationTracker.m in Sources */, DC84AF0422D805C800D43E26 /* EDOWeakObject.m in Sources */, C5A2F06D2134D6C100421D72 /* EDOInvocationMessage.m in Sources */,