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

192 Коммитов

Автор SHA1 Сообщение Дата
Joel Maher 009710fe6f Bug 1869430 - Batch 19.2 convert python unittest .ini -> .toml. r=gbrown,taskgraph-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D196124
2023-12-12 17:40:03 +00:00
Sylvestre Ledru 20eddd44eb Bug 1866480 - Fix redundant_static_lifetimes some rust generated code r=xpcom-reviewers,emilio
Depends on D194527

Differential Revision: https://phabricator.services.mozilla.com/D194627
2023-11-24 13:54:56 +00:00
Logan Rosen f024d94b2b Bug 1786490 - reformat the tree using black 23.3.0 r=sylvestre,webdriver-reviewers,taskgraph-reviewers,whimboo,jmaher,ahal,perftest-reviewers,geckoview-reviewers,afinder,m_kato
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D186092
2023-09-06 16:14:30 +00:00
Nika Layzell 5c7b57345b Bug 1843568 - Part 2: Validate that rust_sync interfaces have threadsafe refcounts in c++, r=xpcom-reviewers,barret
This adds c++-side assertions to annotated interfaces, requiring them to use a
threadsafe reference count. This ended up being quite gross due to interface
table entries making it difficult to add a `static_assert` into the code, so it
ended up being done through a constexpr constant which validates before
returning the IID.

Differential Revision: https://phabricator.services.mozilla.com/D183591
2023-07-20 17:39:03 +00:00
Nika Layzell 166ac8f00a Bug 1843568 - Part 1: Add a `rust_sync` attribute to XPIDL, r=xpcom-reviewers,barret
This attribute indicates that all implementations of the interface must
implement the `Sync` trait in Rust, meaning that they're safe to share between
threads. This will make storing these values in threadsafe types in Rust more
ergonomic.

To implement this, the vtable types were changed to be `&'static` references
rather than raw pointers. This should be OK as they are always valid non-null
pointers to the VTable, and avoids the need for manual `unsafe impl`s for the
relevant interfaces.

Other interfaces will remain non-send and non-sync due to the marker type.

Differential Revision: https://phabricator.services.mozilla.com/D183590
2023-07-20 17:39:03 +00:00
Noemi Erli ec441901f7 Backed out 5 changesets (bug 1843568) for causing xpc failures in test_extension_permissions_migration.js CLOSED TREE
Backed out changeset a4cb1e2b9e3d (bug 1843568)
Backed out changeset 26047645c009 (bug 1843568)
Backed out changeset 50d6b858ee6e (bug 1843568)
Backed out changeset 3597df96ba38 (bug 1843568)
Backed out changeset 8faeb75f1161 (bug 1843568)
2023-07-19 22:54:13 +03:00
Nika Layzell 605f1ce526 Bug 1843568 - Part 2: Validate that rust_sync interfaces have threadsafe refcounts in c++, r=xpcom-reviewers,barret
This adds c++-side assertions to annotated interfaces, requiring them to use a
threadsafe reference count. This ended up being quite gross due to interface
table entries making it difficult to add a `static_assert` into the code, so it
ended up being done through a constexpr constant which validates before
returning the IID.

Differential Revision: https://phabricator.services.mozilla.com/D183591
2023-07-19 18:03:45 +00:00
Nika Layzell 7a7503c291 Bug 1843568 - Part 1: Add a `rust_sync` attribute to XPIDL, r=xpcom-reviewers,barret
This attribute indicates that all implementations of the interface must
implement the `Sync` trait in Rust, meaning that they're safe to share between
threads. This will make storing these values in threadsafe types in Rust more
ergonomic.

To implement this, the vtable types were changed to be `&'static` references
rather than raw pointers. This should be OK as they are always valid non-null
pointers to the VTable, and avoids the need for manual `unsafe impl`s for the
relevant interfaces.

Other interfaces will remain non-send and non-sync due to the marker type.

Differential Revision: https://phabricator.services.mozilla.com/D183590
2023-07-19 18:03:45 +00:00
Nika Layzell cc821ef894 Bug 1843571 - Expose CEnum variants in rust, r=emilio
These are exposed as simple associated constants, similar to how they're
exposed in JS. We cannot use rust enums, as they have limited value
requirements, and `cenum` types are treated as arbitrary integers.

Differential Revision: https://phabricator.services.mozilla.com/D183587
2023-07-17 20:21:53 +00:00
Mike Hommey db029aba32 Bug 1831467 - Avoid more UB from transmuting a ref to a ref with interior mutability. r=emilio
aka one specific change in LLVM 16 introducing UB in Rust, take 3? 4?

This time, we have multiple types like:
  #[xpcom(implement(nsISomething))]
  struct Foo {
      foo: RefCell<Something>,
  }

  impl Foo {
      fn from_interface(obj: &nsISomething) -> &Self {
          unsafe { ::std::mem::transmute(obj) }
      }
  }

At first glance, this looks innocuous. But the problem is that
nsISomething, as far as LLVM is informed by Rust, is readonly,
but Foo, via the RefCell, has interious mutability.

LLVM ends up assuming that any mutability that happens to that returned
&Foo can't happen, and removes it.

This is yet another case where https://github.com/rust-lang/rust/issues/111229
would save our feet from this footgun LLVM 16 added and that the rust
compiler doesn't help us prevent the least.

Differential Revision: https://phabricator.services.mozilla.com/D183569
2023-07-14 08:34:43 +00:00
Andrew Halberstadt 577c4dacfe Bug 1811850 - [lint] Fix ruff errors resulting from new configuration, r=webdriver-reviewers,perftest-reviewers,whimboo,sparky,firefox-build-system-reviewers,ahochheiden
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D172359
2023-03-20 13:06:28 +00:00
Cristian Tuns c1b52fd95e Backed out 5 changesets (bug 1811850) for causing linting bustages(bugzilla) CLOSED TREE
Backed out changeset e8fcfc7f8108 (bug 1811850)
Backed out changeset f8950d716c9e (bug 1811850)
Backed out changeset f650123cc188 (bug 1811850)
Backed out changeset d96f90c2c58b (bug 1811850)
Backed out changeset c3b0f9666183 (bug 1811850)
2023-03-16 22:16:30 -04:00
Andrew Halberstadt d93be6a402 Bug 1811850 - [lint] Fix ruff errors resulting from new configuration, r=webdriver-reviewers,perftest-reviewers,whimboo,sparky,firefox-build-system-reviewers,ahochheiden
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D172359
2023-03-17 01:54:00 +00:00
Kagami Sascha Rosylight 0b2130674e Bug 1788986 - Part 4: Add a counter for nsIFile r=xpcom-reviewers,nika,barret,janv
This adds `count` out parameter for recursive file remove calls to report the number of the removed entries.

  Having a lot of files removed by `::Remove(recursive=true)` has been a problem, as a slow disk can cause a hang with such call. A counter feature will help us knowing the situation better via telemetry.

  The use of out parameter here is to mark it optional and prevent unwanted changes in existing callers (because a return value can't be optional).

Differential Revision: https://phabricator.services.mozilla.com/D156940
2023-02-06 11:32:48 +00:00
Iulian Moraru 0caa2f1940 Backed out 3 changesets (bug 1788986) for causing xpcshell failures on test_backgroundtask_removeDirectory.js. CLOSED TREE
Backed out changeset d288a5d5cc3d (bug 1788986)
Backed out changeset 7f30102942bc (bug 1788986)
Backed out changeset 8c8026379e91 (bug 1788986)
2023-02-02 20:58:26 +02:00
Kagami Sascha Rosylight 8fb81ed249 Bug 1788986 - Part 4: Add a counter for nsIFile r=xpcom-reviewers,nika,barret,janv
This adds `count` out parameter for recursive file remove calls to report the number of the removed entries.

  Having a lot of files removed by `::Remove(recursive=true)` has been a problem, as a slow disk can cause a hang with such call. A counter feature will help us knowing the situation better via telemetry.

  The use of out parameter here is to mark it optional and prevent unwanted changes in existing callers (because a return value can't be optional).

Differential Revision: https://phabricator.services.mozilla.com/D156940
2023-02-02 15:23:47 +00:00
Andrew McCreight 6f4aa4f64f Bug 1681586 - Remove include guard around XPIDL compiler includes. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D168318
2023-01-31 20:42:22 +00:00
Marco Castelluccio f69e697461 Bug 1801836 - Remove no longer necessary 'from __future__' imports. r=linter-reviewers,glandium,webdriver-reviewers,perftest-reviewers,geckoview-reviewers,jld,ahal,owlish,afinder DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D165395
2022-12-23 22:45:46 +00:00
Marco Castelluccio 2784a97322 Bug 1790816 - Reformat xpcom/ with isort. r=mccr8 DONTBUILD
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D162640
2022-11-22 13:37:48 +00:00
Marco Castelluccio 2cb1a1b750 Bug 1758419 - Remove comment in xpidl.py mentioning Python 2 support as Searchfox is now using Python 3. r=mccr8 DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D162675
2022-11-22 08:10:46 +00:00
Andrew McCreight 45ed572852 Bug 1799982 - Remove uses of inline flags from XPIDL regexps. r=xpcom-reviewers,kmag
Apparently the use of these is being turned into an error in Python 3.11.
Fortunately, our uses appears to be rather trivial.

For t_multilinecomment and t_LCDATA, I dropped the (?s) flag and just
replaced the one use of . with (\n|.). (?s) means DOTALL, which means
that dot includes any character, including a newline. Otherwise it means
dot includes any character except a newline.

I took the new t_singlelinecomment from IPDL's parser.py, so I assume
it is reasonable enough. t_multilinecomment is also now the same as
in IPDL.

Differential Revision: https://phabricator.services.mozilla.com/D161738
2022-11-10 20:16:52 +00:00
Andrew McCreight ba8af7f4fa Bug 1792920, part 4 - Add special handling for MozExternalRefCountType to XPIDL. r=nika
In XPIDL, the return type of AddRef and Release are nsrefcnt, which
is defined as unsigned long. The first problem is that nsrefcnt is
defined in XPIDL as unsigned long, but in C++ as uintptr_t. The second
problem is that the actual return type of these methods in C++ is
MozExternalRefCountType.

This patch fixes the return type of these methods in XPIDL. However,
due to MSCOM compatibility requirements this type is not expressible
in XPIDL, so I added it as a new builtin type to XPIDL. In C++, it
defers to the typedef and for Rust it uses u32 directly. I tried
using the new Rust typedef I defined in refptr.rs, but it seemed like
it was being used in places that didn't have refptr.rs available.

I also deleted the incorrect definition of nsrefcnt in XPIDL. It is
not used anywhere else in XPIDL files, and my previous patches removed
all uses of this type definition from Rust.

Note that this patch does not really change nsISupports.h,
because this part of the file is ignored via an #if 0. However, this
patch does clear the way for further work to start using the auto
generated nsISupports.h instead of nsISupportsBase.h.

Differential Revision: https://phabricator.services.mozilla.com/D159323
2022-10-17 16:09:21 +00:00
Andrew McCreight 64a41edf66 Bug 1795102, part 4 - Add iid_is checking. r=nika
Check that iid_is refers to a parameter, is an nsIID, and has compatible
input-ness.

Make attr_param_idx in jsonxpt.py assert if the expected parameter
is missing, rather than silently ignoring the attribute.

Differential Revision: https://phabricator.services.mozilla.com/D159319
2022-10-13 23:41:14 +00:00
Andrew McCreight 5b6d7aabe4 Bug 1795102, part 3 - Check that size_is parameter input-ness matches. r=nika
If I remembered anything from my logic programming days, I could
come up a smarter sounding word for this than "input-ness".

Differential Revision: https://phabricator.services.mozilla.com/D159318
2022-10-13 23:41:14 +00:00
Andrew McCreight 27bac104c6 Bug 1795102, part 2 - Make size_is checking use NameMap. r=nika
This also changes the location from the location of the method to the
parameter which seems better.

Make the other error message use p.location, and change the error
message to say "size_is" instead of "is_size".

Differential Revision: https://phabricator.services.mozilla.com/D159317
2022-10-13 23:41:13 +00:00
Andrew McCreight b7c03f1335 Bug 1795102, part 1 - Fix some miscellaneous bugs for XPIDL front end errors. r=nika
Fix the error message for NameMap::get().

Use the location of the identifier in p_param. It was passing in
something that didn't return a valid location, causing bad error messages.
I'm guessing a new thing got added to this production rule without
adjusting the index.

Differential Revision: https://phabricator.services.mozilla.com/D159316
2022-10-13 23:41:13 +00:00
Andrew McCreight 2cd50a83f1 Bug 1792356, part 2 - Non-scriptable interfaces don't need to be marked [builtinclass]. r=xpcom-reviewers,nika
If an interface isn't scriptable, then it is invisible to script, so it
can't be implemented by it.

Differential Revision: https://phabricator.services.mozilla.com/D158137
2022-10-13 21:06:44 +00:00
Andrew McCreight f0ce4cf5ac Bug 1792356, part 1 - [noscript] on XPIDL interfaces doesn't do anything. r=xpcom-reviewers,necko-reviewers,nika,kershaw
The [noscript] attribute does nothing on XPIDL interfaces, so make it
invalid so people don't think something might be affected if they set it.

Differential Revision: https://phabricator.services.mozilla.com/D158136
2022-10-13 21:06:44 +00:00
Andrew McCreight c2665040be Bug 1792357, part 1 - [infallible] is okay if the interface isn't scriptable. r=xpcom-reviewers,nika
If it isn't scriptable, it can't be implemented by JS, even
if it isn't marked [builtinclass].

Differential Revision: https://phabricator.services.mozilla.com/D158134
2022-09-27 18:31:50 +00:00
Nika Layzell 706cf2f2fa Bug 1782765 - Fix nullability of arrays of interfaces in Rust, r=xpcom-reviewers,necko-reviewers,mccr8,valentin
When generating code for arrays of interfaces from the rust-xpidl
compiler, the type was declared incorrectly as ThinVec<RefPtr<T>>
instead of ThinVec<Option<RefPtr<T>>> meaning that null values in the
array would be handled incorrectly.

This patch fixes this code generation mistake and updates crates using
the interface to handle null values correctly.

Differential Revision: https://phabricator.services.mozilla.com/D153485
2022-08-11 17:53:48 +00:00
Nika Layzell c1e984d0c6 Bug 1779326 - Handle a few more `native` types in rust-xpidl, r=xpcom-reviewers,kmag
This makes the logic for the rust type line up a bit more with the C++
logic for existing types, and adds support for 'char' and 'char16_t'
native types (for 'charPtr').

This specifically enables `nsIInputStream::Read` to be used from Rust.

Differential Revision: https://phabricator.services.mozilla.com/D152715
2022-07-27 14:09:52 +00:00
Butkovits Atila 99f074b50f Backed out changeset d4dae48f386a (bug 1779326) for causing build bustages. CLOSED TREE 2022-07-27 02:28:37 +03:00
Nika Layzell 155b049ad5 Bug 1779326 - Handle a few more `native` types in rust-xpidl, r=xpcom-reviewers,kmag
This makes the logic for the rust type line up a bit more with the C++
logic for existing types, and adds support for 'char' and 'char16_t'
native types (for 'charPtr').

This specifically enables `nsIInputStream::Read` to be used from Rust.

Differential Revision: https://phabricator.services.mozilla.com/D152715
2022-07-26 23:12:58 +00:00
Nika Layzell 7ced96212e Bug 1778211 - Reject xpidl CDATA containing 'virtual', r=xpcom-reviewers,necko-reviewers,mccr8,dragana
We'll probably want to do something more accurate in the future with a
custom clang static analysis pass which validates that XPIDL interfaces
have the expected vtable and struct layout, however doing so would be
more involved than the string matching done in this patch.

In addition to checking for extra virtual methods, we'll likely also
want to check for data members on interfaces, and reject them unless the
class is marked as `[builtinclass]` in addition to some other attribute
which we'll need to add to prevent them from being implemented in Rust
(as c++ data members will not be reflected by the rust macro).

There were 2 instances of a comment which contained the word 'virtual'
within a CDATA block. These comments were moved out of the CDATA block
to avoid triggering the error.

Differential Revision: https://phabricator.services.mozilla.com/D151068
2022-07-06 14:53:06 +00:00
Ryan VanderMeulen 78ab363cf5 Bug 1738054 - Remove obsolete "skip-if = python == 2" keys from testing manifests and re-enable some skipped tests which now pass. r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D149573
2022-06-21 01:46:44 +00:00
Kagami Sascha Rosylight 2093ec97cf Bug 1769290 - Part 3: Use fully qualified JS types in xpidl r=xpcom-reviewers,mccr8
Depends on D146439

Differential Revision: https://phabricator.services.mozilla.com/D146453
2022-05-16 17:20:30 +00:00
Molnar Sandor 9d544b1925 Backed out changeset 9cc08c2f20be (bug 239460) for causing build bustage. CLOSED TREE 2022-04-07 03:02:28 +03:00
Nika Layzell 2b2d7891c1 Bug 239460 - Specify types for XPIDL consts in C++, r=xpcom-reviewers,mccr8
Before this change, all XPIDL constants were declared using an anonymous
`enum` rather than using a static constant. This change makes the
generated code more consistent with what is done in languages like Rust.

Some small changes were needed due to signed/unsigned comparison
warnings which were previously silent.

Differential Revision: https://phabricator.services.mozilla.com/D143090
2022-04-06 23:40:47 +00:00
Nika Layzell aa59bfed6b Bug 1748718 - Part 2: Use the specified type for rust xpidl constants, r=emilio
Previously all xpidl constants were specified as `i64` which means they require
casts before being passed to any xpcom methods. The lack of typing was not an
issue in c++ due to implicit casts from enums to integer types, but using the
correct type is much more valuable in Rust.

Differential Revision: https://phabricator.services.mozilla.com/D135165
2022-01-07 20:35:15 +00:00
Nika Layzell fed16696c3 Bug 1748718 - Part 1: Allow 64-bit integer constant types in xpidl, r=mccr8
The constants must fit within an int32_t or uint32_t as that is required by the
JS backend with xpt types holding a `uint32_t` and signed bit.

Differential Revision: https://phabricator.services.mozilla.com/D135164
2022-01-07 20:35:14 +00:00
Sylvestre Ledru 70be2344fc Bug 1707591 - ride along - reformat the tree with black 21.10b0 r=ahal,webdriver-reviewers,perftest-reviewers,whimboo,gerard-majax,alexandru.irimovici
This changed with this:
https://github.com/psf/black/pull/1740

Depends on D130964

Differential Revision: https://phabricator.services.mozilla.com/D130965
2021-11-22 22:10:03 +00:00
Iulian Moraru 897bb9d353 Backed out 2 changesets (bug 1707591) for causing python mozlint failures on test_yaml.py. CLOSED TREE
Backed out changeset a730ab2d0dbe (bug 1707591)
Backed out changeset 0269849fd7ef (bug 1707591)
2021-11-12 18:44:36 +02:00
Sylvestre Ledru c1b5edd8be Bug 1707591 - ride along - reformat the tree with black 21.10b0 r=webdriver-reviewers,whimboo,gerard-majax
This changed with this:
https://github.com/psf/black/pull/1740

Differential Revision: https://phabricator.services.mozilla.com/D130965
2021-11-12 15:06:56 +00:00
Andrey Bienkowski 888618300d Bug 1714376 - Replace a number of "exception.message" usages. r=mhentges,jgraham
Differential Revision: https://phabricator.services.mozilla.com/D116723
2021-06-08 15:50:10 +00:00
Dorel Luca f021feb29f Backed out changeset 68f73772f51e (bug 1714376) for Xpcom failures in builds/worker/checkouts/gecko/xpcom/idl-parser/xpidl/runtests.py. CLOSED TREE 2021-06-04 02:19:33 +03:00
Andrey Bienkowski a7a4542e20 Bug 1714376 - Replace a number of "exception.message" usages. r=mhentges,jgraham
Differential Revision: https://phabricator.services.mozilla.com/D116723
2021-06-03 20:08:51 +00:00
nirmay 8d472bb024 Bug 1647259 - Replace unsubscriptable value 'list' with 'attlist' r=nika
Differential Revision: https://phabricator.services.mozilla.com/D103261
2021-02-01 15:57:44 +00:00
Mats Palmgren b41a2b9d21 Bug 1687239 part 2 - Remove plugin support from layout/. r=emilio
Note that there's still a little plugin related code in
widget/ and gfx/ etc after this.  That can be removed
once we remove plugin support from dom/ etc.
The removal from layout/ should be pretty complete though.

Differential Revision: https://phabricator.services.mozilla.com/D102140
2021-01-25 11:53:49 +00:00
Masatoshi Kimura 15f341b1ca Bug 1686863 - Evaluate xpidl constant values more eagerly. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D101927
2021-01-22 03:40:53 +00:00
Masatoshi Kimura d15c3a2be1 Bug 1685899 - Fix an infinite loop when a constant identifier is not found. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D101269
2021-01-14 19:42:59 +00:00