cliqz-oss / cliqz-s

Mozilla Public License 2.0
4 stars 8 forks source link

[WIP] record history from pushState and replaceState #56

Open chrmod opened 6 years ago

chrmod commented 6 years ago

This little trick is likely to work as it is battle tested by firefox-ios project: https://github.com/mozilla-mobile/firefox-ios/blob/2d5ca06880b9288be74b7eb1a6cb7c937292387d/Client/Frontend/UserContent/UserScripts/MainFrame/AtDocumentStart/HistoryStateHelper.js

Unfortunately on Android (not sure about iOS), using onMessage on a web view breaks certain pages, like twitter.com, it is probably caused by a fact Android web view replaces native postMessage https://github.com/facebook/react-native/blob/0.39-stable/React/Views/RCTWebView.m#L286

chrmod commented 6 years ago

there are some react-native issues that may be related to this problem:

chrmod commented 6 years ago

Have found react-native PR that implemented webview messaging https://github.com/facebook/react-native/commit/abb8ea3aea686e2cd881a61fbc66d137857ef422 and it looks like the original window.postMessage function gets replaced with react-native one, which means, the messages never arrive to their original destinations. I will try to fix that by calling original function along with react-native replacement.

chrmod commented 6 years ago

OK. Have implemented react-native bugfix. This PR has to be merged before we can progress https://github.com/facebook/react-native/pull/18546