ActiveState Community

Komodo 5.2 Javascript debugging with mod_rewrite

Posted by chansw on 2009-10-22 12:39

I am looking for suggestions on how to get Komodo 5.2 debugging working with Javascript. The server is CentOS (Apache 2 running mod_rewrite).

My .htaccess remaps all URL requests to an index.php file at the root level. I am using the URI hierarchy as parameters (i.e., www.mydomain.com/username/pageno/param1/param2

The problem is that Komodo always complains that it can't find the file when debugging in Javascript. Debugging PHP works fine.

Any suggestions?

Thanks

Jerry

ericp | Thu, 2009-10-22 15:06

Is the JS code loaded from a separate file in via ,
or is it embedded in script tags in the HTML?

It sounds like Firefox does successfully connect to Komodo, but then
tries to give Komodo a URL that Komodo can't resolve. What URL
is reported?

Are you running anything else when you debug, like gmail, or a page
with google analytics? I usually bring up a single-tab Firefox
session while debugging JS.

- Eric

chansw | Thu, 2009-10-22 18:16

Hi Eric -

Let me clarify -

Using .htaccess and mod_rewrite, pages are generated through the following php file:

/usr/local/apache/htdocs/index.php

Depending on the parameters, index.php will dynamically generate pages from html pages (that includes Javacript within blocks) within the folders named after the domain:

/usr/local/apache/htdocs/www.mydomain.com/

The problem appears to be that the following URL has no "physical" counterpart via FTP:

http://www.mydomain.com/myname

The error I get from Komodo is that "550 Can't open /www.mydomain.com/myname: No such file or directory". Komodo is correct, there is no such file or folder "myname". "myname" is used strictly as a parameter to index.php.

The resulting HTML code is streamed through index.php. Komodo will not be able to see (via FTP) all the dynamically-generated HTML code since it is generated on-the-fly.

Any suggestions?

Thanks

Jerry

ericp | Fri, 2009-10-23 09:52

A bit of background: during JavaScript debugging, if Komodo can't
resolve a URI into a file, it should be asking the debugger for
the underlying "script" (a block of pretty-printed code). The
only time Komodo tries to access an actual file is if you
have a Mapped URI that maps a set of URIs to a physical location
(using either a local drive, or the scp or ftp protocols).

Here it looks that Komodo thinks the JS code is at "/www.mydomain.com/myname",
which looks like a local filename, not a URI, and Komodo complains that
it can't find it.

Does the debugger stop working at that point? If you see a buffer
that says Komodo couldn't find the code, does pressing the "Pretty Print"
button in the tool bar (the [Debug|Pretty Print] menu item will also work)
show the code?

- Eric

chansw | Fri, 2009-10-23 11:04

Hi Eric -

Thanks for your tip.

It is working somewhat better now. The code now shows up when I ignore URI mapping -- I was trying to get the URI mapping to work, I didn't realize that ignoring URI mapping would allow me to see the code after using pretty-print.

I can't seem to "step over" my jQuery functions though -- attempting to "step over" causes Komodo to just ignore breakpoints ("break on next Javascript statement" and "break now" don't work).

I'll play some more to see if I can get a better handle on the issue.

Jerry