Changeset 83601 in webkit


Ignore:
Timestamp:
Apr 12, 2011 10:07:33 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

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

Reviewed by Yury Semikhatsky.

Web Inspector: remove scriptWorldType from the protocol.
https://bugs.webkit.org/show_bug.cgi?id=58324

  • inspector/Inspector.json:
  • inspector/InspectorDebuggerAgent.cpp: (WebCore::InspectorDebuggerAgent::didParseSource):
  • inspector/ScriptDebugListener.h: (WebCore::ScriptDebugListener::~ScriptDebugListener):
  • inspector/front-end/DebuggerModel.js: (WebInspector.DebuggerModel.prototype._parsedScriptSource): (WebInspector.DebuggerDispatcher.prototype.scriptParsed):
  • inspector/front-end/Script.js: (WebInspector.Script):
  • inspector/front-end/ScriptsPanel.js:
  • inspector/front-end/SourceFile.js: (WebInspector.SourceFile):
Location:
trunk/Source/WebCore
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83600 r83601  
     12011-04-12  Pavel Feldman  <pfeldman@google.com>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: remove scriptWorldType from the protocol.
     6        https://bugs.webkit.org/show_bug.cgi?id=58324
     7
     8        * inspector/Inspector.json:
     9        * inspector/InspectorDebuggerAgent.cpp:
     10        (WebCore::InspectorDebuggerAgent::didParseSource):
     11        * inspector/ScriptDebugListener.h:
     12        (WebCore::ScriptDebugListener::~ScriptDebugListener):
     13        * inspector/front-end/DebuggerModel.js:
     14        (WebInspector.DebuggerModel.prototype._parsedScriptSource):
     15        (WebInspector.DebuggerDispatcher.prototype.scriptParsed):
     16        * inspector/front-end/Script.js:
     17        (WebInspector.Script):
     18        * inspector/front-end/ScriptsPanel.js:
     19        * inspector/front-end/SourceFile.js:
     20        (WebInspector.SourceFile):
     21
    1222011-04-11  Dimitri Glazkov  <dglazkov@chromium.org>
    223
  • trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp

    r83190 r83601  
    215215}
    216216
    217 void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, SourceProvider* sourceProvider, ScriptWorldType worldType)
     217void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, SourceProvider* sourceProvider, bool isContentScript)
    218218{
    219219    String sourceID = ustringToString(JSC::UString::number(sourceProvider->asID()));
     
    226226    copyToVector(listeners, copy);
    227227    for (size_t i = 0; i < copy.size(); ++i)
    228         copy[i]->didParseSource(sourceID, url, data, lineOffset, columnOffset, worldType);
     228        copy[i]->didParseSource(sourceID, url, data, lineOffset, columnOffset, isContentScript);
    229229}
    230230
     
    241241}
    242242
    243 static ScriptWorldType currentWorldType(ExecState* exec)
    244 {
    245     if (currentWorld(exec) == mainThreadNormalWorld())
    246         return MAIN_WORLD;
    247     return EXTENSIONS_WORLD;
     243static bool isContentScript(ExecState* exec)
     244{
     245    return currentWorld(exec) != mainThreadNormalWorld();
    248246}
    249247
     
    276274    if (isError)
    277275        dispatchFailedToParseSource(*listeners, sourceProvider, errorLine, ustringToString(errorMessage));
    278     else {
    279         ScriptWorldType worldType = currentWorldType(exec);
    280         dispatchDidParseSource(*listeners, sourceProvider, worldType);
    281     }
     276    else
     277        dispatchDidParseSource(*listeners, sourceProvider, isContentScript(exec));
    282278
    283279    m_callingListeners = false;
  • trunk/Source/WebCore/bindings/js/ScriptDebugServer.h

    r82590 r83601  
    103103    void dispatchDidPause(ScriptDebugListener*);
    104104    void dispatchDidContinue(ScriptDebugListener*);
    105     void dispatchDidParseSource(const ListenerSet& listeners, JSC::SourceProvider*, enum ScriptWorldType);
     105    void dispatchDidParseSource(const ListenerSet& listeners, JSC::SourceProvider*, bool isContentScript);
    106106    void dispatchFailedToParseSource(const ListenerSet& listeners, JSC::SourceProvider*, int errorLine, const String& errorMessage);
    107107
  • trunk/Source/WebCore/bindings/v8/DebuggerScript.js

    r83290 r83601  
    3939};
    4040
    41 DebuggerScript.ScriptWorldType = {
    42     MainWorld : 0,
    43     ExtensionsWorld : 1
    44 };
    45 
    4641DebuggerScript._pauseOnExceptionsState = DebuggerScript.PauseOnExceptionsState.DontPauseOnExceptions;
    4742Debug.clearBreakOnException();
     
    7772DebuggerScript._formatScript = function(script)
    7873{
    79     var scriptWorldType = DebuggerScript.ScriptWorldType.MainWorld;
    80     if (script.context_data && script.context_data.indexOf("injected") == 0)
    81         scriptWorldType = DebuggerScript.ScriptWorldType.ExtensionsWorld;
    8274    return {
    8375        id: script.id,
     
    8678        lineOffset: script.line_offset,
    8779        columnOffset: script.column_offset,
    88         scriptWorldType: scriptWorldType
     80        isContentScript: !!script.context_data && script.context_data.indexOf("injected") == 0
    8981    };
    9082}
  • trunk/Source/WebCore/bindings/v8/ScriptDebugServer.cpp

    r83290 r83601  
    352352        object->Get(v8::String::New("lineOffset"))->ToInteger()->Value(),
    353353        object->Get(v8::String::New("columnOffset"))->ToInteger()->Value(),
    354         static_cast<ScriptWorldType>(object->Get(v8::String::New("scriptWorldType"))->Int32Value()));
     354        object->Get(v8::String::New("isContentScript"))->ToBoolean()->Value());
    355355}
    356356
  • trunk/Source/WebCore/inspector/Inspector.json

    r83599 r83601  
    14551455                    { "name": "columnOffset", "type": "integer", "description": "Column offset of the script within the resource with given URL." },
    14561456                    { "name": "length", "type": "integer", "description": "Length of the script" },
    1457                     { "name": "scriptWorldType", "type": "integer", "description": "Script type. // FIXME." }
     1457                    { "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." }
    14581458                ],
    14591459                "description": "Fired when virtual machine parses script. This even is also fired for all known scripts upon enabling debugger."
  • trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp

    r83434 r83601  
    375375// JavaScriptDebugListener functions
    376376
    377 void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String& url, const String& data, int lineOffset, int columnOffset, ScriptWorldType worldType)
     377void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String& url, const String& data, int lineOffset, int columnOffset, bool isContentScript)
    378378{
    379379    // Don't send script content to the front end until it's really needed.
    380     m_frontend->scriptParsed(sourceID, url, lineOffset, columnOffset, data.length(), worldType);
     380    m_frontend->scriptParsed(sourceID, url, lineOffset, columnOffset, data.length(), isContentScript);
    381381
    382382    m_scripts.set(sourceID, Script(url, data, lineOffset, columnOffset));
  • trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h

    r83290 r83601  
    120120    PassRefPtr<InspectorArray> currentCallFrames();
    121121
    122     virtual void didParseSource(const String& sourceID, const String& url, const String& data, int lineOffset, int columnOffset, ScriptWorldType);
     122    virtual void didParseSource(const String& sourceID, const String& url, const String& data, int lineOffset, int columnOffset, bool isContentScript);
    123123    virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage);
    124124    virtual void didPause(ScriptState*);
  • trunk/Source/WebCore/inspector/ScriptDebugListener.h

    r75794 r83601  
    3838namespace WebCore {
    3939
    40 enum ScriptWorldType {
    41 MAIN_WORLD = 0,
    42 EXTENSIONS_WORLD
    43 };
    44 
    4540class ScriptDebugListener {
    4641public:
    4742    virtual ~ScriptDebugListener() { }
    4843
    49     virtual void didParseSource(const String&  sourceID, const String& url, const String& data, int lineOffset, int columnOffset, ScriptWorldType) = 0;
     44    virtual void didParseSource(const String&  sourceID, const String& url, const String& data, int lineOffset, int columnOffset, bool isContentScript) = 0;
    5045    virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) = 0;
    5146    virtual void didPause(ScriptState*) = 0;
  • trunk/Source/WebCore/inspector/front-end/DebuggerModel.js

    r83290 r83601  
    180180    },
    181181
    182     _parsedScriptSource: function(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType)
    183     {
    184         var script = new WebInspector.Script(sourceID, sourceURL, lineOffset, columnOffset, length, undefined, undefined, scriptWorldType);
     182    _parsedScriptSource: function(sourceID, sourceURL, lineOffset, columnOffset, length, isContentScript)
     183    {
     184        var script = new WebInspector.Script(sourceID, sourceURL, lineOffset, columnOffset, length, undefined, undefined, isContentScript);
    185185        this._scripts[sourceID] = script;
    186186        this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource, script);
     
    228228    },
    229229
    230     scriptParsed: function(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType)
    231     {
    232         this._debuggerModel._parsedScriptSource(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType);
     230    scriptParsed: function(sourceID, sourceURL, lineOffset, columnOffset, length, isContentScript)
     231    {
     232        this._debuggerModel._parsedScriptSource(sourceID, sourceURL, lineOffset, columnOffset, length, isContentScript);
    233233    },
    234234
  • trunk/Source/WebCore/inspector/front-end/Script.js

    r82683 r83601  
    2424 */
    2525
    26 WebInspector.Script = function(sourceID, sourceURL, lineOffset, columnOffset, length, errorLine, errorMessage, worldType)
     26WebInspector.Script = function(sourceID, sourceURL, lineOffset, columnOffset, length, errorLine, errorMessage, isContentScript)
    2727{
    2828    this.sourceID = sourceID;
     
    3333    this.errorLine = errorLine;
    3434    this.errorMessage = errorMessage;
    35     this.worldType = worldType;
    36 }
    37 
    38 WebInspector.Script.WorldType = {
    39     MAIN_WORLD: 0,
    40     EXTENSIONS_WORLD: 1
     35    this.isContentScript = isContentScript;
    4136}
    4237
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r83290 r83601  
    281281        var option = document.createElement("option");
    282282        option.text = sourceFile.url ? WebInspector.displayNameForURL(sourceFile.url) : WebInspector.UIString("(program)");
    283         if (sourceFile.isExtensionScript)
     283        if (sourceFile.isContentScript)
    284284            option.addStyleClass("extension-script");
    285285        function optionCompare(a, b)
  • trunk/Source/WebCore/inspector/front-end/SourceFile.js

    r83294 r83601  
    3939    this.id = id;
    4040    this.url = script.sourceURL;
    41     this.isExtensionScript = script.worldType === WebInspector.Script.WorldType.EXTENSIONS_WORLD;
     41    this.isContentScript = script.isContentScript;
    4242    this.messages = [];
    4343    this.breakpoints = {};
Note: See TracChangeset for help on using the changeset viewer.