CB-6761 Fix native->JS bridge ceasing to fire when page changes and online is set to false and the JS loads quickly

(cherry picked from commit 445ddd89fb3269a772978a9860247065e5886249)
CB-7261 Fix setNativeToJsBridgeMode sometimes crashing when switching to ONLINE_EVENT

(cherry picked from commit 41125ea1e2ce9bff3191f57d88c10c277cbb3e94)
Fix JSONStore.init() hangs for Android devices

- Cordova RTC work item number: 59273
- Apache Cordova Jira issue:
https://issues.apache.org/jira/browse/CB-6047(already applied),
https://issues.apache.org/jira/browse/CB-6761,
https://issues.apache.org/jira/browse/CB-7261
- Markmail or Google Group reference:
- Product PMR: APAR PI30969 (RTC 59178)
- Description: JSONStore.init() hangs is caused by a lack of good
handling on the reset and toggling events
on NativeToJsMessageQueue.java class, the changes applied on this fix
are going to properly handle the Online events,
handling the queue of messages on page transitions, and general
optimization. More information on RTC work item.