Closed Bug 1591102 Opened 10 months ago Closed 10 months ago

SpecialPowers.pushPermissions is async but returns too early (before permission is applied)

Categories

(Testing :: Mochitest, defect)

Version 3
defect
Not set
normal

Tracking

(firefox71 fixed, firefox72 fixed)

RESOLVED FIXED
mozilla72
Tracking Status
firefox71 --- fixed
firefox72 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

Details

Attachments

(2 files)

I added a new test in bug 1589754 that used SpecialPowers.pushPermissions. The patch got backed out, and I guess that it may be due to the fact that this test helper returns too early.

The helper is async and takes a callback, but the async function returns before when the callback would be called. This may result in intermittent test failures.

Summary: SpecialPowers.pushPreferences is sync but returns too early (before permission is applied) → SpecialPowers.pushPermissions is sync but returns too early (before permission is applied)

SpecialPowers.pushPermissions was made async in bug 1541557 . I'll attach a patch that adds a proper wait, and then convert callback consumers of SpecialPowers.pushPermissions to the promise-based API to promote the usage of the promise-based API in the code base.

See Also: → 1541557
Summary: SpecialPowers.pushPermissions is sync but returns too early (before permission is applied) → SpecialPowers.pushPermissions is async but returns too early (before permission is applied)

Some callers of SpecialPowers.pushPermissions wrapped the call in a
promise. That is not needed; directly use the returned promise instead.

Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/1d5f3e751433
Let SpecialPowers.pushPermissions wait until the permissions have been applied r=jdm
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/cc7ea5119035
Let some SpecialPowers.pushPermissions callers use promises r=jdm
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72

Comment on attachment 9103973 [details]
Bug 1591102 - Let SpecialPowers.pushPermissions wait until the permissions have been applied

Beta/Release Uplift Approval Request

  • User impact if declined: Bug 1589754 was fixed and contained a unit test. The unit test depends on a correct functioning of this test helper. Without this test helper, the patch for the other bug cannot be uplifted to beta.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Minimal change that fixes logic of a test-only helper, has baked in m-c and was confirmed to fix the test failure of bug 1589754.
  • String changes made/needed: none
Attachment #9103973 - Flags: approval-mozilla-beta?
Attachment #9103974 - Flags: approval-mozilla-beta?

Comment on attachment 9103973 [details]
Bug 1591102 - Let SpecialPowers.pushPermissions wait until the permissions have been applied

Uplift approved for 71 beta 7, thanks.

Attachment #9103973 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9103974 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Comment on attachment 9103974 [details]
Bug 1591102 - Let some SpecialPowers.pushPermissions callers use promises

I meant to only ask for uplift on the first patch, not the second one. Could you clear uplift approval on this second patch?

Flags: needinfo?(pascalc)
Flags: needinfo?(pascalc)
Attachment #9103974 - Flags: approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.