Bug 1150572

Summary: default spellchecker dictionary is not correct for firefox
Product: Red Hat Enterprise Linux 7 Reporter: Stephen Beal <sbeal>
Component: firefoxAssignee: Jan Horak <jhorak>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: agajania, byount, ctubbsii, cww, desktop-qa-list, garrett.mitchener, jhorak, jlyle, jrstoup, jyundt, lnovich, mattdm, rrajaram, stransky, svashisht, tpelka, xwang, yshao
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 643954 Environment:
Last Closed: 2015-01-13 23:19:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 643954    
Bug Blocks: 1133060    
Description Flags
video displaying bug
Latest screencase to show behavior none

Comment 3 Jan Horak 2014-11-19 13:53:52 UTC
Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1097625

Comment 5 errata-xmlrpc 2015-01-13 23:19:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Comment 7 Stephen Beal 2015-01-14 12:59:02 UTC
Created attachment 979989 [details]
video displaying bug

Comment 11 Stephen Beal 2015-01-15 14:04:04 UTC
Created attachment 980506 [details]
Latest screencase to show behavior

Comment 12 Jan Horak 2015-01-15 14:20:04 UTC
Hm, please try with the fresh profile (firefox -ProfileManager). Do you also see this on some public pages, like here http://www.html.am/html-codes/textboxes/html-textbox.cfm ?

Comment 17 Jan Horak 2015-01-29 13:53:28 UTC
I'm still unable to reproduce customer's issue.

Do the customer have some system wide preferences set? These preferences are in /usr/lib64/firefox/defaults or /usr/lib64/firefox/defaults/pref directories.

Recorded video resembles behavior of previous Firefox version 31.3. Please could the customer double check that they have firefox 31.4.0-1 installed?

Anyway customer can safely remove hunspell-en package by yum remove hunspell-en. Then en_US dictionary still stay installed.

Comment 23 Siteshwar Vashisht 2015-02-03 14:58:41 UTC
There are 2 issues here :

1. 'en_ZW' dictionary is used by default (when you have not explicity set spellchecker dictionary)
2. Default dictionary keeps getting set back to 'en_ZW'

I am able to reproduce issue 1.

Steps to reproduce :

1. Start with a fresh firefox profile

2. Visit 'http://google.co.in/'. Right click search box and enable spellchecker.

3. Righ click search box and select Languages. 'Engligsh (Zimbabwe)' is selected in the list by default.

When spellchecker is enabled, nsEditorSpellCheck::UpdateCurrentDictionary() method is invoked from editor/composer/src/nsEditorSpellCheck.cpp :

697 nsEditorSpellCheck::UpdateCurrentDictionary(nsIEditorSpellCheckCallback* aCallback)
698 {
699   nsresult rv;
701   nsRefPtr<nsEditorSpellCheck> kungFuDeathGrip = this;
703   // Get language with html5 algorithm
704   nsCOMPtr<nsIContent> rootContent;
705   nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(mEditor);
706   if (htmlEditor) {
707     rootContent = htmlEditor->GetActiveEditingHost();
708   } else {
709     nsCOMPtr<nsIDOMElement> rootElement;
710     rv = mEditor->GetRootElement(getter_AddRefs(rootElement));
711     NS_ENSURE_SUCCESS(rv, rv);
712     rootContent = do_QueryInterface(rootElement);
713   }
716   DictionaryFetcher* fetcher = new DictionaryFetcher(this, aCallback,
717                                                      mDictionaryFetcherGroup);
718   rootContent->GetLang(fetcher->mRootContentLang);
719   nsCOMPtr<nsIDocument> doc = rootContent->GetCurrentDoc();
720   NS_ENSURE_STATE(doc);
721   doc->GetContentLanguage(fetcher->mRootDocContentLang);
723   rv = fetcher->Fetch(mEditor);
724   NS_ENSURE_SUCCESS(rv, rv);
726   return NS_OK;
727 }

Line 712 will fetch root element of the page and line 718 will set language specified in root item as the dictionary to be used.

Google India home page specifies value of lang attribute to "en-IN" :
<html itemscope="" itemtype="http://schema.org/SearchResultsPage" lang="en-IN">

but there is no 'en-IN' dictionary on my system, so the search will fallback to editor/composer/src/nsEditorSpellCheck.cpp:822

822       // Otherwise, try any available dictionary aa-XX
823       if (NS_FAILED(rv)) {
824         // loop over avaible dictionaries; if we find one with required
825         // language, use it
826         nsTArray<nsString> dictList;
827         rv = mSpellChecker->GetDictionaryList(&dictList);
828         NS_ENSURE_SUCCESS(rv, rv);
829         int32_t i, count = dictList.Length();
830         for (i = 0; i < count; i++) {
831           nsAutoString dictStr(dictList.ElementAt(i));
833           if (dictStr.Equals(dictName) ||
834               dictStr.Equals(preferedDict) ||
835               dictStr.Equals(langCode)) {
836             // We have already tried it
837             continue;
838           }
839           if (nsStyleUtil::DashMatchCompare(GetDictNameWithDash(dictStr), langCode, comparator) &&
840               NS_SUCCEEDED(SetCurrentDictionary(dictStr))) {
841               break;
842           }
843         }
844       }

'en_ZW' is the first dictionary which matches condition specified in line 839 and is set as default dictionary.

Comment 24 Jan Horak 2015-02-03 15:58:49 UTC
Thanks for the debugging and reproducer. In fact from Mozilla point of view the code is correct. In Mozilla products users install dictionaries by their own. Fallback to first dictionary in list that user actually installed is most likely correct for majority of Firefox/Thunderbird users.

This is wrong for Fedora and RHEL however. The hunspell-en package contains various dialects, in fact all of them are symlink to en-GB. This is because we want working dictionaries for some other locales, not just for en_US and en_GB (some applications require language_region to be the same to locale settings to be able to find and use the dictionary).

This bug was initially about fallback to French (if you had French dictionary installed) instead of some English dictionary on English pages because the fallback code didn't work correctly for our dictionaries (our dictionaries use underscore as separator, Mozilla use dash). I think issue with en_ZW is another bug so we should fill another one.

Comment 25 Laura Novich 2015-02-03 16:59:14 UTC
I have RHEL 6 installed - there is no fallback to French - it is the default, no matter how many times I have tried to change it. I do not speak French and do not reside in a French speaking country so there is no reason why I would have enabled it. Also for whatever reason, Mozilla seems to think I am located in the Netherlands so content that is enabled to track location and to localize presents itself in Dutch. 
When will these fixes be applied to RHEL 6 CSB?


Comment 26 Siteshwar Vashisht 2015-02-04 09:14:11 UTC
Opened a new bug at https://bugzilla.redhat.com/show_bug.cgi?id=1189018 as requested in comment #24.