Changeset 85315 in webkit


Ignore:
Timestamp:
Apr 29, 2011 4:35:58 AM (13 years ago)
Author:
podivilov@chromium.org
Message:

2011-04-28 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: breakpoints set in original and formatted scripts are messed up after navigation.
https://bugs.webkit.org/show_bug.cgi?id=59476

  • http/tests/inspector/inspector-test.js: (initialize_InspectorTest.InspectorTest.navigate): (initialize_InspectorTest.InspectorTest.reloadPage): (initialize_InspectorTest.InspectorTest.pageLoaded): (initialize_InspectorTest.InspectorTest.runWhenPageLoads): ():
  • inspector/debugger/script-formatter-expected.txt:
  • inspector/debugger/script-formatter.html:

2011-04-28 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: breakpoints set in original and formatted scripts are messed up after navigation.
https://bugs.webkit.org/show_bug.cgi?id=59476

  • inspector/front-end/DebuggerPresentationModel.js: (WebInspector.DebuggerPresentationModel.prototype.toggleFormatSourceFiles): (WebInspector.DebuggerPresentationModel.prototype._removeBreakpointFromDebugger): (WebInspector.PresentationBreakpoint.prototype.serialize):
  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.optionCompare): (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect): (WebInspector.ScriptsPanel.prototype.reset):
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r85306 r85315  
     12011-04-28  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: breakpoints set in original and formatted scripts are messed up after navigation.
     6        https://bugs.webkit.org/show_bug.cgi?id=59476
     7
     8        * http/tests/inspector/inspector-test.js:
     9        (initialize_InspectorTest.InspectorTest.navigate):
     10        (initialize_InspectorTest.InspectorTest.reloadPage):
     11        (initialize_InspectorTest.InspectorTest.pageLoaded):
     12        (initialize_InspectorTest.InspectorTest.runWhenPageLoads):
     13        ():
     14        * inspector/debugger/script-formatter-expected.txt:
     15        * inspector/debugger/script-formatter.html:
     16
    1172011-04-28  Adam Roben  <aroben@apple.com>
    218
  • trunk/LayoutTests/http/tests/inspector/inspector-test.js

    r84772 r85315  
    151151}
    152152
     153InspectorTest.navigate = function(url, callback)
     154{
     155    InspectorTest._pageLoadedCallback = InspectorTest.safeWrap(callback);
     156
     157    if (WebInspector.panels.network)
     158        WebInspector.panels.network._reset();
     159    InspectorTest.evaluateInConsole("window.location = '" + url + "'");
     160}
     161
    153162InspectorTest.reloadPage = function(callback)
    154163{
    155     InspectorTest._reloadPageCallback = InspectorTest.safeWrap(callback);
     164    InspectorTest._pageLoadedCallback = InspectorTest.safeWrap(callback);
    156165
    157166    if (WebInspector.panels.network)
     
    160169}
    161170
    162 InspectorTest.pageReloaded = function()
     171InspectorTest.pageLoaded = function()
    163172{
    164173    resultsSynchronized = false;
    165174    InspectorTest.addResult("Page reloaded.");
    166     if (InspectorTest._reloadPageCallback) {
    167         var callback = InspectorTest._reloadPageCallback;
    168         delete InspectorTest._reloadPageCallback;
     175    if (InspectorTest._pageLoadedCallback) {
     176        var callback = InspectorTest._pageLoadedCallback;
     177        delete InspectorTest._pageLoadedCallback;
    169178        callback();
    170179    }
     
    173182InspectorTest.runWhenPageLoads = function(callback)
    174183{
    175     var oldCallback = InspectorTest._reloadPageCallback;
     184    var oldCallback = InspectorTest._pageLoadedCallback;
    176185    function chainedCallback()
    177186    {
     
    180189        callback();
    181190    }
    182     InspectorTest._reloadPageCallback = InspectorTest.safeWrap(chainedCallback);
     191    InspectorTest._pageLoadedCallback = InspectorTest.safeWrap(chainedCallback);
    183192}
    184193
     
    342351    {
    343352        if (window.InspectorTest) {
    344             InspectorTest.pageReloaded();
     353            InspectorTest.pageLoaded();
    345354            return;
    346355        }
  • trunk/LayoutTests/inspector/debugger/script-formatter-expected.txt

    r84625 r85315  
    1515}
    1616</script></body></html>
     17
     18Running: testBreakpointsInOriginalAndFormattedSource
     19Script execution paused.
     20Call stack:
     21    0) f1 (script-formatter.html:12)
     22    1)  (script-formatter.html:1)
     23Script execution resumed.
     24Page reloaded.
     25Navigated to test-navigation.html
     26Page reloaded.
     27Navigated back to test page.
     28Script execution paused.
     29Call stack:
     30    0) f2 (script-formatter.html:17)
     31    1)  (script-formatter.html:1)
     32Script execution resumed.
    1733Debugger was disabled.
    1834
  • trunk/LayoutTests/inspector/debugger/script-formatter.html

    r84625 r85315  
    77<script>
    88
     9function f1()
     10{
     11    var a=0;var b=1;var c=3;var d=4;var e=5;
     12    var f=0;
     13    return 0;
     14}
     15
     16function f2()
     17{
     18    var x = 0;
     19    return 0;
     20}
     21
    922var test = function()
    1023{
     24    var panel = WebInspector.panels.scripts;
    1125    var worker = new Worker("ScriptFormatterWorker.js");
    1226
     
    8599            var content = "<html><body><script>function f(){}<" + "/script><script>function g(){}<" + "/script></body></html>";
    86100            worker.postMessage({ mimeType: "text/html", content: content });
     101        },
     102
     103        function testBreakpointsInOriginalAndFormattedSource(next)
     104        {
     105            var root;
     106            InspectorTest.showScriptSource("script-formatter.html", didShowScriptSource);
     107
     108            function didShowScriptSource(sourceFrame)
     109            {
     110                root = sourceFrame._url.substr(0, sourceFrame._url.lastIndexOf("/") + 1);
     111                InspectorTest.setBreakpoint(sourceFrame, 11, "", true);
     112                InspectorTest.waitUntilPaused(pausedInF1);
     113                InspectorTest.evaluateInPageWithTimeout("f1()");
     114            }
     115
     116            function pausedInF1(callFrames)
     117            {
     118                InspectorTest.captureStackTrace(callFrames);
     119                InspectorTest.resumeExecution(resumed);
     120            }
     121
     122            function resumed()
     123            {
     124                InspectorTest.navigate(root + "resources/test-navigation.html", didNavigateAnotherPage);
     125            }
     126
     127            function didNavigateAnotherPage()
     128            {
     129                InspectorTest.addResult("Navigated to test-navigation.html");
     130                panel._toggleFormatSourceFiles();
     131                InspectorTest.showScriptSource("test-navigation.html", didShowAnotherPage);
     132            }
     133
     134            function didShowAnotherPage(sourceFrame)
     135            {
     136                InspectorTest.navigate(root + "script-formatter.html", didNavigateBack);
     137            }
     138
     139            function didNavigateBack()
     140            {
     141                InspectorTest.addResult("Navigated back to test page.");
     142                InspectorTest.showScriptSource("script-formatter.html", didShowFormattedScriptSource);
     143            }
     144
     145            function didShowFormattedScriptSource(sourceFrame)
     146            {
     147                // There should be no breakpoint in f1 since script is pretty-printed now.
     148                InspectorTest.evaluateInPageWithTimeout("f1()");
     149
     150                InspectorTest.setBreakpoint(panel.visibleView, 24, "", true);
     151                InspectorTest.waitUntilPaused(pausedInF2);
     152                InspectorTest.evaluateInPageWithTimeout("f2()");
     153            }
     154
     155            function pausedInF2(callFrames)
     156            {
     157                InspectorTest.captureStackTrace(callFrames);
     158                next();
     159            }
    87160        }
    88161    ]);
  • trunk/Source/WebCore/ChangeLog

    r85312 r85315  
     12011-04-28  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: breakpoints set in original and formatted scripts are messed up after navigation.
     6        https://bugs.webkit.org/show_bug.cgi?id=59476
     7
     8        * inspector/front-end/DebuggerPresentationModel.js:
     9        (WebInspector.DebuggerPresentationModel.prototype.toggleFormatSourceFiles):
     10        (WebInspector.DebuggerPresentationModel.prototype._removeBreakpointFromDebugger):
     11        (WebInspector.PresentationBreakpoint.prototype.serialize):
     12        * inspector/front-end/ScriptsPanel.js:
     13        (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.optionCompare):
     14        (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect):
     15        (WebInspector.ScriptsPanel.prototype.reset):
     16
    1172011-04-29  Pavel Feldman  <pfeldman@google.com>
    218
  • trunk/Source/WebCore/inspector/front-end/DebuggerPresentationModel.js

    r85204 r85315  
    211211        }
    212212
     213        for (var id in this._breakpointsWithoutSourceFile) {
     214            var breakpoints = this._breakpointsWithoutSourceFile[id];
     215            for (var i = 0; i < breakpoints.length; ++i)
     216                this._removeBreakpointFromDebugger(breakpoints[i]);
     217        }
     218
    213219        var messages = this._messages;
    214220        this._reset();
     
    331337    _removeBreakpointFromDebugger: function(breakpoint, callback)
    332338    {
    333         if (!("debuggerId" in breakpoint)) {
    334             if (callback)
    335                 callback();
    336             return;
    337         }
    338 
    339         function didRemoveBreakpoint()
    340         {
     339        if ("debuggerId" in breakpoint) {
     340            WebInspector.debuggerModel.removeBreakpoint(breakpoint.debuggerId);
    341341            this._unbindDebuggerId(breakpoint);
    342             if (callback)
    343                 callback();
    344         }
    345         WebInspector.debuggerModel.removeBreakpoint(breakpoint.debuggerId, didRemoveBreakpoint.bind(this));
     342        }
     343
     344        if (callback)
     345            callback();
    346346    },
    347347
     
    632632        serializedBreakpoint.condition = this.condition;
    633633        serializedBreakpoint.enabled = this.enabled;
    634         serializedBreakpoint.debuggerId = this.debuggerId;
     634        if ("debuggerId" in this)
     635            serializedBreakpoint.debuggerId = this.debuggerId;
    635636        return serializedBreakpoint;
    636637    }
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r85266 r85315  
    296296
    297297            if (a.isContentScript && !b.isContentScript)
    298                 return 1; 
     298                return 1;
    299299            if (!a.isContentScript && b.isContentScript)
    300                 return -1; 
     300                return -1;
    301301
    302302            if (a.text === b.text)
     
    480480        this._updateBackAndForwardButtons();
    481481
     482        for (var id in this._sourceFileIdToSourceFrame) {
     483            var sourceFrame = this._sourceFileIdToSourceFrame[id];
     484            sourceFrame.removeEventListener(WebInspector.SourceFrame.Events.Loaded, this._sourceFrameLoaded, this);
     485        }
     486
    482487        this._sourceFileIdToSourceFrame = {};
    483488        this._sourceFileIdToFilesSelectOption = {};
Note: See TracChangeset for help on using the changeset viewer.