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

Side by Side Diff: third_party/WebKit/Source/devtools/scripts/utils.js

Issue 2489033003: DevTools: hosted mode fallback if generated files aren't uploaded yet (Closed)
Patch Set: fix the git grep so it works on full & front-end checkout Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 var fs = require("fs"); 5 var fs = require("fs");
6 var http = require("http"); 6 var http = require("http");
7 var https = require("https"); 7 var https = require("https");
8 var path = require("path"); 8 var path = require("path");
9 var parseURL = require("url").parse; 9 var parseURL = require("url").parse;
10 var shell = require("child_process").execSync;
10 var Stream = require("stream").Transform; 11 var Stream = require("stream").Transform;
11 12
12 function fetch(url) 13 function fetch(url)
13 { 14 {
14 return new Promise(fetchPromise); 15 return new Promise(fetchPromise);
15 16
16 function fetchPromise(resolve, reject) 17 function fetchPromise(resolve, reject)
17 { 18 {
18 var request; 19 var request;
19 var protocol = parseURL(url).protocol; 20 var protocol = parseURL(url).protocol;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } catch (error) { 115 } catch (error) {
115 throw new Error(`Received an error: [${error}] while trying to remove: $ {filePath}`); 116 throw new Error(`Received an error: [${error}] while trying to remove: $ {filePath}`);
116 } 117 }
117 } 118 }
118 119
119 function includes(sequence, target) 120 function includes(sequence, target)
120 { 121 {
121 return sequence.indexOf(target) > -1; 122 return sequence.indexOf(target) > -1;
122 } 123 }
123 124
125 function shellOutput(command)
126 {
127 return shell(command).toString().trim();
128 }
129
124 module.exports = { 130 module.exports = {
125 fetch, 131 fetch,
126 atob, 132 atob,
127 isFile, 133 isFile,
128 isDir, 134 isDir,
129 copy, 135 copy,
130 copyRecursive, 136 copyRecursive,
131 removeRecursive, 137 removeRecursive,
132 includes, 138 includes,
139 shellOutput,
133 }; 140 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698