Commit graph

2288 commits

Author SHA1 Message Date
Martin Robinson
e9281e2eda
build(deps): bump bitflags from 1.3.2 to 2.3.1 (#30273)
Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.3.2 to 2.3.1.
 - [Release notes](https://github.com/bitflags/bitflags/releases)
 - [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
 - [Commits](https://github.com/bitflags/bitflags/compare/1.3.2...2.3.1)
2023-09-01 09:58:48 +00:00
Martin Robinson
585a25a212
Use std::cell::OnceCell and remove mitochondria dependency (#30207)
`OnceCell` is now part of the standard library and we'll be able to use
it once we upgrade rust. For now we can use the version that's shipped
behind a feature flag in rust. This removes a dependency on one crate.
2023-08-25 14:09:55 +00:00
Martin Robinson
65138add46
Fix the 32-bit build (#30204)
Use the `libc::char` to represent a pointer to characters rather than
`i8`. This fixes the build for the Raspberry Pi and Android 32-bit.
2023-08-25 08:11:54 +00:00
Martin Robinson
bd2503ceac
Fix warnings after chrono upgrade (#30165)
Some functions are now deprecated, so use the suggested ones and do a
general cleanup of the affected lines of code.
2023-08-23 00:44:00 +00:00
Samson
71e0372ac1
Upgrade whole webgpu stack (#29795)
* Allow noidl files in script/dom/webidls

* Upgrade wgpu to 0.16 and refresh whole webgpu implementation

* Update WebGPU test expectations

* misc

* MutNullableDom -> DomRefCell<Option<Dom for GPUTexture

* Direct use of GPUTextureDescriptor

* Remove config from GPUCanvasContext

* misc

* finally blue color

* gpubuffer "handle" error

* GPU object have non-null label

* gpu limits and info

* use buffer_size

* fix warnings

* Cleanup

* device destroy

* fallback adapter

* mach update-webgpu write webgpu commit hash in file

* Mising deps in CI for webgpu tests

* Updated expectations

* Fixups

* early reject

* DomRefCell<Option<Dom -> MutNullableDom for GPUTexture
2023-08-20 23:16:46 +00:00
Samson
450f8193a5
Use mozjs tracing infrastructure (#29918)
* Update mozjs

64711ec2e6 also fixes https://github.com/servo/servo/issues/30043

* Move to mozjs Traceable and introduce CustomTraceable
2023-08-10 21:46:06 +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
bors-servo
3f7e5b15f8
Auto merge of #29850 - servo:css-viewport-removal, r=mrobinson
CSS viewport removal

It was removed from the spec and it's disabled everywhere.

This also removes the meta viewport support (which was implemented on top), but that also had a single test and is disabled everywhere, so I'm not too concerned, it can be implemented again if / when needed.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26349
- [x] There are tests for these changes
2023-06-30 20:54:11 +02:00
Emilio Cobos Álvarez
349edff768
It was removed from the spec and it's disabled everywhere.
This also removes the meta viewport support (which was implemented on top), but that also had a single test and is disabled everywhere, so I'm not too concerned, it can be implemented again if / when needed.
2023-06-30 16:28:21 +02:00
Martin Robinson
8be014ee46
Create a top-level "third_party" directory
This directory now contains third_party software that is vendored into
the Servo source tree. The idea is that it would eventually hold
webrender and other crates from mozilla-central as well with a standard
patch management approach for each.
2023-06-30 09:51:31 +02:00
Josh Matthews
cc07e27864 Rename reflect_dom_object2. 2023-05-31 23:03:32 -04:00
Josh Matthews
b14b4726ac Assert that we're constructing. 2023-05-30 11:47:47 -04:00
Josh Matthews
56a8237ef4 Throw type error when calling DOM constructor without new. 2023-05-30 10:32:33 -04:00
Josh Matthews
ce023bea24 Don't root a Realm that's used for one call. 2023-05-29 00:47:31 -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
bors-servo
43ebf6c82c
Auto merge of #29798 - jdm:per-interface-codegen, r=jdm
Extract bodies of generated binding helpers into common code

This is part of fixing #29770, by extracting common behaviour that [will be called](https://searchfox.org/mozilla-central/rev/2d678a843ceab81e43f7ffb83212197dc10e944a/dom/bindings/BindingUtils.cpp#3744) from new code in interface.rs.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes
2023-05-26 08:18:51 +02:00
Josh Matthews
123937a500 Formatting. 2023-05-26 01:24:47 -04:00
Josh Matthews
7d9dc458af Use an enum to pass the index value for interfaces/protos. 2023-05-26 01:21:31 -04:00
Josh Matthews
747a99d3f6 Extract bodies of DefineDOMInterface and GetProtoObject/GetConstructorObject out of generated bindings. 2023-05-26 01:02:38 -04:00
Josh Matthews
f79e1e327d Make GlobalScope.get_cx a static method. 2023-05-20 11:05:09 -04:00
Martin Robinson
dc192172ad Clean up debug options 2023-05-01 14:09:28 +02:00
Delan Azabani
65da7b668b clean up lints and tidy errors 2023-03-23 18:07:36 +08:00
Delan Azabani
1f74d4c75b revert: Introduce Untransplantable trait to indicate transplantability at the type level
(8f7b0cff87f0eab921e13e6990d76e12935e8675)
2023-03-23 18:06:17 +08:00
Delan Azabani
4c7f198ee2 apply yvt/servo/fix-named-window-getter 2023-03-23 18:02:35 +08:00
Delan Azabani
fd1de05592 apply pylbrecht/servo/named.window.getter (closes #27952) 2023-03-23 18:01:26 +08:00
sagudev
ee7c393773 Fix Codegen 2023-02-20 06:16:13 +01:00
sagudev
42d8269ac9 ReadableStream WebIDL.py patch 2023-02-20 06:15:54 +01:00
sagudev
2acdeabaf5 Update ply 2023-02-19 13:38:01 +01:00
sagudev
4d393612b4 Update WebIDL 2023-02-19 13:36:13 +01:00
sagudev
6f563830d1 Fix WebIDL.py patches 2023-02-19 13:35:58 +01:00
bors-servo
f70857906d
Auto merge of #29250 - fabricedesre:no-deprecated-symbol-to-jsid, r=delan
Replace use of the deprecated RUST_SYMBOL_TO_JSID by SymbolId

<!-- Please describe your changes on the following line: -->

A simple replacement of a deprecated function, according to changes in https://github.com/servo/mozjs/pull/315

That removes the only build warning I saw when doing a clobber.

---
<!-- 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
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ X] These changes do not require tests because no behavior change is expected.

<!-- 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. -->
2023-01-18 18:05:12 +01:00
The Capyloon Team
a9c0479a48 Replace use of the deprecated RUST_SYMBOL_TO_JSID by SymbolId 2023-01-16 19:14:01 +00:00
Martin Robinson
e68ebd2617 Stringify unknown JavaScript objects in global exception handlers
When turning DOM exceptions into `ErrorInfo` always try to stringify
the JavaScript value, even if it's an object that isn't a `DOMException`
or native exception.  This means that exceptions that extend the `Error`
prototype are now stringified. The result is that test output for WPT
global assertion failures is more useful. For instance for the test
include-frames-from-child-same-origin-grandchild.sub.html:

Before:
```
uncaught exception: unknown (can't convert to string)
```

After:
```
uncaught exception: Error: assert_equals: expected 4 but got 3
```
2023-01-12 19:57:51 +01:00
Martin Robinson
c021df027a Fix some build warnings
- Mark some instances of unused fields and variables as as allowed,
  when they are used for memory management.
- Remove the use of some deprecated function.s

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2023-01-11 12:50:36 +01:00
Josh Matthews
f76bb20c2e Format. 2022-11-23 10:04:53 -05:00
Josh Matthews
bd77a4043c Changes for spidermomkey upgrade. 2022-11-23 10:04:50 -05:00
bors-servo
35e95f55a1
Auto merge of #28663 - saschanaz:void-undefined, r=jdm
Convert Web IDL void to undefined

<!-- Please describe your changes on the following line: -->

Thanks to my tool https://github.com/saschanaz/gecko-webidl 🙌

Build is failing on my current VS2022+Python 3.10 environment, but the IDL tests are passing anyway, so...

---
<!-- 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 #27660

<!-- Either: -->
- [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. -->
2022-01-16 23:06:45 -05:00
Naveen Gattu
a48a111cee Upgrade Hyper 2022-01-16 09:34:17 -08:00
Kagami Sascha Rosylight
4bd814a078 Update CodegenRust.py 2022-01-05 13:54:56 +01:00
Kagami Sascha Rosylight
87fad61851 Try rolling back python fix 2022-01-05 04:44:19 +01:00
Kagami Sascha Rosylight
52ea5204a2 Convert Web IDL void to undefined
Fixes #27660
2022-01-05 03:39:33 +01:00
Naveen Gattu
bcb1374256
semicolon 2021-12-01 09:25:54 -08:00
Naveen Gattu
4e33454364
Update principals.rs 2021-12-01 06:43:35 -08:00
Naveen Gattu
5bd417331f
Perform non-null checks on pointers in subsumes
Need to ensure the passed in pointers are non-null prior to using them unchecked. Seeing sporadic crashes:

```
Stack trace for thread "Script(2,36)"
   0: backtrace::backtrace::libunwind::trace
             at /Users/navgattu/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.63/src/backtrace/libunwind.rs:93:5
      backtrace::backtrace::trace_unsynchronized
             at /Users/navgattu/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.63/src/backtrace/mod.rs:66:5
   1: <servo::backtrace::Print as core::fmt::Debug>::fmt
             at /Users/navgattu/Documents/dev-git/servo/ports/winit/backtrace.rs:53:13
   2: core::fmt::write
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/core/src/fmt/mod.rs:1117:17
   3: std::io::Write::write_fmt
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/std/src/io/mod.rs:1667:15
   4: servo::backtrace::print
             at /Users/navgattu/Documents/dev-git/servo/ports/winit/backtrace.rs:17:5
   5: servo::crash_handler::install::handler
             at /Users/navgattu/Documents/dev-git/servo/ports/winit/crash_handler.rs:25:21
   6: __sigtramp
   7: core::ptr::non_null::NonNull<T>::as_ref
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/core/src/ptr/non_null.rs:317:20
   8: alloc::rc::Rc<T>::inner
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/alloc/src/rc.rs:332:18
      <alloc::rc::Rc<T> as core::clone::Clone>::clone
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/alloc/src/rc.rs:1479:9
   9: <servo_url::origin::MutableOrigin as core::clone::Clone>::clone
             at /Users/navgattu/Documents/dev-git/servo/components/url/origin.rs:92:26
  10: script::dom::bindings::principals::ServoJSPrincipals::origin
             at /Users/navgattu/Documents/dev-git/servo/components/script/dom/bindings/principals.rs:42:9
  11: script::dom::bindings::principals::subsumes
             at /Users/navgattu/Documents/dev-git/servo/components/script/dom/bindings/principals.rs:136:22
  12: _ZN2jsL30SavedFrameSubsumedByPrincipalsEP9JSContextP12JSPrincipalsN2JS6HandleIPNS_10SavedFrameEEE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/SavedStacks.cpp:617:10
      _ZN2jsL20GetFirstMatchedFrameIFbP9JSContextP12JSPrincipalsN2JS6HandleIPNS_10SavedFrameEEEEEES8_S2_S4_RT_S9_NS5_20SavedFrameSelfHostedERb
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/SavedStacks.cpp:636:9
      _ZN2jsL21GetFirstSubsumedFrameEP9JSContextP12JSPrincipalsN2JS6HandleIPNS_10SavedFrameEEENS4_20SavedFrameSelfHostedERb
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/SavedStacks.cpp:660:10
  13: _ZN2js16UnwrapSavedFrameEP9JSContextP12JSPrincipalsN2JS6HandleIP8JSObjectEENS4_20SavedFrameSelfHostedERb
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/SavedStacks.cpp:744:10
  14: _ZN2JS16BuildStackStringEP9JSContextP12JSPrincipalsNS_6HandleIP8JSObjectEENS_13MutableHandleIP8JSStringEEmN2js11StackFormatE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/SavedStacks.cpp:1041:13
  15: mozjs::rust::CapturedJSStack::as_string
             at /Users/navgattu/.cargo/git/checkouts/rust-mozjs-8611526964119dd6/09edacd/src/rust.rs:1377:17
  16: script::dom::webglrenderingcontext::capture_webgl_backtrace::{{closure}}
             at /Users/navgattu/Documents/dev-git/servo/components/script/dom/webglrenderingcontext.rs:1939:46
  17: core::option::Option<T>::and_then
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/core/src/option.rs:1043:24
  18: script::dom::webglrenderingcontext::capture_webgl_backtrace
             at /Users/navgattu/Documents/dev-git/servo/components/script/dom/webglrenderingcontext.rs:1939:27
  19: script::dom::webglrenderingcontext::WebGLRenderingContext::send_command
             at /Users/navgattu/Documents/dev-git/servo/components/script/dom/webglrenderingcontext.rs:397:28
  20: script::dom::webglrenderingcontext::WebGLRenderingContext::get_gl_extensions
             at /Users/navgattu/Documents/dev-git/servo/components/script/dom/webglrenderingcontext.rs:913:9
  21: <script::dom::webglrenderingcontext::WebGLRenderingContext as script::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextBinding::WebGLRenderingContextMethods>::GetSupportedExtensions::{{closure}}
             at /Users/navgattu/Documents/dev-git/servo/components/script/dom/webglrenderingcontext.rs:2330:27
  22: script::dom::webgl_extensions::extensions::WebGLExtensions::init_once
  23: <script::dom::webglrenderingcontext::WebGLRenderingContext as script::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextBinding::WebGLRenderingContextMethods>::GetSupportedExtensions
             at /Users/navgattu/Documents/dev-git/servo/components/script/dom/webglrenderingcontext.rs:2329:9
  24: script::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextBinding::getSupportedExtensions::{{closure}}::{{closure}}
             at /Users/navgattu/Documents/dev-git/servo/target/debug/build/script-80d43fa6e481c605/out/Bindings/WebGLRenderingContextBinding.rs:1095:46
  25: script::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextBinding::getSupportedExtensions::{{closure}}
             at /Users/navgattu/Documents/dev-git/servo/target/debug/build/script-80d43fa6e481c605/out/Bindings/WebGLRenderingContextBinding.rs:1090:33
  26: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/core/src/ops/function.rs:280:13
  27: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/core/src/panic/unwind_safe.rs:271:9
  28: std::panicking::try::do_call
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/std/src/panicking.rs:403:40
  29: <unknown>
             at /Users/navgattu/.cargo/git/checkouts/rust-mozjs-8611526964119dd6/09edacd/src/glue.rs:299:6
  30: std::panicking::try
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/std/src/panicking.rs:367:19
  31: std::panic::catch_unwind
             at /rustc/0fa3190394475a84360b34e074e719d519bc40f1/library/std/src/panic.rs:129:14
  32: mozjs::panic::wrap_panic
             at /Users/navgattu/.cargo/git/checkouts/rust-mozjs-8611526964119dd6/09edacd/src/panic.rs:22:11
  33: script::dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextBinding::getSupportedExtensions
             at /Users/navgattu/Documents/dev-git/servo/target/debug/build/script-80d43fa6e481c605/out/Bindings/WebGLRenderingContextBinding.rs:1090:5
  34: CallJitMethodOp
             at /Users/navgattu/.cargo/git/checkouts/rust-mozjs-8611526964119dd6/09edacd/src/jsglue.cpp:663:12
  35: script::dom::bindings::utils::generic_call
  36: script::dom::bindings::utils::generic_method
  37: _Z12CallJSNativeP9JSContextPFbS0_jPN2JS5ValueEEN2js10CallReasonERKNS1_8CallArgsE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/Interpreter.cpp:435:13
      _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructENS_10CallReasonE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/Interpreter.cpp:520:12
  38: _ZN2js13CallFromStackEP9JSContextRKN2JS8CallArgsE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/Interpreter.cpp:584:10
      _ZL9InterpretP9JSContextRN2js8RunStateE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/Interpreter.cpp:3244:16
  39: _ZN2js9RunScriptEP9JSContextRNS_8RunStateE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/Interpreter.cpp:405:13
  40: _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructENS_10CallReasonE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/Interpreter.cpp:552:13
  41: _ZN2js4CallEP9JSContextN2JS6HandleINS2_5ValueEEES5_RKNS_13AnyInvokeArgsENS2_13MutableHandleIS4_EENS_10CallReasonE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/Interpreter.cpp:597:8
  42: _ZN2js9fun_applyEP9JSContextjPN2JS5ValueE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/JSFunction.cpp:1166:10
  43: _Z12CallJSNativeP9JSContextPFbS0_jPN2JS5ValueEEN2js10CallReasonERKNS1_8CallArgsE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/Interpreter.cpp:435:13
      _ZN2js23InternalCallOrConstructEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructENS_10CallReasonE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/vm/Interpreter.cpp:520:12
  44: _ZN2js3jit14DoCallFallbackEP9JSContextPNS0_13BaselineFrameEPNS0_15ICCall_FallbackEjPN2JS5ValueENS7_13MutableHandleIS8_EE
             at /Users/navgattu/Documents/dev-git/mozjs/mozjs/js/src/jit/BaselineIC.cpp:1841:10
```
2021-11-30 21:49:47 -08:00
yvt
c25355704d fix(script): the condition for exposing a cross-origin setter is CrossOriginWritable, not CrossOriginReadable
The expression `crossOriginIframe.contentWindow.location.href = "new
href"` takes the following steps: (1) Get the setter for `href` by
invoking `[[GetOwnProperty]]` on `crossOriginIframe.contentWindow.
location`. (2) Call the setter, passing `crossOriginIframe.
contentWindow` and `"new href"`. Since the target `Location` is cross
origin, getting the setter succeeds only if the `CrossOriginWritable`
extended attribute is present on the `href` attribute, and it's present.
However, instead of `CrossOriginWritable`, `CrossOriginReadable` was
checked mistakenly.

Since `Location#href` has `CrossOriginWritable` but not
`CrossOriginReadable`, this bug rendered `Location#href` inaccessible
from a cross-origin document.
2021-08-17 09:26:27 +09:00
yvt
afbe2fa1f2 fix(script): don't pass an unrooted slice to from_rooted_slice 2021-07-28 09:10:55 +09:00
yvt
110b3ab6bc style(script): add underscore to unused parameter 2021-07-27 22:38:32 +09:00
yvt
b6ee398b91 refactor(script): make grouping clearer while keeping test-tidy happy 2021-07-27 22:26:28 +09:00