MDL-45471 javascript: Escape content of exception dialogs
This commit is contained in:
committed by
Dan Poltawski
parent
ec57b5669c
commit
6eb787b873
@@ -302,13 +302,13 @@ Y.extend(EXCEPTION, DIALOGUE, {
|
||||
delay = this.get('hideTimeoutDelay');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">'
|
||||
+ config.name + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
+ Y.Escape.html(config.name) + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-exception"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+this.get('message')+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+Y.Escape.html(this.get('message'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-filename"><label>File:</label> '
|
||||
+ this.get('fileName')+'</div>'))
|
||||
+ Y.Escape.html(this.get('fileName'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-linenumber"><label>Line:</label> '
|
||||
+ this.get('lineNumber')+'</div>'))
|
||||
+ Y.Escape.html(this.get('lineNumber'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'
|
||||
+ this.get('stack')+'</pre></div>'));
|
||||
if (M.cfg.developerdebug) {
|
||||
@@ -351,7 +351,7 @@ Y.extend(EXCEPTION, DIALOGUE, {
|
||||
},
|
||||
stack : {
|
||||
setter : function(str) {
|
||||
var lines = str.split("\n"),
|
||||
var lines = Y.Escape.html(str).split("\n"),
|
||||
pattern = new RegExp('^(.+)@('+M.cfg.wwwroot+')?(.{0,75}).*:(\\d+)$'),
|
||||
i;
|
||||
for (i in lines) {
|
||||
@@ -382,15 +382,15 @@ Y.extend(AJAXEXCEPTION, DIALOGUE, {
|
||||
delay = this.get('hideTimeoutDelay');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">'
|
||||
+ config.name + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
+ Y.Escape.html(config.name) + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-ajaxexception"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+this.get('error')+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+Y.Escape.html(this.get('error'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>URL:</label> '
|
||||
+ this.get('reproductionlink')+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>Debug info:</label> '
|
||||
+ this.get('debuginfo')+'</div>'))
|
||||
+ Y.Escape.html(this.get('debuginfo'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'
|
||||
+ this.get('stacktrace')+'</pre></div>'));
|
||||
+ Y.Escape.html(this.get('stacktrace'))+'</pre></div>'));
|
||||
if (M.cfg.developerdebug) {
|
||||
content.all('.moodle-exception-param').removeClass('hidden');
|
||||
}
|
||||
@@ -427,6 +427,7 @@ Y.extend(AJAXEXCEPTION, DIALOGUE, {
|
||||
reproductionlink : {
|
||||
setter : function(link) {
|
||||
if (link !== null) {
|
||||
link = Y.Escape.html(link);
|
||||
link = '<a href="'+link+'">'+link.replace(M.cfg.wwwroot, '')+'</a>';
|
||||
}
|
||||
return link;
|
||||
@@ -448,4 +449,4 @@ M.core.exception = EXCEPTION;
|
||||
M.core.ajaxException = AJAXEXCEPTION;
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "panel", "event-key", "dd-plugin"]});
|
||||
}, '@VERSION@', {"requires": ["base", "node", "panel", "event-key", "escape", "dd-plugin"]});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -302,13 +302,13 @@ Y.extend(EXCEPTION, DIALOGUE, {
|
||||
delay = this.get('hideTimeoutDelay');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">'
|
||||
+ config.name + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
+ Y.Escape.html(config.name) + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-exception"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+this.get('message')+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+Y.Escape.html(this.get('message'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-filename"><label>File:</label> '
|
||||
+ this.get('fileName')+'</div>'))
|
||||
+ Y.Escape.html(this.get('fileName'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-linenumber"><label>Line:</label> '
|
||||
+ this.get('lineNumber')+'</div>'))
|
||||
+ Y.Escape.html(this.get('lineNumber'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'
|
||||
+ this.get('stack')+'</pre></div>'));
|
||||
if (M.cfg.developerdebug) {
|
||||
@@ -351,7 +351,7 @@ Y.extend(EXCEPTION, DIALOGUE, {
|
||||
},
|
||||
stack : {
|
||||
setter : function(str) {
|
||||
var lines = str.split("\n"),
|
||||
var lines = Y.Escape.html(str).split("\n"),
|
||||
pattern = new RegExp('^(.+)@('+M.cfg.wwwroot+')?(.{0,75}).*:(\\d+)$'),
|
||||
i;
|
||||
for (i in lines) {
|
||||
@@ -382,15 +382,15 @@ Y.extend(AJAXEXCEPTION, DIALOGUE, {
|
||||
delay = this.get('hideTimeoutDelay');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">'
|
||||
+ config.name + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
+ Y.Escape.html(config.name) + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-ajaxexception"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+this.get('error')+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+Y.Escape.html(this.get('error'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>URL:</label> '
|
||||
+ this.get('reproductionlink')+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>Debug info:</label> '
|
||||
+ this.get('debuginfo')+'</div>'))
|
||||
+ Y.Escape.html(this.get('debuginfo'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'
|
||||
+ this.get('stacktrace')+'</pre></div>'));
|
||||
+ Y.Escape.html(this.get('stacktrace'))+'</pre></div>'));
|
||||
if (M.cfg.developerdebug) {
|
||||
content.all('.moodle-exception-param').removeClass('hidden');
|
||||
}
|
||||
@@ -427,6 +427,7 @@ Y.extend(AJAXEXCEPTION, DIALOGUE, {
|
||||
reproductionlink : {
|
||||
setter : function(link) {
|
||||
if (link !== null) {
|
||||
link = Y.Escape.html(link);
|
||||
link = '<a href="'+link+'">'+link.replace(M.cfg.wwwroot, '')+'</a>';
|
||||
}
|
||||
return link;
|
||||
@@ -448,4 +449,4 @@ M.core.exception = EXCEPTION;
|
||||
M.core.ajaxException = AJAXEXCEPTION;
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["base", "node", "panel", "event-key", "dd-plugin"]});
|
||||
}, '@VERSION@', {"requires": ["base", "node", "panel", "event-key", "escape", "dd-plugin"]});
|
||||
|
||||
+10
-9
@@ -300,13 +300,13 @@ Y.extend(EXCEPTION, DIALOGUE, {
|
||||
delay = this.get('hideTimeoutDelay');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">'
|
||||
+ config.name + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
+ Y.Escape.html(config.name) + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-exception"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+this.get('message')+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+Y.Escape.html(this.get('message'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-filename"><label>File:</label> '
|
||||
+ this.get('fileName')+'</div>'))
|
||||
+ Y.Escape.html(this.get('fileName'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-linenumber"><label>Line:</label> '
|
||||
+ this.get('lineNumber')+'</div>'))
|
||||
+ Y.Escape.html(this.get('lineNumber'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'
|
||||
+ this.get('stack')+'</pre></div>'));
|
||||
if (M.cfg.developerdebug) {
|
||||
@@ -349,7 +349,7 @@ Y.extend(EXCEPTION, DIALOGUE, {
|
||||
},
|
||||
stack : {
|
||||
setter : function(str) {
|
||||
var lines = str.split("\n"),
|
||||
var lines = Y.Escape.html(str).split("\n"),
|
||||
pattern = new RegExp('^(.+)@('+M.cfg.wwwroot+')?(.{0,75}).*:(\\d+)$'),
|
||||
i;
|
||||
for (i in lines) {
|
||||
@@ -380,15 +380,15 @@ Y.extend(AJAXEXCEPTION, DIALOGUE, {
|
||||
delay = this.get('hideTimeoutDelay');
|
||||
this.get(BASE).addClass('moodle-dialogue-exception');
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER, '<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">'
|
||||
+ config.name + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
+ Y.Escape.html(config.name) + '</h1>', Y.WidgetStdMod.REPLACE);
|
||||
content = Y.Node.create('<div class="moodle-ajaxexception"></div>')
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+this.get('error')+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-message">'+Y.Escape.html(this.get('error'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>URL:</label> '
|
||||
+ this.get('reproductionlink')+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-debuginfo"><label>Debug info:</label> '
|
||||
+ this.get('debuginfo')+'</div>'))
|
||||
+ Y.Escape.html(this.get('debuginfo'))+'</div>'))
|
||||
.append(Y.Node.create('<div class="moodle-exception-param hidden param-stacktrace"><label>Stack trace:</label> <pre>'
|
||||
+ this.get('stacktrace')+'</pre></div>'));
|
||||
+ Y.Escape.html(this.get('stacktrace'))+'</pre></div>'));
|
||||
if (M.cfg.developerdebug) {
|
||||
content.all('.moodle-exception-param').removeClass('hidden');
|
||||
}
|
||||
@@ -425,6 +425,7 @@ Y.extend(AJAXEXCEPTION, DIALOGUE, {
|
||||
reproductionlink : {
|
||||
setter : function(link) {
|
||||
if (link !== null) {
|
||||
link = Y.Escape.html(link);
|
||||
link = '<a href="'+link+'">'+link.replace(M.cfg.wwwroot, '')+'</a>';
|
||||
}
|
||||
return link;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"node",
|
||||
"panel",
|
||||
"event-key",
|
||||
"escape",
|
||||
"dd-plugin"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user