Conversation
WalkthroughThis PR adds support for JavaScript profiling configuration across the Capacitor Android platform. A new Changes
Sequence DiagramsequenceDiagram
actor Init as Initialization
participant Config as CapConfig
participant Bridge as Bridge
participant WebServer as WebViewLocalServer
participant PathHandler as PathHandler
Init->>Config: Read jsProfilingEnabled from config
Config-->>Init: Return jsProfilingEnabled (bool)
Init->>Bridge: Initialize with config
Bridge->>Config: Call isJsProfilingEnabled()
Config-->>Bridge: Return jsProfilingEnabled value
Bridge->>WebServer: new WebViewLocalServer(..., jsProfilingEnabled)
alt jsProfilingEnabled == true
WebServer->>WebServer: Create customHeaders<br/>with Document-Policy: js-profiling
WebServer->>PathHandler: Initialize with customHeaders
else jsProfilingEnabled == false
WebServer->>PathHandler: Initialize without customHeaders
end
PathHandler-->>WebServer: PathHandler ready
WebServer-->>Bridge: WebViewLocalServer initialized
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes The changes follow a straightforward pattern for adding a configuration feature flag: new field with getter/setter, Builder integration, JSON deserialization, and conditional header injection. All modifications are consistent and boilerplate-oriented with no complex logic or interdependencies requiring special attention. Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
android/capacitor/src/main/java/com/getcapacitor/CapConfig.java (1)
57-57:jsProfilingEnabledconfig flag is consistently wired through CapConfig and Builder
- The new
jsProfilingEnabledfield, its JSON deserialization fromandroid.jsProfilingEnabled, theisJsProfilingEnabled()getter, and the Builder field +setJsProfilingEnabled(boolean)are all consistent and default tofalse.- This matches the CLI config surface (
android.jsProfilingEnabled) and howBridge/WebViewLocalServerconsume the flag.Looks good as‑is; just ensure this new option is reflected in any external configuration docs or release notes you maintain.
Also applies to: 185-185, 291-291, 388-390, 592-592, 697-700
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
android/capacitor/src/main/java/com/getcapacitor/Bridge.java(1 hunks)android/capacitor/src/main/java/com/getcapacitor/CapConfig.java(6 hunks)android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java(3 hunks)cli/src/declarations.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
android/capacitor/src/main/java/com/getcapacitor/CapConfig.java (1)
android/capacitor/src/main/java/com/getcapacitor/util/JSONUtils.java (1)
JSONUtils(10-166)
🪛 GitHub Actions: CI
android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
[error] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues in this file.
🔇 Additional comments (3)
cli/src/declarations.ts (1)
300-310: AndroidjsProfilingEnabledconfig surface and docs look consistentThe new
android.jsProfilingEnabled?: booleanflag and its documentation align with the native config key and behavior (toggling theDocument-Policy: js-profilingheader). Just make sure the@since 8.0.0tag matches the actual release version for this branch.android/capacitor/src/main/java/com/getcapacitor/Bridge.java (1)
275-277: Clean propagation ofjsProfilingEnabledintoWebViewLocalServerUsing
config.isJsProfilingEnabled()here and passing it to the extendedWebViewLocalServerconstructor is consistent with the new config plumbing and preserves existing behavior when the flag is left at its defaultfalse.android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java (1)
66-67: Based on my verification, I can now provide the rewritten review comment:
jsProfilingEnabledwiring and header injection are correct; fix Prettier formatting for Java filesThe new
jsProfilingEnabledflag is properly threaded throughWebViewLocalServer's constructor (line 137) and correctly used increateHostingDetails()to conditionally addDocument-Policy: js-profilingto response headers when enabled. The single instantiation inBridge.java:276uses the correct 6-argument signature. Default behavior remains unchanged when disabled.Action required:
The CI lint job runs Prettier on Java files via
prettier-plugin-java. Runnpm run fmtto auto-format all files, or specifically:npm run prettier -- --write android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
Test PR creation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.