Closed Bug 1693585 Opened 3 months ago Closed 29 days ago

Changing of default search engine broken due to overrides not being correctly handled

Categories

(Firefox :: Search, defect, P2)

Firefox 86
defect
Points:
3

Tracking

()

RESOLVED FIXED
89 Branch
Iteration:
89.1 - Mar 22 - Apr 4
Tracking Status
firefox89 --- fixed

People

(Reporter: edmorales.97, Assigned: standard8)

References

(Blocks 1 open bug)

Details

Attachments

(4 files, 1 obsolete file)

Attached video bug.mp4

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:86.0) Gecko/20100101 Firefox/86.0

Steps to reproduce:

See Video attached:

  1. I changed my Search Engine from Google to DuckDuckGo today.
  2. It changed fine.
  3. I want to revert to Google, so I went to change it.
  4. I select Google.

NOTE: Changing to a different Search Engine also doesn't work.

Actual results:

Google shows up as my default Search Engine but when I search, it searches on DuckDuckgo.

Closing and re-opening preferences shows DuckDuckGo as my default search engine.

Expected results:

Google should stay as the default. It seems to not be changing my default.

The dropdown changes the value, but it has no effect.

I can't seem to reproduce the issue on my Firefox Nightly 87, same Mac.

The Bugbug bot thinks this bug should belong to the 'Firefox::Search' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Search

Please can you try opening the browser console, and seeing if any errors appear when you try to change the default engine or around that time? Maybe also check just after startup as well.

To open the console go to Tools -> Web Developer -> Browser Console (not the web console).

Flags: needinfo?(edmorales.97)

Thank you! Yes, there is an error. See image: https://ibb.co/jf1ZSQy

Uncaught (in promise) TypeError: can't access property "urls", this._overriddenData is undefined
    removeExtensionOverride resource://gre/modules/SearchEngine.jsm:1132
    _setEngineDefault resource://gre/modules/SearchService.jsm:2141
    set defaultEngine resource://gre/modules/SearchService.jsm:2182
    setDefault resource://gre/modules/SearchService.jsm:2206
    setDefaultEngine chrome://browser/content/preferences/search.js:602
    handleEvent chrome://browser/content/preferences/search.js:367
    init chrome://browser/content/preferences/search.js:75
    init chrome://browser/content/preferences/preferences.js:105
    initializeCategories chrome://browser/content/preferences/findInPage.js:96
    init chrome://browser/content/preferences/findInPage.js:52
    requestIdleCallback handler*init chrome://browser/content/preferences/findInPage.js:52
    init_all chrome://browser/content/preferences/preferences.js:139
    EventListener.handleEvent* chrome://browser/content/preferences/preferences.js:111
SearchEngine.jsm:1132:7
TypeError: (destructured parameter) is undefined
Flags: needinfo?(edmorales.97)

Thank you for that, it is very useful. I'm not quite sure how to reproduce it yet though, so a couple of questions:

Have you previously installed the DuckDuckGo Privacy Essentials add-on?
Have you previously changed the default engine?

Could you also try and get a bit more logging for us?

  • Visit about:config (type it in the address bar)
  • Acknowledge the warning
  • Search for browser.search.log and double-click it, so that its value becomes true
  • Restart Firefox, and open the Browser Console straight away
  • Right-click select all, then use cmd-C to copy.
  • Paste that into an attachment here.

I'm interested to see if it is something happening at start-up or not.

Flags: needinfo?(edmorales.97)

In the past, I had installed the DuckDuckGo Privacy Essential add-on, but I don't currently have it installed and I don't recall installing it recently.
I had Google as my default search engine, then I switched it manually to DuckDuckGo today, and then I tried to go back to Google but I can't seem to be able to. I should add that I am running Firefox Developer Edition, not sure if that makes a difference.

View log here: https://justpaste.it/3xbwk

Flags: needinfo?(edmorales.97)

(In reply to Eduardo Morales from comment #6)

In the past, I had installed the DuckDuckGo Privacy Essential add-on, but I don't currently have it installed and I don't recall installing it recently.
I had Google as my default search engine, then I switched it manually to DuckDuckGo today, and then I tried to go back to Google but I can't seem to be able to. I should add that I am running Firefox Developer Edition, not sure if that makes a difference.

View log here: https://justpaste.it/3xbwk

Thank you for your help, Mark!
Eduardo

Attached file Startup Log

Thank you for the log, I don't see anything unexpected in there.

One more thing, could you attach the search.json.mozlz4 file from your profile folder? You can get to the folder from about:support. It contains only details about your installed search engine settings.

Once you've done that if close Firefox, move the file out the way, then start Firefox, it should restart with the default search settings. If that's an issue let me know.

I'm not totally sure how this happens, it could have been as a result of an old bug, but we should fix it anyway.

Assignee: nobody → standard8
Severity: -- → S2
Status: UNCONFIRMED → ASSIGNED
Iteration: --- → 88.1 - Feb 22 - Mar 7
Points: --- → 3
Ever confirmed: true
Priority: -- → P2
Attached file search.json.mozlz4

I've attached search.json.mozlz4.

After moving it from the profile folder and restarting Firefox, I can no longer reproduce the bug.
I am now able to switch Search Engines without an issue.

Thank you!

Flags: needinfo?(standard8)

Thank you for the file, that confirms my suspicions as to the result of what happened.

I'm still not quite sure how you got into that state though, my current theory is that a third party app might have tried to change the default engine, but it was blocked.

In any case, there's a better way to do what we're trying to do in that piece of code, which would protect against it in future.

Flags: needinfo?(standard8)
Summary: Changing Search Engine doesn't work. → Updating the Search Engine Name doesn't work from an add-on
Summary: Updating the Search Engine Name doesn't work from an add-on → Changing of default search engine broken due to overrides not being correctly handled
Iteration: 88.1 - Feb 22 - Mar 7 → 88.2 - Mar 8 - Mar 21
Iteration: 88.2 - Mar 8 - Mar 21 → 89.1 - Mar 22 - Apr 4
Depends on: 1702454

There's a two part fix here:

  • The first I found an issue when we were enabling engines (after disable) which could cause overrides to be set when they shouldn't be - when the engine wasn't going to be set as default.
  • The second is a hardness fix to ensure that the default search engine can always be changed even if we're in a bad state, and get us back to a good one.

Comment on attachment 9213118 [details]
Bug 1693585 - When re-enabling an add-on that uses search engine override, only set the override if the engine will be set as default. r?mixedpuppy!

Revision D110563 was moved to bug 1705437. Setting attachment 9213118 [details] to obsolete.

Attachment #9213118 - Attachment is obsolete: true

(In reply to Mark Banner (:standard8) from comment #16)

There's a two part fix here:

  • The first I found an issue when we were enabling engines (after disable) which could cause overrides to be set when they shouldn't be - when the engine wasn't going to be set as default.
  • The second is a hardness fix to ensure that the default search engine can always be changed even if we're in a bad state, and get us back to a good one.

We've changed the plan here slightly. The first part is going to be moved out to bug 1705437. The second part will continue to land in this bug to fix the user experience.

Blocks: 1705437
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a7273acca4c1
Ensure that the default search engine can be changed, even if overriden data is missing. r=daleharvey
Status: ASSIGNED → RESOLVED
Closed: 29 days ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
You need to log in before you can comment on or make changes to this bug.