diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-09 13:22:29 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-09 13:22:29 +0100 |
commit | d79cc5fb49131cba4ed1aa86bb13de468a718565 (patch) | |
tree | f348d40599d12749d8e4c176dfe83d0a43b1e939 /widget/windows/WinIMEHandler.cpp | |
parent | 8ae047bbbf0a732744060878339b2f6fdf4ba909 (diff) | |
download | UXP-d79cc5fb49131cba4ed1aa86bb13de468a718565.tar UXP-d79cc5fb49131cba4ed1aa86bb13de468a718565.tar.gz UXP-d79cc5fb49131cba4ed1aa86bb13de468a718565.tar.lz UXP-d79cc5fb49131cba4ed1aa86bb13de468a718565.tar.xz UXP-d79cc5fb49131cba4ed1aa86bb13de468a718565.zip |
Issue #1348 - Part 3: Set IS_PRIVATE input scope in private browsing.
Microsoft IME on Windows 10 20H1 (build 19025+) supports IME private
mode by input scope. Although previous Windows versions use an
undocumented API for Edge and IE only, the next Windows 10 release will
use a public API for it.
We pre-empt this potential privacy concern by setting the IS_PRIVATE
flag when in PB mode.
Diffstat (limited to 'widget/windows/WinIMEHandler.cpp')
-rw-r--r-- | widget/windows/WinIMEHandler.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/widget/windows/WinIMEHandler.cpp b/widget/windows/WinIMEHandler.cpp index 99f0fb136..9debaa2dd 100644 --- a/widget/windows/WinIMEHandler.cpp +++ b/widget/windows/WinIMEHandler.cpp @@ -409,7 +409,7 @@ IMEHandler::OnDestroyWindow(nsWindow* aWindow) if (!sIsInTSFMode) { // MSDN says we need to set IS_DEFAULT to avoid memory leak when we use // SetInputScopes API. Use an empty string to do this. - SetInputScopeForIMM32(aWindow, EmptyString(), EmptyString()); + SetInputScopeForIMM32(aWindow, EmptyString(), EmptyString(), false); } #endif // #ifdef NS_ENABLE_TSF AssociateIMEContext(aWindow, true); @@ -481,8 +481,10 @@ IMEHandler::SetInputContext(nsWindow* aWindow, } } else { // Set at least InputScope even when TextStore is not available. - SetInputScopeForIMM32(aWindow, aInputContext.mHTMLInputType, - aInputContext.mHTMLInputInputmode); + SetInputScopeForIMM32(aWindow, + aInputContext.mHTMLInputType, + aInputContext.mHTMLInputInputmode, + aInputContext.mInPrivateBrowsing); } #endif // #ifdef NS_ENABLE_TSF @@ -583,12 +585,18 @@ IMEHandler::OnKeyboardLayoutChanged() void IMEHandler::SetInputScopeForIMM32(nsWindow* aWindow, const nsAString& aHTMLInputType, - const nsAString& aHTMLInputInputmode) + const nsAString& aHTMLInputInputmode, + bool aInPrivateBrowsing) { if (sIsInTSFMode || !sSetInputScopes || aWindow->Destroyed()) { return; } AutoTArray<InputScope, 3> scopes; + + if (aInPrivateBrowsing) { + scopes.AppendElement(IS_PRIVATE); + } + // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html if (aHTMLInputType.IsEmpty() || aHTMLInputType.EqualsLiteral("text")) { if (aHTMLInputInputmode.EqualsLiteral("url")) { |