Skip to content

fix(windows): fix init scripts running twicec#1418

Merged
pewsheen merged 2 commits intodevfrom
fix/windows/init-scripts-twice
Nov 15, 2024
Merged

fix(windows): fix init scripts running twicec#1418
pewsheen merged 2 commits intodevfrom
fix/windows/init-scripts-twice

Conversation

@amrbashir
Copy link
Copy Markdown
Member

@amrbashir amrbashir commented Nov 14, 2024

@amrbashir amrbashir requested a review from a team as a code owner November 14, 2024 23:32
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 14, 2024

Package Changes Through bc976b0

There are 1 changes which include wry with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
wry 0.47.0 0.47.1

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

Comment on lines +601 to +614
webview.add_ContentLoading(
&ContentLoadingEventHandler::create(Box::new(move |webview, _| {
let Some(webview) = webview else {
return Ok(());
};

for (script, _) in scripts.iter().filter(|(_, for_main)| *for_main) {
Self::execute_script(&webview, script.clone(), |_| ())?;
}

Ok(())
})),
token,
)?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine but actually it sometimes injects the script at the wrong timing, for example, currently Tauri's helloworld example will throw an error saying window.__TAURI__ is undefined but works if you reload the page or use AddScriptToExecuteOnDocumentCreated

@amrbashir I'm not sure if we want to keep this or just don't support injecting to main page only on Windows

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should revert? I mean we always injected into all frames, so I don't think it should be harmful, or do we still need this @tweidinger

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We moved to selective injection due to security issues like GHSA-57fm-592m-34r7 - windows was always a bit of a special case since it allows injection into same origin but afaik we did not want this Auto injection behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Click event is triggered twice

4 participants