Merge pull request #1346 from notmasteryet/verifyname-2

Verify the names parameter in fontLoaderPrepareFontLoadEvent
This commit is contained in:
Brendan Dahl 2012-03-16 10:48:57 -07:00
commit 2c5de00ef3

View File

@ -500,6 +500,12 @@ var FontLoader = {
// The postMessage() hackery was added to work around chrome bug // The postMessage() hackery was added to work around chrome bug
// 82402. // 82402.
// Validate the names parameter -- the values can used to construct HTML.
if (!/^\w+$/.test(names.join(''))) {
error('Invalid font name(s): ' + names.join());
return; // Keep the return in case if error() did not throw.
}
var div = document.createElement('div'); var div = document.createElement('div');
div.setAttribute('style', div.setAttribute('style',
'visibility: hidden;' + 'visibility: hidden;' +