| 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 startButton.title = WebInspector.UIString("Start"); | 314 startButton.title = WebInspector.UIString("Start"); |
| 315 } | 315 } |
| 316 runningStatusDiv.createChild("div", "service-workers-version-running
-status-text").createTextChild(version.runningStatus); | 316 runningStatusDiv.createChild("div", "service-workers-version-running
-status-text").createTextChild(version.runningStatus); |
| 317 var scriptURLDiv = stateRowElement.createChild("div", "service-worke
rs-version-script-url"); | 317 var scriptURLDiv = stateRowElement.createChild("div", "service-worke
rs-version-script-url"); |
| 318 scriptURLDiv.createChild("div", "service-workers-version-script-url-
text").createTextChild(version.scriptURL.asParsedURL().path); | 318 scriptURLDiv.createChild("div", "service-workers-version-script-url-
text").createTextChild(version.scriptURL.asParsedURL().path); |
| 319 if (version.isRunning() || version.isStarting()) { | 319 if (version.isRunning() || version.isStarting()) { |
| 320 var inspectButton = scriptURLDiv.createChild("span", "service-wo
rkers-version-inspect"); | 320 var inspectButton = scriptURLDiv.createChild("span", "service-wo
rkers-version-inspect"); |
| 321 inspectButton.createTextChild(WebInspector.UIString("inspect")); | 321 inspectButton.createTextChild(WebInspector.UIString("inspect")); |
| 322 inspectButton.addEventListener("click", this._inspectButtonClick
ed.bind(this, version.id), false); | 322 inspectButton.addEventListener("click", this._inspectButtonClick
ed.bind(this, version.id), false); |
| 323 } | 323 } |
| 324 |
| 325 if (version.scriptLastModified) { |
| 326 var scriptLastModifiedLabel = scriptURLDiv.createChild("label",
" service-workers-info service-worker-script-last-modified", "dt-icon-label"); |
| 327 scriptLastModifiedLabel.type = "info-icon"; |
| 328 scriptLastModifiedLabel.createTextChild(WebInspector.UIString("L
ast-Modified: %s", (new Date(version.scriptLastModified * 1000)).toConsoleTime()
)); |
| 329 } |
| 330 if (version.scriptResponseTime) { |
| 331 var scriptResponseTimeDiv = scriptURLDiv.createChild("label", "
service-workers-info service-worker-script-response-time", "dt-icon-label"); |
| 332 scriptResponseTimeDiv.type = "info-icon"; |
| 333 scriptResponseTimeDiv.createTextChild(WebInspector.UIString("Ser
ver response time: %s", (new Date(version.scriptResponseTime * 1000)).toConsoleT
ime())); |
| 334 } |
| 335 |
| 324 var errorMessages = version.errorMessages; | 336 var errorMessages = version.errorMessages; |
| 325 for (var index = 0; index < errorMessages.length; ++index) { | 337 for (var index = 0; index < errorMessages.length; ++index) { |
| 326 var errorDiv = scriptURLDiv.createChild("div", "service-workers-
error"); | 338 var errorDiv = scriptURLDiv.createChild("div", "service-workers-
error"); |
| 327 errorDiv.createChild("div", "service-workers-error-icon"); | 339 errorDiv.createChild("label", "", "dt-icon-label").type = "error
-icon"; |
| 328 errorDiv.createChild("div", "service-workers-error-message").cre
ateTextChild(errorMessages[index].errorMessage); | 340 errorDiv.createChild("div", "service-workers-error-message").cre
ateTextChild(errorMessages[index].errorMessage); |
| 329 var script_path = errorMessages[index].sourceURL; | 341 var script_path = errorMessages[index].sourceURL; |
| 330 var script_url; | 342 var script_url; |
| 331 if (script_url = script_path.asParsedURL()) | 343 if (script_url = script_path.asParsedURL()) |
| 332 script_path = script_url.path; | 344 script_path = script_url.path; |
| 333 if (errorMessages[index].lineNumber != -1) | 345 if (errorMessages[index].lineNumber != -1) |
| 334 script_path = String.sprintf("%s:%d", script_path, errorMess
ages[index].lineNumber); | 346 script_path = String.sprintf("%s:%d", script_path, errorMess
ages[index].lineNumber); |
| 335 errorDiv.createChild("div", "service-workers-error-line").create
TextChild(script_path); | 347 errorDiv.createChild("div", "service-workers-error-line").create
TextChild(script_path); |
| 336 } | 348 } |
| 349 |
| 337 } | 350 } |
| 338 if (!versions.length) { | 351 if (!versions.length) { |
| 339 var stateRowElement = versionsElement.createChild("div", "service-wo
rkers-version-row"); | 352 var stateRowElement = versionsElement.createChild("div", "service-wo
rkers-version-row"); |
| 340 stateRowElement.createChild("div", "service-workers-version-status")
; | 353 stateRowElement.createChild("div", "service-workers-version-status")
; |
| 341 stateRowElement.createChild("div", "service-workers-version-running-
status"); | 354 stateRowElement.createChild("div", "service-workers-version-running-
status"); |
| 342 stateRowElement.createChild("div", "service-workers-version-script-u
rl"); | 355 stateRowElement.createChild("div", "service-workers-version-script-u
rl"); |
| 343 } | 356 } |
| 344 return modeRowElement; | 357 return modeRowElement; |
| 345 }, | 358 }, |
| 346 | 359 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 371 | 384 |
| 372 /** | 385 /** |
| 373 * @param {string} versionId | 386 * @param {string} versionId |
| 374 * @param {!Event} event | 387 * @param {!Event} event |
| 375 */ | 388 */ |
| 376 _inspectButtonClicked: function(versionId, event) | 389 _inspectButtonClicked: function(versionId, event) |
| 377 { | 390 { |
| 378 this._manager.inspectWorker(versionId); | 391 this._manager.inspectWorker(versionId); |
| 379 } | 392 } |
| 380 } | 393 } |
| OLD | NEW |