| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
| 9 */ | 9 */ |
| 10 WebInspector.ServiceWorkersView = function() | 10 WebInspector.ServiceWorkersView = function() |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 var statusValue = this._wrapWidget(this._section.appendField(WebInspecto
r.UIString("Status"))); | 198 var statusValue = this._wrapWidget(this._section.appendField(WebInspecto
r.UIString("Status"))); |
| 199 statusValue.removeChildren(); | 199 statusValue.removeChildren(); |
| 200 var versionsStack = statusValue.createChild("div", "service-worker-versi
on-stack"); | 200 var versionsStack = statusValue.createChild("div", "service-worker-versi
on-stack"); |
| 201 versionsStack.createChild("div", "service-worker-version-stack-bar"); | 201 versionsStack.createChild("div", "service-worker-version-stack-bar"); |
| 202 | 202 |
| 203 if (active) { | 203 if (active) { |
| 204 var scriptElement = this._section.appendField(WebInspector.UIString(
"Source")); | 204 var scriptElement = this._section.appendField(WebInspector.UIString(
"Source")); |
| 205 scriptElement.removeChildren(); | 205 scriptElement.removeChildren(); |
| 206 var fileName = WebInspector.ParsedURL.extractName(active.scriptURL); | 206 var fileName = WebInspector.ParsedURL.extractName(active.scriptURL); |
| 207 scriptElement.appendChild(WebInspector.linkifyURLAsNode(active.scrip
tURL, fileName)); | 207 scriptElement.appendChild(WebInspector.linkifyURLAsNode(active.scrip
tURL, fileName)); |
| 208 scriptElement.createChild("div", "report-field-value-subtitle").text
Content = WebInspector.UIString("Last modified %s", new Date(active.scriptLastMo
dified * 1000).toLocaleString()); | 208 scriptElement.createChild("div", "report-field-value-subtitle").text
Content = WebInspector.UIString("Received %s", new Date(active.scriptResponseTim
e * 1000).toLocaleString()); |
| 209 | 209 |
| 210 var activeEntry = versionsStack.createChild("div", "service-worker-v
ersion"); | 210 var activeEntry = versionsStack.createChild("div", "service-worker-v
ersion"); |
| 211 activeEntry.createChild("div", "service-worker-active-circle"); | 211 activeEntry.createChild("div", "service-worker-active-circle"); |
| 212 activeEntry.createChild("span").textContent = WebInspector.UIString(
"#%s activated and is %s", active.id, active.runningStatus); | 212 activeEntry.createChild("span").textContent = WebInspector.UIString(
"#%s activated and is %s", active.id, active.runningStatus); |
| 213 | 213 |
| 214 if (active.isRunning() || active.isStarting()) { | 214 if (active.isRunning() || active.isStarting()) { |
| 215 createLink(activeEntry, WebInspector.UIString("stop"), this._sto
pButtonClicked.bind(this, active.id)); | 215 createLink(activeEntry, WebInspector.UIString("stop"), this._sto
pButtonClicked.bind(this, active.id)); |
| 216 if (!this._manager.targetForVersionId(active.id)) | 216 if (!this._manager.targetForVersionId(active.id)) |
| 217 createLink(activeEntry, WebInspector.UIString("inspect"), th
is._inspectButtonClicked.bind(this, active.id)); | 217 createLink(activeEntry, WebInspector.UIString("inspect"), th
is._inspectButtonClicked.bind(this, active.id)); |
| 218 } else if (active.isStartable()) { | 218 } else if (active.isStartable()) { |
| 219 createLink(activeEntry, WebInspector.UIString("start"), this._st
artButtonClicked.bind(this)); | 219 createLink(activeEntry, WebInspector.UIString("start"), this._st
artButtonClicked.bind(this)); |
| 220 } | 220 } |
| 221 | 221 |
| 222 var clientsList = this._wrapWidget(this._section.appendField(WebInsp
ector.UIString("Clients"))); | 222 var clientsList = this._wrapWidget(this._section.appendField(WebInsp
ector.UIString("Clients"))); |
| 223 clientsList.removeChildren(); | 223 clientsList.removeChildren(); |
| 224 this._section.setFieldVisible(WebInspector.UIString("Clients"), acti
ve.controlledClients.length); | 224 this._section.setFieldVisible(WebInspector.UIString("Clients"), acti
ve.controlledClients.length); |
| 225 for (var client of active.controlledClients) { | 225 for (var client of active.controlledClients) { |
| 226 var clientLabelText = clientsList.createChild("div", "service-wo
rker-client"); | 226 var clientLabelText = clientsList.createChild("div", "service-wo
rker-client"); |
| 227 if (this._clientInfoCache.has(client)) | 227 if (this._clientInfoCache.has(client)) |
| 228 this._updateClientInfo(clientLabelText, /** @type {!WebInspe
ctor.TargetInfo} */(this._clientInfoCache.get(client))); | 228 this._updateClientInfo(clientLabelText, /** @type {!WebInspe
ctor.TargetInfo} */(this._clientInfoCache.get(client))); |
| 229 this._manager.getTargetInfo(client, this._onClientInfo.bind(this
, clientLabelText)); | 229 this._manager.getTargetInfo(client, this._onClientInfo.bind(this
, clientLabelText)); |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 | 232 |
| 233 if (waiting) { | 233 if (waiting) { |
| 234 var waitingEntry = versionsStack.createChild("div", "service-worker-
version"); | 234 var waitingEntry = versionsStack.createChild("div", "service-worker-
version"); |
| 235 waitingEntry.createChild("div", "service-worker-waiting-circle"); | 235 waitingEntry.createChild("div", "service-worker-waiting-circle"); |
| 236 waitingEntry.createChild("span").textContent = WebInspector.UIString
("#%s waiting to activate", waiting.id); | 236 waitingEntry.createChild("span").textContent = WebInspector.UIString
("#%s waiting to activate", waiting.id); |
| 237 createLink(waitingEntry, WebInspector.UIString("skipWaiting"), this.
_skipButtonClicked.bind(this)); | 237 createLink(waitingEntry, WebInspector.UIString("skipWaiting"), this.
_skipButtonClicked.bind(this)); |
| 238 waitingEntry.createChild("div", "service-worker-subtitle").textConte
nt = new Date(waiting.scriptLastModified * 1000).toLocaleString(); | 238 waitingEntry.createChild("div", "service-worker-subtitle").textConte
nt = new Date(waiting.scriptResponseTime * 1000).toLocaleString(); |
| 239 if (!this._manager.targetForVersionId(waiting.id) && (waiting.isRunn
ing() || waiting.isStarting())) | 239 if (!this._manager.targetForVersionId(waiting.id) && (waiting.isRunn
ing() || waiting.isStarting())) |
| 240 createLink(waitingEntry, WebInspector.UIString("inspect"), this.
_inspectButtonClicked.bind(this, waiting.id)); | 240 createLink(waitingEntry, WebInspector.UIString("inspect"), this.
_inspectButtonClicked.bind(this, waiting.id)); |
| 241 } | 241 } |
| 242 if (installing) { | 242 if (installing) { |
| 243 var installingEntry = versionsStack.createChild("div", "service-work
er-version"); | 243 var installingEntry = versionsStack.createChild("div", "service-work
er-version"); |
| 244 installingEntry.createChild("div", "service-worker-installing-circle
"); | 244 installingEntry.createChild("div", "service-worker-installing-circle
"); |
| 245 installingEntry.createChild("span").textContent = WebInspector.UIStr
ing("#%s installing", installing.id); | 245 installingEntry.createChild("span").textContent = WebInspector.UIStr
ing("#%s installing", installing.id); |
| 246 installingEntry.createChild("div", "service-worker-subtitle").textCo
ntent = new Date(installing.scriptLastModified * 1000).toLocaleString(); | 246 installingEntry.createChild("div", "service-worker-subtitle").textCo
ntent = new Date(installing.scriptResponseTime * 1000).toLocaleString(); |
| 247 if (!this._manager.targetForVersionId(installing.id) && (installing.
isRunning() || installing.isStarting())) | 247 if (!this._manager.targetForVersionId(installing.id) && (installing.
isRunning() || installing.isStarting())) |
| 248 createLink(installingEntry, WebInspector.UIString("inspect"), th
is._inspectButtonClicked.bind(this, installing.id)); | 248 createLink(installingEntry, WebInspector.UIString("inspect"), th
is._inspectButtonClicked.bind(this, installing.id)); |
| 249 } | 249 } |
| 250 | 250 |
| 251 this._section.setFieldVisible(WebInspector.UIString("Errors"), !!this._r
egistration.errors.length); | 251 this._section.setFieldVisible(WebInspector.UIString("Errors"), !!this._r
egistration.errors.length); |
| 252 var errorsValue = this._wrapWidget(this._section.appendField(WebInspecto
r.UIString("Errors"))); | 252 var errorsValue = this._wrapWidget(this._section.appendField(WebInspecto
r.UIString("Errors"))); |
| 253 var errorsLabel = createLabel(String(this._registration.errors.length),
"error-icon"); | 253 var errorsLabel = createLabel(String(this._registration.errors.length),
"error-icon"); |
| 254 errorsLabel.classList.add("service-worker-errors-label"); | 254 errorsLabel.classList.add("service-worker-errors-label"); |
| 255 errorsValue.appendChild(errorsLabel); | 255 errorsValue.appendChild(errorsLabel); |
| 256 this._moreButton = createLink(errorsValue, this._errorsList.classList.co
ntains("hidden") ? WebInspector.UIString("details") : WebInspector.UIString("hid
e"), this._moreErrorsButtonClicked.bind(this)); | 256 this._moreButton = createLink(errorsValue, this._errorsList.classList.co
ntains("hidden") ? WebInspector.UIString("details") : WebInspector.UIString("hid
e"), this._moreErrorsButtonClicked.bind(this)); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 return contentElement; | 393 return contentElement; |
| 394 }, | 394 }, |
| 395 | 395 |
| 396 _dispose: function() | 396 _dispose: function() |
| 397 { | 397 { |
| 398 this._linkifier.dispose(); | 398 this._linkifier.dispose(); |
| 399 if (this._pendingUpdate) | 399 if (this._pendingUpdate) |
| 400 clearTimeout(this._pendingUpdate); | 400 clearTimeout(this._pendingUpdate); |
| 401 } | 401 } |
| 402 } | 402 } |
| OLD | NEW |