Changeset 82847 in webkit


Ignore:
Timestamp:
Apr 4, 2011 11:00:32 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

2011-04-04 Pavel Feldman <pfeldman@google.com>

Reviewed by Yury Semikhatsky.

Web Inspector: add support for the enumerated types in the protocol.
https://bugs.webkit.org/show_bug.cgi?id=57761

  • inspector/debugger/debugger-autocontinue-on-syntax-error.html:
  • inspector/debugger/debugger-pause-on-exception.html:

2011-04-04 Pavel Feldman <pfeldman@google.com>

Reviewed by Yury Semikhatsky.

Web Inspector: add support for the enumerated types in the protocol.
https://bugs.webkit.org/show_bug.cgi?id=57761

  • inspector/Inspector.json:
  • inspector/InspectorDebuggerAgent.cpp: (WebCore::InspectorDebuggerAgent::setPauseOnExceptions):
  • inspector/InspectorDebuggerAgent.h:
  • inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl): (WebCore::InspectorInstrumentation::scriptImportedImpl):
  • inspector/InspectorResourceAgent.cpp: (WebCore::cachedResourceTypeString): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::setInitialScriptContent): (WebCore::InspectorResourceAgent::setInitialXHRContent):
  • inspector/InspectorResourceAgent.h:
  • inspector/front-end/ScriptsPanel.js:
  • inspector/generate-inspector-idl:
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r82843 r82847  
     12011-04-04  Pavel Feldman  <pfeldman@google.com>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: add support for the enumerated types in the protocol.
     6        https://bugs.webkit.org/show_bug.cgi?id=57761
     7
     8        * inspector/debugger/debugger-autocontinue-on-syntax-error.html:
     9        * inspector/debugger/debugger-pause-on-exception.html:
     10
    1112011-04-04  Yong Li  <yoli@rim.com>
    212
  • trunk/LayoutTests/inspector/debugger/debugger-autocontinue-on-syntax-error.html

    r80416 r82847  
    1919    function step1()
    2020    {
    21         DebuggerAgent.setPauseOnExceptionsState(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
     21        DebuggerAgent.setPauseOnExceptions(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
    2222        InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
    2323        InspectorTest.evaluateInPage("loadIframe()");
  • trunk/LayoutTests/inspector/debugger/debugger-pause-on-exception.html

    r78717 r82847  
    2121    function step1()
    2222    {
    23         DebuggerAgent.setPauseOnExceptionsState(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
     23        DebuggerAgent.setPauseOnExceptions(WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions);
    2424        InspectorTest.showScriptSource("debugger-pause-on-exception.html", step2);
    2525    }
  • trunk/Source/WebCore/ChangeLog

    r82845 r82847  
     12011-04-04  Pavel Feldman  <pfeldman@google.com>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: add support for the enumerated types in the protocol.
     6        https://bugs.webkit.org/show_bug.cgi?id=57761
     7
     8        * inspector/Inspector.json:
     9        * inspector/InspectorDebuggerAgent.cpp:
     10        (WebCore::InspectorDebuggerAgent::setPauseOnExceptions):
     11        * inspector/InspectorDebuggerAgent.h:
     12        * inspector/InspectorInstrumentation.cpp:
     13        (WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl):
     14        (WebCore::InspectorInstrumentation::scriptImportedImpl):
     15        * inspector/InspectorResourceAgent.cpp:
     16        (WebCore::cachedResourceTypeString):
     17        (WebCore::InspectorResourceAgent::didReceiveResponse):
     18        (WebCore::InspectorResourceAgent::setInitialScriptContent):
     19        (WebCore::InspectorResourceAgent::setInitialXHRContent):
     20        * inspector/InspectorResourceAgent.h:
     21        * inspector/front-end/ScriptsPanel.js:
     22        * inspector/generate-inspector-idl:
     23
    1242011-04-04  Yury Semikhatsky  <yurys@chromium.org>
    225
  • trunk/Source/WebCore/inspector/Inspector.json

    r82804 r82847  
    160160                "parameters": [
    161161                    { "name": "objectId", "type": "string" },
    162                     { "name": "ignoreHasOwnProperty", "type": "boolean" },
     162                    { "name": "ignoreHasOwnProperty", "type": "boolean" }
    163163                ],
    164164                "returns": [
     
    286286            },
    287287            {
     288                "id": "ResourceType",
     289                "type": "string",
     290                "enum": ["Document", "Stylesheet", "Image", "Font", "Script", "XHR", "WebSocket", "Other"],
     291                "description": "Resource type as it was perceived by the rendering enging."
     292            },
     293            {
    288294                "id": "CachedResource",
    289295                "type": "object",
     
    291297                "properties": {
    292298                    "url": { "type": "string", "description": "Resource URL." },
    293                     "type": { "type": "string", "description": "Type of this resource. // FIXME" },
     299                    "type": { "$ref": "ResourceType", "description": "Type of this resource." },
    294300                    "response": { "$ref": "ResourceResponse", "description": "Cached response data." },
    295301                    "bodySize": { "type": "number", "description": "Cached response body size." }
     
    320326                            "properties": {
    321327                                "url": { "type": "string", "description": "Resource URL." },
    322                                 "type": { "type": "string", "description": "Type of this resource. // FIXME" }
     328                                "type": { "$ref": "ResourceType", "description": "Type of this resource." }
    323329                            }
    324330                        },
     
    399405                    { "name": "identifier", "type": "integer", "description": "Request identifier." },
    400406                    { "name": "time", "type": "number", "description": "Timestamp." },
    401                     { "name": "resourceType", "type": "string", "description": "Resource type. // FIXME" },
     407                    { "name": "type", "$ref": "ResourceType", "description": "Resource type." },
    402408                    { "name": "response", "$ref": "ResourceResponse", "description": "Response data." }
    403409                ]
     
    447453                    { "name": "identifier", "type": "integer", "description": "Request identifier." },
    448454                    { "name": "content", "type": "string", "description": "Resource content." },
    449                     { "name": "type", "type": "string", "description": "Resource type. // FIXME" }
     455                    { "name": "type", "$ref": "ResourceType", "description": "Resource type." }
    450456                ]
    451457            },
     
    679685                "parameters": [
    680686                    { "name": "nodeId", "type": "integer", "description": "Id of the node to query upon." },
    681                     { "name": "selectors", "type": "string", "description": "Selector string." },
     687                    { "name": "selectors", "type": "string", "description": "Selector string." }
    682688                ],
    683689                "returns": [
     
    690696                "parameters": [
    691697                    { "name": "nodeId", "type": "integer", "description": "Id of the node to query upon." },
    692                     { "name": "selectors", "type": "string", "description": "Selector string." },
     698                    { "name": "selectors", "type": "string", "description": "Selector string." }
    693699                ],
    694700                "returns": [
     
    10031009                    "sourceURL": { "type": "string", "optional": true, "description": "Parent stylesheet resource URL (for regular rules)."},
    10041010                    "sourceLine": { "type": "integer", "description": "Line ordinal of the rule selector start character in the resource."},
    1005                     "origin": { "type": "string", "description": "The parent stylesheet type: \"user\" for user stylesheets, \"user-agent\" for user-agent stylesheets, \"inspector\" for stylesheets created by the inspector (i.e. those holding new rules created with <code>addRule()</code>), \"\" for regular stylesheets. // FIXME"},
     1011                    "origin": { "type": "string", "enum": ["user", "user-agent", "inspector", ""], "description": "The parent stylesheet type: \"user\" for user stylesheets, \"user-agent\" for user-agent stylesheets, \"inspector\" for stylesheets created by the inspector (i.e. those holding new rules created with <code>addRule()</code>), \"\" for regular stylesheets."},
    10061012                    "style": { "$ref": "CSSStyle", "description": "Associated style declaration." },
    10071013                    "selectorRange": { "$ref": "SourceRange", "optional": true, "description": "The rule selector range in the underlying resource (if available)." }
     
    10411047                    "implicit": { "type": "boolean", "optional": true, "description": "Whether the property is implicit (implies <code>false</code> if absent)." },
    10421048                    "parsedOk": { "type": "boolean", "optional": true, "description": "Whether the property is understood by the browser (implies <code>true</code> if absent)." },
    1043                     "status": { "type": "string", "optional": true, "description": "The property status: \"active\" (implied if absent) if the property is effective in the style, \"inactive\" if the property is overridden by a same-named property in this style later on, \"disabled\" if the property is disabled by the user, \"style\" if the property is reported by the browser rather than by the CSS source parser. // FIXME" },
     1049                    "status": { "type": "string", "enum": ["active", "inactive", "disabled", "style"], "optional": true, "description": "The property status: \"active\" (implied if absent) if the property is effective in the style, \"inactive\" if the property is overridden by a same-named property in this style later on, \"disabled\" if the property is disabled by the user, \"style\" if the property is reported by the browser rather than by the CSS source parser." },
    10441050                    "shorthandName": { "type": "string", "description": "The related shorthand property name (absent if this property is not a longhand)." },
    10451051                    "range": { "$ref": "SourceRange", "optional": true, "description": "The entire property range in the enclosing style declaration (if available)." }
     
    13511357            },
    13521358            {
    1353                 "name": "setPauseOnExceptionsState",
    1354                 "parameters": [
    1355                     { "name": "pauseOnExceptionsState", "type": "integer", "description": "Pause on exceptions mode. // FIXME, make enumerable." }
     1359                "name": "setPauseOnExceptions",
     1360                "parameters": [
     1361                    { "name": "state", "type": "string", "enum": ["none", "uncaught", "all"], "description": "Pause on exceptions mode." }
    13561362                ],
    13571363                "description": "Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions."
  • trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp

    r82804 r82847  
    302302}
    303303
    304 void InspectorDebuggerAgent::setPauseOnExceptionsState(ErrorString* errorString, int pauseState)
    305 {
     304void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString* errorString, const String& stringPauseState)
     305{
     306    ScriptDebugServer::PauseOnExceptionsState pauseState;
     307    if (stringPauseState == "none")
     308        pauseState = ScriptDebugServer::DontPauseOnExceptions;
     309    else if (stringPauseState == "all")
     310        pauseState = ScriptDebugServer::PauseOnAllExceptions;
     311    else if (stringPauseState == "uncaught")
     312        pauseState = ScriptDebugServer::PauseOnUncaughtExceptions;
     313    else {
     314        *errorString = "Unknown pause on exceptions mode: " + stringPauseState;
     315        return;
     316    }
    306317    scriptDebugServer().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState));
    307318    if (scriptDebugServer().pauseOnExceptionsState() != pauseState)
  • trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h

    r82804 r82847  
    9595    void stepInto(ErrorString*);
    9696    void stepOut(ErrorString*);
    97     void setPauseOnExceptionsState(ErrorString*, int pauseState);
     97    void setPauseOnExceptions(ErrorString*, const String& pauseState);
    9898    void evaluateOnCallFrame(ErrorString*, const String& callFrameId, const String& expression, const String& objectGroup, const bool* const optionalIncludeCommandLineAPI, RefPtr<InspectorObject>* result);
    9999
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r82403 r82847  
    485485    inspectorAgent->consoleAgent()->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber);
    486486    if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
    487         resourceAgent->setInitialContent(identifier, sourceString, "XHR");
     487        resourceAgent->setInitialXHRContent(identifier, sourceString);
    488488}
    489489
     
    491491{
    492492    if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
    493         resourceAgent->setInitialContent(identifier, sourceString, "Script");
     493        resourceAgent->setInitialScriptContent(identifier, sourceString);
    494494}
    495495
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp

    r82804 r82847  
    7575}
    7676
     77namespace ResourceType {
     78static const char document[] = "Document";
     79static const char stylesheet[] = "Stylesheet";
     80static const char image[] = "Image";
     81static const char font[] = "Font";
     82static const char script[] = "Script";
     83static const char xhr[] = "XHR";
     84static const char websocket[] = "WebSocket";
     85static const char other[] = "Other";
     86}
     87
    7788void InspectorResourceAgent::setFrontend(InspectorFrontend* frontend)
    7889{
     
    237248    switch (cachedResource.type()) {
    238249    case CachedResource::ImageResource:
    239         return "Image";
     250        return ResourceType::image;
    240251    case CachedResource::FontResource:
    241         return "Font";
     252        return ResourceType::font;
    242253    case CachedResource::CSSStyleSheet:
    243254        // Fall through.
     
    245256    case CachedResource::XSLStyleSheet:
    246257#endif
    247         return "Stylesheet";
     258        return ResourceType::stylesheet;
    248259    case CachedResource::Script:
    249         return "Script";
     260        return ResourceType::script;
    250261    default:
    251262        break;
    252263    }
    253     return "Other";
     264    return ResourceType::other;
    254265}
    255266
     
    315326        }
    316327        if (equalIgnoringFragmentIdentifier(response.url(), loader->frameLoader()->iconURL()))
    317             type = "Image";
     328            type = ResourceType::image;
    318329        else if (equalIgnoringFragmentIdentifier(response.url(), loader->url()) && type == "Other")
    319             type = "Document";
     330            type = ResourceType::document;
    320331    }
    321332    m_frontend->responseReceived(static_cast<int>(identifier), currentTime(), type, resourceResponse);
     
    349360}
    350361
    351 void InspectorResourceAgent::setInitialContent(unsigned long identifier, const String& sourceString, const String& type)
    352 {
    353     m_frontend->initialContentSet(static_cast<int>(identifier), sourceString, type);
     362void InspectorResourceAgent::setInitialScriptContent(unsigned long identifier, const String& sourceString)
     363{
     364    m_frontend->initialContentSet(static_cast<int>(identifier), sourceString, ResourceType::script);
     365}
     366
     367void InspectorResourceAgent::setInitialXHRContent(unsigned long identifier, const String& sourceString)
     368{
     369    m_frontend->initialContentSet(static_cast<int>(identifier), sourceString, ResourceType::xhr);
    354370}
    355371
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.h

    r82804 r82847  
    9696    void didFailLoading(unsigned long identifier, const ResourceError&);
    9797    void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*);
    98     void setInitialContent(unsigned long identifier, const String& sourceString, const String& type);
     98    void setInitialScriptContent(unsigned long identifier, const String& sourceString);
     99    void setInitialXHRContent(unsigned long identifier, const String& sourceString);
    99100    void didCommitLoad(DocumentLoader*);
    100101    void frameDetachedFromParent(Frame*);
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r82685 r82847  
    205205// Keep these in sync with WebCore::ScriptDebugServer
    206206WebInspector.ScriptsPanel.PauseOnExceptionsState = {
    207     DontPauseOnExceptions : 0,
    208     PauseOnAllExceptions : 1,
    209     PauseOnUncaughtExceptions: 2
     207    DontPauseOnExceptions : "none",
     208    PauseOnAllExceptions : "all",
     209    PauseOnUncaughtExceptions: "uncaught"
    210210};
    211211
     
    415415    _debuggerWasEnabled: function()
    416416    {
    417         this._setPauseOnExceptions(WebInspector.settings.pauseOnExceptionState);
     417        this._setPauseOnExceptions(WebInspector.settings.pauseOnExceptionStateString);
    418418
    419419        if (this._debuggerEnabled)
     
    682682    _setPauseOnExceptions: function(pauseOnExceptionsState)
    683683    {
     684        pauseOnExceptionsState = pauseOnExceptionsState || WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions;
    684685        function callback(error)
    685686        {
     
    694695
    695696            this._pauseOnExceptionButton.state = pauseOnExceptionsState;
    696             WebInspector.settings.pauseOnExceptionState = pauseOnExceptionsState;
    697         }
    698         DebuggerAgent.setPauseOnExceptionsState(pauseOnExceptionsState, callback.bind(this));
     697            WebInspector.settings.pauseOnExceptionStateString = pauseOnExceptionsState;
     698        }
     699        DebuggerAgent.setPauseOnExceptions(pauseOnExceptionsState, callback.bind(this));
    699700    },
    700701
     
    811812    _togglePauseOnExceptions: function()
    812813    {
    813         this._setPauseOnExceptions((this._pauseOnExceptionButton.state + 1) % this._pauseOnExceptionButton.states);
     814        var nextStateMap = {};
     815        var stateEnum = WebInspector.ScriptsPanel.PauseOnExceptionsState;
     816        nextStateMap[stateEnum.DontPauseOnExceptions] = stateEnum.PauseOnAllExceptions; 
     817        nextStateMap[stateEnum.PauseOnAllExceptions] = stateEnum.PauseOnUncaughtExceptions; 
     818        nextStateMap[stateEnum.PauseOnUncaughtExceptions] = stateEnum.DontPauseOnExceptions;
     819        this._setPauseOnExceptions(nextStateMap[this._pauseOnExceptionButton.state]);
    814820    },
    815821
  • trunk/Source/WebCore/inspector/front-end/inspector.css

    r82609 r82847  
    494494}
    495495
    496 button.status-bar-item.toggled-1 .glyph {
    497     background-color: rgb(66, 129, 235);
    498 }
    499 
    500 button.status-bar-item.toggled-2 .glyph {
    501     background-color: purple;   
    502 }
    503 
    504496button.status-bar-item:disabled {
    505497    opacity: 0.5;
     
    25212513}
    25222514
     2515.scripts-pause-on-exceptions-status-bar-item.toggled-all .glyph {
     2516    background-color: rgb(66, 129, 235);
     2517}
     2518
     2519.scripts-pause-on-exceptions-status-bar-item.toggled-uncaught .glyph {
     2520    background-color: purple;   
     2521}
     2522
    25232523#scripts-status-bar {
    25242524    position: absolute;
  • trunk/Source/WebCore/inspector/generate-inspector-idl

    r82804 r82847  
    8282}
    8383
     84ref_types = {}
     85
    8486macro_traits = {
    8587    "Database": "DATABASE",
     
    9395def param_type(param):
    9496    if "type" in param:
    95         return type_traits[param["type"]];
     97        return type_traits[param["type"]]
    9698    if "$ref" in param:
    97         return "Object"
     99        type_id = param["$ref"]
     100        if type_id in ref_types:
     101            ref_type = ref_types[type_id]
     102            return type_traits[ref_type["type"]]
     103        else:
     104            return "Object"
    98105
    99106for domain in json_api:
     
    102109        output_file.write("\n#if defined(ENABLE_%s) && ENABLE_%s" % (macro_traits[domain_name], macro_traits[domain_name]))
    103110    output_file.write("\n    interface [Conditional=INSPECTOR] %s {" % domain_name)
     111    if "types" in domain:
     112        for type in domain["types"]:
     113            ref_types[type["id"]] = type
    104114    if "commands" in domain:
    105115        for command in domain["commands"]:
    106             params = [];
     116            params = []
    107117            if ("parameters" in command):
    108118                for in_param in command["parameters"]:
     
    118128    if "events" in domain:
    119129        for event in domain["events"]:
    120             params = [];
     130            params = []
    121131            if ("parameters" in event):
    122132                for in_param in event["parameters"]:
Note: See TracChangeset for help on using the changeset viewer.