From: Chris Jones Date: Mon, 4 Jul 2011 22:21:13 +0000 (-0400) Subject: handle font names with comments (fix fix of hack hack) X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=fe09c1852c853606e956cb47419d6fc9da0a4ea4;p=pdf.js.git handle font names with comments (fix fix of hack hack) --- diff --git a/fonts.js b/fonts.js index 12d7ce8..735213f 100644 --- a/fonts.js +++ b/fonts.js @@ -218,12 +218,7 @@ var FontLoader = { window.addEventListener( "message", function(e) { - var fontNames = e.data; - // Firefox 5 doesn't parse the JSON here. Welcome to the - // Wonderful Web World. - if ("string" == typeof(fontNames)) { - fontNames = fontNames.split(","); - } + var fontNames = JSON.parse(e.data); for (var i = 0; i < fontNames.length; ++i) { var font = Fonts.lookup(fontNames[i]); font.loading = false; @@ -251,7 +246,7 @@ var FontLoader = { } src += ' var fontNames=['+ fontNamesArray +'];\n'; src += ' window.onload = function () {\n' - src += ' top.postMessage(fontNames, "*");\n'; + src += ' top.postMessage(JSON.stringify(fontNames), "*");\n'; src += ' }'; src += ''; for (var i = 0; i < names.length; ++i) {