| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 604 |
| 605 /** | 605 /** |
| 606 * @param {!WebInspector.Target} target | 606 * @param {!WebInspector.Target} target |
| 607 * @return {?string} | 607 * @return {?string} |
| 608 */ | 608 */ |
| 609 _serviceWorkerTargetIdForWorker: function(target) | 609 _serviceWorkerTargetIdForWorker: function(target) |
| 610 { | 610 { |
| 611 var parent = target.parentTarget(); | 611 var parent = target.parentTarget(); |
| 612 if (!parent || parent.parentTarget() !== this._target) | 612 if (!parent || parent.parentTarget() !== this._target) |
| 613 return null; | 613 return null; |
| 614 if (this._subTargetsManager.targetType(parent) !== "service_worker") | 614 var targetInfo = this._subTargetsManager.targetInfo(parent); |
| 615 if (!targetInfo || targetInfo.type !== "service_worker") |
| 615 return null; | 616 return null; |
| 616 return this._subTargetsManager.targetId(parent); | 617 return targetInfo.id; |
| 617 }, | 618 }, |
| 618 | 619 |
| 619 _updateAllContextLabels: function() | 620 _updateAllContextLabels: function() |
| 620 { | 621 { |
| 621 for (var target of WebInspector.targetManager.targets()) { | 622 for (var target of WebInspector.targetManager.targets()) { |
| 622 var serviceWorkerTargetId = this._serviceWorkerTargetIdForWorker(tar
get); | 623 var serviceWorkerTargetId = this._serviceWorkerTargetIdForWorker(tar
get); |
| 623 if (!serviceWorkerTargetId) | 624 if (!serviceWorkerTargetId) |
| 624 continue; | 625 continue; |
| 625 var version = this._versionByTargetId.get(serviceWorkerTargetId) ||
null; | 626 var version = this._versionByTargetId.get(serviceWorkerTargetId) ||
null; |
| 626 for (var context of target.runtimeModel.executionContexts()) | 627 for (var context of target.runtimeModel.executionContexts()) |
| 627 this._updateContextLabel(context, version); | 628 this._updateContextLabel(context, version); |
| 628 } | 629 } |
| 629 }, | 630 }, |
| 630 | 631 |
| 631 /** | 632 /** |
| 632 * @param {!WebInspector.ExecutionContext} context | 633 * @param {!WebInspector.ExecutionContext} context |
| 633 * @param {?WebInspector.ServiceWorkerVersion} version | 634 * @param {?WebInspector.ServiceWorkerVersion} version |
| 634 */ | 635 */ |
| 635 _updateContextLabel: function(context, version) | 636 _updateContextLabel: function(context, version) |
| 636 { | 637 { |
| 637 var parsedUrl = context.origin.asParsedURL(); | 638 var parsedUrl = context.origin.asParsedURL(); |
| 638 var label = parsedUrl ? parsedUrl.lastPathComponentWithFragment() : cont
ext.name; | 639 var label = parsedUrl ? parsedUrl.lastPathComponentWithFragment() : cont
ext.name; |
| 639 if (version) | 640 if (version) |
| 640 context.setLabel(label + " #" + version.id + " (" + version.status +
")"); | 641 context.setLabel(label + " #" + version.id + " (" + version.status +
")"); |
| 641 else | 642 else |
| 642 context.setLabel(label); | 643 context.setLabel(label); |
| 643 }, | 644 }, |
| 644 } | 645 } |
| OLD | NEW |