tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

image-decode-path-changes-svg.tentative.html (3840B)


      1 <!DOCTYPE html>
      2 <meta charset=utf-8>
      3 <meta name="timeout" content="long">
      4 <title>SVGImageElement.prototype.decode(), href mutation tests.</title>
      5 <link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 
      9 <script>
     10 "use strict";
     11 
     12 // src tests
     13 // -------------------
     14 promise_test(function(t) {
     15  var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
     16  img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png?image-decode-path-changes-1");
     17  var promise = img.decode();
     18  img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.svg?image-decode-path-changes-1");
     19  return promise_rejects_dom(t, "EncodingError", promise);
     20 }, document.title + " xlink:href changes fail decode.");
     21 
     22 promise_test(function(t) {
     23  var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
     24  img.setAttribute('href', "/images/green.png?image-decode-path-changes-2");
     25  var promise = img.decode();
     26  img.setAttribute('href', "/images/green.svg?image-decode-path-changes-2");
     27  return promise_rejects_dom(t, "EncodingError", promise);
     28 }, document.title + " href changes fail decode.");
     29 
     30 promise_test(function(t) {
     31  var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
     32  img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png?image-decode-path-changes-3");
     33  var first_promise = img.decode();
     34  img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.svg?image-decode-path-changes-3");
     35  var second_promise = img.decode();
     36  assert_not_equals(first_promise, second_promise);
     37  return Promise.all([
     38    promise_rejects_dom(t, "EncodingError", first_promise),
     39    second_promise
     40  ]);
     41 }, document.title + " xlink:href changes fail decode; following good decode succeeds.");
     42 
     43 promise_test(function(t) {
     44  var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
     45  img.setAttribute('href', "/images/green.png?image-decode-path-changes-4");
     46  var first_promise = img.decode();
     47  img.setAttribute('href', "/images/green.svg?image-decode-path-changes-4");
     48  var second_promise = img.decode();
     49  assert_not_equals(first_promise, second_promise);
     50  return Promise.all([
     51    promise_rejects_dom(t, "EncodingError", first_promise),
     52    second_promise
     53  ]);
     54 }, document.title + " href changes fail decode; following good decode succeeds.");
     55 
     56 promise_test(function(t) {
     57  var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
     58  img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/images/green.png?image-decode-path-changes-5");
     59  var first_promise = img.decode();
     60  img.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', "/non/existent/path.png?image-decode-path-changes-5");
     61  var second_promise = img.decode();
     62  assert_not_equals(first_promise, second_promise);
     63  return Promise.all([
     64    promise_rejects_dom(t, "EncodingError", first_promise),
     65    promise_rejects_dom(t, "EncodingError", second_promise)
     66  ]);
     67 }, document.title + " xlink:href changes fail decode; following bad decode fails.");
     68 
     69 promise_test(function(t) {
     70  var img = document.createElementNS('http://www.w3.org/2000/svg', 'image');
     71  img.setAttribute('href', "/images/green.png?image-decode-path-changes-6");
     72  var first_promise = img.decode();
     73  img.setAttribute('href', "/non/existent/path.png?image-decode-path-changes-6");
     74  var second_promise = img.decode();
     75  assert_not_equals(first_promise, second_promise);
     76  return Promise.all([
     77    promise_rejects_dom(t, "EncodingError", first_promise),
     78    promise_rejects_dom(t, "EncodingError", second_promise)
     79  ]);
     80 }, document.title + " href changes fail decode; following bad decode fails.");
     81 
     82 </script>