Web Inspector: Inspecting a Main Resource that is JS/JSON does not format / syntax...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Mar 2017 20:57:11 +0000 (20:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 28 Mar 2017 20:57:11 +0000 (20:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=166862
<rdar://problem/29835977>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-03-28
Reviewed by Brian Burg.

Source/WebInspectorUI:

* UserInterface/Models/Resource.js:
(WebInspector.Resource.prototype.get syntheticMIMEType):
Don't override the mime type for Document resources. They should always
have a mime type and we should use whatever it is.

LayoutTests:

* http/tests/inspector/network/resource-mime-type-expected.txt: Added.
* http/tests/inspector/network/resource-mime-type.html: Added.
Test resource mime types for different resources.

* http/tests/inspector/network/resources/json.php: Added.
* http/tests/inspector/network/resources/script.js: Added.
* http/tests/inspector/network/resources/script.txt: Added.
* http/tests/inspector/network/resources/stylesheet.css: Added.
* http/tests/inspector/network/resources/stylesheet.txt: Added.
* http/tests/resources/square20.jpg: Added.
Resources for various requests and different mime types.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214492 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/network/resource-mime-type-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resource-mime-type.html [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resources/json.php [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resources/script.js [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resources/script.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resources/stylesheet.css [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resources/stylesheet.txt [new file with mode: 0644]
LayoutTests/http/tests/resources/square20.jpg [new file with mode: 0644]
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Models/Resource.js

index 5d6b1ab..b0d18f9 100644 (file)
@@ -1,3 +1,23 @@
+2017-03-28  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Inspecting a Main Resource that is JS/JSON does not format / syntax highlight it properly
+        https://bugs.webkit.org/show_bug.cgi?id=166862
+        <rdar://problem/29835977>
+
+        Reviewed by Brian Burg.
+
+        * http/tests/inspector/network/resource-mime-type-expected.txt: Added.
+        * http/tests/inspector/network/resource-mime-type.html: Added.
+        Test resource mime types for different resources.
+
+        * http/tests/inspector/network/resources/json.php: Added.
+        * http/tests/inspector/network/resources/script.js: Added.
+        * http/tests/inspector/network/resources/script.txt: Added.
+        * http/tests/inspector/network/resources/stylesheet.css: Added.
+        * http/tests/inspector/network/resources/stylesheet.txt: Added.
+        * http/tests/resources/square20.jpg: Added.
+        Resources for various requests and different mime types.
+
 2017-03-28  Ryan Haddad  <ryanhaddad@apple.com>
 
         Mark http/tests/xmlhttprequest/simple-cross-origin-progress-events.html as flaky.
diff --git a/LayoutTests/http/tests/inspector/network/resource-mime-type-expected.txt b/LayoutTests/http/tests/inspector/network/resource-mime-type-expected.txt
new file mode 100644 (file)
index 0000000..9fd2edb
--- /dev/null
@@ -0,0 +1,148 @@
+Tests for the `mimeType` and `syntheticMIMEType` properties of different Resource Types.
+
+
+== Running test suite: Resource.MIMEType
+-- Running test case: Resource.MIMEType.Script.js
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-script'.
+PASS: Resource mimeType should be 'application/x-javascript'.
+PASS: Resource syntheticMIMEType should be 'application/x-javascript'.
+
+-- Running test case: Resource.MIMEType.Script.txt
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-script'.
+PASS: Resource mimeType should be 'text/plain'.
+PASS: Resource syntheticMIMEType should be 'text/javascript'.
+
+-- Running test case: Resource.MIMEType.Stylesheet.css
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-stylesheet'.
+PASS: Resource mimeType should be 'text/css'.
+PASS: Resource syntheticMIMEType should be 'text/css'.
+
+-- Running test case: Resource.MIMEType.Stylesheet.txt
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-stylesheet'.
+PASS: Resource mimeType should be 'text/plain'.
+PASS: Resource syntheticMIMEType should be 'text/css'.
+
+-- Running test case: Resource.MIMEType.Image.png
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-image'.
+PASS: Resource mimeType should be 'image/png'.
+PASS: Resource syntheticMIMEType should be 'image/png'.
+
+-- Running test case: Resource.MIMEType.Image.jpg
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-image'.
+PASS: Resource mimeType should be 'image/jpeg'.
+PASS: Resource syntheticMIMEType should be 'image/jpeg'.
+
+-- Running test case: Resource.MIMEType.XHR.js
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-xhr'.
+PASS: Resource mimeType should be 'application/x-javascript'.
+PASS: Resource syntheticMIMEType should be 'application/x-javascript'.
+
+-- Running test case: Resource.MIMEType.XHR.css
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-xhr'.
+PASS: Resource mimeType should be 'text/css'.
+PASS: Resource syntheticMIMEType should be 'text/css'.
+
+-- Running test case: Resource.MIMEType.XHR.png
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-xhr'.
+PASS: Resource mimeType should be 'image/png'.
+PASS: Resource syntheticMIMEType should be 'image/png'.
+
+-- Running test case: Resource.MIMEType.XHR.txt
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-xhr'.
+PASS: Resource mimeType should be 'image/jpeg'.
+PASS: Resource syntheticMIMEType should be 'image/jpeg'.
+
+-- Running test case: Resource.MIMEType.XHR.json
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-xhr'.
+PASS: Resource mimeType should be 'application/json'.
+PASS: Resource syntheticMIMEType should be 'application/json'.
+
+-- Running test case: Resource.MIMEType.XHR.html
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-xhr'.
+PASS: Resource mimeType should be 'text/html'.
+PASS: Resource syntheticMIMEType should be 'text/html'.
+
+-- Running test case: Resource.MIMEType.Fetch.js
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-fetch'.
+PASS: Resource mimeType should be 'application/x-javascript'.
+PASS: Resource syntheticMIMEType should be 'application/x-javascript'.
+
+-- Running test case: Resource.MIMEType.Fetch.css
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-fetch'.
+PASS: Resource mimeType should be 'text/css'.
+PASS: Resource syntheticMIMEType should be 'text/css'.
+
+-- Running test case: Resource.MIMEType.Fetch.png
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-fetch'.
+PASS: Resource mimeType should be 'image/png'.
+PASS: Resource syntheticMIMEType should be 'image/png'.
+
+-- Running test case: Resource.MIMEType.Fetch.txt
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-fetch'.
+PASS: Resource mimeType should be 'image/jpeg'.
+PASS: Resource syntheticMIMEType should be 'image/jpeg'.
+
+-- Running test case: Resource.MIMEType.Fetch.json
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-fetch'.
+PASS: Resource mimeType should be 'application/json'.
+PASS: Resource syntheticMIMEType should be 'application/json'.
+
+-- Running test case: Resource.MIMEType.Fetch.html
+PASS: Resource should be created.
+PASS: Resource Type should be 'resource-type-fetch'.
+PASS: Resource mimeType should be 'text/html'.
+PASS: Resource syntheticMIMEType should be 'text/html'.
+
+-- Running test case: Resource.MIMEType.Document.js
+PASS: Frame MainResource should be created.
+PASS: Resource Type should be 'resource-type-document'.
+PASS: Resource mimeType should be 'application/x-javascript'.
+PASS: Resource syntheticMIMEType should be 'application/x-javascript'.
+
+-- Running test case: Resource.MIMEType.Document.css
+PASS: Frame MainResource should be created.
+PASS: Resource Type should be 'resource-type-document'.
+PASS: Resource mimeType should be 'text/css'.
+PASS: Resource syntheticMIMEType should be 'text/css'.
+
+-- Running test case: Resource.MIMEType.Document.png
+PASS: Frame MainResource should be created.
+PASS: Resource Type should be 'resource-type-document'.
+PASS: Resource mimeType should be 'image/png'.
+PASS: Resource syntheticMIMEType should be 'image/png'.
+
+-- Running test case: Resource.MIMEType.Document.txt
+PASS: Frame MainResource should be created.
+PASS: Resource Type should be 'resource-type-document'.
+PASS: Resource mimeType should be 'image/jpeg'.
+PASS: Resource syntheticMIMEType should be 'image/jpeg'.
+
+-- Running test case: Resource.MIMEType.Document.json
+PASS: Frame MainResource should be created.
+PASS: Resource Type should be 'resource-type-document'.
+PASS: Resource mimeType should be 'application/json'.
+PASS: Resource syntheticMIMEType should be 'application/json'.
+
+-- Running test case: Resource.MIMEType.Document.html
+PASS: Frame MainResource should be created.
+PASS: Resource Type should be 'resource-type-document'.
+PASS: Resource mimeType should be 'text/html'.
+PASS: Resource syntheticMIMEType should be 'text/html'.
+
diff --git a/LayoutTests/http/tests/inspector/network/resource-mime-type.html b/LayoutTests/http/tests/inspector/network/resource-mime-type.html
new file mode 100644 (file)
index 0000000..0d594fb
--- /dev/null
@@ -0,0 +1,304 @@
+<!-- No DOCTYPE to avoid Flakey Strict Mode Console Warning -->
+<html>
+<head>
+<script src="../resources/inspector-test.js"></script>
+<script>
+function loadDocumentWithURL(url) {
+    let iframe = document.createElement("iframe");
+    iframe.src = url;
+    document.body.appendChild(iframe);
+}
+
+function loadScriptWithURL(url) {
+    let script = document.createElement("script");
+    script.src = url;
+    document.body.appendChild(script);
+}
+
+function loadStyleSheetWithURL(url) {
+    let link = document.createElement("link");
+    link.rel = "stylesheet";
+    link.href = url;
+    document.head.appendChild(link);
+}
+
+function loadImageWithURL(url) {
+    let img = document.createElement("img");
+    img.src = url;
+    document.body.appendChild(img);
+}
+
+function loadXHRWithURL(url) {
+    let xhr = new XMLHttpRequest;
+    xhr.open("GET", url, true);
+    xhr.send();
+}
+
+function loadFetchWithURL(url) {
+    fetch(url);
+}
+
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite("Resource.MIMEType");
+
+    function addTestCase({name, description, expression, type, mimeType, synthetic}) {
+        suite.addTestCase({
+            name, description,
+            test(resolve, reject) {
+                InspectorTest.evaluateInPage(expression);
+                WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+                    let resource = event.data.resource;
+                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+                    resource.singleFireEventListener(WebInspector.Resource.Event.ResponseReceived, (event) => {
+                        InspectorTest.expectEqual(resource.type, type, `Resource Type should be '${type}'.`);
+                        InspectorTest.expectEqual(resource.mimeType, mimeType, `Resource mimeType should be '${mimeType}'.`);
+                        InspectorTest.expectEqual(resource.syntheticMIMEType, synthetic, `Resource syntheticMIMEType should be '${synthetic}'.`);
+                        resolve();
+                    });
+                });
+            }
+        });
+    }
+
+    function addDocumentResourceTestCase({name, description, expression, type, mimeType, synthetic}) {
+        suite.addTestCase({
+            name, description,
+            test(resolve, reject) {
+                InspectorTest.evaluateInPage(expression);
+                WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ChildFrameWasAdded, (event) => {
+                    // At this point the frame's resource has loaded.
+                    let resource = event.data.childFrame.mainResource;
+                    InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Frame MainResource should be created.");
+                    InspectorTest.expectEqual(resource.type, type, `Resource Type should be '${type}'.`);
+                    InspectorTest.expectEqual(resource.mimeType, mimeType, `Resource mimeType should be '${mimeType}'.`);
+                    InspectorTest.expectEqual(resource.syntheticMIMEType, synthetic, `Resource syntheticMIMEType should be '${synthetic}'.`);
+                    resolve();
+                });
+            }
+        });
+    }
+
+    // These are the Apache MIME types returned for file extensions.
+    let mimeTypeForExtension = {
+        js: "application/x-javascript",
+        json: "application/json",
+        css: "text/css",
+        txt: "text/plain",
+        html: "text/html",
+        png: "image/png",
+        jpg: "image/jpeg",
+    };
+
+    // Scripts.
+
+    addTestCase({
+        name: "Resource.MIMEType.Script.js",
+        expression: `loadScriptWithURL("resources/script.js")`,
+        type: WebInspector.Resource.Type.Script,
+        mimeType: mimeTypeForExtension.js,
+        synthetic: mimeTypeForExtension.js,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.Script.txt",
+        expression: `loadScriptWithURL("resources/script.txt")`,
+        type: WebInspector.Resource.Type.Script,
+        mimeType: mimeTypeForExtension.txt,
+        synthetic: "text/javascript",
+    });
+
+    // Stylesheets.
+
+    addTestCase({
+        name: "Resource.MIMEType.Stylesheet.css",
+        expression: `loadStyleSheetWithURL("resources/stylesheet.css")`,
+        type: WebInspector.Resource.Type.Stylesheet,
+        mimeType: mimeTypeForExtension.css,
+        synthetic: mimeTypeForExtension.css,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.Stylesheet.txt",
+        expression: `loadStyleSheetWithURL("resources/stylesheet.txt")`,
+        type: WebInspector.Resource.Type.Stylesheet,
+        mimeType: mimeTypeForExtension.txt,
+        synthetic: "text/css",
+    });
+
+    // Images.
+
+    addTestCase({
+        name: "Resource.MIMEType.Image.png",
+        expression: `loadImageWithURL("/resources/square100.png")`,
+        type: WebInspector.Resource.Type.Image,
+        mimeType: mimeTypeForExtension.png,
+        synthetic: mimeTypeForExtension.png,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.Image.jpg",
+        expression: `loadImageWithURL("/resources/square20.jpg")`,
+        type: WebInspector.Resource.Type.Image,
+        mimeType: mimeTypeForExtension.jpg,
+        synthetic: mimeTypeForExtension.jpg,
+    });
+
+    // XHRs.
+
+    addTestCase({
+        name: "Resource.MIMEType.XHR.js",
+        expression: `loadXHRWithURL("resources/script.js")`,
+        type: WebInspector.Resource.Type.XHR,
+        mimeType: mimeTypeForExtension.js,
+        synthetic: mimeTypeForExtension.js,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.XHR.css",
+        expression: `loadXHRWithURL("resources/stylesheet.css")`,
+        type: WebInspector.Resource.Type.XHR,
+        mimeType: mimeTypeForExtension.css,
+        synthetic: mimeTypeForExtension.css,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.XHR.png",
+        expression: `loadXHRWithURL("/resources/square100.png")`,
+        type: WebInspector.Resource.Type.XHR,
+        mimeType: mimeTypeForExtension.png,
+        synthetic: mimeTypeForExtension.png,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.XHR.txt",
+        expression: `loadXHRWithURL("/resources/square20.jpg")`,
+        type: WebInspector.Resource.Type.XHR,
+        mimeType: mimeTypeForExtension.jpg,
+        synthetic: mimeTypeForExtension.jpg,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.XHR.json",
+        expression: `loadXHRWithURL("resources/json.php")`,
+        type: WebInspector.Resource.Type.XHR,
+        mimeType: mimeTypeForExtension.json,
+        synthetic: mimeTypeForExtension.json,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.XHR.html",
+        expression: `loadXHRWithURL("resources/data.html")`,
+        type: WebInspector.Resource.Type.XHR,
+        mimeType: mimeTypeForExtension.html,
+        synthetic: mimeTypeForExtension.html,
+    });
+
+    // Fetch.
+
+    addTestCase({
+        name: "Resource.MIMEType.Fetch.js",
+        expression: `loadFetchWithURL("resources/script.js")`,
+        type: WebInspector.Resource.Type.Fetch,
+        mimeType: mimeTypeForExtension.js,
+        synthetic: mimeTypeForExtension.js,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.Fetch.css",
+        expression: `loadFetchWithURL("resources/stylesheet.css")`,
+        type: WebInspector.Resource.Type.Fetch,
+        mimeType: mimeTypeForExtension.css,
+        synthetic: mimeTypeForExtension.css,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.Fetch.png",
+        expression: `loadFetchWithURL("/resources/square100.png")`,
+        type: WebInspector.Resource.Type.Fetch,
+        mimeType: mimeTypeForExtension.png,
+        synthetic: mimeTypeForExtension.png,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.Fetch.txt",
+        expression: `loadFetchWithURL("/resources/square20.jpg")`,
+        type: WebInspector.Resource.Type.Fetch,
+        mimeType: mimeTypeForExtension.jpg,
+        synthetic: mimeTypeForExtension.jpg,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.Fetch.json",
+        expression: `loadFetchWithURL("resources/json.php")`,
+        type: WebInspector.Resource.Type.Fetch,
+        mimeType: mimeTypeForExtension.json,
+        synthetic: mimeTypeForExtension.json,
+    });
+
+    addTestCase({
+        name: "Resource.MIMEType.Fetch.html",
+        expression: `loadFetchWithURL("resources/data.html")`,
+        type: WebInspector.Resource.Type.Fetch,
+        mimeType: mimeTypeForExtension.html,
+        synthetic: mimeTypeForExtension.html,
+    });
+
+    // Documents.
+
+    addDocumentResourceTestCase({
+        name: "Resource.MIMEType.Document.js",
+        expression: `loadDocumentWithURL("resources/script.js")`,
+        type: WebInspector.Resource.Type.Document,
+        mimeType: mimeTypeForExtension.js,
+        synthetic: mimeTypeForExtension.js,
+    });
+
+    addDocumentResourceTestCase({
+        name: "Resource.MIMEType.Document.css",
+        expression: `loadDocumentWithURL("resources/stylesheet.css")`,
+        type: WebInspector.Resource.Type.Document,
+        mimeType: mimeTypeForExtension.css,
+        synthetic: mimeTypeForExtension.css,
+    });
+
+    addDocumentResourceTestCase({
+        name: "Resource.MIMEType.Document.png",
+        expression: `loadDocumentWithURL("/resources/square100.png")`,
+        type: WebInspector.Resource.Type.Document,
+        mimeType: mimeTypeForExtension.png,
+        synthetic: mimeTypeForExtension.png,
+    });
+
+    addDocumentResourceTestCase({
+        name: "Resource.MIMEType.Document.txt",
+        expression: `loadDocumentWithURL("/resources/square20.jpg")`,
+        type: WebInspector.Resource.Type.Document,
+        mimeType: mimeTypeForExtension.jpg,
+        synthetic: mimeTypeForExtension.jpg,
+    });
+
+    addDocumentResourceTestCase({
+        name: "Resource.MIMEType.Document.json",
+        expression: `loadDocumentWithURL("resources/json.php")`,
+        type: WebInspector.Resource.Type.Document,
+        mimeType: mimeTypeForExtension.json,
+        synthetic: mimeTypeForExtension.json,
+    });
+
+    addDocumentResourceTestCase({
+        name: "Resource.MIMEType.Document.html",
+        expression: `loadDocumentWithURL("resources/data.html")`,
+        type: WebInspector.Resource.Type.Document,
+        mimeType: mimeTypeForExtension.html,
+        synthetic: mimeTypeForExtension.html,
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests for the `mimeType` and `syntheticMIMEType` properties of different Resource Types.</p>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/inspector/network/resources/json.php b/LayoutTests/http/tests/inspector/network/resources/json.php
new file mode 100644 (file)
index 0000000..b761e23
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+header("Content-Type: application/json");
+echo '{"version": 1}';
+?>
diff --git a/LayoutTests/http/tests/inspector/network/resources/script.js b/LayoutTests/http/tests/inspector/network/resources/script.js
new file mode 100644 (file)
index 0000000..20a889c
--- /dev/null
@@ -0,0 +1 @@
+function myScriptJS() {}
diff --git a/LayoutTests/http/tests/inspector/network/resources/script.txt b/LayoutTests/http/tests/inspector/network/resources/script.txt
new file mode 100644 (file)
index 0000000..d93a61b
--- /dev/null
@@ -0,0 +1 @@
+function myScriptTXT() {}
diff --git a/LayoutTests/http/tests/inspector/network/resources/stylesheet.css b/LayoutTests/http/tests/inspector/network/resources/stylesheet.css
new file mode 100644 (file)
index 0000000..18ce8ef
--- /dev/null
@@ -0,0 +1 @@
+#stylesheet-css { color: blue; }
diff --git a/LayoutTests/http/tests/inspector/network/resources/stylesheet.txt b/LayoutTests/http/tests/inspector/network/resources/stylesheet.txt
new file mode 100644 (file)
index 0000000..c8ce033
--- /dev/null
@@ -0,0 +1 @@
+#stylesheet-txt { color: orange; }
diff --git a/LayoutTests/http/tests/resources/square20.jpg b/LayoutTests/http/tests/resources/square20.jpg
new file mode 100644 (file)
index 0000000..83ed491
Binary files /dev/null and b/LayoutTests/http/tests/resources/square20.jpg differ
index 47c324d..99165e6 100644 (file)
@@ -1,5 +1,18 @@
 2017-03-28  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Inspecting a Main Resource that is JS/JSON does not format / syntax highlight it properly
+        https://bugs.webkit.org/show_bug.cgi?id=166862
+        <rdar://problem/29835977>
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Models/Resource.js:
+        (WebInspector.Resource.prototype.get syntheticMIMEType):
+        Don't override the mime type for Document resources. They should always
+        have a mime type and we should use whatever it is.
+
+2017-03-28  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: Unable to Format JSON Request Data
         https://bugs.webkit.org/show_bug.cgi?id=170189
 
index 799e281..11c86b1 100644 (file)
@@ -270,8 +270,6 @@ WebInspector.Resource = class Resource extends WebInspector.SourceCode
         // Return the default MIME-types for the Resource.Type, since the current MIME-type
         // does not match what is expected for the Resource.Type.
         switch (this._type) {
-        case WebInspector.Resource.Type.Document:
-            return "text/html";
         case WebInspector.Resource.Type.Stylesheet:
             return "text/css";
         case WebInspector.Resource.Type.Script: