bump
This commit is contained in:
110
ZOOM_TEST_BUG_FIX.md
Normal file
110
ZOOM_TEST_BUG_FIX.md
Normal file
@@ -0,0 +1,110 @@
|
||||
# Zoom Test Bug Fix
|
||||
|
||||
## Issue Summary
|
||||
|
||||
**Bug**: The `web_zoom_test_cremotemcp` tool was failing with JSON parsing errors:
|
||||
```
|
||||
Error: invalid character 'm' looking for beginning of value
|
||||
```
|
||||
|
||||
**Root Cause**: Unreachable code in the JavaScript evaluation function in `daemon/daemon.go` at line 9375.
|
||||
|
||||
## Technical Details
|
||||
|
||||
### The Problem
|
||||
|
||||
In the `testZoom` function in `daemon/daemon.go` (lines 9312-9376), the JavaScript code had a duplicate return statement:
|
||||
|
||||
```javascript
|
||||
return {
|
||||
viewport_width: window.innerWidth,
|
||||
viewport_height: window.innerHeight,
|
||||
has_horizontal_scroll: hasHorizontalScroll,
|
||||
content_width: contentWidth,
|
||||
content_height: contentHeight,
|
||||
visible_elements: visibleCount,
|
||||
overflowing_elements: overflowingCount,
|
||||
text_readable: textReadable,
|
||||
min_font_size: minFontSize
|
||||
};
|
||||
return JSON.stringify(result); // ← UNREACHABLE CODE - BUG
|
||||
```
|
||||
|
||||
The second `return JSON.stringify(result);` statement was:
|
||||
1. **Unreachable** - came after a valid return statement
|
||||
2. **Referenced undefined variable** - `result` doesn't exist in that scope
|
||||
3. **Caused malformed output** - the JavaScript engine likely returned undefined or threw an error
|
||||
|
||||
This resulted in the Go code receiving malformed data that couldn't be parsed as JSON, causing the error message about invalid character 'm'.
|
||||
|
||||
### The Fix
|
||||
|
||||
**File**: `daemon/daemon.go`
|
||||
**Line**: 9375 (removed)
|
||||
|
||||
Removed the unreachable `return JSON.stringify(result);` statement. The JavaScript now correctly returns the object directly, which the Go code can properly parse.
|
||||
|
||||
### Fixed Code
|
||||
|
||||
```javascript
|
||||
return {
|
||||
viewport_width: window.innerWidth,
|
||||
viewport_height: window.innerHeight,
|
||||
has_horizontal_scroll: hasHorizontalScroll,
|
||||
content_width: contentWidth,
|
||||
content_height: contentHeight,
|
||||
visible_elements: visibleCount,
|
||||
overflowing_elements: overflowingCount,
|
||||
text_readable: textReadable,
|
||||
min_font_size: minFontSize
|
||||
};
|
||||
// Removed: return JSON.stringify(result);
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
### Build Verification
|
||||
```bash
|
||||
cd mcp && go build -o cremote-mcp
|
||||
```
|
||||
✅ Build successful - no compilation errors
|
||||
|
||||
### Binary Created
|
||||
```
|
||||
-rwxrwxr-x 1 squash squash 9.8M Oct 2 13:04 cremote-mcp
|
||||
```
|
||||
|
||||
## Impact
|
||||
|
||||
This fix resolves the zoom test functionality, which is critical for WCAG 1.4.4 and 1.4.10 compliance testing:
|
||||
- **WCAG 1.4.4**: Resize text - Users must be able to zoom text to 200% without loss of content or functionality
|
||||
- **WCAG 1.4.10**: Reflow - Content must reflow at 400% zoom without horizontal scrolling
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Deploy** the updated MCP binary to the container
|
||||
2. **Restart** the cremote daemon to load the new binary
|
||||
3. **Resume** the ADA Level AA assessment of https://visionleadership.org
|
||||
4. **Verify** zoom test now works correctly at 100%, 200%, and 400% zoom levels
|
||||
|
||||
## Related Files
|
||||
|
||||
- `daemon/daemon.go` - Main fix location (line 9375 removed)
|
||||
- `mcp/main.go` - MCP server tool registration (lines 3793-3890)
|
||||
- `client/client.go` - Client-side zoom test interface (lines 3599-3648)
|
||||
|
||||
## Commit Message Suggestion
|
||||
|
||||
```
|
||||
fix: Remove unreachable return statement in zoom test JavaScript
|
||||
|
||||
The testZoom function had an unreachable `return JSON.stringify(result);`
|
||||
statement after the main return, causing JSON parsing errors. This resulted
|
||||
in "invalid character 'm' looking for beginning of value" errors when
|
||||
attempting to parse the zoom test results.
|
||||
|
||||
Fixes zoom test functionality for WCAG 1.4.4 and 1.4.10 compliance testing.
|
||||
|
||||
File: daemon/daemon.go, line 9375
|
||||
```
|
||||
|
||||
@@ -9372,7 +9372,6 @@ func (d *Daemon) testZoom(tabID string, zoomLevels []float64, timeout int) (*Zoo
|
||||
text_readable: textReadable,
|
||||
min_font_size: minFontSize
|
||||
};
|
||||
return JSON.stringify(result);
|
||||
}`
|
||||
|
||||
var jsResult *proto.RuntimeRemoteObject
|
||||
|
||||
Reference in New Issue
Block a user