Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sugarizer activities failed on Sugar 0.110 #116

Closed
llaske opened this issue Mar 26, 2017 · 12 comments
Closed

Sugarizer activities failed on Sugar 0.110 #116

llaske opened this issue Mar 26, 2017 · 12 comments
Labels
Milestone

Comments

@llaske
Copy link
Owner

llaske commented Mar 26, 2017

I'm creating my first web activity and I've used the ActivityTemplate
from Sugarizer repository.

However I'm failing to get my activity to run under Sugar.

The same happens when I try to run any of the Sugar-web activities
contained in activities/ directory of Sugarizer repository.

However when I download Markdown.activity from ASLO, I am able to run it.

The failure consists of the activity icon not becoming colored and no
datastore object being created. Furthermore, there are no errors in the
Sugar logs that I can find.

I'm testing with Sugar 0.110 as packaged in Debian Testing.

Indeed there is an error in the Inspector Javascript Console:

[Error] Invalid url for WebSocket ws://127.0.0.1:undefined
(anonymous function) (sugaros.js:19)
(anonymous function) (env.js:29)

[Error] SyntaxError (DOM Exception 12): The string did not match the expected pattern.
(anonymous function) (sugaros.js:19)
(anonymous function) (sugaros.js:19)
(anonymous function) (env.js:29)

This can be reproduced by copying any activity (above is from Stopwatch.activity) into ~/Activities in a Sugar Desktop.
When I switch the lib/sugar-web directory for the official sugarlabs/sugar-web, then it works fine in Sugar 0.110, but then, it doesn't work in Sugarizer anymore.

@icarito
Copy link
Contributor

icarito commented Mar 26, 2017

Thanks for your suggested fix referring to sugarlabs/sugar-web@e17b17d !
However, with this change, although there are no Javascript errors at the console anymore, I still don't get a colored icon and a datastore object!

@icarito
Copy link
Contributor

icarito commented Mar 26, 2017

I think the error happens before, at the stage of setting the environment, because by the time execution reaches this WebSocket request, it wants a port variable which is undefined.

@icarito
Copy link
Contributor

icarito commented Mar 26, 2017

Correction, the javascript console error does not disappear when changing 127.0.0.1 to 0.0.0.0.

@llaske
Copy link
Owner Author

llaske commented Mar 27, 2017

I've tested with LastOneLoses activity on Sugar 0.110.0.olpc.1 on a XO-4 and it works. No message, icon is colored.
Which Sugar version are you using ?
Could you test with LastOneLoses activity: just zip the content of the Sugarizer directory LastOnLoses.activity directory and rename it as .xo.

@icarito
Copy link
Contributor

icarito commented Mar 28, 2017

Ok, I figured out the failure condition. It's when running with the Webkit2 backend.
By default, the XO runs with Webkit1 backend.

Initially I thought this was a failure of sugar-web (sugarizer flavour) - but it turns out that the same code runs well enough on Webkit1 codepath.

Steps to test:
On a distribution with Sugar installed, start Sugar and run Terminal Activity. From it, try:

  • chdir into a web activity (e.g. LastOneLoses)
  • run it with sugar-activity-web (it will fail)
  • run it with SUGAR_USE_WEBKIT1=yes sugar-activity-web (it will work)

It's not visible on XO because on XO it uses Webkit1 by default for some reason (I tried the Webkit2 on a XO1.5 and it cause a segmentation fault - I guess that's the reason).

@icarito
Copy link
Contributor

icarito commented Mar 28, 2017

I'm guessing sugar-web's environment detection is wrong on Webkit2 sugar backend for some reason.

@llaske
Copy link
Owner Author

llaske commented Mar 28, 2017

Okay. So it means that it's more a sugar-web issue than a Sugarizer issue. When running on Sugar, Sugarizer activities rely on Sugar Sugar-Web implementation thought I have to report back some recent fixes (like the one mention earlier).
I'm not sure I could help here because I'm not fully aware of how sugar-web is linked to Webkit1/Webkit2 in Sugar. May be we could report this issue into the sugar-web repository some someone more qualified could try to find a solution.

@icarito
Copy link
Contributor

icarito commented Mar 28, 2017

I thought so too and was just actually writing this to https://github.com/sugarlabs/sugar-toolkit-gtk3/issues/new except then I tried the version in https://github.com/sugarlabs/sugar-web and it works both in Webkit2 and Webkit1 so I guess compatibility with Webkit2 was lost somewhere in https://github.com/llaske/sugarizer/tree/dev/lib/sugar-web . .

I also tried changing 127.0.0.1 to 0.0.0.0, by the way, but the same error [Error] Invalid url for WebSocket is presented.

@llaske
Copy link
Owner Author

llaske commented Mar 28, 2017

Ok. Not a problem. I leave this issue open. When there will be a fix available on the sugar-toolkit side, I will fix too on my side.
I've already started, few things have changed.

@icarito
Copy link
Contributor

icarito commented Mar 28, 2017

Except it's not possible to report an issue with sugar-toolkit (I've not done so) because sugar-toolkit works fine with sugarlabs/sugar-web. Although the fix might be on the sugar-toolkit side, it would be great for the same codebase to work in already released Sugar 0.110.

@icarito
Copy link
Contributor

icarito commented Apr 29, 2017

Currently I made the sugarizer version to work both in Sugarizer and Sugar (WebKit2 and Webkit1), with changing the env.isStandalone() to the one in https://github.com/sugarlabs/sugar-web, like this.

@llaske
Copy link
Owner Author

llaske commented Apr 30, 2017

Very nice. I'm going to report this fix in all Sugarizer activities.

@llaske llaske added this to the v0.9 milestone Apr 30, 2017
@llaske llaske modified the milestones: v0.9, v1.0 Sep 15, 2017
@llaske llaske added the bug label Nov 26, 2017
@llaske llaske closed this as completed in 062c84e May 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants