Commit graph

48 commits

Author SHA1 Message Date
Auguste Baum
863d2ce871
Propagate CanGc arguments through callers in constructors (#35541)
Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
2025-02-20 16:17:45 +00:00
Shubham Gupta
1e164738d8
Add support for Upgrade request to a potentially trustworthy URL. (#34986)
* Add support for Upgrade request to a potentially trustworthy URL.

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>

* script: Support inheritable insecure request policy in documents and workers.

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

---------

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Shubham Gupta <shubham.gupta@chromium.org>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2025-02-05 12:49:56 +00:00
Josh Matthews
c94d909a86
script: Limit public exports. (#34915)
* script: Restrict reexport visibility of DOM types.

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

* script: Mass pub->pub(crate) conversion.

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

* script: Hide existing dead code warnings.

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

* Formatting.

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

* Fix clippy warnings.

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

* Formatting.

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

* Fix unit tests.

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

* Fix clippy.

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

* More formatting.

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

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-01-10 08:19:19 +00:00
shanehandley
08a3e61bb4
Use spec-aligned process for resolving history handling during navigation (#34747)
Makes use of the is_initial_about_blank property on Document in order to
determine whether the navigation should create a history entry, or replace
the current history entry.

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-12-27 02:45:53 +00:00
Domenico Rizzo
0e9746fbbe
Add CanGc argument to reflect_dom_object (#34606)
* applied mach fmt

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>

Refinements

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>

Modified reflect_dom_object signature and all its calls

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>

* fix function calls when parameter is passed up

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>

---------

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
2024-12-13 15:51:59 +00:00
Josh Matthews
e956f3124c
Generate a trait abstracting over all known DOM interfaces (#34357)
* script: Generate trait for all DOM interfaces and parameterize generated Methods traits over it.

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

* script: Update trait implementations with new generic type.

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

* Formatting.

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

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-11-24 07:35:14 +00:00
shanehandley
975e2ae859
Remove referrer policy from document (#34263)
* Remove the referrer policy from document and rely on its policy container

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Make ReferrerPolicy non-optional, instead using a new enum value to represent the empty string case

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Fix clippy issue

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Fix usage of Option<ReferrerPolicy> in unit test

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

---------

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
2024-11-19 12:45:10 +00:00
Chocolate Pie
92866ab911
enhance: Add support for unsafe-eval and wasm-unsafe-eval (#32893)
Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
2024-08-01 17:26:44 +00:00
komuhangi
0da2508e4d
clippy: Allow too_many_arguments for all functions (#31962)
This is the start of preventing this in the future.

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-04-01 14:53:33 +00:00
eri
58081579e9
WebIDL: Remove JSObject from Document::NamedGetter (#31841)
* WebIDL: Remove `JSObject` from `Document::NamedGetter`

* fix: update rustdoc comment
2024-03-24 18:04:04 +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
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
marmeladema
2c5d0a6ebc Convert CGTraitInterface to use safe JSContext instead of raw JSContext 2019-07-24 08:24:50 +01:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +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
Nupur Baghel
d02422408e Updated content_type of Document and XMLDocument from DOCString to Mime 2018-02-09 09:32:56 +05:30
Simon Sapin
52eda6082f Replace NonNullJSObjectPtr with std::ptr::NonNull<JSObject> 2018-01-22 17:41:25 +01:00
Manish Goregaokar
3900f5e616
Use FetchCanceller for document loads 2017-11-22 14:06:27 -08:00
Simon Sapin
e2fafd2dfc Replace NonZero<*mut JSObject> with a wrapper to enable local trait impls. 2017-10-16 20:19:56 +02:00
Simon Sapin
aa15dc269f Remove use of unstable box syntax.
http://www.robohornet.org gives a score of 101.36 on master,
and 102.68 with this PR. The latter is slightly better,
but probably within noise level.
So it looks like this PR does not affect DOM performance.

This is expected since `Box::new` is defined as:

```rust
impl<T> Box<T> {
    #[inline(always)]
    pub fn new(x: T) -> Box<T> {
        box x
    }
}
```

With inlining, it should compile to the same as box syntax.
2017-10-16 17:16:20 +02:00
Anthony Ramine
f87c2a8d76 Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
2017-09-26 09:49:10 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Anthony Ramine
31e9d81c0f Make #[dom_struct] a proc_macro attribute 2017-02-24 01:50:51 +01:00
Connor Brewster
bfd7b950ad Add ImmutableOrigin to allow for serializing origins 2017-02-22 11:11:59 -06:00
Alan Jeffrey
403499a9d5 Allow windows to share browsing contexts. 2017-01-28 21:57:03 -06:00
Alan Jeffrey
a43c842099 The constellation notifies the script thread about documents becoming inactive, active and fully active. 2017-01-27 12:39:43 -06:00
Ms2ger
ec5d08c887 Pass the Document's origin to its constructor.
CC #10963.
2016-12-23 11:15:46 +01:00
bors-servo
22aebdf5d4 Auto merge of #14246 - emilio:servo-url, r=SimonSapin
Urlmageddon

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

Still needs a bunch of code in net to be converted in order to get more
advantage of this for images and stuff, but meanwhile this should help quite a
bit with #13778.

Still wanted to get this in.

r? @SimonSapin

<!-- 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/14246)
<!-- Reviewable:end -->
2016-11-17 15:34:47 -06:00
Emilio Cobos Álvarez
913c874cb5
Urlmageddon: Use refcounted urls more often. 2016-11-17 18:34:23 +01:00
Abelardo E. Mendoza
b372e7c98f script creates methods taking '*mut JSContext' unsafe
rebase + marked the necessary new code as unsafe
2016-11-14 11:06:17 +01:00
Anthony Ramine
0b3ab875f4 Remove intrinsic Root::r() 2016-10-11 19:44:32 +02:00
Anthony Ramine
fcb59d3057 Make reflect_dom_object take a &GlobalScope 2016-10-06 20:59:09 +02:00
Anthony Ramine
7dfb336be8 Use Option<T> to return from getters
This removes the cumbersome &mut bool argument and offers overall
a more readable code.
2016-08-30 19:07:19 +02:00
Anthony Ramine
6e1523f4ae Compile WebIDL return type "object" to NonZero<*mut JSObject> 2016-08-30 19:07:13 +02:00
Aravind Gollakota
1a242d8a50 script: Obtain referrer policy from header 2016-07-15 08:12:24 -07:00
Nazım Can Altınova
d6c1f7b5e3 Implement Document.referrer 2016-07-14 21:35:39 +03:00
Anthony Ramine
cdc7bca944 Move DOMString back to script
This entirely removes the 'non-geckolib' feature of the util crate.
2016-05-24 10:54:57 +02:00
Per Lundberg
2f7ed1d73e Removed unused imports
This fixes #11185.
2016-05-15 22:24:26 +03:00
Ms2ger
3f95e4c8e1 Use upcast() in XMLDocument methods. 2016-04-11 10:30:08 +02:00
Ms2ger
0633ca4144 Remove unused import from xmldocument. 2016-04-11 10:29:51 +02:00
shubham_jain
6626c5cfd4 issue #10141 : Document::location set null for documents without a browsing context. r=Ms2ger 2016-04-09 22:54:07 +05:30
Jack Moffitt
2507bfb2cf Suppress reflows before RefreshTick or FirstLoad
This fixes a bug where partially loaded content is displayed to the user
before it should be, usually before stylesheets have loaded. This commit
supresses reflows until either FirstLoad or RefreshTick, whichever comes
first.

Unfortunately, hit_test and mouse_over did not do reflows if they were
necessary, and so by suppressing the initial spurious reflows, these
methods started to panic without a display list to query. This patch
also transforms these into queries similar to the other existing
queries.
2016-03-03 15:17:46 -07:00
Rahul Sharma
f8cddf5a22 removed XMLDocument constructor according to spec 2016-03-03 17:01:33 +05:30
Josh Matthews
7045056173 Make it possible for XMLDocuments to have a browsing context. 2016-02-20 18:03:14 +01:00
Ms2ger
152cec69eb Store a pointer to the browsing context in the Document. 2016-02-11 13:08:11 +01:00
Anthony Ramine
60976406cc Implement [Unforgeable]
This is mostly stolen from Gecko. As there, we define the unforgeable members
on an object stored in the slots of the prototype object. They are then copied
onto instance objects when they are instantiated. It should be noted that
proxy objects see their unforgeable memebers defined on their expando object.

Unforgeable attributes aren't properly inherited in codegen (in a similar
fashion as getters and setters as filed in #5875) and require to be redefined
in derived interfaces. Fortunately, there are currently no such interfaces.

No unforgeable members can be included into the TestBinding interfaces for good
measure because they are not compatible with setters.

Given the unforgeable holder object has the same prototype as actual instances
of the interface, the finalize hook needs to check its slot pointer for nullity
before dropping it.

The new failing test isn't related to Unforgeable attributes, but to the fact
that all Document instances currently have a Location, even if their window
isn't in a browsing context.
2015-12-02 22:15:11 +01:00
Guillaume Gomez
adf8b359bb Add XMLDocument object 2015-11-27 14:55:41 +01:00