Skip to content

Commit

Permalink
Support integrity for module script
Browse files Browse the repository at this point in the history
  • Loading branch information
CYBAI committed Jan 3, 2020
1 parent f200775 commit cfad32c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/script/dom/htmlscriptelement.rs
Expand Up @@ -582,6 +582,7 @@ impl HTMLScriptElement {
ModuleOwner::Window(Trusted::new(self)),
url.clone(),
Destination::Script,
integrity_metadata.to_owned(),
);

if !r#async && was_parser_inserted {
Expand Down
5 changes: 5 additions & 0 deletions components/script/script_module.rs
Expand Up @@ -1095,6 +1095,7 @@ pub fn fetch_external_module_script(
owner: ModuleOwner,
url: ServoUrl,
destination: Destination,
integrity_metadata: String,
) -> Rc<Promise> {
// Step 1.
fetch_single_module_script(
Expand All @@ -1103,6 +1104,7 @@ pub fn fetch_external_module_script(
destination,
Referrer::Client,
ParserMetadata::NotParserInserted,
integrity_metadata,
None,
true,
)
Expand All @@ -1115,6 +1117,7 @@ pub fn fetch_single_module_script(
destination: Destination,
referrer: Referrer,
parser_metadata: ParserMetadata,
integrity_metadata: String,
parent_url: Option<ServoUrl>,
top_level_module_fetch: bool,
) -> Rc<Promise> {
Expand Down Expand Up @@ -1209,6 +1212,7 @@ pub fn fetch_single_module_script(
.origin(global.origin().immutable().clone())
.referrer(Some(referrer))
.parser_metadata(parser_metadata)
.integrity_metadata(integrity_metadata.clone())
.mode(mode);

let context = Arc::new(Mutex::new(ModuleContext {
Expand Down Expand Up @@ -1395,6 +1399,7 @@ fn fetch_module_descendants(
destination.clone(),
Referrer::Client,
ParserMetadata::NotParserInserted,
"".to_owned(),
Some(module_tree.url.clone()),
false,
)
Expand Down

0 comments on commit cfad32c

Please sign in to comment.