Do not use ParallelIterator if not using rayon
The rayon [`ParalllelIIterator`](https://github.com/rayon-rs/rayon/blob/master/src/iter/plumbing/README.md) is being used for inline content size calculations irrespective of the `use_rayon` flag, which can lead to an unbounded (dynamically determined) number of threads being spawned during iteration.
The check is performed for static position calculations, however:
6fced22e47/components/layout_2020/flow/mod.rs (L235-L242)
---
<!-- 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
- [ ] These changes do not require tests because ___
<!-- 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. -->
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
```
Preserve URI fragment across redirects
https://www.rfc-editor.org/rfc/rfc7231#section-7.1.2
```
If the Location value provided in a 3xx (Redirection) response does
not have a fragment component, a user agent MUST process the
redirection as if the value inherits the fragment component of the
URI reference used to generate the request target (i.e., the
redirection inherits the original reference's fragment, if any).
```
<!-- Please describe your changes on the following line: -->
---
<!-- 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
- [ ] These changes do not require tests because ___
<!-- 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. -->
Updated cssparser dependency to 0.29.
Signed-off-by: Lewin Probst <info@emirror.de>
This commit updates the cssparser dependency to 0.29. The intention is to get the selectors crate to cssparser 0.29. This will reduce problems in other crates that belong on both, selectors and cssparser.
Would love to get a review and changes required to be able to merge this.
---
<!-- 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
- [ ] These changes do not require tests because ___
<!-- 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. -->
`shell.nix`: Add `libxkbcommon` to `LD_LIBRARY_PATH`
`libxkbcommon` is a runtime dependency of winit's Wayland backend. Servo crashes with [a very confusing panic message][1] if the Wayland backend is selected, and `libxkbcommon.so` can't be found at runtime.
[1]: https://github.com/rust-windowing/winit/issues/1760
---
- [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)
---
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they don't affect the production code
docs: Fix link to experimental CLI prefs list
Fixes: #28612.
Signed-off-by: Divyanshu Agrawal <agrawal-d@outlook.com>
<!-- Please describe your changes on the following line: -->
---
<!-- 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#28612 (GitHub issue number if applicable)
<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because these are documentation 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. -->
CI: Update the required clang-format version to 13
`mach test-tidy` requires a specific version of `clang-format` so that the formatting result is consistent between build environments. [The virtual environment][6] used by GitHub Actions has been updated [**again**][1] and now provides a version of `clang-format` that is different from the one expected by our `mach` tool, causing the `mach test-tidy --force-cpp` step to [fail][2]. This PR updates our tool to address the issue.
[6]: https://github.com/actions/virtual-environments
[1]: https://github.com/servo/servo/pull/28602
[2]: https://github.com/servo/servo/pull/28613#issuecomment-944424519
---
- [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)
---
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they don't change the production code
Delete `canvas.png`
This PR deletes `:/canvas.png`, which was presumably accidentally added by commit 5f91ab07.
---
- [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)
---
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because this file is used absolutely nowhere
Update rust by example link
<!-- Please describe your changes on the following line: -->
rustbyexample.com shows 404
---
- [x] These changes do not require tests because this just updates a text file
<!-- 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. -->
Fix CI
This PR fixes CI failures that have occurred due to external reasons.
# Highlights
## `blessing`
Our `mach` script uses [`blessings`][2] for terminal rendering during WPT tests. The `setuptools` script of `blessings` 1.6 activates the option `use_2to3` to convert the code when installing the package for Python 3. However, this option has been [removed][1] in `setuptools` 58. This caused a breakage in our CI pipelines, producing an error message like the following:
```
Collecting blessings==1.6
Downloading blessings-1.6.tar.gz (19 kB)
ERROR: Command errored out with exit status 1:
command: /home/runner/work/servo/servo/python/_virtualenv3.8/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-n51ah1i5/blessings_f1c0f646d72e488e988232f7aeb42946/setup.py'"'"'; __file__='"'"'/tmp/pip-install-n51ah1i5/blessings_f1c0f646d72e488e988232f7aeb42946/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-1eg28bh4
cwd: /tmp/pip-install-n51ah1i5/blessings_f1c0f646d72e488e988232f7aeb42946/
Complete output (1 lines):
error in blessings setup command: use_2to3 is invalid.
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/af/4a/61acd1c6c29662d3fcbcaee5ba95c20b1d315c5a33534732b6d81e0dc8e8/blessings-1.6.tar.gz#sha256=edc5713061f10966048bf6b40d9a514b381e0ba849c64e034c4ef6c1847d3007 (from https://pypi.org/simple/blessings/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement blessings==1.6 (from versions: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.5.1, 1.6, 1.6.1, 1.7)
ERROR: No matching distribution found for blessings==1.6
"/home/runner/work/servo/servo/python/_virtualenv3.8/bin/python" "-m" "pip" "install" "-I" "-r" "/home/runner/work/servo/servo/python/requirements.txt" failed with error code 1:
Output:
Error:
Error: Process completed with exit code 1.
```
Our `requirements.txt` pins the version of `setuptools`, but this didn't work probably because `virtualenv` uses an embedded version of `setuptools`, which was recently [upgraded][4] to 58 in `virtualenv` 20.8.0.
This PR upgrades `blessings` to a version that [doesn't use][3] the `use_2to3` option anymore to fix this issue.
## OpenSSL Binding
It appears that, when installing OpenSSL, Homebrew now installs version 3.0 by default. OpenSSL 3.0 isn't supported by `openssl-sys` 0.9.63 that we currently use and causes a build error while building the binding.
```
build/expando.c:10:1: error: pasting formed 'RUST_VERSION_OPENSSL_(', an invalid preprocessing token
VERSION(OPENSSL, OPENSSL_VERSION_NUMBER)
^
build/expando.c:5:23: note: expanded from macro 'VERSION'
#define VERSION(n, v) VERSION2(n, v)
^
build/expando.c:4:43: note: expanded from macro 'VERSION2'
#define VERSION2(n, v) RUST_VERSION_##n##_##v
^
1 error generated.
```
This PR upgrades `openssl[-sys]` to newer versions that were [updated][5] to support OpenSSL 3.0.
## `clang-format`
`mach test-tidy` requires a specific version of `clang-format` so that the formatting result is consistent between build environments. [The virtual environment][6] used by GitHub Actions has been [updated][7] and now provides a version of `clang-format` that is different from the one expected by our `mach` tool. This PR updates our tool to address the issue.
[1]: https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v5800
[2]: https://github.com/erikrose/blessings
[3]: https://github.com/erikrose/blessings/pull/132
[4]: https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst#v2080-2021-09-16
[5]: b4c735e8af
[6]: https://github.com/actions/virtual-environments
[7]: https://github.com/actions/virtual-environments/pull/3905/files#diff-816219d3c9f30fcc1c40f88ca826c1662bf99eded781c1b419dd2dfb577ae227R380
---
- [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)
---
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they don't change the production code
Fix simpleservo binary check on macos
<!-- Please describe your changes on the following line: -->
When compiling libsimpleservo on MacOS 11.5.2 I would get an error at the end of the process saying
```
Error running mach:
['build', '-d', '--libsimpleservo']
The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.
If filing a bug, please include the full output of mach, including this error
message.
The details of the failure are as follows:
servo.command_base.BuildNotFound: No Servo binary found. Perhaps you forgot to run `./mach build`?
File "/Users/yuriwitte/_HtmlTests/servo/python/servo/build_commands.py", line 734, in build
self.get_binary_path(release, dev, target=target, simpleservo=libsimpleservo)
File "/Users/yuriwitte/_HtmlTests/servo/python/servo/command_base.py", line 394, in get_binary_path
raise BuildNotFound('No Servo binary found.'
```
The binary is there, it's just that `get_binary_path` on `command_base.py` checks for a libsimpleservo **.so** instead of a **.dylib**. This pr fixes this check.
---
<!-- 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: didn't find a specific issue for this, but these two are also related to file extensions on MacOS:
https://github.com/servo/servo/issues/27654https://github.com/servo/servo/issues/27318
<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because: they _are_ the tests I guess?
<!-- 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. -->
Update docs for VS2019 and clarify
This mostly updates Windows docs, clarifies and removes some unnecessary parts.
The long chocolatey command gives more insight into what it's doing, it still gives us the same components as before (but 2019), without VS itself.
I also used `./mach clean` a few times and had one problem due to `python/_virtualenv[version]/` not being removed completely, so I clarified what the `clean`-command does (I thought it just passes on to cargo).
---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix#28530 (and maybe #25845)
- [X] These changes do not require tests because it's just docs