Closed Bug 1390585 Opened 7 years ago Closed 7 years ago

Check the state of BHRTelemetryService in test_BHRObserver.js

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: nika, Assigned: nika)

References

Details

Attachments

(1 file)

After bug 1380081 we have a test which checks that the format of the bhr-thread-hang's output is correct, but we don't actually test BHRTelemetryService itself. This patch adds the ability to directly test that its payload is correct.
Comment on attachment 8897861 [details] [diff] [review]
Check the state of BHRTelemetryService in test_BHRObserver.js

Review of attachment 8897861 [details] [diff] [review]:
-----------------------------------------------------------------

Tests look good, but I would like an explanation on the magic.

::: toolkit/components/backgroundhangmonitor/BHRTelemetryService.js
@@ +13,5 @@
>                                    "resource://gre/modules/TelemetryController.jsm");
>  
>  function BHRTelemetryService() {
> +  // Allow tests to get access to this object to verify it works correctly.
> +  this.wrappedJSObject = this;

This is some wrapper magic that I don't understand; can you please help enlighten me?
Attachment #8897861 - Flags: review?(nfroyd) → review+
(In reply to Nathan Froyd [:froydnj] from comment #2)
> > +  // Allow tests to get access to this object to verify it works correctly.
> > +  this.wrappedJSObject = this;
> 
> This is some wrapper magic that I don't understand; can you please help
> enlighten me?

It's some XPCOM magic. Basically if you have a type with the wrappedJSObject property set, the property is avaliable on XPCOM wrapped objects as a way to acquire the inner JS object which we are accessing through an XPCOM wrapper. If you're curious about the docs then: https://developer.mozilla.org/en/docs/wrappedJSObject
Pushed by michael@thelayzells.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/034291d5068e
Check the state of BHRTelemetryService in test_BHRObserver.js, r=froydnj
https://hg.mozilla.org/mozilla-central/rev/034291d5068e
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: