Bug 138221

Summary: Web Inspector: ObjC Protocol Interfaces should throw exceptions for nil arguments
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: burg, commit-queue, graouts, joepeck, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix timothy: review+, timothy: commit-queue-

Joseph Pecoraro
Reported 2014-10-30 12:18:48 PDT
* SUMMARY Improved type checking and enforcement of correct inspector protocol types by throwing exceptions if required ObjC protocol objects are nil.
Attachments
[PATCH] Proposed Fix (23.71 KB, patch)
2014-10-31 16:40 PDT, Joseph Pecoraro
timothy: review+
timothy: commit-queue-
Radar WebKit Bug Importer
Comment 1 2014-10-30 12:19:01 PDT
Joseph Pecoraro
Comment 2 2014-10-31 16:40:42 PDT
Created attachment 240769 [details] [PATCH] Proposed Fix The following convenience macros are defined in RWIProtocolJSONInternal.h, which these files include. > #define THROW_EXCEPTION_FOR_NIL_KEY(expr) \ > if (!expr) \ > [NSException raise:NSInvalidArgumentException format:@"cannot set property with nil key"]; > > #define THROW_EXCEPTION_FOR_NIL_VALUE(expr) \ > if (!expr) \ > [NSException raise:NSInvalidArgumentException format:@"cannot set property to nil value"]; > > #define THROW_EXCEPTION_FOR_REQUIRED_PROPERTY(expr, propertyName) \ > if (!expr) \ > [NSException raise:NSInvalidArgumentException format:@"required property '%@' cannot be nil", propertyName]; > > #define THROW_EXCEPTION_FOR_REQUIRED_PARAMETER(expr, parameterName) \ > if (!expr) \ > [NSException raise:NSInvalidArgumentException format:@"required parameter '%@' cannot be nil", parameterName]; > > #define THROW_EXCEPTION_FOR_BAD_OPTIONAL_PARAMETER(expr, parameterName) \ > if (expr && !*expr) \ > [NSException raise:NSInvalidArgumentException format:@"optional parameter '%@' cannot be nil", parameterName]; The top ones are only used by RWIProtocolJSON for generic methods like -setString:forKey, -setObject:forKey:, ...
WebKit Commit Bot
Comment 3 2014-10-31 16:42:38 PDT
This patch modifies the inspector protocol generator. Please ensure that you have rebaselined any generator test results (i.e., by running `Tools/Scripts/run-inspector-generator-tests --reset-results`)
Joseph Pecoraro
Comment 4 2014-11-03 11:36:49 PST
Note You need to log in before you can comment on or make changes to this bug.