Commit graph

182 commits

Author SHA1 Message Date
Martin Robinson
8de4629a3c
Remove usage of drain_filter (#30742)
This is a step on the way toward supporting stable rust.
2023-11-17 10:28:33 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

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

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Samson
9514f670d1
No tracing of nop traceable fields (#29926)
* Add `no_trace` option to JSTraceable derive

* NoTrace wrapper

* Port some types to no_trace schematics

* Fixing my unsafe mistakes (not tracing traceables)

* Add docs & safety guards for no_trace

Safety guards (trait shenanigans) guarantees safety usage of `no_trace`

* Port canvas_traits to no_trace

* Port servo_media to no_trace

* Port net_traits to no_trace

* Port style to no_trace

* Port webgpu to no_trace

* Port script_traits to no_trace

* Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace

* unrooted_must_root lint in seperate file

* Add trace_in_no_trace_lint as script_plugin

* Composable types in must_not_have_traceable

* Introduced HashMapTracedValues wrapper

* `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>`

* Port rest of servo's types to no_trace

* Port html5ever, euclid, mime and http to no_trace

* Port remaining externals to no_trace

* Port webxr and Arc<Mutex<_>>

* Fix spelling in notrace doc
2023-08-04 10:17:43 +00:00
Gregory Terzian
cf9ec700de
make the concept of has_listeners_for follow other implementations (#21044)
Co-authored-by: Gregory Terzian <gterzian@users.noreply.github.com>
2023-07-19 15:27:32 +00:00
Josh Matthews
cc07e27864 Rename reflect_dom_object2. 2023-05-31 23:03:32 -04:00
Josh Matthews
0e8ac3fdac Formatting. 2023-05-28 23:54:02 -04:00
Josh Matthews
dbff26bce0 Support arbitrary protos when wrapping DOM objects with constructors. 2023-05-28 23:23:12 -04:00
Josh Matthews
d9600ff50f Support arbitrary protos when wrapping EventTarget objects. 2023-05-28 23:23:12 -04:00
Josh Matthews
f79e1e327d Make GlobalScope.get_cx a static method. 2023-05-20 11:05:09 -04:00
Michael Mc Donnell
a3728b8ce2 Fix for loop over option warnings 2022-11-10 16:57:56 -08:00
Sudarsan
f8c9ee4eff Update mozjs to 0.14.1
This update pulls in improvements on mozjs that now removes the need to
pass pointers to CompileOptionsWraper::new(), allows NewProxyObject to
now accept a Singleton bool and JSClass and removes an unsafe
Handle::new usage.
2020-08-28 20:54:18 +08:00
bors-servo
00b57b4fd9
Auto merge of #26792 - servo:static-mut, r=nox
Replace `static mut` with `const`, `static`+`AtomicPtr`, or `static`+`UnsafeCell`

Fixes https://github.com/servo/servo/issues/26550
2020-06-05 09:56:41 -04:00
bors-servo
e2d980a071
Auto merge of #26480 - CYBAI:missing-on, r=jdm
Prefix `on` for function name of inline events

While checking what needs to be done for the spec-update, I've noticed the logic of checking `is window-reflecting element (e.g. body and frameset)` is already handled by the `is` casting function.

However, we still failed to pass the tests because we're missing `on` prefix for inline functions.

I'm not sure if this patch is good enough (or maybe at least I need to add a comment for why adding `on` prefix?).

Besides, I checked [how Gecko handles](https://searchfox.org/mozilla-central/rev/8bc4e35c9bb47c1fe3131e6155d9f482e1efef9a/dom/events/EventListenerManager.cpp#1012-1022) and looks like they also just pass the atom directly.
But, the [generated atom](https://searchfox.org/mozilla-central/source/__GENERATED__/xpcom/ds/nsGkAtomList.h#775) is prefixed with `on` which is correct to just pass it into the `CompileFunction`.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26479
- [x] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2020-06-04 16:45:22 -04:00
Simon Sapin
36920abfe8 Use const instead of static mut in script/dom/eventtarget.rs
There is no mutability there.
2020-06-04 14:33:53 +02:00
Josh Matthews
097a84671a dom: Implement current window event. 2020-05-13 14:36:32 -04:00
CYBAI
b4d1f5b309 Prefix on for function name of inline events 2020-05-10 19:53:36 +09:00
CYBAI
018b23d43b Use mozjs exposed function to generate SourceText 2020-03-31 22:29:53 +09:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
Anthony Ramine
5a4f8cf93f Update SpiderMonkey 2020-03-06 11:13:28 +01:00
CYBAI
403ffcf1eb Always pass InRealm to GlobalScope::from_context to avoid getting null global 2020-02-16 09:55:10 +09:00
Patrick Shaughnessy
01aba1fcc4 Event dispatch rewritten to resemble spec more often, activate on clicks better 2020-02-12 15:57:37 -05:00
Patrick Shaughnessy
2874c62d35 Fix some of the remove-event-handler problems 2020-01-30 14:27:30 -05:00
Patrick Shaughnessy
ee53e10f70 Errors only pass the special bonus arguments to globals 2020-01-27 15:03:28 -05:00
Kunal Mohan
5a3e1b8e69
rename compartment to realm 2020-01-24 20:52:36 +05:30
Kunal Mohan
f7db4b7f80
Modify script to prevent further violations of snake_case 2020-01-18 14:22:15 +05:30
Patrick Shaughnessy
59f66fe09d Scope chain is now constructed 2020-01-15 14:13:18 -05:00
Simon Sapin
e501eaaa5b
Add FIXME to the new comment asking wether code below it is right 2019-12-11 08:59:05 +01:00
Patrick Shaughnessy
f35a870f55 Took out the special mouseover cancel case 2019-12-10 21:50:47 -05:00
marmeladema
88cacfb009 Modify *::get_cx methods to return a safe JSContext instead of a raw one 2019-07-24 09:53:10 +01:00
marmeladema
2c5d0a6ebc Convert CGTraitInterface to use safe JSContext instead of raw JSContext 2019-07-24 08:24:50 +01:00
marmeladema
2fb3f1f983 Callbacks now uses safe JSContext instead of raw JSContext 2019-07-24 08:18:22 +01:00
Kamil Niski
adb402487e Create a helper API for entering a DOM object's compartment
Revert some unnecessary changes

Fix fmt errors
2019-06-29 19:23:17 +02:00
Josh Matthews
4328713f71 Update to SpiderMonkey 66. 2019-05-10 22:43:43 -04:00
Bastien Orivel
50c832762f Implement AddEventListenerOptions: once
Fixes #13242
2018-12-22 17:11:30 +01:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Simon Sapin
2012be4a8b cargo fix --edition-idioms 2018-11-08 09:28:00 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Gregory Terzian
29d1cf6270 implement "has event listener", plug into (before)unload 2018-05-05 19:14:43 +08:00
Gregory Terzian
427eaed535 beforeunload and unload infrastructure 2018-05-05 19:14:36 +08:00
Marcin Mielniczuk
356c57e628 Adapt Servo for mozjs 0.6 and the changes introduced in servo/rust-mozjs#393 2018-03-28 21:28:30 +02:00
Anthony Ramine
f903da0a7b Make callbacks' new methods unsafe
They take raw pointers to contexts and objects.
2018-01-25 11:25:23 +01:00
Simon Sapin
4d459bce32 Fix tyvar_behind_raw_pointer warnings
https://github.com/rust-lang/rust/issues/46906
2018-01-10 20:54:35 +01:00
ddh
79d896d474 queue event instead of immediately fire
created checks to see if parser is in use before event dispatch

changed tests to expect crash and added async style test
2017-11-30 16:18:57 +00:00
Maxim Novikov
83c7f80baa Implement EventTarget constructor
Resolves #19283
2017-11-19 16:14:57 +01:00
Nicholas Nethercote
4506f0d30c Replace all uses of the heapsize crate with malloc_size_of.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
2017-10-18 22:20:37 +11:00
Matt Brubeck
efc3683cc7 Fix commonmark Markdown warnings in docs, part 1
Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is
passed to rustdoc.

This is mostly a global find-and-replace for bare URIs on lines by
themselves in doc comments.
2017-10-17 11:24:57 -07:00