Bug 1422985. Update decoder doctor to JSON encode details param value. r=gijs
MozReview-Commit-ID: JUf4rw5CeCH
--- a/browser/base/content/browser-media.js
+++ b/browser/base/content/browser-media.js
@@ -339,19 +339,23 @@ let gDecoderDoctorHandler = {
}
histogram.add(decoderDoctorReportId, TELEMETRY_DDSTAT_CLICKED);
let params = new URLSearchParams;
params.append("url", docURL);
params.append("label", "type-media");
params.append("problem_type", "video_bug");
params.append("src", "media-decode-error");
- params.append("details",
- "Technical Information:\n" + decodeIssue +
- (resourceURL ? ("\nResource: " + resourceURL) : ""));
+
+ let details = {"Technical Information:": decodeIssue};
+ if (resourceURL) {
+ details["Resource:"] = resourceURL;
+ }
+
+ params.append("details", JSON.stringify(details));
openUILinkIn(endpoint + "?" + params.toString(), "tab");
}
});
}
box.appendNotification(
title,
notificationId,
--- a/browser/base/content/test/general/browser_decoderDoctor.js
+++ b/browser/base/content/test/general/browser_decoderDoctor.js
@@ -154,26 +154,26 @@ add_task(async function test_decode_erro
await test_decoder_doctor_notification(
{type: "decode-error", decodeIssue: "DecodeIssue",
docURL: "DocURL", resourceURL: "ResURL"},
message,
gNavigatorBundle.getString("decoder.decodeError.button"),
gNavigatorBundle.getString("decoder.decodeError.accesskey"),
tab_checker_for_webcompat(
{url: "DocURL", label: "type-media", problem_type: "video_bug",
- details: "Technical Information:\nDecodeIssue\nResource: ResURL"}));
+ details: JSON.stringify({"Technical Information:": "DecodeIssue", "Resource:": "ResURL"})}));
});
add_task(async function test_decode_warning() {
await SpecialPowers.pushPrefEnv(
{ set: [["media.decoder-doctor.new-issue-endpoint",
"http://127.0.0.1/webcompat"]] });
let message = gNavigatorBundle.getString("decoder.decodeWarning.message");
await test_decoder_doctor_notification(
{type: "decode-warning", decodeIssue: "DecodeIssue",
docURL: "DocURL", resourceURL: "ResURL"},
message,
gNavigatorBundle.getString("decoder.decodeError.button"),
gNavigatorBundle.getString("decoder.decodeError.accesskey"),
tab_checker_for_webcompat(
{url: "DocURL", label: "type-media", problem_type: "video_bug",
- details: "Technical Information:\nDecodeIssue\nResource: ResURL"}));
+ details: JSON.stringify({"Technical Information:": "DecodeIssue", "Resource:": "ResURL"})}));
});