Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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('chrome.popular_sites_internals', function() { | 5 cr.define('chrome.popular_sites_internals', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 function initialize() { | 8 function initialize() { |
| 9 function submitDownload(event) { | 9 function submitDownload(event) { |
| 10 $('download-result').textContent = ''; | 10 $('download-result').textContent = ''; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 $('view-json').addEventListener('click', viewJson); | 25 $('view-json').addEventListener('click', viewJson); |
| 26 | 26 |
| 27 chrome.send('registerForEvents'); | 27 chrome.send('registerForEvents'); |
| 28 } | 28 } |
| 29 | 29 |
| 30 function receiveDownloadResult(result) { | 30 function receiveDownloadResult(result) { |
| 31 $('download-result').textContent = result; | 31 $('download-result').textContent = result; |
| 32 } | 32 } |
| 33 | 33 |
| 34 function receiveSites(sites) { | 34 function receiveSites(sites) { |
| 35 jstProcess(new JsEvalContext(sites), $('sites')); | 35 var context = new JsEvalContext(sites); |
| 36 jstProcess(context, $('info')); | |
|
Bernhard Bauer
2016/04/07 12:24:28
You could just process the parent of these nodes.
Marc Treib
2016/04/07 13:38:39
Done.
| |
| 37 jstProcess(context, $('sites')); | |
| 36 // Also clear the json string, since it's likely stale now. | 38 // Also clear the json string, since it's likely stale now. |
| 37 $('json-value').textContent = ''; | 39 $('json-value').textContent = ''; |
| 38 } | 40 } |
| 39 | 41 |
| 40 function receiveJson(json) { | 42 function receiveJson(json) { |
| 41 $('json-value').textContent = json; | 43 $('json-value').textContent = json; |
| 42 } | 44 } |
| 43 | 45 |
| 44 // Return an object with all of the exports. | 46 // Return an object with all of the exports. |
| 45 return { | 47 return { |
| 46 initialize: initialize, | 48 initialize: initialize, |
| 47 receiveDownloadResult: receiveDownloadResult, | 49 receiveDownloadResult: receiveDownloadResult, |
| 48 receiveSites: receiveSites, | 50 receiveSites: receiveSites, |
| 49 receiveJson: receiveJson, | 51 receiveJson: receiveJson, |
| 50 }; | 52 }; |
| 51 }); | 53 }); |
| 52 | 54 |
| 53 document.addEventListener('DOMContentLoaded', | 55 document.addEventListener('DOMContentLoaded', |
| 54 chrome.popular_sites_internals.initialize); | 56 chrome.popular_sites_internals.initialize); |
| 55 | 57 |
| OLD | NEW |