Closed Bug 1442866 Opened 2 years ago Closed 2 years ago

TB fails on about:support with ReferenceError: reference to undefined property "policies" - TEST-UNEXPECTED-FAIL | [snip]/mozmill/content-tabs/test-about-support.js

Categories

(Firefox :: Enterprise Policies, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 60
Tracking Status
firefox60 --- fixed

People

(Reporter: Paenglab, Assigned: Paenglab)

References

Details

(Whiteboard: [Thunderbird-testfailure: Z all])

Attachments

(1 file, 1 obsolete file)

Since bug 1426362 TB fails in about:config with:
ReferenceError: reference to undefined property "policies"[Learn More]  Troubleshoot.jsm:254:5
Troubleshoot data provider failed: application
TypeError: Services.policies is undefined  Troubleshoot.jsm:154

It's no wonder as this is a browser only feature. Please could you make to not fail when it's undefined or only check when it's run from FX?

And maybe think about moving the policies to toolkit? Then TB could use this too in the future
Flags: needinfo?(felipc)
Could we do something like:
try {
  data.policiesStatus = Services.policies.status;
} catch (e) {
  // Other applications like Thunderbird don't have policies.
  data.policiesStatus = null;
}

Richard, could you try that and submit a patch for review.
Summary: TB fails on about:support with ReferenceError: reference to undefined property "policies" → TB fails on about:support with ReferenceError: reference to undefined property "policies" - TEST-UNEXPECTED-FAIL | [snip]/mozmill/content-tabs/test-about-support.js
Whiteboard: [Thunderbird-testfailure: Z all]
Attached patch policiesStatus.patch (obsolete) — Splinter Review
With the try/catch I still get the ReferenceError, so I decided to use the AppConstants.
Assignee: nobody → richard.marti
Status: NEW → ASSIGNED
Attachment #8955767 - Flags: review?(felipc)
Comment on attachment 8955767 [details] [diff] [review]
policiesStatus.patch

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

Sorry about that. I tried to protect against this problem in aboutSupport.js (see https://hg.mozilla.org/mozilla-central/rev/476e0758eb1c#l2.12), but I forgot about Troubleshoot.jsm.

This patch is fine, although I suggest that you try the following version:

if (Services.policies) {
  data.policiesStatus = Services.policies.status;
}

No need for the else part. And then on aboutSupport.js, we could change the line that I linked above to check for data.policiesStatus instead of Services.policies.

if it doesn't throw any errors, it's probably the best approach. Otherwise, I'll take this patch
Attachment #8955767 - Flags: review?(felipc)
Flags: needinfo?(felipc)
(In reply to :Felipe Gomes (needinfo me!) from comment #3)
> This patch is fine, although I suggest that you try the following version:
> 
> if (Services.policies) {
>   data.policiesStatus = Services.policies.status;
> }

Ah, yes this is a lot simpler...and works without error.
Attachment #8955767 - Attachment is obsolete: true
Attachment #8955803 - Flags: review?(felipc)
Attachment #8955803 - Flags: review?(felipc) → review+
Thanks!
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8577732074db
Make the policiesStatus work on TB too. r=Felipe
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/8577732074db
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 60
You need to log in before you can comment on or make changes to this bug.