Skip to content

Commit

Permalink
Update src/webview/webkitgtk/mod.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir authored Aug 21, 2024
1 parent d119e20 commit 70e0990
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/webview/webkitgtk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,11 @@ impl InnerWebView {
};

// Initialize message handler
w.init("Object.defineProperty(window, 'ipc', { value: Object.freeze({ postMessage: function(x) { window.webkit.messageHandlers['ipc'].postMessage(x) } }) })")?;
let mut init = String::with_capacity(115 + 20 + 22);
init.push_str("Object.defineProperty(window, 'ipc', {value: Object.freeze({postMessage:function(x){window.webkit.messageHandlers[\"");
init.push_str(&window_hash);
init.push_str("\"].postMessage(x)}})})");
w.init(&init)?;

// Initialize scripts
for js in attributes.initialization_scripts {
Expand Down

0 comments on commit 70e0990

Please sign in to comment.