Skip to content

Conversation

@jinzhongjia
Copy link
Member

…, and secure communication demos

  • introduce advanced_window example with window controls and info
  • add browser_profiles example for managing browser profiles and info
  • provide error_handling example demonstrating error reporting and recovery
  • add secure_communication example for encoding, binary transfer, and memory management
  • update win32GetHwnd for improved pointer handling on Windows
…, and secure communication demos - introduce advanced_window example with window controls and info - add browser_profiles example for managing browser profiles and info - provide error_handling example demonstrating error reporting and recovery - add secure_communication example for encoding, binary transfer, and memory management - update win32GetHwnd for improved pointer handling on Windows
@jinzhongjia jinzhongjia requested a review from Copilot August 7, 2025 15:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces comprehensive advanced example applications demonstrating WebUI's enhanced capabilities for window management, browser profiles, error handling, and secure communication, along with an improvement to pointer handling on Windows.

  • Adds four new advanced example applications showcasing different WebUI features
  • Improves Windows pointer handling in the win32GetHwnd method
  • Provides comprehensive demonstrations of error handling, encoding, browser management, and window controls

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/webui.zig Updates Windows HWND pointer handling to use optional capture syntax
examples/secure_communication/main.zig Implements secure communication example with encoding, binary transfer, and memory management
examples/secure_communication/index.html Provides UI for testing encoding/decoding and binary data transfer features
examples/error_handling/main.zig Demonstrates comprehensive error handling patterns throughout WebUI operations
examples/error_handling/index.html Interactive UI for testing various error scenarios and recovery mechanisms
examples/browser_profiles/main.zig Shows browser profile management and browser detection capabilities
examples/browser_profiles/profile.html Simple test page for demonstrating profile isolation
examples/browser_profiles/index.html Main UI for browser profile management and information display
examples/advanced_window/main.zig Comprehensive window control functionality including positioning, sizing, and system integration
examples/advanced_window/index.html Advanced UI with controls for all window management features
Comments suppressed due to low confidence (1)

examples/error_handling/main.zig:18

  • Function name has a typo: isHighConstrast should be isHighContrast (missing 'n').
 _ = try window.bind("test_encode_error", testEncodeError); 
Comment on lines +461 to +462
if (tmp_hwnd) |hwnd| {
return @ptrCast(hwnd);
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

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

[nitpick] The variable name hwnd shadows the outer scope variable name tmp_hwnd. Consider using a different name like valid_hwnd to improve clarity.

Suggested change
if (tmp_hwnd) |hwnd| {
return @ptrCast(hwnd);
if (tmp_hwnd) |valid_hwnd| {
return @ptrCast(valid_hwnd);
Copilot uses AI. Check for mistakes.
// Fill buffer with test data
const test_data = "This is test data for memory management";
const copy_len = @min(test_data.len, buffer.len);
webui.memcpy(buffer[0..copy_len], test_data[0..copy_len]);
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

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

Using webui.memcpy instead of Zig's standard @memcpy is inconsistent with the pattern used elsewhere in the file (line 44, 67). Consider using @memcpy for consistency.

Suggested change
webui.memcpy(buffer[0..copy_len], test_data[0..copy_len]);
@memcpy(buffer[0..copy_len], test_data[0..copy_len]);
Copilot uses AI. Check for mistakes.
};
defer webui.free(buffer2);

webui.memcpy(buffer2[0..copy_len], buffer[0..copy_len]);
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

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

Using webui.memcpy instead of Zig's standard @memcpy is inconsistent with the pattern used elsewhere in the file. Consider using @memcpy for consistency.

Suggested change
webui.memcpy(buffer2[0..copy_len], buffer[0..copy_len]);
@memcpy(buffer2[0..copy_len], buffer[0..copy_len]);
Copilot uses AI. Check for mistakes.
@AlbertShown
Copy link
Member

…, and secure communication demos

  • introduce advanced_window example with window controls and info
  • add browser_profiles example for managing browser profiles and info
  • provide error_handling example demonstrating error reporting and recovery
  • add secure_communication example for encoding, binary transfer, and memory management
  • update win32GetHwnd for improved pointer handling on Windows

Is this PR a draft?

@jinzhongjia
Copy link
Member Author

yes, this pr is a draft

@AlbertShown AlbertShown marked this pull request as draft August 8, 2025 15:07
@jinzhongjia
Copy link
Member Author

Many examples can only be built and passed, but the test has not been completed yet, so I need more tests

@AlbertShown
Copy link
Member

Understood, take your time @jinzhongjia

- add version checks to support managed and unmanaged ArrayList initialization - update user append logic to handle allocator parameter for Zig 0.16+ - ensure event handling example works across Zig 0.14, 0.15, and 0.16+
- update CI configuration to test against Zig 0.15.1 - ensure compatibility across multiple Zig versions
- update ArrayList compatibility logic to support Zig 0.15+ - adjust version checks from 0.16 to 0.15 for managed/unmanaged ArrayList - update webui dependency to latest commit in build.zig.zon
- update window icon to use raw SVG string instead of base64 - refine window hide/show logic to use minimize/maximize for better UX - replace window.destroy with window.close for proper resource management - add missing charset meta tag and webui.js script to HTML
- include webui.js in index.html to enable proper functionality - ensure browser_profiles example loads required scripts
- delete error_handling and secure_communication example directories - remove related Zig and HTML files for both demos
- delete browser_profiles example including HTML and Zig files - remove profile management and browser detection sample code
@jinzhongjia jinzhongjia marked this pull request as ready for review August 24, 2025 14:20
@jinzhongjia jinzhongjia merged commit a55153c into main Aug 24, 2025
20 checks passed
@jinzhongjia jinzhongjia deleted the more_example branch November 16, 2025 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants