Skip to content

Commit 4d3bb2e

Browse files
authored
PIR: Fix shared webview being destroyed in PIR debug runs (duckduckgo#7755)
Task/Issue URL: https://app.asana.com/1/137249556945/task/1212923242657599 ### Description Shared WebView that is passed to a PIR runner was destroyed between jobs. This delegates the cleanup to the owner of the WebView (activity) instead of to the runner. ### Steps to test this PR QA optional - can run debug scans or opt-outs ### UI changes No UI changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Small, debug-only control-flow change that avoids calling runner cleanup which destroys the shared WebView; low blast radius outside debug runs. > > **Overview** > Prevents PIR *debug* scan/opt-out flows from destroying the caller-provided (shared) `WebView` between sequential steps. > > In `RealPirScan.debugExecute` and `RealPirOptOut.debugExecute`, removes the per-step `runners[0].stop()` call (with an explanatory comment), leaving WebView lifecycle/cleanup to the debug WebView owner while still cleaning WebView data at the end of the run. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a3343a9. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 4d52ad5 commit 4d3bb2e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/optout/PirOptOut.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ class RealPirOptOut @Inject constructor(
307307
allSteps.forEach { (profileQuery, step) ->
308308
logcat { "PIR-OPT-OUT: Start thread=${Thread.currentThread().name}, profile=$profileQuery and step=$step" }
309309
runners[0].startOn(webView, profileQuery, listOf(step))
310-
runners[0].stop()
310+
// don't call stop() here to avoid destroying the WebView as it's reused for all steps
311311
logcat { "PIR-OPT-OUT: Finish thread=${Thread.currentThread().name}, profile=$profileQuery and step=$step" }
312312
}
313313

pir/pir-impl/src/main/java/com/duckduckgo/pir/impl/scan/PirScan.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class RealPirScan @Inject constructor(
235235
allSteps.forEach { (profileQuery, step) ->
236236
logcat { "PIR-SCAN: Start thread=${Thread.currentThread().name}, profile=$profileQuery and step=$step" }
237237
runners[0].startOn(webView, profileQuery, listOf(step))
238-
runners[0].stop()
238+
// don't call stop() here to avoid destroying the WebView as it's reused for all steps
239239
logcat { "PIR-SCAN: Finish thread=${Thread.currentThread().name}, profile=$profileQuery and step=$step" }
240240
}
241241

0 commit comments

Comments
 (0)