tor-browser

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

base-uri.html (1870B)


      1 <!doctype html>
      2 <meta charset="utf-8">
      3 <title>CSSOM base URI is the document's base URI</title>
      4 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
      5 <link rel="author" title="Mozilla" href="https://mozilla.org">
      6 <link rel="help" href="https://html.spec.whatwg.org/#document-base-url">
      7 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1343919">
      8 <base href="/non-existent-base/">
      9 <script src='/resources/testharness.js'></script>
     10 <script src='/resources/testharnessreport.js'></script>
     11 <div id="target"></div>
     12 <script>
     13 const target = document.getElementById("target");
     14 const kRelativeURI = "url(something.png)";
     15 const kKeyframes = [
     16  { backgroundImage: kRelativeURI },
     17  { backgroundImage: kRelativeURI },
     18 ];
     19 function assertBackground() {
     20  const image = getComputedStyle(target).backgroundImage;
     21  assert_true(image.includes("non-existent-base"), image);
     22 }
     23 function assertNoBackground() {
     24  const image = getComputedStyle(target).backgroundImage;
     25  assert_equals(image, "none");
     26 }
     27 
     28 promise_test(async function() {
     29  target.style.backgroundImage = kRelativeURI;
     30  assertBackground();
     31  target.style.backgroundImage = "";
     32  assertNoBackground();
     33 }, "setProperty");
     34 
     35 promise_test(async function() {
     36  const keyframe = new KeyframeEffect(target, kKeyframes, 10000);
     37  const animation = new Animation(keyframe, document.timeline);
     38  animation.play();
     39  await animation.ready;
     40  assertBackground();
     41  animation.cancel();
     42  assertNoBackground();
     43 }, "KeyframeEffect constructor");
     44 
     45 promise_test(async function() {
     46  const keyframe = new KeyframeEffect(target, [], 10000);
     47  keyframe.setKeyframes(kKeyframes);
     48  const animation = new Animation(keyframe, document.timeline);
     49  animation.play();
     50  await animation.ready;
     51  assertBackground();
     52  animation.cancel();
     53  assertNoBackground();
     54 }, "KeyframeEffect.setKeyframes");
     55 </script>