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

Description Brian Burg 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.
Comment 1 Brian Burg 2014-11-12 13:32:55 PST
Created attachment 241438 [details]
WIP
Comment 2 Radar WebKit Bug Importer 2014-11-12 13:33:10 PST
<rdar://problem/18960076>
Comment 3 Radar WebKit Bug Importer 2014-11-12 13:33:11 PST
<rdar://problem/18960075>