<html><head></head><body>If this in fact is the cause it sounds like a b2g bug.<br><br><div class="gmail_quote">Jared Hirsch <6a68@mozilla.com> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><br />On Dec 5, 2013, at 12:22 PM, Jed Parsons <jparsons@mozilla.com> wrote:<br /><br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> <br /> Guilherme and I just got off a vidyo call, where he got sign-in to WiMF working with FxA.<br /> <br /> \o/<br /> <br /> <br /> <br /> That's mainly what I wanted to report. Now for a technical question:<br /> <br /> He was encountering a problem when calling request(), and it confuses me. Perhaps someone on this list can help clarify.<br /> <br /> We have a check in dom/identity/nsDOMIdentity.js that ensures that request() is being called as the result of a user action. (We are able to pref this check off for automated testing; see comments in the file for how.)<br /> <br /> Guilherme was using this code, in which a click handler triggers request: <a
href="https://github.com/guilherme-pg/gaia/commit/2d72d1a8f605e7a43c9cbb8d7b915fb913704f85">https://github.com/guilherme-pg/gaia/commit/2d72d1a8f605e7a43c9cbb8d7b915fb913704f85</a><br /> <br /> When triggered by this code, nsDOM believed that it was not handling user input; i.e., that it wasn't a "real" click event. Therefore our check failed and we stopped the execution of request().<br /> <br /> I don't understand why this is happening, as his code uses a click handler in gaia.<br /> <br /> We obviously don't want to remove this handlingUserInput check in nsDOMIdentity; it's important for security.<br /> <br /> Does anyone know what might be going on here?<br /></blockquote><br />I suspect we're running into the same heuristics as those used by browser native popup blockers to detect whether a click is real or simulated. To ensure the popup wasn't blocked in Persona, we suggested[1][2] using DOM Level 1 click handlers:<br /><br /> myElement.onclick = myHandler<br /><br />as
opposed to DOM Level 2 handlers (which are used in the linked gist):<br /><br /> myElement.addEventListener('click', myHandler)<br /><br />I'd bet that something similar is afoot here, and I'd bet the fix is to directly assign the handler to the element.<br /><br />Cheers,<br /><br />Jared<br /><br />[1] <a href="https://developer.mozilla.org/en-US/Persona/The_implementor_s_guide/Call_request()_only_from_a_click_handler">https://developer.mozilla.org/en-US/Persona/The_implementor_s_guide/Call_request()_only_from_a_click_handler</a><br />[2] <a href="https://developer.mozilla.org/en-US/Persona/Quick_Setup#Step_2.3A_Add_login_and_logout_buttons">https://developer.mozilla.org/en-US/Persona/Quick_Setup#Step_2.3A_Add_login_and_logout_buttons</a><br /><br /><br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> <br /> Thanks,<br /> j<br /><hr /><br /> Dev-fxacct mailing list<br /> Dev-fxacct@mozilla.org<br /> <a
href="https://mail.mozilla.org/listinfo/dev-fxacct">https://mail.mozilla.org/listinfo/dev-fxacct</a><br /></blockquote><br /><hr /><br />Dev-fxacct mailing list<br />Dev-fxacct@mozilla.org<br /><a href="https://mail.mozilla.org/listinfo/dev-fxacct">https://mail.mozilla.org/listinfo/dev-fxacct</a><br /></pre></blockquote></div><br>
lloyd - (on an tiny keyboard)</body></html>