| Index: third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
|
| index 0bac1809640546015d63cdf8f50dd00035dcefe7..049bcf840e6db2aae7c1b70ba7b8fcee43ef1b7e 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
|
| @@ -33,6 +33,7 @@ WebInspector.ServiceWorkersView.prototype = {
|
| if (this._manager || !target.serviceWorkerManager || !securityOriginManager)
|
| return;
|
| this._manager = target.serviceWorkerManager;
|
| + this._subTargetsManager = target.subTargetsManager;
|
| this._securityOriginManager = securityOriginManager;
|
|
|
| this._toolbar.appendToolbarItem(WebInspector.NetworkConditionsSelector.createOfflineToolbarCheckbox());
|
| @@ -108,7 +109,7 @@ WebInspector.ServiceWorkersView.prototype = {
|
| {
|
| var section = this._sections.get(registration);
|
| if (!section) {
|
| - section = new WebInspector.ServiceWorkersView.Section(this._manager, this._reportView.appendSection(""), registration);
|
| + section = new WebInspector.ServiceWorkersView.Section(this._manager, this._subTargetsManager, this._reportView.appendSection(""), registration);
|
| this._sections.set(registration, section);
|
| }
|
| this._updateSectionVisibility();
|
| @@ -133,12 +134,14 @@ WebInspector.ServiceWorkersView.prototype = {
|
| /**
|
| * @constructor
|
| * @param {!WebInspector.ServiceWorkerManager} manager
|
| + * @param {!WebInspector.SubTargetsManager} subTargetsManager
|
| * @param {!WebInspector.ReportView.Section} section
|
| * @param {!WebInspector.ServiceWorkerRegistration} registration
|
| */
|
| -WebInspector.ServiceWorkersView.Section = function(manager, section, registration)
|
| +WebInspector.ServiceWorkersView.Section = function(manager, subTargetsManager, section, registration)
|
| {
|
| this._manager = manager;
|
| + this._subTargetsManager = subTargetsManager;
|
| this._section = section;
|
| this._registration = registration;
|
|
|
| @@ -184,6 +187,18 @@ WebInspector.ServiceWorkersView.Section.prototype = {
|
| },
|
|
|
| /**
|
| + * @param {string} versionId
|
| + * @return {?WebInspector.Target}
|
| + */
|
| + _targetForVersionId: function(versionId)
|
| + {
|
| + var version = this._manager.findVersion(versionId);
|
| + if (!version || !version.targetId)
|
| + return null;
|
| + return this._subTargetsManager.targetForId(version.targetId);
|
| + },
|
| +
|
| + /**
|
| * @return {!Promise}
|
| */
|
| _update: function()
|
| @@ -221,7 +236,7 @@ WebInspector.ServiceWorkersView.Section.prototype = {
|
|
|
| if (active.isRunning() || active.isStarting()) {
|
| createLink(activeEntry, WebInspector.UIString("stop"), this._stopButtonClicked.bind(this, active.id));
|
| - if (!this._manager.targetForVersionId(active.id))
|
| + if (!this._targetForVersionId(active.id))
|
| createLink(activeEntry, WebInspector.UIString("inspect"), this._inspectButtonClicked.bind(this, active.id));
|
| } else if (active.isStartable()) {
|
| createLink(activeEntry, WebInspector.UIString("start"), this._startButtonClicked.bind(this));
|
| @@ -234,7 +249,7 @@ WebInspector.ServiceWorkersView.Section.prototype = {
|
| var clientLabelText = clientsList.createChild("div", "service-worker-client");
|
| if (this._clientInfoCache.has(client))
|
| this._updateClientInfo(clientLabelText, /** @type {!WebInspector.TargetInfo} */(this._clientInfoCache.get(client)));
|
| - this._manager.getTargetInfo(client, this._onClientInfo.bind(this, clientLabelText));
|
| + this._subTargetsManager.getTargetInfo(client, this._onClientInfo.bind(this, clientLabelText));
|
| }
|
| }
|
|
|
| @@ -244,7 +259,7 @@ WebInspector.ServiceWorkersView.Section.prototype = {
|
| waitingEntry.createChild("span").textContent = WebInspector.UIString("#%s waiting to activate", waiting.id);
|
| createLink(waitingEntry, WebInspector.UIString("skipWaiting"), this._skipButtonClicked.bind(this));
|
| waitingEntry.createChild("div", "service-worker-subtitle").textContent = new Date(waiting.scriptResponseTime * 1000).toLocaleString();
|
| - if (!this._manager.targetForVersionId(waiting.id) && (waiting.isRunning() || waiting.isStarting()))
|
| + if (!this._targetForVersionId(waiting.id) && (waiting.isRunning() || waiting.isStarting()))
|
| createLink(waitingEntry, WebInspector.UIString("inspect"), this._inspectButtonClicked.bind(this, waiting.id));
|
| }
|
| if (installing) {
|
| @@ -252,7 +267,7 @@ WebInspector.ServiceWorkersView.Section.prototype = {
|
| installingEntry.createChild("div", "service-worker-installing-circle");
|
| installingEntry.createChild("span").textContent = WebInspector.UIString("#%s installing", installing.id);
|
| installingEntry.createChild("div", "service-worker-subtitle").textContent = new Date(installing.scriptResponseTime * 1000).toLocaleString();
|
| - if (!this._manager.targetForVersionId(installing.id) && (installing.isRunning() || installing.isStarting()))
|
| + if (!this._targetForVersionId(installing.id) && (installing.isRunning() || installing.isStarting()))
|
| createLink(installingEntry, WebInspector.UIString("inspect"), this._inspectButtonClicked.bind(this, installing.id));
|
| }
|
|
|
| @@ -285,7 +300,7 @@ WebInspector.ServiceWorkersView.Section.prototype = {
|
| */
|
| _addError: function(error)
|
| {
|
| - var target = this._manager.targetForVersionId(error.versionId);
|
| + var target = this._targetForVersionId(error.versionId);
|
| var message = this._errorsList.createChild("div");
|
| if (this._errorsList.childElementCount > 100)
|
| this._errorsList.firstElementChild.remove();
|
| @@ -334,8 +349,8 @@ WebInspector.ServiceWorkersView.Section.prototype = {
|
| */
|
| _updateClientInfo: function(element, targetInfo)
|
| {
|
| - if (!(targetInfo.isWebContents() || targetInfo.isFrame())) {
|
| - element.createTextChild(WebInspector.UIString("Worker: %s", targetInfo.url));
|
| + if (!targetInfo.canActivate) {
|
| + element.createTextChild(targetInfo.title);
|
| return;
|
| }
|
| element.removeChildren();
|
| @@ -350,7 +365,7 @@ WebInspector.ServiceWorkersView.Section.prototype = {
|
| */
|
| _activateTarget: function(targetId)
|
| {
|
| - this._manager.activateTarget(targetId);
|
| + this._subTargetsManager.activateTarget(targetId);
|
| },
|
|
|
| _startButtonClicked: function()
|
|
|