Title: [244576] trunk/Source/WebInspectorUI
- Revision
- 244576
- Author
- [email protected]
- Date
- 2019-04-23 18:20:32 -0700 (Tue, 23 Apr 2019)
Log Message
Web Inspector: Network: support drag/drop for importing
https://bugs.webkit.org/show_bug.cgi?id=197221
Reviewed by Timothy Hatcher.
* UserInterface/Views/NetworkTabContentView.js:
(WI.NetworkTabContentView.prototype.async.handleFileDrop): Added.
* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype.processHAR): Added.
(WI.NetworkTableContentView.prototype._importHAR):
* UserInterface/Base/FileUtilities.js:
(WI.FileUtilities.async readText):
Only `await` if the result is a `Promise`.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (244575 => 244576)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-04-24 00:52:41 UTC (rev 244575)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-04-24 01:20:32 UTC (rev 244576)
@@ -1,5 +1,22 @@
2019-04-23 Devin Rousso <[email protected]>
+ Web Inspector: Network: support drag/drop for importing
+ https://bugs.webkit.org/show_bug.cgi?id=197221
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Views/NetworkTabContentView.js:
+ (WI.NetworkTabContentView.prototype.async.handleFileDrop): Added.
+ * UserInterface/Views/NetworkTableContentView.js:
+ (WI.NetworkTableContentView.prototype.processHAR): Added.
+ (WI.NetworkTableContentView.prototype._importHAR):
+
+ * UserInterface/Base/FileUtilities.js:
+ (WI.FileUtilities.async readText):
+ Only `await` if the result is a `Promise`.
+
+2019-04-23 Devin Rousso <[email protected]>
+
Web Inspector: Uncaught Exception: null is not an object (evaluating 'this.ownerDocument.frameIdentifier')
https://bugs.webkit.org/show_bug.cgi?id=196420
<rdar://problem/49444205>
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/FileUtilities.js (244575 => 244576)
--- trunk/Source/WebInspectorUI/UserInterface/Base/FileUtilities.js 2019-04-24 00:52:41 UTC (rev 244575)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/FileUtilities.js 2019-04-24 01:20:32 UTC (rev 244576)
@@ -144,7 +144,7 @@
}
let promise = callback(result);
- if (promise)
+ if (promise instanceof Promise)
await promise;
}
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js (244575 => 244576)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js 2019-04-24 00:52:41 UTC (rev 244575)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js 2019-04-24 01:20:32 UTC (rev 244576)
@@ -83,6 +83,11 @@
super.closed();
}
+ async handleFileDrop(files)
+ {
+ await WI.FileUtilities.readJSON(files, (result) => this._networkTableContentView.processHAR(result));
+ }
+
// Public
get contentBrowser() { return this._contentBrowser; }
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js (244575 => 244576)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js 2019-04-24 00:52:41 UTC (rev 244575)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js 2019-04-24 01:20:32 UTC (rev 244576)
@@ -1242,6 +1242,23 @@
this._waterfallPopover.resize();
}
+ processHAR(result)
+ {
+ let resources = WI.networkManager.processHAR(result);
+ if (!resources)
+ return;
+
+ let importedCollection = this._addCollection();
+
+ let displayName = WI.UIString("Imported - %s").format(result.filename);
+ this._addCollectionPathComponent(importedCollection, displayName, "network-har-icon");
+
+ this._changeCollection(importedCollection);
+
+ for (let resource of resources)
+ this._insertResourceAndReloadTable(resource);
+ }
+
handleClearShortcut(event)
{
if (!this._isShowingMainCollection())
@@ -2135,21 +2152,7 @@
_importHAR()
{
- WI.FileUtilities.importJSON((result) => {
- let resources = WI.networkManager.processHAR(result);
- if (!resources)
- return;
-
- let importedCollection = this._addCollection();
-
- let displayName = WI.UIString("Imported - %s").format(result.filename);
- this._addCollectionPathComponent(importedCollection, displayName, "network-har-icon");
-
- this._changeCollection(importedCollection);
-
- for (let resource of resources)
- this._insertResourceAndReloadTable(resource);
- });
+ WI.FileUtilities.importJSON((result) => this.processHAR(result));
}
_waterfallPopoverContent()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes