<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">issue is here:<div><a href="https://github.com/guilherme-pg/gaia/blob/wimf_fxa/apps/settings/js/whereismyfox.js#L69-L71">https://github.com/guilherme-pg/gaia/blob/wimf_fxa/apps/settings/js/whereismyfox.js#L69-L71</a></div><div><br></div><div>.request() is typically required to be invoked from inside a click hander.  postMessage is an asynchronous break, and by the time .request() is implement the click handler is lost.</div><div><br></div><div>Spoke with brian warner and jed, and we’ll make a change to simplify things:</div><div><br></div><div>Because the settings app is certified it should be able to do two things that trusted content cannot:</div><div><br></div><div>1. specify the audience as a parameter to .request()</div><div>2. invoke .request() without being inside a click handler</div><div><br></div><div>Jed will make the change, warner will review, we will simplify code and #win everywhere!</div><div><br></div><div>lloyd</div><div><br><div><div>On Dec 5, 2013, at 3:48 PM, Lloyd Hilaiel <<a href="mailto:lloyd@mozilla.com">lloyd@mozilla.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>If this in fact is the cause it sounds like a b2g bug.<br><br><div class="gmail_quote">Jared Hirsch <<a href="mailto:6a68@mozilla.com">6a68@mozilla.com</a>> 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 <<a href="mailto:jparsons@mozilla.com">jparsons@mozilla.com</a>> 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> <a href="mailto:Dev-fxacct@mozilla.org">Dev-fxacct@mozilla.org</a><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><a href="mailto:Dev-fxacct@mozilla.org">Dev-fxacct@mozilla.org</a><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)</div>_______________________________________________<br>Dev-fxacct mailing list<br><a href="mailto:Dev-fxacct@mozilla.org">Dev-fxacct@mozilla.org</a><br>https://mail.mozilla.org/listinfo/dev-fxacct<br></blockquote></div><br></div></body></html>