[Webkit-unassigned] [Bug 136032] New: Web Inspector: check and cast InspectorObjects before passing to InspectorAgents

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Aug 17 15:04:24 PDT 2014


https://bugs.webkit.org/show_bug.cgi?id=136032

           Summary: Web Inspector: check and cast InspectorObjects before
                    passing to InspectorAgents
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Inspector
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: burg at cs.washington.edu
                CC: timothy at apple.com, joepeck at webkit.org,
                    webkit-bug-importer at group.apple.com,
                    graouts at webkit.org


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.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list