aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/fetch.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-04-06 03:33:08 -0400
committerGitHub <noreply@github.com>2019-04-06 03:33:08 -0400
commitbe1e0690eb890ef785cee76e3a180f9265d820b8 (patch)
tree3448838c31cd6873b3a2383a1586e0c205aa9743 /components/script/fetch.rs
parent967efc7fbc0fdfe55eeb9c1f6ac9f3df933f72d9 (diff)
parent60ba3d25730815817abe60f5fdbed1fa4ff2a553 (diff)
downloadservo-be1e0690eb890ef785cee76e3a180f9265d820b8.tar.gz
servo-be1e0690eb890ef785cee76e3a180f9265d820b8.zip
Auto merge of #23158 - BartGitHub:promise-constructor, r=jdm
Promise constructor In this PR, measures are taken that prevent the ```Promise::new``` constructor from being used outside a compartment. --- <!-- 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 #22982 (GitHub issue number if applicable) <!-- Either: --> - [x] These changes do not require tests because no new functionality is added. <!-- 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/23158) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/fetch.rs')
-rw-r--r--components/script/fetch.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/components/script/fetch.rs b/components/script/fetch.rs
index 04c5e7f5ede..bed4d3c5d12 100644
--- a/components/script/fetch.rs
+++ b/components/script/fetch.rs
@@ -127,6 +127,7 @@ fn request_init_from_request(request: NetTraitsRequest) -> NetTraitsRequestInit
// https://fetch.spec.whatwg.org/#fetch-method
#[allow(unrooted_must_root)]
+#[allow(unsafe_code)]
pub fn Fetch(
global: &GlobalScope,
input: RequestInfo,
@@ -135,7 +136,7 @@ pub fn Fetch(
let core_resource_thread = global.core_resource_thread();
// Step 1
- let promise = Promise::new(global);
+ let promise = unsafe { Promise::new_in_current_compartment(global) };
let response = Response::new(global);
// Step 2