#845 Empty page when viewing examples/js/demo.fan

qualidafial Tue 1 Dec 2009

When I run examples/js/demo.fan the main index page comes up fine, but none of the demo pages (e.g. ajax.fwt) are showing anything. Viewing page source shows that the code shows up fine and all the JS files are linked in. I've also manually navigated to the various /pod/<pod>/<pod>.js files and they are all there.

I've tried this under Firefox/Ubuntu, Firefox/WinXP and IE8/WinXP. In every case, the FWT pages come up blank.

To start the demo app I execute the following on the CL:

/home/matt/dev/fan/examples/js/> fan demo.fan

That's it. Am I missing something?

brian Tue 1 Dec 2009

Are you using hg tip or the released build?

qualidafial Tue 1 Dec 2009

hg tip.

qualidafial Tue 1 Dec 2009

I checked and found that my base (release) fantom distro was out of date. So I upgraded to 1.0.47 and recompiled the development distro. However the FWT demo pages are still coming up blank.

brian Tue 1 Dec 2009

I am trying on XP with Chrome and FF it seems to working ok.

Do you have anything in your JavaScript error console?

tcolar Tue 1 Dec 2009

FYI: I was having that kind of issues when the SWT jar wasn't found / picked up.

qualidafial Wed 2 Dec 2009

Do you have anything in your JavaScript error console?

Yes. Upon loading graphics.fwt I get:

Error: fan.sys.Range is undefined
Source File: http://localhost:8080/pod/sys/sys.js
Line: 3296

once, and

Error: fanx_TypeParser.load is not a function
Source File: http://localhost:8080/pod/sys/sys.js
Line: 420

5 times.

qualidafial Wed 2 Dec 2009

I also get the exact same errors when loading hello.fwt, cookies.fwt, or ajax.fwt.

andy Wed 2 Dec 2009

You try clearing your browser cache? If fan.sys.Range is undefined, that's most often cause you have an outdated sys.js cached.

qualidafial Wed 2 Dec 2009

No that didn't fix it. The problem appears to be line 3296:

fan.sys.Uri.parentRange = fan.sys.Range.makr(0, -2, false);

But fan.sys.Range isn't defined until line 5029:

fan.sys.Range = fan.sys.Obj.$extend(fan.sys.Obj)

So it appears that the classes in sys pod are emitted to JavaScript in the wrong order.

brian Wed 2 Dec 2009

If you are working off of tip, then it looks like your sys.js isn't getting compiled correctly. What I have for sys.js line 3296:

var weekday = this.weekday();

Line 5029 is:

throw fan.sys.UnsupportedErr.make("binary write on StrBuf output");

When doing a sys\js\build and make sure it is updating the js file inside of sys.pod.

qualidafial Thu 3 Dec 2009

I just did this again. fantom-dev is located at /home/matt/fan/dev/. fantom-rel is located at /home/matt/apps/fantom-1.0.47/. I ran the commands:

/home/matt/fan/dev/src/> ./buildboot.fan clean
/home/matt/fan/dev/src/> ./buildpods.fan clean

This deleted all pod files, except for the pods which have been removed so far during the 1.0.48 iteration. I deleted these .pod files manually so that the lib/fan/ directory was empty.

/home/matt/fan/dev/src/> ./buildboot.fan full
/home/matt/fan/dev/src/> ./buildpods.fan full

Navigated to /home/matt/fan/dev/lib/fan/ and verified all pod files were regenerated. Opened sys.pod in Archive Manager (basically winzip for Linux) and opened up file "sys.js". I then started a search for "fan.sys.Range.make". The first hit was at line 3296, as before:

fan.sys.Uri.parentRange = fan.sys.Range.make(0, -2, false);

Then at line 3952 (inside definition of fan.sys.Uri.relTo):

t.path = fan.sys.List.slice(this.m_path, fan.sys.Range.makeInclusive(d, -1));

Then starting at line 5036:

fan.sys.Range.makeInclusive = function(start, end)
{
return new fan.sys.Range(start, end, false);
}
fan.sys.Range.makeExclusive = function(start, end)
{
return new fan.sys.Range(start, end, true);
}
fan.sys.Range.make = function(start, end, exclusive)
{

The only thing I can figure is that maybe you've updated the boot pods internally since 1.0.47, or at least updated the compilerJs pod only.

andy Thu 3 Dec 2009

I know what that is. I have a fix. But just sorta destroyed my hg repo, so I'll try to check it in tomorrow.

andy Thu 3 Dec 2009

Ok, pushed a fix, should work now.

The order those files get written is not set. So all static field defs must be written out after all the types have been defined to guarantee the script file parses correctly. Just happened my Range was being written before my Uri, so worked for me. Just needed to move that guy to the end.

Login or Signup to reply.