Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update web-sys and js-sys #17556

Merged
merged 2 commits into from
Aug 20, 2024
Merged

Conversation

evilpie
Copy link
Collaborator

@evilpie evilpie commented Aug 18, 2024

No description provided.

@@ -354,11 +354,7 @@ impl RuffleHandle {

async fn run_context_menu_callback_paste(&self, index: usize) {
let window = web_sys::window().expect("Missing window");
let Some(clipboard) = window.navigator().clipboard() else {
tracing::warn!("Clipboard unsupported");
let _ = self.with_instance(|inst| inst.js_player.display_clipboard_modal(false));
Copy link
Member

Choose a reason for hiding this comment

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

Is display_clipboard_modal still called with false anywhere? If not, I suppose it can be simplified by removing its parameter. Doesn't have to be in this PR though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You are right, I think it's unused now.

I was actually wondering if we should somehow manually (probably something like "clipboard" in navigator) keep checking if clipboard exists.

Copy link
Member

Choose a reason for hiding this comment

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

And I was wondering - since accessing it no longer returns an Option, what happens if it's not available anyway? A JS exception? Errors on use? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've added an explicit check for "clipboard" in navigator, because otherwise the navigator.clipboard() just panics when the property doesn't exist.

@torokati44
Copy link
Member

@torokati44
Copy link
Member

torokati44 commented Aug 20, 2024

cargo clippy complains

error: this expression creates a reference which is immediately dereferenced by the compiler
   --> web/src/lib.rs:360:31
    |
360 |         if !JsValue::from_str(&"clipboard").js_in(&navigator) {
    |                               ^^^^^^^^^^^^ help: change this to: `"clipboard"`
    |

@torokati44
Copy link
Member

fixed it for you

@torokati44 torokati44 enabled auto-merge (rebase) August 20, 2024 19:07
@torokati44 torokati44 merged commit d824a02 into ruffle-rs:master Aug 20, 2024
17 checks passed
@torokati44
Copy link
Member

Oh, render/canvas was left out of this. Hopefully no API changes affect it.

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.

2 participants