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

Side by Side Diff: experimental/webtry/res/js/webtry.js

Issue 644253003: fix display of fiddles that DON'T have compile errors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months 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 | « no previous file | experimental/webtry/webtry.go » ('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 * Common JS that talks XHR back to the server and runs the code and receives 2 * Common JS that talks XHR back to the server and runs the code and receives
3 * the results. 3 * the results.
4 */ 4 */
5 5
6 6
7 /** 7 /**
8 * All the functionality is wrapped up in this anonymous closure, but we need 8 * All the functionality is wrapped up in this anonymous closure, but we need
9 * to be told if we are on the workspace page or a normal try page, so the 9 * to be told if we are on the workspace page or a normal try page, so the
10 * workspaceName is passed into the closure, it must be set in the global 10 * workspaceName is passed into the closure, it must be set in the global
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // The response is JSON of the form: 262 // The response is JSON of the form:
263 // { 263 // {
264 // "message": "you had an error...", 264 // "message": "you had an error...",
265 // "img": "<base64 encoded image but only on success>" 265 // "img": "<base64 encoded image but only on success>"
266 // } 266 // }
267 // 267 //
268 // The img is optional and only appears if there is a valid 268 // The img is optional and only appears if there is a valid
269 // image to display. 269 // image to display.
270 endWait(); 270 endWait();
271 body = JSON.parse(e.target.response); 271 body = JSON.parse(e.target.response);
272 if (body.compileErrors.length) { 272 if (null != body.compileErrors && body.compileErrors.length) {
273 html = ""; 273 html = "";
274 for (i = 0 ; i < body.compileErrors.length ; i++) { 274 for (i = 0 ; i < body.compileErrors.length ; i++) {
275 compileError = body.compileErrors[i]; 275 compileError = body.compileErrors[i];
276 276
277 err = document.createElement("div"); 277 err = document.createElement("div");
278 err.className = "compile-error"; 278 err.className = "compile-error";
279 279
280 loc = document.createElement("span"); 280 loc = document.createElement("span");
281 loc.className = "error-location"; 281 loc.className = "error-location";
282 loc.innerHTML = "Line " + compileError.line + ", col " + compileErro r.column + ": "; 282 loc.innerHTML = "Line " + compileError.line + ", col " + compileErro r.column + ": ";
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 368 }
369 369
370 // If loaded via HTML Imports then DOMContentLoaded will be long done. 370 // If loaded via HTML Imports then DOMContentLoaded will be long done.
371 if (document.readyState != "loading") { 371 if (document.readyState != "loading") {
372 onLoad(); 372 onLoad();
373 } else { 373 } else {
374 this.addEventListener('load', onLoad); 374 this.addEventListener('load', onLoad);
375 } 375 }
376 376
377 })(); 377 })();
OLDNEW
« no previous file with comments | « no previous file | experimental/webtry/webtry.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698