Changeset 145539 in webkit


Ignore:
Timestamp:
Mar 12, 2013 6:10:40 AM (11 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: ResourceScriptFile diverged state should be correctly reset after debugger reset.
https://bugs.webkit.org/show_bug.cgi?id=112036

Reviewed by Alexander Pavlov.

Source/WebCore:

  • inspector/front-end/ResourceScriptMapping.js:

(WebInspector.ResourceScriptFile):
(WebInspector.ResourceScriptFile.prototype._workingCopyChanged):
(WebInspector.ResourceScriptFile.prototype._maybeDirtyChanged):

LayoutTests:

  • inspector/debugger/file-system-project-mapping-expected.txt:
  • inspector/debugger/file-system-project-mapping.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r145536 r145539  
     12013-03-12  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: ResourceScriptFile diverged state should be correctly reset after debugger reset.
     4        https://bugs.webkit.org/show_bug.cgi?id=112036
     5
     6        Reviewed by Alexander Pavlov.
     7
     8        * inspector/debugger/file-system-project-mapping-expected.txt:
     9        * inspector/debugger/file-system-project-mapping.html:
     10
    1112013-03-12  Vsevolod Vlasov  <vsevik@chromium.org>
    212
  • trunk/LayoutTests/inspector/debugger/file-system-project-mapping-expected.txt

    r145536 r145539  
    1 Tests file system project.
     1Tests file system project mappings.
    22
    33
     
    1919    filesystem:/var/www/bar.js ->
    2020
     21Running: testScriptFileOnReloadWithDirtyFile
     22Adding file system.
     23 - hasDivergedFromVM: false
     24Editing uiSourceCode:
     25 - hasDivergedFromVM: true
     26Committing uiSourceCode with live edit failure:
     27 - hasDivergedFromVM: true
     28Editing uiSourceCode again:
     29 - hasDivergedFromVM: true
     30Committing uiSourceCode again (with live edit success now):
     31 - hasDivergedFromVM: false
     32Reloading page:
     33 - hasDivergedFromVM: false
     34Editing uiSourceCode again and reloading while it is dirty:
     35 - hasDivergedFromVM: true
     36
  • trunk/LayoutTests/inspector/debugger/file-system-project-mapping.html

    r145536 r145539  
    8787            InspectorTest.testFileMapping.setMappingEntries([]);
    8888            next();
     89        },
     90
     91        function testScriptFileOnReloadWithDirtyFile(next)
     92        {
     93            function uiSourceCodeAdded(uiSourceCode) { }
     94
     95            function reload()
     96            {
     97                resourceScriptMapping._debuggerReset();
     98                defaultScriptMapping._debuggerReset();
     99                script = InspectorTest.createScriptMock("http://localhost/html/foo.js", 0, 0, false, "<foo content>");
     100                InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 1);
     101                defaultScriptMapping.addScript(script);
     102                resourceScriptMapping.addScript(script);
     103            }
     104
     105            var fileSystemPath = "/var/www";
     106            var fileSystemProjectId = WebInspector.FileSystemProjectDelegate.projectId(fileSystemPath);
     107            var files = {"/html/foo.js": "<foo content>", "/bar.js": "<bar content>"};
     108            createObjects();
     109            var entry1 = new WebInspector.FileMapping.Entry("http://localhost/", "/var/www/");
     110            InspectorTest.testFileMapping.setMappingEntries([entry1]);
     111            InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 2);
     112            InspectorTest.addResult("Adding file system.");
     113            manager.addMockFileSystem(fileSystemPath, files);
     114
     115            reload();
     116
     117            var uiSourceCode = InspectorTest.testWorkspace.uiSourceCode(fileSystemProjectId, ["html", "foo.js"]);
     118            InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
     119            InspectorTest.addResult("Editing uiSourceCode:");
     120            uiSourceCode.setWorkingCopy("<foo content edited>");
     121            InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
     122
     123            function setScriptSourceOverrideFailure(scriptId, newContent, callback)
     124            {
     125                callback("error");
     126            }
     127            InspectorTest.override(WebInspector.debuggerModel, "setScriptSource", setScriptSourceOverrideFailure);
     128            InspectorTest.addResult("Committing uiSourceCode with live edit failure:");
     129            uiSourceCode.commitWorkingCopy(function() { });
     130            InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
     131
     132            InspectorTest.addResult("Editing uiSourceCode again:");
     133            uiSourceCode.setWorkingCopy("<foo content edited again>");
     134            InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
     135
     136            function setScriptSourceOverrideSuccess(scriptId, newContent, callback)
     137            {
     138                callback();
     139            }
     140            InspectorTest.override(WebInspector.debuggerModel, "setScriptSource", setScriptSourceOverrideSuccess);
     141            InspectorTest.addResult("Committing uiSourceCode again (with live edit success now):");
     142            uiSourceCode.commitWorkingCopy(function() { });
     143            InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
     144
     145            InspectorTest.addResult("Reloading page:");
     146            reload();
     147            InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
     148
     149            InspectorTest.addResult("Editing uiSourceCode again and reloading while it is dirty:");
     150            uiSourceCode.setWorkingCopy("<foo content edited and dirty>");
     151            reload();
     152            InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
     153            next();
    89154        }
    90155    ]);
     
    93158</head>
    94159<body onload="runTest()">
    95 <p>Tests file system project.</p>
     160<p>Tests file system project mappings.</p>
    96161</body>
    97162</html>
  • trunk/Source/WebCore/ChangeLog

    r145538 r145539  
     12013-03-12  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: ResourceScriptFile diverged state should be correctly reset after debugger reset.
     4        https://bugs.webkit.org/show_bug.cgi?id=112036
     5
     6        Reviewed by Alexander Pavlov.
     7
     8        * inspector/front-end/ResourceScriptMapping.js:
     9        (WebInspector.ResourceScriptFile):
     10        (WebInspector.ResourceScriptFile.prototype._workingCopyChanged):
     11        (WebInspector.ResourceScriptFile.prototype._maybeDirtyChanged):
     12
    1132013-03-12  Marja Hölttä  <marja@chromium.org>
    214
  • trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js

    r144669 r145539  
    265265    this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
    266266    this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
     267    this._maybeDirtyChanged(false);
    267268}
    268269
     
    297298    {
    298299        var wasDirty = /** @type {boolean} */ (event.data.wasDirty);
     300        this._maybeDirtyChanged(wasDirty);
     301    },
     302
     303    _maybeDirtyChanged: function(wasDirty)
     304    {
    299305        if (!wasDirty && this._uiSourceCode.isDirty() && !this._hasDivergedFromVM) {
    300306            this._isDivergingFromVM = true;
Note: See TracChangeset for help on using the changeset viewer.