<div dir="ltr"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Sat, 20 Oct 2018 at 04:34, Nicholas Alexander <<a href="mailto:nalexander@mozilla.com">nalexander@mozilla.com</a>> wrote:<br><div class="gmail_quote"><div dir="ltr">On Fri, Oct 19, 2018 at 7:43 AM Stefan Arentz <<a href="mailto:sarentz@mozilla.com" target="_blank">sarentz@mozilla.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br> <div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><ol><li><br></li><li><a href="https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/WebChannel.jsm" target="_blank">WebChannels</a> in GeckoView-consuming browser-like Apps. WebChannels are a Firefox-specific chome-only feature that allows the browser chrome to communicate via message-passing with trusted Web Content; they are used to integrate Firefox with <a href="http://accounts.firefox.com" target="_blank">accounts.firefox.com</a> and <a href="http://addons.mozilla.org" target="_blank">addons.mozilla.org</a>. We need something that provides this functionality in the Reference Browser to support a first-class Firefox Accounts experience. Privileged Web Extensions are ideologically pure but don't have a concrete date on the GeckoView roadmap. Suggestions gratefully accepted!</li></ol></div></div></div></blockquote><div><br></div>Can we learn anything from how this was implemented on iOS? If I remember correctly, we inject a helper user script into the webview, which then sets up the right glue to do messages between the native application and the FxA page loaded in the webview.</div></div></blockquote><div><br></div><div>This is a good point, because IIRC Firefox for iOS doesn't actually support WebChannel messages in the same way that Desktop and Android do.</div><br><div>On Desktop and Android, any tab that loads web content from <a href="https://accounts.firefox.com">https://accounts.firefox.com</a> gets some special message listeners hooked up, and the web content can send privileged messages to the browser. This is why, for example, you can just browse to this page on Desktop, punch in your account credentials, and get your browser connected to Sync:</div><div><br></div><div> <a href="https://www.mozilla.org/en-US/firefox/accounts/">https://www.mozilla.org/en-US/firefox/accounts/</a><br></div><div><br></div><div>On Firefox for iOS, the message listeners get hooked up when viewing <a href="https://accounts.firefox.com">https://accounts.firefox.com</a> in a special webview through the "settings" menu, but they won't get hooked up if you just open a tab and browse to <a href="https://accounts.firefox.com">https://accounts.firefox.com</a> on the web.<br></div><div><br></div><div>
<div>(That's my recollection anyway; if I'm wrong please correct me!)<br></div><div></div>
</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote">One note, and please correct me if I am wrong: but the web based FxA login flow can not depend on GeckoView - it has to work in both the system webview and geckoview. It is not practical for non-browser applications to pull in a giant dependency on GeckoView if all they need is a place to show a web based login flow. Whatever we do here needs to work in both the system webview and geckoview.<br></div></div></blockquote></div><div class="gmail_quote"><br></div><div class="gmail_quote">This is 100% correct. The use of this special message-passing stuff is for a very specific use-case - browser-like apps that want to be able to host account management UI by opening up <a href="https://accounts.firefox.com">https://accounts.firefox.com</a>. Non-browser applications will only want the existing OAuth signin flow, not all the extra account-management stuff, so should work fine with either GeckoView or the system browser.</div><div class="gmail_quote"><br></div><div class="gmail_quote"> Cheers,</div><div class="gmail_quote"><br></div><div class="gmail_quote"> Ryan<br></div></div></div></div></div>