Changeset 117768 in webkit


Ignore:
Timestamp:
May 21, 2012 4:55:32 AM (12 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: Temporary UISourceCode should be replaced each time another inline script is added in RawSourceCode with pending request.
https://bugs.webkit.org/show_bug.cgi?id=87003

Reviewed by Pavel Feldman.

Source/WebCore:

This is needed to correctly show document content when debugger stops on several breakpoints in different scripts during page load.

  • inspector/front-end/RawSourceCode.js:

(WebInspector.RawSourceCode.prototype.addScript):
(WebInspector.RawSourceCode.prototype._finishedLoading):

LayoutTests:

  • inspector/debugger/raw-source-code-expected.txt:
  • inspector/debugger/raw-source-code.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r117767 r117768  
     12012-05-21  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Temporary UISourceCode should be replaced each time another inline script is added in RawSourceCode with pending request.
     4        https://bugs.webkit.org/show_bug.cgi?id=87003
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/debugger/raw-source-code-expected.txt:
     9        * inspector/debugger/raw-source-code.html:
     10
    1112012-05-21  Pavel Feldman  <pfeldman@chromium.org>
    212
  • trunk/LayoutTests/inspector/debugger/raw-source-code-expected.txt

    r116775 r117768  
    99
    1010Running: testHTMLWithPendingResource
     11Adding first script for pending request.
     12UISourceCode: index.html
     13UISourceCode is content script: false
     14Mime type: text/html
     15Script source:   <script><script source 1></script>
     16Adding second script for pending request.
     17UISourceCode: index.html
     18UISourceCode is content script: false
     19Mime type: text/html
     20Script source:   <script><script source 1></script> <script><script source 2></script>
     21Finishing request.
    1122UISourceCode: index.html
    1223UISourceCode is content script: false
  • trunk/LayoutTests/inspector/debugger/raw-source-code.html

    r116846 r117768  
    118118            var script2 = InspectorTest.createScriptMock("index.html", 0, 45, false, "<script source 2>");
    119119            var request = createPendingRequestMock("document", "<resource content>");
     120            InspectorTest.addResult("Adding first script for pending request.");
    120121            var rawSourceCode = createRawSourceCode(script1, request);
    121122
    122123            InspectorTest.assertTrue(!rawSourceCode.uiSourceCode());
    123124
    124             waitForUISourceCodeChangedEvent(rawSourceCode, uiSourceCodeChanged);
    125             finishRequest(request);
    126 
    127             function uiSourceCodeChanged(event)
     125            waitForUISourceCodeChangedEvent(rawSourceCode, uiSourceCodeAdded);
     126            rawSourceCode.rawLocationToUILocation(createRawLocation(0, 10));
     127            function uiSourceCodeAdded(event)
    128128            {
    129129                InspectorTest.assertTrue(!event.data.oldUISourceCode);
     
    133133                InspectorTest.addResult("UISourceCode is content script: " + uiSourceCode.isContentScript);
    134134                uiSourceCode.requestContent(didRequestContent);
     135
     136                function didRequestContent(content, contentEncoded, mimeType)
     137                {
     138                    InspectorTest.addResult("Mime type: " + mimeType);
     139                    InspectorTest.addResult("Script source: " + content);
     140
     141                    waitForUISourceCodeChangedEvent(rawSourceCode, uiSourceCodeChangedAfterScriptAdded);
     142                    InspectorTest.addResult("Adding second script for pending request.");
     143                    rawSourceCode.addScript(script2);
     144                  }
    135145            }
    136146
    137             function didRequestContent(content, contentEncoded, mimeType)
    138             {
    139                 InspectorTest.addResult("Mime type: " + mimeType);
    140                 InspectorTest.addResult("Script source: " + content);
    141 
    142                 rawSourceCode.addScript(script2);
    143                 next();
    144             }
     147            function uiSourceCodeChangedAfterScriptAdded(event)
     148            {
     149                InspectorTest.assertTrue(event.data.oldUISourceCode);
     150                InspectorTest.assertTrue(!!rawSourceCode.uiSourceCode());
     151                var uiSourceCode = rawSourceCode.uiSourceCode();
     152                InspectorTest.addResult("UISourceCode: " + uiSourceCode.url);
     153                InspectorTest.addResult("UISourceCode is content script: " + uiSourceCode.isContentScript);
     154                uiSourceCode.requestContent(didRequestContent);
     155
     156                function didRequestContent(content, contentEncoded, mimeType)
     157                {
     158                    InspectorTest.addResult("Mime type: " + mimeType);
     159                    InspectorTest.addResult("Script source: " + content);
     160
     161                    waitForUISourceCodeChangedEvent(rawSourceCode, uiSourceCodeChangedAfterRequestFinished);
     162                    InspectorTest.addResult("Finishing request.");
     163                    finishRequest(request);
     164                }
     165              }
     166
     167            function uiSourceCodeChangedAfterRequestFinished(event)
     168            {
     169                InspectorTest.assertTrue(event.data.oldUISourceCode);
     170                InspectorTest.assertTrue(!!rawSourceCode.uiSourceCode());
     171                var uiSourceCode = rawSourceCode.uiSourceCode();
     172                InspectorTest.addResult("UISourceCode: " + uiSourceCode.url);
     173                InspectorTest.addResult("UISourceCode is content script: " + uiSourceCode.isContentScript);
     174                uiSourceCode.requestContent(didRequestContent);
     175
     176                function didRequestContent(content, contentEncoded, mimeType)
     177                {
     178                    InspectorTest.addResult("Mime type: " + mimeType);
     179                    InspectorTest.addResult("Script source: " + content);
     180
     181                    next();
     182                }
     183              }
    145184        },
    146185
  • trunk/Source/WebCore/ChangeLog

    r117766 r117768  
     12012-05-21  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Temporary UISourceCode should be replaced each time another inline script is added in RawSourceCode with pending request.
     4        https://bugs.webkit.org/show_bug.cgi?id=87003
     5
     6        Reviewed by Pavel Feldman.
     7
     8        This is needed to correctly show document content when debugger stops on several breakpoints in different scripts during page load.
     9
     10        * inspector/front-end/RawSourceCode.js:
     11        (WebInspector.RawSourceCode.prototype.addScript):
     12        (WebInspector.RawSourceCode.prototype._finishedLoading):
     13
    1142012-05-20  Kinuko Yasuda  <kinuko@chromium.org>
    215
  • trunk/Source/WebCore/inspector/front-end/RawSourceCode.js

    r117600 r117768  
    6969    {
    7070        this._scripts.push(script);
     71        if (this._temporaryUISourceCode) {
     72            var oldUISourceCode = this._temporaryUISourceCode;
     73            this._temporaryUISourceCode = this._createUISourceCode();
     74            this.dispatchEventToListeners(WebInspector.RawSourceCode.Events.UISourceCodeChanged, { uiSourceCode: this._temporaryUISourceCode, oldUISourceCode: oldUISourceCode });
     75        }
    7176    },
    7277
     
    132137        delete this._pendingRequest;
    133138        var oldUISourceCode = this._uiSourceCode || this._temporaryUISourceCode;
     139        delete this._temporaryUISourceCode;
    134140        this._uiSourceCode = this._createUISourceCode();
    135141        this.dispatchEventToListeners(WebInspector.RawSourceCode.Events.UISourceCodeChanged, { uiSourceCode: this._uiSourceCode, oldUISourceCode: oldUISourceCode });
Note: See TracChangeset for help on using the changeset viewer.