MDL-31499 Javascript: Handle invalid window names in openpopup

This commit is contained in:
Frederic Massart
2012-09-24 15:24:30 +08:00
parent c366bea3cf
commit fede879cf2
+9
View File
@@ -1178,6 +1178,15 @@ function openpopup(event, args) {
}
}
// Cleans window name because IE does not support funky ones.
var nameregex = /[^a-z0-9_]/i;
if (args.name.match(nameregex)) {
args.name = args.name.replace(nameregex, '_');
if (M.cfg.developerdebug) {
alert('DEVELOPER NOTICE: Invalid \'name\' passed to openpopup()');
}
}
var fullurl = args.url;
if (!args.url.match(/https?:\/\//)) {
fullurl = M.cfg.wwwroot + args.url;