| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../js/resources/js-test-pre.js"></script> | 3 <script src="../js/resources/js-test-pre.js"></script> |
| 4 <style> | 4 <style> |
| 5 @font-face { | 5 @font-face { |
| 6 font-family: 'ahem'; | 6 font-family: 'ahem'; |
| 7 src: url(../../resources/Ahem.ttf); | 7 src: url(../../resources/Ahem.ttf); |
| 8 } | 8 } |
| 9 </style> | 9 </style> |
| 10 <script> | 10 <script> |
| 11 description('Checks that adding CSS in callback of fonts.loadFont() does not cau
se a crash.'); | 11 description('Checks that adding CSS in callback of fonts.loadFont() does not cau
se a crash.'); |
| 12 | 12 |
| 13 window.jsTestIsAsync = true; | 13 window.jsTestIsAsync = true; |
| 14 | 14 |
| 15 function addCss() { | 15 function addCss() { |
| 16 var cssText = "@font-face { font-family: 'Courier New'; src: local('Courier
New') }"; | 16 var cssText = "@font-face { font-family: 'Courier New'; src: local('Courier
New') }"; |
| 17 var cssNode = document.createElement('style'); | 17 var cssNode = document.createElement('style'); |
| 18 cssNode.type = 'text/css'; | 18 cssNode.type = 'text/css'; |
| 19 var head = document.getElementsByTagName('head')[0]; | 19 var head = document.getElementsByTagName('head')[0]; |
| 20 head.appendChild(cssNode); | 20 head.appendChild(cssNode); |
| 21 var cssTextNode = document.createTextNode(cssText); | 21 var cssTextNode = document.createTextNode(cssText); |
| 22 cssNode.appendChild(cssTextNode); | 22 cssNode.appendChild(cssTextNode); |
| 23 finishJSTest(); | 23 finishJSTest(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 if (document.fonts) | 26 if (document.fonts) |
| 27 document.fonts.loadFont({font:"12px ahem", onsuccess:addCss}) | 27 document.fonts.load("12px ahem").then(addCss); |
| 28 else { | 28 else { |
| 29 testFailed('document.fonts does not exist'); | 29 testFailed('document.fonts does not exist'); |
| 30 finishJSTest(); | 30 finishJSTest(); |
| 31 } | 31 } |
| 32 </script> | 32 </script> |
| 33 </head> | 33 </head> |
| 34 <body> | 34 <body> |
| 35 <script src="../js/resources/js-test-post.js"></script> | 35 <script src="../js/resources/js-test-post.js"></script> |
| 36 </body> | 36 </body> |
| 37 </html> | 37 </html> |
| OLD | NEW |