Auto merge of #23372 - sreeise:xhr_resource_url, r=jdm

Change XHRContext and resource timing information to use request URL

<!-- Please describe your changes on the following line: -->
Change resource timing information to return the URL used to create the XHR and store the URL in XHRContext.

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

<!-- Either: -->
- [X] 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/23372)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-06-02 22:48:25 -04:00 committed by GitHub
commit 7f7eead3d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 7 deletions

View file

@ -98,6 +98,7 @@ struct XHRContext {
gen_id: GenerationId,
sync_status: DomRefCell<Option<ErrorResult>>,
resource_timing: ResourceFetchTiming,
url: ServoUrl,
}
#[derive(Clone)]
@ -284,10 +285,7 @@ impl XMLHttpRequest {
impl ResourceTimingListener for XHRContext {
fn resource_timing_information(&self) -> (InitiatorType, ServoUrl) {
(
InitiatorType::XMLHttpRequest,
self.resource_timing_global().get_url().clone(),
)
(InitiatorType::XMLHttpRequest, self.url.clone())
}
fn resource_timing_global(&self) -> DomRoot<GlobalScope> {
@ -1466,6 +1464,7 @@ impl XMLHttpRequest {
gen_id: self.generation_id.get(),
sync_status: DomRefCell::new(None),
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Resource),
url: init.url.clone(),
}));
let (task_source, script_port) = if self.sync.get() {