##// END OF EJS Templates
Treat set_rendered as unsafe.
Jonathan Frederic -
Show More
@@ -245,8 +245,6 b' var IPython = (function (IPython) {'
245 245 * @method set_rendered
246 246 */
247 247 TextCell.prototype.set_rendered = function(text) {
248 // TODO: This HTML needs to be treated as potentially dangerous
249 // user input.
250 248 this.element.find('div.text_cell_render').html(text);
251 249 };
252 250
@@ -297,6 +295,8 b' var IPython = (function (IPython) {'
297 295 // make this value the starting point, so that we can only undo
298 296 // to this state, instead of a blank cell
299 297 this.code_mirror.clearHistory();
298 // TODO: This HTML needs to be treated as potentially dangerous
299 // user input and should be handled before set_rendered.
300 300 this.set_rendered(data.rendered || '');
301 301 this.rendered = false;
302 302 this.render();
@@ -355,12 +355,17 b' var IPython = (function (IPython) {'
355 355 // Links in markdown cells should open in new tabs.
356 356 html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
357 357 try {
358 // TODO: This HTML needs to be treated as potentially dangerous
359 // user input and should be handled before set_rendered.
358 360 this.set_rendered(html);
359 361 } catch (e) {
360 362 console.log("Error running Javascript in Markdown:");
361 363 console.log(e);
362 this.set_rendered($("<div/>").addClass("js-error").html(
363 "Error rendering Markdown!<br/>" + e.toString())
364 rendered.empty();
365 rendered.append(
366 $("<div/>")
367 .append($("<div/>").text('Error rendering Markdown!').addClass("js-error"))
368 .append($("<div/>").text(e.toString()).addClass("js-error"))
364 369 );
365 370 }
366 371 this.element.find('div.text_cell_input').hide();
@@ -507,8 +512,6 b' var IPython = (function (IPython) {'
507 512
508 513
509 514 HeadingCell.prototype.set_rendered = function (html) {
510 // TODO: This HTML needs to be treated as potentially dangerous
511 // user input.
512 515 this.element.find("div.text_cell_render").html(html);
513 516 };
514 517
@@ -542,7 +545,8 b' var IPython = (function (IPython) {'
542 545 .attr('href', '#' + hash)
543 546 .text('¶')
544 547 );
545
548 // TODO: This HTML needs to be treated as potentially dangerous
549 // user input and should be handled before set_rendered.
546 550 this.set_rendered(h);
547 551 this.typeset();
548 552 this.element.find('div.text_cell_input').hide();
General Comments 0
You need to be logged in to leave comments. Login now