<div dir="ltr"><div>I think a decent solution would be to check if window.location starts with activity:// in the getEnvironment function (that's the protocol we use when running inside sugar). If not, just return null to the callback.<br>
<br></div>Then fix envSpec.js to do a proper async check (see datastoreSpec.js, we are doing it a lot there). And handle the null case to avoid an error when running standalone.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On 22 November 2013 19:59, Daniel Narvaez <span dir="ltr"><<a href="mailto:dwnarvaez@gmail.com" target="_blank">dwnarvaez@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Oh actually I see why it succeeds... The test doesn't verify that it receives a response. It will only fail if it gets the wrong answer (and it probably it's not always to fail in that case either). We need to follow the async pattern we have in the datastore test. Though first maybe best to decide what we want to do with getEnvironment exactly...<br>
</div><div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On 22 November 2013 19:56, Daniel Narvaez <span dir="ltr"><<a href="mailto:dwnarvaez@gmail.com" target="_blank">dwnarvaez@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>On 22 November 2013 19:31, Rogelio Mita <span dir="ltr"><<a href="mailto:rogeliomita@activitycentral.com" target="_blank">rogeliomita@activitycentral.com</a>></span> wrote:<br>
</div><div class="gmail_extra">
<div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><div><br></div><div>Can you help me to understand the getEnvironment function (<a href="https://github.com/sugarlabs/sugar-web/blob/master/env.js)" target="_blank">https://github.com/sugarlabs/sugar-web/blob/master/env.js)</a>?.</div>
</div></div></blockquote><div><br></div></div><div>This is used to pass some initial environment variables from python.<br></div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div></div><div><div>My understanding is that if sugar.environment is undefined is because I am in standalone mode, is that right?</div></div></div></div></blockquote><div><br></div></div><div>Right now, I'd expect it to not return at all, which is a bug. I'm not sure what's a good solution though, other than writing a webkit plugin in C which I'm trying to resist.<br>
</div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div></div><div>what is the purpose of this handler onEnvironmentSet (<a href="https://github.com/sugarlabs/sugar-web/blob/master/env.js#L22" target="_blank">https://github.com/sugarlabs/sugar-web/blob/master/env.js#L22</a>)?</div>
<div><br></div></div></div></div></blockquote><div><br></div></div><div>Python calls it to notify js that it has set the environment variables on window.sugar.<br></div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div></div><div>I am running all tests (with karma but with a Chfome browser, no in sugar environment) and I noted some rare: when is running this test: <a href="https://github.com/sugarlabs/sugar-web/blob/master/test/envSpec.js" target="_blank">https://github.com/sugarlabs/sugar-web/blob/master/test/envSpec.js</a> is <span style="color:rgb(48,57,66);font-family:Menlo,monospace;font-size:11px;white-space:pre-wrap">SUCCESS</span>, I can't underestand why.<br>
</div></div></div></div></blockquote><div><br></div></div><div>You mean it sometimes succeed or it rarely does? (both are unexpected). <br></div></div></div></div>
</blockquote></div><br><br clear="all"><br></div></div><span class="HOEnZb"><font color="#888888">-- <br>Daniel Narvaez<br>
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br>Daniel Narvaez<br>
</div>