Skip to content

Commit

Permalink
fix(android): initialization scripts order (#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Dec 12, 2022
1 parent 5b9f21d commit 7f819c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/android-initialization-scripts.md
@@ -0,0 +1,5 @@
---
"wry": patch
---

Fixes Android initialization scripts order.
3 changes: 2 additions & 1 deletion src/webview/android/mod.rs
Expand Up @@ -188,7 +188,8 @@ impl InnerWebView {
let csp = response.headers_mut().get_mut(CONTENT_SECURITY_POLICY);
let mut hashes = Vec::new();
with_html_head(&mut document, |head| {
for script in &initialization_scripts {
// iterate in reverse order since we are prepending each script to the head tag
for script in initialization_scripts.iter().rev() {
let script_el =
NodeRef::new_element(QualName::new(None, ns!(html), "script".into()), None);
script_el.append(NodeRef::new_text(script));
Expand Down

0 comments on commit 7f819c0

Please sign in to comment.