From 1a86abc159e788c40ebdfc6a99c9143d168737af Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Tue, 8 Oct 2019 21:02:28 +0200 Subject: No Issue - Expand HWA over RDP to Windows 8.1 and 10. When Mozilla implemented this initially, only Windows 8 existed. Because of the strict equal check, 8.1 and 10 didn't get HWA over RDP while they are perfectly capable of doing so with RemoteFX. This change allows any version of Windows from 8.0 onwards to use HWA over RDP. --- widget/windows/GfxInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'widget') diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp index c62f5873e..6f3c5313f 100644 --- a/widget/windows/GfxInfo.cpp +++ b/widget/windows/GfxInfo.cpp @@ -329,7 +329,7 @@ GfxInfo::Init() // Unfortunately, the Device ID is nullptr, and we can't enumerate // it using the setup infrastructure (SetupDiGetClassDevsW below // will return INVALID_HANDLE_VALUE). - if (mWindowsVersion == kWindows8 && + if (mWindowsVersion >= kWindows8 && mDeviceID.Length() == 0 && mDeviceString.EqualsLiteral("RDPUDD Chained DD")) { -- cgit v1.2.3 From 4105ebb6ed85aaffec5e4469a939945fb9eea066 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 18:28:10 -0500 Subject: MoonchildProductions#1251 - Part 4: Core build system changes, lots of libevent/IPC junk. This is mostly ifdefs, but as you can see, Solaris is actually a lot like Linux. They're both more SysV than BSD at core, and most of the differences have more to do with Solaris not using glibc than anything else. I still need to audit a lot of these changes and understand why they're needed and what the alternative approaches are. After this patch, most of the core functionality needed to build Solaris is here. --- widget/GfxInfoX11.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'widget') diff --git a/widget/GfxInfoX11.cpp b/widget/GfxInfoX11.cpp index 338dcac67..98a4bb965 100644 --- a/widget/GfxInfoX11.cpp +++ b/widget/GfxInfoX11.cpp @@ -187,6 +187,15 @@ GfxInfo::GetData() note.AppendLiteral(" -- texture_from_pixmap"); note.Append('\n'); + // illumos/Solaris 10 libc lacks a strcasestr function, but NSPR has + // one. A lot of programs just implement one on the spot or use strstr + // and a buffer as some kind of workaround. They've been implementing + // missing functions lately, though, so this may not be needed much longer. + +#if defined(XP_SOLARIS) +#define strcasestr PL_strcasestr +#endif + // determine the major OpenGL version. That's the first integer in the version string. mGLMajorVersion = strtol(mVersion.get(), 0, 10); -- cgit v1.2.3 From 7d65eb2b3a345abe22f42361e00c97da2e968009 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Mon, 7 Oct 2019 03:27:01 -0500 Subject: MoonchildProductions#1251 - Part 22: Remove some unused type declarations from IPC process_util. https://bugzilla.mozilla.org/show_bug.cgi?id=1397928 Was looking into that _POSIX_PATH_MAX/NAME_MAX issue earlier because it didn't make a lot of sense and I was thinking of other approaches besides char arrays, and I wanted to make sure it didn't cause problems after they did it. Turns out that one commit after this was added, Mozilla determined the code I was working on fixing to be dead code as of Firefox 58. I don't know if it's dead code in Pale Moon as well, but given that it compiles fine without it and I can't find any other references to szExeFile in the IPC code, that seems like a safe bet. Besides, I determined config/pathsub.c already seems to do what this code looks like it's trying to do, and implements the solution of just defining NAME_MAX to 256 and having done with it that I nearly adopted after realizing that even OS/2 and BeOS, let alone Unix/Linux systems, all basically use that value and there's just disagreement on which system header to check for it. --- widget/GfxInfoX11.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'widget') diff --git a/widget/GfxInfoX11.cpp b/widget/GfxInfoX11.cpp index 98a4bb965..05a2cab1a 100644 --- a/widget/GfxInfoX11.cpp +++ b/widget/GfxInfoX11.cpp @@ -192,7 +192,7 @@ GfxInfo::GetData() // and a buffer as some kind of workaround. They've been implementing // missing functions lately, though, so this may not be needed much longer. -#if defined(XP_SOLARIS) +#ifndef strcasestr #define strcasestr PL_strcasestr #endif -- cgit v1.2.3 From d558cf6647406bdbb87c852772ad211670eff223 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 6 Dec 2019 15:08:10 +0100 Subject: Initialize all fields of GdkEvents in nsClipboard.cpp --- widget/gtk/nsClipboard.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'widget') diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp index eecae3e88..950be1dc4 100644 --- a/widget/gtk/nsClipboard.cpp +++ b/widget/gtk/nsClipboard.cpp @@ -806,7 +806,7 @@ void GetHTMLCharset(guchar * data, int32_t dataLength, nsCString& str) static void DispatchSelectionNotifyEvent(GtkWidget *widget, XEvent *xevent) { - GdkEvent event; + GdkEvent event = {}; event.selection.type = GDK_SELECTION_NOTIFY; event.selection.window = gtk_widget_get_window(widget); event.selection.selection = gdk_x11_xatom_to_atom(xevent->xselection.selection); @@ -822,7 +822,7 @@ DispatchPropertyNotifyEvent(GtkWidget *widget, XEvent *xevent) { GdkWindow *window = gtk_widget_get_window(widget); if ((gdk_window_get_events(window)) & GDK_PROPERTY_CHANGE_MASK) { - GdkEvent event; + GdkEvent event = {}; event.property.type = GDK_PROPERTY_NOTIFY; event.property.window = window; event.property.atom = gdk_x11_xatom_to_atom(xevent->xproperty.atom); -- cgit v1.2.3 From f61a99e5ed6de754e9e99d05634c508f0b4d951a Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Thu, 9 Jan 2020 09:53:16 +0100 Subject: Issue #1348 - Part 1: Clean up input scope support for IMM32. Use AutoTArray to set input scope. --- widget/windows/WinIMEHandler.cpp | 76 ++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 50 deletions(-) (limited to 'widget') diff --git a/widget/windows/WinIMEHandler.cpp b/widget/windows/WinIMEHandler.cpp index d44f729c4..99f0fb136 100644 --- a/widget/windows/WinIMEHandler.cpp +++ b/widget/windows/WinIMEHandler.cpp @@ -588,77 +588,53 @@ IMEHandler::SetInputScopeForIMM32(nsWindow* aWindow, if (sIsInTSFMode || !sSetInputScopes || aWindow->Destroyed()) { return; } - UINT arraySize = 0; - const InputScope* scopes = nullptr; + AutoTArray scopes; // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html if (aHTMLInputType.IsEmpty() || aHTMLInputType.EqualsLiteral("text")) { if (aHTMLInputInputmode.EqualsLiteral("url")) { - static const InputScope inputScopes[] = { IS_URL }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_URL); } else if (aHTMLInputInputmode.EqualsLiteral("email")) { - static const InputScope inputScopes[] = { IS_EMAIL_SMTPEMAILADDRESS }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_EMAIL_SMTPEMAILADDRESS); } else if (aHTMLInputInputmode.EqualsLiteral("tel")) { - static const InputScope inputScopes[] = - {IS_TELEPHONE_LOCALNUMBER, IS_TELEPHONE_FULLTELEPHONENUMBER}; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_TELEPHONE_LOCALNUMBER); + scopes.AppendElement(IS_TELEPHONE_FULLTELEPHONENUMBER); } else if (aHTMLInputInputmode.EqualsLiteral("numeric")) { - static const InputScope inputScopes[] = { IS_NUMBER }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_NUMBER); } else { - static const InputScope inputScopes[] = { IS_DEFAULT }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_DEFAULT); } } else if (aHTMLInputType.EqualsLiteral("url")) { - static const InputScope inputScopes[] = { IS_URL }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_URL); } else if (aHTMLInputType.EqualsLiteral("search")) { - static const InputScope inputScopes[] = { IS_SEARCH }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_SEARCH); } else if (aHTMLInputType.EqualsLiteral("email")) { - static const InputScope inputScopes[] = { IS_EMAIL_SMTPEMAILADDRESS }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_EMAIL_SMTPEMAILADDRESS); } else if (aHTMLInputType.EqualsLiteral("password")) { - static const InputScope inputScopes[] = { IS_PASSWORD }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_PASSWORD); } else if (aHTMLInputType.EqualsLiteral("datetime") || aHTMLInputType.EqualsLiteral("datetime-local")) { - static const InputScope inputScopes[] = { - IS_DATE_FULLDATE, IS_TIME_FULLTIME }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_DATE_FULLDATE); + scopes.AppendElement(IS_TIME_FULLTIME); } else if (aHTMLInputType.EqualsLiteral("date") || aHTMLInputType.EqualsLiteral("month") || aHTMLInputType.EqualsLiteral("week")) { - static const InputScope inputScopes[] = { IS_DATE_FULLDATE }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_DATE_FULLDATE); } else if (aHTMLInputType.EqualsLiteral("time")) { - static const InputScope inputScopes[] = { IS_TIME_FULLTIME }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_TIME_FULLTIME); } else if (aHTMLInputType.EqualsLiteral("tel")) { - static const InputScope inputScopes[] = { - IS_TELEPHONE_FULLTELEPHONENUMBER, IS_TELEPHONE_LOCALNUMBER }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_TELEPHONE_FULLTELEPHONENUMBER); + scopes.AppendElement(IS_TELEPHONE_LOCALNUMBER); } else if (aHTMLInputType.EqualsLiteral("number")) { - static const InputScope inputScopes[] = { IS_NUMBER }; - scopes = &inputScopes[0]; - arraySize = ArrayLength(inputScopes); + scopes.AppendElement(IS_NUMBER); } - if (scopes && arraySize > 0) { - sSetInputScopes(aWindow->GetWindowHandle(), scopes, arraySize, nullptr, 0, - nullptr, nullptr); + if (!scopes.IsEmpty()) { + sSetInputScopes(aWindow->GetWindowHandle(), + scopes.Elements(), + scopes.Length(), + nullptr, + 0, + nullptr, + nullptr); } } -- cgit v1.2.3 From e338d996999867b5d4f66d47837c56dba73a7f6b Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 9 Jan 2020 13:19:56 +0100 Subject: Issue #1348 - Part 2: Teach IMEState about Private Browsing mode. --- widget/IMEData.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'widget') diff --git a/widget/IMEData.h b/widget/IMEData.h index b12497be3..04245df26 100644 --- a/widget/IMEData.h +++ b/widget/IMEData.h @@ -300,6 +300,10 @@ struct InputContext final * compatibility with webapps relying on key listeners. */ bool mMayBeIMEUnaware; + /* Whether the owning document of the input element has been loaded + * in private browsing mode. */ + bool mInPrivateBrowsing; + bool IsOriginMainProcess() const { return mOrigin == ORIGIN_MAIN; -- cgit v1.2.3 From 00b8ab8be2ac97de7ccb22af499208a281afd161 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 9 Jan 2020 13:22:29 +0100 Subject: 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. --- widget/windows/TSFTextStore.cpp | 15 ++++++++++++--- widget/windows/TSFTextStore.h | 3 ++- widget/windows/WinIMEHandler.cpp | 16 ++++++++++++---- widget/windows/WinIMEHandler.h | 3 ++- 4 files changed, 28 insertions(+), 9 deletions(-) (limited to 'widget') diff --git a/widget/windows/TSFTextStore.cpp b/widget/windows/TSFTextStore.cpp index c80de831c..12b8cd0c1 100644 --- a/widget/windows/TSFTextStore.cpp +++ b/widget/windows/TSFTextStore.cpp @@ -1355,7 +1355,9 @@ TSFTextStore::Init(nsWindowBase* aWidget, return false; } - SetInputScope(aContext.mHTMLInputType, aContext.mHTMLInputInputmode); + SetInputScope(aContext.mHTMLInputType, + aContext.mHTMLInputInputmode, + aContext.mInPrivateBrowsing); // Create document manager RefPtr threadMgr = sThreadMgr; @@ -3205,9 +3207,15 @@ TSFTextStore::InsertEmbedded(DWORD dwFlags, void TSFTextStore::SetInputScope(const nsString& aHTMLInputType, - const nsString& aHTMLInputInputMode) + const nsString& aHTMLInputInputMode, + bool aInPrivateBrowsing) { mInputScopes.Clear(); + + if (aInPrivateBrowsing) { + mInputScopes.AppendElement(IS_PRIVATE); + } + if (aHTMLInputType.IsEmpty() || aHTMLInputType.EqualsLiteral("text")) { if (aHTMLInputInputMode.EqualsLiteral("url")) { mInputScopes.AppendElement(IS_URL); @@ -5688,7 +5696,8 @@ TSFTextStore::SetInputContext(nsWindowBase* aWidget, if (sEnabledTextStore) { RefPtr textStore(sEnabledTextStore); textStore->SetInputScope(aContext.mHTMLInputType, - aContext.mHTMLInputInputmode); + aContext.mHTMLInputInputmode, + aContext.mInPrivateBrowsing); } return; } diff --git a/widget/windows/TSFTextStore.h b/widget/windows/TSFTextStore.h index 9596510d5..d1431e95d 100644 --- a/widget/windows/TSFTextStore.h +++ b/widget/windows/TSFTextStore.h @@ -355,7 +355,8 @@ protected: ULONG aFilterCount, const TS_ATTRID* aFilterAttrs); void SetInputScope(const nsString& aHTMLInputType, - const nsString& aHTMLInputInputmode); + const nsString& aHTMLInputInputmode, + bool aInPrivateBrowsing); // Creates native caret over our caret. This method only works on desktop // application. Otherwise, this does nothing. 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 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")) { diff --git a/widget/windows/WinIMEHandler.h b/widget/windows/WinIMEHandler.h index c18a4437e..c836e8626 100644 --- a/widget/windows/WinIMEHandler.h +++ b/widget/windows/WinIMEHandler.h @@ -144,7 +144,8 @@ private: static decltype(SetInputScopes)* sSetInputScopes; static void SetInputScopeForIMM32(nsWindow* aWindow, const nsAString& aHTMLInputType, - const nsAString& aHTMLInputInputmode); + const nsAString& aHTMLInputInputmode, + bool aInPrivateBrowsing); static bool sIsInTSFMode; // If sIMMEnabled is false, any IME messages are not handled in TSF mode. // Additionally, IME context is always disassociated from focused window. -- cgit v1.2.3 From e01d499617b7e090785006c13e92f02e22993ca5 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 10 Jan 2020 19:40:14 +0100 Subject: Update GTK clipboard handling - Store the clipboard even if it was set in a GTK dialog. - Fix a GtkTargetList leak. - Notify GTK that the data is no longer available for clipboard_get_cb(), so that GTK will no longer advertise nor attempt to store the data. --- widget/gtk/nsClipboard.cpp | 51 ++++++++++++++++++++++++++-------------------- widget/gtk/nsClipboard.h | 5 ++--- 2 files changed, 31 insertions(+), 25 deletions(-) (limited to 'widget') diff --git a/widget/gtk/nsClipboard.cpp b/widget/gtk/nsClipboard.cpp index 950be1dc4..1ae3673b0 100644 --- a/widget/gtk/nsClipboard.cpp +++ b/widget/gtk/nsClipboard.cpp @@ -120,24 +120,13 @@ NS_IMETHODIMP nsClipboard::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) { if (strcmp(aTopic, "quit-application") == 0) { - // application is going to quit, save clipboard content - Store(); + // Application is going to quit, save clipboard content + gtk_clipboard_store(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD)); gdk_window_remove_filter(nullptr, selection_request_filter, nullptr); } return NS_OK; } -nsresult -nsClipboard::Store(void) -{ - // Ask the clipboard manager to store the current clipboard content - if (mGlobalTransferable) { - GtkClipboard *clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); - gtk_clipboard_store(clipboard); - } - return NS_OK; -} - NS_IMETHODIMP nsClipboard::SetData(nsITransferable *aTransferable, nsIClipboardOwner *aOwner, int32_t aWhichClipboard) @@ -152,9 +141,6 @@ nsClipboard::SetData(nsITransferable *aTransferable, return NS_OK; } - // Clear out the clipboard in order to set the new data - EmptyClipboard(aWhichClipboard); - // List of suported targets GtkTargetList *list = gtk_target_list_new(nullptr, 0); @@ -163,8 +149,12 @@ nsClipboard::SetData(nsITransferable *aTransferable, nsresult rv = aTransferable->FlavorsTransferableCanExport(getter_AddRefs(flavors)); - if (!flavors || NS_FAILED(rv)) + if (!flavors || NS_FAILED(rv)) { + // Clear references to the any old data and let GTK know that it is no + // longer available. + EmptyClipboard(aWhichClipboard); return NS_ERROR_FAILURE; + } // Add all the flavors to this widget's supported type. bool imagesAdded = false; @@ -232,8 +222,10 @@ nsClipboard::SetData(nsITransferable *aTransferable, } rv = NS_OK; - } - else { + } else { + // Clear references to the any old data and let GTK know that it is no + // longer available. + EmptyClipboard(aWhichClipboard); rv = NS_ERROR_FAILURE; } @@ -373,6 +365,23 @@ nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard) NS_IMETHODIMP nsClipboard::EmptyClipboard(int32_t aWhichClipboard) { + if (aWhichClipboard == kSelectionClipboard) { + if (mSelectionTransferable) { + gtk_clipboard_clear(gtk_clipboard_get(GDK_SELECTION_PRIMARY)); + MOZ_ASSERT(!mSelectionTransferable); + } + } else { + if (mGlobalTransferable) { + gtk_clipboard_clear(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD)); + MOZ_ASSERT(!mGlobalTransferable); + } + } + + return NS_OK; +} + +void +nsClipboard::ClearTransferable(int32_t aWhichClipboard) { if (aWhichClipboard == kSelectionClipboard) { if (mSelectionOwner) { mSelectionOwner->LosingOwnership(mSelectionTransferable); @@ -387,8 +396,6 @@ nsClipboard::EmptyClipboard(int32_t aWhichClipboard) } mGlobalTransferable = nullptr; } - - return NS_OK; } NS_IMETHODIMP @@ -652,7 +659,7 @@ nsClipboard::SelectionClearEvent(GtkClipboard *aGtkClipboard) else return; // THAT AIN'T NO CLIPBOARD I EVER HEARD OF - EmptyClipboard(whichClipboard); + ClearTransferable(whichClipboard); } void diff --git a/widget/gtk/nsClipboard.h b/widget/gtk/nsClipboard.h index 70c866a01..c3129bf20 100644 --- a/widget/gtk/nsClipboard.h +++ b/widget/gtk/nsClipboard.h @@ -39,13 +39,12 @@ private: static GdkAtom GetSelectionAtom (int32_t aWhichClipboard); static GtkSelectionData *GetTargets (GdkAtom aWhichClipboard); - // Save global clipboard content to gtk - nsresult Store (void); - // Get our hands on the correct transferable, given a specific // clipboard nsITransferable *GetTransferable (int32_t aWhichClipboard); + void ClearTransferable(int32_t aWhichClipboard); + // Hang on to our owners and transferables so we can transfer data // when asked. nsCOMPtr mSelectionOwner; -- cgit v1.2.3