NEW 136032
Web Inspector: check and cast InspectorObjects before passing to InspectorAgents
https://bugs.webkit.org/show_bug.cgi?id=136032
Summary Web Inspector: check and cast InspectorObjects before passing to InspectorAgents
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.