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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 deliverPushMessage: function(registrationId, data) | 155 deliverPushMessage: function(registrationId, data) |
156 { | 156 { |
157 var registration = this._registrations.get(registrationId); | 157 var registration = this._registrations.get(registrationId); |
158 if (!registration) | 158 if (!registration) |
159 return; | 159 return; |
160 var origin = WebInspector.ParsedURL.splitURLIntoPathComponents(registrat ion.scopeURL)[0]; | 160 var origin = WebInspector.ParsedURL.splitURLIntoPathComponents(registrat ion.scopeURL)[0]; |
161 this._agent.deliverPushMessage(origin, registrationId, data); | 161 this._agent.deliverPushMessage(origin, registrationId, data); |
162 }, | 162 }, |
163 | 163 |
164 /** | 164 /** |
165 * @param {string} targetId | |
pfeldman
2015/06/12 20:31:34
Here and below {ServiceWorker.TargetID}
horo
2015/06/15 03:12:43
Done.
| |
166 */ | |
167 activateTarget: function(targetId) | |
168 { | |
169 this._agent.activateTarget(targetId); | |
170 }, | |
171 | |
172 /** | |
165 * @param {string} scope | 173 * @param {string} scope |
166 */ | 174 */ |
167 _unregister: function(scope) | 175 _unregister: function(scope) |
168 { | 176 { |
169 this._agent.unregister(scope); | 177 this._agent.unregister(scope); |
170 }, | 178 }, |
171 | 179 |
172 /** | 180 /** |
173 * @param {string} scope | 181 * @param {string} scope |
174 */ | 182 */ |
(...skipping 20 matching lines...) Expand all Loading... | |
195 | 203 |
196 /** | 204 /** |
197 * @param {string} versionId | 205 * @param {string} versionId |
198 */ | 206 */ |
199 skipWaiting: function(versionId) | 207 skipWaiting: function(versionId) |
200 { | 208 { |
201 this._agent.skipWaiting(versionId); | 209 this._agent.skipWaiting(versionId); |
202 }, | 210 }, |
203 | 211 |
204 /** | 212 /** |
213 * @param {string} targetId | |
214 * @param {function(?WebInspector.TargetInfo)=} callback | |
215 */ | |
216 getTargetInfo: function(targetId, callback) | |
217 { | |
218 /** | |
219 * @param {?Protocol.Error} error | |
220 * @param {?ServiceWorkerAgent.TargetInfo} targetInfo | |
221 */ | |
222 function innerCallback(error, targetInfo) | |
223 { | |
224 if (error) | |
225 console.error(error); | |
pfeldman
2015/06/12 20:31:34
callback(null); return; here
horo
2015/06/15 03:12:43
Done.
| |
226 if (targetInfo) | |
227 callback(new WebInspector.TargetInfo(targetInfo)); | |
228 else | |
229 callback(null) | |
230 } | |
231 this._agent.getTargetInfo(targetId, innerCallback); | |
232 }, | |
233 | |
234 /** | |
205 * @param {string} workerId | 235 * @param {string} workerId |
206 * @param {string} url | 236 * @param {string} url |
207 */ | 237 */ |
208 _workerCreated: function(workerId, url) | 238 _workerCreated: function(workerId, url) |
209 { | 239 { |
210 new WebInspector.ServiceWorker(this, workerId, url); | 240 new WebInspector.ServiceWorker(this, workerId, url); |
211 }, | 241 }, |
212 | 242 |
213 /** | 243 /** |
214 * @param {string} workerId | 244 * @param {string} workerId |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
495 _close: function() | 525 _close: function() |
496 { | 526 { |
497 this.connectionClosed("worker_terminated"); | 527 this.connectionClosed("worker_terminated"); |
498 }, | 528 }, |
499 | 529 |
500 __proto__: InspectorBackendClass.Connection.prototype | 530 __proto__: InspectorBackendClass.Connection.prototype |
501 } | 531 } |
502 | 532 |
503 /** | 533 /** |
504 * @constructor | 534 * @constructor |
535 * @param {!ServiceWorkerAgent.TargetInfo} payload | |
536 */ | |
537 WebInspector.TargetInfo = function(payload) | |
538 { | |
539 this.id = payload.id; | |
540 this.type = payload.type; | |
541 this.title = payload.title; | |
542 this.url = payload.url; | |
543 } | |
544 | |
545 WebInspector.TargetInfo.prototype = { | |
546 /** | |
547 * @return {boolean} | |
548 */ | |
549 isWebContents: function() | |
550 { | |
551 return this.type == "web_contents"; | |
552 }, | |
553 /** | |
554 * @return {boolean} | |
555 */ | |
556 isFrame: function() | |
557 { | |
558 return this.type == "frame"; | |
559 }, | |
560 } | |
561 | |
562 /** | |
563 * @constructor | |
505 * @param {!ServiceWorkerAgent.ServiceWorkerErrorMessage} payload | 564 * @param {!ServiceWorkerAgent.ServiceWorkerErrorMessage} payload |
506 */ | 565 */ |
507 WebInspector.ServiceWorkerErrorMessage = function(payload) | 566 WebInspector.ServiceWorkerErrorMessage = function(payload) |
508 { | 567 { |
509 this.errorMessage = payload.errorMessage; | 568 this.errorMessage = payload.errorMessage; |
510 this.sourceURL = payload.sourceURL; | 569 this.sourceURL = payload.sourceURL; |
511 this.lineNumber = payload.lineNumber; | 570 this.lineNumber = payload.lineNumber; |
512 this.columnNumber = payload.columnNumber; | 571 this.columnNumber = payload.columnNumber; |
513 } | 572 } |
514 | 573 |
515 /** | 574 /** |
516 * @constructor | 575 * @constructor |
517 * @param {!WebInspector.ServiceWorkerRegistration} registration | 576 * @param {!WebInspector.ServiceWorkerRegistration} registration |
518 * @param {!ServiceWorkerAgent.ServiceWorkerVersion} payload | 577 * @param {!ServiceWorkerAgent.ServiceWorkerVersion} payload |
519 */ | 578 */ |
520 WebInspector.ServiceWorkerVersion = function(registration, payload) | 579 WebInspector.ServiceWorkerVersion = function(registration, payload) |
521 { | 580 { |
522 this._registration = registration; | 581 this._registration = registration; |
523 this._update(payload); | 582 this._update(payload); |
524 /** @type {!Array<!WebInspector.ServiceWorkerErrorMessage>} */ | 583 /** @type {!Array<!WebInspector.ServiceWorkerErrorMessage>} */ |
525 this.errorMessages = []; | 584 this.errorMessages = []; |
526 } | 585 } |
527 | 586 |
528 WebInspector.ServiceWorkerVersion.prototype = { | 587 WebInspector.ServiceWorkerVersion.prototype = { |
529 /** | 588 /** |
530 * @param {!ServiceWorkerAgent.ServiceWorkerVersion} payload | 589 * @param {!ServiceWorkerAgent.ServiceWorkerVersion} payload |
531 */ | 590 */ |
532 _update: function(payload) | 591 _update: function(payload) |
533 { | 592 { |
534 this.id = payload.versionId; | 593 this.id = payload.versionId; |
pfeldman
2015/06/12 20:31:34
Most of these fields could be private.
horo
2015/06/15 03:12:43
All of these fields are used in ServiceWorkersView
| |
535 this.scriptURL = payload.scriptURL; | 594 this.scriptURL = payload.scriptURL; |
536 this.runningStatus = payload.runningStatus; | 595 this.runningStatus = payload.runningStatus; |
537 this.status = payload.status; | 596 this.status = payload.status; |
538 this.scriptLastModified = payload.scriptLastModified; | 597 this.scriptLastModified = payload.scriptLastModified; |
539 this.scriptResponseTime = payload.scriptResponseTime; | 598 this.scriptResponseTime = payload.scriptResponseTime; |
599 this.controlledClients = [] | |
600 for (var i = 0; i < payload.controlledClients.length; ++i) { | |
601 this.controlledClients.push(payload.controlledClients[i]); | |
pfeldman
2015/06/12 20:31:34
4 spaces, {} around.
horo
2015/06/15 03:12:43
Done.
| |
602 } | |
540 }, | 603 }, |
541 | 604 |
542 /** | 605 /** |
543 * @return {boolean} | 606 * @return {boolean} |
544 */ | 607 */ |
545 isStartable: function() | 608 isStartable: function() |
546 { | 609 { |
547 return !this._registration.isDeleted && this.isActivated() && this.isSto pped(); | 610 return !this._registration.isDeleted && this.isActivated() && this.isSto pped(); |
548 }, | 611 }, |
549 | 612 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
718 }, | 781 }, |
719 | 782 |
720 /** | 783 /** |
721 * @return {boolean} | 784 * @return {boolean} |
722 */ | 785 */ |
723 _shouldBeRemoved: function() | 786 _shouldBeRemoved: function() |
724 { | 787 { |
725 return this._isRedundant() && (!this._hasErrorLog() || this._deleting); | 788 return this._isRedundant() && (!this._hasErrorLog() || this._deleting); |
726 } | 789 } |
727 } | 790 } |
OLD | NEW |