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