Commit graph

54 commits

Author SHA1 Message Date
eri
9a76dd9325
clippy: Fix remaining warnings in generated code (#31844)
* clippy: fix warnings in generated code

* clippy: fix wrap_panic closure warnings
2024-03-25 11:12:36 +00:00
eri
8c7e9a15e1
Remove repeated imports from generated code (#31711)
* feat: try to deduplicate imports in codegen

* feat: another attempt

* feat: start testing imports

* feat: clean all global imports

* feat: remove shared imports from CGDescriptor

* feat: remove redundant imports from CGDescriptor

* fix: formatting

* fix: remove libc (base level import)

* feat: roll back named path changes

* feat: last changes and tidy

* experiment: move imports into a separate file

* fix: extra parenthesis

* fix: remove repeated allow statement
2024-03-21 13:38:16 +00:00
Josh Matthews
19f1f2a8f4
Extract generated finalizers into generic helper functions. (#31569) 2024-03-08 14:15:26 +00:00
Taym Haddadi
d0b663800f
WedIDL: bring dom/bindings/typedarray further in line with spec (#31375)
* WedIDL: bring dom/bindings/typedarray further in line with spec

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Rename HeapBufferSourceTypes to HeapBufferSource

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* fmt code

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
2024-02-25 12:13:17 +00:00
Abhay Raj Singh
c367309a8f
docs: dom binding link fixes (#31311) 2024-02-11 21:05:33 +00:00
Gregory Terzian
e145c51234
WebIDL: use FLoat32Array (#30990)
* inital

* audiobuffer: return float 32 array as channel data

* add on heap float 32 array type

* fix warnings

* add list of webidl interfaces to ignore for float 32

* codegen: remove duplication of builtin return type handling

* bindings: derive default for float 32 array wrapper

* bindings: allow unsafe code in typedarrays module

* bindings: rename float 32 array wrapper

* bindings: rename HeapFloat32Array is_set method to is_initialized

* bindings: assert float 32 array is initialized before data can be acquired

* bindings: use let syntax for error handling in float 32 array wrapper

* bindings: use copy_from_slice where possible in float 32 array wrapper

* bindings: rename args in typedarray copy methods

* codegen: use idl type in builtin names for float 32 array

* bindings: add a util to create float 32 arrays, use in dom matrix readonly

* codegen: tidy

* bindings: box the heap inside heaped float 32 arrays
2024-01-11 09:43:36 +00:00
Samson
604979e367
Replace script_plugins with a clippy like rustc driver (named crown) (#30508)
* Remove script_plugins

* Use crown instead of script_plugins

* crown_is_not_used

* Use crown in command base

* bootstrap crown

* tidy happy

* disable sccache

* Bring crown in tree

* Install crown from tree

* fix windows ci

* fix warning

* fix mac

libscript_plugins.dylib is not available anymore

* Update components/script/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* Update for nightly-2023-03-18

Mostly just based off https://github.com/servo/servo/pull/30630

* Always install crown

it's slow only when there is new version

* Run crown test with `mach test-unit`

* Small fixups; better trace_in_no_trace tests

* Better doc

* crown in config.toml

* Fix tidy for real

* no sccache on rustc_wrapper

* document rustc overrides

* fixup of compiletest

* Make a few minor comment adjustments

* Fix a typo in python/servo/platform/base.py

Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>

* Proper test types

* Ignore tidy on crown/tests

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-12-01 15:50:52 +00:00
Samson
e0a6281e73
Impl Setlike and Maplike (#30237)
* MallocSizeOf for Index{Set, Map}

* like as iterable in WebIDL

* Codegen magic for like interfaces

* TestBinding for like

* Test for Setlike and Maplike test bindings

* Some fixes

* Switch to any.js

* nit

* Keep order
2023-09-06 13:08:45 +00:00
yvt
320965bfb9 refactor(script): move crate::dom::bindings::{utils → principals)::ServoJSPrincipal 2021-07-13 21:45:21 +09:00
Gregory Terzian
6e8a85482c re-structure blob, structured serialization 2019-12-11 22:46:50 +08:00
Keith Yeung
c3b17c1201 begin messageport, transferable objects, impl
Accept transfer argument for StructuredCloneData::write

Allow structured clone reads to return a boolean

Add Transferable trait

Add basic skeletons to MessagePort

Implement transfer and transfer-receiving steps on MessagePort

Use transfer and transfer_receive in StructuredClone callbacks

Implement MessageChannel

Freeze the array object for the MessageEvent ports attribute

Implement transfer argument on window.postMessage

Use ReentrantMutex instead for MessagePortInternal

Accept origin as a parameter in dispatch_jsval

Fix BorrowMut crash with pending_port_message

Detach port on closure and check for detached during transfer

Enable webmessaging tests

fix webidl

fix
2019-10-19 14:12:22 +08:00
Kagami Sascha Rosylight
b697621b05 Support WebIDL record<> 2019-10-15 17:14:00 +09:00
est31
8b6ed3d182 Remove unused code from script* crates 2019-06-02 07:12:26 +02:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Simon Sapin
52eda6082f Replace NonNullJSObjectPtr with std::ptr::NonNull<JSObject> 2018-01-22 17:41:25 +01:00
olmanz
d71ff786c6 Moved function html_constructor() from interface.rs to new file htmlconstructor.rs 2017-11-16 13:06:50 +01:00
Simon Sapin
e2fafd2dfc Replace NonZero<*mut JSObject> with a wrapper to enable local trait impls. 2017-10-16 20:19:56 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Ms2ger
cb47a7e403 Implement the entry global.
Partial fix for #10963.
2017-01-06 12:56:35 +01:00
Anthony Ramine
3f91ce1d07 Don't generate constructor IDs for inline interfaces 2017-01-03 14:12:19 +01:00
Ms2ger
1bc0862214 Remove and allow some dead code. 2016-12-22 16:06:22 +01:00
Ms2ger
8f2d624cbf Move attributes for the bindings module to its mod.rs. 2016-12-22 15:58:54 +01:00
Anthony Ramine
b6bbd41e11 Remove GlobalRoot and GlobalRef 2016-10-06 21:36:00 +02:00
Anthony Ramine
19108aa330 Pass a &GlobalScope to WebIDL static methods and constructors 2016-10-06 21:35:49 +02:00
Simon Sapin
c831369e3e Move DOMRefCell back into script.
We’re not using it in style after all.
2016-10-04 18:35:00 +02:00
Ms2ger
2d83e5a788 Implement the MozMap type.
Fixes #13144.
2016-09-21 14:03:34 +02:00
Anthony Ramine
0b689a8a31 Implement WebIDL namespaces 2016-09-08 11:01:34 +02:00
Anthony Ramine
51e46b11a3 Move WebIDL constants machinery to bindings::constant 2016-09-06 10:14:11 +02:00
Simon Sapin
c87180a2fb Move DOMRefCell to style. 2016-08-31 02:34:05 +02:00
Josh Matthews
812a761abf Implement pair iterators in WebIDL interfaces. 2016-08-24 11:26:01 -04:00
Anthony Ramine
fd7c4f8149 Remove utils::Prefable in favour of guard::Guard 2016-05-26 23:56:13 +02:00
Zhen Zhang
0385f60310 fix docs 2016-05-02 11:17:35 +08:00
Anthony Ramine
1559f5a39f Lazily define interface objects on globals (fixes #6419) 2016-02-25 15:56:47 +01:00
Ms2ger
ff0992401e Remove remaining reference to the long-disappeared JSRef type. 2016-01-18 09:52:23 +01:00
Anthony Ramine
833e0d2fac Refactor prototype initialisation
The function do_create_interface_objects is removed in favour of 4 functions:
create_callback_interface_object, create_interface_prototype_object,
create_noncallback_interface_object and create_named_constructors.

While this increases the amount of codegen'd code, this greatly improves the
readability of the code involved in this part of DOM, instead of having one function
doing 4 different things. We can always find a more adequate abstraction later.

NativeProperties and everything related to the interface objects have been removed
from the utils module.
2016-01-12 12:34:18 +01:00
Anthony Ramine
72c67efe96 Introduce trait WeakReferenceable
This allows to take weak references of JS-managed DOM objects.
2015-11-12 12:51:50 +01:00
bors-servo
92f9e58310 Auto merge of #8286 - eefriedman:no-move, r=nox
Remove unnecessary uses of #[no_move]

The patch makes RootCollection a bit safer by making the StackRootTLS hold
it in place.

RootedVec was doing an extremely delicate dance and just hoping nobody
messed it up; switch to a Box to be safe.

CodeGenRust seemed to be using no_move for no particularly good reason.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8286)
<!-- Reviewable:end -->
2015-11-08 12:51:00 +05:30
Eli Friedman
1a50fce67c Clean up some code related to #[no_move].
The patch makes RootCollection a bit safer by making the StackRootTLS hold
it in place.

The use of no_move in CodeGenRust was leftover from when roots couldn't
be moved.
2015-11-07 21:17:24 -08:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
Ms2ger
1f03ce1b1f Enable some warnings for generated code.
None of those warnings currently occur.
2015-10-16 12:07:57 +02:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Hugo Thiessard
6565e7b02f Issue #7390 correct the order of mod declaration 2015-09-18 22:02:04 +02:00
Anthony Ramine
cf6975f2a3 Do not allow unreachable_code in codegen anymore 2015-08-30 17:25:05 +02:00
Anthony Ramine
3c1c315838 Do not allow dead_code in codegen anymore 2015-08-30 17:19:42 +02:00
Anthony Ramine
2c8638ea9e Do not allow unused_parens in codegen anymore 2015-08-30 17:16:15 +02:00
Anthony Ramine
1064e7decc Do not allow unused_mut in codegen anymore 2015-08-30 16:53:35 +02:00
Anthony Ramine
aaa7a86381 Do not allow unused_unsafe in codegen anymore 2015-08-30 16:53:20 +02:00
Jack Moffitt
07d95627ca Generate code into OUT_DIR.
This is necessary to ensure Cargo knows when to rebuild. Normally
.gitignore would be enough to exclude these from Cargo's freshness
calculation, but https://github.com/rust-lang/cargo/issues/1729 prevents
this currently. This is the new, correct way to do these thigns, just
like the style crate does.
2015-06-17 16:18:22 -06:00
Manish Goregaokar
dcb0a0eab6 Fix some no_move errors 2015-04-28 04:20:45 +05:30
Ms2ger
03c526dd20 Add more documentation about the DOM bindings.
Most of this documentation is based on
<https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings>.
2015-04-03 11:33:53 +02:00