OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <include src="extension_error.js"></include> | 5 <include src="extension_error.js"></include> |
6 | 6 |
7 cr.define('options', function() { | 7 cr.define('options', function() { |
8 'use strict'; | 8 'use strict'; |
9 | 9 |
10 /** | 10 /** |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 // The extension warnings (describing runtime issues). | 298 // The extension warnings (describing runtime issues). |
299 if (extension.warnings) { | 299 if (extension.warnings) { |
300 var panel = node.querySelector('.extension-warnings'); | 300 var panel = node.querySelector('.extension-warnings'); |
301 panel.hidden = false; | 301 panel.hidden = false; |
302 var list = panel.querySelector('ul'); | 302 var list = panel.querySelector('ul'); |
303 extension.warnings.forEach(function(warning) { | 303 extension.warnings.forEach(function(warning) { |
304 list.appendChild(document.createElement('li')).innerText = warning; | 304 list.appendChild(document.createElement('li')).innerText = warning; |
305 }); | 305 }); |
306 } | 306 } |
307 | 307 |
308 // The manifest errors and warnings, in one of two formats (depending on | 308 // If the ErrorConsole is enabled, handle the manifest and runtime errors. |
309 // if the ErrorConsole is enabled). | 309 // Otherwise, handle any install warnings. |
310 if (extension.manifestErrors) { | 310 if (extension.manifestErrors || extension.runtimeErrors) { |
311 var manifestErrors = node.querySelector('.manifest-errors'); | 311 if (extension.manifestErrors) { |
312 manifestErrors.hidden = false; | 312 var panel = node.querySelector('.manifest-errors-wrapper'); |
313 manifestErrors.appendChild( | 313 panel.hidden = false; |
314 new extensions.ExtensionErrorList(extension.manifestErrors)); | 314 panel.appendChild(new extensions.ExtensionErrorList( |
315 extension.manifestErrors, 'manifest')); | |
316 } | |
317 if (extension.runtimeErrors) { | |
318 var panel = node.querySelector('.runtime-errors-wrapper'); | |
319 panel.hidden = false; | |
320 panel.appendChild(new extensions.ExtensionErrorList( | |
321 extension.runtimeErrors, 'runtime')); | |
322 } | |
315 } else if (extension.installWarnings) { | 323 } else if (extension.installWarnings) { |
not at google - send to devlin
2013/09/05 00:37:16
I'm puzzled by the else here. Why can't this be:
Devlin
2013/09/05 17:53:55
It can be. I had it like that for two reasons:
1.
not at google - send to devlin
2013/09/06 17:05:19
Yeah - it would be simpler to just render what we'
| |
316 var panel = node.querySelector('.install-warnings'); | 324 var panel = node.querySelector('.install-warnings'); |
317 panel.hidden = false; | 325 panel.hidden = false; |
318 var list = panel.querySelector('ul'); | 326 var list = panel.querySelector('ul'); |
319 extension.installWarnings.forEach(function(warning) { | 327 extension.installWarnings.forEach(function(warning) { |
320 var li = document.createElement('li'); | 328 var li = document.createElement('li'); |
321 li.innerText = warning.message; | 329 li.innerText = warning.message; |
322 list.appendChild(li); | 330 list.appendChild(li); |
323 }); | 331 }); |
324 } | 332 } |
325 | 333 |
326 this.appendChild(node); | 334 this.appendChild(node); |
327 if (location.hash.substr(1) == extension.id) { | 335 if (location.hash.substr(1) == extension.id) { |
328 // Scroll beneath the fixed header so that the extension is not | 336 // Scroll beneath the fixed header so that the extension is not |
329 // obscured. | 337 // obscured. |
330 var topScroll = node.offsetTop - $('page-header').offsetHeight; | 338 var topScroll = node.offsetTop - $('page-header').offsetHeight; |
331 var pad = parseInt(getComputedStyle(node, null).marginTop, 10); | 339 var pad = parseInt(getComputedStyle(node, null).marginTop, 10); |
332 if (!isNaN(pad)) | 340 if (!isNaN(pad)) |
333 topScroll -= pad / 2; | 341 topScroll -= pad / 2; |
334 document.body.scrollTop = topScroll; | 342 document.body.scrollTop = topScroll; |
335 } | 343 } |
336 }, | 344 }, |
337 }; | 345 }; |
338 | 346 |
339 return { | 347 return { |
340 ExtensionsList: ExtensionsList | 348 ExtensionsList: ExtensionsList |
341 }; | 349 }; |
342 }); | 350 }); |
OLD | NEW |