Commit Graph
126 Commits
Author SHA1 Message Date
Sylvestre Ledru 6149f49299 Bug 2023419 - Remove Emacs/Vim modelines from xpcom/ r=emilio
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287878
2026-03-16 17:22:07 +00:00
serge-sans-paille 8a28ab1466 Bug 1992012 - Cleanup FloatingPoint.h inclusion r=emilio,media-playback-reviewers,firefox-svg-reviewers,layout-reviewers,dholbert,alwu
There was a lot of leftovers from previous code cleaning.

Also turn detail::FloatingPointTrait into FloatingPointTrait because
it's specialized in js/src/vm/Float16.h, which shows it's not an
internal API.

Differential Revision: https://phabricator.services.mozilla.com/D267467
2025-10-09 11:36:34 +00:00
Andi-Bogdan Postelnicu 011e3fc2d9 Bug 1660405 - Move away from mozilla::IsNaN in favor of std::isnan. r=nbp,media-playback-reviewers,sergesanspaille,padenot
Differential Revision: https://phabricator.services.mozilla.com/D173035
2023-03-22 11:35:33 +00:00
Stanca Serban 98c675ed3f Backed out 7 changesets (bug 1660405) for causing bustages on Linux x64 opt. CLOSED TREE
Backed out changeset ad1a5f59214f (bug 1660405)
Backed out changeset a39e95f0aafe (bug 1660405)
Backed out changeset 48629ee0d70d (bug 1660405)
Backed out changeset 8419b99aab60 (bug 1660405)
Backed out changeset 535cc12c8bed (bug 1660405)
Backed out changeset e27052da4927 (bug 1660405)
Backed out changeset 11b0f9cf8091 (bug 1660405)
2023-03-22 13:05:53 +02:00
Andi-Bogdan Postelnicu 5e0156c1e4 Bug 1660405 - Move away from mozilla::IsNaN in favor of std::isnan. r=nbp,media-playback-reviewers,sergesanspaille,padenot
Differential Revision: https://phabricator.services.mozilla.com/D173035
2023-03-22 09:27:56 +00:00
serge-sans-paille 3350ff1c54 Bug 1811934 - Have nsID::ToString() return an managed string instead of a raw pointer r=xpcom-reviewers,nika
And use nsID::ToProvidedString(...) method when suitable.

This naturally fixes a memory leak in dom/fetch/FetchParent.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D167606
2023-01-31 16:44:04 +00:00
Norisz Fay 1913a62811 Backed out changeset 7d4b830c1cf6 (bug 1811934) for causing wpt failures on pointerevent_pointerrawupdate_in_pointerlock.html CLOSED TREE 2023-01-31 21:44:59 +02:00
serge-sans-paille b77aa145fa Bug 1811934 - Have nsID::ToString() return an managed string instead of a raw pointer r=xpcom-reviewers,nika
And use nsID::ToProvidedString(...) method when suitable.

This naturally fixes a memory leak in dom/fetch/FetchParent.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D167606
2023-01-31 16:44:04 +00:00
Andrew McCreight 291afe14f4 Bug 1792574, part 3 - Don't include nsMemory where it isn't needed. r=xpcom-reviewers,necko-reviewers,valentin,nika
There are only 3 places where nsMemory.h is still needed (image/RasterImage.cpp,
gfx/thebes/gfxFT2FontList.cpp, and nsMemory.cpp). Remove the rest.

Differential Revision: https://phabricator.services.mozilla.com/D158213
2022-09-28 15:17:46 +00:00
Andrew McCreight 0b3e4869bf Bug 1751102, part 5 - Make NaN falsy. r=xpcom-reviewers,nika
The existing code treats all non-0.0 values as true, but in
Javascript NaN is also falsy, so let's just do that here.

Differential Revision: https://phabricator.services.mozilla.com/D137101
2022-02-03 00:45:08 +00:00
Andrew McCreight e13dba5c59 Bug 1751102, part 4 - Make VTYPE_CHAR and _WCHAR act like normal int conversion. r=xpcom-reviewers,nika
This is probably less bad than what it is doing. I think the only
difference is that for doubles we won't just do a straight cast,
but will instead do some bounds checking. Thanks to the prior patch,
it will also produce an error for NaN. This might make us start to
fail if you try to convert, say, 3.3 to a char but hopefully that
doesn't matter.

Differential Revision: https://phabricator.services.mozilla.com/D137100
2022-02-03 00:45:08 +00:00
Andrew McCreight e3cd06b90f Bug 1751102, part 3 - Produce an error when converting NaN to an int. r=xpcom-reviewers,nika
Doing a direct cast produces an error in UBSan.

Differential Revision: https://phabricator.services.mozilla.com/D137099
2022-02-03 00:45:07 +00:00
Andrew McCreight 635f7874f6 Bug 1751102, part 2 - Add parens around min_ and max_ macro args. r=xpcom-reviewers,nika
Also add some braces around multi-line ifs.

Differential Revision: https://phabricator.services.mozilla.com/D137154
2022-02-03 00:45:07 +00:00
Andrew McCreight e911eff3d9 Bug 1751102, part 1 - Fix nsVariant typos and remove unused macro. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D137098
2022-02-03 00:45:07 +00:00
Csoregi Natalia 2c8ada957e Backed out 6 changesets (bug 1751102) for causing bustage on TestVariant.cpp. CLOSED TREE
Backed out changeset 6a33352c8299 (bug 1751102)
Backed out changeset 23d247518d1b (bug 1751102)
Backed out changeset f0f278354f00 (bug 1751102)
Backed out changeset 63ccb3fe2db5 (bug 1751102)
Backed out changeset a5269aefd257 (bug 1751102)
Backed out changeset f09eeaeec834 (bug 1751102)
2022-02-03 01:39:57 +02:00
Andrew McCreight fbaf398ef7 Bug 1751102, part 5 - Make NaN falsy. r=xpcom-reviewers,nika
The existing code treats all non-0.0 values as true, but in
Javascript NaN is also falsy, so let's just do that here.

Differential Revision: https://phabricator.services.mozilla.com/D137101
2022-02-02 21:26:54 +00:00
Andrew McCreight 9678555456 Bug 1751102, part 4 - Make VTYPE_CHAR and _WCHAR act like normal int conversion. r=xpcom-reviewers,nika
This is probably less bad than what it is doing. I think the only
difference is that for doubles we won't just do a straight cast,
but will instead do some bounds checking. Thanks to the prior patch,
it will also produce an error for NaN. This might make us start to
fail if you try to convert, say, 3.3 to a char but hopefully that
doesn't matter.

Differential Revision: https://phabricator.services.mozilla.com/D137100
2022-02-02 21:26:54 +00:00
Andrew McCreight d7d2ded116 Bug 1751102, part 3 - Produce an error when converting NaN to an int. r=xpcom-reviewers,nika
Doing a direct cast produces an error in UBSan.

Differential Revision: https://phabricator.services.mozilla.com/D137099
2022-02-02 21:26:53 +00:00
Andrew McCreight 70d04bca89 Bug 1751102, part 2 - Add parens around min_ and max_ macro args. r=xpcom-reviewers,nika
Also add some braces around multi-line ifs.

Differential Revision: https://phabricator.services.mozilla.com/D137154
2022-02-02 21:26:53 +00:00
Andrew McCreight bcbdf5adfc Bug 1751102, part 1 - Fix nsVariant typos and remove unused macro. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D137098
2022-02-02 21:26:53 +00:00
Chris H-C d3c71eac50 Bug 1651210 - uint variant values should convert over as uints, not ints r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D82891
2020-07-09 13:02:29 +00:00
Nicklas Boman 72b2085951 Bug 1515419 - fixing ToNewCString (and ToNewUnicode as well) xpcom/string/nsReadableUtils.cpp r=froydnj,necko-reviewers,valentin
Differential Revision: https://phabricator.services.mozilla.com/D17411
2020-05-17 06:58:48 +00:00
Chris Peterson 0a9155f83b Bug 1570499 - Part 1: Replace MOZ_FALLTHROUGH macro with C++17's [[fallthrough]] attribute. r=froydnj
This changeset is a simple find and replace of `MOZ_FALLTHROUGH` and `[[fallthrough]]`.

Unfortunately, the MOZ_FALLTHROUGH_ASSERT macro (to assert on case fallthrough in debug builds) is still necessary after switching from [[clang::fallthrough]] to [[fallthrough]] because:

* MOZ_ASSERT(false) followed by [[fallthrough]] triggers a -Wunreachable-code warning in DEBUG builds
* but MOZ_ASSERT(false) without [[fallthrough]] triggers a -Wimplicit-fallthrough warning in NDEBUG builds.

Differential Revision: https://phabricator.services.mozilla.com/D56440
2019-12-20 07:16:43 +00:00
Nicklas Boman 97fd179331 Bug 1122740 - remove useless null checks after allocating memory with |new| r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D33445
2019-06-04 04:43:11 +00:00
Sylvestre Ledru e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Boris Zbarsky 951cf5c0c5 Bug 1507540 part 6. Make nsIVariant's "type" a notxpcom attribute. r=froydnj 2018-11-19 20:20:05 -05:00
Nicholas Nethercote 95b6af20be Bug 1489047 - Remove C++ support for, and testing of, the XPIDL DOMString type. r=nika 2018-09-06 18:03:18 +10:00
Nicholas Nethercote 65c1741f3a Bug 1486690 - Rename nsMemory::Clone() and remove unnecessary checks after it. r=glandium
The 'x' in the new name makes it clearer that it's infallible.
2018-08-28 15:59:19 +10:00
Nicholas Nethercote beb45f5f20 Bug 1486690 - Rename NS_str{,}dup and remove unnecessary checks after calls to them. r=glandium
The 'x' prefix makes it clearer that these are infallible.

A couple of nsJSID methods are now also infallible.
2018-08-28 15:58:54 +10:00
Nicholas Nethercote cd127441a0 Bug 1486690 - Remove unnecessary checks after moz_xmalloc() calls. r=glandium
There are surprisingly many of them.

(Plus a couple of unnecessary checks after `new` calls that were nearby.)
2018-08-28 15:56:01 +10:00
Henri Sivonen 7067da0717 Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj.
Correctness improvements:

 * UTF errors are handled safely per spec instead of dangerously truncating
   strings.

 * There are fewer converter implementations.

Performance improvements:

 * The old code did exact buffer length math, which meant doing UTF math twice
   on each input string (once for length calculation and another time for
   conversion). Exact length math is more complicated when handling errors
   properly, which the old code didn't do. The new code does UTF math on the
   string content only once (when converting) but risks allocating more than
   once. There are heuristics in place to lower the probability of
   reallocation in cases where the double math avoidance isn't enough of a
   saving to absorb an allocation and memcpy.

 * Previously, in UTF-16 <-> UTF-8 conversions, an ASCII prefix was optimized
   but a single non-ASCII code point pessimized the rest of the string. The
   new code tries to get back on the fast ASCII path.

 * UTF-16 to Latin1 conversion guarantees less about handling of out-of-range
   input to eliminate an operation from the inner loop on x86/x86_64.

 * When assigning to a pre-existing string, the new code tries to reuse the
   old buffer instead of first releasing the old buffer and then allocating a
   new one.

 * When reallocating from the new code, the memcpy covers only the data that
   is part of the logical length of the old string instead of memcpying the
   whole capacity. (For old callers old excess memcpy behavior is preserved
   due to bogus callers. See bug 1472113.)

 * UTF-8 strings in XPConnect that are in the Latin1 range are passed to
   SpiderMonkey as Latin1.

New features:

 * Conversion between UTF-8 and Latin1 is added in order to enable faster
   future interop between Rust code (or otherwise UTF-8-using code) and text
   node and SpiderMonkey code that uses Latin1.

MozReview-Commit-ID: JaJuExfILM9
2018-08-14 14:43:42 +03:00
Nika Layzell 24c85e7bea Bug 1478820 - Stop manually synchronizing VTYPE_ and nsXPTTypeTag, r=erahm
Reviewers: erahm!

Tags: #secure-revision

Bug #: 1478820

Differential Revision: https://phabricator.services.mozilla.com/D2449
2018-07-26 18:15:27 -04:00
Brindusan Cristian 5eb135b0a8 Backed out 15 changesets (bug 1475409, bug 1461450, bug 1474369, bug 1471726) for build bustages on xptcstubs_gcc_x86_unix.cpp:55:1. CLOSED TREE
Backed out changeset 79dbf5b9d8db (bug 1474369)
Backed out changeset 7e2e13953e19 (bug 1474369)
Backed out changeset 9d0b9a4c4651 (bug 1474369)
Backed out changeset 9f14f7b8bc3d (bug 1475409)
Backed out changeset bddd838d1910 (bug 1475409)
Backed out changeset 850f21ca1f45 (bug 1475409)
Backed out changeset 320802ab02e3 (bug 1474369)
Backed out changeset db67bf0e7f91 (bug 1474369)
Backed out changeset f355d9be9912 (bug 1474369)
Backed out changeset e1b6a5f74642 (bug 1474369)
Backed out changeset 459635cdfc08 (bug 1474369)
Backed out changeset 44414b1cd32e (bug 1461450)
Backed out changeset a5d04cf5d67f (bug 1461450)
Backed out changeset 40885fbf99c6 (bug 1471726)
Backed out changeset da79e75b9cb3 (bug 1471726)
2018-07-25 22:57:09 +03:00
Nika Layzell 05c5ac3d5f Bug 1474369 - Part 7: Rename [array] to LegacyArray within xpt and xpidl, r=mccr8
Summary:
This is done so we can use Array as the name for the new nsTArray-based
type, rather than having to come up with a new name.

LegacyArray was chosen as the [array] attribute is now effectively deprecated,
and we'd like to remove it ASAP.

Depends On D2334

Reviewers: mccr8!

Tags: #secure-revision

Bug #: 1474369

Differential Revision: https://phabricator.services.mozilla.com/D2335
2018-07-25 15:38:02 -04:00
Nika Layzell ba9dee0590 Bug 1444745 - Part 5: Update consumers of nsIInterfaceInfo to use the nsXPTInterfaceInfo directly, r=mccr8
Due to the decision to keep the old API on nsXPTInterfaceInfo in part 4, this is
a fairly straightforward patch.

1. I had to change a couple of consumers of `IsRetval()` due to the movement of
that flag.
2. I changed all code which held a nsIInterfaceInfo to hold an `const
nsXPTInterfaceInfo*` instead.
3. I changed code which used the nsIInterfaceInfoManager to instead call the
static methods on nsXPTInterfaceInfo.
2018-04-17 19:20:56 -04:00
Nicholas Nethercote dc0d454657 Bug 1409227 (part 4) - Replace nsMemory::Clone(id, sizeof(nsID)) with nsID::Clone(id). r=mccr8.
This change requires introducing nsID::Clone(). Because it's infallible, the
patch also removes some redundant failure-handling code. (nsMemory::Clone() is
also infallible, so this code was redundant even before this change.)
2017-10-18 10:39:20 +11:00
Nicholas Nethercote 59440727ef Bug 1409227 (part 2) - Replace nsMemory::Clone(s, strlen(s)+1) with moz_xstrdup(s). r=erahm.
They are equivalent -- both infallible, both requiring measuring the length of
the string -- but moz_xstrdup is much more readable. (One place deals with
16-bit strings and so uses NS_strdup instead, which is also infallible.)

The patch also removes some failure-path code that will never execute due to
the infallibility.
2017-10-17 13:09:29 +11:00
Tom Tromey 6e5dbe5ed5 Bug 1334318 - remove last uses of PR_smprintf; r=froydnj
This removes the last uses of PR_smprintf from the tree (excluding the
security and nsprpub directories).  It also fixes a related latent bug
in nsAppRunner.cpp (which was incorrectly freeing the pointer passed to
PR_SetEnv).

MozReview-Commit-ID: GynP2PhuWWO
2017-04-28 10:13:26 -06:00
Thomas Wisniewski 2f1accbc40 Bug 1305202 - Use NullString() more and remove superfluous Truncates(). r=smaug 2016-09-23 21:10:01 -04:00
Nicholas Nethercote 9237825cda Bug 1268772 (part 2) - Make infallible nsVariant methods return |void| instead of |nsresult|. r=erahm.
This makes things clearer and removes some unnecessary nsresult checks.

The patch also:
- removes some unnecessary |new| and moz_xmalloc() checks;
- adds MOZ_MUST_USE to some fallible nsVariant methods.
2016-04-29 13:47:44 +10:00
Chris Peterson e9307b2d8e Bug 1220035 - Fix -Wimplicit-fallthrough warnings in xpcom. r=mccr8
xpcom/base/nsDebugImpl.cpp:458:5 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
xpcom/ds/nsCheapSets.h:139:5 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
xpcom/ds/nsPersistentProperties.cpp:232:9 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
xpcom/ds/nsVariant.cpp:360:5 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
xpcom/ds/nsVariant.cpp:766:5 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
xpcom/ds/nsVariant.cpp:1658:9 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
xpcom/ds/nsVariant.cpp:1661:5 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
xpcom/glue/nsTextFormatter.cpp:355:5 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
xpcom/glue/nsTextFormatter.cpp:362:5 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
xpcom/io/nsWildCard.cpp:85:7 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
xpcom/io/nsWildCard.cpp:401:7 [-Wimplicit-fallthrough] unannotated fall-through between switch labels
2015-10-29 21:31:32 -07:00
Andrew McCreight 15ee03ca3e Bug 931283, part 3 - Implement a cycle collected version of nsVariant. r=froydnj
Also, use this class for the component manager etc. in XPCOM.
2015-10-09 10:24:23 -07:00
Andrew McCreight dedc925355 Bug 931283, part 2 - Split out nsVariant into a subclass. r=froydnj 2015-10-09 10:24:23 -07:00
Andrew McCreight 9c95fbb016 Bug 931283, part 1 - Rename nsVariant to nsVariantBase. r=froydnj
Leave a typedef for compatibility. nsVariant will be defined as a
separate class in the next patch.

Also, remove an obsolete comment and fix some whitespace.
2015-10-09 10:24:23 -07:00
Chris Peterson db45e51be4 Bug 1204403 - Fix -Wshadow warnings in xpcom. r=mccr8 2015-09-07 23:56:16 -07:00
Birunthan Mohanathas a0f7c73250 Bug 1191100 - Remove XPIDL signature comments in .cpp files. r=ehsan
Comment-only so DONTBUILD.
2015-08-04 16:17:36 -07:00
Andrew McCreight cfa9f363ea Bug 931571, part 15 - Remove extra spaces in nsVariant macros. r=froydnj 2015-07-23 12:28:30 -07:00
Andrew McCreight 0e454c63e4 Bug 931571, part 13 - Add a destructor for nsDiscriminatedUnion. r=froydnj
The existing nsDiscriminateUnions either always call Cleanup() when they
are about to go away, or they only handle scalar values so it is safe to
call Cleanup() on them without worrying about another discriminated union
having taken over any memory owned by this union.
2015-07-23 12:28:30 -07:00
Andrew McCreight af213613b5 Bug 931571, part 12 - Add nsDiscriminatedUnion::GetType(). r=froydnj
This is not quite enough to make the data members private because
XPCVariant pokes around to do some JS array stuff.
2015-07-23 12:28:30 -07:00
Andrew McCreight 8ba2a001cb Bug 931571, part 11 - Turn nsDiscriminatedUnion's Traverse function into a method. r=froydnj 2015-07-23 12:28:30 -07:00