Commit graph

53 commits

Author SHA1 Message Date
Josh Matthews
cc07e27864 Rename reflect_dom_object2. 2023-05-31 23:03:32 -04:00
Josh Matthews
dbff26bce0 Support arbitrary protos when wrapping DOM objects with constructors. 2023-05-28 23:23:12 -04:00
cybai
7c9c786053 Reset to in-memory stream with empty byte sequence for None init body
Because the response body stream is initialized with FetchResponse, it
cannot be processed with in-memory empty sequence. Thus, instead of
using the FetchResponse stream, we'll reset it to Memory body stream
with empty byte sequence if there's no init body.
2023-04-27 14:18:36 +09:00
cybai
c4882aab7e Update steps comment to match latest (2023-04-14) spec 2023-04-14 14:32:28 +09:00
cybai
445c90e5c5 Respect MIME type from headers instead of caching it 2023-04-13 00:31:49 +09:00
Naveen Gattu
a48a111cee Upgrade Hyper 2022-01-16 09:34:17 -08:00
Naveen Gattu
a744ac26da concept-response-clone: Ensure header guard is cloned after headers
https://fetch.spec.whatwg.org/#concept-response-clone

If the header guard of the response to clone is `immutable`, then copying the headers to the new response will fail with `Guard is immutable` unless we ensure the guard is copied _after_ the headers.

8650794391/components/script/dom/response.rs (L331-L334)

    fn Append(&self, name: ByteString, value: ByteString) -> ErrorResult {
        // Step 1
        let value = normalize_value(value);
        // Step 2
        let (mut valid_name, valid_value) = validate_name_and_value(name, value)?;
        valid_name = valid_name.to_lowercase();
        // Step 3
        if self.guard.get() == Guard::Immutable {
            return Err(Error::Type("Guard is immutable".to_string()));
        }
2021-12-17 11:25:59 -08:00
Gregory Terzian
bd5796c90b integrate readablestream with fetch and blob 2020-06-04 11:38:35 +08:00
Bastien Orivel
c4273d86f2 Fix the webidl for Headers
Make the HeadersInit type match the spec.

Fixes #26441
2020-05-30 12:46:51 +02:00
Kunal Mohan
f3fa53b849 update rust toolchain 2020-05-21 21:51:49 +05:30
Bastien Orivel
aa43ce8cf3 Fix the redirected attribute for Response 2020-05-05 20:43:56 +02:00
Bastien Orivel
566147dab3 Strip request-body-header when redirecting from a POST to GET
This doesn't change any expectation because we're not setting
response.redirected properly so all the tests fail later on when it's
asserted to be true.

Fixes #25257
2020-05-05 20:43:55 +02:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
Kunal Mohan
f7db4b7f80
Modify script to prevent further violations of snake_case 2020-01-18 14:22:15 +05:30
Kunal Mohan
02c1612cb0
Add accountable-refcell as optional build time feature 2020-01-08 09:44:41 +05:30
Ridhim Rastogi
a5469f8710 Add StreamConsumer wrapper and methods to response 2019-12-03 15:59:35 -05:00
glowe
e73528e5fc Set response mime_type based on Content-Type
Set the response's mime_type based on its Content-Type header whenever
Response::set_headers is called.

Fixes #24628.
2019-11-14 01:25:20 -05:00
bors-servo
723df4abcf
Auto merge of #24379 - PeaceRebel:dom_response_check_opaque_filter, r=jdm
Dom response check opaque filter

<!-- Please describe your changes on the following line: -->
Added setters for url_list, status, and body in `Response`. Response members are set for [Network Error](https://fetch.spec.whatwg.org/#concept-network-error), [Opaque](https://fetch.spec.whatwg.org/#concept-filtered-response-opaque) and [Opaque-redirect](https://fetch.spec.whatwg.org/#concept-filtered-response-opaque-redirect) responses.

---
<!-- 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 #24372 (GitHub issue number if applicable)

<!-- 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. -->

<!-- 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/24379)
<!-- Reviewable:end -->
2019-10-11 10:45:58 -04:00
peacerebel
0f1ddc6fea Set DOM response members as per the spec for opaque, opaque-redirect and error responses
Signed-off-by: Bipin <peacerebel@protonmail.com>
2019-10-11 10:06:29 +00:00
Otávio Pace
a1acd29339 response: remove text from default statusCode
According to the specification the text of the
default statusCode should be empty.

Reference: https://fetch.spec.whatwg.org/#concept-response-status-message
2019-10-07 08:23:44 -03:00
Manish Goregaokar
611dc4bc70 Remove now-unnecessary must_root and allow(unrooted_must_root) annotations 2019-01-04 15:05:07 -08:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
Bastien Orivel
024b40b39d Update hyper to 0.12 2018-11-01 19:17:36 +01:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
OJ Kwon
c0b5eeef57
feat(webidl): expose arraybuffer overload in body idl 2018-03-23 23:12:21 -07:00
Nicholas Nethercote
4506f0d30c Replace all uses of the heapsize crate with malloc_size_of.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
2017-10-18 22:20:37 +11:00
Simon Sapin
a819cfb0fa Replace uses of libcore with libstd in components/script 2017-10-16 20:19:59 +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
577370746e Rename DOMRefCell<T> to DomRefCell<T>
I don't want to do such a gratuitous rename, but with all the other types
now having "Dom" as part of their name, and especially with "DomOnceCell",
I feel like the other cell type that we already have should also follow
the convention. That argument loses weight though when we realise there
is still DOMString and other things.
2017-09-26 09:49:08 +02:00
Anthony Ramine
c52fd0a780 Rename MutNullableJS<T> to MutNullableDom<T> 2017-09-26 09:49:02 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Simon Sapin
7af5a7fd54 Untry script 2017-06-18 13:21:49 +02:00
Anthony Ramine
31e9d81c0f Make #[dom_struct] a proc_macro attribute 2017-02-24 01:50:51 +01:00
Ms2ger
75be03041c Use the API base URL in Fetch APIs. 2016-12-19 19:43:26 +01:00
Anthony Ramine
1327ebd52f Remove HeapGCValue
It could be used to have mutable JSVal fields without GC barriers.
With the removal of that trait, MutHeap and MutNullableHeap can respectively
be replaced by MutJS and MutNullableJS.
2016-12-12 10:47:54 -10:00
Corey Farwell
449f6337d4 Rename Reflectable to DomObject.
Fixes https://github.com/servo/servo/issues/8473.
2016-12-08 08:50:35 -10:00
Pu Xingyu
0818b44459 Implement range index with the Position enum on ServoUrl 2016-11-18 17:46:36 +08:00
Emilio Cobos Álvarez
913c874cb5
Urlmageddon: Use refcounted urls more often. 2016-11-17 18:34:23 +01:00
Atte Lautanala
65a7747864 Implement response API Clone step 1 2016-10-23 12:32:48 +03:00
Jeena Lee
25cc87f226 Make Response's Clone() method to clone headers.
This patch allows the response clone to have the same headers list as
the original's. Previously, only the cloned response's headers guard was
set to be the same as the original response's headers guard.
2016-10-21 09:14:57 -07:00
Anthony Ramine
d8e92bb271 Rename Reflectable::global_scope to global 2016-10-06 21:36:41 +02:00
Anthony Ramine
19108aa330 Pass a &GlobalScope to WebIDL static methods and constructors 2016-10-06 21:35:49 +02:00
Anthony Ramine
f38159b7d3 Introduce GlobalScope::get_url 2016-10-06 21:35:44 +02:00
Anthony Ramine
ae6af5172b Introduce Reflectable::global_scope 2016-10-06 21:35:38 +02:00
Anthony Ramine
fcb59d3057 Make reflect_dom_object take a &GlobalScope 2016-10-06 20:59:09 +02:00
Ms2ger
cb7e6715fb Provide the fetched data to fetch() consumers. 2016-10-06 14:21:03 +02:00
Simon Sapin
fbde392c3d Revert "Make DOMRefCell use style’s copy of RefCell"
This reverts commit ec723057b2.
2016-10-04 18:35:01 +02:00