cordova-plugin-inappbrowser
cordova-plugin-inappbrowser copied to clipboard
(android) Removed waitForBeforeload flag as it prevents beforeLoad from being called on every GET request
Platforms affected
Android
Motivation and Context
Resolves #686
Link to the issue: #686
Description
We removed waitForBeforeload flag as it prevents beforeLoad from being called on every GET request and it does not seem to have any meaningful use.
Testing
Testing was done manually as I am not sure how to automate it.
The following tests were executed for Android 7, 8, and 10.
Created a new Cordova test app using cordova-plugin-inappbrowser. Executed: cordova.InAppBrowser.open("https://www.hannaford.com", "_blank", "beforeload=get"); and verified beforeLoad gets called with every get request.
Executed: cordova.InAppBrowser.open("mailto:[email protected]", "_blank", "beforeload=get"); and verified beforeLoad gets called with that get request.
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
- [x] Commit is prefixed with
(platform)if this change only applies to one platform (e.g.(android)) - [x] 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)
- [x] I've updated the documentation if necessary
@wvengen originally implemented the beforeload feature and his PR comment indicates that waitForBeforeload is necessary.
have you got an opinion on this @wvengen?
@wvengen originally implemented the
beforeloadfeature and his PR comment indicates thatwaitForBeforeloadis necessary.have you got an opinion on this @wvengen?
We saw it was added on purpose and I believe it may had a specific goal. However, now it has the effect of preventing beforeLoad from being called on every GET request, which is quite a big deal. We removed it and we have been using the code in this PR successfully in production for a week.
waitForBeforeload is necessary. I think it prevent duplicate event.
for fix problem you maybe want correct it instead of remove.
I have found same problem before and fixed by correct it when onPageFinished. Real problem is when load error it not reset waitForBeforeload.
Could you please check commit?
waitForBeforeload is necessary. I think it prevent duplicate event.
for fix problem you maybe want correct it instead of remove.
I have found same problem before and fixed by correct it when onPageFinished. Real problem is when load error it not reset waitForBeforeload.
Could you please check commit?
We have been using the change in this PR in our app in the Google Play Store for almost two month (500k installs). We have no reports of issues with beforeLoad which is called a lot when the customer uses the app. So, if waitForBeforeload is really necessary, I would expect a completely different situation.
By the way, no one has been able to provide a good explanation on why it's needed. On the other hand, if you have in the code, beforeLoad only happens every other request, which is definitely wrong. That has been reported more than once by many people.
It would really nice to have an good explanation on why it's necessary. By looking at the code, I cannot really understand it.
To follow up on this PR, I've found in testing that this PR is necessary for beforeload to function more than once. @stionic: The code for waitForBeforeload doesn't prevent duplicates of the beforeload event occurring and can be safely removed .
This PR fixes the issues we found too!
Thank you. This finally fixed this issue for me.