Open
Conversation
Updated README.md to reflect new features and enhancements in version 2.2.1-alpha1, including event object refactoring and UI responsiveness improvements.
Added a new section detailing the latest release (v2.2.1-alpha1) with a focus on UI responsiveness and event object refactoring.
Added caution note about breaking changes in HTTP status code detection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Thanks for your effort and interest 💛 in improving the project. It's very appreciated.
Description
Refactored: OnDownloadStarting Event
Transitioned from a parameter-based signature to a robust, object-oriented argument model.
New Argument Wrapper:
IWebView2DownloadStartingEventArgsprovides access toUri,ResultFilePath,Handled,Cancel,MimeType,ContentDisposition, andTotalBytesToReceive.Hybrid Deferral Model: Implemented a performance-optimized synchronization mechanism using
CoreWebView2Deferral. The C# core now waits up to 5000ms for AutoIt to setHandledorCancelon the argument object, proceeding immediately once a decision is made.MimeType Support (Issue [FEATURE]: WebView.UnviewableContentIdentified Event #123): Exposed
MimeTypedirectly in the download arguments, allowing AutoIt scripts to identify "unviewable content" (e.g., PDFs, ZIPs) at the start of the download lifecycle.Improved: Download Logic: Automatic redirection to
_customDownloadPathis now applied before the event fires, allowing AutoIt to see and potentially override the final destination.Refactored: OnDownloadStateChanged Event
New Argument Wrapper:
IWebView2DownloadStateChangedEventArgsprovides access to
State,Uri,TotalBytesToReceive,BytesReceived, and a newPercentCompletehelper.Buffered Property Pattern: Applied to ensure thread-safe progress updates during rapid download cycles.
Fixed: HTTP Status Code Detection
OnWebResourceResponseReceivedfailed to fire due to a missing legacy header hack. Replaced with nativeResourceContextdetection.Caution
Breaking Change: If you have custom scripts using
OnDownloadStartingorOnDownloadStateChanged, please update their signatures to use the new$oArgsobject as demonstrated in the updated examples.🔗 Linked GitHub Issues
#123
#120 (comment)
Closes #123
📋 What is the current behavior?
🚀 What is the new behavior?
Type of changes
Breaking changes 🔥
Breaking Change:
If you have custom scripts using
OnDownloadStarting Event
OnDownloadStateChanged Event
please update their signatures to use the new $oArgs object as demonstrated in the updated examples.
How and where was this tested?
🖥️ Describe where you tested your changes
System:
Context:
NetJson.ParserNetWebView2.Manager - WebView2NetWebView2.Manager - Bridge🔬 Describe how you tested your changes
Checklist
Additional context
Screenshots
Note to reviewers
⚡ OnDownloadStarting
Fired when a download is starting. Provides a robust argument object for decision making and metadata access (MimeType, etc.).
object_OnDownloadStarting(Sender As Object, ParentHandle As HWND, Args As Object)Args properties:
Uri (string): The target URL of the download.
ResultFilePath (string): Get/Set the target file path.
Handled (bool): Set to True to indicate AutoIt has handled the UI/Decision (stops the 5000ms wait loop).
Cancel (bool): Set to True to cancel the download immediately.
MimeType (string): The MIME type of the content (e.g., "application/pdf").
ContentDisposition (string): The Content-Disposition header from the server.
TotalBytesToReceive (long): Estimated total size of the download (if known).
⚡ OnDownloadStateChanged
Fired when a download state changes (e.g., Progress, Completed, Failed).
object_OnDownloadStateChanged(Sender As Object, ParentHandle As HWND, Args As Object)Args properties:
State (string): The current state ("InProgress", "Completed", "Interrupted").
Uri (string): The download URI.
TotalBytesToReceive (long): Estimated total size.
BytesReceived (long): Number of bytes received so far.
PercentComplete (int): Calculation (0-100) or -1 if unknown.