Closed remster closed 7 years ago
This may be related to my js not unscubscribing from touch events - but it's a long shot.
I continuously see this in logcat:
04-24 14:56:51.860 31586 31586 D XWalkCordovaUiClient: onPageLoadStopped(https://zikes-web-client.appspot.com/mobile/#) 04-24 14:56:51.860 31586 31586 D CordovaWebViewImpl: onPageFinished(https://zikes-web-client.appspot.com/mobile/#) 04-24 14:56:52.283 31586 31586 I chromium: [INFO:CONSOLE(107)] "Uncaught Error: cordova already defined", source: data:text/javascript;charset=utf-8;base64,Ly8gUGxhdGZvcm06IGFuZHJvaWQKLy8gN2M1ZmNjNWE1YWRmYmYzZmI4Y2VhZjM2ZmJkZDRiZDk3MGJkOWMyMAovKgogTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZQogb3IgbW9yZSBjb250cmlidXRvciBsaWNlbnNlIGFncmVlbWVudHMuICBTZWUgdGhlIE5PVElDRSBmaWxlCiBkaXN0cmlidXRlZCB3aXRoIHRoaXMgd29yayBmb3IgYWRkaXRpb25hbCBpbmZvcm1hdGlvbgogcmVnYXJkaW5nIGNvcHlyaWdodCBvd25lcnNoaXAuICBUaGUgQVNGIGxpY2Vuc2VzIHRoaXMgZmlsZQogdG8geW91IHVuZGVyIHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAgKHRoZQogIkxpY2Vuc2UiKTsgeW91IG1heSBub3QgdXNlIHRoaXMgZmlsZSBleGNlcHQgaW4gY29tcGxpYW5jZQogd2l0aCB0aGUgTGljZW5zZS4gIFlvdSBtYXkgb2J0YWluIGEgY29weSBvZiB0aGUgTGljZW5zZSBhdAogCiAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wCiAKIFVubGVzcyByZXF1aXJlZCBieSBhcHBsaWNhYmxlIGxhdyBvciBhZ3JlZWQgdG8gaW4gd3JpdGluZywKIHNvZnR3YXJlIGRpc3RyaWJ1dGVkIHVuZGVyIHRoZSBMaWNlbnNlIGlzIGRpc3RyaWJ1dGVkIG9uIGFuCiAiQVMgSVMiIEJBU0lTLCBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkKIEtJTkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuICBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZQogc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZCBsaW1pdGF0aW9ucwogdW5kZXIgdGhlIExpY2Vuc2UuCiovCjsoZnVuY3Rpb24oKSB7CnZhciBQTEFURk
If this is crosswalk issue #15 may be similar.
cordova already defined
is a benign info message.
Thanks. Indeed, looks crosswalk related. Would it be possible to inspect the DOM to see if script has already be injected (and not double up if it has)? Alternatively, could RemoteInjectionPlugin hold state? I am not familiar with the mechanics of communicating with webviews so my ideas may be naive.
"cordova already defined" may be benign, but my dom grows with a new instance of the script with every trivial interaction with the UI, so I consider this a serious issue.
The issue though is in crosswalk, not this plugin. Any plugin relying on those events would have to work around the crosswalk behavior which is not inline with behavior of the other browser controls.
Well I know and I hate to kick the fuss, but i have no alternative (for another 12 months or so until the androids of the world all catch up to Chromium 53+) but to use crosswalk (which appears to be discontinued). You wrote the plugin that I find immensely useful, yet.. i need to solve this problem = find a workaround. Would really appreciate if you had a low hanging fruit in mind - i could modify your code locally w/o necessarily forking it.
Just an observation to share. crosswalk appears to generate onPageFinished whenever I tap on any href in the dom. And I've settled on a somewhat nasty workaround and i locally changed your plugin to only inject when onPageFinished is preceded by onPageStarted. You may close this issue.
Ok, thanks. Yeah, they fire events for all responses, not just loading of the main page. I'd recommend logging an issue with them.
Feel free to log a PR!
Whenever I interact with my Android app in a certain way (I can't yet work out what exactly it is) i see "cordova already defined" and new items being added to the bottom of the head element as shown here:
By looking at your code i conclude my webpage/webview (which is crosswalk in my case) generates a multiplicity of (spurious?) 'onPageFinished' events to which your plugin reacts by re-appending the same script over and over again.
Please, lets help each other diagnose this.