Closed Bug 1519099 Opened 7 years ago Closed 5 years ago

removeFromDb parameter of nsIAutoCompleteResult::RemoveValueAt is always true

Categories

(Toolkit :: Autocomplete, enhancement, P5)

enhancement

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: standard8, Assigned: aarushivij, Mentored)

Details

(Keywords: good-first-bug, Whiteboard: [lang=js|cpp])

Attachments

(1 file)

The removeFromDb parameter of nsIAutoCompleteResult::RemoveValueAt is always set to true:

https://searchfox.org/mozilla-central/search?q=RemoveValueAt&redirect=false

We could probably tidy that up a bit and clean up some code.

Mentor: mak77
Priority: -- → P5
Whiteboard: [good-first-bug]
Keywords: good-first-bug
Whiteboard: [good-first-bug] → [lang=js|cpp]

Hey, can I take this up? Let me know how to fix it.

Hey,can you direct me to the codebase for this bug?

Hey Mark,
Can I work on this issue?
I guess we need to put some condition on RemoveValueAt to be true. Let me know what needs to be fixed in it.

The parameter must be removed from the definition in nsIAutoCompleteResult.idl, from the implementation in nsAutoCompleteSimpleResult.cpp and then from all the call points, the link in comment 0 shows all of them.

Thanks, @Marco Got it! Working on this.

So it should be something like this in nsIAutoCompleteResult.idl
void removeValueAt();

and in nsAutoCompleteSimpleResult.cpp file, parameters must also be removed?

nsAutoCompleteSimpleResult::RemoveValueAt(int32_t aRowIndex,
                                          bool aRemoveFromDb) {
  CHECK_MATCH_INDEX(aRowIndex, false);

  nsString value = mMatches[aRowIndex].mValue;
  mMatches.RemoveElementAt(aRowIndex);

  if (mListener) {
    mListener->OnValueRemoved(this, value, aRemoveFromDb);
  }

  return NS_OK;
}

(In reply to paarmita1998 from comment #6)

So it should be something like this in nsIAutoCompleteResult.idl
`
void removeValueAt();

no, the method has 2 arguments, only removeFromDb should be removed, per the bug description.

I'd suggest starting with getting a Firefox build working, in optimized mode (because it's faster to build). Since this requires to work with cpp, it's important to be able to verify things compile properly. https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build

Hey, will this project run if I install Firefox Artifact as it is a C++ project?

(In reply to paarmita1998 from comment #9)

Hey, will this project run if I install Firefox Artifact as it is a C++ project?

No, an artifact build does not pick up changes to C++. You'll need a full (optimized) build.

I couldn't provide a patch for this as I have artifacts version installed. So you can assign it to others.
Thanks for your help.

I would work on it. I have complete build on my laptop already. :)

Thanks

Hello, I have a complete build installed as well. If no one else takes this up let me know if it's okay to work on it.

Assignee: nobody → shivams2799
Assignee: shivams2799 → nobody

Hi Mark,
If anyone is not working on it currently, can I take this up, to get hands dirty on some artifacts for the first time.

Thanks
Avneesh Singhal

Well in this case, it is Marco (:mak) that is the mentor, though I'm quite happy to help as well!

Assignee: nobody → avneesh1995

Yeah, but you are the reporter :-) . I will ask Marco if I get stuck somewhere. Thanks for assigning.

Hi Marco,
I got the change and have done the code changes after running the full optimized build(this step took some time), and the new build is also running fine as it seems. Can you guide me to any automated tests I can do to before raising the patch?

Thanks

Flags: needinfo?(mak77)

you can run some tests using ./mach test toolkit/components/autocomplete

Flags: needinfo?(mak77)

(In reply to Marco Bonardo [::mak] from comment #18)

you can run some tests using ./mach test toolkit/components/autocomplete

https://searchfox.org/mozilla-central/source/toolkit/components/autocomplete/tests/unit/test_330578.js

Thanks for waiting!
There is this test which uses false attribute in removeValueAt instead of as quoted true in all cases, please go through it and let me know what to do with it.
Thanks
Avneesh Singhal

Flags: needinfo?(mak77)

Because the removeFRomDB argument is going away, you will remove the aRemoveFromDb from the test and as a consequence also this._lastRemoveFromDb. Then you should remove all the test lines involving _lastRemoveFromDb.
all the calls will just be result.removeValueAt(0);

Flags: needinfo?(mak77)

(In reply to Marco Bonardo [::mak] from comment #20)

Because the removeFRomDB argument is going away, you will remove the aRemoveFromDb from the test and as a consequence also this._lastRemoveFromDb. Then you should remove all the test lines involving _lastRemoveFromDb.
all the calls will just be result.removeValueAt(0);

Thanks, I will do as stated.

Hello, Can I take up this issue ?
Thanks :)
Aarushi

Flags: needinfo?(mak)

Feel free to start working on it, read the previous comments, ensure you have a working build. Feel free to ask questions.
We assign the bug once a patch is attached.

Flags: needinfo?(mak)
Attachment #9140174 - Attachment description: Bug 1519099 - removeFromDb parameter of nsIAutoCompleteResult::RemoveValueAt is always true mak,standard → Bug 1519099 - removeFromDb parameter of nsIAutoCompleteResult::RemoveValueAt is always true r=mak,standard
Assignee: avneesh1995 → aarushivij
Attachment #9140174 - Attachment description: Bug 1519099 - removeFromDb parameter of nsIAutoCompleteResult::RemoveValueAt is always true r=mak,standard → Bug 1519099 - removeFromDb parameter of nsIAutoCompleteResult::RemoveValueAt is always true mak,standard
Attachment #9140174 - Attachment description: Bug 1519099 - removeFromDb parameter of nsIAutoCompleteResult::RemoveValueAt is always true mak,standard → Bug 1519099 - removeFromDb parameter of nsIAutoCompleteResult::RemoveValueAt is always true
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/0f97ae8ad0dd removeFromDb parameter of nsIAutoCompleteResult::RemoveValueAt is always true r=mak
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: