mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #16508 - brainlessdeveloper:fetch-set-origin, r=asajeffrey
Properly set origin of fetch requests <!-- Please describe your changes on the following line: --> These changes aim to fix #15247 --- <!-- 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 #15247 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes - [x] These changes do not require tests because cors is already tested with different origins These changes require changes in tests, but I need help with that (see comments below). <!-- 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/16508) <!-- Reviewable:end -->
This commit is contained in:
commit
2bb4f65100
32 changed files with 173 additions and 529 deletions
|
@ -574,17 +574,14 @@ impl WorkletThread {
|
|||
// TODO: Fetch a module graph, not just a single script.
|
||||
// TODO: Fetch the script asynchronously?
|
||||
// TODO: Caching.
|
||||
// TODO: Avoid re-parsing the origin as a URL.
|
||||
let resource_fetcher = self.global_init.resource_threads.sender();
|
||||
let origin_url = ServoUrl::parse(&*origin.unicode_serialization())
|
||||
.unwrap_or_else(|_| ServoUrl::parse("about:blank").unwrap());
|
||||
let request = RequestInit {
|
||||
url: script_url,
|
||||
type_: RequestType::Script,
|
||||
destination: Destination::Script,
|
||||
mode: RequestMode::CorsMode,
|
||||
origin: origin_url,
|
||||
credentials_mode: credentials.into(),
|
||||
origin,
|
||||
.. RequestInit::default()
|
||||
};
|
||||
let script = load_whole_resource(request, &resource_fetcher).ok()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue