Inspector should display service worker served responses properly
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 22:00:37 +0000 (22:00 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 22:00:37 +0000 (22:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178597
<rdar://problem/35186111>

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Network.json:
Expose a new "service-worker" response source.

Source/WebCore:

Test: http/tests/inspector/network/resource-response-service-worker.html

* inspector/InspectorNetworkAgent.cpp:
(WebCore::responseSource):
Use the new protocol enum.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New Service Worker related strings.

* UserInterface/Controllers/HARBuilder.js:
(WI.HARBuilder.entry):
(WI.HARBuilder.timings):
Only output timing data when we have real resource timing data.

(WI.HARBuilder.fetchType):
Output a new string for a Service Worker load in our custom field.

* UserInterface/Models/ResourceTimingData.js:
(WI.ResourceTimingData.prototype.get responseStart):
Fallback further to the responseEnd. This can happen if the response
itself is an error/failure and there was no response, so treat it as
the same as response end.

* UserInterface/Models/Resource.js:
(WI.Resource.responseSourceFromPayload):
(WI.Resource.prototype.updateForRedirectResponse):
(WI.Resource.prototype.updateForResponse):
A fetch response won't change the URL, so if the URL is empty
don't change it from what the request's URL was.

(WI.Resource.prototype.hasResponse):
Failure is like finished. We should likely transition to an "isComplete" method.

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype._populateTransferSizeCell):
(WI.NetworkTableContentView.prototype._generateSortComparator):
Output "(service worker)" in the transfer size field, to indicate this came
from a Service worker. Sort such loads together.

* UserInterface/Views/ResourceHeadersContentView.js:
(WI.ResourceHeadersContentView.prototype._responseSourceDisplayString):
(WI.ResourceHeadersContentView.prototype._refreshSummarySection):
Include the Service Worker response source in this details view. Also include
a FIXME, since we would like to link directly to the service worker in the future.

LayoutTests:

* LayoutTests/platform/gtk/TestExpectations:
* LayoutTests/platform/mac-wk1/TestExpectations:
* LayoutTests/platform/win/TestExpectations:
* LayoutTests/platform/wpe/TestExpectations:
Skip Inspector service worker tests on platforms where Service Workers
are not yet supported. For now this is just one test, future tests
specific to Service Workers will go into a directory.

* http/tests/inspector/network/resource-response-service-worker-expected.txt: Added.
* http/tests/inspector/network/resource-response-service-worker.html: Added.
* http/tests/inspector/network/resources/fetch-service-worker.js: Added.
Test for service worker initiated loads.

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

19 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/network/resource-response-service-worker-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resource-response-service-worker.html [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resources/fetch-service-worker.js [new file with mode: 0644]
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wpe/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Network.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Controllers/HARBuilder.js
Source/WebInspectorUI/UserInterface/Models/Resource.js
Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js
Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js
Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js

index 35b942f..f151f38 100644 (file)
@@ -1,3 +1,24 @@
+2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Inspector should display service worker served responses properly
+        https://bugs.webkit.org/show_bug.cgi?id=178597
+        <rdar://problem/35186111>
+
+        Reviewed by Brian Burg.
+
+        * LayoutTests/platform/gtk/TestExpectations:
+        * LayoutTests/platform/mac-wk1/TestExpectations:
+        * LayoutTests/platform/win/TestExpectations:
+        * LayoutTests/platform/wpe/TestExpectations:
+        Skip Inspector service worker tests on platforms where Service Workers
+        are not yet supported. For now this is just one test, future tests
+        specific to Service Workers will go into a directory.
+
+        * http/tests/inspector/network/resource-response-service-worker-expected.txt: Added.
+        * http/tests/inspector/network/resource-response-service-worker.html: Added.
+        * http/tests/inspector/network/resources/fetch-service-worker.js: Added.
+        Test for service worker initiated loads.
+
 2017-11-02  Ryan Haddad  <ryanhaddad@apple.com>
 
         Mark http/tests/preload/viewport/meta-viewport-link-headers.php as flaky on iOS.
diff --git a/LayoutTests/http/tests/inspector/network/resource-response-service-worker-expected.txt b/LayoutTests/http/tests/inspector/network/resource-response-service-worker-expected.txt
new file mode 100644 (file)
index 0000000..09d2da7
--- /dev/null
@@ -0,0 +1,21 @@
+Test for `Resource.ResponseSource.ServiceWorker`.
+
+
+== Running test suite: Resource.ResponseSource.ServiceWorker
+-- Running test setup.
+-- Running test case: Resource.ResponseSource.ServiceWorker.200
+PASS: Resource should be created.
+PASS: Resource should receive a Response.
+PASS: responseSource should be Symbol(service-worker)
+RESPONSE: 200 Custom Status Text: OK
+
+-- Running test case: Resource.ResponseSource.ServiceWorker.500
+PASS: Resource should be created.
+PASS: Resource should receive a Response.
+PASS: responseSource should be Symbol(service-worker)
+RESPONSE: 500 Custom Status Text: Error
+
+-- Running test case: Resource.ResponseSource.ServiceWorker.Error
+PASS: Resource should be created.
+PASS: Resource should have failed.
+
diff --git a/LayoutTests/http/tests/inspector/network/resource-response-service-worker.html b/LayoutTests/http/tests/inspector/network/resource-response-service-worker.html
new file mode 100644 (file)
index 0000000..5c7d49e
--- /dev/null
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../resources/inspector-test.js"></script>
+<script>
+async function startServiceWorker() {
+    await navigator.serviceWorker.register("resources/fetch-service-worker.js");
+    TestPage.dispatchEventToFrontend("SetupComplete");
+}
+
+async function triggerServiceWorkerLoad(url) {
+    try { await fetch(url); } catch { }
+    TestPage.dispatchEventToFrontend("LoadComplete");
+}
+
+function test()
+{
+    InspectorTest.debug();
+    let suite = InspectorTest.createAsyncSuite("Resource.ResponseSource.ServiceWorker");
+
+    function addTestCase({name, description, setup, expression, statusCode, responseSource}) {
+        suite.addTestCase({
+            name, description, setup,
+            test(resolve, reject) {
+                InspectorTest.evaluateInPage(expression);
+                Promise.all([
+                    WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+                    WI.Resource.awaitEvent(WI.Resource.Event.ResponseReceived),
+                    InspectorTest.awaitEvent("LoadComplete"),
+                ]).then(([resourceWasAddedEvent, responseReceivedEvent, loadCompleteEvent]) => {
+                    let resource = resourceWasAddedEvent.data.resource;
+                    InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
+                    InspectorTest.expectEqual(resource, responseReceivedEvent.target, "Resource should receive a Response.");
+                    if (responseSource)
+                        InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`);
+                    InspectorTest.log("RESPONSE: " + resource.statusCode + " " + resource.statusText);
+                }).then(resolve, reject);
+            }
+        });
+    }
+
+    addTestCase({
+        name: "Resource.ResponseSource.ServiceWorker.200",
+        setup(resolve) { InspectorTest.evaluateInPage(`startServiceWorker()`); InspectorTest.awaitEvent("SetupComplete").then(resolve); },
+        expression: `triggerServiceWorkerLoad("test-200")`,
+        responseSource: WI.Resource.ResponseSource.ServiceWorker,
+    });
+
+    addTestCase({
+        name: "Resource.ResponseSource.ServiceWorker.500",
+        expression: `triggerServiceWorkerLoad("test-500")`,
+        responseSource: WI.Resource.ResponseSource.ServiceWorker,
+    });
+
+    suite.addTestCase({
+        name: "Resource.ResponseSource.ServiceWorker.Error",
+        description: "ServiceWorker may respond with an error.",
+        test(resolve, reject) {
+            InspectorTest.evaluateInPage(`triggerServiceWorkerLoad("test-error")`);
+            Promise.all([
+                WI.Frame.awaitEvent(WI.Frame.Event.ResourceWasAdded),
+                InspectorTest.awaitEvent("LoadComplete"),
+            ]).then(([resourceWasAddedEvent, loadCompleteEvent]) => {
+                let resource = resourceWasAddedEvent.data.resource;
+                InspectorTest.expectThat(resource instanceof WI.Resource, "Resource should be created.");
+                InspectorTest.expectThat(resource.failed, "Resource should have failed.");
+            }).then(resolve, reject);
+        }
+    });
+
+    suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Test for `Resource.ResponseSource.ServiceWorker`.</p>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/inspector/network/resources/fetch-service-worker.js b/LayoutTests/http/tests/inspector/network/resources/fetch-service-worker.js
new file mode 100644 (file)
index 0000000..ca90255
--- /dev/null
@@ -0,0 +1,13 @@
+self.addEventListener("fetch", (event) => {
+    if (event.request.url.includes("test-200")) {
+        event.respondWith(new Response(null, {status: 200, statusText: "Custom Status Text: OK"}));
+        return;
+    }
+
+    if (event.request.url.includes("test-500")) {
+        event.respondWith(new Response(null, {status: 500, statusText: "Custom Status Text: Error"}));
+        return;
+    }
+
+    event.respondWith(Response.error());
+});
index 113b6d7..9077937 100644 (file)
@@ -1134,6 +1134,7 @@ webkit.org/b/178316 http/tests/cache-storage [ Skip ]
 # Service-workers implementation is not complete yet
 webkit.org/b/175419 http/tests/workers/service [ Skip ]
 webkit.org/b/175419 http/wpt/service-workers [ Failure ]
+webkit.org/b/175419 http/tests/inspector/network/resource-response-service-worker.html [ Skip ]
 webkit.org/b/175419 imported/w3c/web-platform-tests/service-workers [ Skip ]
 webkit.org/b/175419 imported/w3c/web-platform-tests/service-workers/stub-4.6.2-cache.html [ Pass ]
 webkit.org/b/175419 imported/w3c/web-platform-tests/service-workers/stub-4.6.3-cache-storage.html [ Pass ]
index 448096d..a719d86 100644 (file)
@@ -426,6 +426,7 @@ webkit.org/b/173432 [ Debug ] imported/w3c/web-platform-tests/fetch/nosniff/impo
 fast/images/low-memory-decode.html [ Skip ]
 
 http/tests/workers/service [ Skip ]
+http/tests/inspector/network/resource-response-service-worker.html [ Skip ]
 
 # Link preconnect is disabled on WebKit1 because it does not use NETWORK_SESSION.
 http/tests/preconnect [ Skip ]
index 63f58af..d244501 100644 (file)
@@ -3700,6 +3700,7 @@ webkit.org/b/93589 svg/dom/SVGScriptElement/script-change-externalResourcesRequi
 # No service worker implementation for WK1
 http/tests/workers/service [ Skip ]
 http/wpt/service-workers [ Skip ]
+http/tests/inspector/network/resource-response-service-worker.html [ Skip ]
 imported/w3c/web-platform-tests/fetch/api/policies/referrer-no-referrer-service-worker.https.html [ Skip ]
 imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https.html [ Skip ]
 imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https.html [ Skip ]
index dea1457..58a619c 100644 (file)
@@ -878,6 +878,7 @@ webkit.org/b/139489 http/tests/css/link-css-disabled-value-with-slow-loading-she
 webkit.org/b/139489 http/tests/css/link-css-disabled-value-with-slow-loading-sheet-in-error.html [ Failure Pass ]
 
 webkit.org/b/175419 http/tests/workers/service [ Skip ]
+webkit.org/b/175419 http/tests/inspector/network/resource-response-service-worker.html [ Skip ]
 webkit.org/b/178576 http/wpt/service-workers/extendableEvent.https.html [ Failure ]
 webkit.org/b/178576 http/wpt/service-workers/fetchEvent.https.html [ Failure ]
 webkit.org/b/178576 imported/w3c/web-platform-tests/service-workers [ Skip ]
index 045631e..968f5c2 100644 (file)
@@ -1,3 +1,14 @@
+2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Inspector should display service worker served responses properly
+        https://bugs.webkit.org/show_bug.cgi?id=178597
+        <rdar://problem/35186111>
+
+        Reviewed by Brian Burg.
+
+        * inspector/protocol/Network.json:
+        Expose a new "service-worker" response source.
+
 2017-11-02  Filip Pizlo  <fpizlo@apple.com>
 
         AI does not correctly model the clobber case of ArithClz32
index abe479c..16b7b49 100644 (file)
@@ -70,7 +70,7 @@
                 { "name": "headers", "$ref": "Headers", "description": "HTTP response headers." },
                 { "name": "headersText", "type": "string", "optional": true, "description": "HTTP response headers text." },
                 { "name": "mimeType", "type": "string", "description": "Resource mimeType as determined by the browser." },
-                { "name": "source", "type": "string", "enum": ["unknown", "network", "memory-cache", "disk-cache"], "description": "Specifies where the response came from." },
+                { "name": "source", "type": "string", "enum": ["unknown", "network", "memory-cache", "disk-cache", "service-worker"], "description": "Specifies where the response came from." },
                 { "name": "requestHeaders", "$ref": "Headers", "optional": true, "description": "Refined HTTP request headers that were actually transmitted over the network." },
                 { "name": "requestHeadersText", "type": "string", "optional": true, "description": "HTTP request headers text." },
                 { "name": "timing", "$ref": "ResourceTiming", "optional": true, "description": "Timing information for the given request." }
index 3c5d2f2..542d2e3 100644 (file)
@@ -1,3 +1,17 @@
+2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Inspector should display service worker served responses properly
+        https://bugs.webkit.org/show_bug.cgi?id=178597
+        <rdar://problem/35186111>
+
+        Reviewed by Brian Burg.
+
+        Test: http/tests/inspector/network/resource-response-service-worker.html
+
+        * inspector/InspectorNetworkAgent.cpp:
+        (WebCore::responseSource):
+        Use the new protocol enum.
+
 2017-11-02  Ryosuke Niwa  <rniwa@webkit.org>
 
         Eliminate isMainThread() checks in most call sites of NoEventDispatchAssertion
index 648cf87..bf8d6c7 100644 (file)
@@ -274,9 +274,8 @@ static Inspector::Protocol::Network::Response::Source responseSource(ResourceRes
     case ResourceResponse::Source::DiskCache:
     case ResourceResponse::Source::DiskCacheAfterValidation:
         return Inspector::Protocol::Network::Response::Source::DiskCache;
-    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=178597. Add an Inspector ServiceWorker source.
     case ResourceResponse::Source::ServiceWorker:
-        return Inspector::Protocol::Network::Response::Source::Unknown;
+        return Inspector::Protocol::Network::Response::Source::ServiceWorker;
     }
 
     ASSERT_NOT_REACHED();
index 9d04041..468e37b 100644 (file)
@@ -1,3 +1,50 @@
+2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Inspector should display service worker served responses properly
+        https://bugs.webkit.org/show_bug.cgi?id=178597
+        <rdar://problem/35186111>
+
+        Reviewed by Brian Burg.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        New Service Worker related strings.
+
+        * UserInterface/Controllers/HARBuilder.js:
+        (WI.HARBuilder.entry):
+        (WI.HARBuilder.timings):
+        Only output timing data when we have real resource timing data.
+
+        (WI.HARBuilder.fetchType):
+        Output a new string for a Service Worker load in our custom field.
+
+        * UserInterface/Models/ResourceTimingData.js:
+        (WI.ResourceTimingData.prototype.get responseStart):
+        Fallback further to the responseEnd. This can happen if the response
+        itself is an error/failure and there was no response, so treat it as
+        the same as response end.
+
+        * UserInterface/Models/Resource.js:
+        (WI.Resource.responseSourceFromPayload):
+        (WI.Resource.prototype.updateForRedirectResponse):
+        (WI.Resource.prototype.updateForResponse):
+        A fetch response won't change the URL, so if the URL is empty
+        don't change it from what the request's URL was.
+
+        (WI.Resource.prototype.hasResponse):
+        Failure is like finished. We should likely transition to an "isComplete" method.
+
+        * UserInterface/Views/NetworkTableContentView.js:
+        (WI.NetworkTableContentView.prototype._populateTransferSizeCell):
+        (WI.NetworkTableContentView.prototype._generateSortComparator):
+        Output "(service worker)" in the transfer size field, to indicate this came
+        from a Service worker. Sort such loads together.
+
+        * UserInterface/Views/ResourceHeadersContentView.js:
+        (WI.ResourceHeadersContentView.prototype._responseSourceDisplayString):
+        (WI.ResourceHeadersContentView.prototype._refreshSummarySection):
+        Include the Service Worker response source in this details view. Also include
+        a FIXME, since we would like to link directly to the service worker in the future.
+
 2017-11-02  Nikita Vasilyev  <nvasilyev@apple.com>
 
         Web Inspector: Styles Redesign: turn on CSS spreadsheet editor by default
index c5e744e..17d178a 100644 (file)
@@ -57,6 +57,7 @@ localizedStrings["(memory)"] = "(memory)";
 localizedStrings["(modify the boxes below to add a value)"] = "(modify the boxes below to add a value)";
 localizedStrings["(multiple)"] = "(multiple)";
 localizedStrings["(program)"] = "(program)";
+localizedStrings["(service worker)"] = "(service worker)";
 localizedStrings["(uninitialized)"] = "(uninitialized)";
 localizedStrings[", "] = ", ";
 localizedStrings["1 match"] = "1 match";
@@ -816,6 +817,7 @@ localizedStrings["Self"] = "Self";
 localizedStrings["Self Size"] = "Self Size";
 localizedStrings["Self Time"] = "Self Time";
 localizedStrings["Semantic Issue"] = "Semantic Issue";
+localizedStrings["Service Worker"] = "Service Worker";
 localizedStrings["Session"] = "Session";
 localizedStrings["Session Storage"] = "Session Storage";
 localizedStrings["Set to Automatically Continue"] = "Set to Automatically Continue";
index d994627..c3d4054 100644 (file)
@@ -299,6 +299,8 @@ WI.HARBuilder = class HARBuilder
             return "Memory Cache";
         case WI.Resource.ResponseSource.DiskCache:
             return "Disk Cache";
+        case WI.Resource.ResponseSource.ServiceWorker:
+            return "Service Worker";
         }
 
         console.assert(false);
index 2cc2bf3..17214b0 100644 (file)
@@ -230,6 +230,8 @@ WI.Resource = class Resource extends WI.SourceCode
             return WI.Resource.ResponseSource.MemoryCache;
         case NetworkAgent.ResponseSource.DiskCache:
             return WI.Resource.ResponseSource.DiskCache;
+        case NetworkAgent.ResponseSource.ServiceWorker:
+            return WI.Resource.ResponseSource.ServiceWorker;
         default:
             console.error("Unknown response source type", source);
             return WI.Resource.ResponseSource.Unknown;
@@ -662,7 +664,9 @@ WI.Resource = class Resource extends WI.SourceCode
 
         var oldURL = this._url;
 
-        this._url = url;
+        if (url)
+            this._url = url;
+
         this._requestHeaders = requestHeaders || {};
         this._requestCookies = null;
         this._lastRedirectReceivedTimestamp = elapsedTime || NaN;
@@ -680,7 +684,7 @@ WI.Resource = class Resource extends WI.SourceCode
 
     hasResponse()
     {
-        return !isNaN(this._statusCode) || this._finished;
+        return !isNaN(this._statusCode) || this._finished || this._failed;
     }
 
     hasRequestFormParameters()
@@ -702,7 +706,9 @@ WI.Resource = class Resource extends WI.SourceCode
         if (type in WI.Resource.Type)
             type = WI.Resource.Type[type];
 
-        this._url = url;
+        if (url)
+            this._url = url;
+
         this._mimeType = mimeType;
         this._type = type || WI.Resource.typeFromMIMEType(mimeType);
         this._statusCode = statusCode;
@@ -1099,6 +1105,7 @@ WI.Resource.ResponseSource = {
     Network: Symbol("network"),
     MemoryCache: Symbol("memory-cache"),
     DiskCache: Symbol("disk-cache"),
+    ServiceWorker: Symbol("service-worker"),
 };
 
 WI.Resource.NetworkPriority = {
index ab1de27..fa5aee8 100644 (file)
@@ -94,7 +94,7 @@ WI.ResourceTimingData = class ResourceTimingData
     get connectEnd() { return this._connectEnd; }
     get secureConnectionStart() { return this._secureConnectionStart; }
     get requestStart() { return this._requestStart || this._startTime || this._resource.requestSentTimestamp; }
-    get responseStart() { return this._responseStart || this._startTime || this._resource.responseReceivedTimestamp; }
+    get responseStart() { return this._responseStart || this._startTime || this._resource.responseReceivedTimestamp || this._resource.finishedOrFailedTimestamp; }
     get responseEnd() { return this._responseEnd || this._resource.finishedOrFailedTimestamp; }
 
     markResponseEndTime(responseEnd)
index 0b7cad3..fa73b47 100644 (file)
@@ -420,6 +420,11 @@ WI.NetworkTableContentView = class NetworkTableContentView extends WI.ContentVie
             cell.textContent = WI.UIString("(disk)");
             return;
         }
+        if (responseSource === WI.Resource.ResponseSource.ServiceWorker) {
+            cell.classList.add("cache-type");
+            cell.textContent = WI.UIString("(service worker)");
+            return;
+        }
 
         let transferSize = entry.transferSize;
         cell.textContent = isNaN(transferSize) ? emDash : Number.bytesToString(transferSize);
@@ -569,12 +574,16 @@ WI.NetworkTableContentView = class NetworkTableContentView extends WI.ContentVie
                     transferSizeA = -20;
                 else if (sourceA === WI.Resource.ResponseSource.DiskCache)
                     transferSizeA = -10;
+                else if (sourceA === WI.Resource.ResponseSource.ServiceWorker)
+                    transferSizeA = -5;
 
                 let sourceB = b.resource.responseSource;
                 if (sourceB === WI.Resource.ResponseSource.MemoryCache)
                     transferSizeB = -20;
                 else if (sourceB === WI.Resource.ResponseSource.DiskCache)
                     transferSizeB = -10;
+                else if (sourceB === WI.Resource.ResponseSource.ServiceWorker)
+                    transferSizeB = -5;
 
                 return transferSizeA - transferSizeB;
             };
index d3f2f9e..db7b2af 100644 (file)
@@ -251,6 +251,8 @@ WI.ResourceHeadersContentView = class ResourceHeadersContentView extends WI.Cont
             return WI.UIString("Memory Cache");
         case WI.Resource.ResponseSource.DiskCache:
             return WI.UIString("Disk Cache");
+        case WI.Resource.ResponseSource.ServiceWorker:
+            return WI.UIString("Service Worker");
         case WI.Resource.ResponseSource.Unknown:
         default:
             return null;
@@ -271,6 +273,8 @@ WI.ResourceHeadersContentView = class ResourceHeadersContentView extends WI.Cont
             status = this._resource.statusCode + (this._resource.statusText ? " " + this._resource.statusText : "");
         this._appendKeyValuePair(detailsElement, WI.UIString("Status"), status);
 
+        // FIXME: <https://webkit.org/b/178827> Web Inspector: Should be able to link directly to the ServiceWorker that handled a particular load
+
         let source = this._responseSourceDisplayString(this._resource.responseSource) || emDash;
         this._appendKeyValuePair(detailsElement, WI.UIString("Source"), source);