Revision 9b9293f0a667ca23ded04060894c2ce9e4a3e19c authored by Brian Birtles on 15 February 2018, 11:42:52 UTC, committed by moz-wptsync-bot on 15 February 2018, 11:42:52 UTC
These tests test the behavior introduced in the following changesets to the Web
Animations specification:

  1. https://github.com/w3c/csswg-drafts/commit/5af5e276badf4df0271bcfa0b8e7837fff24133a
  2. https://github.com/w3c/csswg-drafts/commit/673f6fc1269829743c707c53dcb04092f958de35

which can be viewed as a merged diff at:

  https://gist.github.com/birtles/d147eb2e0e2d4d37fadf217abd709411

See the following spec issues:

  1. https://github.com/w3c/csswg-drafts/issues/2059
  2. https://github.com/w3c/csswg-drafts/issues/2266
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1436659
gecko-commit: 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5
gecko-integration-branch: central
gecko-reviewers: hiro
1 parent eb7491d
Raw File
console-time-label-conversion.any.js
"use strict";
// https://console.spec.whatwg.org/#timing

test(() => {
  let timeLabelToStringCalled = false;

  console.time({
    toString() {
      timeLabelToStringCalled = true;
    }
  });

  assert_true(timeLabelToStringCalled, "toString() must be called on time()'s label when label is an object");
}, "console.time()'s label gets converted to string via label.toString() when label is an object");

test(() => {
  let timeEndLabelToStringCalled = false;

  console.timeEnd({
    toString() {
      timeEndLabelToStringCalled = true;
    }
  });

  assert_true(timeEndLabelToStringCalled, "toString() must be called on timeEnd()'s label when label is an object");
}, "console.timeEnd()'s label gets converted to string via label.toString() when label is an object");

test(() => {
  assert_throws({name: "Error"}, () => {
    console.time({
      toString() {
        throw new Error("conversion error");
      }
    });
  }, "time() must re-throw any exceptions thrown by label.toString() conversion");
}, "console.time() throws exceptions generated by erroneous label.toString() conversion");

test(() => {
  assert_throws({name: "Error"}, () => {
    console.timeEnd({
      toString() {
        throw new Error("conversion error");
      }
    });
  }, "timeEnd() must re-throw any exceptions thrown by label.toString() conversion");
}, "console.timeEnd() throws exceptions generated by erroneous label.toString() conversion");
back to top