Skip to content

Commit

Permalink
fix(android): initialization scripts order (tauri-apps#808)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored and luoffei committed Dec 20, 2022
1 parent aeb7d45 commit 700ddb4
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wry": patch
---

Fixes Android initialization scripts order.
3 changes: 2 additions & 1 deletion src/webview/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,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 700ddb4

Please sign in to comment.