Calling `typeof` on arrays or null in JavaScript returns `"object"`,
and a safer check is to rely on `Object.prototype.toString`.
MozReview-Commit-ID: 5VxXf2ByoEx
--HG--
extra : rebase_source : 4d1fe95a75343964836e670d0ceffa6ce680e390
Many tests that result in throwing errors, amongst those many type-
and platform checks, are repeated throughout the Marionette code base.
This patch centralises the most common of these, typically reducing
consumer calls from three to one line.
Example usage:
assert.defined(cmd.parameters.value);
assert.postiveInteger(cmd.parameters.value,
error.pprint`Expected 'value' (${value}) to be a signed integer`);
// InvalidArgumentError: Expected 'value' ([object Object] {"foo": "bar"}) to be a positive integer
MozReview-Commit-ID: BHOaDazeGer
--HG--
extra : rebase_source : 1d35c10e29d4fd536829e9714ae65bcd14ad21f8