| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 WebInspector.ServiceWorker = function(manager, workerId, url, versionId) | 425 WebInspector.ServiceWorker = function(manager, workerId, url, versionId) |
| 426 { | 426 { |
| 427 this._manager = manager; | 427 this._manager = manager; |
| 428 this._agent = manager.target().serviceWorkerAgent(); | 428 this._agent = manager.target().serviceWorkerAgent(); |
| 429 this._workerId = workerId; | 429 this._workerId = workerId; |
| 430 this._connection = new WebInspector.ServiceWorkerConnection(this._agent, wor
kerId); | 430 this._connection = new WebInspector.ServiceWorkerConnection(this._agent, wor
kerId); |
| 431 this._url = url; | 431 this._url = url; |
| 432 this._versionId = versionId; | 432 this._versionId = versionId; |
| 433 var parsedURL = url.asParsedURL(); | 433 var parsedURL = url.asParsedURL(); |
| 434 this._name = parsedURL ? parsedURL.lastPathComponentWithFragment() : "#" +
(++WebInspector.ServiceWorker._lastAnonymousTargetId); | 434 this._name = parsedURL ? parsedURL.lastPathComponentWithFragment() : "#" +
(++WebInspector.ServiceWorker._lastAnonymousTargetId); |
| 435 this._scope = parsedURL.host + parsedURL.folderPathComponents; | 435 this._scope = parsedURL ? parsedURL.host + parsedURL.folderPathComponents :
""; |
| 436 | 436 |
| 437 this._manager._workers.set(workerId, this); | 437 this._manager._workers.set(workerId, this); |
| 438 var capabilities = WebInspector.Target.Capability.Network | WebInspector.Tar
get.Capability.Worker; | 438 var capabilities = WebInspector.Target.Capability.Network | WebInspector.Tar
get.Capability.Worker; |
| 439 this._target = WebInspector.targetManager.createTarget(this._name, capabilit
ies, this._connection, manager.target()); | 439 this._target = WebInspector.targetManager.createTarget(this._name, capabilit
ies, this._connection, manager.target()); |
| 440 this._target[WebInspector.ServiceWorker.Symbol] = this; | 440 this._target[WebInspector.ServiceWorker.Symbol] = this; |
| 441 this._manager.dispatchEventToListeners(WebInspector.ServiceWorkerManager.Eve
nts.WorkersUpdated); | 441 this._manager.dispatchEventToListeners(WebInspector.ServiceWorkerManager.Eve
nts.WorkersUpdated); |
| 442 this._target.runtimeAgent().runIfWaitingForDebugger(); | 442 this._target.runtimeAgent().runIfWaitingForDebugger(); |
| 443 } | 443 } |
| 444 | 444 |
| 445 WebInspector.ServiceWorker.Symbol = Symbol("serviceWorker"); | 445 WebInspector.ServiceWorker.Symbol = Symbol("serviceWorker"); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 } | 672 } |
| 673 | 673 |
| 674 WebInspector.ServiceWorkerVersion.prototype = { | 674 WebInspector.ServiceWorkerVersion.prototype = { |
| 675 /** | 675 /** |
| 676 * @param {!ServiceWorkerAgent.ServiceWorkerVersion} payload | 676 * @param {!ServiceWorkerAgent.ServiceWorkerVersion} payload |
| 677 */ | 677 */ |
| 678 _update: function(payload) | 678 _update: function(payload) |
| 679 { | 679 { |
| 680 this.id = payload.versionId; | 680 this.id = payload.versionId; |
| 681 this.scriptURL = payload.scriptURL; | 681 this.scriptURL = payload.scriptURL; |
| 682 this.securityOrigin = payload.scriptURL.asParsedURL().securityOrigin(); | 682 var parsedURL = new WebInspector.ParsedURL(payload.scriptURL); |
| 683 this.securityOrigin = parsedURL.securityOrigin(); |
| 683 this.runningStatus = payload.runningStatus; | 684 this.runningStatus = payload.runningStatus; |
| 684 this.status = payload.status; | 685 this.status = payload.status; |
| 685 this.scriptLastModified = payload.scriptLastModified; | 686 this.scriptLastModified = payload.scriptLastModified; |
| 686 this.scriptResponseTime = payload.scriptResponseTime; | 687 this.scriptResponseTime = payload.scriptResponseTime; |
| 687 this.controlledClients = []; | 688 this.controlledClients = []; |
| 688 for (var i = 0; i < payload.controlledClients.length; ++i) | 689 for (var i = 0; i < payload.controlledClients.length; ++i) |
| 689 this.controlledClients.push(payload.controlledClients[i]); | 690 this.controlledClients.push(payload.controlledClients[i]); |
| 690 }, | 691 }, |
| 691 | 692 |
| 692 /** | 693 /** |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 | 817 |
| 817 WebInspector.ServiceWorkerRegistration.prototype = { | 818 WebInspector.ServiceWorkerRegistration.prototype = { |
| 818 /** | 819 /** |
| 819 * @param {!ServiceWorkerAgent.ServiceWorkerRegistration} payload | 820 * @param {!ServiceWorkerAgent.ServiceWorkerRegistration} payload |
| 820 */ | 821 */ |
| 821 _update: function(payload) | 822 _update: function(payload) |
| 822 { | 823 { |
| 823 this._fingerprint = Symbol("fingerprint"); | 824 this._fingerprint = Symbol("fingerprint"); |
| 824 this.id = payload.registrationId; | 825 this.id = payload.registrationId; |
| 825 this.scopeURL = payload.scopeURL; | 826 this.scopeURL = payload.scopeURL; |
| 826 this.securityOrigin = payload.scopeURL.asParsedURL().securityOrigin(); | 827 var parsedURL = new WebInspector.ParsedURL(payload.scopeURL); |
| 828 this.securityOrigin = parsedURL.securityOrigin(); |
| 827 this.isDeleted = payload.isDeleted; | 829 this.isDeleted = payload.isDeleted; |
| 828 this.forceUpdateOnPageLoad = payload.forceUpdateOnPageLoad; | 830 this.forceUpdateOnPageLoad = payload.forceUpdateOnPageLoad; |
| 829 }, | 831 }, |
| 830 | 832 |
| 831 /** | 833 /** |
| 832 * @return {symbol} | 834 * @return {symbol} |
| 833 */ | 835 */ |
| 834 fingerprint: function() | 836 fingerprint: function() |
| 835 { | 837 { |
| 836 return this._fingerprint; | 838 return this._fingerprint; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 { | 886 { |
| 885 return this._isRedundant() && (!this.errors.length || this._deleting); | 887 return this._isRedundant() && (!this.errors.length || this._deleting); |
| 886 }, | 888 }, |
| 887 | 889 |
| 888 clearErrors: function() | 890 clearErrors: function() |
| 889 { | 891 { |
| 890 this._fingerprint = Symbol("fingerprint"); | 892 this._fingerprint = Symbol("fingerprint"); |
| 891 this.errors = []; | 893 this.errors = []; |
| 892 } | 894 } |
| 893 } | 895 } |
| OLD | NEW |