Diff
Modified: trunk/Source/WebCore/ChangeLog (131871 => 131872)
--- trunk/Source/WebCore/ChangeLog 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/ChangeLog 2012-10-19 08:02:24 UTC (rev 131872)
@@ -1,3 +1,44 @@
+2012-10-19 Eugene Klyuchnikov <[email protected]>
+
+ Web Inspector: Saving HAR, snapshots and timeline data do not work in remote debugging mode
+ https://bugs.webkit.org/show_bug.cgi?id=99179
+
+ Reviewed by Yury Semikhatsky.
+
+ Added method "close" to InspectorFrontendHost.
+ Symantically, this method forces to flush all unsaved buffers for
+ specified file. In native implementation this turns to be no-op.
+
+ In stub implementation "close" causes compilation of blob object an
+ navigating to blob-schema url.
+
+ Removed "canAppend", as appending in now suppurted
+ by all implementations.
+
+ Repaced schema "data" with "blob" in InspectorFrontendHostStub "save"
+ to avoid out-of-memory errors.
+
+ * inspector/InspectorFrontendHost.cpp:
+ (WebCore::InspectorFrontendHost::close): Compiles blob object and
+ navigates to blob-object url.
+ (WebCore):
+ * inspector/InspectorFrontendHost.h: Added "close" method.
+ * inspector/InspectorFrontendHost.idl: Ditto.
+ * inspector/front-end/FileManager.js:
+ (WebInspector.FileManager.prototype.close): Proxy to InspectorFrontend.
+ * inspector/front-end/FileUtils.js:
+ (WebInspector.FileOutputStream.prototype.close):
+ Invoke "close" on FileManager.
+ (WebInspector.FileOutputStream.prototype._onAppendDone): Ditto.
+ * inspector/front-end/HandlerRegistry.js: Added mandatory "close" call.
+ * inspector/front-end/HeapSnapshotView.js:
+ (WebInspector.HeapProfileHeader.prototype.canSaveToFile): Fixed check.
+ * inspector/front-end/InspectorFrontendHostStub.js:
+ (.WebInspector.InspectorFrontendHostStub):
+ Added "appendable" behaviour emulation.
+ * inspector/front-end/SourceFrame.js: Added mandatory "close" call.
+ * inspector/front-end/externs.js: Replaced "canAppend" with "close"
+
2012-10-18 Dominic Mazzoni <[email protected]>
AX: labelForElement is slow when there are a lot of DOM elements
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (131871 => 131872)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp 2012-10-19 08:02:24 UTC (rev 131872)
@@ -250,6 +250,10 @@
m_client->append(url, content);
}
+void InspectorFrontendHost::close(const String&)
+{
+}
+
bool InspectorFrontendHost::canInspectWorkers()
{
#if ENABLE(WORKERS)
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (131871 => 131872)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h 2012-10-19 08:02:24 UTC (rev 131872)
@@ -77,6 +77,7 @@
bool canSave();
void save(const String& url, const String& content, bool forceSaveAs);
void append(const String& url, const String& content);
+ void close(const String& url);
bool canInspectWorkers();
Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (131871 => 131872)
--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl 2012-10-19 08:02:24 UTC (rev 131872)
@@ -54,6 +54,7 @@
boolean canSave();
void save(in DOMString url, in DOMString content, in boolean forceSaveAs);
void append(in DOMString url, in DOMString content);
+ void close(in DOMString url);
boolean canInspectWorkers();
Modified: trunk/Source/WebCore/inspector/front-end/FileManager.js (131871 => 131872)
--- trunk/Source/WebCore/inspector/front-end/FileManager.js 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/inspector/front-end/FileManager.js 2012-10-19 08:02:24 UTC (rev 131872)
@@ -51,14 +51,6 @@
},
/**
- * @return {boolean}
- */
- canAppend: function()
- {
- return InspectorFrontendHost.canSave() && ("append" in InspectorFrontendHost);
- },
-
- /**
* @param {string} url
* @param {string} content
* @param {boolean} forceSaveAs
@@ -105,6 +97,14 @@
/**
* @param {string} url
*/
+ close: function(url)
+ {
+ InspectorFrontendHost.close(url);
+ },
+
+ /**
+ * @param {string} url
+ */
appendedToURL: function(url)
{
this.dispatchEventToListeners(WebInspector.FileManager.EventTypes.AppendedToURL, url);
Modified: trunk/Source/WebCore/inspector/front-end/FileUtils.js (131871 => 131872)
--- trunk/Source/WebCore/inspector/front-end/FileUtils.js 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/inspector/front-end/FileUtils.js 2012-10-19 08:02:24 UTC (rev 131872)
@@ -385,6 +385,7 @@
if (this._writeCallbacks.length)
return;
WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.AppendedToURL, this._onAppendDone, this);
+ WebInspector.fileManager.close(this._fileName);
},
/**
@@ -395,8 +396,10 @@
if (event.data !== this._fileName)
return;
if (!this._writeCallbacks.length) {
- if (this._closed)
+ if (this._closed) {
WebInspector.fileManager.removeEventListener(WebInspector.FileManager.EventTypes.AppendedToURL, this._onAppendDone, this);
+ WebInspector.fileManager.close(this._fileName);
+ }
return;
}
var callback = this._writeCallbacks.shift();
Modified: trunk/Source/WebCore/inspector/front-end/HandlerRegistry.js (131871 => 131872)
--- trunk/Source/WebCore/inspector/front-end/HandlerRegistry.js 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/inspector/front-end/HandlerRegistry.js 2012-10-19 08:02:24 UTC (rev 131872)
@@ -132,7 +132,9 @@
function doSave(forceSaveAs, content)
{
- WebInspector.fileManager.save(contentProvider.contentURL(), content, forceSaveAs);
+ var url = ""
+ WebInspector.fileManager.save(url, content, forceSaveAs);
+ WebInspector.fileManager.close(url);
}
function save(forceSaveAs)
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js (131871 => 131872)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js 2012-10-19 08:02:24 UTC (rev 131872)
@@ -953,7 +953,7 @@
*/
canSaveToFile: function()
{
- return !this.fromFile() && this._snapshotProxy && !this._receiver && WebInspector.fileManager.canAppend();
+ return !this.fromFile() && !!this._snapshotProxy && !this._receiver;
},
/**
Modified: trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js (131871 => 131872)
--- trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js 2012-10-19 08:02:24 UTC (rev 131872)
@@ -38,6 +38,7 @@
{
this._attachedWindowHeight = 0;
this.isStub = true;
+ this._fileBuffers = {};
WebInspector.documentCopyEventFired = this.documentCopy.bind(this);
}
@@ -143,23 +144,43 @@
save: function(url, content, forceSaveAs)
{
- var blob = new Blob([content], { type: "application/octet-stream" });
+ if (this._fileBuffers[url])
+ throw new Error("Concurrent file modification denied.");
- var fr = new FileReader();
- fr._onload_ = function(e) {
- // Force download
- window.location = this.result;
- }
- fr.readAsDataURL(blob);
+ this._fileBuffers[url] = [content];
+ setTimeout(WebInspector.fileManager.savedURL.bind(WebInspector.fileManager, url), 0);
},
- canAppend: function()
+ append: function(url, content)
{
- return false;
+ var buffer = this._fileBuffers[url];
+ if (!buffer)
+ throw new Error("File is not open for write yet.");
+
+ buffer.push(content);
+ setTimeout(WebInspector.fileManager.appendedToURL.bind(WebInspector.fileManager, url), 0);
},
- append: function(url, content)
+ close: function(url)
{
+ var content = this._fileBuffers[url];
+ delete this._fileBuffers[url];
+
+ if (!content)
+ return;
+
+ var lastSlashIndex = url.lastIndexOf("/");
+ var fileNameSuffix = (lastSlashIndex === -1) ? url : url.substring(lastSlashIndex + 1);
+
+ var blob = new Blob(content, { type: "application/octet-stream" });
+ var objectUrl = window.URL.createObjectURL(blob);
+ window.location = objectUrl + "#" + fileNameSuffix;
+
+ function cleanup()
+ {
+ window.URL.revokeObjectURL(objectUrl);
+ }
+ setTimeout(cleanup, 0);
},
sendMessageToBackend: function(message)
Modified: trunk/Source/WebCore/inspector/front-end/UISourceCode.js (131871 => 131872)
--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js 2012-10-19 08:02:24 UTC (rev 131872)
@@ -192,8 +192,10 @@
delete this._workingCopy;
this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted, {oldWorkingCopy: oldWorkingCopy, workingCopy: this.workingCopy()});
WebInspector.workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted, { uiSourceCode: this, content: this._content });
- if (this._url && WebInspector.fileManager.isURLSaved(this._url))
+ if (this._url && WebInspector.fileManager.isURLSaved(this._url)) {
WebInspector.fileManager.save(this._url, this._content, false);
+ WebInspector.fileManager.close(this._url);
+ }
},
/**
Modified: trunk/Source/WebCore/inspector/front-end/externs.js (131871 => 131872)
--- trunk/Source/WebCore/inspector/front-end/externs.js 2012-10-19 08:01:06 UTC (rev 131871)
+++ trunk/Source/WebCore/inspector/front-end/externs.js 2012-10-19 08:02:24 UTC (rev 131872)
@@ -138,7 +138,7 @@
InspectorFrontendHostAPI.prototype.openInNewTab = function(url) {}
InspectorFrontendHostAPI.prototype.canSave = function() {}
InspectorFrontendHostAPI.prototype.save = function(url, content, forceSaveAs) {}
-InspectorFrontendHostAPI.prototype.canAppend = function() {}
+InspectorFrontendHostAPI.prototype.close = function(url) {}
InspectorFrontendHostAPI.prototype.append = function(url, content) {}
InspectorFrontendHostAPI.prototype.sendMessageToBackend = function(message) {}
InspectorFrontendHostAPI.prototype.recordActionTaken = function(actionCode) {}