Commit Graph
130 Commits
Author SHA1 Message Date
Yannis Juglaret a81755da89 Bug 1897479 - Abstract away single-step data collection for reusability. r=rkraesig,win-reviewers
This patch makes the single-step data collection code that we
implemented for bug 1571516 reusable, while preserving its behavior.
No functional changes, except for a slight reordering of the
error-result enum.

We define a generic CollectSingleStepData function that embeds the
magic for starting to trigger single step exceptions and for acting upon
them.

We define a more specialized CollectModuleSingleStepData function which
can be reused if the purpose of single step data collection is to
monitor what paths are taken within a specific module. It stores the
collected data in stack, so that it can be accessed from crash reports.

This code is considered unstable and thus only available in Nightly and
early Beta and only used on paths that are known to crash already.

Differential Revision: https://phabricator.services.mozilla.com/D211195
2024-06-03 12:24:41 +00:00
serge-sans-paille 2507d2f681 Bug 1869497 - Introduce MOZ_NAKED to centralize all attributes we expect from naked r=glandium,win-reviewers,mhowell
In the fx codebase, we tend to use __attribute__((naked)) for plain
assembly functions with a C interface. Instrumenting these functions can
mess up this assembly, so we conservatively also want to prevent
instrumentation.

Differential Revision: https://phabricator.services.mozilla.com/D196154
2023-12-15 09:26:48 +00:00
Cristian Tuns 5693a730d3 Backed out 2 changesets (bug 1865795) for causing spidermonkeys bustages with WinHeaderOnlyUtils.h CLOSED TREE
Backed out changeset d7e12200a4a0 (bug 1865795)
Backed out changeset 9efc72d1ff06 (bug 1865795)
2023-12-06 13:16:53 -05:00
Yannis Juglaret 8d2c3a1caf Bug 1865795 - Abstract away single-step data collection for reusability. r=rkraesig,win-reviewers
This patch makes the single-step data collection code that we
implemented for bug 1571516 reusable, while preserving its behavior.

We define a generic CollectSingleStepData function that embeds the
magic for starting to trigger single step exceptions and for acting upon
them.

We define a more specialized CollectModuleSingleStepData function which
can be reused if the purpose of single step data collection is to
monitor what paths are taken within a specific module. It stores the
collected data in stack, so that it can be accessed from crash reports.

This code is considered unstable and thus only available in Nightly and
early Beta and only used on paths that are known to crash already.

Differential Revision: https://phabricator.services.mozilla.com/D194203
2023-12-06 16:53:40 +00:00
Yannis Juglaret 29675453c5 Bug 1571516 - Additional attempt at collecting debug information for CreateWindowW failures. r=win-reviewers,rkraesig
This patch runs RegisterClassW and CreateWindowW a second time when they
fail, so that we can trace their execution and collect single-step data.
We collect RIP values as we step through user32 code. We also collect
changes in the error state while in user32. We store the collected data
in the stack so that it appears in the crash dumps.

Because this patch only affects behavior after a first failure (which
would normally lead to an immediate crash), it does not alter behavior
for non-crashing users.

Differential Revision: https://phabricator.services.mozilla.com/D189240
2023-10-10 14:41:41 +00:00
Ray Kraesig a627fa29e5 Bug 1571516 - log additional data to stack (redux) r=gsvelto,win-reviewers,mhowell
Improve logging around InitHiddenWindow():

- Normalize WinErrorState.

- Simplify access to the OS-cached last-NTSTATUS value.

- Store and clear the last error-state more frequently.

- When ::CreateWindowW() fails, keep enough information to determine
  whether a call to ::RegisterClassW() was attempted.

- To rule out user atom table exhaustion, check the capacity and
  availability of the user atom table after a call that might have
  created a user atom fails.

- To rule out early return from our WndProc, when
  ::RegisterWindowMessageW() fails, leave the extant value of
  sAppShellGeckoMsgId in place.

Differential Revision: https://phabricator.services.mozilla.com/D188307
2023-09-15 19:12:29 +00:00
Ray Kraesig b55d9e5ef0 Bug 1571516 - [2/2] store diagnostic data within stack frame r=gsvelto
Per https://bugzilla.mozilla.org/show_bug.cgi?id=1571516#c24, we don't
currently store diagnostic data like the value of `::GetLastError()` in
stack dumps. However, we do store the current stack, and that's enough
to be usable.

Store some additional (critical?) diagnostic information in local
variables on the stack... and disable optimizations for that function,
to ensure that those variables actually exist in the stack-dump.

Arguably, no functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D186988
2023-08-30 22:34:44 +00:00
Ray Kraesig b190acd9ed Bug 1571516 - [1/2] preparatory reorganization r=gsvelto
Pull the failing section of code out into its own function, for the sake
of clarity of later diffs.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D186987
2023-08-30 22:34:43 +00:00
Butkovits Atila bd8dfd19c6 Backed out 2 changesets (bug 1571516) for causing bustages at nsAppShell. CLOSED TREE
Backed out changeset d706cd5fccfe (bug 1571516)
Backed out changeset 0664ee61f82f (bug 1571516)
2023-08-30 23:04:10 +03:00
Ray Kraesig 465a8699da Bug 1571516 - [2/2] store diagnostic data within stack frame r=gsvelto
Per https://bugzilla.mozilla.org/show_bug.cgi?id=1571516#c24, we don't
currently store diagnostic data like the value of `::GetLastError()` in
stack dumps. However, we do store the current stack, and that's enough
to be usable.

Store some additional (critical?) diagnostic information in local
variables on the stack... and disable optimizations for that function,
to ensure that those variables actually exist in the stack-dump.

Arguably, no functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D186988
2023-08-30 17:26:32 +00:00
Ray Kraesig b4972b794f Bug 1571516 - [1/2] preparatory reorganization r=gsvelto
Pull the failing section of code out into its own function, for the sake
of clarity of later diffs.

No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D186987
2023-08-30 17:26:32 +00:00
Masatoshi Kimura a3e419385e Bug 1844908 - Remove pre-Win10-specific codepath from widget/. r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D184307
2023-07-26 08:52:54 +00:00
Natalia Csoregi 42e803a2dd Backed out 19 changesets (bug 1844908) for causing win bustage on AvailableMemoryTracker.cpp. CLOSED TREE
Backed out changeset 44c66f2233cf (bug 1844908)
Backed out changeset a8010ff534bf (bug 1844908)
Backed out changeset 225dc3aeb220 (bug 1844908)
Backed out changeset a1414db64e33 (bug 1844908)
Backed out changeset 7f1e0a527839 (bug 1844908)
Backed out changeset 6dc7646d1ffa (bug 1844908)
Backed out changeset 8d715131510f (bug 1844908)
Backed out changeset 4b6fe8a4e7db (bug 1844908)
Backed out changeset 2b419fabf1e8 (bug 1844908)
Backed out changeset af84e701d616 (bug 1844908)
Backed out changeset 2fa203969ec5 (bug 1844908)
Backed out changeset 2b3d2df94db3 (bug 1844908)
Backed out changeset 7eca452f5fd7 (bug 1844908)
Backed out changeset 3d961cf25afe (bug 1844908)
Backed out changeset 3c59143f8dd7 (bug 1844908)
Backed out changeset ab50c6c5425a (bug 1844908)
Backed out changeset b2c5636df673 (bug 1844908)
Backed out changeset e9a0f1c6760c (bug 1844908)
Backed out changeset 945ccbedde0b (bug 1844908)
2023-07-25 19:55:35 +03:00
Masatoshi Kimura 4182954d50 Bug 1844908 - Remove pre-Win10-specific codepath from widget/. r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D184307
2023-07-25 14:41:05 +00:00
James Teh f027ac1541 Bug 1838123: Update UI Automation client detection to work with modern versions of Windows. r=nlapre,handyman
The window message we previously hooked no longer gets sent and the associated shared memory no longer seems to be created either.
Also, we don't seem to be notified about the load of UIAutomationCore.dll until after it has already instantiated a11y, which is obviously too late for us to hook anything.
Instead, we block UIA instantiation via LazyInstantiator, just as we do for MSAA/IA2:

1. Refactor CompatibilityUIA so that rather than being called by a hook, it simply allows the caller to query the process ids of any UIA clients.
2. CompatibilityUIA now searches handles in our process for named pipes created by UIA for communication with the remote process and then uses GetNamedPipeServerProcessId to get the process id on the other end of each pipe.
3. Refactor LazyInstantiator so that it first tries to get the MSAA/IA2 client process id, then calls CompatibilityUIA to get any UIA client process ids.
4. LazyInstantiator now handles setting the instantiator and blocking of clients for UIA as well as MSAA/IA2 using the same code.
5. Because UIA client detection can be expensive if clients repeatedly query us, cache the result. Reset that cache only when one of our windows comes to the foreground.

Differential Revision: https://phabricator.services.mozilla.com/D181958
2023-07-13 05:25:20 +00:00
Iulian Moraru 31079e4e24 Backed out changeset 0724fde82b2f (bug 1838123) for causing build bustages. CLOSED TREE 2023-07-13 07:35:44 +03:00
James Teh 24665a2abc Bug 1838123: Update UI Automation client detection to work with modern versions of Windows. r=nlapre,handyman
The window message we previously hooked no longer gets sent and the associated shared memory no longer seems to be created either.
Also, we don't seem to be notified about the load of UIAutomationCore.dll until after it has already instantiated a11y, which is obviously too late for us to hook anything.
Instead, we block UIA instantiation via LazyInstantiator, just as we do for MSAA/IA2:

1. Refactor CompatibilityUIA so that rather than being called by a hook, it simply allows the caller to query the process ids of any UIA clients.
2. CompatibilityUIA now searches handles in our process for named pipes created by UIA for communication with the remote process and then uses GetNamedPipeServerProcessId to get the process id on the other end of each pipe.
3. Refactor LazyInstantiator so that it first tries to get the MSAA/IA2 client process id, then calls CompatibilityUIA to get any UIA client process ids.
4. LazyInstantiator now handles setting the instantiator and blocking of clients for UIA as well as MSAA/IA2 using the same code.
5. Because UIA client detection can be expensive if clients repeatedly query us, cache the result. Reset that cache only when one of our windows comes to the foreground.

Differential Revision: https://phabricator.services.mozilla.com/D181958
2023-07-13 03:57:30 +00:00
David Parks f396f754b1 Bug 1841871: Add native event profiling and logging to Windows AppShell r=gstoll
Differential Revision: https://phabricator.services.mozilla.com/D182819
2023-07-06 19:57:40 +00:00
Stanca Serban d527f6a464 Backed out 2 changesets (bug 1841871) for causing bp-nu bustages in nsWindowDbg.cpp. CLOSED TREE
Backed out changeset 2ea8f3575620 (bug 1841871)
Backed out changeset faafc044fa2b (bug 1841871)
2023-07-06 02:06:52 +03:00
David Parks ef0559468e Bug 1841871: Add native event profiling and logging to Windows AppShell r=gstoll
Differential Revision: https://phabricator.services.mozilla.com/D182819
2023-07-05 21:59:14 +00:00
serge-sans-paille 71d5bc785e Bug 1825324 - Make widget/* buildable outside of a unified build environment r=andi,geckoview-reviewers,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D173969
2023-04-01 08:31:12 +00:00
Cristian Tuns 29ebb2f54e Backed out 12 changesets (bug 1825325, bug 1825336, bug 1825333, bug 1825332, bug 1825324, bug 1824557, bug 1825328, bug 1825335, bug 1825330, bug 1825329, bug 1825327, bug 1825331) for causing build bustages in nsClipboard.cpp CLOSED TREE
Backed out changeset 9de3ed24d3a0 (bug 1825336)
Backed out changeset aef787728f19 (bug 1825335)
Backed out changeset a04c341244c1 (bug 1825333)
Backed out changeset e3ad15f762ba (bug 1825332)
Backed out changeset eed23da92a27 (bug 1825331)
Backed out changeset 8213bb54376e (bug 1825330)
Backed out changeset 747ec5ac4994 (bug 1825329)
Backed out changeset e91ff431f92d (bug 1825328)
Backed out changeset 59c18d13768b (bug 1825327)
Backed out changeset 538096d99e49 (bug 1825325)
Backed out changeset c76eb9d9b095 (bug 1825324)
Backed out changeset 8b81410eb686 (bug 1824557)
2023-03-31 12:58:53 -04:00
serge-sans-paille 1bf9d22652 Bug 1825324 - Make widget/* buildable outside of a unified build environment r=andi,geckoview-reviewers,m_kato
Depends on D173637

Differential Revision: https://phabricator.services.mozilla.com/D173969
2023-03-31 13:29:44 +00:00
Mathew Hodson f87e55defb Bug 1783087 - Fix build with --disable-backgroundtasks. r=nalexander DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D153690
2022-08-08 10:40:29 +00:00
David Parks 316f497e45 Bug 1755700: Use StartAudioSession and StopAudioSession symmetrically r=cmartin
Moves StopAudioSession earlier -- to nsAppShell::Run -- where we call StartAudioSession.

Differential Revision: https://phabricator.services.mozilla.com/D152299
2022-07-29 19:32:14 +00:00
Sean Burke 9471bef671 Bug 1343826 - Return updated timezone on system timezone change. r=smaug,mstange,stransky,handyman
Differential Revision: https://phabricator.services.mozilla.com/D146725
2022-06-14 19:41:30 +00:00
Mike Hommey 45b9f403ab Bug 1766561 - Use %lu for Windows Error types (DWORD). r=rkraesig,xpcom-reviewers,application-update-reviewers,mhowell,bobowen,necko-reviewers,keeler,media-playback-reviewers,bytesized,barret,alwu,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D144914
2022-05-03 20:49:07 +00:00
Shazib Summar eacc52a34a Bug 1617283 - Shifted AudioSession to MTA and removed COM violations r=handyman
Cleans up the interface to AudioSession and brings in line with COM best practices.  Uses background threads that are implicitly MTA and asserts proper thread behavior.  This also removes AudioSession's Co[Un]Initialize static analysis violations.

Differential Revision: https://phabricator.services.mozilla.com/D140741
2022-04-07 18:39:49 +00:00
Nick Alexander f67aebbc21 Bug 1753603 - Don't {Start,Stop}AudioSession in background tasks. r=mossop
The presenting issue is that each background task's audio session is
user-visible via various Windows UIs that display "volume controls" or
"volume mixers"; this avoids that.

Differential Revision: https://phabricator.services.mozilla.com/D141101
2022-03-16 17:29:37 +00:00
Narcis Beleuzu 5d0bbfc7b8 Backed out changeset 6fd4b72c9a6c (bug 1617283) for dt failure on browser_dbg-backgroundtask-debugging.js . CLOSED TREE 2022-03-16 02:26:38 +02:00
Shazib Summar 38ef159720 Bug 1617283 - Shifted AudioSession to MTA and removed COM violations r=handyman
Pointer to AudioSession object is made std::atomic to resolve crashes (bug 1755700) by atomically modifying/reading the pointer as an effort to make sure any update to the pointer is seen across other threads immediately while not using locks to maintain such concurrency and avoiding dataraces.

This patch is built upon the work done in D136377.

Differential Revision: https://phabricator.services.mozilla.com/D140741
2022-03-15 19:48:43 +00:00
Narcis Beleuzu 878597bb4a Backed out changeset e1b946a41694 (bug 1617283) for audio related crashes and hangs (bug 1755700, bug 1755717). a=backout 2022-02-16 18:14:02 +02:00
Shazib Summar 56d1e09352 Bug 1617283 - Removed COM violations and shifted AudioSession to MTA r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D136377
2022-02-15 22:28:41 +00:00
Butkovits Atila bd93ffbe3f Backed out changeset 14ef7c10fef4 (bug 1617283) for causing bustages complaining about Unified_cpp_widget_windows0.obj. CLOSED TREE 2022-02-07 00:24:45 +02:00
Shazib Summar 0dd31b9d01 Bug 1617283 - Removed COM violations and shifted AudioSession to MTA r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D136377
2022-02-06 22:01:29 +00:00
Christian Holler 6b86e1884a Bug 1750181 - Silence warning about unused diagnostic variable. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D136476
2022-01-20 13:27:47 +00:00
Christian Holler 82f8a534d3 Bug 1571516 - Add diagnostics for startup crash. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D135685
2022-01-12 10:14:00 +00:00
Mike Hommey 4dfe43b4f7 Bug 1732208 - Silence the unused-but-set-variable warning in widget. r=cmartin
widget/windows/nsAppShell.cpp(685,10): error: variable 'uiMessage' set but not used [-Werror,-Wunused-but-set-variable]
    bool uiMessage = false;
         ^
widget/windows/TaskbarPreview.cpp(370,11): error: variable 'hr' set but not used [-Werror,-Wunused-but-set-variable]
  HRESULT hr;
          ^

Differential Revision: https://phabricator.services.mozilla.com/D126461
2021-09-28 00:02:48 +00:00
Bob Owen c5eb171752 Bug 1701802: Don't use SingleNativeEventPump in windows app shell if win32k is locked down. r=handyman
Depends on D112961

Differential Revision: https://phabricator.services.mozilla.com/D112962
2021-04-27 07:41:16 +00:00
Gerald Squelart f25e1c0093 Bug 1691589 - Reduce reliance on GeckoProfiler.h when only labels (and maybe markers) are needed - r=necko-reviewers,geckoview-reviewers,sg,agi,florian
There are no code changes, only #include changes.
It was a fairly mechanical process: Search for all "AUTO_PROFILER_LABEL", and in each file, if only labels are used, convert "GeckoProfiler.h" into "ProfilerLabels.h" (or just add that last one where needed).
In some files, there were also some marker calls but no other profiler-related calls, in these cases "GeckoProfiler.h" was replaced with both "ProfilerLabels.h" and "ProfilerMarkers.h", which still helps in reducing the use of the all-encompassing "GeckoProfiler.h".

Differential Revision: https://phabricator.services.mozilla.com/D104588
2021-02-16 04:44:19 +00:00
alwu ef82d8c798 Bug 1657043 - part3 : implement a new wakelock listener with new API. r=jmathies
`PowerSetRequest` is a new API to request wakelock for Windows 7 and above versions. This new listener would use new API to request wakelock to solve the issue where old API doesn't work on certain users computer.

[1] https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-powersetrequest

Differential Revision: https://phabricator.services.mozilla.com/D85820
2020-08-12 20:57:17 +00:00
alwu c684395a25 Bug 1657043 - part2 : rename listener to legacy listener. r=jmathies
This listener uses `SetThreadExecutionState`[1] to request wakelock, which is an old API. I would create a new listener to use new API in D85820 so rename this one as a legacy listener.

[1] https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate

Differential Revision: https://phabricator.services.mozilla.com/D85819
2020-08-12 20:55:53 +00:00
alwu 3ac54af2c4 Bug 1657043 - part1 : only use wakelock listener in chrome process. r=jmathies
Whole firefox only needs one wakelock instance, requesting more wakelock doesn't help anything. As those notification would be sent to chrome process as well, so we would only need one listener in chrome process to prevent requesting unnecessary wakelock.

Differential Revision: https://phabricator.services.mozilla.com/D85818
2020-08-12 20:55:18 +00:00
Simon Giesecke a69d79b6db Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Emilio Cobos Álvarez 03cfd95496 Bug 1641245 - Make string comparators not virtual. r=froydnj,necko-reviewers,geckoview-reviewers,jgilbert,agi,valentin
There's no use case for stateful comparators, so they can be just plain
function pointers.

This is used in some hot places like CSS selector matching.

Differential Revision: https://phabricator.services.mozilla.com/D77084
2020-05-27 18:11:12 +00:00
Aaron Klotz 7ed9f1cafd Bug 1639391: Do not call nsWindow::GetAttention for top-level windows being shown during session restore; r=mhowell
When we call nsWindow::Show but Firefox is not foreground, we show the window
and also flash it on the taskbar to get the user's attention.

This is really annoying when restoring a session with `N` windows, as the
user's taskbar ends up with all `N` of them stuck in a flashed state until the
user goes through and manually activates every single window.

There are several ways I thought of to address this, but I think the
simplest one is just to track whether or not we're in the middle of restoring a
session and skip flashing when we are doing so.

Differential Revision: https://phabricator.services.mozilla.com/D76406
2020-05-22 01:49:11 +00:00
Bob Owen 24b35ff452 Bug 1632583: Only register taskbar button creation message in the parent process. r=aklotz
This also removes XRE_Win32kCallsAllowed and replaces its other use.

Differential Revision: https://phabricator.services.mozilla.com/D73909
2020-05-05 16:11:44 +00:00
Gerald Squelart 279fd05754 Bug 1530419 - Move PROFILER_AUTO_THREAD_SLEEP into WinUtils::WaitForMessage from callers - r=mstange
Both `nsAppShell::ProcessNextNativeEvent()` and `MessagePumpForUI::WaitForWork()` have a `PROFILER_AUTO_THREAD_SLEEP` surrounding the `mozilla::widget::WinUtils::WaitForMessage()` call.
However inside `WaitForMessage()` the call to `PeekMessageW()` may trigger a sequence of events (because the system delivers pending messages) that end in the initialization of a new thread, which invokes `ReentrantMonitor::Wait()` where there is a `PROFILER_AUTO_THREAD_SLEEP`.

To avoid this recursion, this patch moves `PROFILER_AUTO_THREAD_SLEEP` from both callers into `WaitForMessage()` to only enclose the actual potentially-sleeping operation `::MsgWaitForMultipleObjectsEx()`.

Differential Revision: https://phabricator.services.mozilla.com/D72850
2020-04-28 16:22:13 +00:00
alwu ff621e9851 Bug 1584319 - refactor the way of requesting wakelock on Windows. r=jmathies
Current implementation would fail to request a non-display wakelock on Windows when we ask for a background audio lock. The check for `audio-playing` with `locked-background` is incorrect. Therefore, adding new a variable to tell if we should request a non-display lock.

Differential Revision: https://phabricator.services.mozilla.com/D60201
2020-02-12 01:32:39 +00:00
Bob Owen 3e6d8d8a35 Bug 1565932: Add more Printer dialog completion messages to be reposted on x86 Windows. r=jmathies
These are now being hit because of the removal of the HTML frames
customizations to the print dialog.
I've removed the defines for these, because I don't think there is any point
trying to guess what their uses are.
I've also made it 32-bit only, because we only see them on 32-bit Windows 7.
In fact only 32-bit Firefox on 64-bit Windows 7 I believe.

Differential Revision: https://phabricator.services.mozilla.com/D40433
2019-08-05 17:17:31 +00:00