| OLD | NEW | 
| (Empty) |  | 
 |   1 <!DOCTYPE html> | 
 |   2 <html> | 
 |   3  | 
 |   4 <head> | 
 |   5     <!-- Programmatically converted from a WebKit Reftest, please forgive result
    ing idiosyncracies.--> | 
 |   6     <title>scripthash-unicode-normalization</title> | 
 |   7     <script src="/resources/testharness.js"></script> | 
 |   8     <script src="/resources/testharnessreport.js"></script> | 
 |   9  | 
 |  10     <!-- enforcing policy: | 
 |  11 script-src 'self' 'nonce-nonceynonce' 'sha256-dWTP4Di8KBjaiXvQ5mRquI9OoBSo921ahY
    xLfYSiuT8='; connect-src 'self'; | 
 |  12 --> | 
 |  13     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 
 |  14 </head> | 
 |  15  | 
 |  16 <body> | 
 |  17     <!-- The following two scripts contain two separate code points (U+00C5 | 
 |  18         and U+212B, respectively) which, depending on your text editor, might be | 
 |  19         rendered the same.However, their difference is important because, under | 
 |  20         NFC normalization, they would become the same code point, which would be | 
 |  21         against the spec. This test, therefore, validates that the scripts have | 
 |  22         *different* hash values. --> | 
 |  23     <script nonce="nonceynonce"> | 
 |  24       var matchingContent = 'Å'; | 
 |  25       var nonMatchingContent = 'Å'; | 
 |  26  | 
 |  27       // This script should have a hash value of | 
 |  28       // sha256-9UFeeZbvnMa0tLNu76v96T4Hh+UtDWHm2lPQJoTWb9c= | 
 |  29       var scriptContent1 = "window.finish('" + matchingContent + "');"; | 
 |  30  | 
 |  31       // This script should have a hash value of | 
 |  32       // sha256-iNjjXUXds31FFvkAmbC74Sxnvreug3PzGtu16udQyqM= | 
 |  33       var scriptContent2 = "window.finish('" + nonMatchingContent + "');"; | 
 |  34  | 
 |  35       var script1 = document.createElement('script'); | 
 |  36       var script2 = document.createElement('script'); | 
 |  37  | 
 |  38       script1.test = async_test("Only matching content runs even with NFC normal
    ization."); | 
 |  39  | 
 |  40       var failure = function() { | 
 |  41         assert_unreached(); | 
 |  42       } | 
 |  43  | 
 |  44       window.finish = function(content) { | 
 |  45         if (content == matchingContent) { | 
 |  46           script1.test.step(function() { | 
 |  47             script1.test.done(); | 
 |  48           }); | 
 |  49         } else { | 
 |  50           script1.test.step(function() { | 
 |  51             assert_unreached("nonMatchingContent script ran"); | 
 |  52           }); | 
 |  53         } | 
 |  54       } | 
 |  55  | 
 |  56       script1.onerror = failure; | 
 |  57  | 
 |  58       document.body.appendChild(script2); | 
 |  59       script2.textContent = scriptContent2; | 
 |  60       document.body.appendChild(script1); | 
 |  61       script1.textContent = scriptContent1; | 
 |  62     </script> | 
 |  63  | 
 |  64     <p> | 
 |  65         This tests Unicode normalization. While appearing the same, the strings 
    in the scripts are different Unicode points, but through normalization, should b
    e the same when the hash is taken. | 
 |  66     </p> | 
 |  67     <div id="log"></div> | 
 |  68     <script async defer src="../support/checkReport.sub.js?reportExists=true"></
    script> | 
 |  69 </body> | 
 |  70  | 
 |  71 </html> | 
| OLD | NEW |