Skip to content

Comments

V2.1.0 alpha#108

Open
ioa747 wants to merge 6 commits intomainfrom
v2.1.0-alpha
Open

V2.1.0 alpha#108
ioa747 wants to merge 6 commits intomainfrom
v2.1.0-alpha

Conversation

@ioa747
Copy link
Owner

@ioa747 ioa747 commented Feb 23, 2026

Important

Thanks for your effort and interest 💛 in improving the project. It's very appreciated.

Description

What's New in v2.1.0-alpha - Frame Support & Event Isolation

🔗 Linked GitHub Issues

Closes #<number>

📋 What is the current behavior?

🚀 What is the new behavior?


Type of changes

  • 🪲 Bugfix (change which fixes an issue)
  • ⭐ New Feature (change which adds functionality)
  • ⭐ New Example (this PR adds a new example)
  • 🔒 Security fix (change which improves security)
  • 🔮 Code style update (formatting, renaming)
  • 🔨 Refactoring (code optimization without functional change)
  • 📚 Documentation (updates to README or docs)
  • ⚙️ Build or CI related changes
  • 🧿 Other type

Breaking changes 🔥

  • Yes
  • No

How and where was this tested?

🖥️ Describe where you tested your changes

System:

  • Windows 11 (x64)
  • Windows 10 (x64)
  • Windows 10 (x86)
  • Windows Server ......

Context:

  • COM object NetJson.Parser
  • COM object NetWebView2.Manager - WebView2
  • COM object NetWebView2.Manager - Bridge
  • UDF - NetWebView2Lib.au3
  • Examples: ...
  • with ...

🔬 Describe how you tested your changes

  • Manually tested in system and context shown above
  • Ran automatic tests (unit tests, integration tests, etc.)
  • Other ways

Checklist

  • I have read and understood the available contributing guidelines.
  • I have ensured my code follows the available code conventions.
  • I have reviewed my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • I have added/updated necessary tests to cover the changes (if applicable).
  • I have checked for potential security implications.

Additional context

Screenshots

Note to reviewers

This patch introduces first-class support for iframe interaction, allowing developers to target specific frames for script execution, messaging, and host object binding.

Key Features & Enhancements

1. Professional Frame Support (WebView2Frame)
IFrames are no longer just metadata. You can now obtain a dedicated COM object for any frame to interact with it directly.

  • GetFrame(index): returns an IWebView2Frame object.
  • Frame Methods: ExecuteScript, ExecuteScriptWithResult (Thread-Safe Sync), PostWebMessageAsJson, PostWebMessageAsString.
  • Host Object Injection: AddHostObjectToScript and RemoveHostObjectFromScript are now supported per frame.

2. Isolated Frame Events
Listen to the lifecycle of specific frames without context ambiguity.

  • Events: OnFrameNavigationStarting, OnFrameNavigationCompleted, OnFrameContentLoading, OnFrameDOMContentLoaded, OnFrameWebMessageReceived.
  • Targeting: Every event provides the frameName to facilitate multi-frame coordination.

3. Backward Compatibility Sync
The existing bulk extraction methods (GetFrameCount, GetFrameUrls, etc.) remain fully functional and synchronized with the internal frame tracker.

4. Refactoring & Structural Inheritance

The project's internal architecture has been fully reorganized to ensure long-term scalability and clean COM interoperability.

  • Logic-Based Namespacing: Files are now categorized into dedicated directories (/Core, /Events, /Interfaces, /Utils). This makes the codebase easier to navigate and ensures that the root namespace remains focused on the primary API.

  • Partial Class Implementation: The WebView2Manager is now distributed across specialized partial classes (e.g., Main, Events, FrameMgmt). This maintains a single, unified COM object for the user while keeping the source code modular and readable.

  • Inheritance-Driven Event Wrappers: We introduced BaseWebViewEventArgs, a parent class for all event wrappers. This leverages C# inheritance to streamline how data is passed to the host application.

Why this matters:

  • Standardized Metadata: Every event now automatically inherits common properties like WindowHandle and a reference to the Manager instance.

  • DRY (Don't Repeat Yourself): By using : base(manager, hwnd), we eliminated boilerplate code. Updates to core event logic (like handle formatting) now only need to be made in one place to affect all event types.

  • Developer Predictability: Whether you are handling a ZoomChanged or a NavigationStarting event, the core properties remain consistent, making the library much more intuitive for AutoIt/COM scripting.

The project has been reorganized into logical directories:

NETWEBVIEW2LIB\SRC
├───Core       Main manager logic (partial classes) and core bridge/parser.
├───Events     Standardized event argument wrappers.
├───Interfaces COM-visible interface definitions.
└───Utils      Shared utility functions and assembly helpers.

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.

1 participant