Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
Перейти к файлу
Masayuki Nakano 8224e1138c Bug 1840519 - Make typing surrogate pair behavior switchable with prefs r=m_kato,smaug
A lone surrogate should not appear in `DOMString` at least when the attribute
values of events because of ill-formed UTF-16 string.

`TextEventDispatcher` does not handle surrogate pairs correctly. It should not
split surrogate pairs when it sets `KeyboardEvent.key` value for avoiding the
problem in some DOM API wrappers, e.g., Rust-running-as-wasm.

On the other hand, `.charCode` is an unsigned long attribute and web apps
may use `String.fromCharCode(event.charCode)` to convert the input to string,
and unfortunately, `fromCharCode` does not support Unicode character code
points over `0xFFFF`.  Therefore, we may need to keep dispatching 2 `keypress`
events per surrogate pair for the backward compatibility.

Therefore, this patch creates 2 prefs.  One is for using single-keypress
event model and double-keypress event model.  The other is for the latter,
whether `.key` value never has ill-formed UTF-16 or it's allowed.

If using the single-keypress event model --this is compatible with Safari and
Chrome in non-Windows platforms--, one `keypress` event is dispatched for
typing a surrogate pair.  Then, its `.charCode` is over `0xFFFF` which can
work with `String.fromCodePoint()` instead of `String.fromCharCode()` and
`.key` value is set to simply the surrogate pair (i.e., its length is 2).

If using the double-keypress event model and disallowing ill-formed UTF-16
--this is the new default behavior for both avoiding ill-formed UTF-16 string
creation and keeping backward compatibility with not-maintained web apps using
`String.fromCharCode`--, 2 `keypress` events are dispatched.  `.charCode` for
first one is the code of the high-surrogate, but `.key` is the surrogate pair.
Then, `.charCode` for second one is the low-surrogate and `.key` is empty
string.  In this mode, `TextEditor` and `HTMLEditor` ignores the second
`keypress`.  Therefore, web apps can cancel it only with the first `keypress`,
but it indicates the `keypress` introduces a surrogate pair with `.key`
attribute.

Otherwise, if using the double-keypress event model and allowing ill-formed
UTF-16 --this is the traditional our behavior and compatible with Chrome in
Windows--, 2 `keypress` events are dispatched with same `.charCode` values as
the previous mode, but first `.key` is the high-surrogate and the other's is
the low surrogate.  Therefore, web apps can cancel either one of them or
both of them.

Finally, this patch makes `TextEditor` and `HTMLEditor` handle text input
with `keypress` events properly.  Except in the last mode, `beforeinput` and
`input` events are fired once and their `data` values are the surrogate pair.
On the other hand, in the last mode, 2 sets of `beforeinput` and `input` are
fired and their `.data` values has only the surrogate so that ill-formed
UTF-16 values.

Note that this patch also fixes an issue on Windows.  Windows may send a high
surrogate and a low surrogate with 2 sets of `WM_KEYDOWN` and `WM_KEYUP` whose
virtual keycode is `VK_PACKET` (typically, this occurs with `SendInput` API).
For handling this correctly, this patch changes `NativeKey` class to make it
just store the high surrogate for the first `WM_KEYDOWN` and `WM_KEYUP` and use
it when it'll receive another `WM_KEYDOWN` for a low surrogate.

Differential Revision: https://phabricator.services.mozilla.com/D182142
2023-08-23 01:16:59 +00:00
.cargo Backed out changeset bc91ede31572 (bug 1848956) for causing webgpu failures. 2023-08-22 20:57:58 +03:00
.github/workflows Bug 1847997: Automatically close GitHub pull requests with a GitHub Action r=hwine DONTBUILD 2023-08-10 17:01:59 +00:00
.vscode
accessible Bug 1849204 - Add generic atom hash keys that use the better distributed atom hash, and use it across the tree. r=mstange,xpcom-reviewers,credential-management-reviewers,sgalich,nika 2023-08-18 18:43:27 +00:00
browser Bug 1849726: Rename telemetry ping name of quicksuggest r=adw 2023-08-23 00:51:24 +00:00
build Backed out changeset bc91ede31572 (bug 1848956) for causing webgpu failures. 2023-08-22 20:57:58 +03:00
caps Bug 1847469 - Part 24: Use column number types in JS::DescribeScriptedCaller. r=iain 2023-08-16 17:31:42 +00:00
chrome Bug 1834176 - Convert consumers of NetUtil.jsm to import the ES module directly. r=arai,webdriver-reviewers,perftest-reviewers,valentin,extension-reviewers,devtools-reviewers,sync-reviewers,cookie-reviewers,robwu,afinder,whimboo 2023-06-07 08:42:36 +00:00
config Bug 1848746 - Avoid problems when <exception> is included before <new>. r=firefox-build-system-reviewers,ahochheiden 2023-08-15 20:11:14 +00:00
devtools Bug 1819464 - Part 2: Add content-box and stroke-box into transform-box in style. r=emilio 2023-08-22 19:49:03 +00:00
docs Bug 1849084 - fix moznetwork doc generation r=firefox-source-docs-reviewers,sylvestre DONTBUILD 2023-08-21 10:52:36 +00:00
docshell Bug 1849389 - Enable test that has no Android Fission specific failures (known intermittent) r=nika 2023-08-18 19:51:28 +00:00
dom Bug 1840519 - Make typing surrogate pair behavior switchable with prefs r=m_kato,smaug 2023-08-23 01:16:59 +00:00
editor Bug 1840519 - Make typing surrogate pair behavior switchable with prefs r=m_kato,smaug 2023-08-23 01:16:59 +00:00
extensions Bug 1847769 - Clean up warnings from NotifySecondaryKeyPermissionUpdateInContentProcess - r=pbz 2023-08-11 16:46:39 +00:00
gfx Backed out changeset bc91ede31572 (bug 1848956) for causing webgpu failures. 2023-08-22 20:57:58 +03:00
gradle/wrapper
hal Bug 1848766 - Add PerformanceHintManager implementation to HAL. r=smaug,emilio,geckoview-reviewers,owlish 2023-08-18 12:01:24 +00:00
image Bug 1847811 - Remove network.preload pref. r=necko-reviewers,anti-tracking-reviewers,pbz,kershaw 2023-08-14 10:46:03 +00:00
intl Bug 1849204 - Add generic atom hash keys that use the better distributed atom hash, and use it across the tree. r=mstange,xpcom-reviewers,credential-management-reviewers,sgalich,nika 2023-08-18 18:43:27 +00:00
ipc Backed out 4 changesets (bug 1758155) for causing build bustages in NetworkConnectivityService.cpp CLOSED TREE 2023-08-16 10:32:03 -04:00
js Bug 1842462 - Remove dom.script_loader.external_scripts.utf8_parsing.enabled and dom.worker.script_loader.utf8_parsing.enabled prefs r=smaug 2023-08-22 21:29:11 +00:00
layout Bug 1846853 - Clamp negative outline-offset per spec r=emilio 2023-08-23 00:59:43 +00:00
media Bug 1849049 - Don't try to export non-existing symbols. r=media-playback-reviewers,karlt 2023-08-17 04:13:51 +00:00
memory Bug 1844359 - Lookup main thread only arenas without a lock r=glandium 2023-08-16 05:51:38 +00:00
mfbt Bug 1844908 - Remove unused Windows version check functions. r=handyman 2023-08-22 19:11:41 +00:00
mobile Bug 1843926 - Add a new ExtensionsProcessEnabled GeckoRuntimeSettings and expose it in GeckoViewExample Settings UI. r=amejiamarmol,geckoview-reviewers,zmckenney 2023-08-19 17:22:04 +00:00
modules Bug 1840519 - Make typing surrogate pair behavior switchable with prefs r=m_kato,smaug 2023-08-23 01:16:59 +00:00
mozglue Bug 1849068 - Change how the missing pieces are setup for mingw. r=bobowen 2023-08-17 19:26:07 +00:00
netwerk Bug 1849370 - Fix telemetry mirrors for http download metrics r=necko-reviewers,valentin 2023-08-21 12:48:54 +00:00
nsprpub
other-licenses Bug 1846660 part 2: Add IAccessibleTextSelectionContainer interface. r=nlapre 2023-08-04 02:51:42 +00:00
parser Bug 1849204 - Add generic atom hash keys that use the better distributed atom hash, and use it across the tree. r=mstange,xpcom-reviewers,credential-management-reviewers,sgalich,nika 2023-08-18 18:43:27 +00:00
python Bug 1848308 - Properly quote args in run_process logs r=firefox-build-system-reviewers,ahochheiden,glandium 2023-08-18 19:29:19 +00:00
remote Bug 1849229 - [remote] Convert delta values for wheel scroll actions from CSS to device pixels. r=webdriver-reviewers,jdescottes 2023-08-21 15:21:46 +00:00
security No Bug, mozilla-central repo-update HSTS HPKP remote-settings - r=release-managers,RyanVM 2023-08-21 11:05:16 +00:00
services No Bug, mozilla-central repo-update HSTS HPKP remote-settings - r=release-managers,RyanVM 2023-08-21 11:05:16 +00:00
servo Bug 1839837 - Detect default color interpolation method for *-gradient() syntax r=emilio 2023-08-22 21:01:14 +00:00
startupcache Bug 1841660 - Fix potential deadlock waiting for StartupCache ThreadedPrefetch, r=jesup 2023-07-04 19:05:06 +00:00
storage Bug 1834043 - Add a configure option to disable Sqlite auxiliary files persistence. r=glandium,tjr 2023-08-01 08:02:34 +00:00
supply-chain Backed out changeset bc91ede31572 (bug 1848956) for causing webgpu failures. 2023-08-22 20:57:58 +03:00
taskcluster Bug 1849654 - fix reftest about:blank, and mochitest timeout path parsing for confirm-failures. r=aryx,taskgraph-reviewers,releng-reviewers,ahal 2023-08-22 16:00:00 +00:00
testing Bug 1840519 - Make typing surrogate pair behavior switchable with prefs r=m_kato,smaug 2023-08-23 01:16:59 +00:00
third_party Backed out changeset bc91ede31572 (bug 1848956) for causing webgpu failures. 2023-08-22 20:57:58 +03:00
toolkit Bug 1849757 - Register "browser.translations.automaticallyPopup" with Nimbus; r=nordzilla 2023-08-22 17:43:00 +00:00
tools Bug 1849718 - Remove redundant `use`. r=canaltinova 2023-08-22 20:43:49 +00:00
uriloader Bug 1847718 - Require nsIChannel instead of nsIRequest in nsIExternalHelperAppService r=necko-reviewers,geckoview-reviewers,valentin,owlish 2023-08-14 14:25:29 +00:00
view Bug 1837960. Remove array of all nsViewManagers. r=emilio 2023-06-22 09:38:27 +00:00
widget Bug 1840519 - Make typing surrogate pair behavior switchable with prefs r=m_kato,smaug 2023-08-23 01:16:59 +00:00
xpcom Bug 1849386 - Use consistent pointer hashing. r=nika,xpcom-reviewers 2023-08-18 22:35:40 +00:00
xpfe/appshell Bug 1846277 - Remove nsGlobalWindow.h. r=dom-core,necko-reviewers,jesup,farre 2023-08-02 20:41:48 +00:00
.arcconfig
.babel-eslint.rc.js Bug 1830265 - Enable ESLint and Prettier on .babel-eslint.rc.js. r=Gijs 2023-05-04 17:21:03 +00:00
.clang-format
.clang-format-ignore
.cron.yml Bug 1839317 - Add cron task for Firefox Snap upstream builds r=releng-reviewers,taskgraph-reviewers,ahal 2023-07-25 16:55:48 +00:00
.eslintignore Bug 1778112 - Move dom/base/test/jsmodules/ to use mjs files, rather than defining sourceType for ESLint. r=allstarschh 2023-07-13 13:56:12 +00:00
.eslintrc-test-paths.js Bug 1849271 - Flip test when checking for the presence of optional colorspace members on a VideoDecoderConfig. r=media-playback-reviewers,alwu 2023-08-22 14:33:21 +00:00
.eslintrc.js Bug 1817779 - Implemented tabs.detectLanguage for Android, r=robwu,geckoview-reviewers,extension-reviewers,owlish,amejiamarmol 2023-08-16 09:05:20 +00:00
.git-blame-ignore-revs
.gitattributes
.gitignore Bug 1834558: chore(webgpu): sync `.gitignore` with `.hgignore` for WebGPU r=webgpu-reviewers,nical 2023-06-19 20:12:38 +00:00
.hg-annotate-ignore-revs
.hg-format-source
.hgignore Bug 1842198 - [remote] Update hgignore to ignore readme files in puppeteer packages r=Sasha 2023-07-25 07:10:08 +00:00
.hgtags No bug - tagging 7b63ca6bbdfaf5d4dc027f808de9f74789a5fa6e with FIREFOX_NIGHTLY_117_END a=release DONTBUILD CLOSED TREE 2023-07-31 15:25:35 +00:00
.lando.ini
.lldbinit
.mailmap
.prettierignore Bug 1833654 - Remove libtremor from the tree. r=karlt,media-playback-reviewers,sylvestre 2023-08-08 12:12:45 +00:00
.prettierrc.js Bug 1826062 - Upgrade Prettier to v2.0.5. r=mossop 2023-05-20 12:26:49 +00:00
.stylelintignore Bug 1771113 - Add chromeOnly `StyleSheetRemoved` event, emitted when a stylesheet is removed. r=emilio. 2023-08-10 14:36:03 +00:00
.stylelintrc.js Bug 1835028 - Change newtab stylelint problem severity from warning to error. r=Gijs,Standard8 2023-06-05 12:58:01 +00:00
.taskcluster.yml Bug 1831143 - use new mozillareleases/gecko_decision:4.1.0 docker image. r=releng-reviewers,bhearsum 2023-08-22 15:22:43 +00:00
.trackerignore
.yamllint
.ycm_extra_conf.py
AUTHORS
CLOBBER Bug 1847818 - restore aec logging from about:webrtc - moz.build file updates. r=ng,webrtc-reviewers 2023-08-08 22:51:56 +00:00
Cargo.lock Backed out changeset bc91ede31572 (bug 1848956) for causing webgpu failures. 2023-08-22 20:57:58 +03:00
Cargo.toml Bug 1719535 - Part 12. Update icu_provider_macros not to depend on syn 1.0. r=supply-chain-reviewers,firefox-build-system-reviewers,glandium 2023-08-07 06:24:03 +00:00
GNUmakefile
LICENSE
Makefile.in Bug 1844122 - sccache: store the stats too r=padenot,taskgraph-reviewers,jcristau DONTBUILD 2023-07-18 15:10:55 +00:00
README.txt
aclocal.m4
build.gradle Bug 1626969 - Include locale in Glean pings.r=chutten,supply-chain-reviewers 2023-08-07 11:02:56 +00:00
client.mk
client.py
configure
configure.py Bug 1840537 - Enable value checking in moz.build for CONFIG variables derived from target.*. r=firefox-build-system-reviewers,andi,sergesanspaille 2023-07-06 21:33:41 +00:00
gradle.properties
gradlew
gradlew.bat
mach Bug 1695312 - Activate the virtualenv associated with a mach command much earlier r=firefox-build-system-reviewers,glandium 2023-07-25 00:24:53 +00:00
mach.cmd
mach.ps1
mots.yaml Bug 1810189 - Update MOTS for WebGPU: +jimb,+egubler,+nical,+teoxoy. DONTBUILD r=jimb,zeid 2023-08-15 19:46:13 +00:00
moz.build Bug 1842620: Add overviews of the main applications to the docs. r=Gijs,geckoview-reviewers,owlish,bgrins 2023-07-26 18:22:32 +00:00
moz.configure Bug 1719535 - Part 7. Build ICU4X as default. r=firefox-build-system-reviewers,platform-i18n-reviewers,glandium,dminor 2023-08-07 06:23:58 +00:00
mozilla-config.h.in
old-configure.in Bug 1847958 - Use -Oz for optimize option on GeckoView all channels. r=firefox-build-system-reviewers,glandium 2023-08-10 04:36:33 +00:00
package-lock.json Bug 1832765 - start linting scss across the tree in our standard config, r=Standard8 2023-05-30 22:41:22 +00:00
package.json Bug 1832765 - start linting scss across the tree in our standard config, r=Standard8 2023-05-30 22:41:22 +00:00
pyproject.toml Bug 1823694 - [lint.ruff] Disable some warnings we don't actually want to enforce, r=linter-reviewers,andi 2023-03-21 14:36:26 +00:00
settings.gradle Bug 1846523 - Call `python mach` on Windows from settings.gradle r=nalexander 2023-08-01 18:26:32 +00:00
substitute-local-geckoview.gradle
test.mozbuild

README.txt

An explanation of the Firefox Source Code Directory Structure and links to
project pages with documentation can be found at:

    https://firefox-source-docs.mozilla.org/contributing/directory_structure.html

For information on how to build Firefox from the source code and create the patch see:

    https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html

If you have a question about developing Firefox, and can't find the solution
on https://firefox-source-docs.mozilla.org/, you can try asking your question on Matrix at chat.mozilla.org in `Introduction` (https://chat.mozilla.org/#/room/#introduction:mozilla.org) channel.


Nightly development builds can be downloaded from:

    https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
            - or -
    https://www.mozilla.org/firefox/channel/desktop/#nightly

Keep in mind that nightly builds, which are used by Firefox developers for
testing, may be buggy.