Closed
Bug 1026099
Opened 10 years ago
Closed 10 years ago
MozHunspell opens dictionary files in content processes
Categories
(Core :: Spelling checker, defect, P1)
Core
Spelling checker
Tracking
()
Tracking | Status | |
---|---|---|
e10s | m3+ | --- |
People
(Reporter: jld, Assigned: mrbkap)
References
Details
Attachments
(10 files, 2 obsolete files)
(deleted),
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Felipe
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Felipe
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
ehsan.akhgari
:
review+
billm
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Felipe
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Felipe
:
review+
|
Details | Diff | Splinter Review |
The spelling checker opens dictionary files in the content process, instead of using IPC to ask the parent process to do so. Additionally, it opens the directory containing those files to enumerate them.
Comment 1•10 years ago
|
||
Ally is working on this for e10s.
Updated•10 years ago
|
tracking-e10s:
--- → ?
Updated•10 years ago
|
Blocks: old-e10s-m2
Updated•10 years ago
|
Assignee: nobody → ally
Updated•10 years ago
|
Priority: -- → P1
Updated•10 years ago
|
Assignee: ally → mrbkap
Assignee | ||
Updated•10 years ago
|
OS: Gonk (Firefox OS) → All
Assignee | ||
Comment 2•10 years ago
|
||
Attachment #8483052 -
Flags: review?(ehsan.akhgari)
Assignee | ||
Comment 3•10 years ago
|
||
These are a few nits that I found in the code (including one heinous misspelling of the word "dictionary") as well as adding some MOZ_OVERRIDEs and virtuals that are nice indicators of what's going on.
Attachment #8483055 -
Flags: review?(ehsan.akhgari)
Assignee | ||
Comment 4•10 years ago
|
||
This avoids creating mozHunspell instances in the child.
Attachment #8483058 -
Flags: review?(ehsan.akhgari)
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8483059 -
Flags: review?(ehsan.akhgari)
Updated•10 years ago
|
Summary: MozHunspell opens directory files in content processes → MozHunspell opens dictionary files in content processes
Updated•10 years ago
|
Attachment #8483052 -
Flags: review?(ehsan.akhgari) → review+
Comment 6•10 years ago
|
||
Comment on attachment 8483055 [details] [diff] [review]
Fix a few nits.
Review of attachment 8483055 [details] [diff] [review]:
-----------------------------------------------------------------
The number of spelling mistakes in this code is quite ironic. ;-)
::: editor/composer/nsEditorSpellCheck.cpp
@@ -699,5 @@
> }
> NS_ENSURE_TRUE(rootContent, NS_ERROR_FAILURE);
>
> - DictionaryFetcher* fetcher = new DictionaryFetcher(this, aCallback,
> - mDictionaryFetcherGroup);
o_O I'm not sure how I did not catch this earlier. :(
@@ +763,5 @@
> if (dictName.IsEmpty()) {
> dictName.Assign(preferedDict);
> }
>
> + nsresult rv = NS_OK;
Why is this needed?!
Attachment #8483055 -
Flags: review?(ehsan.akhgari) → review+
Assignee | ||
Comment 7•10 years ago
|
||
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #6)
> Why is this needed?!
It technically isn't needed, but it's better to put declarations as close as their first-use as possible.
Comment 8•10 years ago
|
||
Comment on attachment 8483058 [details] [diff] [review]
Avoid mozHunspell in the child altogether.
Review of attachment 8483058 [details] [diff] [review]:
-----------------------------------------------------------------
Can we somehow prevent the mozHunspell XPCOM component from being created in the child process altogether?
::: extensions/spellcheck/hunspell/src/mozHunspell.cpp
@@ +611,5 @@
> {
> mDynamicDirectories.RemoveObject(aDir);
> LoadDictionaryList();
> +
> + ContentParent::NotifyUpdatedDictionaries();
Please move this to LoadDictionaryList instead.
::: extensions/spellcheck/src/mozSpellChecker.cpp
@@ +359,4 @@
> mozSpellChecker::GetCurrentDictionary(nsAString &aDictionary)
> {
> + if (XRE_GetProcessType() == GeckoProcessType_Content) {
> + aDictionary = mCurrentDictionary;
This won't work if someone calls mozISpellCheckingEngine::SetDictionary in the parent process.
Can we just forward this to the parent so that we have one single source of truth for this?
Attachment #8483058 -
Flags: review?(ehsan.akhgari) → review-
Comment 9•10 years ago
|
||
Comment on attachment 8483059 [details] [diff] [review]
Make selecting dictionaries work.
Review of attachment 8483059 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/modules/InlineSpellChecker.jsm
@@ +8,5 @@
> const MAX_UNDO_STACK_DEPTH = 1;
>
> +const Cc = Components.classes;
> +const Ci = Components.interfaces;
> +const Cu = Components.utils;
Cc and Cu are unused in this file.
@@ +167,2 @@
> spellchecker.GetDictionaryList(o1, o2);
> + var list = Cu.waiveXrays(o1.value);
Please get bholley to review this part. I don't think he'll like it. ;-)
Attachment #8483059 -
Flags: review?(ehsan.akhgari) → review+
Updated•10 years ago
|
Flags: firefox-backlog+
Updated•10 years ago
|
Flags: firefox-backlog+
Updated•10 years ago
|
Flags: firefox-backlog+
Assignee | ||
Comment 10•10 years ago
|
||
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #8)
> Can we just forward this to the parent so that we have one single source of
> truth for this?
I'd rather not do that mostly because we don't have to. We also call SetCurrentDictionary every time we focus a textarea or a window which sets things everywhere.
Assignee | ||
Comment 11•10 years ago
|
||
This addresses ehsan's comment 8 modulo comment 10.
Attachment #8483058 -
Attachment is obsolete: true
Attachment #8483059 -
Attachment is obsolete: true
Assignee | ||
Comment 12•10 years ago
|
||
In order to have the parent and child on the same page wrt which elements were editable or needed spellchecking menu items, I needed to refactor some common code out. I also attempt to avoid recalculating the same information twice.
Attachment #8486150 -
Flags: review?(felipc)
Assignee | ||
Comment 13•10 years ago
|
||
This supercedes my previous "make selecting dictionaries work" patch. It
avoids CPOWs as much as possible in the spellchecking contextmenu code.
It turned out to be very difficult for me to interpose my "RemoteInlineSpellChecker" in the parent. To be honest, I was unable to actually try down how any of these objects are created. This patch attempts to shim the InlineSpellChecker object in the parent as cleanly as possible. I'm not thrilled about the mapping from spellInfo -> RemoteSpellChecker, but this seems to work. I had a bunch of trouble getting all of the states right (no dictionaries vs. turned off vs turned on). This does appear to work, though.
Attachment #8486151 -
Flags: review?(felipc)
Assignee | ||
Comment 14•10 years ago
|
||
I still have to check with the Finnish add-on, but we can't use the default engine directly, this should Just Work (TM).
Attachment #8486152 -
Flags: review?(ehsan.akhgari)
Assignee | ||
Updated•10 years ago
|
Attachment #8486149 -
Flags: review?(ehsan.akhgari)
Updated•10 years ago
|
Attachment #8486149 -
Flags: review?(ehsan.akhgari) → review+
Comment 16•10 years ago
|
||
Comment on attachment 8486152 [details] [diff] [review]
Don't use the default engine directly since we might not be using it.
Review of attachment 8486152 [details] [diff] [review]:
-----------------------------------------------------------------
Please test this with that Finnish spell checker.
Attachment #8486152 -
Flags: review?(ehsan.akhgari) → review+
Comment 17•10 years ago
|
||
Comment on attachment 8486153 [details] [diff] [review]
de-rpc-ize PRemoteSpellcheckEngine
Review of attachment 8486153 [details] [diff] [review]:
-----------------------------------------------------------------
::: extensions/spellcheck/hunspell/src/PRemoteSpellcheckEngine.ipdl
@@ +5,5 @@
> include protocol PContent;
>
> namespace mozilla {
>
> +sync protocol PRemoteSpellcheckEngine {
I don't know what these changes mean. Please ask someone else review this part.
::: extensions/spellcheck/hunspell/src/RemoteSpellCheckEngineParent.h
@@ +24,1 @@
> bool* success) MOZ_OVERRIDE;
Nit: indentation.
@@ +29,2 @@
> bool* aIsMisspelled,
> InfallibleTArray<nsString>* aSuggestions)
Nit: indentation.
Attachment #8486153 -
Flags: review?(ehsan.akhgari) → review+
Assignee | ||
Updated•10 years ago
|
Attachment #8486153 -
Flags: review?(wmccloskey)
Attachment #8486153 -
Flags: review?(wmccloskey) → review+
Assignee | ||
Comment 19•10 years ago
|
||
Comment on attachment 8486150 [details] [diff] [review]
Refactor target-inspecting code from the context menu
Review of attachment 8486150 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/modules/InlineSpellChecker.jsm
@@ +363,5 @@
> + INPUT: 0x2,
> + TEXTAREA: 0x4,
> +
> + TEXTINPUT: 0x8,
> + KEYWORD: 0xA,
Obviously, KEYWORD should be 0x10.
Assignee | ||
Comment 20•10 years ago
|
||
Assignee | ||
Comment 21•10 years ago
|
||
Attachment #8498964 -
Flags: review?(wmccloskey)
Assignee | ||
Comment 22•10 years ago
|
||
This isn't strictly necessary, but it avoids using CPOWs a few times during the computation.
Attachment #8498965 -
Flags: review?(felipc)
Assignee | ||
Comment 23•10 years ago
|
||
I had to treat the "contenteditable" case completely separately to deal with password fields (which was one of the causes of the mochitest orange).
Attachment #8498967 -
Flags: review?(felipc)
Updated•10 years ago
|
Attachment #8486150 -
Flags: review?(felipc) → review+
Updated•10 years ago
|
Attachment #8498965 -
Flags: review?(felipc) → review+
Comment 24•10 years ago
|
||
Comment on attachment 8498967 [details] [diff] [review]
fix contenteditable
Review of attachment 8498967 [details] [diff] [review]:
-----------------------------------------------------------------
Can you explain in isEditable why sometimes it gets the EDITABLE flag and sometimes the CONTENTEDITABLE?
::: browser/base/content/nsContextMenu.js
@@ +751,1 @@
> // If this.onEditableArea is false but editFlags is EDITABLE, then
nit: update comment for CONTENTEDITABLE
Attachment #8498967 -
Flags: review?(felipc) → review+
Comment 25•10 years ago
|
||
Comment on attachment 8486151 [details] [diff] [review]
Don't use CPOWs for the spellchecker in the context menu.
Review of attachment 8486151 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/modules/InlineSpellCheckerContent.jsm
@@ +6,5 @@
> +"use strict";
> +
> +let {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
> +
> +Cu.import("resource://gre/modules/InlineSpellChecker.jsm");
übernit, but could you change it to:
let { SpellCheckHelper } = Cu.import("resource://gre/modules/InlineSpellChecker.jsm");
It will make it more clear why this is being imported here in the content side, because in theory it doesn't make sense just by looking at the filename (which is supposed to be a module used in the parent)
Attachment #8486151 -
Flags: review?(felipc) → review+
Attachment #8498964 -
Flags: review?(wmccloskey) → review+
Assignee | ||
Comment 26•10 years ago
|
||
Assignee | ||
Comment 27•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/91ffa2ab03aa
I squashed all of the commits into one since the intermediate steps were never tested independently.
Comment 28•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
Updated•10 years ago
|
Iteration: --- → 35.3
Flags: qe-verify?
Comment 29•10 years ago
|
||
This sounds like internal plumbing, no need to do manual QA on that, I think.
Flags: qe-verify? → qe-verify-
You need to log in
before you can comment on or make changes to this bug.
Description
•