APPs Manifest JSON error + Path ?

266 views
Skip to first unread message

gmgj

unread,
Jan 3, 2012, 3:25:40 PM1/3/12
to mozilla-apps
I have a web page that is a webapp at
http://garyjohnsoninfo.info//XXSoftwareTools/MEvaluator-CalculatorApp.html

My webapp manifest is at
http://garyjohnsoninfo.info//XXSoftwareTools/MEvaluator-CalculatorApp.webapp
The manifest is served as the correct type.
AddType application/x-web-app-manifest+json .webapp

I submit the manifest and it gives me json error, while a json
validator passes it.
The Manifest
{
"version": "1.111",
"name": "Evaluator",
"description": "Calculator, Expression Evaluator, JavaScript Eval
with added Sandboxing Limitations",
"icons": {
"16": "/XXSoftwareTools/images/Calculator16x16.png",
"48": "/XXSoftwareTools/images/Calculator48x48.png",
"128": "/XXSoftwareTools/images/Calculator128x128.png"
},
"widget": {
"path": "/XXSoftwareTools/MEvaluator-CalculatorApp.html",
"width": 320,
"height": 356
},
"developer": {
"name": "Gary Johnson",
"url": "http://garyjohnsoninfo.info/"
},
"installs_allowed_from": [
"https://apps-preview.mozilla.org"
]
}

I see this in the doc:

The manifest and app origin (protocol, host name, and port number) are
collectively the complete description of an installed app

1) but I don't know what the app origin is?

2) I am unsure of what the launch_path entry could or should be

3) why does it fail?

JoeStagner

unread,
Jan 4, 2012, 8:28:30 AM1/4/12
to mozilla-apps
What is the error ?

-Joe

On Jan 3, 3:25 pm, gmgj <gary.johnson...@gmail.com> wrote:
> I have a web page that is a webapp athttp://garyjohnsoninfo.info//XXSoftwareTools/MEvaluator-CalculatorApp...
>
> My webapp manifest is athttp://garyjohnsoninfo.info//XXSoftwareTools/MEvaluator-CalculatorApp...

gmgj

unread,
Jan 4, 2012, 8:52:14 AM1/4/12
to mozilla-apps
The error is just a plain json error message, no line number no
nothing. But as it turns out, I saved the file as UTF no BOM and it
was accepted. Thanks for replying

Ian Bicking

unread,
Jan 4, 2012, 1:09:11 PM1/4/12
to mozill...@googlegroups.com
On Tue, Jan 3, 2012 at 2:25 PM, gmgj <gary.jo...@gmail.com> wrote:
I see this in the doc:

The manifest and app origin (protocol, host name, and port number) are
collectively the complete description of an installed app

1) but I don't know what the app origin is?

The origin is basically the site your app (and its manifest) are on.  In your case "http://garyjohnsoninfo.info" - so all the URLs are calculated with the origin plus whatever value (e.g., the icon).
 
2) I am unsure of what the launch_path entry could or should be

It's the page that will open up when a user clicks on the icon.  If you want it to open http://garyjohnsoninfo.info/ then it can be "/" (or just leave it out, that's the default).  But if you do launch_path: "/start.html" then when the user clicks on your icon they'll go to http://garyjohnsoninfo.info/start.html
 
3) why does it fail?

Seems you figured it out, probably the BOM - we have a fix for this, but I guess it hasn't been deployed yet.

  Ian

gmgj

unread,
Jan 5, 2012, 9:59:33 AM1/5/12
to mozilla-apps
Thanks for the reply.

If I change my webapp file at http://garyjohnsoninfo.info//XXSoftwareTools/MEvaluator-CalculatorApp.webapp

by adding a "launch_path": "/XXSoftwareTools/MEvaluator-
CalculatorApp.html", line; would existing users pick up the change
and be directed to the new
launch_path?

1)
I have done that and it does not appear to work. Is their something
else I have to do?

2)
This page https://developer.mozilla.org/en/Apps/Manifest is now
showing this error
"reference to undefined name 'syntax' Exception of type
'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was
thrown. (click for details)."

3)
In the future, would you consider adding more examples to the existing
documentation (see prior post) and just reply, see the updated doc at
xxxx?
I would even consider highlighting things like "as of Jan 5 2012" if
you use UTF-8 you need to submit webapp's as UTF-8 -NO BOM

4)
I clicked on the Talk page at https://developer.mozilla.org/en/Apps/Manifest
and it took me to:
https://developer.mozilla.org/en-US/


gmgj

unread,
Jan 5, 2012, 10:51:38 AM1/5/12
to mozilla-apps
about:apps

view manifest does not appear to work

Ian Bicking

unread,
Jan 5, 2012, 12:47:38 PM1/5/12
to mozill...@googlegroups.com
On Thu, Jan 5, 2012 at 8:59 AM, gmgj <gary.jo...@gmail.com> wrote:
Thanks for the reply.

If I change my webapp file at http://garyjohnsoninfo.info//XXSoftwareTools/MEvaluator-CalculatorApp.webapp

by adding a   "launch_path": "/XXSoftwareTools/MEvaluator-
CalculatorApp.html",  line; would existing users pick up the change
and be directed to the new
launch_path?

No, they have to reinstall.  Or you can do:

var MANIFEST = '/XXSoftwareTools/Mvaluator-CalculatorApp.webapp';

req = new XMLHttpRequest();
req.open('GET', MANIFEST);
req.onreadystatechange = function () {
  if (req.readyState != 4) {
    return;
  }
  var appManifest = JSON.parse(req.responseText);

  navigator.mozApps.amInstalled(function (app) {
    if (app) {
      if (app.manifest.version != appManifest.version) {
        // Needs an update
        navigator.mozApps.install(MANIFEST);
      }
    } else {
      // Might want to ask user to install app
    }
  });
};
req.send();



I realize that's a bit long-winded - but it will check if the app is installed, and if installed if the manifest is up to date.  (And yes, this code certainly needs to be in the docs, which I'll fix soon!)
 
1)
I have done that and it does not appear to work.  Is their something
else I have to do?

2)
This page https://developer.mozilla.org/en/Apps/Manifest is now
showing this error
"reference to undefined name 'syntax' Exception of type
'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was
thrown. (click for details)."

Thanks for the note, I've opened a bug on that.  Something on the server must have changed recently to break that.
 
3)
In the future, would you consider adding more examples to the existing
documentation (see prior post) and just reply, see the updated doc at
xxxx?
I would even consider highlighting things like "as of Jan 5 2012" if
you use UTF-8 you need to submit webapp's as UTF-8 -NO BOM

Yes, you are right - though with all the broken examples I'm hoping to get that fixed so I don't mess up existing content.

 

I'm not sure what link you mean, I don't see a Talk page...?


gmgj

unread,
Jan 5, 2012, 2:02:07 PM1/5/12
to mozilla-apps

> I'm not sure what link you mean, I don't see a Talk page...?

On this page
https://developer.mozilla.org/en/Apps/Manifest

Look in the upper right for a drop down call "This Page"

I had the problem when I was not logged in.
When I log in; I am directed to the page.

My understanding is that the talk page is for the editors and authors
etc to discuss changes, approaches etc to the actual "doc page"

Janet Swisher

unread,
Jan 5, 2012, 2:19:35 PM1/5/12
to mozill...@googlegroups.com, Ian Bicking
On 1/5/12 11:47 AM, Ian Bicking wrote:
On Thu, Jan 5, 2012 at 8:59 AM, gmgj <gary.jo...@gmail.com> wrote:


2)
This page https://developer.mozilla.org/en/Apps/Manifest is now
showing this error
"reference to undefined name 'syntax' Exception of type
'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was
thrown. (click for details)."

Thanks for the note, I've opened a bug on that.  Something on the server must have changed recently to break that.
Yes, there is a recurring problem with the wiki server failing to load its configuration, and therefore not loading the syntax highlighting extension:
https://bugzilla.mozilla.org/show_bug.cgi?id=715341

--Janet

jswisher.vcf

gmgj

unread,
Jan 6, 2012, 7:53:11 AM1/6/12
to mozilla-apps
"launch_path" does work,

I added some examples and questions to the Talk page {Look in the
upper right for a drop down call "This Page" }

https://developer.mozilla.org/en/Apps/Manifest

The sort story is that I am trying to flesh out what we have to do if
we use the HTML 5 cache and if we don't.

markg

unread,
Jan 6, 2012, 2:58:54 PM1/6/12
to mozilla-apps
Thanks for all that info Gary. I'm working on the docs for Apps and
it's very useful.

Mark Giffin

gmgj

unread,
Jan 14, 2012, 2:20:36 PM1/14/12
to mozilla-apps
I have been fooling with using both a html 5 and firefox app and
manifest.
<html manifest="MEvaluator-CalculatorApp.appcache">

When I am cached as an html5 app, it disallows or otherwise whacks the
XMLHttpRequest

I add a couple more checks to the code to let me know that I did not
update the Firefox app manifest

if(this.readyState === 4 && (this.status === 0 || + this.status
=== 200))
{
if(this.status==0 && this.statusText==null)
{
alert("Check for Firefox app update -> Request was not
allowed ");
return;
}

if (this.responseText==null || this.responseText=="") //data
null or failure
{
alert("Check for Firefox app update did not receive
manifest, probably request not sent " + this.statusText );
return;
}

My understanding is when you open the web page in the browser (File ,
Open) you are using File protocol, not http protocol and one of the
sandboxing rules is
don't let files from this origin request files from the web. At this
time,it looks to me like this is enforced for HTML 5 cached files.
Once I have download a FireFox / HTML 5 app, the browser does its job
of keeping the html5 cache up to date; however, getting at the FireFox
manifest back at the origin is not possible.

I am not sure of what I can do to keep things in synch. I suppose 1
option would be to HTML 5 cache most things, but keep something on the
server so that you can initiate a valid XMLHttpRequest, but in my
case, I have fairly trivial (but useful) web pages / applications and
sending traffic to the web site serves not purpose other than keeping
the Firefox app version / manifest in synch with the rest of the
app.

Since html5 caching keeps the app up to date, I suppose I could but a
link somewhere that says check for Firefox app update, but again, I am
sending traffic just to keep the Firefox app version number current.

I don't think this is a show stopper. Its great to have the app store
to promote the app. I would like to figure the low cost / low traffic
way of keeping things in synch.
Could it be as simple as having the browser check for a corresponding
webapp for an appcache file and triggering something which could
initiate the whatever the app install / update process would be? I
don't see any great need to do this either, but it does close the gap
on the html5 and firefox app conventions.




===========

var MANIFEST = '/XXSoftwareTools/Mvaluator-CalculatorApp.webapp';

req = new XMLHttpRequest();
req.open('GET', MANIFEST);
req.onreadystatechange = function () {
if (req.readyState != 4) {
return;
}
var appManifest = JSON.parse(req.responseText);

navigator.mozApps.amInstalled(function (app) {
if (app) {
if (app.manifest.version != appManifest.version) {
// Needs an update
navigator.mozApps.install(MANIFEST);
}
} else {
// Might want to ask user to install app
}
});
};

req.send();

On Jan 5, 12:47 pm, Ian Bicking <i...@colorstudy.com> wrote:
> On Thu, Jan 5, 2012 at 8:59 AM, gmgj <gary.johnson...@gmail.com> wrote:
> > Thanks for the reply.
>
> > If I change my webapp file at
> >http://garyjohnsoninfo.info//XXSoftwareTools/MEvaluator-CalculatorApp...
> > This pagehttps://developer.mozilla.org/en/Apps/Manifestis now

Ian Bicking

unread,
Jan 17, 2012, 5:23:21 PM1/17/12
to mozill...@googlegroups.com

If you are using appcache, then the origin doesn't actually change; it doesn't appear, for instance, that you are requesting a resource a local file.  Or are you thinking about actually saving the files locally, like with "Save As"?
 
I am not sure of what I can do to keep things in synch.  I suppose 1
option would be to HTML 5 cache most things, but keep something on the
server so that you can initiate a valid  XMLHttpRequest, but in my
case, I have fairly trivial (but useful) web pages / applications and
sending traffic to the web site serves not purpose other than keeping
the Firefox app version / manifest in synch with the rest of the
app.

Since html5 caching keeps the app up to date, I suppose I could but a
link somewhere that says check for Firefox app update, but again, I am
sending traffic just to keep the Firefox app version number current.

I don't think this is a show stopper.  Its great to have the app store
to promote the app.  I would like to figure the low cost / low traffic
way of keeping things in synch.
Could it be as simple as having the browser check for a corresponding
webapp for an appcache file and triggering something which could
initiate the whatever the app install / update process would be?  I
don't see any great need to do this either, but it does close the gap
on the html5 and firefox app conventions.

I think, in part in response to this input, that we'll be handling app manifest updates (not to be confused with app CACHE manifest updates ;) more automatically, and not requiring manual checks.  I think that will mean polling the server on a regular interval, but using HTTP cache semantics (i.e., if you set Expires then it won't poll until after the resource is expired).  In cases when you want to force an update then probably a call to .install() will be necessary.  But this XMLHttpRequest polling shouldn't be necessary.

We're getting ready to do a revision of the API, and there should be more details then.

 Ian

Reply all
Reply to author
Forward
0 new messages