Diff
Modified: trunk/LayoutTests/ChangeLog (126846 => 126847)
--- trunk/LayoutTests/ChangeLog 2012-08-28 06:33:34 UTC (rev 126846)
+++ trunk/LayoutTests/ChangeLog 2012-08-28 06:41:45 UTC (rev 126847)
@@ -1,3 +1,16 @@
+2012-08-27 Taiju Tsuiki <[email protected]>
+
+ Web Inspector: Add delete button to FileSystemView
+ https://bugs.webkit.org/show_bug.cgi?id=93940
+
+ Reviewed by Vsevolod Vlasov.
+
+ Adding status bar button to allow user to delete entries in FileSystem
+ for debugging use.
+
+ * http/tests/inspector/filesystem/delete-entry-expected.txt: Added.
+ * http/tests/inspector/filesystem/delete-entry.html: Added.
+
2012-08-27 Zan Dobersek <[email protected]>
Unreviewed GTK gardening.
Added: trunk/LayoutTests/http/tests/inspector/filesystem/delete-entry-expected.txt (0 => 126847)
--- trunk/LayoutTests/http/tests/inspector/filesystem/delete-entry-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/filesystem/delete-entry-expected.txt 2012-08-28 06:41:45 UTC (rev 126847)
@@ -0,0 +1,11 @@
+Tests deleteEntry command.
+
+errorCode: 2
+errorCode: 8
+errorCode: 0
+errorCode: 0
+errorCode: 0
+errorCode: 1
+backendRootEntry: (null)
+
+
Property changes on: trunk/LayoutTests/http/tests/inspector/filesystem/delete-entry-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/http/tests/inspector/filesystem/delete-entry.html (0 => 126847)
--- trunk/LayoutTests/http/tests/inspector/filesystem/delete-entry.html (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/filesystem/delete-entry.html 2012-08-28 06:41:45 UTC (rev 126847)
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<script src=""
+<script src=""
+<script>
+document.addEventListener("DOMContentLoaded", runTest);
+function test()
+{
+ var fileSystemRequestManager = new WebInspector.FileSystemRequestManager();
+
+ var testStep = [
+ function()
+ {
+ InspectorTest.createFile("/hoge", testStep.shift());
+ },
+
+ function()
+ {
+ InspectorTest.createDirectory("/fuga", testStep.shift());
+ },
+
+ function()
+ {
+ InspectorTest.createFile("/fuga/piyo", testStep.shift());
+ },
+
+ function()
+ {
+ InspectorTest.createDirectory("/foo", testStep.shift());
+ },
+
+ function()
+ {
+ fileSystemRequestManager.deleteEntry("InvalidURL", testStep.shift());
+ },
+
+ function(errorCode)
+ {
+ InspectorTest.addResult("errorCode: " + errorCode);
+ fileSystemRequestManager.deleteEntry("filesystem:http://127.0.0.1:8000/InvalidType/fuga", testStep.shift());
+ },
+
+ function(errorCode)
+ {
+ InspectorTest.addResult("errorCode: " + errorCode);
+ fileSystemRequestManager.deleteEntry("filesystem:http://127.0.0.1:8000/temporary/hoge", testStep.shift());
+ },
+
+ function(errorCode)
+ {
+ InspectorTest.addResult("errorCode: " + errorCode);
+ fileSystemRequestManager.deleteEntry("filesystem:http://127.0.0.1:8000/temporary/fuga", testStep.shift());
+ },
+
+ function(errorCode)
+ {
+ InspectorTest.addResult("errorCode: " + errorCode);
+ fileSystemRequestManager.deleteEntry("filesystem:http://127.0.0.1:8000/temporary/", testStep.shift());
+ },
+
+ function(errorCode)
+ {
+ InspectorTest.addResult("errorCode: " + errorCode);
+ fileSystemRequestManager.requestFileSystemRoot("http://127.0.0.1:8000", "temporary", testStep.shift());
+ },
+
+ function(errorCode, backendRootEntry)
+ {
+ InspectorTest.dumpFileSystemRootRequestResult(errorCode, backendRootEntry);
+ InspectorTest.completeTest();
+ }
+ ];
+
+ InspectorTest.clearFileSystem(testStep.shift());
+}
+</script>
+</head>
+<body>
+<p>Tests deleteEntry command.</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector/filesystem/delete-entry.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (126846 => 126847)
--- trunk/Source/WebCore/ChangeLog 2012-08-28 06:33:34 UTC (rev 126846)
+++ trunk/Source/WebCore/ChangeLog 2012-08-28 06:41:45 UTC (rev 126847)
@@ -1,3 +1,35 @@
+2012-08-27 Taiju Tsuiki <[email protected]>
+
+ Web Inspector: Add delete button to FileSystemView
+ https://bugs.webkit.org/show_bug.cgi?id=93940
+
+ Reviewed by Vsevolod Vlasov.
+
+ Adding status bar button to allow user to delete entries in FileSystem
+ for debugging use.
+
+ Test: http/tests/inspector/filesystem/delete-entry.html
+
+ * inspector/front-end/FileSystemModel.js:
+ (WebInspector.FileSystemModel.prototype.requestFileContent):
+ (WebInspector.FileSystemModel.prototype.deleteEntry.hookFileSystemDeletion):
+ (WebInspector.FileSystemModel.prototype.deleteEntry):
+ (WebInspector.FileSystemModel.prototype._removeFileSystem):
+ (WebInspector.FileSystemModel.Entry.prototype.deleteEntry):
+ (WebInspector.FileSystemRequestManager):
+ (WebInspector.FileSystemRequestManager.prototype.deleteEntry.requestAccepted):
+ (WebInspector.FileSystemRequestManager.prototype.deleteEntry):
+ (WebInspector.FileSystemRequestManager.prototype._deletionCompleted):
+ (WebInspector.FileSystemDispatcher.prototype.deletionCompleted):
+ * inspector/front-end/FileSystemView.js:
+ (WebInspector.FileSystemView):
+ (WebInspector.FileSystemView.prototype.get statusBarItems):
+ (WebInspector.FileSystemView.prototype._refresh):
+ (WebInspector.FileSystemView.prototype._confirmDelete):
+ (WebInspector.FileSystemView.prototype._delete):
+ (WebInspector.FileSystemView.EntryTreeElement.prototype.deleteEntry):
+ (WebInspector.FileSystemView.EntryTreeElement.prototype._deletionCompleted):
+
2012-08-27 Yoshifumi Inoue <[email protected]>
[ShadowDOM] Shadow elements in the input element should be focusable.
Modified: trunk/Source/WebCore/inspector/front-end/FileSystemModel.js (126846 => 126847)
--- trunk/Source/WebCore/inspector/front-end/FileSystemModel.js 2012-08-28 06:33:34 UTC (rev 126846)
+++ trunk/Source/WebCore/inspector/front-end/FileSystemModel.js 2012-08-28 06:41:45 UTC (rev 126847)
@@ -197,7 +197,7 @@
*/
_fileSystemRootReceived: function(origin, type, store, errorCode, backendRootEntry)
{
- if (errorCode === 0 && backendRootEntry && this._fileSystemsForOrigin[origin] === store) {
+ if (!errorCode && backendRootEntry && this._fileSystemsForOrigin[origin] === store) {
var fileSystem = new WebInspector.FileSystemModel.FileSystem(this, origin, type, backendRootEntry);
store[type] = fileSystem;
this._fileSystemAdded(fileSystem);
@@ -257,6 +257,42 @@
requestFileContent: function(file, readAsText, start, end, charset, callback)
{
this._agentWrapper.requestFileContent(file.url, readAsText, start, end, charset, callback);
+ },
+
+ /**
+ * @param {WebInspector.FileSystemModel.Entry} entry
+ * @param {function(number)=} callback
+ */
+ deleteEntry: function(entry, callback)
+ {
+ var fileSystemModel = this;
+ if (entry === entry.fileSystem.root)
+ this._agentWrapper.deleteEntry(entry.url, hookFileSystemDeletion);
+ else
+ this._agentWrapper.deleteEntry(entry.url, callback);
+
+ function hookFileSystemDeletion(errorCode)
+ {
+ callback(errorCode);
+ if (!errorCode)
+ fileSystemModel._removeFileSystem(entry.fileSystem);
+ }
+ },
+
+ /**
+ * @param {WebInspector.FileSystemModel.FileSystem} fileSystem
+ */
+ _removeFileSystem: function(fileSystem)
+ {
+ var origin = fileSystem.origin;
+ var type = fileSystem.type;
+ if (this._fileSystemsForOrigin[origin] && this._fileSystemsForOrigin[origin][type]) {
+ delete this._fileSystemsForOrigin[origin][type];
+ this._fileSystemRemoved(fileSystem);
+
+ if (Object.isEmpty(this._fileSystemsForOrigin[origin]))
+ delete this._fileSystemsForOrigin[origin];
+ }
}
}
@@ -367,6 +403,14 @@
requestMetadata: function(callback)
{
this.fileSystemModel.requestMetadata(this, callback);
+ },
+
+ /**
+ * @param {function(number)} callback
+ */
+ deleteEntry: function(callback)
+ {
+ this.fileSystemModel.deleteEntry(this, callback);
}
}
@@ -459,6 +503,7 @@
this._pendingDirectoryContentRequests = {};
this._pendingMetadataRequests = {};
this._pendingFileContentRequests = {};
+ this._pendingDeleteEntryRequests = {};
InspectorBackend.registerFileSystemDispatcher(new WebInspector.FileSystemDispatcher(this));
FileSystemAgent.enable();
@@ -592,6 +637,37 @@
return;
delete this._pendingFileContentRequests[requestId];
callback(errorCode, content, charset);
+ },
+
+ /**
+ * @param {string} url
+ * @param {function(number)=} callback
+ */
+ deleteEntry: function(url, callback)
+ {
+ var store = this._pendingDeleteEntryRequests;
+ FileSystemAgent.deleteEntry(url, requestAccepted);
+
+ function requestAccepted(error, requestId)
+ {
+ if (error)
+ callback(FileError.SECURITY_ERR);
+ else
+ store[requestId] = callback || function() {};
+ }
+ },
+
+ /**
+ * @param {number} requestId
+ * @param {number} errorCode
+ */
+ _deletionCompleted: function(requestId, errorCode)
+ {
+ var callback = /** @type {function(number)} */ this._pendingDeleteEntryRequests[requestId];
+ if (!callback)
+ return;
+ delete this._pendingDeleteEntryRequests[requestId];
+ callback(errorCode);
}
}
@@ -653,6 +729,6 @@
*/
deletionCompleted: function(requestId, errorCode)
{
- console.error("Not implemented");
+ this._agentWrapper._deletionCompleted(requestId, errorCode);
}
}
Modified: trunk/Source/WebCore/inspector/front-end/FileSystemView.js (126846 => 126847)
--- trunk/Source/WebCore/inspector/front-end/FileSystemView.js 2012-08-28 06:33:34 UTC (rev 126846)
+++ trunk/Source/WebCore/inspector/front-end/FileSystemView.js 2012-08-28 06:41:45 UTC (rev 126847)
@@ -53,6 +53,10 @@
this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
this._refreshButton.visible = true;
this._refreshButton.addEventListener("click", this._refresh, this);
+
+ this._deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
+ this._deleteButton.visible = true;
+ this._deleteButton.addEventListener("click", this._confirmDelete, this);
}
WebInspector.FileSystemView.prototype = {
@@ -61,7 +65,7 @@
*/
get statusBarItems()
{
- return [this._refreshButton.element];
+ return [this._refreshButton.element, this._deleteButton.element];
},
/**
@@ -88,6 +92,17 @@
_refresh: function()
{
this._directoryTree.children[0].refresh();
+ },
+
+ _confirmDelete: function()
+ {
+ if (confirm(WebInspector.UIString("Are you sure you want to delete the selected entry?")))
+ this._delete();
+ },
+
+ _delete: function()
+ {
+ this._directoryTree.selectedTreeElement.deleteEntry();
}
}
@@ -201,6 +216,17 @@
}
} else
this._entry.requestDirectoryContent(this._directoryContentReceived.bind(this));
+ },
+
+ deleteEntry: function()
+ {
+ this._entry.deleteEntry(this._deletionCompleted.bind(this));
+ },
+
+ _deletionCompleted: function()
+ {
+ if (this._entry != this._entry.fileSystem.root)
+ this.parent.refresh();
}
}