| 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 * @implements {SDK.TargetManager.Observer} | 5 * @implements {SDK.TargetManager.Observer} |
| 6 * @unrestricted | 6 * @unrestricted |
| 7 */ | 7 */ |
| 8 Resources.ServiceWorkersView = class extends UI.VBox { | 8 Resources.ServiceWorkersView = class extends UI.VBox { |
| 9 constructor() { | 9 constructor() { |
| 10 super(true); | 10 super(true); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 installingEntry.createChild('div', 'service-worker-installing-circle'); | 306 installingEntry.createChild('div', 'service-worker-installing-circle'); |
| 307 installingEntry.createChild('span').textContent = Common.UIString('#%s ins
talling', installing.id); | 307 installingEntry.createChild('span').textContent = Common.UIString('#%s ins
talling', installing.id); |
| 308 installingEntry.createChild('div', 'service-worker-subtitle').textContent
= | 308 installingEntry.createChild('div', 'service-worker-subtitle').textContent
= |
| 309 new Date(installing.scriptResponseTime * 1000).toLocaleString(); | 309 new Date(installing.scriptResponseTime * 1000).toLocaleString(); |
| 310 if (!this._targetForVersionId(installing.id) && (installing.isRunning() ||
installing.isStarting())) | 310 if (!this._targetForVersionId(installing.id) && (installing.isRunning() ||
installing.isStarting())) |
| 311 createLink(installingEntry, Common.UIString('inspect'), this._inspectBut
tonClicked.bind(this, installing.id)); | 311 createLink(installingEntry, Common.UIString('inspect'), this._inspectBut
tonClicked.bind(this, installing.id)); |
| 312 } | 312 } |
| 313 | 313 |
| 314 this._section.setFieldVisible(Common.UIString('Errors'), !!this._registratio
n.errors.length); | 314 this._section.setFieldVisible(Common.UIString('Errors'), !!this._registratio
n.errors.length); |
| 315 var errorsValue = this._wrapWidget(this._section.appendField(Common.UIString
('Errors'))); | 315 var errorsValue = this._wrapWidget(this._section.appendField(Common.UIString
('Errors'))); |
| 316 var errorsLabel = createLabel(String(this._registration.errors.length), 'sma
llicon-error'); | 316 var errorsLabel = UI.createLabel(String(this._registration.errors.length), '
smallicon-error'); |
| 317 errorsLabel.classList.add('service-worker-errors-label'); | 317 errorsLabel.classList.add('service-worker-errors-label'); |
| 318 errorsValue.appendChild(errorsLabel); | 318 errorsValue.appendChild(errorsLabel); |
| 319 this._moreButton = createLink( | 319 this._moreButton = createLink( |
| 320 errorsValue, | 320 errorsValue, |
| 321 this._errorsList.classList.contains('hidden') ? Common.UIString('details
') : Common.UIString('hide'), | 321 this._errorsList.classList.contains('hidden') ? Common.UIString('details
') : Common.UIString('hide'), |
| 322 this._moreErrorsButtonClicked.bind(this)); | 322 this._moreErrorsButtonClicked.bind(this)); |
| 323 createLink(errorsValue, Common.UIString('clear'), this._clearErrorsButtonCli
cked.bind(this)); | 323 createLink(errorsValue, Common.UIString('clear'), this._clearErrorsButtonCli
cked.bind(this)); |
| 324 | 324 |
| 325 /** | 325 /** |
| 326 * @param {!Element} parent | 326 * @param {!Element} parent |
| (...skipping 12 matching lines...) Expand all Loading... |
| 339 | 339 |
| 340 /** | 340 /** |
| 341 * @param {!Protocol.ServiceWorker.ServiceWorkerErrorMessage} error | 341 * @param {!Protocol.ServiceWorker.ServiceWorkerErrorMessage} error |
| 342 */ | 342 */ |
| 343 _addError(error) { | 343 _addError(error) { |
| 344 var target = this._targetForVersionId(error.versionId); | 344 var target = this._targetForVersionId(error.versionId); |
| 345 var message = this._errorsList.createChild('div'); | 345 var message = this._errorsList.createChild('div'); |
| 346 if (this._errorsList.childElementCount > 100) | 346 if (this._errorsList.childElementCount > 100) |
| 347 this._errorsList.firstElementChild.remove(); | 347 this._errorsList.firstElementChild.remove(); |
| 348 message.appendChild(this._linkifier.linkifyScriptLocation(target, null, erro
r.sourceURL, error.lineNumber)); | 348 message.appendChild(this._linkifier.linkifyScriptLocation(target, null, erro
r.sourceURL, error.lineNumber)); |
| 349 message.appendChild(createLabel('#' + error.versionId + ': ' + error.errorMe
ssage, 'smallicon-error')); | 349 message.appendChild(UI.createLabel('#' + error.versionId + ': ' + error.erro
rMessage, 'smallicon-error')); |
| 350 } | 350 } |
| 351 | 351 |
| 352 /** | 352 /** |
| 353 * @param {!Common.Event} event | 353 * @param {!Common.Event} event |
| 354 */ | 354 */ |
| 355 _unregisterButtonClicked(event) { | 355 _unregisterButtonClicked(event) { |
| 356 this._manager.deleteRegistration(this._registration.id); | 356 this._manager.deleteRegistration(this._registration.id); |
| 357 } | 357 } |
| 358 | 358 |
| 359 /** | 359 /** |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 * @return {!Element} | 455 * @return {!Element} |
| 456 */ | 456 */ |
| 457 _wrapWidget(container) { | 457 _wrapWidget(container) { |
| 458 var shadowRoot = UI.createShadowRootWithCoreStyles(container); | 458 var shadowRoot = UI.createShadowRootWithCoreStyles(container); |
| 459 UI.appendStyle(shadowRoot, 'resources/serviceWorkersView.css'); | 459 UI.appendStyle(shadowRoot, 'resources/serviceWorkersView.css'); |
| 460 var contentElement = createElement('div'); | 460 var contentElement = createElement('div'); |
| 461 shadowRoot.appendChild(contentElement); | 461 shadowRoot.appendChild(contentElement); |
| 462 return contentElement; | 462 return contentElement; |
| 463 } | 463 } |
| 464 }; | 464 }; |
| OLD | NEW |