Issue metadata
Sign in to add a comment
|
AwContents.onPause causes un-pauses the javascript timers
Reported by
mkrasow...@opera.com,
Jun 7 2016
|
||||||||||||||||||||||
Issue description
Steps to reproduce the problem:
1. Add below testcase to chromium/src/android_webview/javatests/src/org/chromium/android_webview/test/WebViewModalDialogOverrideTest.java
2. Run the testcase with out/Release/bin/run_android_webview_test_apk -f WebViewModalDialogOverrideTest\#testAwContentsOnPauseDoesNotResumeJsTimers
-- <Java> ------------------------------------
@SmallTest
@Feature({"AndroidWebView"})
public void testAwContentsOnPauseDoesNotResumeJsTimers() throws Throwable {
final String alertText = "Hello World!";
final AtomicBoolean callbackCalled = new AtomicBoolean(false);
// Returning true from the callback should not show a dialog.
TestAwContentsClient client = new TestAwContentsClient() {
@Override
public void handleJsAlert(String url, String message, JsResultReceiver res) {
callbackCalled.set(true);
res.confirm();
assertEquals(alertText, message);
}
};
AwTestContainerView view = createAwTestContainerViewOnMainSync(client);
final AwContents awContents = view.getAwContents();
enableJavaScriptOnUiThread(awContents);
loadDataSync(awContents, client.getOnPageFinishedHelper(),
EMPTY_PAGE, "text/html", false);
JSUtils.executeJavaScriptAndWaitForResult(this, awContents,
client.getOnEvaluateJavaScriptResultHelper(),
"setTimeout(function(){alert('" + alertText + "');},1000)");
// added pause timers
getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
awContents.pauseTimers();
awContents.onPause();
}
});
SystemClock.sleep(2000);
assertFalse(callbackCalled.get());
}
-- </Java> ------------------------------------
2. testcase fails
What is the expected behavior?
Testcase should not fail.
What went wrong?
The awContents.onPause() call is causing
the mContentViewCore.onHide() call, which un-pauses the JS timers.
Which is bad. I think.
Did this work before? N/A
Chrome version: 49.0.2623.110 Channel: n/a
OS Version:
Flash Version: not important
Test is low-quality, since it contains SystemClock.sleep 'n stuff, but it shows the problem.
,
Jun 13 2016
executeJavaScriptAndWaitForResult is synchronous, the pauseTimers/onPause calls have no affect on the state of callbackCalled
,
Jun 13 2016
wait, js does setTimeout.. uhh..
,
Jun 13 2016
test passed for me on trunk..
,
Jun 13 2016
You mention chrome 49.0.2623.110, even though this is webview. Are you complaining specifically about that version?
,
Jun 16 2016
assume duplicate, that reporter is responding
,
Jun 17 2016
Sorry for no-res, indeed the bug is not reproducible on master. The 49.0.2623.110 is the exact tag on which I have reproduced the bug. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by rsgav...@chromium.org
, Jun 7 2016