OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('serviceworker', function() { | 5 cr.define('serviceworker', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 function initialize() { | 8 function initialize() { |
9 if (window.location.hash == "#iframe") { | 9 if (window.location.hash == "#iframe") { |
10 // This page is loaded from chrome://inspect. | 10 // This page is loaded from chrome://inspect. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 178 } |
179 var unregistered_registrations = []; | 179 var unregistered_registrations = []; |
180 var unregistered_versions = []; | 180 var unregistered_versions = []; |
181 getUnregisteredWorkers(stored_registrations, | 181 getUnregisteredWorkers(stored_registrations, |
182 live_registrations, | 182 live_registrations, |
183 live_versions, | 183 live_versions, |
184 unregistered_registrations, | 184 unregistered_registrations, |
185 unregistered_versions); | 185 unregistered_versions); |
186 var template; | 186 var template; |
187 var container = $('serviceworker-list'); | 187 var container = $('serviceworker-list'); |
188 // Existing templates are keyed by partition_path. This allows | 188 // Existing templates are keyed by partition_id. This allows |
189 // the UI to be updated in-place rather than refreshing the | 189 // the UI to be updated in-place rather than refreshing the |
190 // whole page. | 190 // whole page. |
191 for (var i = 0; i < container.childNodes.length; ++i) { | 191 for (var i = 0; i < container.childNodes.length; ++i) { |
192 if (container.childNodes[i].partition_path == partition_path) { | 192 if (container.childNodes[i].partition_id == partition_id) { |
193 template = container.childNodes[i]; | 193 template = container.childNodes[i]; |
194 } | 194 } |
195 } | 195 } |
196 // This is probably the first time we're loading. | 196 // This is probably the first time we're loading. |
197 if (!template) { | 197 if (!template) { |
198 template = jstGetTemplate('serviceworker-list-template'); | 198 template = jstGetTemplate('serviceworker-list-template'); |
199 container.appendChild(template); | 199 container.appendChild(template); |
200 } | 200 } |
201 var fillLogFunc = fillLogForVersion.bind(this, partition_id); | 201 var fillLogFunc = fillLogForVersion.bind(this, partition_id); |
202 stored_registrations.forEach(function(registration) { | 202 stored_registrations.forEach(function(registration) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 onWorkerStopped: onWorkerStopped, | 295 onWorkerStopped: onWorkerStopped, |
296 onErrorReported: onErrorReported, | 296 onErrorReported: onErrorReported, |
297 onConsoleMessageReported: onConsoleMessageReported, | 297 onConsoleMessageReported: onConsoleMessageReported, |
298 onVersionStateChanged: onVersionStateChanged, | 298 onVersionStateChanged: onVersionStateChanged, |
299 onRegistrationStored: onRegistrationStored, | 299 onRegistrationStored: onRegistrationStored, |
300 onRegistrationDeleted: onRegistrationDeleted, | 300 onRegistrationDeleted: onRegistrationDeleted, |
301 }; | 301 }; |
302 }); | 302 }); |
303 | 303 |
304 document.addEventListener('DOMContentLoaded', serviceworker.initialize); | 304 document.addEventListener('DOMContentLoaded', serviceworker.initialize); |
OLD | NEW |