You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
It is currently possible to create multiple instances of WebviewWindow with the same label.
This could lead to undefined behavior when we consider that WebviewWindow.getByLabel() returns a single handle.
Alternatively, WebviewWindow.getByLabel() could be changed to return an array if there are multiple windows with that label.
To Reproduce
Steps to reproduce the behavior:
Within a tauri app, execute the following js:
import{getCurrent,WebviewWindow}from'@tauri-apps/api/window';asyncfunctiontestFunction(){constlabel='testlabel'// the label that will be shared between multiple windowsconstwebview1=newWebviewWindow(label);constwebview2=newWebviewWindow(label);// we now have two webviews with the same label.}
Expected behavior
The WebviewWindow constructor should throw an error if the label is duplicated.
Alternatively, if we decide to allow duplicated labels, WebviewWindow.getByLabel() should return an array.
Platform and Versions (please complete the following information):
Operating System - Windows, version 10.0.19042 X64
Webview2 - 91.0.864.54
Additional context
Allowing duplicate labels would permit that the label be a description of the window's role (eg. main, auxiliary, print_preview)
Disallowing duplicate labels ensures a unique window identifier.
Currently we can achieve the best of both worlds by using a patterns such as <role>:<id> so I think it is best we simply enforce uniqueness.
The text was updated successfully, but these errors were encountered:
@ultravires I cannot reproduce this issue with the API example. Please file a dedicated issue with an app we can use to reproduce it, and also share the tauri info output (ensure you're using latest tauri releases).
Describe the bug
It is currently possible to create multiple instances of
WebviewWindow
with the same label.This could lead to undefined behavior when we consider that
WebviewWindow.getByLabel()
returns a single handle.Alternatively,
WebviewWindow.getByLabel()
could be changed to return an array if there are multiple windows with that label.To Reproduce
Steps to reproduce the behavior:
Within a tauri app, execute the following js:
Expected behavior
The WebviewWindow constructor should throw an error if the label is duplicated.
Alternatively, if we decide to allow duplicated labels,
WebviewWindow.getByLabel()
should return an array.Platform and Versions (please complete the following information):
Operating System - Windows, version 10.0.19042 X64
Webview2 - 91.0.864.54
Node.js environment
Node.js - 14.16.1
@tauri-apps/cli - 1.0.0-beta.3
@tauri-apps/api - 1.0.0-beta.2
Global packages
npm - 6.14.12
yarn - 1.22.10
Rust environment
rustc - 1.53.0
cargo - 1.53.0
Additional context
Allowing duplicate labels would permit that the label be a description of the window's role (eg. main, auxiliary, print_preview)
Disallowing duplicate labels ensures a unique window identifier.
Currently we can achieve the best of both worlds by using a patterns such as
<role>:<id>
so I think it is best we simply enforce uniqueness.The text was updated successfully, but these errors were encountered: