From b346dbfd693e04ab2d3c3bb57fa4cd00767ac67e Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Thu, 1 Nov 2018 13:50:22 +0000 Subject: [PATCH] Bug 1467712 - Fail if Assert.ok is called with more than 2 arguments;r=Standard8 Depends on D10416 Differential Revision: https://phabricator.services.mozilla.com/D10417 --HG-- extra : moz-landing-system : lando --- testing/modules/Assert.jsm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/testing/modules/Assert.jsm b/testing/modules/Assert.jsm index 4beeafe75d16..3e687d5ddb33 100644 --- a/testing/modules/Assert.jsm +++ b/testing/modules/Assert.jsm @@ -228,7 +228,11 @@ proto.report = function(failed, actual, expected, message, operator, truncate = * (string) Short explanation of the expected result */ proto.ok = function(value, message) { - this.report(!value, value, true, message, "=="); + if (arguments.length > 2) { + this.report(true, false, true, "Too many arguments passed to `Assert.ok()`", "=="); + } else { + this.report(!value, value, true, message, "=="); + } }; /**