Diff
Modified: trunk/LayoutTests/ChangeLog (243354 => 243355)
--- trunk/LayoutTests/ChangeLog 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/LayoutTests/ChangeLog 2019-03-22 02:33:38 UTC (rev 243355)
@@ -1,3 +1,17 @@
+2019-03-21 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: Timelines - Cannot export on about:blank - suggested filename containing a colon silently fails
+ https://bugs.webkit.org/show_bug.cgi?id=196109
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/unit-tests/file-utilities-expected.txt: Added.
+ * inspector/unit-tests/file-utilities.html: Added.
+ Tests for FileUtilities.js
+
+ * inspector/unit-tests/object-utilities.html:
+ * inspector/unit-tests/promise-utilities.html:
+
2019-03-21 Chris Dumez <cdu...@apple.com>
[ Mac WK2 ] Layout Test http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-iframe-with-enforced-and-report-policies.html is a flaky failure
Added: trunk/LayoutTests/inspector/unit-tests/file-utilities-expected.txt (0 => 243355)
--- trunk/LayoutTests/inspector/unit-tests/file-utilities-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/unit-tests/file-utilities-expected.txt 2019-03-22 02:33:38 UTC (rev 243355)
@@ -0,0 +1,16 @@
+
+== Running test suite: FileUtilities
+-- Running test case: FileUtilities.sanitizeFilename
+PASS: FileUtilities.sanitizeFilename: "" => ""
+PASS: FileUtilities.sanitizeFilename: "webkit.org-recording.json" => "webkit.org-recording.json"
+PASS: FileUtilities.sanitizeFilename: "abcABC012-_ test.tXt" => "abcABC012-_ test.tXt"
+PASS: FileUtilities.sanitizeFilename: "about:blank.json" => "about-blank.json"
+PASS: FileUtilities.sanitizeFilename: "a::::b" => "a-b"
+
+-- Running test case: FileUtilities.inspectorURLForFilename
+PASS: FileUtilities.inspectorURLForFilename: "" => "web-inspector:///"
+PASS: FileUtilities.inspectorURLForFilename: "webkit.org-recording.json" => "web-inspector:///webkit.org-recording.json"
+PASS: FileUtilities.inspectorURLForFilename: "abcABC012-_test.tXt" => "web-inspector:///abcABC012-_test.tXt"
+PASS: FileUtilities.inspectorURLForFilename: "a:b.json" => "web-inspector:///a-b.json"
+PASS: FileUtilities.inspectorURLForFilename: "a b.txt" => "web-inspector:///a%20b.txt"
+
Added: trunk/LayoutTests/inspector/unit-tests/file-utilities.html (0 => 243355)
--- trunk/LayoutTests/inspector/unit-tests/file-utilities.html (rev 0)
+++ trunk/LayoutTests/inspector/unit-tests/file-utilities.html 2019-03-22 02:33:38 UTC (rev 243355)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+ let suite = InspectorTest.createSyncSuite("FileUtilities");
+
+ suite.addTestCase({
+ name: "FileUtilities.sanitizeFilename",
+ test() {
+ function t(str, expected) {
+ expected = expected || str;
+ InspectorTest.expectEqual(WI.FileUtilities.sanitizeFilename(str), expected, `FileUtilities.sanitizeFilename: ${JSON.stringify(str)} => ${JSON.stringify(expected)}`);
+ }
+
+ t("");
+ t("webkit.org-recording.json");
+ t("abcABC012-_ test.tXt");
+ t("about:blank.json", "about-blank.json");
+ t("a::::b", "a-b");
+ }
+ });
+
+ suite.addTestCase({
+ name: "FileUtilities.inspectorURLForFilename",
+ test() {
+ function t(str, expected) {
+ expected = expected || ("web-inspector:///" + str);
+ InspectorTest.expectEqual(WI.FileUtilities.inspectorURLForFilename(str), expected, `FileUtilities.inspectorURLForFilename: ${JSON.stringify(str)} => ${JSON.stringify(expected)}`);
+ }
+
+ t("");
+ t("webkit.org-recording.json");
+ t("abcABC012-_test.tXt");
+ t("a:b.json", "web-inspector:///a-b.json");
+ t("a b.txt", "web-inspector:///a%20b.txt");
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onLoad_="runTest()">
+</body>
+</html>
Modified: trunk/LayoutTests/inspector/unit-tests/object-utilities.html (243354 => 243355)
--- trunk/LayoutTests/inspector/unit-tests/object-utilities.html 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/LayoutTests/inspector/unit-tests/object-utilities.html 2019-03-22 02:33:38 UTC (rev 243355)
@@ -3,7 +3,6 @@
<head>
<script src=""
<script>
-
function test()
{
let suite = InspectorTest.createSyncSuite("ObjectUtilities");
Modified: trunk/LayoutTests/inspector/unit-tests/promise-utilities.html (243354 => 243355)
--- trunk/LayoutTests/inspector/unit-tests/promise-utilities.html 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/LayoutTests/inspector/unit-tests/promise-utilities.html 2019-03-22 02:33:38 UTC (rev 243355)
@@ -3,7 +3,6 @@
<head>
<script src=""
<script>
-
function test()
{
let suite = InspectorTest.createAsyncSuite("Promise");
Modified: trunk/Source/WebInspectorUI/ChangeLog (243354 => 243355)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-03-22 02:33:38 UTC (rev 243355)
@@ -1,3 +1,50 @@
+2019-03-21 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: Timelines - Cannot export on about:blank - suggested filename containing a colon silently fails
+ https://bugs.webkit.org/show_bug.cgi?id=196109
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Base/FileUtilities.js:
+ (WI.FileUtilities.sanitizeFilename):
+ (WI.FileUtilities.inspectorURLForFilename):
+ New utility functions.
+
+ * UserInterface/Test.html:
+ Include FileUtilities.
+
+ * UserInterface/Base/Main.js:
+ * UserInterface/Controllers/AuditManager.js:
+ (WI.AuditManager.prototype.export):
+ * UserInterface/Debug/ProtocolTrace.js:
+ (WI.ProtocolTrace.prototype.get saveData):
+ (WI.ProtocolTrace):
+ * UserInterface/Views/ConsoleMessageView.js:
+ (WI.ConsoleMessageView.prototype._handleContextMenu):
+ (WI.ConsoleMessageView):
+ * UserInterface/Views/ContextMenuUtilities.js:
+ * UserInterface/Views/HeapSnapshotContentView.js:
+ (WI.HeapSnapshotContentView.prototype._exportSnapshot):
+ * UserInterface/Views/LogContentView.js:
+ (WI.LogContentView.prototype.get saveData):
+ (WI.LogContentView.prototype._handleContextMenuEvent):
+ * UserInterface/Views/NetworkTableContentView.js:
+ (WI.NetworkTableContentView.prototype._exportHAR):
+ * UserInterface/Views/RecordingContentView.js:
+ (WI.RecordingContentView.prototype._exportRecording):
+ (WI.RecordingContentView.prototype._exportReduction):
+ * UserInterface/Views/ScriptContentView.js:
+ (WI.ScriptContentView.prototype.get saveData):
+ * UserInterface/Views/ShaderProgramContentView.js:
+ (WI.ShaderProgramContentView.prototype.get saveData):
+ * UserInterface/Views/TextContentView.js:
+ (WI.TextContentView.prototype.get saveData):
+ * UserInterface/Views/TextResourceContentView.js:
+ (WI.TextResourceContentView.prototype.get saveData):
+ * UserInterface/Views/TimelineRecordingContentView.js:
+ (WI.TimelineRecordingContentView.prototype._exportTimelineRecording):
+ Update "web-inspector:///" URL building code to use the utility.
+
2019-03-21 Nikita Vasilyev <nvasil...@apple.com>
Web Inspector: Use CSS variables for text color in Computed panel
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/FileUtilities.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Base/FileUtilities.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/FileUtilities.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -38,6 +38,16 @@
return WI.UIString("Screen Shot %s-%s-%s at %s.%s.%s").format(...values);
}
+ static sanitizeFilename(filename)
+ {
+ return filename.replace(/:+/g, "-");
+ }
+
+ static inspectorURLForFilename(filename)
+ {
+ return "web-inspector:///" + encodeURIComponent(FileUtilities.sanitizeFilename(filename));
+ }
+
static save(saveData, forceSaveAs)
{
console.assert(saveData);
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -3078,7 +3078,7 @@
let mainFrame = WI.networkManager.mainFrame;
let archiveName = mainFrame.mainResource.urlComponents.host || mainFrame.mainResource.displayName || "Archive";
- let url = "" + encodeURI(archiveName) + ".webarchive";
+ let url = "" + ".webarchive");
InspectorFrontendHost.save(url, data, true, true);
});
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -232,10 +232,8 @@
if (object instanceof WI.AuditTestResultBase)
filename = WI.UIString("%s Result").format(filename);
- let url = "" + encodeURI(filename) + ".json";
-
WI.FileUtilities.save({
- url,
+ url: WI.FileUtilities.inspectorURLForFilename(filename + ".json"),
content: JSON.stringify(object),
forceSaveAs: true,
});
Modified: trunk/Source/WebInspectorUI/UserInterface/Debug/ProtocolTrace.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Debug/ProtocolTrace.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Debug/ProtocolTrace.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -51,6 +51,9 @@
// "Protocol Trace 2015-12-31 at 12.43.04.json".
// When the Intl API is implemented, we can do a better job.
let filename = WI.unlocalizedString(`Protocol Trace at ${YYYY}-${MM}-${DD} ${hh}.${mm}.${ss}.json`);
- return {url: "web-inspector:///" + encodeURIComponent(filename), content: JSON.stringify(this._entries)};
+ return {
+ url: WI.FileUtilities.inspectorURLForFilename(filename),
+ content: JSON.stringify(this._entries),
+ };
}
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Test.html (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Test.html 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Test.html 2019-03-22 02:33:38 UTC (rev 243355)
@@ -57,6 +57,7 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -951,7 +951,7 @@
contextMenu.appendItem(WI.UIString("Save Image"), () => {
const forceSaveAs = true;
WI.FileUtilities.save({
- url: encodeURI("web-inspector:///" + image.getAttribute("filename")),
+ url: WI.FileUtilities.inspectorURLForFilename(image.getAttribute("filename")),
content: parseDataURL(this._message.messageText).data,
base64Encoded: true,
}, forceSaveAs);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -253,7 +253,7 @@
}
WI.FileUtilities.save({
- url: encodeURI(`web-inspector:///${WI.FileUtilities.screenshotString()}.png`),
+ url: WI.FileUtilities.inspectorURLForFilename(WI.FileUtilities.screenshotString() + ".png"),
content: parseDataURL(dataURL).data,
base64Encoded: true,
});
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotContentView.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotContentView.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapSnapshotContentView.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -103,9 +103,8 @@
Number.zeroPad(date.getSeconds(), 2),
];
let filename = WI.UIString("Heap Snapshot %s-%s-%s at %s.%s.%s").format(...values);
- let url = "" + encodeURI(filename) + ".json";
WI.FileUtilities.save({
- url,
+ url: WI.FileUtilities.inspectorURLForFilename(filename + ".json"),
content: this.representedObject.snapshotStringData,
forceSaveAs: true,
});
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -265,7 +265,11 @@
get saveData()
{
- return {url: "web-inspector:///Console.txt", content: this._formatMessagesAsData(false), forceSaveAs: true};
+ return {
+ url: WI.FileUtilities.inspectorURLForFilename("Console.txt"),
+ content: this._formatMessagesAsData(false),
+ forceSaveAs: true,
+ };
}
handleCopyEvent(event)
@@ -495,7 +499,7 @@
contextMenu.appendItem(WI.UIString("Save Selected"), () => {
const forceSaveAs = true;
WI.FileUtilities.save({
- url: "web-inspector:///Console.txt",
+ url: WI.FileUtilities.inspectorURLForFilename("Console.txt"),
content: this._formatMessagesAsData(true),
}, forceSaveAs);
});
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -2108,9 +2108,8 @@
WI.HARBuilder.buildArchive(resources).then((har) => {
let mainFrame = WI.networkManager.mainFrame;
let archiveName = mainFrame.mainResource.urlComponents.host || mainFrame.mainResource.displayName || "Archive";
- let url = "" + encodeURI(archiveName) + ".har";
WI.FileUtilities.save({
- url,
+ url: WI.FileUtilities.inspectorURLForFilename(archiveName + ".har"),
content: JSON.stringify(har, null, 2),
forceSaveAs: true,
});
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RecordingContentView.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -176,10 +176,9 @@
_exportRecording()
{
let filename = this.representedObject.displayName;
- let url = "" + encodeURI(filename) + ".json";
WI.FileUtilities.save({
- url,
+ url: WI.FileUtilities.inspectorURLForFilename(filename + ".json"),
content: JSON.stringify(this.representedObject.toJSON()),
forceSaveAs: true,
});
@@ -193,10 +192,9 @@
}
let filename = this.representedObject.displayName;
- let url = "" + encodeURI(filename) + ".html";
WI.FileUtilities.save({
- url,
+ url: WI.FileUtilities.inspectorURLForFilename(filename + ".html"),
content: this.representedObject.toHTML(),
forceSaveAs: true,
});
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -154,7 +154,7 @@
get saveData()
{
- var url = "" || "web-inspector:///" + encodeURI(this._script.displayName) + ".js";
+ let url = "" || WI.FileUtilities.inspectorURLForFilename(this._script.displayName + ".js");
return {url, content: this._textEditor.string};
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ShaderProgramContentView.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -121,7 +121,7 @@
filename = WI.UIString("Fragment");
return {
- url: `web-inspector:///${filename}.glsl`,
+ url: WI.FileUtilities.inspectorURLForFilename(filename + ".glsl"),
content: this._lastActiveEditor.string,
forceSaveAs: true,
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextContentView.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TextContentView.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextContentView.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -106,7 +106,7 @@
get saveData()
{
- var url = "" + encodeURI(WI.UIString("Untitled")) + ".txt";
+ let url = "" + ".txt");
return {url, content: this._textEditor.string, forceSaveAs: true};
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -143,8 +143,10 @@
get saveData()
{
- if (this.resource instanceof WI.CSSStyleSheet)
- return {url: "web-inspector:///InspectorStyleSheet.css", content: this._textEditor.string, forceSaveAs: true};
+ if (this.resource instanceof WI.CSSStyleSheet) {
+ let url = ""
+ return {url, content: this._textEditor.string, forceSaveAs: true};
+ }
return {url: this.resource.url, content: this._textEditor.string};
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (243354 => 243355)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js 2019-03-22 02:26:09 UTC (rev 243354)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js 2019-03-22 02:33:38 UTC (rev 243355)
@@ -604,9 +604,9 @@
frameName = mainFrame.mainResource.urlComponents.host || mainFrame.mainResource.displayName;
let filename = frameName ? `${frameName}-recording` : this._recording.displayName;
- let url = "" + encodeURI(filename) + ".json";
+
WI.FileUtilities.save({
- url,
+ url: WI.FileUtilities.inspectorURLForFilename(filename + ".json"),
content: JSON.stringify(json),
forceSaveAs: true,
});