From 754824a1ae60ccd79a28c54ecb8697e02828f0c7 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Thu, 12 Jul 2018 09:48:22 -0700 Subject: [PATCH] Bug 1462983 diagnostic: when test_bug607529.html fails JSON.parse operation, print the string that it choked on. r=bz MozReview-Commit-ID: G8O0GP7VpFQ --HG-- extra : rebase_source : c078e34862b3b21abd91fc8cb66b2ad4aefcc97c --- layout/base/tests/test_bug607529.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/layout/base/tests/test_bug607529.html b/layout/base/tests/test_bug607529.html index 68ccfd7d79ad..ead96c03a4da 100644 --- a/layout/base/tests/test_bug607529.html +++ b/layout/base/tests/test_bug607529.html @@ -50,7 +50,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=607529 done = true; } } else { - var msg = JSON.parse(e.data); + try { + var msg = JSON.parse(e.data); + } catch (ex) { + // Diagnostic for Bug 1462983: if JSON.parse throws, pause to print + // the string that it choked on, and then resume throwing the exception. + ok(false, "JSON.parse threw, when passed string '" + e.data + "'"); + throw ex; + } if (msg.error) { window.onerror(msg.msg, msg.url, msg.line); }