Bug 1484506 [wpt PR 12562] - [FIXED] /html/semantics/scripting-1/the-script-element/script-charset-02.html Passed, a=testonly
authorAaqa Ishtyaq <aaqaishtyaq@gmail.com>
Wed, 22 Aug 2018 13:21:31 +0000
changeset 481390 f39a693e10b3f2b68e3e5190ead83d45264266c5
parent 481389 1c10a2029f46ba8e2cb9b3430e2e2c17a3f4473b
child 481391 0fa29f938e7259cec37f1f0c6eadc83a29490c3c
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewerstestonly
bugs1484506, 12562
milestone63.0a1
Bug 1484506 [wpt PR 12562] - [FIXED] /html/semantics/scripting-1/the-script-element/script-charset-02.html Passed, a=testonly Automatic update from web-platform-tests[FIXED] /html/semantics/scripting-1/the-script-element/script-charset-02.html Passed (#12562) -- wpt-commits: 2ac3315a2d73c6252a86ef2b4e1f5aae1dc55faf wpt-pr: 12562
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-charset-02.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -603607,17 +603607,17 @@
    "f3b1c7e2ea61b571bd56cc1c70c5f89bb8e7e4dc",
    "support"
   ],
   "html/semantics/scripting-1/the-script-element/script-charset-01.html": [
    "c5ac0d0a62a048a55d091935cb6ea733e52a5b82",
    "testharness"
   ],
   "html/semantics/scripting-1/the-script-element/script-charset-02.html": [
-   "77a015bb71f058ad23f4cc39e237cdbf1633d673",
+   "63cbe838e017fa0133d2fe66bcb2ec4002d7d43d",
    "testharness"
   ],
   "html/semantics/scripting-1/the-script-element/script-charset-03.html": [
    "4ff4cc6b0bae715005ec31a42709fe2b8dc690b3",
    "testharness"
   ],
   "html/semantics/scripting-1/the-script-element/script-crossorigin-network.html": [
    "488dd4488a4d55853ca82c4cd8dcf29178289250",
--- a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-charset-02.html
+++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/script-charset-02.html
@@ -1,40 +1,41 @@
 <!DOCTYPE html>
 <head>
-  <!-- TODO:
-  askalski: while this test pass, it does not test anything now.
-  It should test, whether with no document.charset set in any way, the
-  external scripts will get decoded using utf-8 as fallback character encoding.
-  It seems like utf-8 is also a fallback encoding to html (my guess), so
-  the part of the code I was attempting to test is never reached.
-  -->
-  <title>Script @type: unknown parameters</title>
+  <title>Script encoding for document encoding windows-1250</title>
   <link rel="author" title="askalski" href="github.com/askalski">
-  <link rel="help" href="https://html.spec.whatwg.org/multipage/#scriptingLanguages">
+  <link rel="author" title="Aaqa Ishtyaq" href="github.com/aaqaishtyaq">
+  <link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script">
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
   <div id="log"></div>
+  <!-- to avoid conflating tests for script encoding declaring the encoding at the top of file. i.e, windows-1250-->
+  <meta charset="windows-1250">
+  <script>
+  test(function() {
+    assert_equals(document.characterSet, "windows-1250")
+  }, "assumption: document encoding is windows-1250");
+  </script>
 
-  <!-- test of step4, which is taking utf-8 as fallback -->
   <!-- in this case, neither response's Content Type nor charset attribute bring correct charset information.
-  Furthermore, document's encoding is not set.-->
+  -->
   <script type="text/javascript"
     src="serve-with-content-type.py?fn=external-script-windows1250.js&ct=text/javascript">
   </script>
+
   <script>
   test(function() {
-    //these strings should not match, since the tested file is in windows-1250, and fallback is defined as utf-8
-    assert_not_equals(window.getSomeString().length, 5);
-  });
+    //these string should match since, windows-1250 is the fallback encoding.
+    assert_equals(window.getSomeString(), "\u015b\u0107\u0105\u017c\u017a");
+  }, "windows-1250 script decoded using document encoding (also windows-1250)");
   </script>
 
   <script type="text/javascript"
     src="serve-with-content-type.py?fn=external-script-utf8.js&ct=text/javascript">
   </script>
   <script>
-  //these strings should match, since fallback utf-8 is the correct setting.
+  //these strings should match, since this string is the result of decoding the utf-8 text as windows-1250.
   test(function() {
-    assert_equals(window.getSomeString().length, 5);
-  });
+    assert_equals(window.getSomeString(), "\u0139\u203a\xc4\u2021\xc4\u2026\u0139\u013d\u0139\u015f");
+  }, "UTF-8 script decoded using document encoding (windows-1250)");
   </script>
 
 </head>