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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 var parsedURL = url.asParsedURL(); | 102 var parsedURL = url.asParsedURL(); |
103 var workerName = parsedURL ? parsedURL.lastPathComponentWithFragment() :
"#" + (++this._lastAnonymousTargetId); | 103 var workerName = parsedURL ? parsedURL.lastPathComponentWithFragment() :
"#" + (++this._lastAnonymousTargetId); |
104 var target = WebInspector.targetManager.createTarget(workerName, WebInsp
ector.Target.Capability.JS, connection, this.target()); | 104 var target = WebInspector.targetManager.createTarget(workerName, WebInsp
ector.Target.Capability.JS, connection, this.target()); |
105 this._targetsByWorkerId.set(workerId, target); | 105 this._targetsByWorkerId.set(workerId, target); |
106 | 106 |
107 // Only pause new worker if debugging SW - we are going through the | 107 // Only pause new worker if debugging SW - we are going through the |
108 // pause on start checkbox. | 108 // pause on start checkbox. |
109 var mainIsServiceWorker = WebInspector.targetManager.mainTarget().hasWor
kerCapability() && !WebInspector.targetManager.mainTarget().hasBrowserCapability
(); | 109 var mainIsServiceWorker = WebInspector.targetManager.mainTarget().hasWor
kerCapability() && !WebInspector.targetManager.mainTarget().hasBrowserCapability
(); |
110 if (mainIsServiceWorker && waitingForDebugger) | 110 if (mainIsServiceWorker && waitingForDebugger) |
111 target.debuggerAgent().pause(); | 111 target.debuggerAgent().pause(); |
112 target.runtimeAgent().run(); | 112 target.runtimeAgent().runIfWaitingForDebugger(); |
113 }, | 113 }, |
114 | 114 |
115 /** | 115 /** |
116 * @param {string} workerId | 116 * @param {string} workerId |
117 */ | 117 */ |
118 _workerTerminated: function(workerId) | 118 _workerTerminated: function(workerId) |
119 { | 119 { |
120 var connection = this._connections.get(workerId); | 120 var connection = this._connections.get(workerId); |
121 if (connection) | 121 if (connection) |
122 connection._close(); | 122 connection._close(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 this._agent.sendMessageToWorker(this._workerId, JSON.stringify(messageOb
ject)); | 221 this._agent.sendMessageToWorker(this._workerId, JSON.stringify(messageOb
ject)); |
222 }, | 222 }, |
223 | 223 |
224 _close: function() | 224 _close: function() |
225 { | 225 { |
226 this.connectionClosed("worker_terminated"); | 226 this.connectionClosed("worker_terminated"); |
227 }, | 227 }, |
228 | 228 |
229 __proto__: InspectorBackendClass.Connection.prototype | 229 __proto__: InspectorBackendClass.Connection.prototype |
230 } | 230 } |
OLD | NEW |