Skip to content

Releases: ioa747/NetWebView2Lib

v2.2.2-alpha

Choose a tag to compare

@ioa747 ioa747 released this 29 Jun 17:57
e6cc702

Version v2.2.2-alpha

Configurable Message Throttling

Provide a configurable throttling mechanism for messages sent from JavaScript to AutoIt via the WebView2 bridge to prevent message loss when throttling is too restrictive for certain use cases, while keeping safety defaults.
⚡ Key Features & Enhancements

  1. Implement the ThrottlingIntervalMs property on the manager class, forwarding to the bridge object.

    ThrottlingIntervalMs [Property]: Gets or sets the throttling interval in milliseconds for messages sent from JavaScript to AutoIt. Set to 0 to disable throttling entirely. Default is 20 ms.

v2.2.1-alpha1

Choose a tag to compare

@ioa747 ioa747 released this 17 Apr 19:45
f3b494e

Version 2.2.1-alpha1

Critical UI Responsiveness & Locking Fixes

  • Fixed: Unresponsive F12 & Context Menu: Resolved a critical issue where Developer Tools and Right-Click menus would become unresponsive or "missing" (Inspect) after navigation.
    • Root Cause: Identified as COM overhead during dual event sink processing and synchronous state lag when toggling engine properties.
  • Improved: Interception-Based Locking: Refactored LockWebView / UnLockWebView to be 100% reliable.
    • Instead of toggling engine settings (which caused UI flickering), the library now stays permanently "Open" at the engine level but intercepts and blocks events via the _isLocked flag in C#.
  • C# Fast Path Optimization: F12 and basic context menus are now handled directly in C# whenever possible, bypassing the AutoIt COM layer for instant response times.
  • Robust AutoIt Navigation: _NetWebView2_Navigate and _NetWebView2_NavigateToString now use a guaranteed UnLockWebView pattern, preventing the browser from remaining locked on navigation errors.
  • Refactored: OnDownloadStarting Event: Transitioned from a parameter-based signature to a robust, object-oriented argument model.
    • New Argument Wrapper: IWebView2DownloadStartingEventArgs provides access to Uri, ResultFilePath, Handled, Cancel, MimeType, ContentDisposition, and TotalBytesToReceive.
    • Hybrid Deferral Model: Implemented a performance-optimized synchronization mechanism using CoreWebView2Deferral. The C# core now waits up to 5000ms for AutoIt to set Handled or Cancel on the argument object, proceeding immediately once a decision is made.
    • MimeType Support (Issue #123): Exposed MimeType directly in the download arguments, allowing AutoIt scripts to identify "unviewable content" (e.g., PDFs, ZIPs) at the start of the download lifecycle.
  • Refactored: OnWebResourceResponseReceived Event: Transitioned to an object-oriented argument model for consistent event handling.
    • New Argument Wrapper: IWebView2WebResourceResponseReceivedEventArgs provides access to StatusCode, ReasonPhrase, RequestUri, and IsDocument.
    • Buffered Property Pattern: Applied to ensure thread-safe access from AutoIt (STA/COM compatibility).
    • Refactored: OnDownloadStateChanged Event: Transitioned to an object-oriented argument model for consistent event handling.
    • New Argument Wrapper: IWebView2DownloadStateChangedEventArgs provides access to State, Uri, TotalBytesToReceive, BytesReceived, and a new PercentComplete helper.
    • Buffered Property Pattern: Applied to ensure thread-safe progress updates during rapid download cycles.
  • Fixed: HTTP Status Code Detection: Resolved a bug where OnWebResourceResponseReceived failed to fire due to a missing legacy header hack. Replaced with native ResourceContext detection.
  • Improved: Download Logic: Automatic redirection to _customDownloadPath is now applied before the event fires, allowing AutoIt to see and potentially override the final destination.

v2.2.1-alpha

Choose a tag to compare

@ioa747 ioa747 released this 22 Mar 11:11
4ed2f45

Version 2.2.1-alpha

Critical UI Responsiveness & Locking Fixes

  • Fixed: Unresponsive F12 & Context Menu: Resolved a critical issue where Developer Tools and Right-Click menus would become unresponsive or "missing" (Inspect) after navigation.
    • Root Cause: Identified as COM overhead during dual event sink processing and synchronous state lag when toggling engine properties.
  • Improved: Interception-Based Locking: Refactored LockWebView / UnLockWebView to be 100% reliable.
    • Instead of toggling engine settings (which caused UI flickering), the library now stays permanently "Open" at the engine level but intercepts and blocks events via the _isLocked flag in C#.
  • C# Fast Path Optimization: F12 and basic context menus are now handled directly in C# whenever possible, bypassing the AutoIt COM layer for instant response times.
  • Robust AutoIt Navigation: _NetWebView2_Navigate and _NetWebView2_NavigateToString now use a guaranteed UnLockWebView pattern, preventing the browser from remaining locked on navigation errors.
  • Persistence Fix: Resolved state corruption where SetLockState would accidentally overwrite user preferences (Like AreDevToolsEnabled=True) with False.

v2.2.0-alpha

Choose a tag to compare

@ioa747 ioa747 released this 18 Mar 02:28
094fbc7

Version 2.2.0-alpha

Event Object Refactoring (Navigation Interception)

This release refactors key events to use object-based arguments, enabling advanced control like navigation cancellation.

  • Breaking Change: OnNavigationStarting and OnFrameNavigationStarting now pass an Args object instead of a raw URL string.
  • New Event Argument Wrapper:
    • IWebView2NavigationStartingEventArgs:
      • Uri: [Property] The target URL.
      • Cancel: [Property] Get/Set boolean to cancel the navigation.
      • IsUserInitiated: [Property] Indicates if the navigation was user-triggered.
      • IsRedirected: [Property] Indicates if it's a redirect.
      • NavigationId: [Property] Unique identifier for the navigation.

v2.1.0-alpha

Choose a tag to compare

@ioa747 ioa747 released this 23 Feb 19:07
c205bf7

Version 2.1.0-alpha

Frame Object Enrichment & Permission Events

This release enriches the WebView2Frame COM object and adds page-level permission handling.

  • New Frame Properties (IWebView2Frame):

    • FrameId: (DispId 9) [Property] Returns the unique identifier of the frame (assigned by the browser).
    • Source: (DispId 10) [Property] Returns the current URL of the frame. Uses reflection-based SDK-independent retrieval.
  • New Manager Method (WebView2Manager):

    • GetFrameById(frameId): (DispId 230) [Method] Returns a WebView2Frame COM object matching the specified FrameId. Returns Null if not found.
  • New Events:

    • OnPermissionRequested: (DispId 239) [Event] Fired when the page requests a permission (Geolocation, Camera, Microphone, etc.). Provides PermissionKind, State, Uri, IsUserInitiated, Handled, and deferral support via GetDeferral()/Complete().
    • OnFramePermissionRequested: (DispId 238) [Event] Frame-level variant of the above, also passes the IWebView2Frame object.
  • Frame Event DispId Assignments:

    • OnFrameCreated (234), OnFrameDestroyed (235), OnFrameNameChanged (236), OnFramePermissionRequested (238).

v2.0.0-stable

Choose a tag to compare

@ioa747 ioa747 released this 17 Feb 07:54
c806300

Current Version: Version 2.0.0-stable


Patch: Enriched Verbose Logging

Diagnostic Visibility & Traceability

This patch significantly enhances the Verbose diagnostic mode with a new format and comprehensive event logging.

  • New Log Format: Introduced a high-visibility prefix and instance tracking.
    • Format: +++[NetWebView2Lib][HANDLE:0x...][HH:mm:ss.fff] Message
    • Traceability: The ParentWindowHandle is now included in every log line, allowing developers to distinguish logs between multiple concurrent WebView2 instances.
  • Enriched Event Logging: Added diagnostic traces to all critical lifecycle events:
    • Navigation: NavigationStarting (Target URI), NavigationCompleted (Success/Error Status), SourceChanged (New URL).
    • Interaction: ContextMenuRequested (Location & Target Kind), WebMessageReceived (Raw payload).
    • Networking: WebResourceRequested (URI & Context), WebResourceResponseReceived (Status Code & Reason), BasicAuthenticationRequested (URI).
    • State: GotFocus, LostFocus (including True vs. Internal check), ProcessFailed (Kind & Reason), NewWindowRequested (Target URI).
  • API Method Logging: Added traces for key API calls:
    • Navigate, ExecuteScript (with content truncation), PostWebMessage.
    • AddExtension, RemoveExtension (with Path/ID logging).
  • Default Folder Sync: Renamed the default failure report folder from Crashes to FailureReportFolder to align with official WebView2 parameter naming conventions.
  • Indentation & Integrity: Standardized the logging calls within event lambdas to maintain clean source code.

Patch: Compiler Scope & Null Check Optimization

Maintenance & Code Health

  • Fixed CS0136: Resolved variable redeclaration scope conflicts in the WebResourceResponseReceived event handler.
  • Improved Null Safety: Refactored the response handler to proactively check for e.Response availability, preventing potential exceptions.
  • Simplified Cleanup (IDE0031): Implemented the null-conditional operator (?.) in the Cleanup() method for more concise and modern C# syntax.

Version 2.0.0-stable

COM Standardizing & Consistency (Major Release)

This release establishes a consistent naming convention for COM objects while ensuring 100% backward compatibility for legacy scripts.

  • Standardized Naming (Architecture):
    • Renamed internal classes and ProgIDs to follow the NetWebView2Lib.WebView2{Subsystem} pattern.
    • WebView2Manager: New ProgID NetWebView2Lib.WebView2Manager (formerly NetWebView2.Manager).
    • WebView2Bridge: New ProgID NetWebView2Lib.WebView2Bridge (formerly NetWebView2Lib.WebViewBridge).
    • WebView2Parser: New ProgID NetWebView2Lib.WebView2Parser (formerly NetJson.Parser).
  • Compatibility Layer:
    • Implemented inheritance-based compatibility. Creating objects using old ProgIDs still works perfectly but uses the new logic internally.
  • AutoIt UDF Sync:
    • NetWebView2Lib.au3 updated to use the new standardized ProgIDs by default. This ensures that ObjName() reports the consistent professional naming for new projects using the UDF.
  • Project Structure:
    • Renamed C# core files for consistency: WebView2Manager.cs, WebView2Bridge.cs, WebView2Parser.cs.
  • IFrame HTML Extraction: High-performance extraction of HTML from cross-origin iframes.
  • SDK Resilience (Reflection): Added reflection-based fallback for CoreWebView2Frame.Uri to maintain compatibility across different WebView2 SDK versions.
  • SDK Locking Policy (Standardization):
    • NuGet Version: Locked to 1.0.2739.15 (Release Date: August 26, 2024).
    • Rationale: This version ensures maximum compatibility across the "Evergreen" cycle on most Windows installations while providing all necessary features (Frames, Basic Auth, Process Failure events).
    • Runtime Requirement: Requires WebView2 Runtime 128.0.2739.15 or higher.
    • Runtime Validation: Register_web2.au3 now performs a strict check for the minimum required runtime version.
  • DispId Normalization: Resolved DispId conflict for Verbose mode (now DispId 228).

v2.0.0-beta.3

Choose a tag to compare

@ioa747 ioa747 released this 12 Feb 01:38
5394db1

Version 2.0.0-beta.3

Refactoring & Keyboard Logic

  • AcceleratorKeyPressed Expansion:
    • Added PhysicalKeyStatus properties to IWebView2AcceleratorKeyPressedEventArgs: RepeatCount, ScanCode, IsExtendedKey, IsMenuKeyDown, WasKeyDown, IsKeyReleased.
    • Flattened the CoreWebView2PhysicalKeyStatus struct for direct COM/AutoIt access.
  • Code Modularity:
    • Extracted WebView2AcceleratorKeyPressedEventArgs into its own standalone file (WebView2AcceleratorKeyPressedEventArgs.cs).
    • Cleaned up WebViewManager.cs by removing 150+ lines of embedded argument logic.
  • Build & Alignment:
    • Updated .csproj for modular file support.
    • Resolved int-to-bool casting issues for keyboard state fields.

Version 2.0.0-beta.2

COM Version Exposure & Stabilization

This update focuses on developer productivity by exposing the DLL version directly to COM and establishing a central version utility.

Added (C# Core)

  • .version Property:
    • DispId 224 (WebViewManager)
    • DispId 2 (WebViewBridge)
    • DispId 230 (JsonParser)
    • Allows AutoIt to verify the DLL version at runtime for compatibility checks.
  • AssemblyUtils Detector:
    • New internal utility to retrieve AssemblyInformationalVersion from metadata.
  • Advanced Handle Formatting ([HANDLE:0x...]):
    • Pivoted all handle-returning strings to the [HANDLE:0x...] format for out-of-the-box AutoIt compatibility with WinExists, WinMove, etc.
  • New Properties:
    • ParentWindowHandle (DispId 229): Returns the handle provided during initialization in Advanced format.
  • New Events:
    • OnProcessFailed (DispId 225): Detailed crash/failure reporting.
    • OnBasicAuthenticationRequested (DispId 228): Handles browser-level auth prompts.

v2.0.0-beta.1

Choose a tag to compare

@ioa747 ioa747 released this 10 Feb 03:48
77e1afd

Version 2.0.0-beta.1

Multi-Instance & Sender-Aware Architecture

This major version introduces breaking changes to support professional multi-instance applications by making all COM events "Sender-Aware".

Changed (C# Core)

  • Sender-Aware Events:
    • All events now include the parameters (object sender, object parentHandle, ...) to allow AutoIt to distinguish which instance fired the event.
  • Architecture Refactor:
    • WebViewBridge now holds a "Sealed" context linked to its specific WebViewManager and parent HWND.
  • Pre-emptive Key Blocking (Stability Phase):
    • Abandoned Sync-Wait Loop: Removed the legacy approach of waiting for AutoIt's Handled = True in OnAcceleratorKeyPressed via a poll loop. This was causing intermittent COM deadlocks and re-entrancy issues.
    • Synchronous Veto: Replaced with BlockedVirtualKeys property. Blocking is now performed immediately in C# based on a pre-defined list, ensuring 100% reliability for keys like F5 and F12.
  • Internal Messaging Overlay:
    • InternalPushMessage: Implemented a secondary messaging layer to handle internal state updates and events that require UI-thread marshalling without triggering external COM event floods.

Added (C# Core)

  • BrowserWindowHandle: (222) [Property] Exposes the internal window handle (HWND) of the WebView2 control as a COM-friendly object. Allows users to perform native Win32 operations (like SendMessage or custom subclassing) directly on the browser window.
  • OnAcceleratorKeyPressed Restoration: (221) [Event] Restored functionality using Reflection to access the internal CoreWebView2Controller.
  • BlockedVirtualKeys: (223) [Property] Allows defining a comma-separated list of VK codes to be blocked synchronously and pre-emptively by the C# core, bypassing COM sync issues.

v1.5.0

Choose a tag to compare

@ioa747 ioa747 released this 30 Jan 16:07
3b62443

Version 1.5.0

Advanced Networking & Download Management

This update introduces deep integration with Chromium's networking layer and programmatic control over the download lifecycle.

Added

  • HTTP Status Code Tracking (DispId 5):
    • OnWebResourceResponseReceived(statusCode, reasonPhrase, requestUrl): [Event] Captures the HTTP status code for every resource request (e.g., 404, 500), enabling precise error handling in AutoIt.
    • HttpStatusCodeEventsEnabled: (195) [Property] Master switch to enable or disable the status code event entirely.
    • HttpStatusCodeDocumentOnly: (196) [Property] Filters status code events to only trigger for the main document (Default: True). This prevents event floods that cause GUI deadlocks in AutoIt.
  • Custom Download Management (DispIds 204 - 211):
    • SetDownloadPath(path): (204) [Method] Forces downloads to a specific folder or file. If a directory is provided, the filename is automatically appended.
    • IsDownloadUIEnabled: (205) [Property] Control visibility of the browser's download bubble.
    • OnDownloadStarting: (208) [Event] Intercepts downloads. Features a simplified contract (URI, DefaultPath). Overrides are now handled via dedicated properties/methods (SetDownloadPath, IsDownloadHandled).
    • OnDownloadStateChanged: (209) [Event] Real-time progress (bytes) and state updates.
    • CancelDownloads(uri): (210) [Method] Cancels downloads. If uri is empty or omitted, cancels all active downloads.
    • IsDownloadHandled: (211) [Property] Set to True during OnDownloadStarting to suppress the default download UI.
    • ActiveDownloadsList: (214) [Property] Returns a pipe-separated string of all active download URIs.
  • Enhanced Export & Snapshot Engine (DispIds 201, 207):
    • CaptureSnapshot(cdpParameters): (201) [Method] Direct access to CDP snapshots (e.g., MHTML).
    • ExportPageData(format, filePath): (207) [Method] Simplified HTML/MHTML export. Note: Moved to DispId 207 to distinguish from raw CDP snapshots.
  • Binary Data Support:
    • DecodeB64ToBinary(base64Text): (206) [Method] Decodes Base64 to raw byte arrays (binary).
  • Manual Download Mode: Added logic to DownloadStarting that checks IsDownloadHandled. If set to True by AutoIt during the event wait loop, the native Edge download is cancelled (e.Cancel = true), allowing AutoIt to handle the download externally (e.g., via InetGet).
  • Download Sync-Wait: A 600ms synchronization loop ensures that property changes in AutoIt are correctly picked up by C# before the download proceeds or is cancelled.
  • UnLockWebView Method: Added UnLockWebView() (215) to re-enable restricted features previously disabled by LockWebView().
  • Zoom Control: Added IsZoomControlEnabled (212) [Property] specify if zoom (Ctrl+Wheel) is enabled.
  • Scrollbar Control: Added IsScrollbarEnabled (213) [Property] Toggle scrollbars via CSS overflow injection.

Fixed

  • Smart Auto-Fill: Updated Initialize to automatically calculate initial parent dimensions when 0 width/height are provided. Note: Dynamic resizing remains disabled unless $oWeb.SetAutoResize(True) is called explicitly.
  • Naming Consistency: Standardized method names (e.g., CaptureSnapshot) across C# and COM interfaces.
  • Build Efficiency: Resolved IDE warnings (CS0067) and unnecessary #pragma directives.
  • GUI Deadlock (HttpStatusCode): Fixed a critical issue where an flood of 404 resource responses for sub-elements (images, CSS, scripts) would overwhelm the AutoIt event loop, causing the GUI to freeze. Added robust tracking to ensure these events are filtered to the main document by default.
  • Download Race Condition Fix: Added Application.DoEvents() to the OnDownloadStarting event to ensure AutoIt property overrides (DownloadResultPath, IsDownloadHandled) are synchronized correctly before the download begins.
  • Automatic Directory Creation: Implemented automatic folder creation for custom download paths if the target directory does not exist.
  • Event Fixes: Wired up the OnZoomChanged event to correctly trigger when the browser zoom level is modified.

v1.4.3

Choose a tag to compare

@ioa747 ioa747 released this 20 Jan 14:22
184c3a9

Version 1.4.3 - (2026-01-20)

COM Robustness & Performance

This update focuses on deepening COM compatibility and resolving assembly discovery issues in AutoIt, along with specialized scraping tools for the main showcase.

Fixed

  • COM Event Discovery (0x80028017): Resolved the "Field name not defined" error in AutoIt by explicitly requiring the 3rd parameter in ObjEvent for .NET-exported interfaces. Documented the necessity of interface names (e.g., IWebViewEvents) for reliable connection point binding.
  • Smart AutoResize (Dynamic Margins): Refined SetAutoResize to automatically calculate margins based on the width and height passed to Initialize. This allows users to request absolute sizes (e.g., leaving a specific gap for a status bar) and have those gaps preserved naturally as the parent window resizes.

Added

  • Additional Browser Arguments (DispId 100):
    • Added AdditionalBrowserArguments property. Allows passing command-line switches (e.g., --disable-gpu, --mute-audio, --proxy-server="...") to the Chromium engine. Note: This must be set before calling Initialize().
  • Advanced JSON Manipulation (JsonParser) (DispIds 225 - 228):
    • GetTokenCount(path): (225) Returns the count of array items or object properties.
    • GetKeys(path, delimiter): (226) Returns a delimited string of all property names for an object.
    • SortArray(path, key, desc): (227) Sorts a JSON array in-place based on a specific key.
    • SelectUnique(path, key): (228) Removes duplicates from a JSON array based on a key's value.
  • Advanced Export & PDF Management (DispIds 201 - 203):
    • ExportPageData(format, filePath): (201) Saves the current page as HTML (0) or MHTML (1). The MHTML snapshots are captured via CDP and parsed natively. Supports returning content as a string if filePath is empty.
    • PrintToPdfStream(): (202) Captures the page as a PDF and returns a Base64 string directly to AutoIt, eliminating temporary file requirements.
    • HiddenPdfToolbarItems: (203) [Property] Bitwise control for the PDF viewer's toolbar (e.g., hiding print/save buttons).

Changed

  • Interface Protocol (Dual Binding): Upgraded IWebViewActions and IJsonParser to InterfaceIsDual. This enables support for both Early Binding (performance) and Late Binding (flexibility) simultaneously, improving overall stability in diverse COM environments.
  • SetTokenValue (JsonParser) Upgrade: Now supports Deep Creation (automatic creation of parent objects) and Smart Typing (automatic conversion of "true", "false", "null" and numbers, while preserving leading zeros in strings like "0123").
  • WebViewManager.cs Reorganization: Completely restructured the 1500+ line class into 17 logical regions for better IDE maintainability and code folding.
  • GetArrayLength (JsonParser): Refactored to internally use the more robust GetTokenCount logic.