Граф коммитов

482 Коммитов

Автор SHA1 Сообщение Дата
Mike Hommey 85e065c14d Bug 1700885 - Add a runtime way to disable MozWalkTheStack. r=Gankra
WalkTheStack* is the function that is being called to print stacks to
the user on e.g. MOZ_CRASH on debug builds. Until bug 1699375, some
cases weren't covered, which now cause unwanted side-effects with e.g.
fuzzing. At least as a stop-gap, allow to runtime-disable the behavior
via an environment variable.

Other uses of the stack-walker, like the profiler's, are not affected
when setting the environment variable.

Differential Revision: https://phabricator.services.mozilla.com/D110199
2021-03-31 00:47:58 +00:00
Simon Giesecke 760cc7e936 Bug 1679522 - Fix include directives and forward declarations. r=andi,necko-reviewers,jgilbert
- Add missing include directives and forward declarations.
- Remove some extra include directives.
- Add missing namespace qualifications.
- Move include directives out of namespace in toolkit/xre/GlobalSemaphore.h

Differential Revision: https://phabricator.services.mozilla.com/D98894
2021-03-25 10:19:44 +00:00
Mike Hommey 4d8e18962b Bug 1699375 - Move WalkTheStack to mozglue. r=nika
A long standing issue is that MOZ_ASSERT and related don't print stack
traces in debug builds when they're directly or indirectly emitted from
non-libxul code. Moving WalkTheStack to mozglue alleviates the problem.

It's also not printing stack traces when emitted from C code (and for
some C third party libraries, we do redirect assert to MOZ_ASSERT),
which we solve by making the corresponding API available without C++
(which WalkTheStack being a static method of the nsTraceRefCnt class
didn't allow, or the use of a closure on Android).

This requires some adjustements to headers that indirectly assume that
Assertions.h includes ErrorList.h through nsError.h through nscore.h
through nsTraceRefcnt.h.

We also remove TestStackCrawl.cpp because it hasn't been built since
bug 158528, 19 years ago.

Differential Revision: https://phabricator.services.mozilla.com/D108913
2021-03-22 21:25:30 +00:00
Mike Hommey 9f69fef1e9 Bug 1699375 - Make MozFormatCodeAddress* return the printed size, and use that instead of strlen. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D108912
2021-03-22 21:25:30 +00:00
Mike Hommey 6cb10c45a4 Bug 1699375 - Add {Vs,S}printLiteral-like functions for buffers of arbitrary size. r=nika
and use them in MozFormatCodeAddress.

Differential Revision: https://phabricator.services.mozilla.com/D108911
2021-03-22 21:25:30 +00:00
Mike Hommey 86270cdf01 Bug 1699375 - Move MozStackWalkThread to a separate header. r=gerald
It requires including <windows.h>, preventing the inclusion of StackWalk.h
from some places (and upcoming changes will make StackWalk.h included in
more places).

Differential Revision: https://phabricator.services.mozilla.com/D108910
2021-03-22 21:25:29 +00:00
Mike Hommey ec7f538e0c Bug 1698719 - Remove aSkipFrames argument to both FramePointerStackWalk and MozStackWalkThread. r=gsvelto,gerald
In the case of FramePointerStackwalk, the caller gives a pointer to the
top-most frame to walk from. There isn't really a reason to give a
number of frames to skip, as the right frame pointer could be given in
the first place if that was really necessary. And in practice, it's
hasn't been used so far.

In the case of MozStackWalkThread, the caller presumably doesn't know
what the thread the stack is being walked for is doing, and it would be
a guesswork to pass a valid number of frames to skip. In practice, it's
also not used.

The aSkipFrames is already a footgun on MozStackWalk (and we're going to
change that in bug 1515229), we don't need to keep a footgun on these
other stack walking methods.

Differential Revision: https://phabricator.services.mozilla.com/D108563
2021-03-17 00:21:39 +00:00
Jeff Muizelaar 702bd6eeec Bug 1680402. Use stderr in printf_stderr instead of reopening fd 2. r=glandium
Currently, printf_stderr doesn't show up when running with ./mach run.
This is because we run with -attach-console and that redirects stderr
to a different file descriptor using freopen in UseParentConsole.

The change from just using stderr directly happened in bug 340443 and was done
to avoid some linking issues. That problem doesn't seem to apply anymore so you'd
expect we'd be able to go back to the straightforward implemention that works even
if stderr has been redirected. Unfortunately, Windows takes not buffering
stderr very seriously and fprintf will write out the results character
by character. This can cause log output lines to be intermixed which
breaks log parsing in CI. We keep using fdopen to create a new FILE*
that's buffered but instead of hard coding fd 2, we get the actual fd
that corresponds to stderr using fileno.

The mozglue implementation was cargo culted from xpcom, so we update it
as well.

Differential Revision: https://phabricator.services.mozilla.com/D98550
2021-03-16 20:45:21 +00:00
Mike Hommey 9c0fcac97c Bug 1690167 - Change VsprintfLiteral/SprintfLiteral to rely on PrintfTarget. r=nika,Gankra,firefox-build-system-reviewers,mhentges
Instead of snprintf.

Because some standalone code uses those functions directly or indirectly,
and PrintfTarget lives in mozglue, they now need to depend on mozglue
instead of mfbt. Except logalloc/replay, which cherry-picks what it
uses, and the updater, for which we keep using vsnprintf.

Differential Revision: https://phabricator.services.mozilla.com/D103730
2021-03-10 23:52:40 +00:00
Mike Hommey e47bda795b Bug 1690167 - Add support for the hh length modifier in Printf.cpp. r=nika,Gankra
Test cases from TestIntegerPrintfMacros will cover this in the next commit.

Differential Revision: https://phabricator.services.mozilla.com/D103729
2021-03-10 23:52:40 +00:00
Mike Hommey c7936d817c Bug 1690167 - Add support for the j length modifier in Printf.cpp. r=Gankra
Test cases from TestIntegerPrintfMacros will cover this in an upcoming commit.

Differential Revision: https://phabricator.services.mozilla.com/D105080
2021-03-10 23:52:39 +00:00
Mike Hommey 3e40e0ce40 Bug 1690167 - Move Sprintf.h and IntegerPrintfMacros.h next to Printf.h. r=jwalden
Which means they move from MFBT to mozglue.

Differential Revision: https://phabricator.services.mozilla.com/D103728
2021-03-10 23:52:39 +00:00
Doug Thayer 6a24f1709b Bug 1696556 - Always run earlyBlankFirstPaint if we showed skele UI r=emalysz
This code is important for transitioning between the skeleton UI code and the
full-featured browser window code. Additionally, the original logic of disabling
when not on the default theme no longer applies, because it was intended to
eliminate white flashes in dark mode. However, with the skeleton UI, those
white flashes no longer occur.

Differential Revision: https://phabricator.services.mozilla.com/D107293
2021-03-09 18:37:53 +00:00
Doug Thayer e2fa1effe1 Bug 1696568 - Ensure skeleton UI window is always consumed if created r=emalysz
If we error out in, say, DrawSkeletonUI, the window we created will be orphaned
and left to sit there indefinitely. This patch fixes that by separating the
error from the consume result.

Differential Revision: https://phabricator.services.mozilla.com/D107301
2021-03-08 21:26:06 +00:00
Andreea Pavel 64289058b6 Backed out 5 changesets (bug 1690167) for failing xpcshell at bootstrapSvc.js on a CLOSED TREE
Backed out changeset d28c0f11743f (bug 1690167)
Backed out changeset 3b2bebed9128 (bug 1690167)
Backed out changeset 7e925e90a251 (bug 1690167)
Backed out changeset f85934a2b7ad (bug 1690167)
Backed out changeset 6d83474e81bb (bug 1690167)
2021-02-17 07:10:58 +02:00
Mike Hommey 622b111f9e Bug 1690167 - Change VsprintfLiteral/SprintfLiteral to rely on PrintfTarget. r=nika,Gankra,firefox-build-system-reviewers,mhentges
Instead of snprintf.

Because some standalone code uses those functions directly or indirectly,
and PrintfTarget lives in mozglue, they now need to depend on mozglue
instead of mfbt. Except logalloc/replay, which cherry-picks what it
uses.

Differential Revision: https://phabricator.services.mozilla.com/D103730
2021-02-16 21:20:04 +00:00
Mike Hommey 34cf11e754 Bug 1690167 - Add support for the hh length modifier in Printf.cpp. r=nika,Gankra
Test cases from TestIntegerPrintfMacros will cover this in the next commit.

Differential Revision: https://phabricator.services.mozilla.com/D103729
2021-02-16 21:20:04 +00:00
Mike Hommey 7912f64d75 Bug 1690167 - Add support for the j length modifier in Printf.cpp. r=Gankra
Test cases from TestIntegerPrintfMacros will cover this in an upcoming commit.

Differential Revision: https://phabricator.services.mozilla.com/D105080
2021-02-16 21:20:04 +00:00
Mike Hommey 900d63959b Bug 1690167 - Move Sprintf.h and IntegerPrintfMacros.h next to Printf.h. r=jwalden
Which means they move from MFBT to mozglue.

Differential Revision: https://phabricator.services.mozilla.com/D103728
2021-02-16 21:20:03 +00:00
Mihai Alexandru Michis 9154148880 Backed out 4 changesets (bug 1690167) for causing cppunit failures in TestIntegerPrintfMacros.
CLOSED TREE

Backed out changeset 27dee66eba83 (bug 1690167)
Backed out changeset cfffb092a39f (bug 1690167)
Backed out changeset 87b2a2a66fd9 (bug 1690167)
Backed out changeset cac4879f50b4 (bug 1690167)
2021-02-13 00:07:00 +02:00
Mike Hommey 47675f5460 Bug 1690167 - Change VsprintfLiteral/SprintfLiteral to rely on PrintfTarget. r=nika,Gankra,firefox-build-system-reviewers,mhentges
Instead of snprintf.

Because some standalone code uses those functions directly or indirectly,
and PrintfTarget lives in mozglue, they now need to depend on mozglue
instead of mfbt. Except logalloc/replay, which cherry-picks what it
uses.

Differential Revision: https://phabricator.services.mozilla.com/D103730
2021-02-12 20:21:50 +00:00
Mike Hommey 8207cffcad Bug 1690167 - Add support for the hh length modifier in Printf.cpp. r=nika,Gankra
Test cases from TestIntegerPrintfMacros will cover this in the next commit.

Differential Revision: https://phabricator.services.mozilla.com/D103729
2021-02-12 20:21:49 +00:00
Mike Hommey 6c2fd9938a Bug 1690167 - Move Sprintf.h and IntegerPrintfMacros.h next to Printf.h. r=jwalden
Which means they move from MFBT to mozglue.

Differential Revision: https://phabricator.services.mozilla.com/D103728
2021-02-12 20:21:49 +00:00
Doug Thayer 38b58e62b2 Bug 1690925 - Don't animate the skeleton UI if we're in a fast startup r=mconley,emalysz
This avoids paying a cost for animating the skeleton UI for faster startups.
Slow startups don't seem to be affected, given the data available. This is
likely due to slow startups being dominated by IO.

Differential Revision: https://phabricator.services.mozilla.com/D104118
2021-02-05 16:43:02 +00:00
Mike Hommey 34b72664d0 Bug 1598533 - Add support for %t modifier in PrintfTarget. r=nika,Gankra
Differential Revision: https://phabricator.services.mozilla.com/D103731
2021-02-02 20:16:55 +00:00
Mike Hommey afe55d2f87 Bug 1689279 - Fix clang-tidy warnings in Printf.cpp. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D103264
2021-02-02 21:18:06 +00:00
Mike Hommey 88b97ce29a Bug 1686831 - Use double-conversion for mozilla::PrintfTarget::cvt_f. r=nika
This makes mozilla::PrintfTarget consistent across all locales (not
printing e.g. "," instead of "." for the decimal point in floats in some
locales)

This implementation passes all the glibc tests in stdio-common/tfformat.c
except two tests because of the difference in how values like e.g 0.25 are
rounded. Printf in glibc and on MacOS, as well as Rust std::fmt, round to
nearest, ties to even. Double-conversion, as well as printf on Windows
and conversion functions in ECMAScript round to nearest, ties away from
zero.

The standard for printf says rounding is implementation-defined so
either way is technically correct.

Differential Revision: https://phabricator.services.mozilla.com/D102699
2021-01-29 04:25:54 +00:00
Mike Hommey c90777d4bf Bug 1686831 - Still apply fillers when no numbers are printed. r=Gankra
The standard for printf says that for integers, the result of converting
zero with an explicit precision of zero shall be no characters. But
flags and width still need to apply.

Differential Revision: https://phabricator.services.mozilla.com/D102696
2021-01-28 09:48:50 +00:00
Mike Hommey 89da5c6b52 Bug 1686831 - Add support for %F and %G, and properly support %n$E. r=nika,Gankra
%F and %G are the same as %f and %g, but using caps for the exponent
indicator, and for "inf"/"nan" for infinity and NaN.

%n$E is the same as %E, but taking the nth argument.

Differential Revision: https://phabricator.services.mozilla.com/D102695
2021-01-28 09:48:43 +00:00
Csoregi Natalia 8db3ebb5da Backed out 9 changesets (bug 1686831) for sanitizer failures on nsTSubstring.cpp. CLOSED TREE
Backed out changeset 0e03d508c8d4 (bug 1686831)
Backed out changeset cf6dd6eab427 (bug 1686831)
Backed out changeset 308000f1e14b (bug 1686831)
Backed out changeset c4d470be0184 (bug 1686831)
Backed out changeset 9751918b1ccb (bug 1686831)
Backed out changeset dd9b7e71dcfb (bug 1686831)
Backed out changeset 486a184530a7 (bug 1686831)
Backed out changeset b64d3e89bf68 (bug 1686831)
Backed out changeset dcc6396e455a (bug 1686831)
2021-01-28 09:55:28 +02:00
Mike Hommey 210911c78c Bug 1686831 - Use double-conversion for mozilla::PrintfTarget::cvt_f. r=nika
This makes mozilla::PrintfTarget consistent across all locales (not
printing e.g. "," instead of "." for the decimal point in floats in some
locales)

This implementation passes all the glibc tests in stdio-common/tfformat.c
except two tests because of the difference in how values like e.g 0.25 are
rounded. Printf in glibc and on MacOS, as well as Rust std::fmt, round to
nearest, ties to even. Double-conversion, as well as printf on Windows
and conversion functions in ECMAScript round to nearest, ties away from
zero.

The standard for printf says rounding is implementation-defined so
either way is technically correct.

Differential Revision: https://phabricator.services.mozilla.com/D102699
2021-01-28 04:56:57 +00:00
Mike Hommey c776e2a4de Bug 1686831 - Still apply fillers when no numbers are printed. r=Gankra
The standard for printf says that for integers, the result of converting
zero with an explicit precision of zero shall be no characters. But
flags and width still need to apply.

Differential Revision: https://phabricator.services.mozilla.com/D102696
2021-01-27 01:06:44 +00:00
Mike Hommey 4c520112c0 Bug 1686831 - Add support for %F and %G, and properly support %n$E. r=nika,Gankra
%F and %G are the same as %f and %g, but using caps for the exponent
indicator, and for "inf"/"nan" for infinity and NaN.

%n$E is the same as %E, but taking the nth argument.

Differential Revision: https://phabricator.services.mozilla.com/D102695
2021-01-27 01:06:22 +00:00
Doug Thayer c22b2b6c3f Bug 1687561 - Disable the skeleton UI permanently-ish if we crash during it r=mconley,emalysz
This will disable the skeleton UI if we crash while setting it up, and further
the error will propagate up and get reported via telemetry on the next run.
This is important because we don't have anything like the crash reporter set up
by the time we want to start showing the skeleton UI.

Differential Revision: https://phabricator.services.mozilla.com/D102355
2021-01-26 16:10:28 +00:00
Doug Thayer bfdaa1612c Bug 1686301 - Report errors in skeleton UI via telemetry r=mconley,emalysz
This is, for the most part, just a large refactor of the skeleton UI stuff to
support coarse-grained error reporting via telemetry. There are a few slight
changes in how we handle some errors. For example, if CreateWindow fails, we
will now bail out and report the failure. The flow for the happy path, however,
should remain unchanged.

Differential Revision: https://phabricator.services.mozilla.com/D102098
2021-01-26 16:10:20 +00:00
Emma Malysz 471404aa23 Bug 1686374, adjust margins if bookmarks toolbar is shown r=dthayer
Differential Revision: https://phabricator.services.mozilla.com/D101647
2021-01-22 20:59:21 +00:00
Emma Malysz c03e8de87c Bug 1686558, adjust tabbar and factor in the top border r=dthayer
Differential Revision: https://phabricator.services.mozilla.com/D101649
2021-01-19 06:12:11 +00:00
Molly Howell d625812205 Bug 1687038 - Disable the skeleton UI when the headless mode environment variable is set. r=dthayer
Differential Revision: https://phabricator.services.mozilla.com/D102040
2021-01-15 21:51:19 +00:00
Emma Malysz ba5a035505 Bug 1686373, adjust chrome content divider color for light theme and urlbar border color for Skeleton UI r=dthayer
Differential Revision: https://phabricator.services.mozilla.com/D101520
2021-01-15 17:04:17 +00:00
Toshihito Kikuchi 7545ed9378 Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell
This patch is to improve the way to detect an injected dependent module for
automatic DLL blocking (bug 1659438).

In the previous version, we created a list of dependent modules in the launcher
process and shared it with other processes via the shared section.  However, it
was not compatible with third-party applications who tamper the Import Table and
revert it in the injected module's DllMain (bug 1682834) because we parsed the
Import Table in the launcher process after it was reverted.

With this patch, we check the Import Table in `patched_NtMapViewOfSection`,
so we can see tampering before it's reverted.  More specifically, we create
a list of dependent modules in the browser process as below.

1. The launcher process creates a section object and initializes
   the kernel32.dll's functions in it.

2. The launcher process transfers a writable handle of the shared
   section to the browser process.

3. In the browser process, if an injected dependent module is being
   mapped by `NtMapViewOfSection`, we add its NT path to the shared
   section and block it with `REDIRECT_TO_NOOP_ENTRYPOINT`.

4. The `main` function of the browser process converts the writable
   handle of the shared section into a readonly handle.

5. The browser process transfers a readonly handle of the shared
   section to a sandbox process.

Since automatic DLL blocking may still cause a compat issue like bug 1682304,
we activate it only in Nightly for now.

Differential Revision: https://phabricator.services.mozilla.com/D101460
2021-01-13 15:13:18 +00:00
Brindusan Cristian 07342ce091 Backed out changeset a4bf5887fc2a (bug 1680402) for being the most likely cause of bug 1686387. a=backout 2021-01-13 06:30:08 +02:00
Paul Adenot b8fa268285 Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld
Differential Revision: https://phabricator.services.mozilla.com/D99138
2021-01-12 12:34:59 +00:00
Jeff Muizelaar b19b4aa8ba Bug 1680402. Use stderr in printf_stderr instead of reopening fd 2. r=glandium
Currently, printf_stderr doesn't show up when running with ./mach run.
This is because we run with -attach-console and that redirects stderr
to a different file descriptor using freopen in UseParentConsole.

The change from just using stderr directly happened in bug 340443 and was done
to avoid some linking issues. That problem doesn't seem to apply anymore so you'd
expect we'd be able to go back to the straightforward implemention that works even
if stderr has been redirected. Unforunately, Windows takes not buffering
stderr very seriously and fprintf will write out the results character
by character. This can cause log output lines to be intermixed which
breaks log parsing in CI. We keep using fdopen to create a new FILE*
that's buffered but instead of hard coding fd 2, we get the actual fd
that corresponds to stderr using fileno.

The mozglue implementation was cargo culted from xpcom, so we update it
as well.

Differential Revision: https://phabricator.services.mozilla.com/D98550
2021-01-12 14:54:48 +00:00
Mihai Alexandru Michis f12a97c159 Backed out 3 changesets (bug 1205985) for causing xpcshell failures in test_TelemetrySession.js
CLOSED TREE

Backed out changeset f82f5070bee5 (bug 1205985)
Backed out changeset 89b03879ce7d (bug 1205985)
Backed out changeset 9ba60febbcf8 (bug 1205985)
2021-01-11 13:44:23 +02:00
Paul Adenot 57e6014622 Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld
Differential Revision: https://phabricator.services.mozilla.com/D99138
2021-01-11 10:05:29 +00:00
Narcis Beleuzu 77844a7997 Backed out 2 changesets (bug 1681445) for causing Bug 1684265
Backed out changeset 3246c882a0da (bug 1681445)
Backed out changeset 38d0eb18ea7a (bug 1681445)
2020-12-28 18:41:59 +02:00
Masatoshi Kimura 05b71dcf6e Bug 1684110 - Stop using some 'A'-functions in mozglue/. r=mhowell
Depends on D100465

Differential Revision: https://phabricator.services.mozilla.com/D100466
2020-12-26 00:46:34 +00:00
Mike Hommey 4f4d6697ad Bug 1681445 - Add support for macOS in TimeStamp_posix.cpp. r=spohl
Now is already supported when CLOCK_MONOTONIC is supported, but
ComputeProcessUptime is not.  This shares the code with other BSDs, and
makes it look like the implementation in Timestamp_darwin.cpp.

Eventually, we'll remove the one from Timestamp_darwin.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D100069
2020-12-18 15:48:55 +00:00
Emma Malysz 3fa05e5db6 Bug 1671603: display skeleton ui elements in correct position when RTL is enabled r=dthayer
Stores the value of intl.uidirection in the registry

Differential Revision: https://phabricator.services.mozilla.com/D99559
2020-12-22 17:22:07 +00:00
Doug Thayer 42a30153d4 Bug 1678488 - Only show skeleton UI if autoselecting profile r=mossop
So this is an ugly solution, but it was the best I could come up with. We do
not want to show the skeleton UI if we're going to show the profile manager,
and we *will* show the profile manager if StartWithLastProfile=0 is under
[General] in profiles.ini. Accordingly the only ways to do the correct thing
here are to try to mirror edits that firefox makes to the profiles.ini file
to the registry, or to simply read the profiles.ini file ourselves. There are
many ways that profiles.ini could get out of sync with the registry if we
tried to mirror its state there, so going straight to the source of truth
seemed the best option.

There is one case which is still not covered here: if there is no profile for
our install marked as Default=1, then we will show the profile manager. This
should only be possible if the user manually edits their profiles.ini file,
however, and then it should resolve itself after one run, so I don't consider
it a significant enough problem to jump through all the hoops we would need
to jump through to solve it.

Depends on D98525

Differential Revision: https://phabricator.services.mozilla.com/D98936
2020-12-17 16:44:01 +00:00