cordova-android icon indicating copy to clipboard operation
cordova-android copied to clipboard

fix: dirty fix SystemWebViewEngine by using history.back instead of g…

Open knight9999 opened this issue 4 years ago • 0 comments

Platforms affected

android

Motivation and Context

To pass the BackButtonMultipageTest.testViaHref() on Android 11 (SDK30) .

i.e. This PR fix the following error

junit.framework.AssertionFailedError
	at junit.framework.Assert.fail(Assert.java:48)
	at junit.framework.Assert.assertTrue(Assert.java:20)
	at junit.framework.Assert.assertTrue(Assert.java:27)
	at org.apache.cordova.unittests.BackButtonMultipageTest$3.run(BackButtonMultipageTest.java:85)

in BackButtonMultipageTest.

Description

if we use the window.location = new_url in javascript and make a page transition, SDK29 or before => we can go back to previous page by webView.goBack(). SDK30 => we cannot go back to previous page by webView.goBack().

I don't know this is a bug or specification in SDK 30. Anyway I used history.back() in javascript instead on SDK 30.

Testing

Open the project test/androidx by AndroidStudio, and execute the BackButtonMultipageTest on Pixel 3 API 30 and API 29 in my local environment.

Checklist

  • [x] I've run the tests to see all new and existing tests pass
  • [ ] I added automated test coverage as appropriate for this change
  • [ ] Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • [ ] I've updated the documentation if necessary

knight9999 avatar Aug 12 '21 08:08 knight9999