Bug 136032

Summary: Web Inspector: check and cast InspectorObjects before passing to InspectorAgents
Product: WebKit Reporter: Brian Burg <burg>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: graouts, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 147067    
Attachments:
Description Flags
WIP none

Brian Burg
Reported 2014-08-17 15:04:32 PDT
All in parameters for commands use raw InspectorObjects and do ad-hoc shape checking. I think we can just generate assertValueHasExpectedType for all types and add accessors to the checked InspectorObject wrappers. Inside the dispatcher functions, all the argument shapes are asserted and casted in debug builds. -- Original code from InspectorDebuggerAgent::setBreakpoint -- RefPtr<InspectorObject> options = ...; String condition = emptyString(); bool autoContinue = false; RefPtr<InspectorArray> actions; if (options) { (*options)->getString(ASCIILiteral("condition"), &condition); (*options)->getBoolean(ASCIILiteral("autoContinue"), &autoContinue); actions = (*options)->getArray(ASCIILiteral("actions")); } -- Proposed refactor -- RefPtr<Protocol::Debugger::Options> options = ...; String condition = emptyString(); bool autoContinue = false; RefPtr<Protocol::Array<Protocol::Debugger::BreakpointAction>> actions; if (options) { options->getCondition(condition); options->getAutoContinue(autoContinue); options->getActions(actions); } This would require the getters to take the argument by reference if the parameter is optional.
Attachments
WIP (527.74 KB, patch)
2014-11-12 13:32 PST, Brian Burg
no flags
Brian Burg
Comment 1 2014-11-12 13:32:55 PST
Radar WebKit Bug Importer
Comment 2 2014-11-12 13:33:10 PST
Radar WebKit Bug Importer
Comment 3 2014-11-12 13:33:11 PST
Note You need to log in before you can comment on or make changes to this bug.