It appears that the issue is caused by a change in behaviour from bug
1799470 which made the profile available earlier during startup. If the
permission manager is started between the time when the profile becomes
available and profile-do-change, it would've previously initialized
without storage, and initialized storage after profile-do-change, but
after the changes it may initialize twice instead.
This patch changes the profile-do-change handler to check if we already
have a profile, and avoid initializing the DB twice in that situation.
Differential Revision: https://phabricator.services.mozilla.com/D173062
This change is necessary to support the [CSS Highlight API](https://drafts.csswg.org/css-highlight-api-1/),
which uses `Selection` internally.
To replace `nsRange` with `AbstractRange`, some sections needed to be
adapted since `nsRange`-specific features were used.
Therefore, some methods (such as `GetRangeAt()`) may only be called if
the `Selection` is *not* of type `SelectionType::eHighlight`,
as it (per spec) returns an `nsRange`.
These methods will now `MOZ_ASSERT` if called for a highlight selection.
Additional methods are implemented which return `AbstractRange`
instead and are safe to be called for every selection type.
This commit also improves support of highlight features:
- Invalidation of highlight ranges: adding/removing Ranges in-place instead of
removing and re-adding the Selection object associated with the highlight.
- Ranges are only associated with the Selection that shares the same Document
- Fixed minor IDL issue
Differential Revision: https://phabricator.services.mozilla.com/D170582
Preferences from /etc/firefox/defaults/pref overwrites preferences set in omni.jar
and firefox/defaults/pref. The code was used for flatpak and snap only, but it could
be used also for regular Linux builds.
Differential Revision: https://phabricator.services.mozilla.com/D168799
The Custom Highlight API allows a use case where a `Range` of a `Highlight`
is also used as `Selection`. Due to the decision to use the `Selection` mechanism
to display `Highlight`s, a `Range` can be part of several `Selection`s.
Since the `Range` has a pointer to its associated `Selection`
to notify about changes, this must be adapted to allow several `Selections`.
As a tradeoff of performance and memory usage, the `Selection`s are stored
as `mozilla::LinkedList`. A helper class `mozilla::SelectionListWrapper`
was implemented to allow `Selection`s to be in multiple of these lists
and without having to be derived from `LinkedListElement<T>`.
To simplify usage of the list, the use case "does this range belong to Selection x?"
is wrapped into the convenience method`IsInSelection(Selection&)`;
The method previously named like this was renamed to `IsInAnySelection()`
to be named more precisely.
Registering and unregistering of the closest common inclusive ancestor
of the `Range` is done when the first `Selection` is registered and
the last `Selection` is unregistered.
Differential Revision: https://phabricator.services.mozilla.com/D169597
## edit-dictionary.sh
Instead of editing the .dic file directly, allow user to provide a list of
words. The script expands the existing .dic file, adds the new words and
compress it again using the affix rules.
Numerals at the beginning of the file and "no suggestion" words need to be
special-cased, since compressing the word list creates different results.
## make-new-dict.sh
Extract suggestions exclusions from the existing Mozilla dictionary, then
add them back to the dictionary generated by SCOWL. This removes the need
to maintain an external list of exclusions (mozilla-exclusions.txt).
It also allows to exclude these offensive words from both lists of added
and removed words by Mozilla.
Also:
- Break if the scowl folder is missing.
- Remove backup folders to make sure the install script can't be run twice.
## install-new-dict.sh
Break if the scowl folder is missing.
Differential Revision: https://phabricator.services.mozilla.com/D165883
Added .sh extension to all scripts.
edit-dictionary.sh:
* Convert to utf-8 before editing, and back to iso-8859-1 before saving
* Place a copy of the utf-8 dictionary inside the utf8 folder, and store the iso-8859-1 in place
make-new-dict.sh:
* Use .txt extension for support wordlists, and place them in a subfolder
* Exclude words in mozilla-exclusions.txt from the generated dictionary
* Save 5-mozilla-*.txt files to utf-8
Depends on D165304
Differential Revision: https://phabricator.services.mozilla.com/D165305
This works around the limitation in Phabricator, where ISO-8859-1 files are seen as binary.
Files have been converted from the existing dictionary using iconv, and the SET manually updated in the affix file to UTF8
Depends on D165302
Differential Revision: https://phabricator.services.mozilla.com/D165303
5-mozilla-* files are a by-product of the dictionary generation, they're not used to generate the dictionaries, so we can safely use utf-8 encoding.
Also, since they are wordlists, it makes sense to use the TXT extensions.
Differential Revision: https://phabricator.services.mozilla.com/D165302
As of the prior patch, these are no longer needed. I removed
these with a script, then ran clang-format on the files, then
manually reverted a few unrelated changed from the formatter.
Differential Revision: https://phabricator.services.mozilla.com/D164829
The original use in rlbox which made having this annotation impossible is no
longer necessary as it was removed in the previous part.
Differential Revision: https://phabricator.services.mozilla.com/D159085
Hereby the "in_app" argument is required to be specified in case some
other argument eg. "clean" requires a termination of the application.
Differential Revision: https://phabricator.services.mozilla.com/D157219
Hereby the "in_app" argument is required to be specified in case some
other argument eg. "clean" requires a termination of the application.
Differential Revision: https://phabricator.services.mozilla.com/D157219
There are only 3 places where nsMemory.h is still needed (image/RasterImage.cpp,
gfx/thebes/gfxFT2FontList.cpp, and nsMemory.cpp). Remove the rest.
Differential Revision: https://phabricator.services.mozilla.com/D158213
This new method return an array of `nsIPermission` whose type are included in the
array of permission types parameter.
This will help the implementation of Bug 1778959 where we need to get all the permission
of a given Set of (gated) permission types.
Differential Revision: https://phabricator.services.mozilla.com/D156951
While working on Bug 1777497 I bumped into a few things I would have done
differently that make it harder to misuse the site-scoped permissions.
These are just bugs waiting to happen, so I'm cleaning them up while I'm in here.
Differential Revision: https://phabricator.services.mozilla.com/D152760
While working on Bug 1777497 I bumped into a few things I would have done
differently that make it harder to misuse the site-scoped permissions.
These are just bugs waiting to happen, so I'm cleaning them up while I'm in here.
Differential Revision: https://phabricator.services.mozilla.com/D152760
While working on Bug 1777497 I bumped into a few things I would have done
differently that make it harder to misuse the site-scoped permissions.
These are just bugs waiting to happen, so I'm cleaning them up while I'm in here.
Differential Revision: https://phabricator.services.mozilla.com/D152760
The remaining methods in ns[T]StringObsolete are all find+replace methods for
nsTSubstring. These were migrated in a similar way to the find methods, and
partially updated to avoid using methods from nsStringObsolete.cpp.
This change removes the ns[T]StringObsolete.cpp files completely, as they are
no longer necessary.
Differential Revision: https://phabricator.services.mozilla.com/D148301
This prevents copies and avoids the hack we have to avoid this, which
right now is using nsDependent{C,}String.
Non-virtual actors can still use `nsString` if they need to on the
receiving end.
Differential Revision: https://phabricator.services.mozilla.com/D152519
This adds a check to see if the encoded word is not empty and does not start
with the null character. Hunspell accepts C-style strings and marks the empty
string as correctly spelled. This prevents other dictionaries from detecting
misspelled strings in languages that use a different charset, which has lead
to problems when using the en-US dictionary packaged with Firefox and Greek,
Hebrew and Russian dictionaries, where misspellings are not detected in the
non-English language.
Differential Revision: https://phabricator.services.mozilla.com/D149899
The remaining methods in ns[T]StringObsolete are all find+replace methods for
nsTSubstring. These were migrated in a similar way to the find methods, and
partially updated to avoid using methods from nsStringObsolete.cpp.
This change removes the ns[T]StringObsolete.cpp files completely, as they are
no longer necessary.
Differential Revision: https://phabricator.services.mozilla.com/D148301
I originally thought we didn't need to be explicitly notified about removals because a correction always triggers a text change and we push a cache update for spelling errors whenever the text changes.
However, it seems that even when a correction is made and the text changes, the spell check ranges aren't yet up to date.
Previously, we were pushing a cache update whenever text was reflowed, which was taking care of this.
Soon, we don't want to push text cache updates if the text doesn't actually change.
We remove the reliance on these redundant text updates by having an explicit notification for spell check removals.
Differential Revision: https://phabricator.services.mozilla.com/D147655
We already have an nsISelectionListener, but that only tells us that a change happened somewhere in the selection, not which range changed.
We don't want to push a cache update for all ranges when only one changed.
Therefore, this patch adds an accessibility notification in mozInlineSpellChecker::AddRange.
We don't need this for removed ranges because the text will change for any spelling error corrections and text updates trigger spelling error cache updates.
Differential Revision: https://phabricator.services.mozilla.com/D147244
nsIFactory is binary compatible with Windows COM's IClassFactory,
but nothing seems to depend on it. This patch removes the test
for compatibility, TestCOM, and removes the lockFactory
method that isn't otherwise needed.
Differential Revision: https://phabricator.services.mozilla.com/D146386
With MOZ_FORMAT_PRINTF annotations, the compiler expects a wchar_t*, and
it won't automatically consider char16ptr_t to be compatible with that.
While handling strings, there's one case of formatting that doesn't need
to use %S at all.
Differential Revision: https://phabricator.services.mozilla.com/D144919
Loading dictionaries is time consuming and must occur on the main thread. By
loading them lazily, we can hopefully spread these loads across multiple calls
rather than loading them all at once, which results in noticeable jank on
slower systems.
Differential Revision: https://phabricator.services.mozilla.com/D142558
This adds an mEnabled flag which is used to hide dictionaries from the
spellchecker rather than freeing them. Loading dictionaries is an expensive
process which must occur on the main thread. By retaining dictionaries in
memory, we avoid having to reload them. If the number of dictionaries in use
exceeds a set number (10), we'll attempt to free any disabled dictionaries to
avoid memory use growing indefinitely.
Differential Revision: https://phabricator.services.mozilla.com/D142557
With the changes to EditorSpellCheck::SetFallbackDictionary to use a
promise chain to support calling either SetCurrentDictionaryFromList or
SetCurrentDictionaries as required, it is now possible that
RemoteSpellCheckEngineChild is destroyed by the time the second promise
runs. During destruction, RemoteSpellCheckEngineChild calls
mozSpellChecker::DeleteRemoteEngine, which sets mEngine to nullptr.
This patch adds a nullptr check for mEngine in both
SetCurrentDictionaryFromList and SetCurrentDictionaries.
Differential Revision: https://phabricator.services.mozilla.com/D141983