Closed
Bug 1209912
Opened 9 years ago
Closed 9 years ago
Use JSON.parse instead of nsIJSON.decode in Telemetry tests
Categories
(Toolkit :: Telemetry, defect)
Toolkit
Telemetry
Tracking
()
RESOLVED
FIXED
mozilla44
Tracking | Status | |
---|---|---|
firefox44 | --- | fixed |
People
(Reporter: Dexter, Assigned: henrik, Mentored)
References
(Blocks 1 open bug)
Details
(Whiteboard: [unifiedTelemetry][measurement:client][lang=js][good first bug])
Attachments
(1 file)
(deleted),
patch
|
Dexter
:
review+
|
Details | Diff | Splinter Review |
Telemetry tests log is raising the following warning locally:
0:01.65 LOG: Thread-1 INFO "CONSOLE_MESSAGE: (warn) [JavaScript Warning: "nsIJSON.decode is deprecated. Please use JSON.parse instead." {file: "c:/mozilla-central/obj-i686-pc-mingw32/_tests/xpcshell/toolkit/components/telemetry/tests/unit/head.js" line: 137}]"
This should be easily fixed by changing [1] to |JSON.parse|.
[1] - https://dxr.mozilla.org/mozilla-central/rev/891ee0d0ba3ec42b6484cf0205b3c95e21c58f74/toolkit/components/telemetry/tests/unit/head.js#137
Reporter | ||
Updated•9 years ago
|
Whiteboard: [measurement:client]
Reporter | ||
Comment 1•9 years ago
|
||
To fix the problem, this line [1] in head.js should be changed from:
payload = decoder.decode(utf8string);
to
payload = JSON.parse(utf8string);
We cannot get rid of the |decoder| itself, as it would still be used for |decodeFromStream|.
To make sure that the problem is fixed, run an xpcshell test as follows:
./mach xpcshell-test toolkit/components/telemetry/tests/unit/test_TelemetryController.js | grep Warning
and check that the warning message in the previous comment is not there anymore.
[1] - https://dxr.mozilla.org/mozilla-central/rev/891ee0d0ba3ec42b6484cf0205b3c95e21c58f74/toolkit/components/telemetry/tests/unit/head.js#137
Mentor: alessio.placitelli
Whiteboard: [measurement:client] → [unifiedTelemetry][measurement:client][lang=js][good first bug]
Assignee | ||
Comment 2•9 years ago
|
||
Implemented changes as proposed by Alessio, the test passes: no further warning about using "decode".
Reporter | ||
Comment 3•9 years ago
|
||
Reporter | ||
Comment 4•9 years ago
|
||
(In reply to Henrik Tjäder from comment #2)
> Created attachment 8671290 [details] [diff] [review]
> bug_1209912_-_Use_JSON.parse_instead_of_nsIJSON.decode_in_Telemetry_tests.
> patch
>
> Implemented changes as proposed by Alessio, the test passes: no further
> warning about using "decode".
Thank you Henrik, and welcome!
Once you attach the patch, you should also request a review: this is done by selecting the "?" value when attaching the patch, in the "Review" entry. A new field will appear, and you should type in the email of the desired reviewer. In this case, that's me, so I've done that for you :) You could also type the name of the reviewer in that field, Bugzilla will spawn a dropdown with some suggestions for you!
I've also pushed it to try servers for you.
Reporter | ||
Updated•9 years ago
|
Assignee: nobody → henrik
Status: NEW → ASSIGNED
Reporter | ||
Updated•9 years ago
|
Attachment #8671290 -
Flags: review+
Reporter | ||
Updated•9 years ago
|
Keywords: checkin-needed
Keywords: checkin-needed
Comment 6•9 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in
before you can comment on or make changes to this bug.
Description
•