You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: prevent CSS commands from hanging connection through iwdp Target routing
CSS.enable, CSS.getAllStyleSheets, and CSS.getStyleSheetText hang without
a response when sent through iwdp Target routing, corrupting the
connection pipeline for all subsequent commands. Added IsTargetRouted()
guard that returns an error immediately instead of sending the command.
Also fixes simulator e2e tests to be self-contained (not dependent on
DOM state from prior tests) and corrects Console.setLoggingChannelLevel
to use valid WebKit levels (off/basic/verbose instead of none/all).
Copy file name to clipboardExpand all lines: CLAUDE.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,11 +50,11 @@ iwdp → Client
50
50
51
51
### Domain Enable/Disable Through Target Routing
52
52
53
-
Many`<Domain>.enable`/`<Domain>.disable` methods (DOM.enable, CSS.enable) return "not found" through iwdp Target routing. However, the actual domain methods (DOM.getDocument, CSS.getMatchedStylesForNode, Runtime.evaluate) work without explicit enabling. Don't require `.enable` calls as a prerequisite.
53
+
Some`<Domain>.enable` methods work through iwdp Target routing (e.g., `Debugger.enable`, `Canvas.enable`, `Worker.enable`, `Animation.enable`). Others like `CSS.enable` hang without a response. Most actual domain methods (DOM.getDocument, CSS.getMatchedStylesForNode, CSS.getComputedStyleForNode, CSS.setStyleText, Runtime.evaluate) work without explicit enabling.
54
54
55
55
### Known Limitations
56
56
57
-
-`CSS.getAllStyleSheets` — exists in the WebKit protocol spec but requires `CSS.enable` first, which doesn't work through iwdp Target routing. Skipped in tests.
57
+
-`CSS.enable`, `CSS.getAllStyleSheets`, `CSS.getStyleSheetText` hang through iwdp Target routing. The command is sent but no response comes back, and the hang corrupts the connection pipeline (all subsequent commands on the same connection will also hang). The tool implementations detect Target routing and return an error immediately instead.
58
58
-`Page.snapshotRect` requires explicit pixel dimensions — compute them first via `Runtime.evaluate` (see `TakeScreenshot` in page.go).
59
59
- Only **one WebSocket debugger connection per page** — simulator tests use a `sync.Once` shared connection pattern.
60
60
- iwdp sends error `data` as a JSON array `[{"code":...,"message":...}]` — `ErrorData.Data` is `json.RawMessage` to handle this.
@@ -93,7 +93,7 @@ Two binaries, one shared `internal/` package tree:
93
93
- gorilla/websocket is not concurrent-write-safe — `Client.writeMu` mutex protects `conn.WriteMessage`
94
94
- E2E simulator tests share a single WebSocket connection via `sync.Once` (`getSimClient` in `e2e/sim_helpers_test.go`) — never create multiple connections to the same page
95
95
- Use `simOrigin()` helper to get the page's actual origin for storage tests — never hardcode origins
96
-
- Almost never use `t.Skipf`/`t.Skip`. Use `t.Fatalf`/`t.Fatal` instead. Only skip when a feature is specifically proven unsupported (e.g., `CSS.getAllStyleSheets` through iwdp Target routing). The env-var check in `getSimClient` is the only legitimate `t.Skip` in e2e tests.
96
+
- Almost never use `t.Skipf`/`t.Skip`. Use `t.Fatalf`/`t.Fatal` instead. The env-var check in `getSimClient` is the only legitimate `t.Skip` in e2e tests.
// errCSSNotSupported is returned when CSS.enable/CSS.getAllStyleSheets/CSS.getStyleSheetText
78
+
// are called through iwdp Target routing, which hangs and corrupts the connection pipeline.
79
+
varerrCSSNotSupported=fmt.Errorf("CSS.enable/CSS.getAllStyleSheets/CSS.getStyleSheetText do not work through ios-webkit-debug-proxy Target routing (the commands hang without a response, breaking subsequent commands on the same connection)")
80
+
77
81
// GetAllStylesheets returns all stylesheets known to the page.
82
+
// Note: this requires CSS.enable which does not work through iwdp Target routing.
83
+
// When connected via iwdp, returns an error immediately to avoid hanging the connection.
0 commit comments