Closed Bug 1553236 Opened 1 year ago Closed 1 year ago

Change unit test callers for nsISearchService.addEngineWithDetails to use object passing rather than individual parameters

Categories

(Firefox :: Search, task, P3)

task

Tracking

()

RESOLVED FIXED
Firefox 69
Tracking Status
firefox69 --- fixed

People

(Reporter: standard8, Assigned: melvingeorge10, Mentored)

References

Details

(Whiteboard: [good first bug][lang=js])

Attachments

(1 file, 1 obsolete file)

nsISearchService.addEngineWithDetails currently supports two formats of parameters:

Services.search.addEngineWithDetails(name, iconURL, alias, description, method, template, extensionID);

or

Services.search.addEngineWithDetails(name, details);

We want to migrate to using just the name, details form. To start off with, lets do just the unit tests, here's a link to the current places this affects:

https://searchfox.org/mozilla-central/search?q=search.addEngineWithDetails&case=false&regexp=false&path=test

I'm opening this up as mentored. To help Mozilla out with this bug, here's the steps:

  1. Comment here on the bug that you want to volunteer to help. I (or someone else) will assign it to you.
  2. Download and build the Firefox source code: https://developer.mozilla.org/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build (an artifact build is sufficient).
  3. Start working on this bug.
    • See the link in comment 0 for the places to change. We want to change calls such as
await Services.search.addEngineWithDetails("MozSearch", "", "mozalias", "", "GET",
  "http://example.com/?q={searchTerms}");

to

await Services.search.addEngineWithDetails("MozSearch", {
  alias: "mozalias",
  method: "GET",
  template: "http://example.com/?q={searchTerms}",
});
* Note: you'll need to use different properties in the object depending on what the original call was. See the [documentation here](https://searchfox.org/mozilla-central/rev/6c9f60f8cc064a1005cd8141ecd526578ae9da7a/toolkit/components/search/nsISearchService.idl#298-360) for the possible parameter names.
* If a parameter is "" or null, then it doesn't need specifying in the object.
* If you have direct questions about this bug, feel free to ask here or on irc.
  1. Check your changes for adherence to our guidelines by using:
    • ./mach lint --workdir
      • (this checks the uncommited changes in your work directory)
  2. Build your change with mach build and test your change with:
    • ./mach test toolkit/components/search
    • You can also name the other directories where there are files that you're changing, but we'll also run these against our test servers once a patch has been posted to make sure nothing has broken.
  3. Submit the patch for review. Mark me as a reviewer (r?standard8) so I'll get an email to come look at your code.
  4. After a series of reviews and changes to your patch, I'll mark it for checkin or push it to autoland. Your code will soon be shipping to Firefox users worldwide!
  5. ...now you get to think about what kind of bug you'd like to work on next. Let me know what you're interested in and I can help you find your next contribution.
Mentor: standard8
Whiteboard: [good first bug][lang=js]

I would like to work on this issue.

Welcome, please start working on it, and let us know if you get any issues.

Assignee: nobody → melvingeorge10
Status: NEW → ASSIGNED

can you please point out the repository i need to start working on.

(In reply to melvingeorge10 from comment #4)

can you please point out the repository i need to start working on.

If you follow the link in step 1 (i.e. https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build), pick the platform that you're starting on.

Then near the top of the page, it'll tell you what you need to do to get set up, and what commands you need to run to clone the repository (Generally in a "Get the source"/"Get the code" section).

i need only mozilla-central repo.. but the script downloads mozilla-unified repo

Unified is a superset of mozilla-central, so it doesn't matter except it is larger. If you want just mozilla-central, then use:

hg clone https://hg.mozilla.org/mozilla-central

ok

Depends on D32565

Made all the changes to initial revision. ( D32565 - https://phabricator.services.mozilla.com/D32565 )

Attachment #9067843 - Attachment is obsolete: true
Attachment #9067532 - Attachment description: Bug 1553236 - made all test suites containing search.addEngineWithDetails() function to use with object parameters r=standard8 → Bug 1553236 - Change tests using Services.search.addEngineWithDetails() to use the object parameter form. r=standard8
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/365c849f1085
Change tests using Services.search.addEngineWithDetails() to use the object parameter form. r=Standard8
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69
You need to log in before you can comment on or make changes to this bug.