DevTools: [Workspace] fix removing stylesheet-related uiSourceCodes

The patch fixes a bug in removing uiSourceCodes from workspace as
the associated stylesheet gets removed.

BUG=424544
R=vsevik

Review URL: https://codereview.chromium.org/661923005

git-svn-id: svn://svn.chromium.org/blink/trunk@183915 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 09de5eae
......@@ -28,7 +28,11 @@ UISourceCode: http://fake.url/4
Highlighter type: text/css
UISourceCode content: <stylesheet resource content>
Running: testRemoveStyleSheetFromModel
Running: testRemoveStyleSheetFromModelWithComplexURL
Added uiSourceCode: http://example.com/foo.css
Removed uiSourceCode: http://example.com/foo.css
Running: testRemoveStyleSheetFromModelWithSimpleURL
Added uiSourceCode: foo.css
Removed uiSourceCode: foo.css
......@@ -8,15 +8,20 @@ function test()
{
var mockContentsMap = {};
var lastResourceId = 0;
var lastStyleSheetId = 0;
var mockStyleSheetHeader = {
styleSheetId: "1",
sourceURL: "foo.css",
function createMockStyleSheetHeader(url)
{
return {
styleSheetId: (++lastStyleSheetId) + "",
sourceURL: url,
sourceMapURL: "",
origin: "regular",
title: "",
disabled: false
};
}
NetworkAgent.getResponseBody = function(requestId, callback)
{
......@@ -138,7 +143,20 @@ function test()
}
},
function testRemoveStyleSheetFromModel(next)
function testRemoveStyleSheetFromModelWithComplexURL(next)
{
var mockStyleSheetHeader = createMockStyleSheetHeader("http://example.com/foo.css");
testRemoveStyleSheetFromModel(mockStyleSheetHeader, next);
},
function testRemoveStyleSheetFromModelWithSimpleURL(next)
{
var mockStyleSheetHeader = createMockStyleSheetHeader("foo.css");
testRemoveStyleSheetFromModel(mockStyleSheetHeader, next);
}
]);
function testRemoveStyleSheetFromModel(mockStyleSheetHeader, callback)
{
var networkUISourceCodeProvider = createNetworkUISourceCodeProvider();
var target = WebInspector.targetManager.mainTarget();
......@@ -155,10 +173,9 @@ function test()
function uiSourceCodeRemoved(uiSourceCode)
{
InspectorTest.addResult("Removed uiSourceCode: " + InspectorTest.uiSourceCodeURL(uiSourceCode));
next();
callback();
}
}
]);
};
</script>
</head>
......
......@@ -153,8 +153,9 @@ WebInspector.NetworkWorkspaceBinding.prototype = {
{
var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
var projectName = splitURL[0];
var path = splitURL.slice(1).join("/");
var projectDelegate = this._projectDelegates[projectName];
projectDelegate.removeFile(url);
projectDelegate.removeFile(path);
},
reset: function()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment