diff options
author | mrnayak <rmuddur@gmail.com> | 2017-01-08 08:52:18 +0530 |
---|---|---|
committer | mrnayak <rmuddur@gmail.com> | 2017-01-08 08:52:18 +0530 |
commit | a3026499f43860c0d02170534bee20f8f5cc7faa (patch) | |
tree | ed575e0f6388fc082ca505dc094675e6ae707279 /components/script/stylesheet_loader.rs | |
parent | 496447a363ca4fc5d6789241ccb0b94134917b9a (diff) | |
download | servo-a3026499f43860c0d02170534bee20f8f5cc7faa.tar.gz servo-a3026499f43860c0d02170534bee20f8f5cc7faa.zip |
Implement Subresource Integrity
Implemented response validation part of
https://w3c.github.io/webappsec-subresource-integrity/.
Implemented step eighteen of the main fetch. If a request has integrity
metadata, then following steps are performed
*Wait for response body
*If the response does not have a termination reason and response does not
match request’s integrity metadata, set response to a
network error.# Please enter the commit message for your changes. Lines starting
Diffstat (limited to 'components/script/stylesheet_loader.rs')
-rw-r--r-- | components/script/stylesheet_loader.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/components/script/stylesheet_loader.rs b/components/script/stylesheet_loader.rs index 28c5e86b6b5..db70c9e8ebb 100644 --- a/components/script/stylesheet_loader.rs +++ b/components/script/stylesheet_loader.rs @@ -193,7 +193,7 @@ impl<'a> StylesheetLoader<'a> { } impl<'a> StylesheetLoader<'a> { - pub fn load(&self, source: StylesheetContextSource) { + pub fn load(&self, source: StylesheetContextSource, integrity_metadata: String) { let url = source.url(); let document = document_from_node(self.elem); let context = Arc::new(Mutex::new(StylesheetContext { @@ -234,6 +234,7 @@ impl<'a> StylesheetLoader<'a> { pipeline_id: Some(self.elem.global().pipeline_id()), referrer_url: Some(document.url()), referrer_policy: referrer_policy, + integrity_metadata: integrity_metadata, .. RequestInit::default() }; @@ -243,6 +244,6 @@ impl<'a> StylesheetLoader<'a> { impl<'a> StyleStylesheetLoader for StylesheetLoader<'a> { fn request_stylesheet(&self, import: &Arc<RwLock<ImportRule>>) { - self.load(StylesheetContextSource::Import(import.clone())) + self.load(StylesheetContextSource::Import(import.clone()), "".to_owned()) } } |