Closed Bug 1272439 Opened 4 years ago Closed 4 years ago

distribution.searchplugins.defaultLocale not working properly on Fennec

Categories

(Firefox for Android :: Android partner distribution, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 49
Tracking Status
firefox49 --- fixed

People

(Reporter: mkaply, Assigned: mkaply)

Details

Attachments

(1 file)

appendDistroSearchDirs in DirectoryProvider.js:

http://mxr.mozilla.org/mozilla-central/source/mobile/android/components/DirectoryProvider.js#94

Wasn't updated to support MCC and MNC codes.

So search plugins aren't using the new directories.
The directory provider should return the folder with MCC/MNC codes for XRE_APP_DISTRIBUTION_DIR:
https://hg.mozilla.org/mozilla-central/diff/80cf5f6c1863/mobile/android/components/DirectoryProvider.js
(In reply to Sebastian Kaspari (:sebastian) from comment #1)
> The directory provider should return the folder with MCC/MNC codes for
> XRE_APP_DISTRIBUTION_DIR:
> https://hg.mozilla.org/mozilla-central/diff/80cf5f6c1863/mobile/android/
> components/DirectoryProvider.js

Via JNI this calls:
https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/distribution/Distribution.java#871
Might be a red herring then. All I know is that I can't get distribution search plugins working at all on Android. I thought this what the reason.

Still debugging.
So I'm trying to figure out why searchplugins in the distro aren't working on Android.

Here's what I found.

We are definitely going down this path:

http://mxr.mozilla.org/mozilla-central/source/mobile/android/components/DirectoryProvider.js#108

Where we push the common directory into the array, but when I look at the result here:

http://mxr.mozilla.org/mozilla-central/source/mobile/android/components/DirectoryProvider.js#169

It's an empty array.

So somehow the result is not making it out.
Summary: appendDistroSearchDirs in directory service was not updated to support the new mobile distributions structure → appendDistroSearchDirs in directory service doesn't properly return data
Problem 1:

There should be a try catch here:

http://mxr.mozilla.org/mozilla-central/source/mobile/android/components/DirectoryProvider.js#135

In case for some reason there is a local directory, but the pref is not set.
So it looks like I was experiencing problem 1, but there is still a larger problem that the distribution plugins don't win over built in plugins on Fennec:

I'm debugging why adding Bing via the distirbution directory isn't working on Fennec. This is the output I got.

I/Gecko   (11725): GeckoDistribution:_init: Initing search plugin from [distribution]/searchplugins/common/bing.xml
I/Gecko   (11725): GeckoDistribution:_parseImage: Image textContent: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAABl5JREFUeAHtnXtQVFUcx793AcEEtEEkyywfgFASk+GjIjKE7CG9p7..."
I/Gecko   (11725): GeckoDistribution:_setIcon: Setting icon url "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAABl5JREFUeAHtnXtQVFUcx793AcEEtEEkyywfgFASk+GjIjKE7CG9p7..." for engine "Being".
I/Gecko   (11725): GeckoDistribution:_addEngineToStore: Adding engine: "Being"
I/Gecko   (11725): GeckoDistribution:_asyncLoadFromChromeURLs: loading engine from chrome url: resource://search-plugins/amazondotcom.xml
I/Gecko   (11725): GeckoDistribution:_asyncInitFromURI: Loading engine from: "resource://search-plugins/amazondotcom.xml".
I/Gecko   (11725): GeckoDistribution:_init: Initing search plugin from jar:[app]/assets/omni.ja!browser/amazondotcom.xml
I/Gecko   (11725): GeckoDistribution:_parseImage: Image textContent: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAACixJREFUeAHtXQ1MldcZfuRXlIr4A1MoYAf+xKBswlKmdTJ1Q7RZdc..."
I/Gecko   (11725): GeckoDistribution:_setIcon: Setting icon url "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAACixJREFUeAHtXQ1MldcZfuRXlIr4A1MoYAf+xKBswlKmdTJ1Q7RZdc..." for engine "Amazon.com".
I/Gecko   (11725): GeckoDistribution:_asyncLoadFromChromeURLs: loading engine from chrome url: resource://search-plugins/twitter.xml
I/Gecko   (11725): GeckoDistribution:_asyncInitFromURI: Loading engine from: "resource://search-plugins/twitter.xml".
I/Gecko   (11725): GeckoDistribution:_init: Initing search plugin from jar:[app]/assets/omni.ja!browser/twitter.xml
I/Gecko   (11725): GeckoDistribution:_parseImage: Image textContent: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAACW5JREFUeAHtXGmMFEUUft07x87sAS6ngILKYkTDoaLiFeSIKP4wGg..."
I/Gecko   (11725): GeckoDistribution:_setIcon: Setting icon url "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAACW5JREFUeAHtXGmMFEUUft07x87sAS6ngILKYkTDoaLiFeSIKP4wGg..." for engine "Twitter".
I/Gecko   (11725): GeckoDistribution:_asyncLoadFromChromeURLs: loading engine from chrome url: resource://search-plugins/wikipedia.xml
I/Gecko   (11725): GeckoDistribution:_asyncInitFromURI: Loading engine from: "resource://search-plugins/wikipedia.xml".
I/Gecko   (11725): GeckoDistribution:_init: Initing search plugin from jar:[app]/assets/omni.ja!browser/wikipedia.xml
I/Gecko   (11725): GeckoDistribution:_parseImage: Image textContent: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAQAAABIkb+zAAAEXElEQVR4Ae3cA4xs2QJG4b9aj41n27Zt27Zt27Zt27Zt+2KM5lXP924qOzs56VPjKSRnrf..."
I/Gecko   (11725): GeckoDistribution:_setIcon: Setting icon url "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAQAAABIkb+zAAAEXElEQVR4Ae3cA4xs2QJG4b9aj41n27Zt27Zt27Zt27Zt+2KM5lXP924qOzs56VPjKSRnrf..." for engine "Wikipedia".
I/Gecko   (11725): GeckoDistribution:_asyncLoadFromChromeURLs: loading engine from chrome url: resource://search-plugins/yahoo.xml
I/Gecko   (11725): GeckoDistribution:_asyncInitFromURI: Loading engine from: "resource://search-plugins/yahoo.xml".
I/Gecko   (11725): GeckoDistribution:_init: Initing search plugin from jar:[app]/assets/omni.ja!browser/yahoo.xml
I/Gecko   (11725): GeckoDistribution:_parseImage: Image textContent: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAACJ5JREFUeAHtXWlsVFUUPm9mOt2gLWKXIFtLKRZIGoIS/CEJa7ASEE..."
I/Gecko   (11725): GeckoDistribution:_setIcon: Setting icon url "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAACJ5JREFUeAHtXWlsVFUUPm9mOt2gLWKXIFtLKRZIGoIS/CEJa7ASEE..." for engine "Yahoo".
I/Gecko   (11725): GeckoDistribution:_asyncLoadFromChromeURLs: loading engine from chrome url: resource://search-plugins/bing.xml
I/Gecko   (11725): GeckoDistribution:_asyncInitFromURI: Loading engine from: "resource://search-plugins/bing.xml".
I/Gecko   (11725): GeckoDistribution:_init: Initing search plugin from jar:[app]/assets/omni.ja!browser/bing.xml
I/Gecko   (11725): GeckoDistribution:_parseImage: Image textContent: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAABq5JREFUeAHtXE1sFVUU/ua1pVBLJVG0CAgiCVKsLETQxJgQUhfujC..."
I/Gecko   (11725): GeckoDistribution:_setIcon: Setting icon url "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAABq5JREFUeAHtXE1sFVUU/ua1pVBLJVG0CAgiCVKsLETQxJgQUhfujC..." for engine "Bing".
I/Gecko   (11725): GeckoDistribution:_asyncLoadFromChromeURLs: loading engine from chrome url: resource://search-plugins/duckduckgo.xml
I/Gecko   (11725): GeckoDistribution:_asyncInitFromURI: Loading engine from: "resource://search-plugins/duckduckgo.xml".
I/Gecko   (11725): GeckoDistribution:_init: Initing search plugin from jar:[app]/assets/omni.ja!browser/duckduckgo.xml
I/Gecko   (11725): GeckoDistribution:_parseImage: Image textContent: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAAGKVJREFUeAHtXQm4HFWV/qv37e15W/KSvCwQSUIgJIEIArIIRD4UFD..."
I/Gecko   (11725): GeckoDistribution:_setIcon: Setting icon url "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAAAXNSR0IArs4c6QAAGKVJREFUeAHtXQm4HFWV/qv37e15W/KSvCwQSUIgJIEIArIIRD4UFD..." for engine "DuckDuckGo".
I/Gecko   (11725): GeckoDistribution:_asyncLoadFromChromeURLs: loading engine from chrome url: resource://search-plugins/google-nocodes.xml
I/Gecko   (11725): GeckoDistribution:_asyncInitFromURI: Loading engine from: "resource://search-plugins/google-nocodes.xml".
I/Gecko   (11725): GeckoDistribution:_init: Initing search plugin from jar:[app]/assets/omni.ja!browser/google-nocodes.xml
I/Gecko   (11725): GeckoDistribution:_parseImage: Image textContent: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAHqklEQVR4Ae2dVXgbSRaFe5lelnnfluFlmCnMzMzMzMwMCjPMKOsxM7MVh5kTc0AMJePDWd..."
I/Gecko   (11725): GeckoDistribution:_setIcon: Setting icon url "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAHqklEQVR4Ae2dVXgbSRaFe5lelnnfluFlmCnMzMzMzMwMCjPMKOsxM7MVh5kTc0AMJePDWd..." for engine "Google".
I/Gecko   (11725): GeckoDistribution:_addEngineToStore: Adding engine: "Amazon.com"
I/Gecko   (11725): GeckoDistribution:_addEngineToStore: Adding engine: "Twitter"
I/Gecko   (11725): GeckoDistribution:_addEngineToStore: Adding engine: "Wikipedia"
I/Gecko   (11725): GeckoDistribution:_addEngineToStore: Adding engine: "Yahoo"
I/Gecko   (11725): GeckoDistribution:_addEngineToStore: Adding engine: "Bing"
I/Gecko   (11725): GeckoDistribution:_addEngineToStore: Adding engine: "DuckDuckGo"
I/Gecko   (11725): GeckoDistribution:_addEngineToStore: Adding engine: "Google"
I/Gecko   (11725): GeckoDistribution:_asyncLoadEngines: loading user-installed engines from the obsolete cache
I/Gecko   (11725): GeckoDistribution:_buildCache: Writing to cache file.
I/Gecko   (11725): GeckoDistribution:_asyncInit: Completed _asyncInit
I/Gecko   (11725): GeckoDistribution:getVisibleEngines: getting all visible engines
I/Gecko   (11725): GeckoDistribution:_buildSortedEngineList: building list
I/Gecko   (11725): GeckoDistribution:getSubmission: In data: "__searchTerms__"; Purpose: "null"
I/Gecko   (11725): GeckoDistribution:getSubmission: Out data: "__searchTerms__"
I/Gecko   (11725): GeckoDistribution:getSubmission: In data: "dummy"; Purpose: "undefined"
I/Gecko   (11725): GeckoDistribution:getSubmission: Out data: "dummy"
I/Gecko   (11725): GeckoDistribution:getSubmission: In data: "dummy"; Purpose: "undefined"
I/Gecko   (11725): GeckoDistribution:getSubmission: Out data: "dummy"
I/Gecko   (11725): GeckoDistribution:SearchService.init
Summary: appendDistroSearchDirs in directory service doesn't properly return data → Distribution plugins overwritten by system plugins on Fennec
I misspelled the search engine name. Wasted day. I'll put together a patch for the other problem. Nothing to see here.
Come to find out we weren't even using distribution.searchplugins.defaultLocale properly anyway. We weren't appending the value to defLocalePlugins.

This patch adds that and puts the whole thing in a try/catch just in case there is a locale directory but the pref isn't set and the curLocale didn't match.
Attachment #8751921 - Flags: review?(margaret.leibovic)
Summary: Distribution plugins overwritten by system plugins on Fennec → distribution.searchplugins.defaultLocale not working properly on Fennec
Comment on attachment 8751921 [details] [diff] [review]
Properly use distribution.searchplugins.defaultLocale

Review of attachment 8751921 [details] [diff] [review]:
-----------------------------------------------------------------

What a debugging saga! Nice find.
Attachment #8751921 - Flags: review?(margaret.leibovic) → review+
https://hg.mozilla.org/integration/fx-team/rev/62994b8424002efc18e8ba6b58471e051b42e930
Bug 1272439 - Make distribution.searchplugins.defaultLocale work on Fennec. r=margaret
https://hg.mozilla.org/mozilla-central/rev/62994b842400
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 49
You need to log in before you can comment on or make changes to this bug.