* Use 2024 style edition
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Reformat all code
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Respond to the "connect" message
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Bump log levels in devtools implementation a bit
If everything is "debug" then nothing stands out.
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Previously, the devtools code was structured like this (in pseudocode):
```rust
fn run() {
let member_1;
let member_2;
fn foo(&member_1) {
// ...
}
fn bar(&member_1, &member_2) {
// ...
}
loop {
match get_message() {
Message1 => foo(&member_1),
Message2 => bar(&member_1, &member_2),
}
}
}
```
This is not very idiomatic rust. And, more importantly, it makes it hard
to edit this code with an IDE, because "find all references" and similar
actions don't properly work. (member_1 inside "foo" is a different
variable than member_1 inside "bar" or "run").
Instead, the code is now structured (roughly) like this:
```rust
struct DevtoolsInstance {
member_1,
member_2,
}
impl DevtoolsInstance {
fn foo(&self) {
// ...
}
fn bar(&self) {
// ...
}
fn run(&self) {
loop {
match get_message() {
Message1 => self.foo(),
Message2 => self.bar(),
}
}
}
}
```
In my opinion, this is an improvement and should make future additions
to the devtools server easier. No behaviour change is intended.
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
- Update the script crate to better reflect the modern Permission
specifcation -- removing the necessity for an `Insecure` variant of
the permissions prompt.
- Have all allow/deny type requests in the internal API use an
`AllowOrDeny` enum for clarity.
- Expose `PermissionsRequest` and `PermissionFeature` data types to the
API and use them in the delegate method.
- Update both servoshell implementations to use the API.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
`EmbedderMsg` was previously paired with an implicit
`Option<WebViewId>`, even though almost all variants were either always
`Some` or always `None`, depending on whether there was a `WebView
involved.
This patch adds the `WebViewId` to as many `EmbedderMsg` variants as
possible, so we can call their associated `WebView` delegate methods
without needing to check and unwrap the `Option`. In many cases, this
required more changes to plumb through the `WebViewId`.
Notably, all `Request`s now explicitly need a `WebView` or not, in order
to ensure that it is passed when appropriate.
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Implement Builder struct for console messages
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Support integer arguments for console methods
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Support floating point arguments to console methods in devtools
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Fix warnings
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Tidy
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Include unimplemented console methods in idl file
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Fix console.assert signature
The condition is optional and there can be multiple messages.
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Implement console.trace
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* ./mach fmt
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Log stack trace when calling console.trace
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Update wpt expectations
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Include line/column info in console.trace logs
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Move option out of constant
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Update mozjs
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Up until now, Servo was using a very old version of time to get a
cross-process monotonic timestamp (using `time::precise_time_ns()`).
This change replaces the usage of old time with a new serializable
monotonic time called `CrossProcessInstant` and uses it where `u64`
timestamps were stored before. The standard library doesn't provide this
functionality because it isn't something you can do reliably on all
platforms. The idea is that we do our best and then fall back
gracefully.
This is a big change, because Servo was using `u64` timestamps all over
the place some as raw values taken from `time::precise_time_ns()` and
some as relative offsets from the "navigation start," which is a concept
similar to DOM's `timeOrigin` (but not exactly the same). It's very
difficult to fix this situation without fixing it everywhere as the
`Instant` concept is supposed to be opaque. The good thing is that this
change clears up all ambiguity when passing times as a `time::Duration`
is unit agnostic and a `CrossProcessInstant` represents an absolute
moment in time.
The `time` version of `Duration` is used because it can both be negative
and is also serializable.
Good things:
- No need too pass around `time` and `time_precise` any longer.
`CrossProcessInstant` is also precise and monotonic.
- The distinction between a time that is unset or at `0` (at some kind
of timer epoch) is now gone.
There still a lot of work to do to clean up timing, but this is the
first step. In general, I've tried to preserve existing behavior, even
when not spec compliant, as much as possible. I plan to submit followup
PRs fixing some of the issues I've noticed.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* feat: watch root node
Signed-off-by: eri <eri@inventati.org>
* reafactor: divide inspector in components
Signed-off-by: eri <eri@inventati.org>
* feat: add css properties actor
Signed-off-by: eri <eri@inventati.org>
* feat: accesibility actor
Signed-off-by: eri <eri@inventati.org>
* feat: layout actor
Signed-off-by: eri <eri@inventati.org>
* feat: network parent and refactor
Signed-off-by: eri <eri@inventati.org>
* feat: progress on the inspector messages
Signed-off-by: eri <eri@inventati.org>
* feat: more progress on inspector
Signed-off-by: eri <eri@inventati.org>
* feat: try to fix nodes showing
Signed-off-by: eri <eri@inventati.org>
* feat: initial dom tree
Signed-off-by: eri <eri@inventati.org>
* feat: some more messages
Signed-off-by: eri <eri@inventati.org>
* feat: clean and add documentation
Signed-off-by: eri <eri@inventati.org>
* refactor: add more docs and clean
Signed-off-by: eri <eri@inventati.org>
* fix: restore deleted node attributes field
Signed-off-by: eri <eri@inventati.org>
* Apply suggestions from code review
Fix a few nits in comments
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
---------
Signed-off-by: eri <eri@inventati.org>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
For a long time, `gfx_traits` has held a lot of things unrelated to graphics
and also unrelated to the `gfx` crate (which is mostly about fonts).
This is a cleanup which does a few things:
1. Move non `gfx` crate things out of `gfx_traits`. This is important in
order to prevent dependency cycles with a different integration between
layout, script, and fonts.
2. Rename the `msg` crate to `base`. It didn't really contain anything
to do with messages and instead mostly holds ids, which are used
across many different crates in Servo. This new crate will hold the
*rare* data types that are widely used.
Details:
- All BackgroundHangMonitor-related things from base to a new
`background_hang_monitor_api` crate.
- Moved `TraversalDirection` to `script_traits`
- Moved `Epoch`-related things from `gfx_traits` to `base`.
- Moved `PrintTree` to base. This should be widely useful in Servo.
- Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it
to `WebRenderFontApi`.
The Linux kernel imposes a 15-byte limit on thread names[1]. This means
information that does not fit in this limit, e.g., the pipeline ID of
layout and script threads, is lost in a debugger and profiler (see the
first column of the table below).
This commit shortens the thread names used in Servo to maximize the
amount of information conveyed. It also rectifies some inconsistencies
in the names.
| Before | After |
|-------------------|-------------------|
| `BluetoothThread` | `Bluetooth` |
| `CanvasThread` | `Canvas` |
| `display alert d` | `AlertDialog` |
| `FontCacheThread` | `FontCache` |
| `GLPlayerThread` | `GLPlayer` |
| `HTML Parser` | `Parse:www.examp` |
| `LayoutThread Pi` | `Layout(1,1)` |
| `Memory profiler` | `MemoryProfiler` |
| `Memory profiler` | `MemoryProfTimer` |
| `OfflineAudioCon` | `OfflineACResolv` |
| `PullTimelineMar` | `PullTimelineDat` |
| `ScriptThread Pi` | `Script(1,1)` |
| `WebWorker for h` | `WW:www.example.` |
| `ServiceWorker f` | `SW:www.example.` |
| `ServiceWorkerMa` | `SvcWorkerManage` |
| `Time profiler t` | `TimeProfTimer` |
| `Time profiler` | `TimeProfiler` |
| `WebGL thread` | `WebGL` |
| `Choose a device` | `DevicePicker` |
| `Pick a file` | `FilePicker` |
| `Pick files` | `FilePicker` |
[1]: https://stackoverflow.com/questions/5026531/thread-name-longer-than-15-chars
Break the association between pipelines and browsing context actors.
Now there is one browsing context actor per actual browsing context,
and individual actors keep track of known pipelines as necessary.
There is also one console/performance/timeline/inspector/etc. actor
per browsing context.
This also centralizes more information in the browsing context actor.
Rather than duplicating state for the active pipeline in actors that
need to use it, each actor now remembers the name of its associated
browsing context actor and obtains that state whenever it's necessary.
DevTools - add DeviceActor and update Root to own global actors
This is one of three pull requests that allows the DevTools Debugger to render. This pr also introduces global actors to the root actor, the same as exists in FF devtools. At a later point I would like to reorganize this.
The two related prs are #21943 and #21944
This is the most significant change of the three. It introduces both Device and Performance as global actors, and leaves the Performance actor also as a target actor. It also introduces the concept of ownership to the root actor, with regards to the two Global Actors.
The Device actor as added to allow the JS Debugger to start up. This required the DeviceActor's `getDescription` method. `getDescription`, in the case of servo, returns a couple of basic fields that the debugger is interested in but doesn't use, specifically `apptype` -- which is returning a fake value of `servo`, and the version number `63.0`.
The version number is interesting because devtools has [dropped support for any versions below 2 version numbers from the current firefox](https://searchfox.org/mozilla-central/rev/3a54520d8d2319a4116866371ed3d9ed2ec0cc2b/devtools/client/debugger/new/src/client/firefox/commands.js#398).
This means that if we want the servo server to be supported, we will need to keep this number synced with FF's versioning. It isn't great, but hopefully we can introduce a different approach later on.
---
<!-- 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. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21942)
<!-- Reviewable:end -->
As part of [Bug 1172987](https://bugzilla.mozilla.org/show_bug.cgi?id=1172897) we renamed TabActor, as the actor does not represent tabs (as in a browser tab), it instead represents a browsing context as defined by the the [HTML standard](https://html.spec.whatwg.org/multipage/browsers.html#windows). In a later PR I will mirror the structure we have on devtools to have a targets folder, which contains all target types. At the moment it looks like servo only represents workers and browsing contexts.