Skip to content

cleanup(webview): drop trivial DEBUG-only overrides in LoggingWebChromeClient (#422)#805

Open
jim-daf wants to merge 2 commits intoAwful:developfrom
jim-daf:cleanup/issue-422-drop-trivial-debug-overrides
Open

cleanup(webview): drop trivial DEBUG-only overrides in LoggingWebChromeClient (#422)#805
jim-daf wants to merge 2 commits intoAwful:developfrom
jim-daf:cleanup/issue-422-drop-trivial-debug-overrides

Conversation

@jim-daf
Copy link
Copy Markdown

@jim-daf jim-daf commented Apr 25, 2026

Closes #422.

The issue raises the question of whether the trivial DEBUG-only overrides in LoggingWebChromeClient (onCloseWindow, onCreateWindow, onJsTimeout) earn their keep. They each exist solely to call Log.d then forward to super. The author leaned toward dropping them until there is an actual bug to chase. This PR does that and also removes the now-unused android.os.Message import.

onConsoleMessage, onShowCustomView, and onHideCustomView stay as-is because they actually do work.

-    @CallSuper
-    @Override
-    public void onCloseWindow(WebView window) {
-        super.onCloseWindow(window);
-        if (DEBUG) Log.d(TAG, "onCloseWindow");
-    }
-
-    @CallSuper
-    @Override
-    public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
-        if (DEBUG)
-            Log.d(TAG, "onCreateWindow" + (isDialog ? " isDialog" : "") + (isUserGesture ? " isUserGesture" : ""));
-        return super.onCreateWindow(view, isDialog, isUserGesture, resultMsg);
-    }
-
-    @CallSuper
-    @Override
-    public boolean onJsTimeout() {
-        if (DEBUG) Log.d(TAG, "onJsTimeout");
-        return super.onJsTimeout();
-    }

If anyone wants this logging back later, the methods are five lines and trivial to restore.

@jim-daf jim-daf marked this pull request as ready for review April 25, 2026 19:25
Copilot AI review requested due to automatic review settings April 25, 2026 19:25
Copy link
Copy Markdown

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

Removes trivial DEBUG-only WebChromeClient overrides that only logged and forwarded to super, reducing log spam and dead code in LoggingWebChromeClient.

Changes:

  • Deleted DEBUG-only overrides: onCloseWindow, onCreateWindow, and onJsTimeout
  • Kept non-trivial overrides (onConsoleMessage, custom view handling) intact

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 40 to 41
this.webView = webView;
}
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

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

After removing the onCreateWindow(..., Message resultMsg) override, the android.os.Message import becomes unused (and the PR description mentions it should be removed). Please delete that import so the file stays clean and matches the PR description.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code style / logging

2 participants