Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1040)

Issue 1018413002: [Android] Fix method invocation and wrappers cleanup handling in Java Bridge (Closed)

Created:
5 years, 9 months ago by mnaganov (inactive)
Modified:
5 years, 9 months ago
CC:
chromium-reviews, darin-cc_chromium.org, jam, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Android] Fix method invocation and wrappers cleanup handling in Java Bridge While investigating flakiness of JavaBridgeBasicsTest#testRemovalNotReflectedUntilReload I realized that we don't handle invocation of injected objects' methods properly -- InvokeMethod was bound to a GinJavaBridgeObject instance and was making two wrong assumptions: - that the method can only be called for the wrapper where the method has been obtained from -- not true, as it is possible to use `call()` method of `Function` to pass a different `this` object; - that it is safe to store an unretained pointer to GinJavaBridgeObject -- it's not, as it is possible to retain a function representing method separately from the injected object, which can be collected (if it's not a named object). The issue that was causing the test flakiness originated from the fact that DidClearWindowObject can be called several times during the page lifecycle. GinJavaBridgeDispatcher injects new wrappers each time, this isn't a problem on its own, but leads to premature issuing of wrapper deletion notificiations when the wrappers of the old generation got cleaned up. BUG=468679 Committed: https://crrev.com/9e4422ed1a5babde895ab2c101298e69338fdfc2 Cr-Commit-Position: refs/heads/master@{#321567}

Patch Set 1 #

Patch Set 2 : Added a dedicated test for attempting to call a non-existing method via `call` #

Unified diffs Side-by-side diffs Delta from patch set Stats (+222 lines, -98 lines) Patch
M content/content_renderer.gypi View 2 chunks +4 lines, -4 lines 0 comments Download
M content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeBasicsTest.java View 1 4 chunks +59 lines, -7 lines 0 comments Download
M content/renderer/BUILD.gn View 1 chunk +2 lines, -0 lines 0 comments Download
M content/renderer/java/gin_java_bridge_dispatcher.h View 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/java/gin_java_bridge_dispatcher.cc View 1 chunk +5 lines, -3 lines 0 comments Download
M content/renderer/java/gin_java_bridge_object.h View 3 chunks +0 lines, -6 lines 0 comments Download
M content/renderer/java/gin_java_bridge_object.cc View 3 chunks +5 lines, -77 lines 0 comments Download
A content/renderer/java/gin_java_function_invocation_helper.h View 1 chunk +37 lines, -0 lines 0 comments Download
A content/renderer/java/gin_java_function_invocation_helper.cc View 1 chunk +109 lines, -0 lines 0 comments Download

Messages

Total messages: 12 (4 generated)
mnaganov (inactive)
5 years, 9 months ago (2015-03-19 18:09:15 UTC) #2
Torne
LGTM in general, but I have one question: you forbid calling an injected method on ...
5 years, 9 months ago (2015-03-20 12:16:32 UTC) #3
mnaganov (inactive)
On 2015/03/20 12:16:32, Torne wrote: > LGTM in general, but I have one question: you ...
5 years, 9 months ago (2015-03-20 12:55:29 UTC) #4
mnaganov (inactive)
jochen@: Please consider approving content/ changes.
5 years, 9 months ago (2015-03-20 12:57:14 UTC) #6
jochen (gone - plz use gerrit)
lgtm
5 years, 9 months ago (2015-03-20 13:00:10 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1018413002/20001
5 years, 9 months ago (2015-03-20 13:03:40 UTC) #10
commit-bot: I haz the power
Committed patchset #2 (id:20001)
5 years, 9 months ago (2015-03-20 14:27:15 UTC) #11
commit-bot: I haz the power
5 years, 9 months ago (2015-03-20 14:28:07 UTC) #12
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/9e4422ed1a5babde895ab2c101298e69338fdfc2
Cr-Commit-Position: refs/heads/master@{#321567}

Powered by Google App Engine
This is Rietveld 408576698