Skip to content

Commit

Permalink
Rename EDOBlacklistedType to EDOBlockedType per go/respectful-code.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 329372445
  • Loading branch information
AlbertWang0116 authored and mobile-devx-github-bot committed Aug 31, 2020
1 parent f27af12 commit 17a3435
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <objc/runtime.h>

Expand All @@ -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) {
Expand Down
9 changes: 4 additions & 5 deletions Service/Tests/FunctionalTests/EDOServiceUITest.m
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()];
Expand All @@ -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]);
Expand Down
4 changes: 2 additions & 2 deletions Service/Tests/FunctionalTests/EDOTestDummyInTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions Service/Tests/FunctionalTests/EDOTestDummyInTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion eDistantObject.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions eDistantObject.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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 = "<group>"; };
7657C22124F9BEA70056F5A6 /* NSObject+EDOBlockedType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSObject+EDOBlockedType.m"; path = "Service/Sources/NSObject+EDOBlockedType.m"; sourceTree = "<group>"; };
7674100D237E01FB00D43A15 /* EDOExecutorMessageTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EDOExecutorMessageTest.m; path = Service/Tests/UnitTests/EDOExecutorMessageTest.m; sourceTree = "<group>"; };
7685673123A1C10100EDBDB4 /* EDORemoteException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EDORemoteException.m; path = Service/Sources/EDORemoteException.m; sourceTree = "<group>"; };
7685673223A1C10100EDBDB4 /* EDORemoteException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EDORemoteException.h; path = Service/Sources/EDORemoteException.h; sourceTree = "<group>"; };
7685673423A1C11F00EDBDB4 /* EDORemoteExceptionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EDORemoteExceptionTest.m; path = Service/Tests/UnitTests/EDORemoteExceptionTest.m; sourceTree = "<group>"; };
7690BE9223A9CCBC00C00D02 /* NSObject+EDOBlacklistedType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSObject+EDOBlacklistedType.h"; path = "Service/Sources/NSObject+EDOBlacklistedType.h"; sourceTree = "<group>"; };
7690BE9323A9CCBD00C00D02 /* NSObject+EDOBlacklistedType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSObject+EDOBlacklistedType.m"; path = "Service/Sources/NSObject+EDOBlacklistedType.m"; sourceTree = "<group>"; };
C52D85772220ADBB00E86E60 /* EDODeviceDetector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = EDODeviceDetector.h; path = Device/Sources/EDODeviceDetector.h; sourceTree = "<group>"; };
C52D85782220ADBC00E86E60 /* EDODeviceDetector.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = EDODeviceDetector.m; path = Device/Sources/EDODeviceDetector.m; sourceTree = "<group>"; };
C52D85792220ADBC00E86E60 /* EDOUSBMuxUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = EDOUSBMuxUtil.m; path = Device/Sources/EDOUSBMuxUtil.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand All @@ -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 */,
Expand Down

0 comments on commit 17a3435

Please sign in to comment.