☠☠ backed out by a33b4bcf0a74 ☠ ☠ | |
author | Andreas Tolfsen <ato@sny.no> |
Sat, 23 Jun 2018 14:00:50 +0100 | |
changeset 479743 | 42964d651f02bb0af3a3d01b5cff634a3c82ec35 |
parent 479742 | 57be8463bb2480e30d2aa3cf29a07d9d98fcfb97 |
child 479744 | 13e47fa99a3141bf76472087d63c7d3e02d197a0 |
push id | 9719 |
push user | ffxbld-merge |
push date | Fri, 24 Aug 2018 17:49:46 +0000 |
treeherder | mozilla-beta@719ec98fba77 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | whimboo |
bugs | 1470646 |
milestone | 63.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/testing/marionette/format.js +++ b/testing/marionette/format.js @@ -7,42 +7,41 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Log} = ChromeUtils.import("chrome://marionette/content/log.js", {}); XPCOMUtils.defineLazyGetter(this, "log", Log.get); this.EXPORTED_SYMBOLS = ["pprint", "truncate"]; +const ELEMENT_NODE = 1; const MAX_STRING_LENGTH = 250; /** * Pretty-print values passed to template strings. * - * Usage: + * Usage:: * - * <pre><code> * const {pprint} = Cu.import("chrome://marionette/content/error.js", {}); * let bool = {value: true}; * pprint`Expected boolean, got ${bool}`; * => 'Expected boolean, got [object Object] {"value": true}' * * let htmlElement = document.querySelector("input#foo"); * pprint`Expected element ${htmlElement}`; * => 'Expected element <input id="foo" class="bar baz" type="input">' * * pprint`Current window: ${window}`; * => '[object Window https://www.mozilla.org/]' - * </code></pre> */ function pprint(ss, ...values) { function pretty(val) { let proto = Object.prototype.toString.call(val); - - if (val && val.nodeType === 1) { + if (typeof val == "object" && val !== null && + "nodeType" in val && val.nodeType === ELEMENT_NODE) { return prettyElement(val); } else if (["[object Window]", "[object ChromeWindow]"].includes(proto)) { return prettyWindowGlobal(val); } else if (proto == "[object Attr]") { return prettyAttr(val); } return prettyObject(val); }