Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: ports/devenv/background.js

Issue 1415743013: Run jshint over all JavaScript files (Closed) Base URL: https://chromium.googlesource.com/external/naclports.git@repo_conf
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ports/curl/curl.js ('k') | ports/devenv/bash.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2014 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* globals NaClProcessManager, makeRootDir */
8
7 'use strict'; 9 'use strict';
8 10
9 function newWindow() { 11 function newWindow() {
10 chrome.app.window.create('bash.html', { 12 chrome.app.window.create('bash.html', {
11 'bounds': { 13 'bounds': {
12 'width': 800, 14 'width': 800,
13 'height': 600, 15 'height': 600,
14 }, 16 },
15 }); 17 });
16 } 18 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 break; 89 break;
88 case 'nacl_sigint': 90 case 'nacl_sigint':
89 manager.sigint(); 91 manager.sigint();
90 break; 92 break;
91 case 'set_local_repo': 93 case 'set_local_repo':
92 /* 94 /*
93 * Modify /usr/etc/pkg/repos/Local.conf, updating the URL and 95 * Modify /usr/etc/pkg/repos/Local.conf, updating the URL and
94 * enabling the repo. 96 * enabling the repo.
95 * Also, disable /usr/etc/pkg/repos/NaCl.conf. 97 * Also, disable /usr/etc/pkg/repos/NaCl.conf.
96 */ 98 */
97 console.log('set_local_repo') 99 console.log('set_local_repo');
98 var local_repo_file = '/usr/etc/pkg/repos/Local.conf'; 100 var local_repo_file = '/usr/etc/pkg/repos/Local.conf';
99 files.readText(local_repo_file).then(function(data) { 101 files.readText(local_repo_file).then(function(data) {
100 data = data.replace('http://localhost:5103', msg.data); 102 data = data.replace('http://localhost:5103', msg.data);
101 data = data.replace('ENABLED: NO', 'ENABLED: YES', data); 103 data = data.replace('ENABLED: NO', 'ENABLED: YES', data);
102 return files.writeText(local_repo_file, data); 104 return files.writeText(local_repo_file, data);
103 }).then(function() { 105 }).then(function() {
104 var repo_file = '/usr/etc/pkg/repos/NaCl.conf'; 106 var repo_file = '/usr/etc/pkg/repos/NaCl.conf';
105 files.readText(repo_file).then(function(data) { 107 files.readText(repo_file).then(function(data) {
106 data = data.replace('ENABLED: YES', 'ENABLED: NO', data); 108 data = data.replace('ENABLED: YES', 'ENABLED: NO', data);
107 return files.writeText(repo_file, data); 109 return files.writeText(repo_file, data);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 reject(new Error(FileManager.FS_NOT_INITIALIZED)); 262 reject(new Error(FileManager.FS_NOT_INITIALIZED));
261 return; 263 return;
262 } 264 }
263 265
264 var pathInfo = self.translatePath(fileName); 266 var pathInfo = self.translatePath(fileName);
265 pathInfo.fs.root.getFile(pathInfo.path, {create: true}, function(fe) { 267 pathInfo.fs.root.getFile(pathInfo.path, {create: true}, function(fe) {
266 fe.createWriter(onCreateWriter, reject); 268 fe.createWriter(onCreateWriter, reject);
267 }, reject); 269 }, reject);
268 270
269 function onCreateWriter(writer) { 271 function onCreateWriter(writer) {
270 var blob = new Blob([content], {type:'text/plain'}) 272 var blob = new Blob([content], {type:'text/plain'});
271 // Discard arguments. 273 // Discard arguments.
272 writer.onwriteend = function() { 274 writer.onwriteend = function() {
273 // truncate done, write data 275 // truncate done, write data
274 if (writer.length === 0) 276 if (writer.length === 0)
275 writer.write(blob); 277 writer.write(blob);
276 else 278 else
277 resolve(); 279 resolve();
278 } 280 };
279 writer.onerror = reject; 281 writer.onerror = reject;
280 writer.truncate(0); 282 writer.truncate(0);
281 } 283 }
282 }); 284 });
283 }; 285 };
284 286
285 /** 287 /**
286 * Remove a file from the filesystem. This does not work on directories. 288 * Remove a file from the filesystem. This does not work on directories.
287 * @param {string} fileName The name of the file. 289 * @param {string} fileName The name of the file.
288 */ 290 */
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 } 335 }
334 336
335 var pathInfo = self.translatePath(fileName); 337 var pathInfo = self.translatePath(fileName);
336 pathInfo.fs.root.getDirectory(pathInfo.path, {}, function(dir) { 338 pathInfo.fs.root.getDirectory(pathInfo.path, {}, function(dir) {
337 dir.removeRecursively(function() { 339 dir.removeRecursively(function() {
338 resolve(); 340 resolve();
339 }, reject); 341 }, reject);
340 }, reject); 342 }, reject);
341 }); 343 });
342 }; 344 };
OLDNEW
« no previous file with comments | « ports/curl/curl.js ('k') | ports/devenv/bash.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698