Commit graph

89 commits

Author SHA1 Message Date
Nico Burns
deb819f233
Upgrade rustc to 1.83 (#34793)
* Upgrade rustc to 1.83

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix crown (change copied from linked clippy function)

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix named lifetime lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Bump shell.nix

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix non-local impl warnings

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Format with 1.83 formatting changes

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix manual non-local impl

Signed-off-by: Nico Burns <nico@nicoburns.com>

* More fixes for crown

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix tidy

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix needless_return lints

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix doc comment lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix missing wait lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow needless_lifetimes lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* more doc comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

* More needless_returns

Signed-off-by: Nico Burns <nico@nicoburns.com>

* is_empty lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix needless_lifetime lints

Signed-off-by: Nico Burns <nico@nicoburns.com>

* fix div_ceil lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow non-minimal bool

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Non-local impl in constellation

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Missing wait in constellation

Signed-off-by: Nico Burns <nico@nicoburns.com>

* fmt

Signed-off-by: Nico Burns <nico@nicoburns.com>

* remove useless lints table

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fixup comments

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Allow non-local definition in sandboxing code to simplify feature flagging

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Remove wait calls and allow zombie_processes lint

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-01-01 09:38:28 +00:00
shanehandley
3a4e5d4245
Replace HistoryEntryReplacement with NavigationHistoryBehavior from the navigation API (#34681)
Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-12-18 12:47:20 +00:00
Josh Matthews
25a0764a37
Use out parameter for generated methods returning JSVal (#34087)
* Make generated bindings that return a WebIDL `any` value use out parameters.

Returning raw JSVal values makes it easier to create GC hazards in code
that calls these methods. Accepting a MutableHandle argument instead
ensures that the values are rooted by the caller.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Update mozjs.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Fix clippy warnings.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-11-05 08:29:08 +00:00
tanishka
4d11b2dc84
CanGc fixes from constantsourcenode.rs & window.rs (#33931)
Signed-off-by: taniishkaaa <tanishkasingh2004@gmail.com>
2024-10-20 19:54:02 +00:00
webbeef
188fa329eb
Stop sending EmbedderMsg::WebViewOpened from WindowProxy (#33514)
This is redundant since the constellation already sends this message.

Signed-off-by: webbeef <me@webbeef.org>
2024-09-22 19:51:11 +00:00
Josh Matthews
bc5235827f
Various borrow hazard fixes (#33133)
* Reduce the scope of the document tag map borrow.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Reduce scope of borrow when finishing a Response.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Avoid creating a File object while borrowing FormData's data.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Prevent the GC from seeing an uninitialized window proxy slot.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-20 16:06:24 +00:00
Taym Haddadi
c01b733523
Update codegen for GetOpener:inRealms in Bindings.conf (#33062)
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
2024-08-15 13:42:50 +00:00
Taym Haddadi
df8ccafa7c
Fix: Return error and avoid panicking in SetOpener function (#33002)
* Fix: Return error and avoid panicking in SetOpener function

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

* eturn JSFailed onstead of InvalidState

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

* Update wpt test result

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

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
2024-08-12 07:58:00 +00:00
Erik Hennig
5963695664
fix: Memory leak from CreateProxyWindowHandler (#32773)
* fix: Memory leak from CreateProxyWindowHandler

Signed-off-by: ede1998 <online@erik-hennig.me>

* fix: memory leak in WindowProxy

Signed-off-by: ede1998 <online@erik-hennig.me>

* fix: Memory leak in WindowProxyHandler through static

Signed-off-by: ede1998 <online@erik-hennig.me>

---------

Signed-off-by: ede1998 <online@erik-hennig.me>
2024-08-01 21:16:49 +00:00
Martin Robinson
3398fc017b
Move non-gfx things out of gfx_traits and create a base crate (#32296)
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`.
2024-05-17 12:28:58 +00:00
Kitsu
67f239d1ba
clippy: fix several lint warns (#32126)
As seems #31500 still remain opened here's the next partial fix.

Fixed list: `unused_mut`, `clippy::needless_borrow`,
`clippy::match_ref_pats`, `clippy::borrow_deref_ref`, `clippy::ptr_eq`,
`clippy::unnecessary_cast`, `clippy::derivable_impls`,
`clippy::collapsible_match`, `clippy::extra_unused_lifetimes`,
`clippy::map_clone`, `clippy::manual_filter`.


- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes are part of #31500.
- [x] These changes do not require tests because are only cosmetic.
2024-04-22 06:45:39 +00:00
komuhangi
89a4820519
Fixed some clippy warnings in components (#32025)
* Fixed some clippy warnings in components

* Updated the simplification of bolean expressions in componets/script/dom/range.rs
2024-04-10 07:50:01 +00:00
Yashasvi Chaudhary
f613159cba
clippy:partialeq_to_none (#31972) 2024-04-02 10:25:06 +00:00
Rosemary Ajayi
3ddb47e902
clippy: Fix more clippy warnings in components/scripts/dom (#31914)
* refrence to a reference

* refrence to a reference
2024-03-28 11:26:39 +00:00
Rosemary Ajayi
3d10dbae32
clippy: Fix some clippy warnings in components/script (#31843)
* deref on an immutable reference

* fix deref on an immutable reference

* fix deref on an immutable reference
2024-03-25 12:57:35 +00:00
Rosemary Ajayi
0a771169b8
fix redundant closure (#31842) 2024-03-23 16:51:41 +00:00
Oluwatobi Sofela
3c05b58221
clippy: Fix explicit_auto_deref warnings in components/script (#31837)
* clippy: Fix explicit auto-deref warnings

* clippy: Fix explicit auto-deref warnings

* refactor: Tidy up code

* refactor: Fix method not found errors
2024-03-23 11:29:20 +00:00
Oluwatobi Sofela
2789e98876
clippy: Fix redundant field names warnings (#31793) 2024-03-20 23:05:29 +00:00
Oluwatobi Sofela
15bf32a4e6
clippy: Fix unneeded return statement warnings (#31776) 2024-03-20 14:11:40 +00:00
Richard Dushime
01ca220f83
clippy: Fix many warnings in components/script (#31717)
* Fix Several clippy warnings

* Fix Build errors

* Fix Unused import

* Fix requested changes

* Fix rustfmt

* Minor fixes

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-03-19 16:05:56 +00:00
Martin Robinson
9c0561536d
script: Do not run layout in a thread (#31346)
* script: Do not run layout in a thread

Instead of spawning a thread for layout that almost always runs
synchronously with script, simply run layout in the script thread.

This is a resurrection of #28708, taking just the bits that remove the
layout thread. It's a complex change and thus is just a first step
toward cleaning up the interface between script and layout. Messages are
still passed from script to layout via a `process()` method and script
proxies some messages to layout from other threads as well.

Big changes:

1. Layout is created in the script thread on Document load, thus every
   live document is guaranteed to have a layout. This isn't completely
   hidden in the interface, but we can safely `unwrap()` on a Document's
   layout.
2. Layout configuration is abstracted away into a LayoutConfig struct
   and the LayoutFactory is a struct passed around by the Constellation.
   This is to avoid having to monomorphize the entire script thread
   for each layout.
3. Instead of having the Constellation block on the layout thread to
   figure out the current epoch and whether there are pending web fonts
   loading, updates are sent synchronously to the Constellation when
   rendering to a screenshot. This practically only used by the WPT.

A couple tests start to fail, which is probably inevitable since removing
the layout thread has introduced timing changes in "exit after load" and
screenshot behavior.

Co-authored-by: Josh Matthews <josh@joshmatthews.net>

* Update test expectations

* Fix some issues found during review

* Clarify some comments

* Address review comments

---------

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2024-02-23 08:14:10 +00:00
Delan Azabani
eb95703325
constellation: focusing and closing webviews (#30842)
* constellation: focusing, closing, and native window visibility

* rename “browser” to “webview”, “unfocus” to “blur”

* remove native window visibility from constellation

* rename more “browser” to “webview”

* guard clauses

* don’t automatically focus when no webviews are focused

* comment spec steps for window.close()

* use format interpolation

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

* fix formatting

* rename “Webview” to “WebView” in types and type parameters

* remove unused method

* fix libsimpleservo

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-01-24 11:45:54 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors (#31147)
This fixes many rustdoc errors that occur due to raw URLs in rustdoc
comments as well as unescaped Rust code that should be in backticks.
2024-01-22 13:13:48 +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
Josh Matthews
f79e1e327d Make GlobalScope.get_cx a static method. 2023-05-20 11:05:09 -04: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
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
yvt
41cce140bc feat(script): implement some of the non-ordinary internal methods of Location
<https://html.spec.whatwg.org/multipage/#the-location-interface>

 - `[[GetPrototypeOf]]`: not yet
 - `[[SetPrototypeOf]]`: not yet
 - `[[IsExtensible]]`: `proxyhandler::is_extensible`
 - `[[PreventExtensions]]`: `proxyhandler::prevent_extensions`
 - `[[GetOwnProperty]]`: `CGDOMJSProxyHandler_getOwnPropertyDescriptor` (updated)
 - `[[DefineOwnProperty]]`: `CGDOMJSProxyHandler_defineProperty` (updated)
 - `[[Get]]`: `CGDOMJSProxyHandler_get` (updated)
 - `[[Set]]`: not yet
 - `[[Delete]]`: `CGDOMJSProxyHandler_delete` (updated)
 - `[[OwnPropertyKeys]]`: `CGDOMJSProxyHandler_ownPropertyKeys` (updated)
2021-07-16 01:26:05 +09:00
yvt
727662a1e6 chore(deps): update mozjs
- a8b688a: Add `ProxyTraps::{getPrototype, setPrototype, setImmutablePrototype}`
2021-07-10 12:54:31 +09:00
yvt
d597264d1b doc(script): we don't do cross-compartment brain transplantation anymore 2021-07-07 22:21:26 +09:00
Jonathan Kingston
0e1479cc84 Add creation url and Secure Contexts 2020-11-25 18:30:50 +00:00
Matthias Deiml
fa18cf620f Make url for "client" referrer mandatory 2020-06-17 19:07:14 +02:00
Utsav Oza
4c637e0601 Update wpt-tests metadata 2020-05-18 19:07:57 +05:30
Utsav Oza
55a3eb6bf4 Run mach test-tidy 2020-05-18 19:07:57 +05:30
Utsav Oza
ab672577e8 Add creator URL, creator base URL and creator origin in browsing context 2020-05-18 19:07:57 +05:30
Utsav Oza
86a5cf75aa Update window.open() to return fallible result 2020-05-04 19:02:38 +05:30
bors-servo
5a6b2d94d4
Auto merge of #25781 - nox:fixzeal, r=jdm
Introduce a new type MaybeUnreflectedDom<T> (fixes #25701)
2020-03-02 08:20:00 -05:00
Anthony Ramine
14846d0567 Introduce a new type MaybeUnreflectedDom<T> (fixes #25701) 2020-02-17 10:17:47 +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
f29e22f131 Names should now be consistently atoms 2020-02-13 11:21:46 -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
111ede9c77 Make property descriptors hold named/indexed property values 2020-01-10 12:32:08 -05:00
Gregory Terzian
45ec250b0a improve spec compliance of discarding BCs
do not handle compositor input events when BC is being discarded

prevent firing of timers for discarded BCs

return null for opener is BC has been discarded

bundle discard BC steps into window method

return null in window.opener, if BC has already been discarded

move the window closed check pre-event to script-thread
2019-09-22 12:46:40 +08:00
Bastien Orivel
ec6b478775 Update Window::open and document::open parameters to match the spec
Fixes #24012
2019-08-24 17:22:44 +02:00