Open Bug 1845523 Opened 10 months ago Updated 10 months ago

ExtensionProcessCrashObserver should use integer (number) instead of string type for childID

Categories

(WebExtensions :: General, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: robwu, Unassigned, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: [addons-jira])

The childID parameter in ExtensionProcessCrashObserver is currently a string, but the more common convention is for the value to be a number.

We should use parseInt(data, 10) instead of just data at: https://searchfox.org/mozilla-central/rev/b6b8ff043e944a5e32ea63208d3ba7cb6b16191d/toolkit/components/extensions/Extension.sys.mjs#697

and for test coverage, add Assert.ok(Number.isInteger(currentProcessChildID), "correct type"); after https://searchfox.org/mozilla-central/rev/b6b8ff043e944a5e32ea63208d3ba7cb6b16191d/toolkit/components/extensions/test/browser/browser_ext_process_crash_handling.js#107

This is a good first bug for people who want to familiarize themselves with setting up a development environment and submitting a patch. To get started, see https://wiki.mozilla.org/WebExtensions/Contribution_Onramp

Since this bug is essentially two lines of change, I recommend the following steps once you have set up the development environment:

  1. Run the test first to verify that it passes as expected:
    ./mach test toolkit/components/extensions/test/browser/browser_ext_process_crash_handling.js
  2. Add the test as explained in the first comment.
  3. Run the test again to verify that it not fails.
  4. Fix the bug as suggested in the first comment.
  5. Run the test again to verify that the test now passes again.
  6. Submit the patch for review.
Mentor: rob
Keywords: good-first-bug
You need to log in before you can comment on or make changes to this bug.