Compare commits

...

226 Commits
0.5 ... 0.6.14

Author SHA1 Message Date
Guillermo Rauch
023566e03b Release 0.6.14 2011-02-22 11:09:42 -08:00
Shripad K
c306a3c303 fixed minor bug in xhr-polling, xhr-multipart, htmlfile. (this.listener.options.log -> self.listener.options.log) 2011-02-22 17:34:39 +05:30
Guillermo Rauch
80f1d9780b Release 0.6.13 2011-02-18 15:18:46 -08:00
Guillermo Rauch
ff10eeecba Fixed references to listener when logging 2011-02-18 15:18:10 -08:00
Guillermo Rauch
cd9cbb500b Fixed listener reference 2011-02-18 15:17:14 -08:00
Guillermo Rauch
de8d573948 Release 0.6.12 2011-02-18 10:36:13 -08:00
Guillermo Rauch
ea9e5ed2cc Fixed noDelay missing file descriptor problem 2011-02-18 10:34:51 -08:00
Guillermo Rauch
109a59ca9a Release 0.6.11 2011-02-15 15:43:35 -08:00
Guillermo Rauch
d304ce19d1 Fixed; Make sure to not execute any other connection operations after WebSocket write error 2011-02-15 15:41:45 -08:00
Marcus Westin
f534a260b3 Don't let errors in an application's message handling code get silently swallowed by any of the transports 2011-02-14 19:56:20 -05:00
Marcus Westin
cff4669d57 Log errors from closing the flash socket server 2011-02-14 19:54:00 -05:00
Guillermo Rauch
4b0a1f22c8 Release 0.6.10 2011-02-09 18:45:00 -08:00
Guillermo Rauch
e79bdb00e9 Added SSL chat example (make example-ssl) 2011-02-09 18:44:07 -08:00
Guillermo Rauch
d11ca00b49 Fixed; possible write errors when a connection error event fires 2011-02-09 18:41:13 -08:00
Guillermo Rauch
f3ba4173c7 Release 0.6.9 2011-02-06 10:09:13 -08:00
Guillermo Rauch
569103e19a Updated expresso 2011-02-06 09:34:16 -08:00
Guillermo Rauch
06445a0faa Added comments and version number to socket.io/index 2011-02-06 09:33:40 -08:00
Guillermo Rauch
2506b06961 Tests refactored for 0.3 and new expresso 2011-02-06 09:33:15 -08:00
Guillermo Rauch
992eda86b4 Updated socket.io client to 0.6.2 2011-02-05 11:40:39 -08:00
Guillermo Rauch
6fa8b1f051 Fixed Flash inline policy serving for Firefox 4 2011-02-05 11:40:14 -08:00
Guillermo Rauch
a91c6f26f4 Release 0.6.8 2011-01-10 01:50:26 -08:00
Guillermo Rauch
aa9f2596cb Fixed issue with terminating connection twice 2011-01-10 01:48:05 -08:00
Guillermo Rauch
e2a97588ef Removed unnecessary code 2011-01-09 19:07:11 -08:00
Guillermo Rauch
0b904d79c2 Release 0.6.7 2011-01-09 18:55:30 -08:00
Guillermo Rauch
f99ac54df5 Fixed situation where the connection drops but the client can still autoreconnect
through a different socket. In this case we still want to clear the FD but not call
onDisconnect immediately.
2011-01-09 18:53:40 -08:00
Guillermo Rauch
b306cc77d7 Release 0.6.6 2011-01-09 18:17:42 -08:00
Guillermo Rauch
ba70be4e0b Note for Flash socket and inline policy on Firefox
Destroy the fds on disconnect
Restored 20 secs of polling so that node doesn't timeout the connections
2011-01-09 18:16:24 -08:00
Guillermo Rauch
0b17ec9cb8 Release 0.6.5 2011-01-09 16:56:54 -08:00
Guillermo Rauch
71e77561bb Make sure not to trigger multiple timeouts when closing
Important fix for polling transports.
2011-01-09 16:54:35 -08:00
Guillermo Rauch
f5b2028577 Release 0.6.4 2011-01-05 11:21:37 -08:00
Fabian Jakobs
7f08d8fd59 Don't destroy the connection in _onClose. Destroying
it will prevent the buffers from being flushed and
will result in corrupted responses for the
xhr-polling transport.

According to the node documentation "destroy" is
only necessary in case of a errors.
2011-01-05 13:25:35 +01:00
Mathew Rodley
ffb0574a76 Added try/catch block around JSON.parse and return an empty object literal
if JSON parsing fails.
2010-12-30 13:18:27 +11:00
Guillermo Rauch
e57e27ee43 Added missing .connect() to example 2010-12-24 13:02:35 -08:00
Guillermo Rauch
3c76d732e6 Client updated to 0.6.1 2010-12-23 20:52:27 -08:00
Guillermo Rauch
e058ae5201 Updated history 2010-12-23 20:50:35 -08:00
Guillermo Rauch
715c46de13 Changed polling default duration to 50 seconds 2010-12-23 20:38:20 -08:00
Guillermo Rauch
eb0e1d3d2c might > will
Adjusted to 85 column limit
2010-12-23 20:11:24 -08:00
Guillermo Rauch
1d6687cecc Fixed typo 2010-12-23 20:08:36 -08:00
Guillermo Rauch
f62bae4e8b Updated client 2010-12-23 17:48:04 -08:00
Guillermo Rauch
28535071bb Support for resources that include slashes. Thanks @schamane 2010-12-23 17:10:39 -08:00
Guillermo Rauch
45f1712d57 Lazy loading of transports. Thanks @technoweenie
Fixed README transports list
2010-12-23 16:52:51 -08:00
Guillermo Rauch
3029d0cf2f OpenSSL clarifications (thanks @bmnds) 2010-12-23 16:46:17 -08:00
Guillermo Rauch
5c9fb03c50 Support for HAProxy load balancing (thanks Brian McKelvey)
Backported Parser from 0.7
2010-12-23 16:25:16 -08:00
Guillermo Rauch
39fab0ab9b Fixed HTTP API in example (was outdated). Thanks deedubs 2010-12-23 15:09:55 -08:00
Guillermo Rauch
c958a12c79 0.3 compatibility (thanks Arnout) 2010-12-23 15:08:06 -08:00
Guillermo Rauch
d298113a3e Temporarily reverting to random session id generation 2010-12-23 14:48:41 -08:00
Guillermo Rauch
3c6fc999dc client.broadcast now 300% faster
Cleaned up chat example
Implemented a simpler session id generation mechanism. Math.random is not webscale
2010-11-11 06:19:07 -03:00
jed
56205392c8 fixed bad pluralization. 2010-11-09 22:39:53 +09:00
jed
967238acb7 cleaned up grammar, missing punctuation, etc. 2010-11-09 22:37:15 +09:00
Guillermo Rauch
3c61f64d29 Prepping package.json for npm publishing 2010-11-08 20:00:15 -03:00
Guillermo Rauch
e91c785ac8 0.6.1 changelog 2010-11-08 19:59:39 -03:00
Guillermo Rauch
d0369801a1 Restored global netserver for flashsocket
Now supporting `flashPolicyServer` option (thanks Arnout)
Tests passing with and without sudo/root user
Fixed noDelay/timeout/utf-8 for draft 76 (accidental typo)
2010-11-08 18:55:27 -03:00
Guillermo Rauch
e51b37da92 Merge branch 'master' of git://github.com/3rd-Eden/Socket.IO-node 2010-11-08 17:37:32 -03:00
Arnout Kazemier
c7bec15fa9 Close the netServer when the main http server closes, this way the event loop does not keep running.
NOTE: this is patch for node 0.2.X, this is not required for node 0.3.X
2010-11-08 21:35:42 +01:00
Guillermo Rauch
4c60ed190d Merge branch 'master' of git://github.com/3rd-Eden/Socket.IO-node 2010-11-08 17:28:19 -03:00
Arnout Kazemier
d959b96363 Fallback to try{}catch handling for node < 0.2.4 , node 0.3.X seems to capture the
errors correctly using the error event.
2010-11-08 21:25:20 +01:00
Guillermo Rauch
a9dc5e081b Merge branch 'master' of git://github.com/3rd-Eden/Socket.IO-node 2010-11-08 17:17:57 -03:00
Arnout Kazemier
c168c89f1a Added the flash policy server, it's enabled by default but can be turned off if needed.
Socket.io will automatically fallback to serving the policy file inline if server is disabled or
unable to start up.
2010-11-08 21:09:52 +01:00
Guillermo Rauch
be4c847692 Misc refactor 2010-11-02 01:13:04 -03:00
Guillermo Rauch
9649b41f25 Fixed history 2010-11-01 18:50:13 -03:00
Guillermo Rauch
6a0f80e4fc Changelog 2010-11-01 18:47:08 -03:00
Guillermo Rauch
4240385f6f Make sure to only write to open transports (thanks JohnDav) 2010-11-01 17:52:23 -03:00
Guillermo Rauch
22a93d06cb Another bad onClose call 2010-11-01 17:47:05 -03:00
Guillermo Rauch
4ea687b57e Ditto 2010-11-01 17:44:41 -03:00
Guillermo Rauch
227671d41d _open is still false, so destroy the connection immediately upon websocket error 2010-11-01 17:43:24 -03:00
Guillermo Rauch
7bf4ae1f05 Make sure .connection is not null on 'end' 2010-11-01 17:27:14 -03:00
Guillermo Rauch
b28d4288d5 Proper fix for invalid websocket key 2010-11-01 17:22:43 -03:00
Guillermo Rauch
835aee46bd Bump version 2010-11-01 17:20:50 -03:00
Guillermo Rauch
054e818bd9 Fix spooky bug 2010-11-01 17:20:23 -03:00
Guillermo Rauch
107806b304 Bump version 2010-11-01 17:10:52 -03:00
Guillermo Rauch
426795395c Call onclose after destroying the connection 2010-11-01 17:10:13 -03:00
Guillermo Rauch
df929876de Updated package.json 2010-11-01 16:54:15 -03:00
Guillermo Rauch
1002105f7a added onClose skipDisconnect flag 2010-11-01 16:34:37 -03:00
Guillermo Rauch
8f4f82a413 onClose call 2010-11-01 15:35:52 -03:00
Guillermo Rauch
e1745e20ac Make sure to disconnect directly onClose if the client is not handshaked and he can't possibly reconnect 2010-11-01 15:35:06 -03:00
Guillermo Rauch
681f004fe9 Make sure to clear the FD on end 2010-11-01 15:01:24 -03:00
Guillermo Rauch
58e879b45d Updated client 2010-11-01 13:01:24 -03:00
Guillermo Rauch
5a5daf6a29 Added jscoverage and web-socket-js as entire repos 2010-11-01 12:36:21 -03:00
Guillermo Rauch
e925fdaf4a Removed cached submodule 2010-11-01 12:31:07 -03:00
Guillermo Rauch
852073d0ea Delete cached submodule 2010-11-01 12:30:35 -03:00
Guillermo Rauch
cad75e9e6e Removing .gitmodules file 2010-11-01 12:28:29 -03:00
Guillermo Rauch
f66b66f667 Make sure to destroy the FD for invalid session ids 2010-10-31 16:14:31 -03:00
Guillermo Rauch
7e692f7be1 Prevent race condition in tests 2010-10-31 15:59:04 -03:00
Guillermo Rauch
51c43400bf Moved setTimeout/noDelay disabling to connection event. This disables the timeout for all the sockets in the server, but it seems to only work from here.
Removed .draft var
2010-10-31 15:48:51 -03:00
Guillermo Rauch
3d436bf04d Client updated
Disabled transport remembering for client
2010-10-30 21:37:48 -03:00
Guillermo Rauch
5e050c9d28 Restored client 2010-10-30 20:02:15 -03:00
Guillermo Rauch
8e1bf87604 Removed incorrect client 2010-10-30 19:59:57 -03:00
Guillermo Rauch
4f1553b7f4 Updated README to reflect no-more-submodules 2010-10-30 19:58:36 -03:00
Guillermo Rauch
c9796819f1 Added submodules as cloned repos 2010-10-30 19:57:46 -03:00
Guillermo Rauch
da4aa5b3ca Removed stale submodule 2010-10-30 19:52:05 -03:00
Guillermo Rauch
03428220a1 Cleaned up submodules 2010-10-30 19:51:50 -03:00
Guillermo Rauch
84c7e96b93 Removed submodules 2010-10-30 19:51:05 -03:00
Guillermo Rauch
8323a43480 Client#broadcast test 2010-10-30 19:45:19 -03:00
Guillermo Rauch
fd19426757 utils tests 2010-10-30 19:10:10 -03:00
Guillermo Rauch
19350dfa3e Moved encode/decode tests into util.js 2010-10-30 19:09:48 -03:00
Guillermo Rauch
5bf9097b39 Disabled 843 server. Will move into utility so that people can set up server-wide policy, and it just doesn't depend on socket.io 2010-10-30 18:51:26 -03:00
Guillermo Rauch
aa6f30210c More cleanup of flashsocket netserver 2010-10-30 17:44:30 -03:00
Guillermo Rauch
20383bd5c4 Cleaned up flashsocket netserver 2010-10-30 17:38:34 -03:00
Guillermo Rauch
9bc6c653c3 Make sure to end and destroy connection onDisconnect (for timeouts) 2010-10-30 15:47:19 -03:00
Guillermo Rauch
64385011af Added flashsocket tests 2010-10-29 09:41:48 -03:00
Guillermo Rauch
9b8fb373bf Removed warning for inline flash policy (will add to docs) 2010-10-29 09:41:12 -03:00
Guillermo Rauch
e516148776 Prepared package.json for npm deployment 2010-10-29 08:21:05 -03:00
Guillermo Rauch
89b18c01ae Merge branch 'master' of git://github.com/kanaka/Socket.IO-node 2010-10-29 03:11:34 -03:00
Guillermo Rauch
2c0aa50d17 Added missing .listen() call to example. Fixes #80. Thanks @machee 2010-10-29 03:07:13 -03:00
Guillermo Rauch
4665f54b43 More consistent connection abortion in websocket transport 2010-10-28 23:19:31 -03:00
Guillermo Rauch
41ea4dbac6 Simplified error handling in client serving 2010-10-28 23:16:11 -03:00
Guillermo Rauch
bdbb419f95 Invalid transport test completed 2010-10-28 23:14:38 -03:00
Guillermo Rauch
71c99bfb87 Initial stab at trying to detect invalid transport responses
Make sure to provide a default for `log` if no log key was provided (internal)
2010-10-28 05:40:30 -03:00
Guillermo Rauch
bd654b74d4 Removed unnecessary file extension verification when serving the client 2010-10-28 05:23:32 -03:00
Guillermo Rauch
f6c2353066 Removed unnecessary Client check upon connection
Added support for /socket.io/WebSocketMain.swf
Added test for /socket.io/WebSocketMain.swf
2010-10-28 05:17:18 -03:00
Guillermo Rauch
9be3daf908 Client serving ETag testing 2010-10-28 05:00:24 -03:00
Guillermo Rauch
8d0196683b Added htmlfile transport tests 2010-10-28 04:12:57 -03:00
Guillermo Rauch
49f556e597 Added extra byte to IE iframe bytes padding 2010-10-28 04:12:29 -03:00
Guillermo Rauch
5caf5b8c75 JSONP Polling posts 2010-10-27 04:27:52 -03:00
Guillermo Rauch
85ad36e4dc Invalid session id test
Potenital fix for timeout assertion uncaught exception
2010-10-27 03:25:13 -03:00
Guillermo Rauch
1046e7275c Listener broadcasting test (* sometimes hangs) 2010-10-25 03:55:43 -03:00
Guillermo Rauch
6194b84b7d end() before destroy()ing the socket for non-WebSocket or non-valid Upgrade requests 2010-10-25 03:27:30 -03:00
Guillermo Rauch
22bc8a6e34 Added listener tests 2010-10-25 03:26:41 -03:00
Guillermo Rauch
880eaa1047 Only utilize 7XXX ports across tests 2010-10-25 03:25:58 -03:00
Guillermo Rauch
22df0e8191 Added test for non-socket.io requests
Simplified index.js tests
Moved listener tests into listener.js
2010-10-25 02:59:25 -03:00
Guillermo Rauch
8b483789fe Make sure to call .end() when listening on connection 'end' event
Make sure the file descriptor is destroyed on disconnection
Fix for websocket client tracking test
2010-10-24 20:31:18 -03:00
Joel Martin
25f1839923 Inline (same port) flash socket policy request.
If the server is not run with root privileges, then the flashsocket
transport will instead listen to all new connections on the main port
for policy requests.

Flash policy requests happen to both port 843 and
the destination port:
http://www.lightsphere.com/dev/articles/flash_socket_policy.html
2010-10-24 17:38:33 -05:00
Guillermo Rauch
7ea53b8bee [websocket test] Fix sending message to client upon connecting 2010-10-24 18:59:59 -03:00
Guillermo Rauch
75a4705426 [websocket test] Fix for connection and handshake test 2010-10-24 17:15:06 -03:00
Guillermo Rauch
4283ee3b8f [client files serving] Leverage end() write() call 2010-10-24 15:30:52 -03:00
Guillermo Rauch
3f97777749 [client serving] Make sure to not do a useless file lookup when file is cached 2010-10-24 15:29:56 -03:00
Guillermo Rauch
72497517d3 Fixed multipart heartbeat test 2010-10-24 15:17:02 -03:00
Guillermo Rauch
e66751f65a Finished json encoding test 2010-10-24 15:11:49 -03:00
Guillermo Rauch
39a558ee3d Look for the heartbeat in the decoded message 2010-10-24 14:57:20 -03:00
Guillermo Rauch
4eda3d374d Refactored websocket transports tests to match polling/multipart helpers
Make sure to close client/server in heartbeat test
2010-10-24 14:54:11 -03:00
Guillermo Rauch
a65326e640 Added gitignore
Added coverage testing to Makefile
Added heartbeat test to multipart
2010-10-24 12:50:34 -03:00
Guillermo Rauch
3ecb37de17 Added buffered messages test for multipart
Added assertions for `connected` property for all the tests
2010-10-20 13:47:59 -03:00
Guillermo Rauch
6a6779697d Multipart clients tracking test 2010-10-20 04:07:40 -03:00
Guillermo Rauch
6ad4df3f64 Multipart client>server message sending test
Make sure to only close the client stream when the roundtrip is complete
2010-10-20 04:02:25 -03:00
Guillermo Rauch
1defee7e6c Multipart connection and handshake tests:
- Implemented HTTP client on top of net.Stream with multipart boundary parsing for testing
- Test for connection / server>client message sending
2010-10-20 03:48:09 -03:00
Guillermo Rauch
148aa74a29 Removed unnecessary check for this.connection (since we now access the socket through req.connection for all transports)
Started on multipart tests
2010-10-19 15:33:57 -03:00
Guillermo Rauch
d624ef3ea8 Test for duration parameter
Close the server
2010-10-19 15:06:06 -03:00
Guillermo Rauch
25f597a9f8 Added make example to Makefile
Added clients tracking test for long polling
Added message buffering test for long polling
2010-10-19 14:18:34 -03:00
Guillermo Rauch
c365c601f0 Improve this.request/this.response/this.connection
Add 'end' listener onConnect, applies to all transports
Improved error handling onConnect
Remove legacy `flush` calls
Removed unnecessary closeTimeout clearing in jsonp polling
2010-10-18 20:13:57 -03:00
Guillermo Rauch
f0e5643533 Fix for this.connection
Clean up in websocket transport
2010-10-18 19:17:08 -03:00
Guillermo Rauch
7fbb069eaa Make sure to close on disconnect if _open = true
Clear disconnection timeout on disconnection (double check)
Make sure to clear closeTimeout for polling transports on close.
2010-10-18 18:15:55 -03:00
Guillermo Rauch
6712d71a2e Replaced empty with null in log option
Comma first style for client serving tests
2010-10-18 18:05:32 -03:00
Guillermo Rauch
57e9b41102 Corrected options overriding order 2010-10-18 17:10:39 -03:00
Guillermo Rauch
080e8944a3 Re-enabled serving static files test
Changed handling of options so that polling defaults are in the respective transports
Switched to comma-first style
2010-10-18 17:05:19 -03:00
Guillermo Rauch
8b52e1f8ed Long polling integration tests
- Utility functions
 - Connection and handshake test
2010-10-17 21:29:19 -03:00
Guillermo Rauch
66a6e6d37e Test for heartbeat message 2010-10-17 18:08:41 -03:00
Guillermo Rauch
464a1c6448 Added heartbeat timeout test
Support for listener#log false
2010-10-17 18:06:53 -03:00
Guillermo Rauch
18a0b99282 Corrected onConnect signature to support a request and a socket, or a request and a response.
Removed error checking for non-upgradeable sockets, since they'll be destroyed, and error handling is done onConnect
Added tests for websocket client tracking
Added tests for websocket message buffering
Make sure disconnect timeout is cleared on websocket re-connect
2010-10-17 05:41:29 -03:00
Arnout Kazemier
52d7c53e46 Updated the flash socket with error detection, and readystate detection.
This is needed because when a error occures we close down the connection,
and the stream will become unwriteable.
Also changed to a single write instead of multiple writes.
2010-10-06 10:00:07 +02:00
Guillermo Rauch
999eba68dc Moved error handling to onConnect to avoid messing with the http.Server global error handlers
Do special error handling for websocket
2010-10-04 16:48:54 -03:00
Guillermo Rauch
af81e0ca52 Merge branch 'master' of git://github.com/3rd-Eden/Socket.IO-node 2010-10-04 16:43:20 -03:00
Guillermo Rauch
6f37628b4f Clearing heartbeat interval upon closing the connection
Commenting client serving test (made the tests hang)
Make sure to close the netserver if all listeners http servers are closed
2010-10-04 16:41:48 -03:00
Arnout Kazemier
e2bb868ed2 Added error listeners, if theses errors are not correcly caught, they will leak memory.
This caused http://speedo.no.de/ to go up from 1mb per connection after a ECONNECTRESET message
2010-10-04 21:21:53 +02:00
Arnout Kazemier
eeab2fd153 Sometimes the listener.options is not available, and creates uncaught exception.
This small if statement solves it.
2010-10-04 21:10:02 +02:00
Guillermo Rauch
30f0521461 Adapting websocket client api to ev.data
Closing as opposed to disconnecting when websocket errors out
2010-10-03 18:44:17 -03:00
Guillermo Rauch
36463a245e Moved dependencies into support/ from tests/support
Adapted Makefile
2010-10-03 18:24:16 -03:00
Guillermo Rauch
0dd9cc3ada _decode and _encode moved to utils
Removed accidental 1==2 for serving the not modified status code for the client
Finished websocket test
2010-10-03 18:19:21 -03:00
Guillermo Rauch
2dd8c58506 Re-enabling all tests 2010-10-03 15:59:06 -03:00
Guillermo Rauch
4465d3416b Tabs => spaces 2010-10-03 15:40:06 -03:00
Guillermo Rauch
b5deea4855 Converted tabs into spaces
Typo fix in flash socket warning message
2010-10-03 15:39:24 -03:00
Guillermo Rauch
a883f17fac Close the server upon timeout
Starting converting back to spaces to comply with node coding standards
2010-10-03 15:32:51 -03:00
Guillermo Rauch
96603825d1 Merge branch 'master' of git://github.com/maccman/Socket.IO-node 2010-10-01 11:24:08 -03:00
Guillermo Rauch
ee2a71755f Merge branch 'master' of git://github.com/SlNPacifist/Socket.IO-node 2010-09-29 12:28:08 -03:00
slnpacifist
1907b41637 returned data.length in listener.js since data is of type buffer 2010-09-29 19:58:55 +07:00
Guillermo Rauch
50f98107a4 Node required version 2010-09-28 13:09:47 +02:00
slnpacifist
d2ead47fca added encode=UTF-8 in jsonp-polling.js and xhr-polling.js since UTF-8 is the default encoding for http.ServerResponse.write
replaced string.length with Buffer.byteLength in jsonp-polling.js, listener.js and xhr-polling.js because content-length header requires number of bytes and not the number of symbols in string
2010-09-28 17:28:31 +07:00
Alex
4803d7b888 Merge branch 'master' of github.com:maccman/Socket.IO-node 2010-09-28 00:28:00 +01:00
Alex MacCaw
607fe38952 Fix COR headers/requests for different ports on Safari. 2010-09-27 06:46:19 -07:00
Alex MacCaw
fcba035330 Fix COR headers/requests for different ports on Safari. 2010-09-27 06:45:53 -07:00
Guillermo Rauch
c1e08318ca Clearing the references to request, response and connection upon disconnect. 2010-09-26 16:29:51 +02:00
Guillermo Rauch
9cb8e3761b Updated client 2010-09-25 11:20:58 +02:00
Guillermo Rauch
965bc9797a Updating client 2010-09-24 06:05:27 +02:00
Alex
c06de0953b add package.json for npm 2010-09-23 11:34:31 +01:00
Guillermo Rauch
17d5ab7fe7 Updated client 2010-09-20 16:29:45 -07:00
Guillermo Rauch
880fb2b71d Updated client
[ocd] fix
2010-09-20 16:26:52 -07:00
Guillermo Rauch
0464e4c1b5 Updated client 2010-09-20 15:42:54 -07:00
Guillermo Rauch
8ef523b97e Expresso updated for regular expressions suppport (thanks tj) 2010-09-20 12:32:49 -07:00
Guillermo Rauch
a264f98e78 Updated expresso 2010-09-20 12:23:03 -07:00
Guillermo Rauch
efd458be7d Cleaned up index and websocket tests 2010-09-20 12:03:18 -07:00
Guillermo Rauch
876cb2bd2e Corrected Makefile target tests expression 2010-09-20 11:56:59 -07:00
Guillermo Rauch
5524812243 client.js tests fixes
Removed `.test` suffix from tests
Updated node-websocket-client
2010-09-20 11:56:27 -07:00
Guillermo Rauch
fbb9a46ba0 Credits to 3rd-Eden for his many patches 2010-09-17 16:11:00 -07:00
Arnout Kazemier
c6b176555e Every require is blocking and requiring the sys module over and over and over again just makes no sense + it hurt performance.. Not to mention.. that it's already included. 2010-09-17 14:52:57 -07:00
Arnout Kazemier
a387982289 When an error occurs during the connection we should disconnect 2010-09-17 13:51:25 -07:00
Arnout Kazemier
fac2498f1f The listen method doesn't return a netserver instance, so the server onclose netserver.close will fail because netserver will be undefined. 2010-09-17 13:50:06 -07:00
Guillermo Rauch
28909f3826 Updated client 2010-09-10 13:36:19 -07:00
Guillermo Rauch
61f4e27029 Socket.IO-node now serves the client out of the box for easier implementation
Memory caching and ETag support for static files
Tests
Simplified demo even further thanks to new static file serving
2010-09-09 17:54:25 -07:00
mgc
4b75668511 Failing to pass an origin header would throw an exception and crash the server. Added some handling. 2010-09-04 04:50:44 -04:00
Guillermo Rauch
d0415723ff .connected renamed to ._open, and adopted proper connected (fixes #41)
example/client updated to latest socket.io client
2010-09-05 16:49:18 -07:00
Guillermo Rauch
61e76db16c Better checking of WebSocket connections 2010-09-03 11:47:31 -07:00
Guillermo Rauch
701c35d952 Fix for certain buggy clients. Needs more investigation. Thanks Malte Ubl (@cramforce) for the report. Fixes #44 2010-09-03 11:28:23 -07:00
Guillermo Rauch
84ee2d8788 Updated client 2010-09-02 12:28:17 -07:00
Guillermo Rauch
e1cffb260c Spacing fix 2010-09-01 13:25:50 -07:00
Guillermo Rauch
670ecbec89 Updated client 2010-09-01 02:06:45 -07:00
Guillermo Rauch
d920f8e64a Merge branch 'master' of git://github.com/aheckmann/Socket.IO-node 2010-09-01 01:31:39 -07:00
Guillermo Rauch
5279b13f54 Better handling of SSL location (thanks @jdub) 2010-09-01 01:26:23 -07:00
Aaron Heckmann
831c293b0c cache the length property 2010-09-01 01:07:24 -04:00
Guillermo Rauch
691de0ed7f Fix for cross-domain websocket (fixes #42) 2010-08-31 15:26:56 -07:00
Guillermo Rauch
c9ec8e27d2 Updated docs
Added clientsIndex reference for BC
2010-08-31 14:36:05 -07:00
Guillermo Rauch
ab623c341b Added sweet error message when trying to use flashsocket without root privileges (thanks @wink for inspiration)
Removed clients/clientsIndex and only using the index (fixes #28)
2010-08-31 14:26:02 -07:00
Guillermo Rauch
24b2714820 [README] Transports clarification 2010-08-31 12:10:25 -07:00
Guillermo Rauch
c023fae2e2 Updated client
Fixed WebSocket location header for ws/wss (Thanks @jdub, Fixes #40)
2010-08-30 19:00:52 -07:00
Guillermo Rauch
39bc1755d8 end was being fired before the connection had really ended in MobileSafari (fixes #29 and potentially creationix issue) 2010-08-30 18:13:26 -07:00
Guillermo Rauch
83ca36d54f Cross domain issues with xhr-polling addressed. Thanks Niko Kaiser (@nicokaiser)
Added origin verification for incoming data.
2010-08-30 17:00:18 -07:00
Guillermo Rauch
dace58b3f7 Updated client 2010-08-30 15:24:10 -07:00
Guillermo Rauch
87f69ab566 Make sure pathname is set (thanks steadicat & swarmation team) 2010-08-30 12:54:39 -07:00
Guillermo Rauch
b705fff132 Fix for accessing routes that being with the namespace but are not a connection attempt. Thanks @steadicat from swarmation 2010-08-30 12:32:55 -07:00
Guillermo Rauch
8e9467719d Updated client 2010-08-29 18:27:53 -07:00
Guillermo Rauch
0dfdc4c83e Cleanup 2010-08-29 17:07:45 -07:00
Guillermo Rauch
72a173e1f1 Some fixes for JSONP-polling 2010-08-29 15:53:41 -07:00
Guillermo Rauch
50a68c9210 JSONP-polling support 2010-08-26 15:50:31 -07:00
Guillermo Rauch
56f0c0f40e Updated client 2010-08-26 13:37:08 -07:00
Guillermo Rauch
cec2e282db Graceful closing of connection for invalid websocket clients 2010-08-24 17:24:40 -07:00
Guillermo Rauch
4bec17e903 Make it possible to just require 'socket.io' 2010-08-24 17:18:22 -07:00
Guillermo Rauch
699e3f1d52 Make sure to abort the connect() method upon bad upgrade / origin verification 2010-08-24 15:51:21 -07:00
Guillermo Rauch
70759ed532 Support for automatic JSON encoding/decoding
Simplified chat example to take advantage of JSON encoding/decoding
Removed fs sync call from example
2010-08-23 21:20:55 -07:00
Guillermo Rauch
7b7270d5ae Better how to use 2010-08-12 23:57:44 -07:00
Guillermo Rauch
e9ffd89050 Updated chat example (thanks saikat) 2010-08-04 16:10:00 -07:00
Guillermo Rauch
757337fac5 Cleanly closing connection if data is incorrectly framed
Reorganized tests
2010-08-02 09:50:28 -07:00
Guillermo Rauch
522318a60d Make sure to send content-type text/plain to ok POST responses 2010-08-01 17:16:20 -07:00
Guillermo Rauch
c173141f8b Updated client 2010-08-01 14:05:55 -07:00
Guillermo Rauch
91cdddb32c Updated client to 0.5.2 2010-08-01 11:27:43 -07:00
Guillermo Rauch
4acf98db9d Fixed require path in README (thanks Tobsn) 2010-07-29 11:09:21 -07:00
Guillermo Rauch
73cc5e2c66 Updated client 2010-07-29 10:37:44 -07:00
Guillermo Rauch
58ac323423 Extended how to use section 2010-07-29 02:04:02 -07:00
Guillermo Rauch
cd2c5140f1 Updated client 2010-07-29 01:59:02 -07:00
812 changed files with 237006 additions and 758 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
.DS_Store
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid

9
.gitmodules vendored
View File

@@ -1,9 +0,0 @@
[submodule "example/client"]
path = example/client
url = git://github.com/LearnBoost/Socket.IO.git
[submodule "tests/support/expresso"]
path = tests/support/expresso
url = git://github.com/visionmedia/expresso.git
[submodule "tests/support/node-websocket-client"]
path = tests/support/node-websocket-client
url = git://github.com/pgriess/node-websocket-client.git

220
History.md Normal file
View File

@@ -0,0 +1,220 @@
0.6.14 / 2011-02-18
===================
* Fixed logging scope issue [shripad]
0.6.13 / 2011-02-18
===================
* Fixed references to listener when logging
0.6.12 / 2011-02-18
===================
* Fixed noDelay missing file descriptor problem
0.6.11 / 2011-02-15
===================
* Fixed; Make sure to not execute any other connection operations after WebSocket
write error.
* Added more error logging
0.6.10 / 2011-02-09
===================
* Added SSL chat example (`make example-ssl`)
* Fixed; possible write errors when a connection error event fires
0.6.9 / 2011-02-06
==================
* 0.3 compatibility
* Updated socket.io client to 0.6.2
* Fixed Flash inline policy serving for Firefox 4
* Updated expresso
* Added comments and version number to socket.io/index
0.6.8 / 2011-01-10
==================
* Fixed issue with terminating connection twice
0.6.7 / 2011-01-09
==================
* Fixed situation where the connection drops but the client can still autoreconnect
through a different socket. In this case we still want to clear the FD but not
call onDisconnect immediately.
0.6.6 / 2011-01-09
==================
* Note for Flash socket and inline policy on Firefox
* Destroy the fds on disconnect
* Restored 20 secs of polling so that node doesn't timeout the connections
0.6.5 / 2011-01-09
==================
* Make sure not to trigger multiple timeouts when closing
* Important fix for polling transports.
0.6.4 / 2011-01-05
==================
* Don't destroy the connection in _onClose. Destroying it will prevent the buffers from being flushed and will result in corrupted responses for the xhr-polling transport.
* Added try/catch block around JSON.parse and return an empty object literal if JSON parsing fails.
* Added missing .connect() to example
0.6.3 / 2010-12-23
==================
* Changed polling default duration to 50 seconds
* might > will Adjusted to 85 column limit
* Support for resources that include slashes. Thanks @schamane
* Lazy loading of transports. Thanks @technoweenie Fixed README transports list
* OpenSSL clarifications (thanks @bmnds)
* Support for HAProxy load balancing (thanks Brian McKelvey) Backported Parser from 0.7
* Fixed HTTP API in example (was outdated). Thanks deedubs
* 0.3 compatibility (thanks Arnout)
* `client.broadcast` now 300% faster Cleaned up chat example
* fixed bad pluralization.
* cleaned up grammar, missing punctuation, etc.
* Restored global `netserver` for flashsocket Now supporting `flashPolicyServer` option (thanks Arnout) Tests passing with and without sudo/root user Fixed noDelay/timeout/utf-8 for draft 76 (accidental typo)
* Close the netServer when the main http server closes, this way the event loop does not keep running. NOTE: this is patch for node 0.2.X, this is not required for node 0.3.X
* Fallback to try{}catch handling for node < 0.2.4 , node 0.3.X seems to capture the errors correctly using the error event.
* Added the flash policy server, it's enabled by default but can be turned off if needed. Socket.io will automatically fallback to serving the policy file inline if server is disabled or unable to start up.
* Make sure to only write to open transports (thanks JohnDav)
* _open is still false, so destroy the connection immediately upon websocket error
* Make sure .connection is not null on 'end'
* Proper fix for invalid websocket key
0.6.1 / 2010-11-08
* Restored flash policy server, but with these changes:
- It's contingent on the listener flashPolicyServer option
- It's started by default if socket.io is started with root access
- It correctly closes the netserver upon all the dependent http servers being closed
- The handler for the inline request is still there regardless. This is important in the following circumstances, and has no performance hit
- The port 843 is filtered
- Flash at some point enables us to skip 843 checking altogether
- Tests compatibility
* Fixed connection timeout, noDelay and socket encoding for draft 76 (had been accidentally moved into the `else` block)
* Some stylistic fixes
0.6.0 / 2010-11-01
==================
* Make sure to only write to open transports (thanks JohnDav)
* _open is still false, so destroy the connection immediately upon websocket error
* Make sure to disconnect directly onClose if the client is not handshaked and he can't possibly reconnect
* Make sure to end and destroy connection onDisconnect (for timeouts)
* Added missing .listen() call to example. Fixes #80. Thanks @machee
* Invalid transport test completed
* Initial stab at trying to detect invalid transport responses
* Make sure to provide a default for `log` if no log key was provided (internal)
* Removed unnecessary file extension verification when serving the client
* Removed unnecessary Client check upon connection
* Added support for /socket.io/WebSocketMain.swf
* Added test for /socket.io/WebSocketMain.swf
* Client serving ETag testing
* Added htmlfile transport tests
* Added extra byte to IE iframe bytes padding
* Invalid session id test
* end() before destroy()ing the socket for non-WebSocket or non-valid Upgrade requests
* Added test for non-socket.io requests
* Simplified index.js tests
* Moved listener tests into listener.js
* Make sure to call .end() when listening on connection 'end' event
* Make sure the file descriptor is destroyed on disconnection
* Fix for websocket client tracking test
* Inline (same port) flash socket policy request.
* If the server is not run with root privileges, then the flashsocket
transport will instead listen to all new connections on the main port
for policy requests. Flash policy requests happen to both port 843 and
the destination port:
http://www.lightsphere.com/dev/articles/flash_socket_policy.html
* [websocket test] Fix sending message to client upon connecting
* [websocket test] Fix for connection and handshake test
* [client files serving] Leverage end() write() call
* [client serving] Make sure to not do a useless file lookup when file is cached
* Finished json encoding test
* Look for the heartbeat in the decoded message
* Refactored websocket transports tests to match polling/multipart helpers
* Added coverage testing to Makefile
* Added heartbeat test to multipart
* Added buffered messages test for multipart
* Added assertions for `connected` property for all the tests
* Multipart clients tracking test
* Multipart client>server message sending test
* Make sure to only close the client stream when the roundtrip is complete
* Multipart connection and handshake tests:
- Implemented HTTP client on top of net.Stream with multipart boundary parsing for testing
- Test for connection / server>client message sending
* Removed unnecessary check for this.connection (since we now access the socket through req.connection for all transports)
* Test for `duration` parameter
* Added `make example` to Makefile
* Added clients tracking test for long polling
* Added message buffering test for long polling
* Improve this.request/this.response/this.connection
* Add 'end' listener onConnect, applies to all transports
* Improved error handling onConnect
* Remove legacy `flush` calls
* Removed unnecessary closeTimeout clearing in jsonp polling
* Make sure to close on disconnect if _open = true
* Clear disconnection timeout on disconnection (double check)
* Make sure to clear closeTimeout for polling transports on close.
* Replaced empty with null in log option
* Comma first style for client serving tests
* Long polling integration tests
* Test for heartbeat message
* Added heartbeat timeout test
* Support for listener#log false
* Corrected onConnect signature to support a request and a socket, or a request and a response.
* Removed error checking for non-upgradeable sockets, since they'll be destroyed, and error handling is done onConnect
* Added tests for websocket client tracking
* Added tests for websocket message buffering
* Make sure disconnect timeout is cleared on websocket re-connect
* Updated the flash socket with error detection, and readystate detection.
* This is needed because when a error occures we close down the connection,
* and the stream will become unwriteable.
* Also changed to a single write instead of multiple writes.
* Moved error handling to onConnect to avoid messing with the http.Server global error handlers
* Do special error handling for websocket
* Clearing heartbeat interval upon closing the connection
* Added error listeners, if theses errors are not correcly caught, they will leak memory.
* This caused http://speedo.no.de/ to go up from 1mb per connection after a ECONNECTRESET message
* Added encode=UTF-8 in jsonp-polling.js and xhr-polling.js since UTF-8 is the default encoding for http.ServerResponse.write
* Replaced string.length with Buffer.byteLength in jsonp-polling.js, listener.js and xhr-polling.js because content-length header requires number of bytes and not the number of symbols in string
* Fix COR headers/requests for different ports on Safari.
* Clearing the references to request, response and connection upon disconnect.
* Every require is blocking and requiring the sys module over and over and over again just makes no sense + it hurt performance.. Not to mention.. that it's already included.
* Socket.IO-node now serves the client out of the box for easier implementation
* Memory caching and ETag support for static files
* Tests
* Simplified demo even further thanks to new static file serving
* Failing to pass an origin header would throw an exception and crash the server. Added some handling.
* .connected renamed to ._open, and adopted proper `connected` (fixes #41)
* example/client updated to latest socket.io client
* Better checking of WebSocket connections
* Better handling of SSL location (thanks @jdub)
* Fix for cross-domain websocket (fixes #42)
* Removed clients/clientsIndex and only using the index (fixes #28)
* Fixed WebSocket location header for ws/wss (Thanks @jdub, Fixes #40)
* Cross domain issues with xhr-polling addressed. Thanks Niko Kaiser (@nicokaiser)
* Added origin verification for incoming data.
* Make sure pathname is set (thanks steadicat & swarmation team)
* Fix for accessing routes that being with the namespace but are not a connection attempt. Thanks @steadicat from swarmation
* JSONP-polling support
* Graceful closing of connection for invalid websocket clients
* Make it possible to just require 'socket.io'
* Make sure to abort the connect() method upon bad upgrade / origin verification
* Support for automatic JSON encoding/decoding
* Simplified chat example to take advantage of JSON encoding/decoding
* Removed fs sync call from example
* Better `how to use`
* Make sure to send content-type text/plain to `ok` POST responses

View File

@@ -1,2 +1,13 @@
test:
./tests/support/expresso/bin/expresso -I lib $(TESTFLAGS) tests/*.test.js
./support/expresso/bin/expresso -I lib $(TESTFLAGS) tests/*.js
test-cov:
@TESTFLAGS=--cov $(MAKE) test
example:
node ./example/server.js
example-ssl:
node ./example/server-ssl.js
.PHONY: example

139
README.md
View File

@@ -1,58 +1,71 @@
Socket.IO Server: Sockets for the rest of us
============================================
The `Socket.IO` server provides seamless supports for a variety of transports intended for realtime communication
The `Socket.IO` server provides seamless support for a variety of transports intended for realtime communication.
- WebSocket (with Flash policy support)
- WebSocket
- WebSocket over Flash (+ XML security policy support)
- XHR Polling
- XHR Multipart Streaming
- Forever Iframe
- JSONP Polling (for cross domain)
Requirements
------------
## Requirements
- Node v0.1.102+
- [Socket.IO client](http://github.com/LearnBoost/Socket.IO) to connect from the browser
- Node v0.1.103+ with `crypto` module support (make sure you have OpenSSL
headers when installing Node to get it)
- The [Socket.IO client](http://github.com/LearnBoost/Socket.IO), to connect from the browser
How to use
----------
## How to use
`Socket.IO` is designed not to take over an entire port or Node `http.Server` instance. This means that if you choose your HTTP server to listen on the port 80, `socket.io` can intercept requests directed to it and the normal requests will still be served.
To run the demo, execute the following:
By default, the server will intercept requests that contain `socket.io` in the path / resource part of the URI. You can change this (look at the available options below).
git clone git://github.com/LearnBoost/Socket.IO-node.git socket.io
cd socket.io/example/
sudo node server.js
and point your browser to `http://localhost:8080`. In addition to `8080`, if the transport `flashsocket` is enabled, a server will be initialized to listen for requests on port `843`.
### Implementing it on your project
`Socket.IO` is designed not to take over an entire port or Node `http.Server` instance. This means that if you choose to have your HTTP server listen on port `80`, `socket.io` can intercept requests directed to it, and normal requests will still be served.
By default, the server will intercept requests that contain `socket.io` in the path / resource part of the URI. You can change this as shown in the available options below.
On the server:
var http = require('http'),
io = require('./socket.io/socket.io.js'),
io = require('./path/to/socket.io'),
server = http.createServer(function(req, res){
// your normal server code
res.writeHeader(200, {'Content-Type': 'text/html'});
res.writeBody('<h1>Hello world</h1>');
res.finish();
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('<h1>Hello world</h1>');
});
server.listen(80);
// socket.io, I choose you
io.listen(server);
var socket = io.listen(server);
On the client side, you should use the [Socket.IO client](https://github.com/LearnBoost/Socket.IO) to connect.
## Notes
IMPORTANT! When checking out the git repo, make sure to include the submodules. One way to do it is:
git clone [repo] --recursive
Another, once cloned
git submodule update --init --recursive
## Demo
To run the demo, go to `example` directory and run
sudo node server.js
socket.on('connection', function(client){
// new client is here!
client.on('message', function(){ … })
client.on('disconnect', function(){ … })
});
and point your browser to http://localhost:8080. In addition to 8080, if the transport `flashsocket` is enabled, a server will be initialized to listen to requests on the port 843.
On the client:
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = new io.Socket();
socket.connect();
socket.on('connect', function(){ … })
socket.on('message', function(){ … })
socket.on('disconnect', function(){ … })
</script>
The [client-side](http://github.com/learnboost/socket.io) files are served automatically by `Socket.IO-node`.
## Documentation
@@ -66,19 +79,15 @@ Public Properties:
- *server*
The instance of _process.http.Server_
An instance of _process.http.Server_.
- *options*
The passed in options combined with the defaults
The passed-in options, combined with the defaults.
- *clients*
An array of clients. Important: disconnected clients are set to null, the array is not spliced.
- *clientsIndex*
An object of clients indexed by their session ids.
An object of clients, indexed by session ID.
Methods:
@@ -88,11 +97,11 @@ Methods:
- *removeListener(event, λ)*
Remove a listener from the listener array for the specified event.
Removes a listener from the listener array for the specified event.
- *broadcast(message, [except])*
Broadcasts a message to all clients. There's an optional second argument which is an array of session ids or a single session id to avoid broadcasting to.
Broadcasts a message to all clients. Optionally, you can pass a single session ID or array of session IDs to avoid broadcasting to, as the second argument.
Options:
@@ -100,11 +109,19 @@ Options:
socket.io
The resource is what allows the `socket.io` server to identify incoming connections by `socket.io` clients. Make sure they're in sync.
The resource is what allows the `socket.io` server to identify incoming connections from `socket.io` clients. Make sure they're in sync.
- *flashPolicyServer*
true
Create a Flash Policy file server on port `843` (this is restricted port and you will need to have root permission). If you disable the FlashPolicy file server, Socket.IO will automatically fall back to serving the policy file inline.
- *transports*
['websocket', 'server-events', 'flashsocket', 'htmlfile', 'xhr-multipart', 'xhr-polling']
['websocket', 'flashsocket', 'htmlfile', 'xhr-multipart', 'xhr-polling',
'jsonp-polling']
A list of the accepted transports.
@@ -116,21 +133,21 @@ Options:
ƒ(){ sys.log }
The logging function. Defaults to outputting to stdout through `sys.log`
The logging function. Defaults to outputting to `stdout` through `sys.log`
Events:
- *clientConnect(client)*
Fired when a client is connected. Receives the Client instance as parameter
Fired when a client is connected. Receives the Client instance as parameter.
- *clientMessage(message, client)*
Fired when a message from a client is received. Receives the message and Client instance as parameter
Fired when a message from a client is received. Receives the message and Client instance as parameters.
- *clientDisconnect(client)*
Fired when a client is disconnected. Receives the Client instance as parameter
Fired when a client is disconnected. Receives the Client instance as a parameter.
Important note: `this` in the event listener refers to the `Listener` instance.
@@ -142,47 +159,49 @@ Public Properties:
- *listener*
The `Listener` instance this client belongs to.
The `Listener` instance to which this client belongs.
- *connected*
Whether the client is connected
Whether the client is connected.
- *connections*
Number of times the client connected
Number of times the client has connected.
Methods:
- *send(message)*
Sends a message to the client
Sends a message to the client.
- *broadcast(message)*
Sends a message to all other clients. Equivalent to Listener::broadcast(message, client.sessionId)
Sends a message to all other clients. Equivalent to Listener::broadcast(message, client.sessionId).
## Protocol
One of the design goals is that you should be able to implement whatever protocol you desire without `Socket.IO` getting in the way. `Socket.IO` has a minimal, unobtrusive protocol layer. It consists of two parts:
One of the design goals is that you should be able to implement whatever protocol you desire without `Socket.IO` getting in the way. `Socket.IO` has a minimal, unobtrusive protocol layer, consisting of two parts:
* Connection handshake
This is required to simulate a full duplex socket with transports such as XHR Polling or Server-sent Events (which is a "one-way socket"). The basic idea is that the first message received from the server will be a JSON object that contains a session id that will be used for further communication exchanged between the client and the server.
This is required to simulate a full duplex socket with transports such as XHR Polling or Server-sent Events (which is a "one-way socket"). The basic idea is that the first message received from the server will be a JSON object that contains a session ID used for further communications exchanged between the client and server.
The concept of session also benefits naturally full-duplex WebSocket, in the event of an accidental disconnection and a quick reconnection. Messages that the server intends to deliver to the client are cached temporarily until the reconnection.
The concept of session also naturally benefits a full-duplex WebSocket, in the event of an accidental disconnection and a quick reconnection. Messages that the server intends to deliver to the client are cached temporarily until reconnection.
The implementation of reconnection logic (potentially with retries) is left for the user. By default, transports that are keep-alive or open all the time (like WebSocket) have a timeout of 0 if a disconnection is detected.
* Message batching
In order to optimize the resources, messages are buffered. In the event of the server trying to send multiple messages while the client is temporarily disconnected (eg: xhr polling), messages are stacked, then encoded in a lightweight way and sent to the client whenever he becomes available.
Messages are buffered in order to optimize resources. In the event of the server trying to send multiple messages while a client is temporarily disconnected (eg: xhr polling), the messages are stacked and then encoded in a lightweight way, and sent to the client whenever it becomes available.
Despite this extra layer, your messages are delivered unaltered to the different event listeners. You can JSON.stringify() objects, send XML, or maybe plain text.
Despite this extra layer, the messages are delivered unaltered to the various event listeners. You can `JSON.stringify()` objects, send XML, or even plain text.
## Credits
Guillermo Rauch &lt;guillermo@learnboost.com&gt;
- Guillermo Rauch &lt;guillermo@learnboost.com&gt; ([Guille](http://github.com/guille))
- Arnout Kazemier ([3rd-Eden](http://github.com/3rd-Eden))
## License
@@ -207,4 +226,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

21
example/cert.crt Normal file
View File

@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDXTCCAkWgAwIBAgIJAMUSOvlaeyQHMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
aWRnaXRzIFB0eSBMdGQwHhcNMTAxMTE2MDkzMjQ5WhcNMTMxMTE1MDkzMjQ5WjBF
MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
CgKCAQEAz+LXZOjcQCJq3+ZKUFabj71oo/ex/XsBcFqtBThjjTw9CVEVwfPQQp4X
wtPiB204vnYXwQ1/R2NdTQqCZu47l79LssL/u2a5Y9+0NEU3nQA5qdt+1FAE0c5o
exPimXOrR3GWfKz7PmZ2O0117IeCUUXPG5U8umhDe/4mDF4ZNJiKc404WthquTqg
S7rLQZHhZ6D0EnGnOkzlmxJMYPNHSOY1/6ivdNUUcC87awNEA3lgfhy25IyBK3QJ
c+aYKNTbt70Lery3bu2wWLFGtmNiGlQTS4JsxImRsECTI727ObS7/FWAQsqW+COL
0Sa5BuMFrFIpjPrEe0ih7vRRbdmXRwIDAQABo1AwTjAdBgNVHQ4EFgQUDnV4d6mD
tOnluLoCjkUHTX/n4agwHwYDVR0jBBgwFoAUDnV4d6mDtOnluLoCjkUHTX/n4agw
DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAFwV4MQfTo+qMv9JMiyno
IEiqfOz4RgtmBqRnXUffcjS2dhc7/z+FPZnM79Kej8eLHoVfxCyWRHFlzm93vEdv
wxOCrD13EDOi08OOZfxWyIlCa6Bg8cMAKqQzd2OvQOWqlRWBTThBJIhWflU33izX
Qn5GdmYqhfpc+9ZHHGhvXNydtRQkdxVK2dZNzLBvBlLlRmtoClU7xm3A+/5dddeP
AQHEPtyFlUw49VYtZ3ru6KqPms7MKvcRhYLsy9rwSfuuniMlx4d0bDR7TOkw0QQS
A0N8MGQRQpzl4mw4jLzyM5d5QtuGBh2P6hPGa0YQxtI3RPT/p6ENzzBiAKXiSfzo
xw==
-----END CERTIFICATE-----

61
example/chat-ssl.html Normal file
View File

@@ -0,0 +1,61 @@
<!doctype html>
<html>
<head>
<title>socket.io client test</title>
<script src="/json.js"></script> <!-- for ie -->
<script src="/socket.io/socket.io.js"></script>
</head>
<body>
<script>
function message(obj){
var el = document.createElement('p');
if ('announcement' in obj) el.innerHTML = '<em>' + esc(obj.announcement) + '</em>';
else if ('message' in obj) el.innerHTML = '<b>' + esc(obj.message[0]) + ':</b> ' + esc(obj.message[1]);
document.getElementById('chat').appendChild(el);
document.getElementById('chat').scrollTop = 1000000;
}
function send(){
var val = document.getElementById('text').value;
socket.send(val);
message({ message: ['you', val] });
document.getElementById('text').value = '';
}
function esc(msg){
return msg.replace(/</g, '&lt;').replace(/>/g, '&gt;');
};
var socket = new io.Socket(null, {port: 443, secure: true, rememberTransport: false});
socket.connect();
socket.on('message', function(obj){
if ('buffer' in obj){
document.getElementById('form').style.display='block';
document.getElementById('chat').innerHTML = '';
for (var i in obj.buffer) message(obj.buffer[i]);
} else message(obj);
});
</script>
<h1>Sample chat client</h1>
<div id="chat"><p>Connecting...</p></div>
<form id="form" onsubmit="send(); return false">
<input type="text" autocomplete="off" id="text"><input type="submit" value="Send">
</form>
<style>
#chat { height: 300px; overflow: auto; width: 800px; border: 1px solid #eee; font: 13px Helvetica, Arial; }
#chat p { padding: 8px; margin: 0; }
#chat p:nth-child(odd) { background: #F6F6F6; }
#form { width: 782px; background: #333; padding: 5px 10px; display: none; }
#form input[type=text] { width: 700px; padding: 5px; background: #fff; border: 1px solid #fff; }
#form input[type=submit] { cursor: pointer; background: #999; border: none; padding: 6px 8px; -moz-border-radius: 8px; -webkit-border-radius: 8px; margin-left: 5px; text-shadow: 0 1px 0 #fff; }
#form input[type=submit]:hover { background: #A2A2A2; }
#form input[type=submit]:active { position: relative; top: 2px; }
</style>
</body>
</html>

View File

@@ -4,13 +4,11 @@
<title>socket.io client test</title>
<script src="/json.js"></script> <!-- for ie -->
<script src="/client/socket.io.js"></script>
<script src="/socket.io/socket.io.js"></script>
</head>
<body>
<script>
io.setPath('/client/');
function message(obj){
var el = document.createElement('p');
if ('announcement' in obj) el.innerHTML = '<em>' + esc(obj.announcement) + '</em>';
@@ -29,19 +27,17 @@
function esc(msg){
return msg.replace(/</g, '&lt;').replace(/>/g, '&gt;');
};
var socket = new io.Socket(null, {rememberTransport: false, port: 8080});
var socket = new io.Socket(null, {port: 8080, rememberTransport: false});
socket.connect();
socket.addEvent('message', function(data){
var obj = JSON.parse(data);
socket.on('message', function(obj){
if ('buffer' in obj){
document.getElementById('form').style.display='block';
document.getElementById('chat').innerHTML = '';
for (var i in obj.buffer) message(obj.buffer[i]);
} else message(obj);
});
});
</script>
<h1>Sample chat client</h1>
@@ -62,4 +58,4 @@
</style>
</body>
</html>
</html>

Submodule example/client deleted from 7a5e2b8cac

27
example/key.key Normal file
View File

@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEAz+LXZOjcQCJq3+ZKUFabj71oo/ex/XsBcFqtBThjjTw9CVEV
wfPQQp4XwtPiB204vnYXwQ1/R2NdTQqCZu47l79LssL/u2a5Y9+0NEU3nQA5qdt+
1FAE0c5oexPimXOrR3GWfKz7PmZ2O0117IeCUUXPG5U8umhDe/4mDF4ZNJiKc404
WthquTqgS7rLQZHhZ6D0EnGnOkzlmxJMYPNHSOY1/6ivdNUUcC87awNEA3lgfhy2
5IyBK3QJc+aYKNTbt70Lery3bu2wWLFGtmNiGlQTS4JsxImRsECTI727ObS7/FWA
QsqW+COL0Sa5BuMFrFIpjPrEe0ih7vRRbdmXRwIDAQABAoIBAGe4+9VqZfJN+dsq
8Osyuz01uQ8OmC0sAWTIqUlQgENIyf9rCJsUBlYmwR5BT6Z69XP6QhHdpSK+TiAR
XUz0EqG9HYzcxHIBaACP7j6iRoQ8R4kbbiWKo0z3WqQGIOqFjvD/mKEuQdE5mEYw
eOUCG6BnX1WY2Yr8WKd2AA/tp0/Y4d8z04u9eodMpSTbHTzYMJb5SbBN1vo6FY7q
8zSuO0BMzXlAxUsCwHsk1GQHFr8Oh3zIR7bQGtMBouI+6Lhh7sjFYsfxJboqMTBV
IKaA216M6ggHG7MU1/jeKcMGDmEfqQLQoyWp29rMK6TklUgipME2L3UD7vTyAVzz
xbVOpZkCgYEA8CXW4sZBBrSSrLR5SB+Ubu9qNTggLowOsC/kVKB2WJ4+xooc5HQo
mFhq1v/WxPQoWIxdYsfg2odlL+JclK5Qcy6vXmRSdAQ5lK9gBDKxZSYc3NwAw2HA
zyHCTK+I0n8PBYQ+yGcrxu0WqTGnlLW+Otk4CejO34WlgHwbH9bbY5UCgYEA3ZvT
C4+OoMHXlmICSt29zUrYiL33IWsR3/MaONxTEDuvgkOSXXQOl/8Ebd6Nu+3WbsSN
bjiPC/JyL1YCVmijdvFpl4gjtgvfJifs4G+QHvO6YfsYoVANk4u6g6rUuBIOwNK4
RwYxwDc0oysp+g7tPxoSgDHReEVKJNzGBe9NGGsCgYEA4O4QP4gCEA3B9BF2J5+s
n9uPVxmiyvZUK6Iv8zP4pThTBBMIzNIf09G9AHPQ7djikU2nioY8jXKTzC3xGTHM
GJZ5m6fLsu7iH+nDvSreDSeNkTBfZqGAvoGYQ8uGE+L+ZuRfCcXYsxIOT5s6o4c3
Dle2rVFpsuKzCY00urW796ECgYBn3go75+xEwrYGQSer6WR1nTgCV29GVYXKPooy
zmmMOT1Yw80NSkEw0pFD4cTyqVYREsTrPU0mn1sPfrOXxnGfZSVFpcR/Je9QVfQ7
eW7GYxwfom335aqHVj10SxRqteP+UoWWnHujCPz94VRKZMakBddYCIGSan+G6YdS
7sdmwwKBgBc2qj0wvGXDF2kCLwSGfWoMf8CS1+5fIiUIdT1e/+7MfDdbmLMIFVjF
QKS3zVViXCbrG5SY6wS9hxoc57f6E2A8vcaX6zy2xkZlGHQCpWRtEM5R01OWJQaH
HsHMmQZGUQVoDm1oRkDhrTFK4K3ukc3rAxzeTZ96utOQN8/KJsTv
-----END RSA PRIVATE KEY-----

66
example/server-ssl.js Normal file
View File

@@ -0,0 +1,66 @@
/**
* Important note: this application is not suitable for benchmarks!
*/
var https = require('https')
, url = require('url')
, fs = require('fs')
, io = require('../')
, sys = require(process.binding('natives').util ? 'util' : 'sys')
, server;
server = https.createServer({
key: fs.readFileSync(__dirname + '/key.key')
, cert: fs.readFileSync(__dirname + '/cert.crt')
}, function(req, res){
// your normal server code
var path = url.parse(req.url).pathname;
switch (path){
case '/':
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('<h1>Welcome. Try the <a href="/chat-ssl.html">SSL Chat</a> example.</h1>');
res.end();
break;
case '/json.js':
case '/chat-ssl.html':
fs.readFile(__dirname + path, function(err, data){
if (err) return send404(res);
res.writeHead(200, {'Content-Type': path == 'json.js' ? 'text/javascript' : 'text/html'})
res.write(data, 'utf8');
res.end();
});
break;
default: send404(res);
}
}),
send404 = function(res){
res.writeHead(404);
res.write('404');
res.end();
};
server.listen(443);
// socket.io, I choose you
// simplest chat application evar
var io = io.listen(server)
, buffer = [];
io.on('connection', function(client){
client.send({ buffer: buffer });
client.broadcast({ announcement: client.sessionId + ' connected' });
client.on('message', function(message){
var msg = { message: [client.sessionId, message] };
buffer.push(msg);
if (buffer.length > 15) buffer.shift();
client.broadcast(msg);
});
client.on('disconnect', function(){
client.broadcast({ announcement: client.sessionId + ' disconnected' });
});
});

View File

@@ -1,63 +1,63 @@
var http = require('http'),
url = require('url'),
fs = require('fs'),
io = require('../'),
sys = require('sys'),
send404 = function(res){
res.writeHead(404);
res.write('404');
res.end();
},
/**
* Important note: this application is not suitable for benchmarks!
*/
var http = require('http')
, url = require('url')
, fs = require('fs')
, io = require('../')
, sys = require(process.binding('natives').util ? 'util' : 'sys')
, server;
server = http.createServer(function(req, res){
// your normal server code
var path = url.parse(req.url).pathname;
switch (path){
case '/':
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('<h1>Welcome. Try the <a href="/chat.html">chat</a> example.</h1>');
res.end();
break;
default:
if (/\.(js|html|swf)$/.test(path)){
try {
var swf = path.substr(-4) === '.swf';
res.writeHead(200, {'Content-Type': swf ? 'application/x-shockwave-flash' : ('text/' + (path.substr(-3) === '.js' ? 'javascript' : 'html'))});
res.write(fs.readFileSync(__dirname + path, swf ? 'binary' : 'utf8'), swf ? 'binary' : 'utf8');
res.end();
} catch(e){
send404(res);
}
break;
}
send404(res);
break;
}
});
// your normal server code
var path = url.parse(req.url).pathname;
switch (path){
case '/':
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('<h1>Welcome. Try the <a href="/chat.html">chat</a> example.</h1>');
res.end();
break;
case '/json.js':
case '/chat.html':
fs.readFile(__dirname + path, function(err, data){
if (err) return send404(res);
res.writeHead(200, {'Content-Type': path == 'json.js' ? 'text/javascript' : 'text/html'})
res.write(data, 'utf8');
res.end();
});
break;
default: send404(res);
}
}),
send404 = function(res){
res.writeHead(404);
res.write('404');
res.end();
};
server.listen(8080);
// socket.io, I choose you
// simplest chat application evar
var buffer = [],
json = JSON.stringify,
io = io.listen(server);
var io = io.listen(server)
, buffer = [];
io.on('connection', function(client){
client.send(json({ buffer: buffer }));
client.broadcast(json({ announcement: client.sessionId + ' connected' }));
client.send({ buffer: buffer });
client.broadcast({ announcement: client.sessionId + ' connected' });
client.on('message', function(message){
var msg = { message: [client.sessionId, message] };
buffer.push(msg);
if (buffer.length > 15) buffer.shift();
client.broadcast(msg);
});
client.on('message', function(message){
var msg = { message: [client.sessionId, message] };
buffer.push(msg);
if (buffer.length > 15) buffer.shift();
client.broadcast(json(msg));
});
client.on('disconnect', function(){
client.broadcast(json({ announcement: client.sessionId + ' disconnected' }));
});
});
client.on('disconnect', function(){
client.broadcast({ announcement: client.sessionId + ' disconnected' });
});
});

View File

@@ -1,4 +1 @@
exports.Listener = require('./lib/socket.io/listener');
exports.listen = function(server, options){
return new exports.Listener(server, options);
};
module.exports = require('./lib/socket.io');

View File

@@ -1,172 +1,186 @@
var urlparse = require('url').parse,
options = require('./utils').options,
frame = '~m~',
var urlparse = require('url').parse
, OutgoingMessage = require('http').OutgoingMessage
, Stream = require('net').Stream
, options = require('./utils').options
, encode = require('./utils').encode
, decode = require('./utils').decode
, merge = require('./utils').merge
, util = require(process.binding('natives').util ? 'util' : 'sys');
Client = module.exports = function(listener, req, res, options, head){
process.EventEmitter.call(this);
this.listener = listener;
this.options({
timeout: 8000,
heartbeatInterval: 10000,
closeTimeout: 0
}, options);
this.connections = 0;
this.connected = false;
this._heartbeats = 0;
this.upgradeHead = head;
this._onConnect(req, res);
var Client = module.exports = function(listener, req, res, options, head){
process.EventEmitter.call(this);
this.listener = listener;
this.options(merge({
timeout: 8000,
heartbeatInterval: 10000,
closeTimeout: 0
}, this.getOptions ? this.getOptions() : {}), options);
this.connections = 0;
this._open = false;
this._heartbeats = 0;
this.connected = false;
this.upgradeHead = head;
this._onConnect(req, res);
};
require('sys').inherits(Client, process.EventEmitter);
util.inherits(Client, process.EventEmitter);
Client.prototype.send = function(message){
if (!this.connected || !(this.connection.readyState === 'open' ||
this.connection.readyState === 'writeOnly')){
return this._queue(message);
}
this._write(this._encode(message));
return this;
if (!this._open || !(this.connection.readyState === 'open' || this.connection.readyState === 'writeOnly')){
return this._queue(message);
}
this._write(encode(message));
return this;
};
Client.prototype.broadcast = function(message){
if (!('sessionId' in this)) return this;
this.listener.broadcast(message, this.sessionId);
return this;
if (!('sessionId' in this)) return this;
this.listener.broadcast(message, this.sessionId);
return this;
};
Client.prototype._onMessage = function(data){
var messages = this._decode(data);
if (messages === false) return this.listener.options.log('Bad message received from client ' + this.sessionId);
for (var i = 0, l = messages.length; i < l; i++){
if (messages[i].substr(0, 3) == '~h~'){
return this._onHeartbeat(messages[i].substr(3));
}
this.emit('message', messages[i]);
this.listener._onClientMessage(messages[i], this);
}
var messages = decode(data);
if (messages === false) return this.listener.options.log('Bad message received from client ' + this.sessionId);
for (var i = 0, l = messages.length, frame; i < l; i++){
frame = messages[i].substr(0, 3);
switch (frame){
case '~h~':
return this._onHeartbeat(messages[i].substr(3));
case '~j~':
try {
messages[i] = JSON.parse(messages[i].substr(3));
} catch(e) {
messages[i] = {};
}
break;
}
this.emit('message', messages[i]);
this.listener._onClientMessage(messages[i], this);
}
};
Client.prototype._onConnect = function(req, res){
var self = this;
this.request = req;
this.response = res;
this.connection = this.request.connection;
if (this._disconnectTimeout) clearTimeout(this._disconnectTimeout);
};
Client.prototype._encode = function(messages){
var ret = '', message,
messages = Array.isArray(messages) ? messages : [messages];
for (var i = 0, l = messages.length; i < l; i++){
message = messages[i] === null || messages[i] === undefined ? '' : String(messages[i]);
ret += frame + message.length + frame + message;
}
return ret;
};
Client.prototype._decode = function(data){
var messages = [], number, n;
do {
if (data.substr(0, 3) !== frame) return messages;
data = data.substr(3);
number = '', n = '';
for (var i = 0, l = data.length; i < l; i++){
n = Number(data.substr(i, 1));
if (data.substr(i, 1) == n){
number += n;
} else {
data = data.substr(number.length + frame.length)
number = Number(number);
break;
}
}
messages.push(data.substr(0, number)); // here
data = data.substr(number);
} while(data !== '');
return messages;
};
Client.prototype._payload = function(){
var payload = [];
this.connections++;
this.connected = true;
if (!this.handshaked){
this._generateSessionId();
payload.push(this.sessionId);
this.handshaked = true;
}
payload = payload.concat(this._writeQueue || []);
this._writeQueue = [];
if (payload.length) this._write(this._encode(payload));
if (this.connections === 1) this.listener._onClientConnect(this);
if (this.options.timeout) this._heartbeat();
};
Client.prototype._heartbeat = function(){
var self = this;
setTimeout(function(){
self.send('~h~' + ++self._heartbeats);
self._heartbeatTimeout = setTimeout(function(){
self._onClose();
}, self.options.timeout);
}, self.options.heartbeatInterval);
};
Client.prototype._onHeartbeat = function(h){
if (h == this._heartbeats){
clearTimeout(this._heartbeatTimeout);
this._heartbeat();
}
var self = this;
this.request = req;
this.response = res;
this.connection = req.connection;
this.connection.addListener('end', function(){
self._onClose();
if (self.connection)
self.connection.destroy();
});
if (req){
req.addListener('error', function(err){
req.destroy && req.destroy();
});
if (res) res.addListener('error', function(err){
res.destroy && res.destroy();
});
req.connection.addListener('error', function(err){
req.connection.destroy && req.connection.destroy();
});
if (this._disconnectTimeout) clearTimeout(this._disconnectTimeout);
}
};
Client.prototype._onClose = function(){
if (this.connected){
var self = this;
if ('_heartbeatTimeout' in this) clearTimeout(this._heartbeatTimeout);
this.connected = false;
this._disconnectTimeout = setTimeout(function(){
self._onDisconnect();
}, this.options.closeTimeout);
}
Client.prototype._payload = function(){
var payload = [];
this.connections++;
this.connected = true;
this._open = true;
if (!this.handshaked){
this._generateSessionId();
payload.push(this.sessionId);
this.handshaked = true;
}
payload = payload.concat(this._writeQueue || []);
this._writeQueue = [];
if (payload.length) this._write(encode(payload));
if (this.connections === 1) this.listener._onClientConnect(this);
if (this.options.timeout) this._heartbeat();
};
Client.prototype._heartbeat = function(){
var self = this;
this._heartbeatInterval = setTimeout(function(){
self.send('~h~' + ++self._heartbeats);
self._heartbeatTimeout = setTimeout(function(){
self._onClose();
}, self.options.timeout);
}, self.options.heartbeatInterval);
};
Client.prototype._onHeartbeat = function(h){
if (h == this._heartbeats){
clearTimeout(this._heartbeatTimeout);
this._heartbeat();
}
};
Client.prototype._onClose = function(skipDisconnect){
if (!this._open) return this;
var self = this;
if (this._heartbeatInterval) clearTimeout(this._heartbeatInterval);
if (this._heartbeatTimeout) clearTimeout(this._heartbeatTimeout);
this._open = false;
this.request = null;
this.response = null;
if (skipDisconnect !== false){
if (this.handshaked){
this._disconnectTimeout = setTimeout(function(){
self._onDisconnect();
}, this.options.closeTimeout);
} else
this._onDisconnect();
}
};
Client.prototype._onDisconnect = function(){
if (!this.finalized){
this._writeQueue = [];
this.connected = false;
this.finalized = true;
if (this.handshaked){
this.emit('disconnect');
this.listener._onClientDisconnect(this);
}
}
if (this._open) this._onClose(true);
if (this._disconnectTimeout) clearTimeout(this._disconnectTimeout);
this._writeQueue = [];
this.connected = false;
if (this.handshaked){
this.emit('disconnect');
this.listener._onClientDisconnect(this);
this.handshaked = false;
}
};
Client.prototype._queue = function(message){
if (!('_writeQueue' in this)){
this._writeQueue = [];
}
this._writeQueue.push(message);
return this;
this._writeQueue = this._writeQueue || [];
this._writeQueue.push(message);
return this;
};
Client.prototype._generateSessionId = function(){
if (this.sessionId) return this.listener.options.log('This client already has a session id');
this.sessionId = Math.random().toString().substr(2);
return this;
this.sessionId = Math.random().toString().substr(2);
return this;
};
Client.prototype._verifyOrigin = function(origin){
var parts = urlparse(origin), origins = this.listener.options.origins;
return origins.indexOf('*:*') !== -1 ||
origins.indexOf(parts.host + ':' + parts.port) !== -1 ||
origins.indexOf(parts.host + ':*') !== -1 ||
origins.indexOf('*:' + parts.port) !== -1;
var origins = this.listener.options.origins;
if (origins.indexOf('*:*') !== -1) {
return true;
}
if (origin) {
try {
var parts = urlparse(origin);
return origins.indexOf(parts.host + ':' + parts.port) !== -1 ||
origins.indexOf(parts.host + ':*') !== -1 ||
origins.indexOf('*:' + parts.port) !== -1;
} catch (ex) {}
}
return false;
};
for (var i in options) Client.prototype[i] = options[i];
for (var i in options) Client.prototype[i] = options[i];

26
lib/socket.io/index.js Normal file
View File

@@ -0,0 +1,26 @@
/**
* Listener creation shorcut
*
* @param {Server} node HTTP server
* @param {Object} options
* @api public
*/
exports.listen = function(server, options){
return new exports.Listener(server, options);
};
/**
* Listener constructor
*
* @api public
*/
exports.Listener = require('./listener');
/**
* Version
*/
exports.version = '0.6.14';

View File

@@ -1,124 +1,166 @@
var url = require('url'),
sys = require('sys'),
options = require('./utils').options,
Client = require('./client'),
transports = {
'flashsocket': require('./transports/flashsocket'),
'htmlfile': require('./transports/htmlfile'),
'websocket': require('./transports/websocket'),
'xhr-multipart': require('./transports/xhr-multipart'),
'xhr-polling': require('./transports/xhr-polling')
},
var url = require('url')
, util = require(process.binding('natives').util ? 'util' : 'sys')
, fs = require('fs')
, options = require('./utils').options
, Client = require('./client')
, clientVersion = require('./../../support/socket.io-client/lib/io').io.version
, transports = {};
Listener = module.exports = function(server, options){
process.EventEmitter.call(this);
var self = this;
this.server = server;
this.options({
origins: '*:*',
resource: 'socket.io',
transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-multipart', 'xhr-polling'],
transportOptions: {
'xhr-polling': {
timeout: null, // no heartbeats for polling
closeTimeout: 8000,
duration: 20000
}
},
log: function(message){
require('sys').log(message);
}
}, options);
this.clients = [];
this.clientsIndex = {};
var listeners = this.server.listeners('request');
this.server.removeAllListeners('request');
this.server.addListener('request', function(req, res){
if (self.check(req, res)) return;
for (var i = 0; i < listeners.length; i++){
listeners[i].call(this, req, res);
}
});
this.server.addListener('upgrade', function(req, socket, head){
if (!self.check(req, socket, true, head)){
socket.destroy();
}
});
for (var i in transports){
if ('init' in transports[i]) transports[i].init(this);
}
this.options.log('socket.io ready - accepting connections');
var Listener = module.exports = function(server, options){
process.EventEmitter.call(this);
var self = this;
this.server = server;
this.options({
origins: '*:*',
resource: 'socket.io',
flashPolicyServer: true,
transports: ['websocket', 'flashsocket', 'htmlfile', 'xhr-multipart',
'xhr-polling', 'jsonp-polling'],
transportOptions: {},
log: util.log
}, options);
if (!this.options.log) this.options.log = function(){};
this.clients = this.clientsIndex = {};
this._clientCount = 0;
this._clientFiles = {};
var listeners = this.server.listeners('request');
this.server.removeAllListeners('request');
this.server.addListener('request', function(req, res){
if (self.check(req, res)) return;
for (var i = 0, len = listeners.length; i < len; i++){
listeners[i].call(this, req, res);
}
});
this.server.addListener('upgrade', function(req, socket, head){
if (!self.check(req, socket, true, head)){
socket.end();
socket.destroy();
}
});
this.options.transports.forEach(function(name) {
if (!(name in transports))
transports[name] = require('./transports/' + name);
if ('init' in transports[name]) transports[name].init(self);
});
this.options.log('socket.io ready - accepting connections');
};
sys.inherits(Listener, process.EventEmitter);
util.inherits(Listener, process.EventEmitter);
for (var i in options) Listener.prototype[i] = options[i];
Listener.prototype.broadcast = function(message, except){
for (var i = 0, l = this.clients.length; i < l; i++){
if (this.clients[i] && (!except || [].concat(except).indexOf(this.clients[i].sessionId) == -1)){
this.clients[i].send(message);
}
}
return this;
for (var i = 0, k = Object.keys(this.clients), l = k.length; i < l; i++){
if (!except || ((typeof except == 'number' || typeof except == 'string') && k[i] != except)
|| (Array.isArray(except) && except.indexOf(k[i]) == -1)){
this.clients[k[i]].send(message);
}
}
return this;
};
Listener.prototype.check = function(req, res, httpUpgrade, head){
var path = url.parse(req.url).pathname, parts, cn;
if (path.indexOf('/' + this.options.resource) === 0){
parts = path.substr(1).split('/');
if (parts[2]){
cn = this._lookupClient(parts[2]);
if (cn){
cn._onConnect(req, res);
} else {
req.connection.end();
this.options.log('Couldnt find client with session id "' + parts[2] + '"');
}
} else {
this._onConnection(parts[1], req, res, httpUpgrade, head);
}
return true;
}
return false;
var path = url.parse(req.url).pathname, parts, cn;
if (path && path.indexOf('/' + this.options.resource) === 0){
parts = path.substr(2 + this.options.resource.length).split('/');
if (this._serveClient(parts.join('/'), req, res)) return true;
if (!(parts[0] in transports)) return false;
if (parts[1]){
cn = this.clients[parts[1]];
if (cn){
cn._onConnect(req, res);
} else {
req.connection.end();
req.connection.destroy();
this.options.log('Couldnt find client with session id "' + parts[1] + '"');
}
} else {
this._onConnection(parts[0], req, res, httpUpgrade, head);
}
return true;
}
return false;
};
Listener.prototype._lookupClient = function(sid){
return this.clientsIndex[sid];
Listener.prototype._serveClient = function(file, req, res){
var self = this
, clientPaths = {
'socket.io.js': 'socket.io.js',
'lib/vendor/web-socket-js/WebSocketMain.swf': 'lib/vendor/web-socket-js/WebSocketMain.swf', // for compat with old clients
'WebSocketMain.swf': 'lib/vendor/web-socket-js/WebSocketMain.swf'
}
, types = {
swf: 'application/x-shockwave-flash',
js: 'text/javascript'
};
function write(path){
if (req.headers['if-none-match'] == clientVersion){
res.writeHead(304);
res.end();
} else {
res.writeHead(200, self._clientFiles[path].headers);
res.end(self._clientFiles[path].content, self._clientFiles[path].encoding);
}
};
var path = clientPaths[file];
if (req.method == 'GET' && path !== undefined){
if (path in this._clientFiles){
write(path);
return true;
}
fs.readFile(__dirname + '/../../support/socket.io-client/' + path, function(err, data){
if (err){
res.writeHead(404);
res.end('404');
} else {
var ext = path.split('.').pop();
self._clientFiles[path] = {
headers: {
'Content-Length': data.length,
'Content-Type': types[ext],
'ETag': clientVersion
},
content: data,
encoding: ext == 'swf' ? 'binary' : 'utf8'
};
write(path);
}
});
return true;
}
return false;
};
Listener.prototype._onClientConnect = function(client){
if (!(client instanceof Client) || !client.sessionId){
return this.options.log('Invalid client');
}
client.i = this.clients.length;
this.clients.push(client);
this.clientsIndex[client.sessionId] = client;
this.options.log('Client '+ client.sessionId +' connected');
this.emit('clientConnect', client);
this.emit('connection', client);
this.clients[client.sessionId] = client;
this.options.log('Client '+ client.sessionId +' connected');
this.emit('clientConnect', client);
this.emit('connection', client);
};
Listener.prototype._onClientMessage = function(data, client){
this.emit('clientMessage', data, client);
this.emit('clientMessage', data, client);
};
Listener.prototype._onClientDisconnect = function(client){
this.clientsIndex[client.sessionId] = null;
this.clients[client.i] = null;
this.options.log('Client '+ client.sessionId +' disconnected');
this.emit('clientDisconnect', client);
delete this.clients[client.sessionId];
this.options.log('Client '+ client.sessionId +' disconnected');
this.emit('clientDisconnect', client);
};
Listener.prototype._onConnection = function(transport, req, res, httpUpgrade, head){
if (this.options.transports.indexOf(transport) === -1 || (httpUpgrade && !transports[transport].httpUpgrade)){
httpUpgrade ? res.destroy() : req.connection.destroy();
return this.options.log('Illegal transport "'+ transport +'"');
}
this.options.log('Initializing client with transport "'+ transport +'"');
new transports[transport](this, req, res, this.options.transportOptions[transport], head);
};
this.options.log('Initializing client with transport "'+ transport +'"');
new transports[transport](this, req, res, this.options.transportOptions[transport], head);
};

View File

@@ -1,39 +1,89 @@
var net = require('net'),
WebSocket = require('./websocket'),
listeners = [],
netserver,
var net = require('net')
, util = require(process.binding('natives').util ? 'util' : 'sys')
, WebSocket = require('./websocket')
, listeners = []
, netserver;
Flashsocket = module.exports = function(){
WebSocket.apply(this, arguments);
var Flashsocket = module.exports = function(){
WebSocket.apply(this, arguments);
};
require('sys').inherits(Flashsocket, WebSocket);
util.inherits(Flashsocket, WebSocket);
Flashsocket.httpUpgrade = true;
Flashsocket.init = function(listener){
listeners.push(listener);
listener.server.on('close', function(){
try {
netserver.close();
} catch(e){}
});
listeners.push(listener);
listener.server.on('close', function(){
listeners.splice(listeners.indexOf(listener), 1);
if (listeners.length === 0 && netserver){
try {
netserver.close();
} catch(e){
listener.options.log('flashsocket netserver close error - ' + e.stack)
}
}
});
if (listener.options.flashPolicyServer && netserver === undefined){
netserver = net.createServer(function(socket){
socket.addListener('error', function(err){
if (socket && socket.end){
socket.end();
socket.destroy();
}
});
if(socket && socket.readyState == 'open')
socket.end(policy(listeners));
});
try {
netserver.listen(843);
} catch(e){
if (e.errno == 13)
listener.options.log('Your node instance does not have root privileges. '
+ 'This means that the flash XML policy file will be '
+ 'served inline instead of on port 843. This will slow '
+ 'down initial connections slightly.');
netserver = null;
}
}
// Could not listen on port 843 so policy requests will be inline
listener.server.addListener('connection', function(stream){
var flashCheck = function (data) {
// Only check the initial data
stream.removeListener("data", flashCheck);
if (data[0] === 60 && data.length == 23) {
if (data == '<policy-file-request/>\0') {
listener.options.log("Answering flash policy request inline");
if (stream && stream.readyState == 'open'){
var xml = policy([listener]);
stream.write(xml);
stream.end();
}
}
}
};
stream.on('data', flashCheck);
});
};
try {
netserver = net.createServer(function(socket){
socket.write('<?xml version="1.0"?>\n');
socket.write('<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">\n');
socket.write('<cross-domain-policy>\n');
function policy(listeners) {
var xml = '<?xml version="1.0"?>\n<!DOCTYPE cross-domain-policy SYSTEM'
+ ' "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">\n<cross-domain-policy>\n';
listeners.forEach(function(l){
[].concat(l.options.origins).forEach(function(origin){
var parts = origin.split(':');
socket.write('<allow-access-from domain="' + parts[0] + '" to-ports="'+ parts[1] +'"/>\n');
});
});
listeners.forEach(function(l){
[].concat(l.options.origins).forEach(function(origin){
var parts = origin.split(':');
xml += '<allow-access-from domain="' + parts[0] + '" to-ports="'+ parts[1] +'"/>\n';
});
});
socket.write('</cross-domain-policy>\n');
socket.end();
}).listen(843);
} catch(e){}
xml += '</cross-domain-policy>\n';
return xml;
};

View File

@@ -1,48 +1,49 @@
var Client = require('../client'),
qs = require('querystring'),
var Client = require('../client')
, util = require(process.binding('natives').util ? 'util' : 'sys')
, qs = require('querystring');
HTMLFile = module.exports = function(){
Client.apply(this, arguments);
var HTMLFile = module.exports = function(){
Client.apply(this, arguments);
};
require('sys').inherits(HTMLFile, Client);
util.inherits(HTMLFile, Client);
HTMLFile.prototype._onConnect = function(req, res){
var self = this, body = '';
switch (req.method){
case 'GET':
Client.prototype._onConnect.apply(this, [req, res]);
this.request.connection.addListener('close', function(){ self._onClose(); });
this.response.useChunkedEncodingByDefault = true;
this.response.shouldKeepAlive = true;
this.response.writeHead(200, {
'Content-Type': 'text/html',
'Connection': 'keep-alive',
'Transfer-Encoding': 'chunked'
});
this.response.write('<html><body>' + new Array(244).join(' '));
if ('flush' in this.response) this.response.flush();
this._payload();
break;
case 'POST':
req.addListener('data', function(message){
body += message;
});
req.addListener('end', function(){
try {
var msg = qs.parse(body);
self._onMessage(msg.data);
} catch(e){}
res.writeHead(200);
res.write('ok');
res.end();
});
break;
}
var self = this, body = '';
switch (req.method){
case 'GET':
Client.prototype._onConnect.call(this, req, res);
this.response.useChunkedEncodingByDefault = true;
this.response.shouldKeepAlive = true;
this.response.writeHead(200, {
'Content-Type': 'text/html',
'Connection': 'keep-alive',
'Transfer-Encoding': 'chunked'
});
this.response.write('<html><body>' + new Array(245).join(' '));
this._payload();
break;
case 'POST':
req.addListener('data', function(message){
body += message;
});
req.addListener('end', function(){
try {
var msg = qs.parse(body);
self._onMessage(msg.data);
} catch(e){
self.listener.options.log('htmlfile message handler error - ' + e.stack);
}
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write('ok');
res.end();
});
break;
}
};
HTMLFile.prototype._write = function(message){
this.response.write('<script>parent.s._('+ JSON.stringify(message) +', document);</script>'); //json for escaping
if ('flush' in this.response) this.response.flush();
};
if (this._open)
this.response.write('<script>parent.s._('+ JSON.stringify(message) +', document);</script>'); //json for escaping
};

View File

@@ -0,0 +1,35 @@
var XHRPolling = require('./xhr-polling')
, util = require(process.binding('natives').util ? 'util' : 'sys');
JSONPPolling = module.exports = function(){
XHRPolling.apply(this, arguments);
};
util.inherits(JSONPPolling, XHRPolling);
JSONPPolling.prototype.getOptions = function(){
return {
timeout: null, // no heartbeats
closeTimeout: 8000,
duration: 20000
};
};
JSONPPolling.prototype._onConnect = function(req, res){
this._index = req.url.match(/\/([0-9]+)\/?$/).pop();
XHRPolling.prototype._onConnect.call(this, req, res);
};
JSONPPolling.prototype._write = function(message){
if (this._open){
if (this.request.headers.origin && !this._verifyOrigin(this.request.headers.origin)){
message = "alert('Cross domain security restrictions not met');";
} else {
message = "io.JSONP["+ this._index +"]._("+ JSON.stringify(message) +");";
}
this.response.writeHead(200, {'Content-Type': 'text/javascript; charset=UTF-8', 'Content-Length': Buffer.byteLength(message)});
this.response.write(message);
this.response.end();
this._onClose();
}
};

View File

@@ -1,139 +1,210 @@
var Client = require('../client'),
url = require('url'),
Buffer = require('buffer').Buffer,
crypto = require('crypto'),
var Client = require('../client')
, Stream = require('net').Stream
, EventEmitter = require('events').EventEmitter
, url = require('url')
, util = require(process.binding('natives').util ? 'util' : 'sys')
, crypto = require('crypto');
WebSocket = module.exports = function(){
Client.apply(this, arguments);
Client.apply(this, arguments);
};
require('sys').inherits(WebSocket, Client);
util.inherits(WebSocket, Client);
WebSocket.prototype._onConnect = function(req, socket){
var self = this, headers = [];
this.request = req;
this.connection = socket;
this.data = '';
var self = this
, headers = [];
if (!req.connection.setTimeout){
req.connection.end();
return false;
}
if (this.request.headers.upgrade !== 'WebSocket' || !this._verifyOrigin(this.request.headers.origin)){
this.listener.options.log('WebSocket connection invalid');
this.connection.end();
}
this.parser = new Parser();
this.parser.on('data', self._onMessage.bind(this));
this.parser.on('error', self._onClose.bind(this));
this.connection.setTimeout(0);
this.connection.setEncoding('utf8');
this.connection.setNoDelay(true);
Client.prototype._onConnect.call(this, req);
if (this.request.headers.upgrade !== 'WebSocket' || !this._verifyOrigin(this.request.headers.origin)){
this.listener.options.log('WebSocket connection invalid or Origin not verified');
this._onClose();
return false;
}
var origin = this.request.headers.origin,
location = (origin && origin.substr(0, 5) == 'https' ? 'wss' : 'ws')
+ '://' + this.request.headers.host + this.request.url;
this.waitingForNonce = false;
if ('sec-websocket-key1' in this.request.headers){
/* We need to send the 101 response immediately when using Draft 76 with
a load balancing proxy, such as HAProxy. In order to protect an
unsuspecting non-websocket HTTP server, HAProxy will not send the
8-byte nonce through the connection until the Upgrade: WebSocket
request has been confirmed by the WebSocket server by a 101 response
indicating that the server can handle the upgraded protocol. We
therefore must send the 101 response immediately, and then wait for
the nonce to be forwarded to us afterward in order to finish the
Draft 76 handshake.
*/
// If we don't have the nonce yet, wait for it.
if (!(this.upgradeHead && this.upgradeHead.length >= 8)) {
this.waitingForNonce = true;
}
headers = [
'HTTP/1.1 101 WebSocket Protocol Handshake',
'Upgrade: WebSocket',
'Connection: Upgrade',
'Sec-WebSocket-Origin: ' + origin,
'Sec-WebSocket-Location: ' + location
];
if ('sec-websocket-protocol' in this.request.headers){
headers.push('Sec-WebSocket-Protocol: ' + this.request.headers['sec-websocket-protocol']);
}
} else {
headers = [
'HTTP/1.1 101 Web Socket Protocol Handshake',
'Upgrade: WebSocket',
'Connection: Upgrade',
'WebSocket-Origin: ' + origin,
'WebSocket-Location: ' + location
];
}
if ('sec-websocket-key1' in this.request.headers){
this.draft = 76;
}
try {
this.connection.write(headers.concat('', '').join('\r\n'));
this.connection.setTimeout(0);
this.connection.setNoDelay(true);
this.connection.setEncoding('utf-8');
} catch(e){
this._onClose();
return;
}
if (this.waitingForNonce) {
// Since we will be receiving the binary nonce through the normal HTTP
// data event, set the connection to 'binary' temporarily
this.connection.setEncoding('binary');
this._headers = headers;
}
else {
if (this._proveReception(headers)) this._payload();
}
this.buffer = "";
this.connection.addListener('data', function(data){
self.buffer += data;
if (self.waitingForNonce) {
if (self.buffer.length < 8) { return; }
// Restore the connection to utf8 encoding after receiving the nonce
self.connection.setEncoding('utf8');
self.waitingForNonce = false;
// Stuff the nonce into the location where it's expected to be
self.upgradeHead = self.buffer.substr(0,8);
self.buffer = self.buffer.substr(8);
if (self.buffer.length > 0) {
self.parser.add(self.buffer);
}
if (self._proveReception(self._headers)) { self._payload(); }
return;
}
self.parser.add(data);
});
if (this.draft == 76){
var origin = this.request.headers.origin;
headers = [
'HTTP/1.1 101 WebSocket Protocol Handshake',
'Upgrade: WebSocket',
'Connection: Upgrade',
'Sec-WebSocket-Origin: ' + (origin || 'null'),
'Sec-WebSocket-Location: ws://' + this.request.headers.host + this.request.url
];
if ('sec-websocket-protocol' in this.request.headers){
headers.push('Sec-WebSocket-Protocol: ' + this.request.headers['sec-websocket-protocol']);
}
} else {
headers = [
'HTTP/1.1 101 Web Socket Protocol Handshake',
'Upgrade: WebSocket',
'Connection: Upgrade',
'WebSocket-Origin: ' + this.request.headers.origin,
'WebSocket-Location: ws://' + this.request.headers.host + this.request.url
];
try {
this.connection.write(headers.concat('', '').join('\r\n'));
} catch(e){
this._onClose();
}
}
this.connection.addListener('end', function(){
self._onClose();
});
this.connection.addListener('data', function(data){
self._handle(data);
});
if (this._proveReception(headers)) this._payload();
};
WebSocket.prototype._handle = function(data){
var chunk, chunks, chunk_count;
this.data += data;
chunks = this.data.split('\ufffd');
chunk_count = chunks.length - 1;
for (var i = 0; i < chunk_count; i++){
chunk = chunks[i];
if (chunk[0] !== '\u0000'){
this.listener.options.log('Data incorrectly framed by UA. Dropping connection');
this.connection.destroy();
return false;
}
this._onMessage(chunk.slice(1));
}
this.data = chunks[chunks.length - 1];
};
// http://www.whatwg.org/specs/web-apps/current-work/complete/network.html#opening-handshake
WebSocket.prototype._proveReception = function(headers){
var k1 = this.request.headers['sec-websocket-key1'],
k2 = this.request.headers['sec-websocket-key2'];
if (k1 && k2){
var md5 = crypto.createHash('md5');
var self = this
, k1 = this.request.headers['sec-websocket-key1']
, k2 = this.request.headers['sec-websocket-key2'];
if (k1 && k2){
var md5 = crypto.createHash('md5');
[k1, k2].forEach(function(k){
var n = parseInt(k.replace(/[^\d]/g, '')),
spaces = k.replace(/[^ ]/g, '').length;
if (spaces === 0 || n % spaces !== 0){
this.listener.options.log('Invalid WebSocket key: "' + k + '". Dropping connection');
this.connection.destroy();
return false;
}
[k1, k2].forEach(function(k){
var n = parseInt(k.replace(/[^\d]/g, '')),
spaces = k.replace(/[^ ]/g, '').length;
if (spaces === 0 || n % spaces !== 0){
self.listener.options.log('Invalid WebSocket key: "' + k + '". Dropping connection');
self._onClose();
return false;
}
n /= spaces;
md5.update(String.fromCharCode(
n >> 24 & 0xFF,
n >> 16 & 0xFF,
n >> 8 & 0xFF,
n & 0xFF));
});
n /= spaces;
md5.update(String.fromCharCode(
n >> 24 & 0xFF,
n >> 16 & 0xFF,
n >> 8 & 0xFF,
n & 0xFF));
});
md5.update(this.upgradeHead.toString('binary'));
try {
this.connection.write(headers.concat('', '').join('\r\n') + md5.digest('binary'), 'binary');
} catch(e){
this._onClose();
}
}
return true;
md5.update(this.upgradeHead.toString('binary'));
try {
this.connection.write(md5.digest('binary'), 'binary');
} catch(e){
this._onClose();
}
}
return true;
};
WebSocket.prototype._write = function(message){
try {
this.connection.write('\u0000', 'binary');
this.connection.write(message, 'utf8');
this.connection.write('\uffff', 'binary');
} catch(e){
this._onClose();
}
try {
this.connection.write('\u0000', 'binary');
this.connection.write(message, 'utf8');
this.connection.write('\uffff', 'binary');
} catch(e){
this._onClose();
}
};
WebSocket.httpUpgrade = true;
WebSocket.httpUpgrade = true;
function Parser(){
this.buffer = '';
this.i = 0;
};
Parser.prototype.__proto__ = EventEmitter.prototype;
Parser.prototype.add = function(data){
this.buffer += data;
this.parse();
};
Parser.prototype.parse = function(){
for (var i = this.i, chr, l = this.buffer.length; i < l; i++){
chr = this.buffer[i];
if (i === 0){
if (chr != '\u0000')
this.error('Bad framing. Expected null byte as first frame');
else
continue;
}
if (chr == '\ufffd'){
this.emit('data', this.buffer.substr(1, this.buffer.length - 2));
this.buffer = this.buffer.substr(i + 1);
this.i = 0;
return this.parse();
}
}
};
Parser.prototype.error = function(reason){
this.buffer = '';
this.i = 0;
this.emit('error', reason);
return this;
};

View File

@@ -1,62 +1,67 @@
var Client = require('../client'),
qs = require('querystring'),
var Client = require('../client')
, util = require(process.binding('natives').util ? 'util' : 'sys')
, qs = require('querystring');
Multipart = module.exports = function(){
Client.apply(this, arguments);
var Multipart = module.exports = function(){
Client.apply(this, arguments);
};
require('sys').inherits(Multipart, Client);
util.inherits(Multipart, Client);
Multipart.prototype._onConnect = function(req, res){
var self = this, body = '', headers = {};
// https://developer.mozilla.org/En/HTTP_Access_Control
if (req.headers.origin && this._verifyOrigin(req.headers.origin)){
headers['Access-Control-Allow-Origin'] = req.headers.origin;
headers['Access-Control-Allow-Credentials'] = 'true';
}
if (typeof req.headers['access-control-request-method'] !== 'undefined'){
// CORS preflight message
headers['Access-Control-Allow-Methods'] = req.headers['access-control-request-method'];
res.writeHead(200, headers);
res.write('ok');
res.end();
return;
}
switch (req.method){
case 'GET':
Client.prototype._onConnect.apply(this, [req, res]);
headers['Content-Type'] = 'multipart/x-mixed-replace;boundary="socketio"';
headers['Connection'] = 'keep-alive';
this.request.connection.addListener('end', function(){ self._onClose(); });
this.response.useChunkedEncodingByDefault = false;
this.response.shouldKeepAlive = true;
this.response.writeHead(200, headers);
this.response.write("--socketio\n");
if ('flush' in this.response) this.response.flush();
this._payload();
break;
case 'POST':
req.addListener('data', function(message){
body += message.toString();
});
req.addListener('end', function(){
try {
var msg = qs.parse(body);
self._onMessage(msg.data);
} catch(e){}
res.writeHead(200, headers);
res.write('ok');
res.end();
body = '';
});
break;
}
var self = this, body = '', headers = {};
// https://developer.mozilla.org/En/HTTP_Access_Control
if (req.headers.origin && this._verifyOrigin(req.headers.origin)){
headers['Access-Control-Allow-Origin'] = '*';
headers['Access-Control-Allow-Credentials'] = 'true';
}
if (typeof req.headers['access-control-request-method'] !== 'undefined'){
// CORS preflight message
headers['Access-Control-Allow-Methods'] = req.headers['access-control-request-method'];
res.writeHead(200, headers);
res.write('ok');
res.end();
return;
}
switch (req.method){
case 'GET':
Client.prototype._onConnect.apply(this, [req, res]);
headers['Content-Type'] = 'multipart/x-mixed-replace;boundary="socketio"';
headers['Connection'] = 'keep-alive';
this.request.connection.addListener('end', function(){ self._onClose(); });
this.response.useChunkedEncodingByDefault = false;
this.response.shouldKeepAlive = true;
this.response.writeHead(200, headers);
this.response.write("--socketio\n");
if ('flush' in this.response) this.response.flush();
this._payload();
break;
case 'POST':
headers['Content-Type'] = 'text/plain';
req.addListener('data', function(message){
body += message.toString();
});
req.addListener('end', function(){
try {
var msg = qs.parse(body);
self._onMessage(msg.data);
} catch(e){
self.listener.options.log('xhr-multipart message handler error - ' + e.stack);
}
res.writeHead(200, headers);
res.write('ok');
res.end();
body = '';
});
break;
}
};
Multipart.prototype._write = function(message){
this.response.write("Content-Type: text/plain" + (message.length === 1 && message.charCodeAt(0) === 6 ? "; charset=us-ascii" : "") + "\n\n");
this.response.write(message + "\n");
this.response.write("--socketio\n");
if ('flush' in this.response) this.response.flush();
};
if (this._open){
this.response.write("Content-Type: text/plain" + (message.length === 1 && message.charCodeAt(0) === 6 ? "; charset=us-ascii" : "") + "\n\n");
this.response.write(message + "\n");
this.response.write("--socketio\n");
}
};

View File

@@ -1,52 +1,80 @@
var Client = require('../client'),
qs = require('querystring'),
var Client = require('../client')
, util = require(process.binding('natives').util ? 'util' : 'sys')
, qs = require('querystring');
Polling = module.exports = function(){
Client.apply(this, arguments);
var Polling = module.exports = function(){
Client.apply(this, arguments);
};
require('sys').inherits(Polling, Client);
util.inherits(Polling, Client);
Polling.prototype.getOptions = function(){
return {
timeout: null, // no heartbeats
closeTimeout: 8000,
duration: 20000
};
};
Polling.prototype._onConnect = function(req, res){
var self = this, body = '';
switch (req.method){
case 'GET':
Client.prototype._onConnect.apply(this, [req, res]);
this.request.connection.addListener('end', function(){ self._onClose(); });
this._closeTimeout = setTimeout(function(){
self._write('');
}, this.options.duration);
this._payload();
break;
case 'POST':
req.addListener('data', function(message){
body += message;
});
req.addListener('end', function(){
try {
// optimization: just strip first 5 characters here?
var msg = qs.parse(body);
self._onMessage(msg.data);
} catch(e){}
res.writeHead(200);
res.write('ok');
res.end();
});
break;
}
var self = this, body = '';
switch (req.method){
case 'GET':
Client.prototype._onConnect.apply(this, [req, res]);
this._closeTimeout = setTimeout(function(){
self._write('');
}, this.options.duration);
this._payload();
break;
case 'POST':
req.addListener('data', function(message){
body += message;
});
req.addListener('end', function(){
var headers = {'Content-Type': 'text/plain'};
if (req.headers.origin){
if (self._verifyOrigin(req.headers.origin)){
headers['Access-Control-Allow-Origin'] = '*';
if (req.headers.cookie) headers['Access-Control-Allow-Credentials'] = 'true';
} else {
res.writeHead(401);
res.write('unauthorized');
res.end();
return;
}
}
try {
// optimization: just strip first 5 characters here?
var msg = qs.parse(body);
self._onMessage(msg.data);
} catch(e){
self.listener.options.log('xhr-polling message handler error - ' + e.stack);
}
res.writeHead(200, headers);
res.write('ok');
res.end();
});
break;
}
};
Polling.prototype._onClose = function(){
if (this._closeTimeout) clearTimeout(this._closeTimeout);
return Client.prototype._onClose.call(this);
};
Polling.prototype._write = function(message){
if (this._closeTimeout) clearTimeout(this._closeTimeout);
var headers = {'Content-Type': 'text/plain', 'Content-Length': message.length};
// https://developer.mozilla.org/En/HTTP_Access_Control
if (this.request.headers.origin && this._verifyOrigin(this.request.headers.origin)){
headers['Access-Control-Allow-Origin'] = this.request.headersorigin;
if (this.request.headers.cookie) headers['Access-Control-Allow-Credentials'] = 'true';
}
this.response.writeHead(200, headers);
this.response.write(message);
this.response.end();
this._onClose();
};
if (this._open){
var headers = {'Content-Type': 'text/plain; charset=UTF-8', 'Content-Length': Buffer.byteLength(message)};
// https://developer.mozilla.org/En/HTTP_Access_Control
if (this.request.headers.origin && this._verifyOrigin(this.request.headers.origin)){
headers['Access-Control-Allow-Origin'] = this.request.headers.origin;
if (this.request.headers.cookie) headers['Access-Control-Allow-Credentials'] = 'true';
}
this.response.writeHead(200, headers);
this.response.write(message);
this.response.end();
this._onClose();
}
};

View File

@@ -1,10 +1,52 @@
exports.options = {
options: function(options, merge){
this.options = exports.merge(options || {}, merge || {});
}
options: function(options, merge){
this.options = exports.merge(options || {}, merge || {});
}
};
exports.merge = function(source, merge){
for (var i in merge) source[i] = merge[i];
return source;
for (var i in merge) source[i] = merge[i];
return source;
};
var frame = '~m~';
function stringify(message){
if (Object.prototype.toString.call(message) == '[object Object]'){
return '~j~' + JSON.stringify(message);
} else {
return String(message);
}
};
exports.encode = function(messages){
var ret = '', message,
messages = Array.isArray(messages) ? messages : [messages];
for (var i = 0, l = messages.length; i < l; i++){
message = messages[i] === null || messages[i] === undefined ? '' : stringify(messages[i]);
ret += frame + message.length + frame + message;
}
return ret;
};
exports.decode = function(data){
var messages = [], number, n;
do {
if (data.substr(0, 3) !== frame) return messages;
data = data.substr(3);
number = '', n = '';
for (var i = 0, l = data.length; i < l; i++){
n = Number(data.substr(i, 1));
if (data.substr(i, 1) == n){
number += n;
} else {
data = data.substr(number.length + frame.length)
number = Number(number);
break;
}
}
messages.push(data.substr(0, number)); // here
data = data.substr(number);
} while(data !== '');
return messages;
};

17
package.json Normal file
View File

@@ -0,0 +1,17 @@
{ "name" : "socket.io"
, "description" : "The cross-browser WebSocket"
, "version" : "0.6.14"
, "author" : "LearnBoost"
, "licenses" :
[ { "type" : "MIT"
, "url" : "http://github.com/learnboost/Socket.IO-node/raw/master/README.md"
}
]
, "repository" :
{ "type" : "git"
, "url" : "http://github.com/learnboost/Socket.IO-node.git"
}
, "engine" : [ "node >=0.1.102" ]
, "main" : "./index"
, "scripts" : { "test" : "make test" }
}

3
support/expresso/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.DS_Store
lib-cov
*.seed

3
support/expresso/.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "deps/jscoverage"]
path = deps/jscoverage
url = git://github.com/visionmedia/node-jscoverage.git

128
support/expresso/History.md Normal file
View File

@@ -0,0 +1,128 @@
0.7.2 / 2010-12-29
==================
* Fixed problem with `listen()` sometimes firing on the same tick [guillermo]
0.7.1 / 2010-12-28
==================
* Fixed `assert.request()` client logic into an issue() function, fired upon the `listen()` callback if the server doesn't have an assigned fd. [guillermo]
* Removed `--watch`
0.7.0 / 2010-11-19
==================
* Removed `assert` from test function signature
Just use `require('assert')` :) this will make integration
with libraries like [should](http://github.com/visionmedia/should) cleaner.
0.6.4 / 2010-11-02
==================
* Added regexp support to `assert.response()` headers
* Removed `waitForExit` code, causing issues
0.6.3 / 2010-11-02
==================
* Added `assert.response()` body RegExp support
* Fixed issue with _--serial_ not executing files sequentially. Closes #42
* Fixed hang when modules use `setInterval` - monitor running tests & force the process to quit after all have completed + timeout [Steve Mason]
0.6.2 / 2010-09-17
==================
* Added _node-jsocoverage_ to package.json (aka will respect npm's binroot)
* Added _-t, --timeout_ MS option, defaulting to 2000 ms
* Added _-s, --serial_
* __PREFIX__ clobberable
* Fixed `assert.response()` for latest node
* Fixed cov reporting from exploding on empty files
0.6.2 / 2010-08-03
==================
* Added `assert.type()`
* Renamed `assert.isNotUndefined()` to `assert.isDefined()`
* Fixed `assert.includes()` param ordering
0.6.0 / 2010-07-31
==================
* Added _docs/api.html_
* Added -w, --watch
* Added `Array` support to `assert.includes()`
* Added; outputting exceptions immediately. Closes #19
* Fixed `assert.includes()` param ordering
* Fixed `assert.length()` param ordering
* Fixed jscoverage links
0.5.0 / 2010-07-16
==================
* Added support for async exports
* Added timeout support to `assert.response()`. Closes #3
* Added 4th arg callback support to `assert.response()`
* Added `assert.length()`
* Added `assert.match()`
* Added `assert.isUndefined()`
* Added `assert.isNull()`
* Added `assert.includes()`
* Added growlnotify support via -g, --growl
* Added -o, --only TESTS. Ex: --only "test foo()" --only "test foo(), test bar()"
* Removed profanity
0.4.0 / 2010-07-09
==================
* Added reporting source coverage (respects --boring for color haters)
* Added callback to assert.response(). Closes #12
* Fixed; putting exceptions to stderr. Closes #13
0.3.1 / 2010-06-28
==================
* Faster assert.response()
0.3.0 / 2010-06-28
==================
* Added -p, --port NUM flags
* Added assert.response(). Closes #11
0.2.1 / 2010-06-25
==================
* Fixed issue with reporting object assertions
0.2.0 / 2010-06-21
==================
* Added `make uninstall`
* Added better readdir() failure message
* Fixed `make install` for kiwi
0.1.0 / 2010-06-15
==================
* Added better usage docs via --help
* Added better conditional color support
* Added pre exit assertion support
0.0.3 / 2010-06-02
==================
* Added more room for filenames in test coverage
* Added boring output support via --boring (suppress colored output)
* Fixed async failure exit status
0.0.2 / 2010-05-30
==================
* Fixed exit status for CI support
0.0.1 / 2010-05-30
==================
* Initial release

53
support/expresso/Makefile Normal file
View File

@@ -0,0 +1,53 @@
PREFIX ?= /usr/local
BIN = bin/expresso
JSCOV = deps/jscoverage/node-jscoverage
DOCS = docs/index.md
HTMLDOCS = $(DOCS:.md=.html)
test: $(BIN)
@./$(BIN) -I lib --growl $(TEST_FLAGS) test/*.test.js
test-cov:
@./$(BIN) -I lib --cov $(TEST_FLAGS) test/*.test.js
test-serial:
@./$(BIN) --serial -I lib $(TEST_FLAGS) test/serial/*.test.js
install: install-jscov install-expresso
uninstall:
rm -f $(PREFIX)/bin/expresso
rm -f $(PREFIX)/bin/node-jscoverage
install-jscov: $(JSCOV)
install $(JSCOV) $(PREFIX)/bin
install-expresso:
install $(BIN) $(PREFIX)/bin
$(JSCOV):
cd deps/jscoverage && ./configure && make && mv jscoverage node-jscoverage
clean:
@cd deps/jscoverage && git clean -fd
docs: docs/api.html $(HTMLDOCS)
%.html: %.md
@echo "... $< > $@"
@ronn -5 --pipe --fragment $< \
| cat docs/layout/head.html - docs/layout/foot.html \
> $@
docs/api.html: bin/expresso
dox \
--title "Expresso" \
--ribbon "http://github.com/visionmedia/expresso" \
--desc "Insanely fast TDD framework for [node](http://nodejs.org) featuring code coverage reporting." \
$< > $@
docclean:
rm -f docs/*.html
.PHONY: test test-cov install uninstall install-expresso install-jscov clean docs docclean

View File

@@ -0,0 +1,61 @@
# Expresso
TDD framework for [nodejs](http://nodejs.org).
## Features
- light-weight
- intuitive async support
- intuitive test runner executable
- test coverage support and reporting
- uses the _assert_ module
- `assert.eql()` alias of `assert.deepEqual()`
- `assert.response()` http response utility
- `assert.includes()`
- `assert.type()`
- `assert.isNull()`
- `assert.isUndefined()`
- `assert.isNotNull()`
- `assert.isDefined()`
- `assert.match()`
- `assert.length()`
## Installation
To install both expresso _and_ node-jscoverage run:
$ make install
To install expresso alone (no build required) run:
$ make install-expresso
Install via npm:
$ npm install expresso
## License
(The MIT License)
Copyright (c) 2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

856
support/expresso/bin/expresso Executable file
View File

@@ -0,0 +1,856 @@
#!/usr/bin/env node
/*
* Expresso
* Copyright(c) TJ Holowaychuk <tj@vision-media.ca>
* (MIT Licensed)
*/
/**
* Module dependencies.
*/
var assert = require('assert'),
childProcess = require('child_process'),
http = require('http'),
path = require('path'),
sys = require('sys'),
cwd = process.cwd(),
fs = require('fs'),
defer;
/**
* Expresso version.
*/
var version = '0.7.2';
/**
* Failure count.
*/
var failures = 0;
/**
* Number of tests executed.
*/
var testcount = 0;
/**
* Whitelist of tests to run.
*/
var only = [];
/**
* Boring output.
*/
var boring = false;
/**
* Growl notifications.
*/
var growl = false;
/**
* Server port.
*/
var port = 5555;
/**
* Execute serially.
*/
var serial = false;
/**
* Default timeout.
*/
var timeout = 2000;
/**
* Quiet output.
*/
var quiet = false;
/**
* Usage documentation.
*/
var usage = ''
+ '[bold]{Usage}: expresso [options] <file ...>'
+ '\n'
+ '\n[bold]{Options}:'
+ '\n -g, --growl Enable growl notifications'
+ '\n -c, --coverage Generate and report test coverage'
+ '\n -q, --quiet Suppress coverage report if 100%'
+ '\n -t, --timeout MS Timeout in milliseconds, defaults to 2000'
+ '\n -r, --require PATH Require the given module path'
+ '\n -o, --only TESTS Execute only the comma sperated TESTS (can be set several times)'
+ '\n -I, --include PATH Unshift the given path to require.paths'
+ '\n -p, --port NUM Port number for test servers, starts at 5555'
+ '\n -s, --serial Execute tests serially'
+ '\n -b, --boring Suppress ansi-escape colors'
+ '\n -v, --version Output version number'
+ '\n -h, --help Display help information'
+ '\n';
// Parse arguments
var files = [],
args = process.argv.slice(2);
while (args.length) {
var arg = args.shift();
switch (arg) {
case '-h':
case '--help':
print(usage + '\n');
process.exit(1);
break;
case '-v':
case '--version':
sys.puts(version);
process.exit(1);
break;
case '-i':
case '-I':
case '--include':
if (arg = args.shift()) {
require.paths.unshift(arg);
} else {
throw new Error('--include requires a path');
}
break;
case '-o':
case '--only':
if (arg = args.shift()) {
only = only.concat(arg.split(/ *, */));
} else {
throw new Error('--only requires comma-separated test names');
}
break;
case '-p':
case '--port':
if (arg = args.shift()) {
port = parseInt(arg, 10);
} else {
throw new Error('--port requires a number');
}
break;
case '-r':
case '--require':
if (arg = args.shift()) {
require(arg);
} else {
throw new Error('--require requires a path');
}
break;
case '-t':
case '--timeout':
if (arg = args.shift()) {
timeout = parseInt(arg, 10);
} else {
throw new Error('--timeout requires an argument');
}
break;
case '-c':
case '--cov':
case '--coverage':
defer = true;
childProcess.exec('rm -fr lib-cov && node-jscoverage lib lib-cov', function(err){
if (err) throw err;
require.paths.unshift('lib-cov');
run(files);
})
break;
case '-q':
case '--quiet':
quiet = true;
break;
case '-b':
case '--boring':
boring = true;
break;
case '-g':
case '--growl':
growl = true;
break;
case '-s':
case '--serial':
serial = true;
break;
default:
if (/\.js$/.test(arg)) {
files.push(arg);
}
break;
}
}
/**
* Colorized sys.error().
*
* @param {String} str
*/
function print(str){
sys.error(colorize(str));
}
/**
* Colorize the given string using ansi-escape sequences.
* Disabled when --boring is set.
*
* @param {String} str
* @return {String}
*/
function colorize(str){
var colors = { bold: 1, red: 31, green: 32, yellow: 33 };
return str.replace(/\[(\w+)\]\{([^]*?)\}/g, function(_, color, str){
return boring
? str
: '\x1B[' + colors[color] + 'm' + str + '\x1B[0m';
});
}
// Alias deepEqual as eql for complex equality
assert.eql = assert.deepEqual;
/**
* Assert that `val` is null.
*
* @param {Mixed} val
* @param {String} msg
*/
assert.isNull = function(val, msg) {
assert.strictEqual(null, val, msg);
};
/**
* Assert that `val` is not null.
*
* @param {Mixed} val
* @param {String} msg
*/
assert.isNotNull = function(val, msg) {
assert.notStrictEqual(null, val, msg);
};
/**
* Assert that `val` is undefined.
*
* @param {Mixed} val
* @param {String} msg
*/
assert.isUndefined = function(val, msg) {
assert.strictEqual(undefined, val, msg);
};
/**
* Assert that `val` is not undefined.
*
* @param {Mixed} val
* @param {String} msg
*/
assert.isDefined = function(val, msg) {
assert.notStrictEqual(undefined, val, msg);
};
/**
* Assert that `obj` is `type`.
*
* @param {Mixed} obj
* @param {String} type
* @api public
*/
assert.type = function(obj, type, msg){
var real = typeof obj;
msg = msg || 'typeof ' + sys.inspect(obj) + ' is ' + real + ', expected ' + type;
assert.ok(type === real, msg);
};
/**
* Assert that `str` matches `regexp`.
*
* @param {String} str
* @param {RegExp} regexp
* @param {String} msg
*/
assert.match = function(str, regexp, msg) {
msg = msg || sys.inspect(str) + ' does not match ' + sys.inspect(regexp);
assert.ok(regexp.test(str), msg);
};
/**
* Assert that `val` is within `obj`.
*
* Examples:
*
* assert.includes('foobar', 'bar');
* assert.includes(['foo', 'bar'], 'foo');
*
* @param {String|Array} obj
* @param {Mixed} val
* @param {String} msg
*/
assert.includes = function(obj, val, msg) {
msg = msg || sys.inspect(obj) + ' does not include ' + sys.inspect(val);
assert.ok(obj.indexOf(val) >= 0, msg);
};
/**
* Assert length of `val` is `n`.
*
* @param {Mixed} val
* @param {Number} n
* @param {String} msg
*/
assert.length = function(val, n, msg) {
msg = msg || sys.inspect(val) + ' has length of ' + val.length + ', expected ' + n;
assert.equal(n, val.length, msg);
};
/**
* Assert response from `server` with
* the given `req` object and `res` assertions object.
*
* @param {Server} server
* @param {Object} req
* @param {Object|Function} res
* @param {String} msg
*/
assert.response = function(server, req, res, msg){
// Check that the server is ready or defer
if (!server.fd) {
if (!('__deferred' in server)) {
server.__deferred = [];
}
server.__deferred.push(arguments);
if (!server.__started) {
server.listen(server.__port = port++, '127.0.0.1', function(){
if (server.__deferred) {
process.nextTick(function(){
server.__deferred.forEach(function(args){
assert.response.apply(assert, args);
});
});
}
});
server.__started = true;
}
return;
}
// Callback as third or fourth arg
var callback = typeof res === 'function'
? res
: typeof msg === 'function'
? msg
: function(){};
// Default messate to test title
if (typeof msg === 'function') msg = null;
msg = msg || assert.testTitle;
msg += '. ';
// Pending responses
server.__pending = server.__pending || 0;
server.__pending++;
// Create client
if (!server.fd) {
server.listen(server.__port = port++, '127.0.0.1', issue);
} else {
issue();
}
function issue(){
if (!server.client)
server.client = http.createClient(server.__port);
// Issue request
var timer,
client = server.client,
method = req.method || 'GET',
status = res.status || res.statusCode,
data = req.data || req.body,
requestTimeout = req.timeout || 0;
var request = client.request(method, req.url, req.headers);
// Timeout
if (requestTimeout) {
timer = setTimeout(function(){
--server.__pending || server.close();
delete req.timeout;
assert.fail(msg + 'Request timed out after ' + requestTimeout + 'ms.');
}, requestTimeout);
}
if (data) request.write(data);
request.on('response', function(response){
response.body = '';
response.setEncoding('utf8');
response.on('data', function(chunk){ response.body += chunk; });
response.on('end', function(){
--server.__pending || server.close();
if (timer) clearTimeout(timer);
// Assert response body
if (res.body !== undefined) {
var eql = res.body instanceof RegExp
? res.body.test(response.body)
: res.body === response.body;
assert.ok(
eql,
msg + 'Invalid response body.\n'
+ ' Expected: ' + sys.inspect(res.body) + '\n'
+ ' Got: ' + sys.inspect(response.body)
);
}
// Assert response status
if (typeof status === 'number') {
assert.equal(
response.statusCode,
status,
msg + colorize('Invalid response status code.\n'
+ ' Expected: [green]{' + status + '}\n'
+ ' Got: [red]{' + response.statusCode + '}')
);
}
// Assert response headers
if (res.headers) {
var keys = Object.keys(res.headers);
for (var i = 0, len = keys.length; i < len; ++i) {
var name = keys[i],
actual = response.headers[name.toLowerCase()],
expected = res.headers[name],
eql = expected instanceof RegExp
? expected.test(actual)
: expected == actual;
assert.ok(
eql,
msg + colorize('Invalid response header [bold]{' + name + '}.\n'
+ ' Expected: [green]{' + expected + '}\n'
+ ' Got: [red]{' + actual + '}')
);
}
}
// Callback
callback(response);
});
});
request.end();
}
};
/**
* Pad the given string to the maximum width provided.
*
* @param {String} str
* @param {Number} width
* @return {String}
*/
function lpad(str, width) {
str = String(str);
var n = width - str.length;
if (n < 1) return str;
while (n--) str = ' ' + str;
return str;
}
/**
* Pad the given string to the maximum width provided.
*
* @param {String} str
* @param {Number} width
* @return {String}
*/
function rpad(str, width) {
str = String(str);
var n = width - str.length;
if (n < 1) return str;
while (n--) str = str + ' ';
return str;
}
/**
* Report test coverage.
*
* @param {Object} cov
*/
function reportCoverage(cov) {
// Stats
print('\n [bold]{Test Coverage}\n');
var sep = ' +------------------------------------------+----------+------+------+--------+',
lastSep = ' +----------+------+------+--------+';
sys.puts(sep);
sys.puts(' | filename | coverage | LOC | SLOC | missed |');
sys.puts(sep);
for (var name in cov) {
var file = cov[name];
if (Array.isArray(file)) {
sys.print(' | ' + rpad(name, 40));
sys.print(' | ' + lpad(file.coverage.toFixed(2), 8));
sys.print(' | ' + lpad(file.LOC, 4));
sys.print(' | ' + lpad(file.SLOC, 4));
sys.print(' | ' + lpad(file.totalMisses, 6));
sys.print(' |\n');
}
}
sys.puts(sep);
sys.print(' ' + rpad('', 40));
sys.print(' | ' + lpad(cov.coverage.toFixed(2), 8));
sys.print(' | ' + lpad(cov.LOC, 4));
sys.print(' | ' + lpad(cov.SLOC, 4));
sys.print(' | ' + lpad(cov.totalMisses, 6));
sys.print(' |\n');
sys.puts(lastSep);
// Source
for (var name in cov) {
if (name.match(/\.js$/)) {
var file = cov[name];
if ((file.coverage < 100) || !quiet) {
print('\n [bold]{' + name + '}:');
print(file.source);
sys.print('\n');
}
}
}
}
/**
* Populate code coverage data.
*
* @param {Object} cov
*/
function populateCoverage(cov) {
cov.LOC =
cov.SLOC =
cov.totalFiles =
cov.totalHits =
cov.totalMisses =
cov.coverage = 0;
for (var name in cov) {
var file = cov[name];
if (Array.isArray(file)) {
// Stats
++cov.totalFiles;
cov.totalHits += file.totalHits = coverage(file, true);
cov.totalMisses += file.totalMisses = coverage(file, false);
file.totalLines = file.totalHits + file.totalMisses;
cov.SLOC += file.SLOC = file.totalLines;
if (!file.source) file.source = [];
cov.LOC += file.LOC = file.source.length;
file.coverage = (file.totalHits / file.totalLines) * 100;
// Source
var width = file.source.length.toString().length;
file.source = file.source.map(function(line, i){
++i;
var hits = file[i] === 0 ? 0 : (file[i] || ' ');
if (!boring) {
if (hits === 0) {
hits = '\x1b[31m' + hits + '\x1b[0m';
line = '\x1b[41m' + line + '\x1b[0m';
} else {
hits = '\x1b[32m' + hits + '\x1b[0m';
}
}
return '\n ' + lpad(i, width) + ' | ' + hits + ' | ' + line;
}).join('');
}
}
cov.coverage = (cov.totalHits / cov.SLOC) * 100;
}
/**
* Total coverage for the given file data.
*
* @param {Array} data
* @return {Type}
*/
function coverage(data, val) {
var n = 0;
for (var i = 0, len = data.length; i < len; ++i) {
if (data[i] !== undefined && data[i] == val) ++n;
}
return n;
}
/**
* Test if all files have 100% coverage
*
* @param {Object} cov
* @return {Boolean}
*/
function hasFullCoverage(cov) {
for (var name in cov) {
var file = cov[name];
if (file instanceof Array) {
if (file.coverage !== 100) {
return false;
}
}
}
return true;
}
/**
* Run the given test `files`, or try _test/*_.
*
* @param {Array} files
*/
function run(files) {
cursor(false);
if (!files.length) {
try {
files = fs.readdirSync('test').map(function(file){
return 'test/' + file;
});
} catch (err) {
print('\n failed to load tests in [bold]{./test}\n');
++failures;
process.exit(1);
}
}
runFiles(files);
}
/**
* Show the cursor when `show` is true, otherwise hide it.
*
* @param {Boolean} show
*/
function cursor(show) {
if (show) {
sys.print('\x1b[?25h');
} else {
sys.print('\x1b[?25l');
}
}
/**
* Run the given test `files`.
*
* @param {Array} files
*/
function runFiles(files) {
if (serial) {
(function next(){
if (files.length) {
runFile(files.shift(), next);
}
})();
} else {
files.forEach(runFile);
}
}
/**
* Run tests for the given `file`, callback `fn()` when finished.
*
* @param {String} file
* @param {Function} fn
*/
function runFile(file, fn) {
if (file.match(/\.js$/)) {
var title = path.basename(file),
file = path.join(cwd, file),
mod = require(file.replace(/\.js$/, ''));
(function check(){
var len = Object.keys(mod).length;
if (len) {
runSuite(title, mod, fn);
} else {
setTimeout(check, 20);
}
})();
}
}
/**
* Report `err` for the given `test` and `suite`.
*
* @param {String} suite
* @param {String} test
* @param {Error} err
*/
function error(suite, test, err) {
++failures;
var name = err.name,
stack = err.stack ? err.stack.replace(err.name, '') : '',
label = test === 'uncaught'
? test
: suite + ' ' + test;
print('\n [bold]{' + label + '}: [red]{' + name + '}' + stack + '\n');
}
/**
* Run the given tests, callback `fn()` when finished.
*
* @param {String} title
* @param {Object} tests
* @param {Function} fn
*/
var dots = 0;
function runSuite(title, tests, fn) {
// Keys
var keys = only.length
? only.slice(0)
: Object.keys(tests);
// Setup
var setup = tests.setup || function(fn){ fn(); };
// Iterate tests
(function next(){
if (keys.length) {
var key,
test = tests[key = keys.shift()];
// Non-tests
if (key === 'setup') return next();
// Run test
if (test) {
try {
++testcount;
assert.testTitle = key;
if (serial) {
sys.print('.');
if (++dots % 25 === 0) sys.print('\n');
setup(function(){
if (test.length < 1) {
test();
next();
} else {
var id = setTimeout(function(){
throw new Error("'" + key + "' timed out");
}, timeout);
test(function(){
clearTimeout(id);
next();
});
}
});
} else {
test(function(fn){
process.on('beforeExit', function(){
try {
fn();
} catch (err) {
error(title, key, err);
}
});
});
}
} catch (err) {
error(title, key, err);
}
}
if (!serial) next();
} else if (serial) {
fn();
}
})();
}
/**
* Report exceptions.
*/
function report() {
cursor(true);
process.emit('beforeExit');
if (failures) {
print('\n [bold]{Failures}: [red]{' + failures + '}\n\n');
notify('Failures: ' + failures);
} else {
if (serial) print('');
print('\n [green]{100%} ' + testcount + ' tests\n');
notify('100% ok');
}
if (typeof _$jscoverage === 'object') {
populateCoverage(_$jscoverage);
if (!hasFullCoverage(_$jscoverage) || !quiet) {
reportCoverage(_$jscoverage);
}
}
}
/**
* Growl notify the given `msg`.
*
* @param {String} msg
*/
function notify(msg) {
if (growl) {
childProcess.exec('growlnotify -name Expresso -m "' + msg + '"');
}
}
// Report uncaught exceptions
process.on('uncaughtException', function(err){
error('uncaught', 'uncaught', err);
});
// Show cursor
['INT', 'TERM', 'QUIT'].forEach(function(sig){
process.on('SIG' + sig, function(){
cursor(true);
process.exit(1);
});
});
// Report test coverage when available
// and emit "beforeExit" event to perform
// final assertions
var orig = process.emit;
process.emit = function(event){
if (event === 'exit') {
report();
process.reallyExit(failures);
}
orig.apply(this, arguments);
};
// Run test files
if (!defer) run(files);

View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@@ -0,0 +1,81 @@
# Makefile.am - builds jscoverage
# Copyright (C) 2007, 2008 siliconforks.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = js
AM_CFLAGS = -Ijs -Ijs/obj @XP_DEF@
AM_CXXFLAGS = -Ijs -Ijs/obj @XP_DEF@
resources = jscoverage-help.txt jscoverage-server-help.txt \
jscoverage.jsm jscoverage.manifest jscoverage.xul jscoverage-overlay.js \
jscoverage.html \
jscoverage.css jscoverage-ie.css jscoverage-highlight.css \
jscoverage.js report.js \
jscoverage-throbber.gif
bin_PROGRAMS = jscoverage jscoverage-server
jscoverage_SOURCES = encoding.c encoding.h \
highlight.c highlight.h \
instrument.c instrument.h \
instrument-js.cpp instrument-js.h \
jscoverage.c global.h \
resource-manager.c resource-manager.h \
stream.c stream.h \
util.c util.h \
$(resources)
jscoverage_LDADD = js/obj/libjs.a -lm @LIBICONV@ @EXTRA_TIMER_LIBS@
jscoverage_server_SOURCES = http-connection.c \
http-exchange.c \
http-host.c \
http-message.c \
http-server.c http-server.h \
http-url.c \
encoding.c encoding.h \
highlight.c highlight.h \
instrument-js.cpp instrument-js.h \
jscoverage-server.c global.h \
resource-manager.c resource-manager.h \
stream.c stream.h \
util.c util.h \
$(resources)
jscoverage_server_LDADD = js/obj/libjs.a -lm @EXTRA_SOCKET_LIBS@ @EXTRA_THREAD_LIBS@ @LIBICONV@ @EXTRA_TIMER_LIBS@
noinst_PROGRAMS = generate-resources
generate_resources_SOURCES = generate-resources.c
BUILT_SOURCES = resources.c
resources.c: generate-resources $(resources)
$(srcdir)/generate-resources $(resources) > $@
dist_man_MANS = jscoverage.1 jscoverage-server.1
CLEANFILES = *.gcno *.exe resources.c *~
example: jscoverage
$(srcdir)/jscoverage --exclude=.svn doc/example doc/instrumented
example-inverted: jscoverage
$(srcdir)/jscoverage --exclude=.svn doc/example-inverted doc/instrumented-inverted
example-jsunit: jscoverage
$(srcdir)/jscoverage --exclude=.svn --no-instrument=jsunit doc/example-jsunit doc/instrumented-jsunit
# override default install target so as not to recursively install subpackages
install: install-am

View File

@@ -0,0 +1,884 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile.am - builds jscoverage
# Copyright (C) 2007, 2008 siliconforks.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = jscoverage$(EXEEXT) jscoverage-server$(EXEEXT)
noinst_PROGRAMS = generate-resources$(EXEEXT)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(srcdir)/make-bin-dist.sh.in \
$(srcdir)/make-dist.sh.in $(top_srcdir)/configure COPYING \
config.guess config.rpath config.sub depcomp install-sh \
missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = make-dist.sh make-bin-dist.sh
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am_generate_resources_OBJECTS = generate-resources.$(OBJEXT)
generate_resources_OBJECTS = $(am_generate_resources_OBJECTS)
generate_resources_LDADD = $(LDADD)
am__objects_1 =
am_jscoverage_OBJECTS = encoding.$(OBJEXT) highlight.$(OBJEXT) \
instrument.$(OBJEXT) instrument-js.$(OBJEXT) \
jscoverage.$(OBJEXT) resource-manager.$(OBJEXT) \
stream.$(OBJEXT) util.$(OBJEXT) $(am__objects_1)
jscoverage_OBJECTS = $(am_jscoverage_OBJECTS)
jscoverage_DEPENDENCIES = js/obj/libjs.a
am_jscoverage_server_OBJECTS = http-connection.$(OBJEXT) \
http-exchange.$(OBJEXT) http-host.$(OBJEXT) \
http-message.$(OBJEXT) http-server.$(OBJEXT) \
http-url.$(OBJEXT) encoding.$(OBJEXT) highlight.$(OBJEXT) \
instrument-js.$(OBJEXT) jscoverage-server.$(OBJEXT) \
resource-manager.$(OBJEXT) stream.$(OBJEXT) util.$(OBJEXT) \
$(am__objects_1)
jscoverage_server_OBJECTS = $(am_jscoverage_server_OBJECTS)
jscoverage_server_DEPENDENCIES = js/obj/libjs.a
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
SOURCES = $(generate_resources_SOURCES) $(jscoverage_SOURCES) \
$(jscoverage_server_SOURCES)
DIST_SOURCES = $(generate_resources_SOURCES) $(jscoverage_SOURCES) \
$(jscoverage_server_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
man1dir = $(mandir)/man1
NROFF = nroff
MANS = $(dist_man_MANS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTRA_SOCKET_LIBS = @EXTRA_SOCKET_LIBS@
EXTRA_THREAD_LIBS = @EXTRA_THREAD_LIBS@
EXTRA_TIMER_LIBS = @EXTRA_TIMER_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBICONV = @LTLIBICONV@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XP_DEF = @XP_DEF@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = js
AM_CFLAGS = -Ijs -Ijs/obj @XP_DEF@
AM_CXXFLAGS = -Ijs -Ijs/obj @XP_DEF@
resources = jscoverage-help.txt jscoverage-server-help.txt \
jscoverage.jsm jscoverage.manifest jscoverage.xul jscoverage-overlay.js \
jscoverage.html \
jscoverage.css jscoverage-ie.css jscoverage-highlight.css \
jscoverage.js report.js \
jscoverage-throbber.gif
jscoverage_SOURCES = encoding.c encoding.h \
highlight.c highlight.h \
instrument.c instrument.h \
instrument-js.cpp instrument-js.h \
jscoverage.c global.h \
resource-manager.c resource-manager.h \
stream.c stream.h \
util.c util.h \
$(resources)
jscoverage_LDADD = js/obj/libjs.a -lm @LIBICONV@ @EXTRA_TIMER_LIBS@
jscoverage_server_SOURCES = http-connection.c \
http-exchange.c \
http-host.c \
http-message.c \
http-server.c http-server.h \
http-url.c \
encoding.c encoding.h \
highlight.c highlight.h \
instrument-js.cpp instrument-js.h \
jscoverage-server.c global.h \
resource-manager.c resource-manager.h \
stream.c stream.h \
util.c util.h \
$(resources)
jscoverage_server_LDADD = js/obj/libjs.a -lm @EXTRA_SOCKET_LIBS@ @EXTRA_THREAD_LIBS@ @LIBICONV@ @EXTRA_TIMER_LIBS@
generate_resources_SOURCES = generate-resources.c
BUILT_SOURCES = resources.c
dist_man_MANS = jscoverage.1 jscoverage-server.1
CLEANFILES = *.gcno *.exe resources.c *~
all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
.SUFFIXES: .c .cpp .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
cd $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
make-dist.sh: $(top_builddir)/config.status $(srcdir)/make-dist.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $@
make-bin-dist.sh: $(top_builddir)/config.status $(srcdir)/make-bin-dist.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
rm -f "$(DESTDIR)$(bindir)/$$f"; \
done
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
generate-resources$(EXEEXT): $(generate_resources_OBJECTS) $(generate_resources_DEPENDENCIES)
@rm -f generate-resources$(EXEEXT)
$(LINK) $(generate_resources_OBJECTS) $(generate_resources_LDADD) $(LIBS)
jscoverage$(EXEEXT): $(jscoverage_OBJECTS) $(jscoverage_DEPENDENCIES)
@rm -f jscoverage$(EXEEXT)
$(CXXLINK) $(jscoverage_OBJECTS) $(jscoverage_LDADD) $(LIBS)
jscoverage-server$(EXEEXT): $(jscoverage_server_OBJECTS) $(jscoverage_server_DEPENDENCIES)
@rm -f jscoverage-server$(EXEEXT)
$(CXXLINK) $(jscoverage_server_OBJECTS) $(jscoverage_server_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoding.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generate-resources.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/highlight.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http-connection.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http-exchange.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http-host.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http-message.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http-server.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http-url.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/instrument-js.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/instrument.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jscoverage-server.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jscoverage.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource-manager.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
install-man1: $(man1_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
done
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d $(distdir) || mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-recursive
all-am: Makefile $(PROGRAMS) $(MANS) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-recursive
clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am: install-man
install-dvi: install-dvi-recursive
install-exec-am: install-binPROGRAMS
install-html: install-html-recursive
install-info: install-info-recursive
install-man: install-man1
install-pdf: install-pdf-recursive
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-man
uninstall-man: uninstall-man1
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-binPROGRAMS \
clean-generic clean-noinstPROGRAMS ctags ctags-recursive dist \
dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \
dist-zip distcheck distclean distclean-compile \
distclean-generic distclean-hdr distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-binPROGRAMS install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-man1 install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am \
uninstall-binPROGRAMS uninstall-man uninstall-man1
resources.c: generate-resources $(resources)
$(srcdir)/generate-resources $(resources) > $@
example: jscoverage
$(srcdir)/jscoverage --exclude=.svn doc/example doc/instrumented
example-inverted: jscoverage
$(srcdir)/jscoverage --exclude=.svn doc/example-inverted doc/instrumented-inverted
example-jsunit: jscoverage
$(srcdir)/jscoverage --exclude=.svn --no-instrument=jsunit doc/example-jsunit doc/instrumented-jsunit
# override default install target so as not to recursively install subpackages
install: install-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,8 @@
# node-jscoverage
[JScoverage](http://siliconforks.com/jscoverage/) for node.
## Installation
$ ./configure && make && make install

View File

@@ -0,0 +1,872 @@
# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(AC_AUTOCONF_VERSION, [2.61],,
[m4_warning([this file was generated for autoconf 2.61.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.10'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.10.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.10.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 9
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 13
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.60])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_arg=$1
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$_am_arg | $_am_arg:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check for `mkdir -p'.
AC_DEFUN([AM_PROG_MKDIR_P],
[AC_PREREQ([2.60])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
dnl while keeping a definition of mkdir_p for backward compatibility.
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
dnl Makefile.ins that do not define MKDIR_P, so we do our own
dnl adjustment using top_builddir (which is defined more often than
dnl MKDIR_P).
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
case $mkdir_p in
[[\\/$]]* | ?:[[\\/]]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/iconv.m4])
m4_include([m4/lib-ld.m4])
m4_include([m4/lib-link.m4])
m4_include([m4/lib-prefix.m4])

1526
support/expresso/deps/jscoverage/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF
/* Define to 1 if you have the `getaddrinfo' function. */
#undef HAVE_GETADDRINFO
/* Define to 1 if you have the `gethostbyname_r' function. */
#undef HAVE_GETHOSTBYNAME_R
/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
/* Define to 1 if you have the <iconv.h> header file. */
#undef HAVE_ICONV_H
/* Define to 1 if you have the `inet_aton' function. */
#undef HAVE_INET_ATON
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `MultiByteToWideChar' function. */
#undef HAVE_MULTIBYTETOWIDECHAR
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strndup' function. */
#undef HAVE_STRNDUP
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN

View File

@@ -0,0 +1,666 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2007 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's _LT_CC_BASENAME.
for cc_temp in $CC""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
darwin*)
case $cc_basename in
xlc*)
wl='-Wl,'
;;
esac
;;
mingw* | cygwin* | pw32* | os2*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux* | k*bsd*-gnu)
case $cc_basename in
icc* | ecc*)
wl='-Wl,'
;;
pgcc | pgf77 | pgf90)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
wl='-Wl,'
;;
esac
;;
esac
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
rdos*)
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
wl='-Wl,'
;;
sysv4*MP*)
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
wl='-Wl,'
;;
unicos*)
wl='-Wl,'
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
case "$host_os" in
aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we cannot use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
interix[3-9]*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
gnu* | linux* | k*bsd*-gnu)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
ld_shlibs=no
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
else
ld_shlibs=no
fi
;;
esac
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = no; then
hardcode_libdir_flag_spec=
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
;;
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
hardcode_direct=no
if test "$GCC" = yes ; then
:
else
case $cc_basename in
xlc*)
;;
*)
ld_shlibs=no
;;
esac
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd* | dragonfly*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
fi
;;
hpux11*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
case $host_cpu in
hppa*64*|ia64*)
hardcode_direct=no
;;
*)
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
else
ld_shlibs=no
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
;;
sysv5* | sco3.2v5* | sco5v6*)
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
hardcode_libdir_separator=':'
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
# only about the one the linker finds when passed -lNAME. This is the last
# element of library_names_spec in libtool.m4, or possibly two of them if the
# linker has special search rules.
library_names_spec= # the last element of library_names_spec in libtool.m4
libname_spec='lib$name'
case "$host_os" in
aix3*)
library_names_spec='$libname.a'
;;
aix4* | aix5*)
library_names_spec='$libname$shrext'
;;
amigaos*)
library_names_spec='$libname.a'
;;
beos*)
library_names_spec='$libname$shrext'
;;
bsdi[45]*)
library_names_spec='$libname$shrext'
;;
cygwin* | mingw* | pw32*)
shrext=.dll
library_names_spec='$libname.dll.a $libname.lib'
;;
darwin* | rhapsody*)
shrext=.dylib
library_names_spec='$libname$shrext'
;;
dgux*)
library_names_spec='$libname$shrext'
;;
freebsd1*)
;;
freebsd* | dragonfly*)
case "$host_os" in
freebsd[123]*)
library_names_spec='$libname$shrext$versuffix' ;;
*)
library_names_spec='$libname$shrext' ;;
esac
;;
gnu*)
library_names_spec='$libname$shrext'
;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
library_names_spec='$libname$shrext'
;;
interix[3-9]*)
library_names_spec='$libname$shrext'
;;
irix5* | irix6* | nonstopux*)
library_names_spec='$libname$shrext'
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux* | k*bsd*-gnu)
library_names_spec='$libname$shrext'
;;
knetbsd*-gnu)
library_names_spec='$libname$shrext'
;;
netbsd*)
library_names_spec='$libname$shrext'
;;
newsos6)
library_names_spec='$libname$shrext'
;;
nto-qnx*)
library_names_spec='$libname$shrext'
;;
openbsd*)
library_names_spec='$libname$shrext$versuffix'
;;
os2*)
libname_spec='$name'
shrext=.dll
library_names_spec='$libname.a'
;;
osf3* | osf4* | osf5*)
library_names_spec='$libname$shrext'
;;
rdos*)
;;
solaris*)
library_names_spec='$libname$shrext'
;;
sunos4*)
library_names_spec='$libname$shrext$versuffix'
;;
sysv4 | sysv4.3*)
library_names_spec='$libname$shrext'
;;
sysv4*MP*)
library_names_spec='$libname$shrext'
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
library_names_spec='$libname$shrext'
;;
uts4*)
library_names_spec='$libname$shrext'
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Format of library name prefix.
libname_spec="$escaped_libname_spec"
# Library names that the linker finds when passed -lNAME.
library_names_spec="$escaped_library_names_spec"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF

1658
support/expresso/deps/jscoverage/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

7971
support/expresso/deps/jscoverage/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,88 @@
# configure.ac - configures jscoverage
# Copyright (C) 2007, 2008 siliconforks.com
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
AC_PREREQ(2.61)
AC_INIT([jscoverage], [0.4])
AM_INIT_AUTOMAKE([-Wall foreign])
AC_CONFIG_SRCDIR([jscoverage.c])
AC_CONFIG_HEADERS([config.h])
AC_CANONICAL_HOST
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CXX
# Checks for libraries.
AM_ICONV
# Checks for header files.
AC_CHECK_HEADERS([pthread.h])
AC_CHECK_HEADERS([iconv.h])
AC_CHECK_HEADERS([windows.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
# Checks for library functions.
AC_CHECK_FUNCS([getaddrinfo gethostbyname_r inet_aton strndup vasprintf asprintf])
AC_MSG_CHECKING([for MultiByteToWideChar])
AC_LANG(C)
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <windows.h>]],[[MultiByteToWideChar(0,0,0,0,0,0);]])],
[AC_DEFINE([HAVE_MULTIBYTETOWIDECHAR], [1], [Define to 1 if you have the `MultiByteToWideChar' function.])
jscoverage_have_multibytetowidechar=yes
AC_MSG_RESULT([yes])],
[jscoverage_have_multibytetowidechar=no
AC_MSG_RESULT([no])])
AC_SUBST([XP_DEF])
case "$host_os" in
mingw*)
XP_DEF='-DXP_WIN'
;;
*)
XP_DEF='-DXP_UNIX'
;;
esac
AC_SUBST([EXTRA_SOCKET_LIBS])
AC_SUBST([EXTRA_THREAD_LIBS])
AC_SUBST([EXTRA_TIMER_LIBS])
case "$host_os" in
mingw*)
EXTRA_SOCKET_LIBS='-lws2_32'
EXTRA_THREAD_LIBS=''
EXTRA_TIMER_LIBS='-lwinmm'
;;
*)
EXTRA_SOCKET_LIBS=''
EXTRA_THREAD_LIBS='-lpthread'
EXTRA_TIMER_LIBS=''
;;
esac
if test "$am_cv_func_iconv" != yes && test "$jscoverage_have_multibytetowidechar" != yes
then
echo -ne '\033@<:@1;31m'
AC_MSG_WARN([neither iconv nor Windows character encoding conversion functions found])
AC_MSG_WARN([only ASCII will be supported])
echo -ne '\033@<:@0m'
fi
AC_CONFIG_FILES([Makefile make-dist.sh make-bin-dist.sh tests/Makefile])
AC_OUTPUT

View File

@@ -0,0 +1,589 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2007-03-29.01
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@@ -0,0 +1,87 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>JSCoverage - demo</title>
<link rel="stylesheet" type="text/css" href="reset-fonts-grids.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="doc3" class="yui-t5">
<div id="hd"><h1><a href="./">JSCoverage</a><br><span class="tag">code coverage for JavaScript</span></h1></div>
<div id="bd">
<div id="yui-main">
<div id="jscoverage-main" class="yui-b">
<h2>Demo</h2>
<p>
Several examples of JSCoverage in action are available online. For each demo, click the "Summary" tab
after the JavaScript code in the "Browser" tab has executed. See the <a href="manual.html">manual</a>
for more information.
</p>
<dl>
<dt><a href="instrumented/jscoverage.html?index.html">Simple demo</a></dt>
<dd>A trivial demonstration of JSCoverage. Simply choose a number and then click the "Summary" tab.</dd>
<dt><a href="http://siliconforks.com/jscoverage/instrumented-mochikit/jscoverage.html?tests/index.html">MochiKit test suite</a></dt>
<dd>The <a href="http://mochikit.com/">MochiKit</a> library test suite, instrumented using JSCoverage.</dd>
<dt><a href="http://siliconforks.com/jscoverage/instrumented-jquery/jscoverage.html?test/index.html">jQuery test suite</a></dt>
<dd>The <a href="http://jquery.com/">jQuery</a> library test suite
(which uses the <a href="http://docs.jquery.com/QUnit">QUnit</a> test framework),
instrumented using JSCoverage.</dd>
<dt><a href="http://siliconforks.com/jscoverage/instrumented-scriptaculous/jscoverage.html?test/run_unit_tests.html">script.aculo.us test suite</a></dt>
<dd>The <a href="http://script.aculo.us/">script.aculo.us</a> library test suite, instrumented using JSCoverage. (For this one you
will have to click the links in the left frame to run the tests.)</dd>
<dt><a href="http://siliconforks.com/jscoverage/instrumented-mootools/jscoverage.html?Specs/index.html">MooTools test suite</a></dt>
<dd>The <a href="http://mootools.net/">MooTools</a> library test suite
(which uses the <a href="http://jania.pe.kr/aw/moin.cgi/JSSpec">JSSpec</a> test framework),
instrumented using JSCoverage.</dd>
</dl>
<h3>Inverted mode</h3>
<p>
The following are examples of running JSCoverage in "inverted mode":
for each demo, click the "Coverage report" button after the JavaScript
code on the page has executed.
</p>
<dl>
<dt><a href="instrumented-inverted/index.html">Simple inverted mode demo</a></dt>
<dd>A trivial demonstration JSCoverage in "inverted mode".
Choose a number and then click the "Coverage report" button.</dd>
<dt><a href="http://siliconforks.com/jscoverage/instrumented-jsunit/jsunit/testRunner.html?testPage=http://siliconforks.com/jscoverage/instrumented-jsunit/test.html&amp;autoRun=true">Simple JsUnit demo</a></dt>
<dd>A trivial demonstration of using JSCoverage with JsUnit. Once the
JsUnit unit tests have run, click the "Coverage report" button.</dd>
<dt><a href="http://siliconforks.com/jscoverage/instrumented-jsunit-self/jsunit/testRunner.html?testPage=http://siliconforks.com/jscoverage/instrumented-jsunit-self/jsunit/tests/jsUnitTestSuite.html&amp;autoRun=true">JsUnit test suite</a></dt>
<dd>JsUnit's own test suite, instrumented using JSCoverage. (Note: some versions of Safari seem to have trouble with the tests in the latest version of JsUnit.)</dd>
<dt><a href="http://siliconforks.com/jscoverage/instrumented-yui/tests/YUI.html">YUI test suite</a>
<dd>The <a href="http://developer.yahoo.com/yui/">YUI</a> library test suite
(which uses the <a href="http://developer.yahoo.com/yui/yuitest/">YUI Test</a> test framework),
instrumented using JSCoverage.
<dt><a href="http://siliconforks.com/jscoverage/instrumented-dojo/dojo/tests/runTests.html">Dojo test suite</a>
<dd>The <a href="http://dojotoolkit.org/">Dojo</a> library test suite
(which uses the <a href="http://dojotoolkit.org/book/dojo-book-0-9/part-4-meta-dojo/d-o-h-unit-testing"><acronym title="Dojo Objective Harness">D.O.H.</acronym></a> test framework),
instrumented using JSCoverage. (Note: Internet Explorer may generate errors for some tests in this suite.)
</dl>
</div>
</div>
<div id="jscoverage-sidebar" class="yui-b">
<ul>
<li><a href="./">Home</a>
<li><a href="news.html">News</a> <a href="http://siliconforks.com/jscoverage/news.xml" type="application/rss+xml" title="RSS feed for JSCoverage"><img src="feed-icon-14x14.png" alt="RSS feed"></a>
<li><a href="manual.html">Documentation</a>
<li>Demo
<li><a href="http://siliconforks.com/jscoverage/download.html">Download</a>
<li><a href="faq.html">FAQ</a>
<li><a href="help.html">Help</a>
<li><a href="license.html">License</a>
<li><a href="links.html">Links</a>
<li><a href="users.html">Users</a>
<li><a href="http://siliconforks.com/jscoverage/bugs/">Bug tracker</a>
</ul>
</div>
</div>
<div id="ft">
<address>
Copyright &copy; 2007, 2008 <a href="http://siliconforks.com/"><img src="siliconforks-16x16.png" width="16" height="16" class="icon" alt="Silicon Forks"></a> <a href="http://siliconforks.com/">siliconforks.com</a><br>
<a href="mailto:jscoverage@siliconforks.com">jscoverage@siliconforks.com</a>
</address>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,45 @@
body {
margin-left: 3%;
margin-right: 3%;
font-family: sans-serif;
}
pre {
margin-left: 3%;
margin-right: 3%;
padding: 1em;
border: 1px dotted black;
background-color: #eee;
}
pre.sh_sourceCode {
background-color: #eee;
}
table {
margin-left: 3%;
margin-right: 3%;
border-collapse: collapse;
}
td {
vertical-align: top;
border-width: 0;
padding: 0;
}
td.arrow {
vertical-align: middle;
font-size: xx-large;
padding-left: 20px;
padding-right: 20px;
}
td pre {
margin: 0;
}
img.icon {
vertical-align: middle;
border-width: 0px;
}

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Example</title>
<script type="text/javascript" src="script.js"></script>
<style>
div.black {
color: black;
}
div.red {
color: red;
font-weight: bold;
}
</style>
</head>
<body>
<div id="request" class="red">Please select your favorite number:</div>
<input type="radio" name="number" id="radio1" onclick="go(this);"><label for="radio1">One</label><br>
<input type="radio" name="number" id="radio2" onclick="go(this);"><label for="radio2">Two</label><br>
<input type="radio" name="number" id="radio3" onclick="go(this);"><label for="radio3">Three</label><br>
<input type="radio" name="number" id="radio4" onclick="go(this);"><label for="radio4">Four</label><br>
<div id="result" class="red"></div>
<button onclick='window.open("jscoverage.html");'>Coverage report</button>
</body>
</html>

View File

@@ -0,0 +1,20 @@
function go(element) {
var message;
if (element.id === 'radio1') {
message = 'You selected the number 1.';
}
else if (element.id === 'radio2') {
message = 'You selected the number 2.';
}
else if (element.id === 'radio3') {
message = 'You selected the number 3.';
}
else if (element.id === 'radio4') {
message = 'You selected the number 4.';
}
var div = document.getElementById('request');
div.className = 'black';
div = document.getElementById('result');
div.innerHTML = '<p>' + message + '</p>';
div.innerHTML += '<p>If you are running the instrumented version of this program, you can click the "Coverage report" button to view a coverage report.</p>';
}

View File

@@ -0,0 +1,50 @@
body {
margin-top: 0;
margin-bottom: 0;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000;
font-size: 0.8em;
background-color: #fff;
}
a:link, a:visited {
color: #00F;
}
a:hover {
color: #F00;
}
h1 {
font-size: 1.2em;
font-weight: bold;
color: #039;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
h2 {
font-weight: bold;
color: #039;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
h3 {
font-weight: bold;
color: #039;
text-decoration: underline;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
h4 {
font-weight: bold;
color: #039;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.jsUnitTestResultSuccess {
color: #000;
}
.jsUnitTestResultNotSuccess {
color: #F00;
}

View File

@@ -0,0 +1,10 @@
this file is required due to differences in behavior between Mozilla/Opera
and Internet Explorer.
main-data.html calls kickOffTests() which calls top.testManager.start()
in the top most frame. top.testManager.start() initializes the output
frames using document.write and HTML containing a relative <link> to the
jsUnitStyle.css file. In MSIE, the base href used to find the CSS file is
that of the top level frame however in Mozilla/Opera the base href is
that of main-data.html. This leads to not-found for the jsUnitStyle.css
in Mozilla/Opera. Creating app/css/jsUnitStyle.css works around this problem.

View File

@@ -0,0 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>emptyPage</title>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,534 @@
var JSUNIT_UNDEFINED_VALUE;
var JSUNIT_VERSION = 2.2;
var isTestPageLoaded = false;
//hack for NS62 bug
function jsUnitFixTop() {
var tempTop = top;
if (!tempTop) {
tempTop = window;
while (tempTop.parent) {
tempTop = tempTop.parent;
if (tempTop.top && tempTop.top.jsUnitTestSuite) {
tempTop = tempTop.top;
break;
}
}
}
try {
window.top = tempTop;
} catch (e) {
}
}
jsUnitFixTop();
/**
+ * A more functional typeof
+ * @param Object o
+ * @return String
+ */
function _trueTypeOf(something) {
var result = typeof something;
try {
switch (result) {
case 'string':
case 'boolean':
case 'number':
break;
case 'object':
case 'function':
switch (something.constructor)
{
case String:
result = 'String';
break;
case Boolean:
result = 'Boolean';
break;
case Number:
result = 'Number';
break;
case Array:
result = 'Array';
break;
case RegExp:
result = 'RegExp';
break;
case Function:
result = 'Function';
break;
default:
var m = something.constructor.toString().match(/function\s*([^( ]+)\(/);
if (m)
result = m[1];
else
break;
}
break;
}
}
finally {
result = result.substr(0, 1).toUpperCase() + result.substr(1);
return result;
}
}
function _displayStringForValue(aVar) {
var result = '<' + aVar + '>';
if (!(aVar === null || aVar === top.JSUNIT_UNDEFINED_VALUE)) {
result += ' (' + _trueTypeOf(aVar) + ')';
}
return result;
}
function fail(failureMessage) {
throw new JsUnitException("Call to fail()", failureMessage);
}
function error(errorMessage) {
var errorObject = new Object();
errorObject.description = errorMessage;
errorObject.stackTrace = getStackTrace();
throw errorObject;
}
function argumentsIncludeComments(expectedNumberOfNonCommentArgs, args) {
return args.length == expectedNumberOfNonCommentArgs + 1;
}
function commentArg(expectedNumberOfNonCommentArgs, args) {
if (argumentsIncludeComments(expectedNumberOfNonCommentArgs, args))
return args[0];
return null;
}
function nonCommentArg(desiredNonCommentArgIndex, expectedNumberOfNonCommentArgs, args) {
return argumentsIncludeComments(expectedNumberOfNonCommentArgs, args) ?
args[desiredNonCommentArgIndex] :
args[desiredNonCommentArgIndex - 1];
}
function _validateArguments(expectedNumberOfNonCommentArgs, args) {
if (!( args.length == expectedNumberOfNonCommentArgs ||
(args.length == expectedNumberOfNonCommentArgs + 1 && typeof(args[0]) == 'string') ))
error('Incorrect arguments passed to assert function');
}
function _assert(comment, booleanValue, failureMessage) {
if (!booleanValue)
throw new JsUnitException(comment, failureMessage);
}
function assert() {
_validateArguments(1, arguments);
var booleanValue = nonCommentArg(1, 1, arguments);
if (typeof(booleanValue) != 'boolean')
error('Bad argument to assert(boolean)');
_assert(commentArg(1, arguments), booleanValue === true, 'Call to assert(boolean) with false');
}
function assertTrue() {
_validateArguments(1, arguments);
var booleanValue = nonCommentArg(1, 1, arguments);
if (typeof(booleanValue) != 'boolean')
error('Bad argument to assertTrue(boolean)');
_assert(commentArg(1, arguments), booleanValue === true, 'Call to assertTrue(boolean) with false');
}
function assertFalse() {
_validateArguments(1, arguments);
var booleanValue = nonCommentArg(1, 1, arguments);
if (typeof(booleanValue) != 'boolean')
error('Bad argument to assertFalse(boolean)');
_assert(commentArg(1, arguments), booleanValue === false, 'Call to assertFalse(boolean) with true');
}
function assertEquals() {
_validateArguments(2, arguments);
var var1 = nonCommentArg(1, 2, arguments);
var var2 = nonCommentArg(2, 2, arguments);
_assert(commentArg(2, arguments), var1 === var2, 'Expected ' + _displayStringForValue(var1) + ' but was ' + _displayStringForValue(var2));
}
function assertNotEquals() {
_validateArguments(2, arguments);
var var1 = nonCommentArg(1, 2, arguments);
var var2 = nonCommentArg(2, 2, arguments);
_assert(commentArg(2, arguments), var1 !== var2, 'Expected not to be ' + _displayStringForValue(var2));
}
function assertNull() {
_validateArguments(1, arguments);
var aVar = nonCommentArg(1, 1, arguments);
_assert(commentArg(1, arguments), aVar === null, 'Expected ' + _displayStringForValue(null) + ' but was ' + _displayStringForValue(aVar));
}
function assertNotNull() {
_validateArguments(1, arguments);
var aVar = nonCommentArg(1, 1, arguments);
_assert(commentArg(1, arguments), aVar !== null, 'Expected not to be ' + _displayStringForValue(null));
}
function assertUndefined() {
_validateArguments(1, arguments);
var aVar = nonCommentArg(1, 1, arguments);
_assert(commentArg(1, arguments), aVar === top.JSUNIT_UNDEFINED_VALUE, 'Expected ' + _displayStringForValue(top.JSUNIT_UNDEFINED_VALUE) + ' but was ' + _displayStringForValue(aVar));
}
function assertNotUndefined() {
_validateArguments(1, arguments);
var aVar = nonCommentArg(1, 1, arguments);
_assert(commentArg(1, arguments), aVar !== top.JSUNIT_UNDEFINED_VALUE, 'Expected not to be ' + _displayStringForValue(top.JSUNIT_UNDEFINED_VALUE));
}
function assertNaN() {
_validateArguments(1, arguments);
var aVar = nonCommentArg(1, 1, arguments);
_assert(commentArg(1, arguments), isNaN(aVar), 'Expected NaN');
}
function assertNotNaN() {
_validateArguments(1, arguments);
var aVar = nonCommentArg(1, 1, arguments);
_assert(commentArg(1, arguments), !isNaN(aVar), 'Expected not NaN');
}
function assertObjectEquals() {
_validateArguments(2, arguments);
var var1 = nonCommentArg(1, 2, arguments);
var var2 = nonCommentArg(2, 2, arguments);
var type;
var msg = commentArg(2, arguments)?commentArg(2, arguments):'';
var isSame = (var1 === var2);
//shortpath for references to same object
var isEqual = ( (type = _trueTypeOf(var1)) == _trueTypeOf(var2) );
if (isEqual && !isSame) {
switch (type) {
case 'String':
case 'Number':
isEqual = (var1 == var2);
break;
case 'Boolean':
case 'Date':
isEqual = (var1 === var2);
break;
case 'RegExp':
case 'Function':
isEqual = (var1.toString() === var2.toString());
break;
default: //Object | Array
var i;
if (isEqual = (var1.length === var2.length))
for (i in var1)
assertObjectEquals(msg + ' found nested ' + type + '@' + i + '\n', var1[i], var2[i]);
}
_assert(msg, isEqual, 'Expected ' + _displayStringForValue(var1) + ' but was ' + _displayStringForValue(var2));
}
}
assertArrayEquals = assertObjectEquals;
function assertEvaluatesToTrue() {
_validateArguments(1, arguments);
var value = nonCommentArg(1, 1, arguments);
if (!value)
fail(commentArg(1, arguments));
}
function assertEvaluatesToFalse() {
_validateArguments(1, arguments);
var value = nonCommentArg(1, 1, arguments);
if (value)
fail(commentArg(1, arguments));
}
function assertHTMLEquals() {
_validateArguments(2, arguments);
var var1 = nonCommentArg(1, 2, arguments);
var var2 = nonCommentArg(2, 2, arguments);
var var1Standardized = standardizeHTML(var1);
var var2Standardized = standardizeHTML(var2);
_assert(commentArg(2, arguments), var1Standardized === var2Standardized, 'Expected ' + _displayStringForValue(var1Standardized) + ' but was ' + _displayStringForValue(var2Standardized));
}
function assertHashEquals() {
_validateArguments(2, arguments);
var var1 = nonCommentArg(1, 2, arguments);
var var2 = nonCommentArg(2, 2, arguments);
for (var key in var1) {
assertNotUndefined("Expected hash had key " + key + " that was not found", var2[key]);
assertEquals(
"Value for key " + key + " mismatch - expected = " + var1[key] + ", actual = " + var2[key],
var1[key], var2[key]
);
}
for (var key in var2) {
assertNotUndefined("Actual hash had key " + key + " that was not expected", var1[key]);
}
}
function assertRoughlyEquals() {
_validateArguments(3, arguments);
var expected = nonCommentArg(1, 3, arguments);
var actual = nonCommentArg(2, 3, arguments);
var tolerance = nonCommentArg(3, 3, arguments);
assertTrue(
"Expected " + expected + ", but got " + actual + " which was more than " + tolerance + " away",
Math.abs(expected - actual) < tolerance
);
}
function assertContains() {
_validateArguments(2, arguments);
var contained = nonCommentArg(1, 2, arguments);
var container = nonCommentArg(2, 2, arguments);
assertTrue(
"Expected '" + container + "' to contain '" + contained + "'",
container.indexOf(contained) != -1
);
}
function standardizeHTML(html) {
var translator = document.createElement("DIV");
translator.innerHTML = html;
return translator.innerHTML;
}
function isLoaded() {
return isTestPageLoaded;
}
function setUp() {
}
function tearDown() {
}
function getFunctionName(aFunction) {
var regexpResult = aFunction.toString().match(/function(\s*)(\w*)/);
if (regexpResult && regexpResult.length >= 2 && regexpResult[2]) {
return regexpResult[2];
}
return 'anonymous';
}
function getStackTrace() {
var result = '';
if (typeof(arguments.caller) != 'undefined') { // IE, not ECMA
for (var a = arguments.caller; a != null; a = a.caller) {
result += '> ' + getFunctionName(a.callee) + '\n';
if (a.caller == a) {
result += '*';
break;
}
}
}
else { // Mozilla, not ECMA
// fake an exception so we can get Mozilla's error stack
var testExcp;
try
{
foo.bar;
}
catch(testExcp)
{
var stack = parseErrorStack(testExcp);
for (var i = 1; i < stack.length; i++)
{
result += '> ' + stack[i] + '\n';
}
}
}
return result;
}
function parseErrorStack(excp)
{
var stack = [];
var name;
if (!excp || !excp.stack)
{
return stack;
}
var stacklist = excp.stack.split('\n');
for (var i = 0; i < stacklist.length - 1; i++)
{
var framedata = stacklist[i];
name = framedata.match(/^(\w*)/)[1];
if (!name) {
name = 'anonymous';
}
stack[stack.length] = name;
}
// remove top level anonymous functions to match IE
while (stack.length && stack[stack.length - 1] == 'anonymous')
{
stack.length = stack.length - 1;
}
return stack;
}
function JsUnitException(comment, message) {
this.isJsUnitException = true;
this.comment = comment;
this.jsUnitMessage = message;
this.stackTrace = getStackTrace();
}
function warn() {
if (top.tracer != null)
top.tracer.warn(arguments[0], arguments[1]);
}
function inform() {
if (top.tracer != null)
top.tracer.inform(arguments[0], arguments[1]);
}
function info() {
inform(arguments[0], arguments[1]);
}
function debug() {
if (top.tracer != null)
top.tracer.debug(arguments[0], arguments[1]);
}
function setJsUnitTracer(aJsUnitTracer) {
top.tracer = aJsUnitTracer;
}
function trim(str) {
if (str == null)
return null;
var startingIndex = 0;
var endingIndex = str.length - 1;
while (str.substring(startingIndex, startingIndex + 1) == ' ')
startingIndex++;
while (str.substring(endingIndex, endingIndex + 1) == ' ')
endingIndex--;
if (endingIndex < startingIndex)
return '';
return str.substring(startingIndex, endingIndex + 1);
}
function isBlank(str) {
return trim(str) == '';
}
// the functions push(anArray, anObject) and pop(anArray)
// exist because the JavaScript Array.push(anObject) and Array.pop()
// functions are not available in IE 5.0
function push(anArray, anObject) {
anArray[anArray.length] = anObject;
}
function pop(anArray) {
if (anArray.length >= 1) {
delete anArray[anArray.length - 1];
anArray.length--;
}
}
function jsUnitGetParm(name)
{
if (typeof(top.jsUnitParmHash[name]) != 'undefined')
{
return top.jsUnitParmHash[name];
}
return null;
}
if (top && typeof(top.xbDEBUG) != 'undefined' && top.xbDEBUG.on && top.testManager)
{
top.xbDebugTraceObject('top.testManager.containerTestFrame', 'JSUnitException');
// asserts
top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_displayStringForValue');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'error');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'argumentsIncludeComments');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'commentArg');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'nonCommentArg');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_validateArguments');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', '_assert');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assert');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertTrue');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertEquals');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotEquals');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNull');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotNull');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertUndefined');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotUndefined');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNaN');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'assertNotNaN');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'isLoaded');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'setUp');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'tearDown');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'getFunctionName');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'getStackTrace');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'warn');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'inform');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'debug');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'setJsUnitTracer');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'trim');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'isBlank');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'newOnLoadEvent');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'push');
top.xbDebugTraceFunction('top.testManager.containerTestFrame', 'pop');
}
function newOnLoadEvent() {
isTestPageLoaded = true;
}
function jsUnitSetOnLoad(windowRef, onloadHandler)
{
var isKonqueror = navigator.userAgent.indexOf('Konqueror/') != -1 ||
navigator.userAgent.indexOf('Safari/') != -1;
if (typeof(windowRef.attachEvent) != 'undefined') {
// Internet Explorer, Opera
windowRef.attachEvent("onload", onloadHandler);
} else if (typeof(windowRef.addEventListener) != 'undefined' && !isKonqueror) {
// Mozilla, Konqueror
// exclude Konqueror due to load issues
windowRef.addEventListener("load", onloadHandler, false);
} else if (typeof(windowRef.document.addEventListener) != 'undefined' && !isKonqueror) {
// DOM 2 Events
// exclude Mozilla, Konqueror due to load issues
windowRef.document.addEventListener("load", onloadHandler, false);
} else if (typeof(windowRef.onload) != 'undefined' && windowRef.onload) {
windowRef.jsunit_original_onload = windowRef.onload;
windowRef.onload = function() {
windowRef.jsunit_original_onload();
onloadHandler();
};
} else {
// browsers that do not support windowRef.attachEvent or
// windowRef.addEventListener will override a page's own onload event
windowRef.onload = onloadHandler;
}
}
jsUnitSetOnLoad(window, newOnLoadEvent);

View File

@@ -0,0 +1,81 @@
// Mock setTimeout, clearTimeout
// Contributed by Pivotal Computer Systems, www.pivotalsf.com
var Clock = {
timeoutsMade: 0,
scheduledFunctions: {},
nowMillis: 0,
reset: function() {
this.scheduledFunctions = {};
this.nowMillis = 0;
this.timeoutsMade = 0;
},
tick: function(millis) {
var oldMillis = this.nowMillis;
var newMillis = oldMillis + millis;
this.runFunctionsWithinRange(oldMillis, newMillis);
this.nowMillis = newMillis;
},
runFunctionsWithinRange: function(oldMillis, nowMillis) {
var scheduledFunc;
var funcsToRun = [];
for (var timeoutKey in this.scheduledFunctions) {
scheduledFunc = this.scheduledFunctions[timeoutKey];
if (scheduledFunc != undefined &&
scheduledFunc.runAtMillis >= oldMillis &&
scheduledFunc.runAtMillis <= nowMillis) {
funcsToRun.push(scheduledFunc);
this.scheduledFunctions[timeoutKey] = undefined;
}
}
if (funcsToRun.length > 0) {
funcsToRun.sort(function(a, b) {
return a.runAtMillis - b.runAtMillis;
});
for (var i = 0; i < funcsToRun.length; ++i) {
try {
this.nowMillis = funcsToRun[i].runAtMillis;
funcsToRun[i].funcToCall();
if (funcsToRun[i].recurring) {
Clock.scheduleFunction(funcsToRun[i].timeoutKey,
funcsToRun[i].funcToCall,
funcsToRun[i].millis,
true);
}
} catch(e) {
}
}
this.runFunctionsWithinRange(oldMillis, nowMillis);
}
},
scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
Clock.scheduledFunctions[timeoutKey] = {
runAtMillis: Clock.nowMillis + millis,
funcToCall: funcToCall,
recurring: recurring,
timeoutKey: timeoutKey,
millis: millis
};
}
};
function setTimeout(funcToCall, millis) {
Clock.timeoutsMade = Clock.timeoutsMade + 1;
Clock.scheduleFunction(Clock.timeoutsMade, funcToCall, millis, false);
return Clock.timeoutsMade;
}
function setInterval(funcToCall, millis) {
Clock.timeoutsMade = Clock.timeoutsMade + 1;
Clock.scheduleFunction(Clock.timeoutsMade, funcToCall, millis, true);
return Clock.timeoutsMade;
}
function clearTimeout(timeoutKey) {
Clock.scheduledFunctions[timeoutKey] = undefined;
}
function clearInterval(timeoutKey) {
Clock.scheduledFunctions[timeoutKey] = undefined;
}

View File

@@ -0,0 +1,705 @@
function jsUnitTestManager() {
this._windowForAllProblemMessages = null;
this.container = top.frames.testContainer
this.documentLoader = top.frames.documentLoader;
this.mainFrame = top.frames.mainFrame;
this.containerController = this.container.frames.testContainerController;
this.containerTestFrame = this.container.frames.testFrame;
var mainData = this.mainFrame.frames.mainData;
// form elements on mainData frame
this.testFileName = mainData.document.testRunnerForm.testFileName;
this.runButton = mainData.document.testRunnerForm.runButton;
this.traceLevel = mainData.document.testRunnerForm.traceLevel;
this.closeTraceWindowOnNewRun = mainData.document.testRunnerForm.closeTraceWindowOnNewRun;
this.timeout = mainData.document.testRunnerForm.timeout;
this.setUpPageTimeout = mainData.document.testRunnerForm.setUpPageTimeout;
// image output
this.progressBar = this.mainFrame.frames.mainProgress.document.progress;
this.problemsListField = this.mainFrame.frames.mainErrors.document.testRunnerForm.problemsList;
this.testCaseResultsField = this.mainFrame.frames.mainResults.document.resultsForm.testCases;
this.resultsTimeField = this.mainFrame.frames.mainResults.document.resultsForm.time;
// 'layer' output frames
this.uiFrames = new Object();
this.uiFrames.mainStatus = this.mainFrame.frames.mainStatus;
var mainCounts = this.mainFrame.frames.mainCounts;
this.uiFrames.mainCountsErrors = mainCounts.frames.mainCountsErrors;
this.uiFrames.mainCountsFailures = mainCounts.frames.mainCountsFailures;
this.uiFrames.mainCountsRuns = mainCounts.frames.mainCountsRuns;
this._baseURL = "";
this.setup();
}
// seconds to wait for each test page to load
jsUnitTestManager.TESTPAGE_WAIT_SEC = 120;
jsUnitTestManager.TIMEOUT_LENGTH = 20;
// seconds to wait for setUpPage to complete
jsUnitTestManager.SETUPPAGE_TIMEOUT = 120;
// milliseconds to wait between polls on setUpPages
jsUnitTestManager.SETUPPAGE_INTERVAL = 100;
jsUnitTestManager.RESTORED_HTML_DIV_ID = "jsUnitRestoredHTML";
jsUnitTestManager.prototype.setup = function () {
this.totalCount = 0;
this.errorCount = 0;
this.failureCount = 0;
this._suiteStack = Array();
var initialSuite = new top.jsUnitTestSuite();
push(this._suiteStack, initialSuite);
}
jsUnitTestManager.prototype.start = function () {
this._baseURL = this.resolveUserEnteredTestFileName();
var firstQuery = this._baseURL.indexOf("?");
if (firstQuery >= 0) {
this._baseURL = this._baseURL.substring(0, firstQuery);
}
var lastSlash = this._baseURL.lastIndexOf("/");
var lastRevSlash = this._baseURL.lastIndexOf("\\");
if (lastRevSlash > lastSlash) {
lastSlash = lastRevSlash;
}
if (lastSlash > 0) {
this._baseURL = this._baseURL.substring(0, lastSlash + 1);
}
this._timeRunStarted = new Date();
this.initialize();
setTimeout('top.testManager._nextPage();', jsUnitTestManager.TIMEOUT_LENGTH);
}
jsUnitTestManager.prototype.getBaseURL = function () {
return this._baseURL;
}
jsUnitTestManager.prototype.doneLoadingPage = function (pageName) {
//this.containerTestFrame.setTracer(top.tracer);
this._testFileName = pageName;
if (this.isTestPageSuite())
this._handleNewSuite();
else
{
this._testIndex = 0;
this._testsInPage = this.getTestFunctionNames();
this._numberOfTestsInPage = this._testsInPage.length;
this._runTest();
}
}
jsUnitTestManager.prototype._handleNewSuite = function () {
var allegedSuite = this.containerTestFrame.suite();
if (allegedSuite.isjsUnitTestSuite) {
var newSuite = allegedSuite.clone();
if (newSuite.containsTestPages())
push(this._suiteStack, newSuite);
this._nextPage();
}
else {
this.fatalError('Invalid test suite in file ' + this._testFileName);
this.abort();
}
}
jsUnitTestManager.prototype._runTest = function () {
if (this._testIndex + 1 > this._numberOfTestsInPage)
{
// execute tearDownPage *synchronously*
// (unlike setUpPage which is asynchronous)
if (typeof this.containerTestFrame.tearDownPage == 'function') {
this.containerTestFrame.tearDownPage();
}
this._nextPage();
return;
}
if (this._testIndex == 0) {
this.storeRestoredHTML();
if (typeof(this.containerTestFrame.setUpPage) == 'function') {
// first test for this page and a setUpPage is defined
if (typeof(this.containerTestFrame.setUpPageStatus) == 'undefined') {
// setUpPage() not called yet, so call it
this.containerTestFrame.setUpPageStatus = false;
this.containerTestFrame.startTime = new Date();
this.containerTestFrame.setUpPage();
// try test again later
setTimeout('top.testManager._runTest()', jsUnitTestManager.SETUPPAGE_INTERVAL);
return;
}
if (this.containerTestFrame.setUpPageStatus != 'complete') {
top.status = 'setUpPage not completed... ' + this.containerTestFrame.setUpPageStatus + ' ' + (new Date());
if ((new Date() - this.containerTestFrame.startTime) / 1000 > this.getsetUpPageTimeout()) {
this.fatalError('setUpPage timed out without completing.');
if (!this.userConfirm('Retry Test Run?')) {
this.abort();
return;
}
this.containerTestFrame.startTime = (new Date());
}
// try test again later
setTimeout('top.testManager._runTest()', jsUnitTestManager.SETUPPAGE_INTERVAL);
return;
}
}
}
top.status = '';
// either not first test, or no setUpPage defined, or setUpPage completed
this.executeTestFunction(this._testsInPage[this._testIndex]);
this.totalCount++;
this.updateProgressIndicators();
this._testIndex++;
setTimeout('top.testManager._runTest()', jsUnitTestManager.TIMEOUT_LENGTH);
}
jsUnitTestManager.prototype._done = function () {
var secondsSinceRunBegan = (new Date() - this._timeRunStarted) / 1000;
this.setStatus('Done (' + secondsSinceRunBegan + ' seconds)');
this._cleanUp();
if (top.shouldSubmitResults()) {
this.resultsTimeField.value = secondsSinceRunBegan;
top.submitResults();
}
}
jsUnitTestManager.prototype._nextPage = function () {
this._restoredHTML = null;
if (this._currentSuite().hasMorePages()) {
this.loadPage(this._currentSuite().nextPage());
}
else {
pop(this._suiteStack);
if (this._currentSuite() == null)
this._done();
else
this._nextPage();
}
}
jsUnitTestManager.prototype._currentSuite = function () {
var suite = null;
if (this._suiteStack && this._suiteStack.length > 0)
suite = this._suiteStack[this._suiteStack.length - 1];
return suite;
}
jsUnitTestManager.prototype.calculateProgressBarProportion = function () {
if (this.totalCount == 0)
return 0;
var currentDivisor = 1;
var result = 0;
for (var i = 0; i < this._suiteStack.length; i++) {
var aSuite = this._suiteStack[i];
currentDivisor *= aSuite.testPages.length;
result += (aSuite.pageIndex - 1) / currentDivisor;
}
result += (this._testIndex + 1) / (this._numberOfTestsInPage * currentDivisor);
return result;
}
jsUnitTestManager.prototype._cleanUp = function () {
this.containerController.setTestPage('./app/emptyPage.html');
this.finalize();
top.tracer.finalize();
}
jsUnitTestManager.prototype.abort = function () {
this.setStatus('Aborted');
this._cleanUp();
}
jsUnitTestManager.prototype.getTimeout = function () {
var result = jsUnitTestManager.TESTPAGE_WAIT_SEC;
try {
result = eval(this.timeout.value);
}
catch (e) {
}
return result;
}
jsUnitTestManager.prototype.getsetUpPageTimeout = function () {
var result = jsUnitTestManager.SETUPPAGE_TIMEOUT;
try {
result = eval(this.setUpPageTimeout.value);
}
catch (e) {
}
return result;
}
jsUnitTestManager.prototype.isTestPageSuite = function () {
var result = false;
if (typeof(this.containerTestFrame.suite) == 'function')
{
result = true;
}
return result;
}
jsUnitTestManager.prototype.getTestFunctionNames = function () {
var testFrame = this.containerTestFrame;
var testFunctionNames = new Array();
var i;
if (testFrame && typeof(testFrame.exposeTestFunctionNames) == 'function')
return testFrame.exposeTestFunctionNames();
if (testFrame &&
testFrame.document &&
typeof(testFrame.document.scripts) != 'undefined' &&
testFrame.document.scripts.length > 0) { // IE5 and up
var scriptsInTestFrame = testFrame.document.scripts;
for (i = 0; i < scriptsInTestFrame.length; i++) {
var someNames = this._extractTestFunctionNamesFromScript(scriptsInTestFrame[i]);
if (someNames)
testFunctionNames = testFunctionNames.concat(someNames);
}
}
else {
for (i in testFrame) {
if (i.substring(0, 4) == 'test' && typeof(testFrame[i]) == 'function')
push(testFunctionNames, i);
}
}
return testFunctionNames;
}
jsUnitTestManager.prototype._extractTestFunctionNamesFromScript = function (aScript) {
var result;
var remainingScriptToInspect = aScript.text;
var currentIndex = this._indexOfTestFunctionIn(remainingScriptToInspect);
while (currentIndex != -1) {
if (!result)
result = new Array();
var fragment = remainingScriptToInspect.substring(currentIndex, remainingScriptToInspect.length);
result = result.concat(fragment.substring('function '.length, fragment.indexOf('(')));
remainingScriptToInspect = remainingScriptToInspect.substring(currentIndex + 12, remainingScriptToInspect.length);
currentIndex = this._indexOfTestFunctionIn(remainingScriptToInspect);
}
return result;
}
jsUnitTestManager.prototype._indexOfTestFunctionIn = function (string) {
return string.indexOf('function test');
}
jsUnitTestManager.prototype.loadPage = function (testFileName) {
this._testFileName = testFileName;
this._loadAttemptStartTime = new Date();
this.setStatus('Opening Test Page "' + this._testFileName + '"');
this.containerController.setTestPage(this._testFileName);
this._callBackWhenPageIsLoaded();
}
jsUnitTestManager.prototype._callBackWhenPageIsLoaded = function () {
if ((new Date() - this._loadAttemptStartTime) / 1000 > this.getTimeout()) {
this.fatalError('Reading Test Page ' + this._testFileName + ' timed out.\nMake sure that the file exists and is a Test Page.');
if (this.userConfirm('Retry Test Run?')) {
this.loadPage(this._testFileName);
return;
} else {
this.abort();
return;
}
}
if (!this._isTestFrameLoaded()) {
setTimeout('top.testManager._callBackWhenPageIsLoaded();', jsUnitTestManager.TIMEOUT_LENGTH);
return;
}
this.doneLoadingPage(this._testFileName);
}
jsUnitTestManager.prototype._isTestFrameLoaded = function () {
try {
return this.containerController.isPageLoaded();
}
catch (e) {
}
return false;
}
jsUnitTestManager.prototype.executeTestFunction = function (functionName) {
this._testFunctionName = functionName;
this.setStatus('Running test "' + this._testFunctionName + '"');
var excep = null;
var timeBefore = new Date();
try {
if (this._restoredHTML)
top.testContainer.testFrame.document.getElementById(jsUnitTestManager.RESTORED_HTML_DIV_ID).innerHTML = this._restoredHTML;
if (this.containerTestFrame.setUp !== JSUNIT_UNDEFINED_VALUE)
this.containerTestFrame.setUp();
this.containerTestFrame[this._testFunctionName]();
}
catch (e1) {
excep = e1;
}
finally {
try {
if (this.containerTestFrame.tearDown !== JSUNIT_UNDEFINED_VALUE)
this.containerTestFrame.tearDown();
}
catch (e2) {
//Unlike JUnit, only assign a tearDown exception to excep if there is not already an exception from the test body
if (excep == null)
excep = e2;
}
}
var timeTaken = (new Date() - timeBefore) / 1000;
if (excep != null)
this._handleTestException(excep);
var serializedTestCaseString = this._currentTestFunctionNameWithTestPageName(true) + "|" + timeTaken + "|";
if (excep == null)
serializedTestCaseString += "S||";
else {
if (typeof(excep.isJsUnitException) != 'undefined' && excep.isJsUnitException)
serializedTestCaseString += "F|";
else {
serializedTestCaseString += "E|";
}
serializedTestCaseString += this._problemDetailMessageFor(excep);
}
this._addOption(this.testCaseResultsField,
serializedTestCaseString,
serializedTestCaseString);
}
jsUnitTestManager.prototype._currentTestFunctionNameWithTestPageName = function(useFullyQualifiedTestPageName) {
var testURL = this.containerTestFrame.location.href;
var testQuery = testURL.indexOf("?");
if (testQuery >= 0) {
testURL = testURL.substring(0, testQuery);
}
if (!useFullyQualifiedTestPageName) {
if (testURL.substring(0, this._baseURL.length) == this._baseURL)
testURL = testURL.substring(this._baseURL.length);
}
return testURL + ':' + this._testFunctionName;
}
jsUnitTestManager.prototype._addOption = function(listField, problemValue, problemMessage) {
if (typeof(listField.ownerDocument) != 'undefined'
&& typeof(listField.ownerDocument.createElement) != 'undefined') {
// DOM Level 2 HTML method.
// this is required for Opera 7 since appending to the end of the
// options array does not work, and adding an Option created by new Option()
// and appended by listField.options.add() fails due to WRONG_DOCUMENT_ERR
var problemDocument = listField.ownerDocument;
var errOption = problemDocument.createElement('option');
errOption.setAttribute('value', problemValue);
errOption.appendChild(problemDocument.createTextNode(problemMessage));
listField.appendChild(errOption);
}
else {
// new Option() is DOM 0
errOption = new Option(problemMessage, problemValue);
if (typeof(listField.add) != 'undefined') {
// DOM 2 HTML
listField.add(errOption, null);
}
else if (typeof(listField.options.add) != 'undefined') {
// DOM 0
listField.options.add(errOption, null);
}
else {
// DOM 0
listField.options[listField.length] = errOption;
}
}
}
jsUnitTestManager.prototype._handleTestException = function (excep) {
var problemMessage = this._currentTestFunctionNameWithTestPageName(false) + ' ';
var errOption;
if (typeof(excep.isJsUnitException) == 'undefined' || !excep.isJsUnitException) {
problemMessage += 'had an error';
this.errorCount++;
}
else {
problemMessage += 'failed';
this.failureCount++;
}
var listField = this.problemsListField;
this._addOption(listField,
this._problemDetailMessageFor(excep),
problemMessage);
}
jsUnitTestManager.prototype._problemDetailMessageFor = function (excep) {
var result = null;
if (typeof(excep.isJsUnitException) != 'undefined' && excep.isJsUnitException) {
result = '';
if (excep.comment != null)
result += ('"' + excep.comment + '"\n');
result += excep.jsUnitMessage;
if (excep.stackTrace)
result += '\n\nStack trace follows:\n' + excep.stackTrace;
}
else {
result = 'Error message is:\n"';
result +=
(typeof(excep.description) == 'undefined') ?
excep :
excep.description;
result += '"';
if (typeof(excep.stack) != 'undefined') // Mozilla only
result += '\n\nStack trace follows:\n' + excep.stack;
}
return result;
}
jsUnitTestManager.prototype._setTextOnLayer = function (layerName, str) {
try {
var content;
if (content = this.uiFrames[layerName].document.getElementById('content'))
content.innerHTML = str;
else
throw 'No content div found.';
}
catch (e) {
var html = '';
html += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
html += '<html><head><link rel="stylesheet" type="text/css" href="css/jsUnitStyle.css"><\/head>';
html += '<body><div id="content">';
html += str;
html += '<\/div><\/body>';
html += '<\/html>';
this.uiFrames[layerName].document.write(html);
this.uiFrames[layerName].document.close();
}
}
jsUnitTestManager.prototype.setStatus = function (str) {
this._setTextOnLayer('mainStatus', '<b>Status:<\/b> ' + str);
}
jsUnitTestManager.prototype._setErrors = function (n) {
this._setTextOnLayer('mainCountsErrors', '<b>Errors: <\/b>' + n);
}
jsUnitTestManager.prototype._setFailures = function (n) {
this._setTextOnLayer('mainCountsFailures', '<b>Failures:<\/b> ' + n);
}
jsUnitTestManager.prototype._setTotal = function (n) {
this._setTextOnLayer('mainCountsRuns', '<b>Runs:<\/b> ' + n);
}
jsUnitTestManager.prototype._setProgressBarImage = function (imgName) {
this.progressBar.src = imgName;
}
jsUnitTestManager.prototype._setProgressBarWidth = function (w) {
this.progressBar.width = w;
}
jsUnitTestManager.prototype.updateProgressIndicators = function () {
this._setTotal(this.totalCount);
this._setErrors(this.errorCount);
this._setFailures(this.failureCount);
this._setProgressBarWidth(300 * this.calculateProgressBarProportion());
if (this.errorCount > 0 || this.failureCount > 0)
this._setProgressBarImage('../images/red.gif');
else
this._setProgressBarImage('../images/green.gif');
}
jsUnitTestManager.prototype.showMessageForSelectedProblemTest = function () {
var problemTestIndex = this.problemsListField.selectedIndex;
if (problemTestIndex != -1)
this.fatalError(this.problemsListField[problemTestIndex].value);
}
jsUnitTestManager.prototype.showMessagesForAllProblemTests = function () {
if (this.problemsListField.length == 0)
return;
try {
if (this._windowForAllProblemMessages && !this._windowForAllProblemMessages.closed)
this._windowForAllProblemMessages.close();
}
catch(e) {
}
this._windowForAllProblemMessages = window.open('', '', 'width=600, height=350,status=no,resizable=yes,scrollbars=yes');
var resDoc = this._windowForAllProblemMessages.document;
resDoc.write('<html><head><link rel="stylesheet" href="../css/jsUnitStyle.css"><title>Tests with problems - JsUnit<\/title><head><body>');
resDoc.write('<p class="jsUnitSubHeading">Tests with problems (' + this.problemsListField.length + ' total) - JsUnit<\/p>');
resDoc.write('<p class="jsUnitSubSubHeading"><i>Running on ' + navigator.userAgent + '</i></p>');
for (var i = 0; i < this.problemsListField.length; i++)
{
resDoc.write('<p class="jsUnitDefault">');
resDoc.write('<b>' + (i + 1) + '. ');
resDoc.write(this.problemsListField[i].text);
resDoc.write('<\/b><\/p><p><pre>');
resDoc.write(this._makeHTMLSafe(this.problemsListField[i].value));
resDoc.write('<\/pre><\/p>');
}
resDoc.write('<\/body><\/html>');
resDoc.close();
}
jsUnitTestManager.prototype._makeHTMLSafe = function (string) {
string = string.replace(/&/g, '&amp;');
string = string.replace(/</g, '&lt;');
string = string.replace(/>/g, '&gt;');
return string;
}
jsUnitTestManager.prototype._clearProblemsList = function () {
var listField = this.problemsListField;
var initialLength = listField.options.length;
for (var i = 0; i < initialLength; i++)
listField.remove(0);
}
jsUnitTestManager.prototype.initialize = function () {
this.setStatus('Initializing...');
this._setRunButtonEnabled(false);
this._clearProblemsList();
this.updateProgressIndicators();
this.setStatus('Done initializing');
}
jsUnitTestManager.prototype.finalize = function () {
this._setRunButtonEnabled(true);
}
jsUnitTestManager.prototype._setRunButtonEnabled = function (b) {
this.runButton.disabled = !b;
}
jsUnitTestManager.prototype.getTestFileName = function () {
var rawEnteredFileName = this.testFileName.value;
var result = rawEnteredFileName;
while (result.indexOf('\\') != -1)
result = result.replace('\\', '/');
return result;
}
jsUnitTestManager.prototype.getTestFunctionName = function () {
return this._testFunctionName;
}
jsUnitTestManager.prototype.resolveUserEnteredTestFileName = function (rawText) {
var userEnteredTestFileName = top.testManager.getTestFileName();
// only test for file:// since Opera uses a different format
if (userEnteredTestFileName.indexOf('http://') == 0 || userEnteredTestFileName.indexOf('https://') == 0 || userEnteredTestFileName.indexOf('file://') == 0)
return userEnteredTestFileName;
return getTestFileProtocol() + this.getTestFileName();
}
jsUnitTestManager.prototype.storeRestoredHTML = function () {
if (document.getElementById && top.testContainer.testFrame.document.getElementById(jsUnitTestManager.RESTORED_HTML_DIV_ID))
this._restoredHTML = top.testContainer.testFrame.document.getElementById(jsUnitTestManager.RESTORED_HTML_DIV_ID).innerHTML;
}
jsUnitTestManager.prototype.fatalError = function(aMessage) {
if (top.shouldSubmitResults())
this.setStatus(aMessage);
else
alert(aMessage);
}
jsUnitTestManager.prototype.userConfirm = function(aMessage) {
if (top.shouldSubmitResults())
return false;
else
return confirm(aMessage);
}
function getTestFileProtocol() {
return getDocumentProtocol();
}
function getDocumentProtocol() {
var protocol = top.document.location.protocol;
if (protocol == "file:")
return "file:///";
if (protocol == "http:")
return "http://";
if (protocol == 'https:')
return 'https://';
if (protocol == "chrome:")
return "chrome://";
return null;
}
function browserSupportsReadingFullPathFromFileField() {
return !isOpera() && !isIE7();
}
function isOpera() {
return navigator.userAgent.toLowerCase().indexOf("opera") != -1;
}
function isIE7() {
return navigator.userAgent.toLowerCase().indexOf("msie 7") != -1;
}
function isBeingRunOverHTTP() {
return getDocumentProtocol() == "http://";
}
function getWebserver() {
if (isBeingRunOverHTTP()) {
var myUrl = location.href;
var myUrlWithProtocolStripped = myUrl.substring(myUrl.indexOf("/") + 2);
return myUrlWithProtocolStripped.substring(0, myUrlWithProtocolStripped.indexOf("/"));
}
return null;
}
// the functions push(anArray, anObject) and pop(anArray)
// exist because the JavaScript Array.push(anObject) and Array.pop()
// functions are not available in IE 5.0
function push(anArray, anObject) {
anArray[anArray.length] = anObject;
}
function pop(anArray) {
if (anArray.length >= 1) {
delete anArray[anArray.length - 1];
anArray.length--;
}
}
if (xbDEBUG.on) {
xbDebugTraceObject('window', 'jsUnitTestManager');
xbDebugTraceFunction('window', 'getTestFileProtocol');
xbDebugTraceFunction('window', 'getDocumentProtocol');
}

View File

@@ -0,0 +1,44 @@
function jsUnitTestSuite() {
this.isjsUnitTestSuite = true;
this.testPages = Array();
this.pageIndex = 0;
}
jsUnitTestSuite.prototype.addTestPage = function (pageName)
{
this.testPages[this.testPages.length] = pageName;
}
jsUnitTestSuite.prototype.addTestSuite = function (suite)
{
for (var i = 0; i < suite.testPages.length; i++)
this.addTestPage(suite.testPages[i]);
}
jsUnitTestSuite.prototype.containsTestPages = function ()
{
return this.testPages.length > 0;
}
jsUnitTestSuite.prototype.nextPage = function ()
{
return this.testPages[this.pageIndex++];
}
jsUnitTestSuite.prototype.hasMorePages = function ()
{
return this.pageIndex < this.testPages.length;
}
jsUnitTestSuite.prototype.clone = function ()
{
var clone = new jsUnitTestSuite();
clone.testPages = this.testPages;
return clone;
}
if (xbDEBUG.on)
{
xbDebugTraceObject('window', 'jsUnitTestSuite');
}

View File

@@ -0,0 +1,102 @@
var TRACE_LEVEL_NONE = new JsUnitTraceLevel(0, null);
var TRACE_LEVEL_WARNING = new JsUnitTraceLevel(1, "#FF0000");
var TRACE_LEVEL_INFO = new JsUnitTraceLevel(2, "#009966");
var TRACE_LEVEL_DEBUG = new JsUnitTraceLevel(3, "#0000FF");
function JsUnitTracer(testManager) {
this._testManager = testManager;
this._traceWindow = null;
this.popupWindowsBlocked = false;
}
JsUnitTracer.prototype.initialize = function() {
if (this._traceWindow != null && top.testManager.closeTraceWindowOnNewRun.checked)
this._traceWindow.close();
this._traceWindow = null;
}
JsUnitTracer.prototype.finalize = function() {
if (this._traceWindow != null) {
this._traceWindow.document.write('<\/body>\n<\/html>');
this._traceWindow.document.close();
}
}
JsUnitTracer.prototype.warn = function() {
this._trace(arguments[0], arguments[1], TRACE_LEVEL_WARNING);
}
JsUnitTracer.prototype.inform = function() {
this._trace(arguments[0], arguments[1], TRACE_LEVEL_INFO);
}
JsUnitTracer.prototype.debug = function() {
this._trace(arguments[0], arguments[1], TRACE_LEVEL_DEBUG);
}
JsUnitTracer.prototype._trace = function(message, value, traceLevel) {
if (!top.shouldSubmitResults() && this._getChosenTraceLevel().matches(traceLevel)) {
var traceString = message;
if (value)
traceString += ': ' + value;
var prefix = this._testManager.getTestFileName() + ":" +
this._testManager.getTestFunctionName() + " - ";
this._writeToTraceWindow(prefix, traceString, traceLevel);
}
}
JsUnitTracer.prototype._getChosenTraceLevel = function() {
var levelNumber = eval(top.testManager.traceLevel.value);
return traceLevelByLevelNumber(levelNumber);
}
JsUnitTracer.prototype._writeToTraceWindow = function(prefix, traceString, traceLevel) {
var htmlToAppend = '<p class="jsUnitDefault">' + prefix + '<font color="' + traceLevel.getColor() + '">' + traceString + '</font><\/p>\n';
this._getTraceWindow().document.write(htmlToAppend);
}
JsUnitTracer.prototype._getTraceWindow = function() {
if (this._traceWindow == null && !top.shouldSubmitResults() && !this.popupWindowsBlocked) {
this._traceWindow = window.open('', '', 'width=600, height=350,status=no,resizable=yes,scrollbars=yes');
if (!this._traceWindow)
this.popupWindowsBlocked = true;
else {
var resDoc = this._traceWindow.document;
resDoc.write('<html>\n<head>\n<link rel="stylesheet" href="css/jsUnitStyle.css">\n<title>Tracing - JsUnit<\/title>\n<head>\n<body>');
resDoc.write('<h2>Tracing - JsUnit<\/h2>\n');
resDoc.write('<p class="jsUnitDefault"><i>(Traces are color coded: ');
resDoc.write('<font color="' + TRACE_LEVEL_WARNING.getColor() + '">Warning</font> - ');
resDoc.write('<font color="' + TRACE_LEVEL_INFO.getColor() + '">Information</font> - ');
resDoc.write('<font color="' + TRACE_LEVEL_DEBUG.getColor() + '">Debug</font>');
resDoc.write(')</i></p>');
}
}
return this._traceWindow;
}
if (xbDEBUG.on) {
xbDebugTraceObject('window', 'JsUnitTracer');
}
function JsUnitTraceLevel(levelNumber, color) {
this._levelNumber = levelNumber;
this._color = color;
}
JsUnitTraceLevel.prototype.matches = function(anotherTraceLevel) {
return this._levelNumber >= anotherTraceLevel._levelNumber;
}
JsUnitTraceLevel.prototype.getColor = function() {
return this._color;
}
function traceLevelByLevelNumber(levelNumber) {
switch (levelNumber) {
case 0: return TRACE_LEVEL_NONE;
case 1: return TRACE_LEVEL_WARNING;
case 2: return TRACE_LEVEL_INFO;
case 3: return TRACE_LEVEL_DEBUG;
}
return null;
}

View File

@@ -0,0 +1,59 @@
var versionRequest;
function isOutOfDate(newVersionNumber) {
return JSUNIT_VERSION < newVersionNumber;
}
function sendRequestForLatestVersion(url) {
versionRequest = createXmlHttpRequest();
if (versionRequest) {
versionRequest.onreadystatechange = requestStateChanged;
versionRequest.open("GET", url, true);
versionRequest.send(null);
}
}
function createXmlHttpRequest() {
if (window.XMLHttpRequest)
return new XMLHttpRequest();
else if (window.ActiveXObject)
return new ActiveXObject("Microsoft.XMLHTTP");
}
function requestStateChanged() {
if (versionRequest && versionRequest.readyState == 4) {
if (versionRequest.status == 200) {
var latestVersion = versionRequest.responseText;
if (isOutOfDate(latestVersion))
versionNotLatest(latestVersion);
else
versionLatest();
} else
versionCheckError();
}
}
function checkForLatestVersion(url) {
setLatestVersionDivHTML("Checking for newer version...");
try {
sendRequestForLatestVersion(url);
} catch (e) {
setLatestVersionDivHTML("An error occurred while checking for a newer version: " + e.message);
}
}
function versionNotLatest(latestVersion) {
setLatestVersionDivHTML('<font color="red">A newer version of JsUnit, version ' + latestVersion + ', is available.</font>');
}
function versionLatest() {
setLatestVersionDivHTML("You are running the latest version of JsUnit.");
}
function setLatestVersionDivHTML(string) {
document.getElementById("versionCheckDiv").innerHTML = string;
}
function versionCheckError() {
setLatestVersionDivHTML("An error occurred while checking for a newer version.");
}

View File

@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
</head>
<body>
<div id="content"><b>Errors:</b> 0</div>
</body>
</html>

View File

@@ -0,0 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
</head>
<body>
<div id="content"><b>Failures:</b> 0</div>
</body>
</html>

View File

@@ -0,0 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
</head>
<body>
<div id="content"><b>Runs:</b> 0</div>
</body>
</html>

View File

@@ -0,0 +1,21 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<frameset cols="200,190,*" border="0">
<frame name="mainCountsRuns" src="main-counts-runs.html" scrolling="no" frameborder="0">
<frame name="mainCountsErrors" src="main-counts-errors.html" scrolling="no" frameborder="0">
<frame name="mainCountsFailures" src="main-counts-failures.html" scrolling="no" frameborder="0">
<noframes>
<body>
<p>jsUnit uses frames in order to remove dependencies upon a browser's implementation of document.getElementById
and HTMLElement.innerHTML.</p>
</body>
</noframes>
</frameset>
</html>

View File

@@ -0,0 +1,189 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JsUnit main-data.html</title>
<link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
<script language="JavaScript" type="text/javascript" src="jsUnitCore.js"></script>
<script language="JavaScript" type="text/javascript" src="jsUnitVersionCheck.js"></script>
<script language="JavaScript" type="text/javascript">
function pageLoaded() {
giveFocusToTestFileNameField();
}
function giveFocusToTestFileNameField() {
if (document.testRunnerForm.testFileName.type != "hidden")
document.testRunnerForm.testFileName.focus();
}
function kickOffTests() {
//
// Check if Init was called by onload handler
//
if (typeof(top.testManager) == 'undefined') {
top.init();
}
if (isBlank(top.testManager.getTestFileName())) {
top.testManager.fatalError('No Test Page specified.');
return;
}
top.testManager.setup();
top.testManager._currentSuite().addTestPage(top.testManager.resolveUserEnteredTestFileName());
top.tracer.initialize();
var traceLevel = document.forms.testRunnerForm.traceLevel;
if (traceLevel.value != '0')
{
var traceWindow = top.tracer._getTraceWindow();
if (traceWindow) {
traceWindow.focus();
}
else {
top.testManager.fatalError('Tracing requires popup windows, and popups are blocked in your browser.\n\nPlease enable popups if you wish to use tracing.');
}
}
top.testManager.start();
}
</script>
</head>
<body onload="pageLoaded();">
<table width="100%" cellpadding="0" cellspacing="0" border="0" summary="jsUnit Information" bgcolor="#DDDDDD">
<tr>
<td width="1"><a href="http://www.jsunit.net" target="_blank"><img src="../images/logo_jsunit.gif" alt="JsUnit" border="0"/></a></td>
<td width="50">&nbsp;</td>
<th nowrap align="left">
<h4>JsUnit <script language="javascript">document.write(JSUNIT_VERSION);</script> TestRunner</h4>
<font size="-2"><i>Running on <script language="javascript" type="text/javascript">document.write(navigator.userAgent);</script>
</i></font>
</th>
<td nowrap align="right" valign="middle">
<font size="-2">
<b><a href="http://www.jsunit.net/" target="_blank">www.jsunit.net</a></b>&nbsp;&nbsp;<br>
</font>
<a href="http://www.pivotalsf.com/" target="top">
<img border="0" src="../images/powerby-transparent.gif" alt="Powered By Pivotal">
</a>
</td>
</tr>
</table>
<form name="testRunnerForm" action="">
<script type="text/javascript" language="javascript">
if (!jsUnitGetParm('testpage')) {
document.write("<p>Enter the filename of the Test Page to be run:</p>");
} else {
document.write("<br>");
};
</script>
<table cellpadding="0" cellspacing="0" border="0" summary="Form for entering test case location">
<tr>
<td align="center" valign="middle">
<script language="JavaScript" type="text/javascript">
document.write(top.getDocumentProtocol());
</script>
</td>
<td nowrap align="center" valign="bottom">
&nbsp;
<script language="JavaScript" type="text/javascript">
var specifiedTestPage = jsUnitGetParm('testpage');
if (specifiedTestPage) {
var html = '<input type="hidden" name="testFileName" value="';
var valueString = '';
if ((top.getDocumentProtocol() == 'http://' || top.getDocumentProtocol() == 'https://') && jsUnitGetParm('testpage').indexOf('/') == 0)
valueString += top.location.host;
valueString += specifiedTestPage;
var testParms = top.jsUnitConstructTestParms();
if (testParms != '') {
valueString += '?';
valueString += testParms;
}
html += valueString;
html += '">';
html += valueString;
document.write(html);
} else {
if (top.getDocumentProtocol() == 'file:///' && top.browserSupportsReadingFullPathFromFileField())
document.write('<input type="file" name="testFileName" size="60">');
else
document.write('<input type="text" name="testFileName" size="60">');
}
</script>
<input type="button" name="runButton" value="Run" onclick="kickOffTests()">
<script type="text/javascript">
function jscoverageWindow() {
/*
the path may have to be adjusted: it should point to the
jscoverage.html file (relative to the jsunit/app
directory)
*/
window.open("../../jscoverage.html");
}
</script>
<button onclick="jscoverageWindow();">Coverage report</button>
</td>
</tr>
</table>
<br>
<hr>
<table cellpadding="0" cellspacing="0" border="0" summary="Choose Trace Level">
<tr>
<td nowrap>Trace level:</td>
<td><select name="traceLevel">
<option value="0" selected>
no tracing
</option>
<option value="1">
warning (lowest)
</option>
<option value="2">
info
</option>
<option value="3">
debug (highest)
</option>
</select></td>
<td>&nbsp;&nbsp;&nbsp;</td>
<td><input type="checkbox" name="closeTraceWindowOnNewRun" checked></td>
<td nowrap>Close old trace window on new run</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td nowrap>Page load timeout:</td>
<td>&nbsp;
<script language="javascript" type="text/javascript">
document.write('<input type="text" size="2" name="timeout" value="' + top.jsUnitTestManager.TESTPAGE_WAIT_SEC + '">');
</script>
</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td nowrap>Setup page timeout:</td>
<td>&nbsp;
<script language="javascript" type="text/javascript">
document.write('<input type="text" size="2" name="setUpPageTimeout" value="' + top.jsUnitTestManager.SETUPPAGE_TIMEOUT + '">');
</script>
</td>
</tr>
</table>
<hr>
</form>
</body>
</html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JsUnit main-errors.html</title>
<link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
</head>
<body>
<hr>
<form name="testRunnerForm" action="javascript:top.testManager.showMessageForSelectedProblemTest()">
<p>Errors and failures:&nbsp;</p>
<select size="5" ondblclick="top.testManager.showMessageForSelectedProblemTest()" name="problemsList">
<option>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
</select>
<br>
<input type="button" value="Show selected" onclick="top.testManager.showMessageForSelectedProblemTest()">
&nbsp;&nbsp;&nbsp;
<input type="button" value="Show all" onclick="top.testManager.showMessagesForAllProblemTests()">
</form>
</body>
</html>

View File

@@ -0,0 +1,19 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>jsUnit Main Frame</title>
</head>
<frameset rows="230,30,30,30,0,*" border="0">>
<frame name="mainData" src="main-data.html" scrolling="no" frameborder="0">
<frame name="mainStatus" src="main-status.html" scrolling="no" frameborder="0">
<frame name="mainProgress" src="main-progress.html" scrolling="no" frameborder="0">
<frame name="mainCounts" src="main-counts.html" scrolling="no" frameborder="0">
<frame name="mainResults" src="main-results.html" scrolling="no" frameborder="0">
<frame name="mainErrors" src="main-errors.html" scrolling="no" frameborder="0">
<noframes>
<body>
<p>Sorry, JsUnit requires frames.</p>
</body>
</noframes>
</frameset>
</html>

View File

@@ -0,0 +1,45 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jsUnit External Data Document loader</title>
<script language="JavaScript" type="text/javascript">
var loadStatus;
var callback = function () {
};
function buffer() {
return window.frames.documentBuffer;
}
function load(uri) {
loadStatus = 'loading';
buffer().document.location.href = uri;
}
function loadComplete() {
top.xbDEBUG.dump('main-loader.html:loadComplete(): loadStatus = ' + loadStatus + ' href=' + buffer().document.location.href);
if (loadStatus == 'loading') {
loadStatus = 'complete';
callback();
callback = function () {
};
}
}
if (top.xbDEBUG.on) {
var scopeName = 'main_loader_' + (new Date()).getTime();
top[scopeName] = window;
top.xbDebugTraceFunction(scopeName, 'buffer');
top.xbDebugTraceFunction(scopeName, 'load');
top.xbDebugTraceFunction(scopeName, 'loadComplete');
}
</script>
</head>
<body>
<iframe name="documentBuffer" onload="loadComplete()"></iframe>
</body>
</html>

View File

@@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JsUnit main-progress.html</title>
<link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
</head>
<body>
<table width="375" cellpadding="0" cellspacing="0" border="0" summary="Test progress indicator">
<tr>
<td width="65" valign="top"><b>Progress:</b></td>
<td width="300" height="14" valign="middle">
<table width="300" cellpadding="0" cellspacing="0" border="1" summary="Progress image">
<tr>
<td width="300" height="14" valign="top"><img name="progress" height="14" width="0"
alt="progress image" src="../images/green.gif"></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,67 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JsUnit main-results.html</title>
<link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
</head>
<body>
<script language="javascript" type="text/javascript">
var DEFAULT_SUBMIT_WEBSERVER = "localhost:8080";
function submitUrlFromSpecifiedUrl() {
var result = "";
var specifiedUrl = top.getSpecifiedResultUrl();
if (specifiedUrl.indexOf("http://") != 0)
result = "http://";
result += specifiedUrl;
return result;
}
function submitUrlFromTestRunnerLocation() {
var result = "http://";
var webserver = top.getWebserver();
if (webserver == null) // running over file:///
webserver = DEFAULT_SUBMIT_WEBSERVER;
result += webserver;
result += "/jsunit/acceptor";
return result;
}
var submitUrl = "";
if (top.wasResultUrlSpecified()) {
submitUrl = submitUrlFromSpecifiedUrl();
} else {
submitUrl = submitUrlFromTestRunnerLocation();
}
var formString = "<form name=\"resultsForm\" action=\"" + submitUrl + "\" method=\"post\" target=\"_top\">";
document.write(formString);
</script>
<input type="hidden" name="id">
<input type="hidden" name="userAgent">
<input type="hidden" name="jsUnitVersion">
<input type="hidden" name="time">
<input type="hidden" name="url">
<input type="hidden" name="cacheBuster">
<select size="5" name="testCases" multiple></select>
</form>
<script language="javascript" type="text/javascript">
function populateHeaderFields(id, userAgent, jsUnitVersion, baseURL) {
document.resultsForm.id.value = id;
document.resultsForm.userAgent.value = userAgent;
document.resultsForm.jsUnitVersion.value = jsUnitVersion;
document.resultsForm.url.value = baseURL;
document.resultsForm.cacheBuster.value = new Date().getTime();
}
function submitResults() {
var testCasesField = document.resultsForm.testCases;
for (var i = 0; i < testCasesField.length; i++) {
testCasesField[i].selected = true;
}
document.resultsForm.submit();
}
</script>
</body>
</html>

View File

@@ -0,0 +1,13 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JsUnit main-status.html</title>
<link rel="stylesheet" type="text/css" href="../css/jsUnitStyle.css">
</head>
<body>
<div id="content"><b>Status:</b> (Idle)</div>
</body>
</html>

View File

@@ -0,0 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JsUnit Test Container</title>
</head>
<frameset rows="0, *" border="0">
<frame name="testContainerController" src="testContainerController.html">
<frame name="testFrame" src="emptyPage.html">
<noframes>
<body>
<p>Sorry, JsUnit requires frames.</p>
</body>
</noframes>
</frameset>
</html>

View File

@@ -0,0 +1,77 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JsUnit Test Container Controller</title>
<script language="javascript" type="text/javascript">
var containerReady = false;
function init() {
containerReady = true;
}
function isPageLoaded() {
if (!containerReady)
return false;
var isTestPageLoaded = false;
try {
// attempt to access the var isTestPageLoaded in the testFrame
if (typeof(top.testManager.containerTestFrame.isTestPageLoaded) != 'undefined') {
isTestPageLoaded = top.testManager.containerTestFrame.isTestPageLoaded;
}
// ok, if the above did not throw an exception, then the
// variable is defined. If the onload has not fired in the
// testFrame then isTestPageLoaded is still false. Otherwise
// the testFrame has set it to true
}
catch (e) {
// an error occured while attempting to access the isTestPageLoaded
// in the testFrame, therefore the testFrame has not loaded yet
isTestPageLoaded = false;
}
return isTestPageLoaded;
}
function isContainerReady() {
return containerReady;
}
function setNotReady() {
try {
// attempt to set the isTestPageLoaded variable
// in the test frame to false.
top.testManager.containerTestFrame.isTestPageLoaded = false;
}
catch (e) {
// testFrame.isTestPageLoaded not available... ignore
}
}
function setTestPage(testPageURI) {
setNotReady();
top.jsUnitParseParms(testPageURI);
testPageURI = appendCacheBusterParameterTo(testPageURI);
try {
top.testManager.containerTestFrame.location.href = testPageURI;
} catch (e) {
}
}
function appendCacheBusterParameterTo(testPageURI) {
if (testPageURI.indexOf("?") == -1)
testPageURI += "?";
else
testPageURI += "&";
testPageURI += "cacheBuster=";
testPageURI += new Date().getTime();
return testPageURI;
}
</script>
</head>
<body onload="init()">
Test Container Controller
</body>
</html>

View File

@@ -0,0 +1,306 @@
// xbDebug.js revision: 0.003 2002-02-26
/* ***** BEGIN LICENSE BLOCK *****
* Licensed under Version: MPL 1.1/GPL 2.0/LGPL 2.1
* Full Terms at /xbProjects-srce/license/mpl-tri-license.txt
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Netscape code.
*
* The Initial Developer of the Original Code is
* Netscape Corporation.
* Portions created by the Initial Developer are Copyright (C) 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Bob Clary <bclary@netscape.com>
*
* ***** END LICENSE BLOCK ***** */
/*
ChangeLog:
2002-02-25: bclary - modified xbDebugTraceOject to make sure
that original versions of wrapped functions were not
rewrapped. This had caused an infinite loop in IE.
2002-02-07: bclary - modified xbDebug.prototype.close to not null
the debug window reference. This can cause problems with
Internet Explorer if the page is refreshed. These issues will
be addressed at a later date.
*/
function xbDebug()
{
this.on = false;
this.stack = new Array();
this.debugwindow = null;
this.execprofile = new Object();
}
xbDebug.prototype.push = function ()
{
this.stack[this.stack.length] = this.on;
this.on = true;
}
xbDebug.prototype.pop = function ()
{
this.on = this.stack[this.stack.length - 1];
--this.stack.length;
}
xbDebug.prototype.open = function ()
{
if (this.debugwindow && !this.debugwindow.closed)
this.close();
this.debugwindow = window.open('about:blank', 'DEBUGWINDOW', 'height=400,width=600,resizable=yes,scrollbars=yes');
this.debugwindow.title = 'xbDebug Window';
this.debugwindow.document.write('<html><head><title>xbDebug Window</title></head><body><h3>Javascript Debug Window</h3></body></html>');
this.debugwindow.focus();
}
xbDebug.prototype.close = function ()
{
if (!this.debugwindow)
return;
if (!this.debugwindow.closed)
this.debugwindow.close();
// bc 2002-02-07, other windows may still hold a reference to this: this.debugwindow = null;
}
xbDebug.prototype.dump = function (msg)
{
if (!this.on)
return;
if (!this.debugwindow || this.debugwindow.closed)
this.open();
this.debugwindow.document.write(msg + '<br>');
return;
}
var xbDEBUG = new xbDebug();
window.onunload = function () {
xbDEBUG.close();
}
function xbDebugGetFunctionName(funcref)
{
if (!funcref)
{
return '';
}
if (funcref.name)
return funcref.name;
var name = funcref + '';
name = name.substring(name.indexOf(' ') + 1, name.indexOf('('));
funcref.name = name;
if (!name) alert('name not defined');
return name;
}
// emulate functionref.apply for IE mac and IE win < 5.5
function xbDebugApplyFunction(funcname, funcref, thisref, argumentsref)
{
var rv;
if (!funcref)
{
alert('xbDebugApplyFunction: funcref is null');
}
if (typeof(funcref.apply) != 'undefined')
return funcref.apply(thisref, argumentsref);
var applyexpr = 'thisref.xbDebug_orig_' + funcname + '(';
var i;
for (i = 0; i < argumentsref.length; i++)
{
applyexpr += 'argumentsref[' + i + '],';
}
if (argumentsref.length > 0)
{
applyexpr = applyexpr.substring(0, applyexpr.length - 1);
}
applyexpr += ')';
return eval(applyexpr);
}
function xbDebugCreateFunctionWrapper(scopename, funcname, precall, postcall)
{
var wrappedfunc;
var scopeobject = eval(scopename);
var funcref = scopeobject[funcname];
scopeobject['xbDebug_orig_' + funcname] = funcref;
wrappedfunc = function ()
{
var rv;
precall(scopename, funcname, arguments);
rv = xbDebugApplyFunction(funcname, funcref, scopeobject, arguments);
postcall(scopename, funcname, arguments, rv);
return rv;
};
if (typeof(funcref.constructor) != 'undefined')
wrappedfunc.constructor = funcref.constuctor;
if (typeof(funcref.prototype) != 'undefined')
wrappedfunc.prototype = funcref.prototype;
scopeobject[funcname] = wrappedfunc;
}
function xbDebugCreateMethodWrapper(contextname, classname, methodname, precall, postcall)
{
var context = eval(contextname);
var methodref = context[classname].prototype[methodname];
context[classname].prototype['xbDebug_orig_' + methodname] = methodref;
var wrappedmethod = function ()
{
var rv;
// eval 'this' at method run time to pick up reference to the object's instance
var thisref = eval('this');
// eval 'arguments' at method run time to pick up method's arguments
var argsref = arguments;
precall(contextname + '.' + classname, methodname, argsref);
rv = xbDebugApplyFunction(methodname, methodref, thisref, argsref);
postcall(contextname + '.' + classname, methodname, argsref, rv);
return rv;
};
return wrappedmethod;
}
function xbDebugPersistToString(obj)
{
var s = '';
var p;
if (obj == null)
return 'null';
switch (typeof(obj))
{
case 'number':
return obj;
case 'string':
return '"' + obj + '"';
case 'undefined':
return 'undefined';
case 'boolean':
return obj + '';
}
if (obj.constructor)
return '[' + xbDebugGetFunctionName(obj.constructor) + ']';
return null;
}
function xbDebugTraceBefore(scopename, funcname, funcarguments)
{
var i;
var s = '';
var execprofile = xbDEBUG.execprofile[scopename + '.' + funcname];
if (!execprofile)
execprofile = xbDEBUG.execprofile[scopename + '.' + funcname] = { started: 0, time: 0, count: 0 };
for (i = 0; i < funcarguments.length; i++)
{
s += xbDebugPersistToString(funcarguments[i]);
if (i < funcarguments.length - 1)
s += ', ';
}
xbDEBUG.dump('enter ' + scopename + '.' + funcname + '(' + s + ')');
execprofile.started = (new Date()).getTime();
}
function xbDebugTraceAfter(scopename, funcname, funcarguments, rv)
{
var i;
var s = '';
var execprofile = xbDEBUG.execprofile[scopename + '.' + funcname];
if (!execprofile)
xbDEBUG.dump('xbDebugTraceAfter: execprofile not created for ' + scopename + '.' + funcname);
else if (execprofile.started == 0)
xbDEBUG.dump('xbDebugTraceAfter: execprofile.started == 0 for ' + scopename + '.' + funcname);
else
{
execprofile.time += (new Date()).getTime() - execprofile.started;
execprofile.count++;
execprofile.started = 0;
}
for (i = 0; i < funcarguments.length; i++)
{
s += xbDebugPersistToString(funcarguments[i]);
if (i < funcarguments.length - 1)
s += ', ';
}
xbDEBUG.dump('exit ' + scopename + '.' + funcname + '(' + s + ')==' + xbDebugPersistToString(rv));
}
function xbDebugTraceFunction(scopename, funcname)
{
xbDebugCreateFunctionWrapper(scopename, funcname, xbDebugTraceBefore, xbDebugTraceAfter);
}
function xbDebugTraceObject(contextname, classname)
{
var classref = eval(contextname + '.' + classname);
var p;
var sp;
if (!classref || !classref.prototype)
return;
for (p in classref.prototype)
{
sp = p + '';
if (typeof(classref.prototype[sp]) == 'function' && (sp).indexOf('xbDebug_orig') == -1)
{
classref.prototype[sp] = xbDebugCreateMethodWrapper(contextname, classname, sp, xbDebugTraceBefore, xbDebugTraceAfter);
}
}
}
function xbDebugDumpProfile()
{
var p;
var execprofile;
var avg;
for (p in xbDEBUG.execprofile)
{
execprofile = xbDEBUG.execprofile[p];
avg = Math.round(100 * execprofile.time / execprofile.count) / 100;
xbDEBUG.dump('Execution profile ' + p + ' called ' + execprofile.count + ' times. Total time=' + execprofile.time + 'ms. Avg Time=' + avg + 'ms.');
}
}

View File

@@ -0,0 +1,83 @@
body {
margin-top: 0;
margin-bottom: 0;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000;
font-size: 0.8em;
background-color: #fff;
}
a:link, a:visited {
color: #00F;
}
a:hover {
color: #F00;
}
h1 {
font-size: 1.2em;
font-weight: bold;
color: #039;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
h2 {
font-weight: bold;
color: #039;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
h3 {
font-weight: bold;
color: #039;
text-decoration: underline;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
h4 {
font-weight: bold;
color: #039;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.jsUnitTestResultSuccess {
color: #000;
}
.jsUnitTestResultNotSuccess {
color: #F00;
}
.unselectedTab {
font-family: Verdana, Arial, Helvetica, sans-serif;
height: 26px;
background: #FFFFFF;
border-style: solid;
border-bottom-width: 1px;
border-top-width: 1px;
border-left-width: 1px;
border-right-width: 1px;
}
.selectedTab {
font-family: Verdana, Arial, Helvetica, sans-serif;
height: 26px;
background: #DDDDDD;
font-weight: bold;
border-style: solid;
border-bottom-width: 0px;
border-top-width: 1px;
border-left-width: 1px;
border-right-width: 1px;
}
.tabHeaderSeparator {
height: 26px;
background: #FFFFFF;
border-style: solid;
border-bottom-width: 1px;
border-top-width: 0px;
border-left-width: 0px;
border-right-width: 0px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

View File

@@ -0,0 +1,56 @@
/*--
$Id: JDOM_license.txt 81 2003-07-24 04:44:54Z edwardhieatt $
Copyright (C) 2000-2003 Jason Hunter & Brett McLaughlin.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions, and the disclaimer that follows
these conditions in the documentation and/or other materials
provided with the distribution.
3. The name "JDOM" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact <license AT jdom DOT org>.
4. Products derived from this software may not be called "JDOM", nor
may "JDOM" appear in their name, without prior written permission
from the JDOM Project Management <pm AT jdom DOT org>.
In addition, we request (but do not require) that you include in the
end-user documentation provided with the redistribution and/or in the
software itself an acknowledgement equivalent to the following:
"This product includes software developed by the
JDOM Project (http://www.jdom.org/)."
Alternatively, the acknowledgment may be graphical using the logos
available at http://www.jdom.org/images/logos.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
This software consists of voluntary contributions made by many
individuals on behalf of the JDOM Project and was originally
created by Jason Hunter <jhunter AT jdom DOT org> and
Brett McLaughlin <brett AT jdom DOT org>. For more information on
the JDOM Project, please see <http://www.jdom.org/>.
*/

View File

@@ -0,0 +1,213 @@
<HTML>
<HEAD>
<TITLE>Jetty License</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<FONT FACE=ARIAL,HELVETICA>
<CENTER><FONT SIZE=+3><B>Jetty License</B></FONT></CENTER>
<CENTER><FONT SIZE=-1><B>$Revision$</B></FONT></CENTER>
<B>Preamble:</B>
<p>
The intent of this document is to state the conditions under which the
Jetty Package may be copied, such that the Copyright Holder maintains some
semblance of control over the development of the package, while giving the
users of the package the right to use, distribute and make reasonable
modifications to the Package in accordance with the goals and ideals of
the Open Source concept as described at
<A HREF="http://www.opensource.org">http://www.opensource.org</A>.
<P>
It is the intent of this license to allow commercial usage of the Jetty
package, so long as the source code is distributed or suitable visible
credit given or other arrangements made with the copyright holders.
<P><B>Definitions:</B>
<P>
<UL>
<LI> "Jetty" refers to the collection of Java classes that are
distributed as a HTTP server with servlet capabilities and
associated utilities.
<p>
<LI> "Package" refers to the collection of files distributed by the
Copyright Holder, and derivatives of that collection of files
created through textual modification.
<P>
<LI> "Standard Version" refers to such a Package if it has not been
modified, or has been modified in accordance with the wishes
of the Copyright Holder.
<P>
<LI> "Copyright Holder" is whoever is named in the copyright or
copyrights for the package. <BR>
Mort Bay Consulting Pty. Ltd. (Australia) is the "Copyright
Holder" for the Jetty package.
<P>
<LI> "You" is you, if you're thinking about copying or distributing
this Package.
<P>
<LI> "Reasonable copying fee" is whatever you can justify on the
basis of media cost, duplication charges, time of people involved,
and so on. (You will not be required to justify it to the
Copyright Holder, but only to the computing community at large
as a market that must bear the fee.)
<P>
<LI> "Freely Available" means that no fee is charged for the item
itself, though there may be fees involved in handling the item.
It also means that recipients of the item may redistribute it
under the same conditions they received it.
<P>
</UL>
0. The Jetty Package is Copyright (c) Mort Bay Consulting Pty. Ltd.
(Australia) and others. Individual files in this package may contain
additional copyright notices. The javax.servlet packages are copyright
Sun Microsystems Inc. <P>
1. The Standard Version of the Jetty package is
available from <A HREF=http://jetty.mortbay.org>http://jetty.mortbay.org</A>.
<P>
2. You may make and distribute verbatim copies of the source form
of the Standard Version of this Package without restriction, provided that
you include this license and all of the original copyright notices
and associated disclaimers.
<P>
3. You may make and distribute verbatim copies of the compiled form of the
Standard Version of this Package without restriction, provided that you
include this license.
<P>
4. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder. A Package
modified in such a way shall still be considered the Standard Version.
<P>
5. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and
when you changed that file, and provided that you do at least ONE of the
following:
<P>
<BLOCKQUOTE>
a) Place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or
an equivalent medium, or placing the modifications on a major archive
site such as ftp.uu.net, or by allowing the Copyright Holder to include
your modifications in the Standard Version of the Package.<P>
b) Use the modified Package only within your corporation or organization.
<P>
c) Rename any non-standard classes so the names do not conflict
with standard classes, which must also be provided, and provide
a separate manual page for each non-standard class that clearly
documents how it differs from the Standard Version.
<P>
d) Make other arrangements with the Copyright Holder.
<P>
</BLOCKQUOTE>
6. You may distribute modifications or subsets of this Package in source
code or compiled form, provided that you do at least ONE of the following:<P>
<BLOCKQUOTE>
a) Distribute this license and all original copyright messages, together
with instructions (in the about dialog, manual page or equivalent) on where
to get the complete Standard Version.<P>
b) Accompany the distribution with the machine-readable source of
the Package with your modifications. The modified package must include
this license and all of the original copyright notices and associated
disclaimers, together with instructions on where to get the complete
Standard Version.
<P>
c) Make other arrangements with the Copyright Holder.
<P>
</BLOCKQUOTE>
7. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package.
You may not charge a fee for this Package itself. However,
you may distribute this Package in aggregate with other (possibly
commercial) programs as part of a larger (possibly commercial) software
distribution provided that you meet the other distribution requirements
of this license.<P>
8. Input to or the output produced from the programs of this Package
do not automatically fall under the copyright of this Package, but
belong to whomever generated them, and may be sold commercially, and
may be aggregated with this Package.
<P>
9. Any program subroutines supplied by you and linked into this Package
shall not be considered part of this Package.
<P>
10. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written
permission.
<P>
11. This license may change with each release of a Standard Version of
the Package. You may choose to use the license associated with version
you are using or the license of the latest Standard Version.
<P>
12. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
<P>
13. If any superior law implies a warranty, the sole remedy under such shall
be , at the Copyright Holders option either a) return of any price paid or
b) use or reasonable endeavours to repair or replace the software.
<P>
14. This license shall be read under the laws of Australia.
<P>
<center>The End</center>
<center><FONT size=-1>This license was derived from the <I>Artistic</I> license published
on <a href=http://www.opensource.org>http://www.opensource.com</a></font></center>
</FONT>

View File

@@ -0,0 +1,470 @@
MOZILLA PUBLIC LICENSE
Version 1.1
---------------
1. Definitions.
1.0.1. "Commercial Use" means distribution or otherwise making the
Covered Code available to a third party.
1.1. "Contributor" means each entity that creates or contributes to
the creation of Modifications.
1.2. "Contributor Version" means the combination of the Original
Code, prior Modifications used by a Contributor, and the Modifications
made by that particular Contributor.
1.3. "Covered Code" means the Original Code or Modifications or the
combination of the Original Code and Modifications, in each case
including portions thereof.
1.4. "Electronic Distribution Mechanism" means a mechanism generally
accepted in the software development community for the electronic
transfer of data.
1.5. "Executable" means Covered Code in any form other than Source
Code.
1.6. "Initial Developer" means the individual or entity identified
as the Initial Developer in the Source Code notice required by Exhibit
A.
1.7. "Larger Work" means a work which combines Covered Code or
portions thereof with code not governed by the terms of this License.
1.8. "License" means this document.
1.8.1. "Licensable" means having the right to grant, to the maximum
extent possible, whether at the time of the initial grant or
subsequently acquired, any and all of the rights conveyed herein.
1.9. "Modifications" means any addition to or deletion from the
substance or structure of either the Original Code or any previous
Modifications. When Covered Code is released as a series of files, a
Modification is:
A. Any addition to or deletion from the contents of a file
containing Original Code or previous Modifications.
B. Any new file that contains any part of the Original Code or
previous Modifications.
1.10. "Original Code" means Source Code of computer software code
which is described in the Source Code notice required by Exhibit A as
Original Code, and which, at the time of its release under this
License is not already Covered Code governed by this License.
1.10.1. "Patent Claims" means any patent claim(s), now owned or
hereafter acquired, including without limitation, method, process,
and apparatus claims, in any patent Licensable by grantor.
1.11. "Source Code" means the preferred form of the Covered Code for
making modifications to it, including all modules it contains, plus
any associated interface definition files, scripts used to control
compilation and installation of an Executable, or source code
differential comparisons against either the Original Code or another
well known, available Covered Code of the Contributor's choice. The
Source Code can be in a compressed or archival form, provided the
appropriate decompression or de-archiving software is widely available
for no charge.
1.12. "You" (or "Your") means an individual or a legal entity
exercising rights under, and complying with all of the terms of, this
License or a future version of this License issued under Section 6.1.
For legal entities, "You" includes any entity which controls, is
controlled by, or is under common control with You. For purposes of
this definition, "control" means (a) the power, direct or indirect,
to cause the direction or management of such entity, whether by
contract or otherwise, or (b) ownership of more than fifty percent
(50%) of the outstanding shares or beneficial ownership of such
entity.
2. Source Code License.
2.1. The Initial Developer Grant.
The Initial Developer hereby grants You a world-wide, royalty-free,
non-exclusive license, subject to third party intellectual property
claims:
(a) under intellectual property rights (other than patent or
trademark) Licensable by Initial Developer to use, reproduce,
modify, display, perform, sublicense and distribute the Original
Code (or portions thereof) with or without Modifications, and/or
as part of a Larger Work; and
(b) under Patents Claims infringed by the making, using or
selling of Original Code, to make, have made, use, practice,
sell, and offer for sale, and/or otherwise dispose of the
Original Code (or portions thereof).
(c) the licenses granted in this Section 2.1(a) and (b) are
effective on the date Initial Developer first distributes
Original Code under the terms of this License.
(d) Notwithstanding Section 2.1(b) above, no patent license is
granted: 1) for code that You delete from the Original Code; 2)
separate from the Original Code; or 3) for infringements caused
by: i) the modification of the Original Code or ii) the
combination of the Original Code with other software or devices.
2.2. Contributor Grant.
Subject to third party intellectual property claims, each Contributor
hereby grants You a world-wide, royalty-free, non-exclusive license
(a) under intellectual property rights (other than patent or
trademark) Licensable by Contributor, to use, reproduce, modify,
display, perform, sublicense and distribute the Modifications
created by such Contributor (or portions thereof) either on an
unmodified basis, with other Modifications, as Covered Code
and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using, or
selling of Modifications made by that Contributor either alone
and/or in combination with its Contributor Version (or portions
of such combination), to make, use, sell, offer for sale, have
made, and/or otherwise dispose of: 1) Modifications made by that
Contributor (or portions thereof); and 2) the combination of
Modifications made by that Contributor with its Contributor
Version (or portions of such combination).
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
effective on the date Contributor first makes Commercial Use of
the Covered Code.
(d) Notwithstanding Section 2.2(b) above, no patent license is
granted: 1) for any code that Contributor has deleted from the
Contributor Version; 2) separate from the Contributor Version;
3) for infringements caused by: i) third party modifications of
Contributor Version or ii) the combination of Modifications made
by that Contributor with other software (except as part of the
Contributor Version) or other devices; or 4) under Patent Claims
infringed by Covered Code in the absence of Modifications made by
that Contributor.
3. Distribution Obligations.
3.1. Application of License.
The Modifications which You create or to which You contribute are
governed by the terms of this License, including without limitation
Section 2.2. The Source Code version of Covered Code may be
distributed only under the terms of this License or a future version
of this License released under Section 6.1, and You must include a
copy of this License with every copy of the Source Code You
distribute. You may not offer or impose any terms on any Source Code
version that alters or restricts the applicable version of this
License or the recipients' rights hereunder. However, You may include
an additional document offering the additional rights described in
Section 3.5.
3.2. Availability of Source Code.
Any Modification which You create or to which You contribute must be
made available in Source Code form under the terms of this License
either on the same media as an Executable version or via an accepted
Electronic Distribution Mechanism to anyone to whom you made an
Executable version available; and if made available via Electronic
Distribution Mechanism, must remain available for at least twelve (12)
months after the date it initially became available, or at least six
(6) months after a subsequent version of that particular Modification
has been made available to such recipients. You are responsible for
ensuring that the Source Code version remains available even if the
Electronic Distribution Mechanism is maintained by a third party.
3.3. Description of Modifications.
You must cause all Covered Code to which You contribute to contain a
file documenting the changes You made to create that Covered Code and
the date of any change. You must include a prominent statement that
the Modification is derived, directly or indirectly, from Original
Code provided by the Initial Developer and including the name of the
Initial Developer in (a) the Source Code, and (b) in any notice in an
Executable version or related documentation in which You describe the
origin or ownership of the Covered Code.
3.4. Intellectual Property Matters
(a) Third Party Claims.
If Contributor has knowledge that a license under a third party's
intellectual property rights is required to exercise the rights
granted by such Contributor under Sections 2.1 or 2.2,
Contributor must include a text file with the Source Code
distribution titled "LEGAL" which describes the claim and the
party making the claim in sufficient detail that a recipient will
know whom to contact. If Contributor obtains such knowledge after
the Modification is made available as described in Section 3.2,
Contributor shall promptly modify the LEGAL file in all copies
Contributor makes available thereafter and shall take other steps
(such as notifying appropriate mailing lists or newsgroups)
reasonably calculated to inform those who received the Covered
Code that new knowledge has been obtained.
(b) Contributor APIs.
If Contributor's Modifications include an application programming
interface and Contributor has knowledge of patent licenses which
are reasonably necessary to implement that API, Contributor must
also include this information in the LEGAL file.
(c) Representations.
Contributor represents that, except as disclosed pursuant to
Section 3.4(a) above, Contributor believes that Contributor's
Modifications are Contributor's original creation(s) and/or
Contributor has sufficient rights to grant the rights conveyed by
this License.
3.5. Required Notices.
You must duplicate the notice in Exhibit A in each file of the Source
Code. If it is not possible to put such notice in a particular Source
Code file due to its structure, then You must include such notice in a
location (such as a relevant directory) where a user would be likely
to look for such a notice. If You created one or more Modification(s)
You may add your name as a Contributor to the notice described in
Exhibit A. You must also duplicate this License in any documentation
for the Source Code where You describe recipients' rights or ownership
rights relating to Covered Code. You may choose to offer, and to
charge a fee for, warranty, support, indemnity or liability
obligations to one or more recipients of Covered Code. However, You
may do so only on Your own behalf, and not on behalf of the Initial
Developer or any Contributor. You must make it absolutely clear than
any such warranty, support, indemnity or liability obligation is
offered by You alone, and You hereby agree to indemnify the Initial
Developer and every Contributor for any liability incurred by the
Initial Developer or such Contributor as a result of warranty,
support, indemnity or liability terms You offer.
3.6. Distribution of Executable Versions.
You may distribute Covered Code in Executable form only if the
requirements of Section 3.1-3.5 have been met for that Covered Code,
and if You include a notice stating that the Source Code version of
the Covered Code is available under the terms of this License,
including a description of how and where You have fulfilled the
obligations of Section 3.2. The notice must be conspicuously included
in any notice in an Executable version, related documentation or
collateral in which You describe recipients' rights relating to the
Covered Code. You may distribute the Executable version of Covered
Code or ownership rights under a license of Your choice, which may
contain terms different from this License, provided that You are in
compliance with the terms of this License and that the license for the
Executable version does not attempt to limit or alter the recipient's
rights in the Source Code version from the rights set forth in this
License. If You distribute the Executable version under a different
license You must make it absolutely clear that any terms which differ
from this License are offered by You alone, not by the Initial
Developer or any Contributor. You hereby agree to indemnify the
Initial Developer and every Contributor for any liability incurred by
the Initial Developer or such Contributor as a result of any such
terms You offer.
3.7. Larger Works.
You may create a Larger Work by combining Covered Code with other code
not governed by the terms of this License and distribute the Larger
Work as a single product. In such a case, You must make sure the
requirements of this License are fulfilled for the Covered Code.
4. Inability to Comply Due to Statute or Regulation.
If it is impossible for You to comply with any of the terms of this
License with respect to some or all of the Covered Code due to
statute, judicial order, or regulation then You must: (a) comply with
the terms of this License to the maximum extent possible; and (b)
describe the limitations and the code they affect. Such description
must be included in the LEGAL file described in Section 3.4 and must
be included with all distributions of the Source Code. Except to the
extent prohibited by statute or regulation, such description must be
sufficiently detailed for a recipient of ordinary skill to be able to
understand it.
5. Application of this License.
This License applies to code to which the Initial Developer has
attached the notice in Exhibit A and to related Covered Code.
6. Versions of the License.
6.1. New Versions.
Netscape Communications Corporation ("Netscape") may publish revised
and/or new versions of the License from time to time. Each version
will be given a distinguishing version number.
6.2. Effect of New Versions.
Once Covered Code has been published under a particular version of the
License, You may always continue to use it under the terms of that
version. You may also choose to use such Covered Code under the terms
of any subsequent version of the License published by Netscape. No one
other than Netscape has the right to modify the terms applicable to
Covered Code created under this License.
6.3. Derivative Works.
If You create or use a modified version of this License (which you may
only do in order to apply it to code which is not already Covered Code
governed by this License), You must (a) rename Your license so that
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
"MPL", "NPL" or any confusingly similar phrase do not appear in your
license (except to note that your license differs from this License)
and (b) otherwise make it clear that Your version of the license
contains terms which differ from the Mozilla Public License and
Netscape Public License. (Filling in the name of the Initial
Developer, Original Code or Contributor in the notice described in
Exhibit A shall not of themselves be deemed to be modifications of
this License.)
7. DISCLAIMER OF WARRANTY.
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
8. TERMINATION.
8.1. This License and the rights granted hereunder will terminate
automatically if You fail to comply with terms herein and fail to cure
such breach within 30 days of becoming aware of the breach. All
sublicenses to the Covered Code which are properly granted shall
survive any termination of this License. Provisions which, by their
nature, must remain in effect beyond the termination of this License
shall survive.
8.2. If You initiate litigation by asserting a patent infringement
claim (excluding declatory judgment actions) against Initial Developer
or a Contributor (the Initial Developer or Contributor against whom
You file such action is referred to as "Participant") alleging that:
(a) such Participant's Contributor Version directly or indirectly
infringes any patent, then any and all rights granted by such
Participant to You under Sections 2.1 and/or 2.2 of this License
shall, upon 60 days notice from Participant terminate prospectively,
unless if within 60 days after receipt of notice You either: (i)
agree in writing to pay Participant a mutually agreeable reasonable
royalty for Your past and future use of Modifications made by such
Participant, or (ii) withdraw Your litigation claim with respect to
the Contributor Version against such Participant. If within 60 days
of notice, a reasonable royalty and payment arrangement are not
mutually agreed upon in writing by the parties or the litigation claim
is not withdrawn, the rights granted by Participant to You under
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
the 60 day notice period specified above.
(b) any software, hardware, or device, other than such Participant's
Contributor Version, directly or indirectly infringes any patent, then
any rights granted to You by such Participant under Sections 2.1(b)
and 2.2(b) are revoked effective as of the date You first made, used,
sold, distributed, or had made, Modifications made by that
Participant.
8.3. If You assert a patent infringement claim against Participant
alleging that such Participant's Contributor Version directly or
indirectly infringes any patent where such claim is resolved (such as
by license or settlement) prior to the initiation of patent
infringement litigation, then the reasonable value of the licenses
granted by such Participant under Sections 2.1 or 2.2 shall be taken
into account in determining the amount or value of any payment or
license.
8.4. In the event of termination under Sections 8.1 or 8.2 above,
all end user license agreements (excluding distributors and resellers)
which have been validly granted by You or any distributor hereunder
prior to termination shall survive termination.
9. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
10. U.S. GOVERNMENT END USERS.
The Covered Code is a "commercial item," as that term is defined in
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
software" and "commercial computer software documentation," as such
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
all U.S. Government End Users acquire Covered Code with only those
rights set forth herein.
11. MISCELLANEOUS.
This License represents the complete agreement concerning subject
matter hereof. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent
necessary to make it enforceable. This License shall be governed by
California law provisions (except to the extent applicable law, if
any, provides otherwise), excluding its conflict-of-law provisions.
With respect to disputes in which at least one party is a citizen of,
or an entity chartered or registered to do business in the United
States of America, any litigation relating to this License shall be
subject to the jurisdiction of the Federal Courts of the Northern
District of California, with venue lying in Santa Clara County,
California, with the losing party responsible for costs, including
without limitation, court costs and reasonable attorneys' fees and
expenses. The application of the United Nations Convention on
Contracts for the International Sale of Goods is expressly excluded.
Any law or regulation which provides that the language of a contract
shall be construed against the drafter shall not apply to this
License.
12. RESPONSIBILITY FOR CLAIMS.
As between Initial Developer and the Contributors, each party is
responsible for claims and damages arising, directly or indirectly,
out of its utilization of rights under this License and You agree to
work with Initial Developer and Contributors to distribute such
responsibility on an equitable basis. Nothing herein is intended or
shall be deemed to constitute any admission of liability.
13. MULTIPLE-LICENSED CODE.
Initial Developer may designate portions of the Covered Code as
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
Developer permits you to utilize portions of the Covered Code under
Your choice of the NPL or the alternative licenses, if any, specified
by the Initial Developer in the file described in Exhibit A.
EXHIBIT A -Mozilla Public License.
``The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Original Code is ______________________________________.
The Initial Developer of the Original Code is ________________________.
Portions created by ______________________ are Copyright (C) ______
_______________________. All Rights Reserved.
Contributor(s): ______________________________________.
Alternatively, the contents of this file may be used under the terms
of the _____ license (the "[___] License"), in which case the
provisions of [______] License are applicable instead of those
above. If you wish to allow use of your version of this file only
under the terms of the [____] License and not to allow others to use
your version of this file under the MPL, indicate your decision by
deleting the provisions above and replace them with the notice and
other provisions required by the [___] License. If you do not delete
the provisions above, a recipient may use your version of this file
under either the MPL or the [___] License."
[NOTE: The text of this Exhibit A may differ slightly from the text of
the notices in the Source Code files of the Original Code. You should
use the text of this Exhibit A rather than the text found in the
Original Code Source Code for Your Modifications.]

View File

@@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@@ -0,0 +1,141 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- JsUnit -->
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Edward Hieatt code.
-
- The Initial Developer of the Original Code is
- Edward Hieatt, edward@jsunit.net.
- Portions created by the Initial Developer are Copyright (C) 2001
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Edward Hieatt, edward@jsunit.net (original author)
- Bob Clary, bc@bclary.comn
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Licensing</title>
<link rel="stylesheet" type="text/css" href="../app/css/jsUnitStyle.css">
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0" border="1" summary="jsUnit Information">
<tr>
<th align="center" valign="top"><h1>JsUnit Licenses</h1></th>
<td align="right" valign="top">
<a href="http://www.jsunit.net/" target="_blank">JsUnit Home</a><br>
<a href="mailto:edward@jsunit.net">edward@jsunit.net</a><br>
</tr>
</table>
<p><h2>Third-party licenses:</h2>
<ul>
<li>JDOM: Portions of this software are copyright Copyright (C) 2000-2003 Jason Hunter & Brett McLaughlin. All
rights reserved. See <a href="JDOM_license.txt">JDOM_license.txt</a>.
<li>Jetty: Portions of this software are copyright <20> Mort Bay Consulting Pty. Ltd. (Australia) and others. All
Rights Reserved. See <a href="Jetty_license.html">Jetty_license.html</a>.
<li>Individual files in this package may contain additional copyright notices. The javax.servlet packages are
copyright Sun Microsystems Inc. All Rights Reserved.
</ul>
</p>
<p><h2>JsUnit licenses:</h2>
JsUnit is licensed under 3 different licenses giving you the freedom
to use, modify and distribute JsUnit in a variety of fashions.
</p>
<ol>
<li>
<p><a href="MPL-1.1.txt">Mozilla Public License 1.1</a></p>
<p>See <a href="http://www.mozilla.org/MPL/">mozilla.org</a>
for more details.</p>
</li>
<li>
<p><a href="gpl-2.txt">GNU Public License 2</a></p>
<p>See <a href="http://www.gnu.org/licenses/licenses.html">www.gnu.org</a>
for more details.</p>
</li>
<li>
<p><a href="lgpl-2.1.txt">GNU Lesser Public License 2.1</a></p>
<p>See <a href="http://www.gnu.org/licenses/licenses.html">www.gnu.org</a>
for more details.</p>
</li>
</ol>
<p>
Every Java and JavaScript source file in this distribution should be considered to be under the following licensing
terms.
<pre>
***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Edward Hieatt code.
-
- The Initial Developer of the Original Code is
- Edward Hieatt, edward@jsunit.net.
- Portions created by the Initial Developer are Copyright (C) 2003
- the Initial Developer. All Rights Reserved.
-
- Author Edward Hieatt, edward@jsunit.net
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK *****
</pre>
</p>
</body>
</html>

View File

@@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@@ -0,0 +1,35 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is __________________________________________.
*
* The Initial Developer of the Original Code is
* ____________________________________________.
* Portions created by the Initial Developer are Copyright (C) 2___
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */

View File

@@ -0,0 +1,35 @@
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is __________________________________________.
-
- The Initial Developer of the Original Code is
- ____________________________________________.
- Portions created by the Initial Developer are Copyright (C) 2___
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->

View File

@@ -0,0 +1,19 @@
JsUnit
Copyright (C) 2001-6 Edward Hieatt, edward@jsunit.net
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Please see http://www.jsunit.net/ for JsUnit documentation and
the "licenses" directory for license information.

View File

@@ -0,0 +1,167 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JsUnit Test Runner</title>
<script language="JavaScript" type="text/javascript" src="app/xbDebug.js"></script>
<script language="JavaScript" type="text/javascript" src="app/jsUnitCore.js"></script>
<script language="JavaScript" type="text/javascript">
var DEFAULT_TEST_FRAME_HEIGHT = 250;
function jsUnitParseParms(string) {
var i;
var searchString = unescape(string);
var parameterHash = new Object();
if (!searchString) {
return parameterHash;
}
i = searchString.indexOf('?');
if (i != -1) {
searchString = searchString.substring(i + 1);
}
var parmList = searchString.split('&');
var a;
for (i = 0; i < parmList.length; i++) {
a = parmList[i].split('=');
a[0] = a[0].toLowerCase();
if (a.length > 1) {
parameterHash[a[0]] = a[1];
}
else {
parameterHash[a[0]] = true;
}
}
return parameterHash;
}
function jsUnitConstructTestParms() {
var p;
var parms = '';
for (p in jsUnitParmHash) {
var value = jsUnitParmHash[p];
if (!value ||
p == 'testpage' ||
p == 'autorun' ||
p == 'submitresults' ||
p == 'showtestframe' ||
p == 'resultid') {
continue;
}
if (parms) {
parms += '&';
}
parms += p;
if (typeof(value) != 'boolean') {
parms += '=' + value;
}
}
return escape(parms);
}
var jsUnitParmHash = jsUnitParseParms(document.location.search);
// set to true to turn debugging code on, false to turn it off.
xbDEBUG.on = jsUnitGetParm('debug') ? true : false;
</script>
<script language="JavaScript" type="text/javascript" src="app/jsUnitTestManager.js"></script>
<script language="JavaScript" type="text/javascript" src="app/jsUnitTracer.js"></script>
<script language="JavaScript" type="text/javascript" src="app/jsUnitTestSuite.js"></script>
<script language="JavaScript" type="text/javascript">
var testManager;
var utility;
var tracer;
if (!Array.prototype.push) {
Array.prototype.push = function (anObject) {
this[this.length] = anObject;
}
}
if (!Array.prototype.pop) {
Array.prototype.pop = function () {
if (this.length > 0) {
delete this[this.length - 1];
this.length--;
}
}
}
function shouldKickOffTestsAutomatically() {
return jsUnitGetParm('autorun') == "true";
}
function shouldShowTestFrame() {
return jsUnitGetParm('showtestframe');
}
function shouldSubmitResults() {
return jsUnitGetParm('submitresults');
}
function getResultId() {
if (jsUnitGetParm('resultid'))
return jsUnitGetParm('resultid');
return "";
}
function submitResults() {
window.mainFrame.mainData.document.testRunnerForm.runButton.disabled = true;
window.mainFrame.mainResults.populateHeaderFields(getResultId(), navigator.userAgent, JSUNIT_VERSION, testManager.resolveUserEnteredTestFileName());
window.mainFrame.mainResults.submitResults();
}
function wasResultUrlSpecified() {
return shouldSubmitResults() && jsUnitGetParm('submitresults') != 'true';
}
function getSpecifiedResultUrl() {
return jsUnitGetParm('submitresults');
}
function init() {
var testRunnerFrameset = document.getElementById('testRunnerFrameset');
if (shouldShowTestFrame() && testRunnerFrameset) {
var testFrameHeight;
if (jsUnitGetParm('showtestframe') == 'true')
testFrameHeight = DEFAULT_TEST_FRAME_HEIGHT;
else
testFrameHeight = jsUnitGetParm('showtestframe');
testRunnerFrameset.rows = '*,0,' + testFrameHeight;
}
testManager = new jsUnitTestManager();
tracer = new JsUnitTracer(testManager);
if (shouldKickOffTestsAutomatically()) {
window.mainFrame.mainData.kickOffTests();
}
}
</script>
</head>
<frameset id="testRunnerFrameset" rows="*,0,0" border="0" onload="init()">
<frame frameborder="0" name="mainFrame" src="./app/main-frame.html">
<frame frameborder="0" name="documentLoader" src="./app/main-loader.html">
<frame frameborder="0" name="testContainer" src="./app/testContainer.html">
<noframes>
<body>
<p>Sorry, JsUnit requires support for frames.</p>
</body>
</noframes>
</frameset>
</html>

View File

@@ -0,0 +1,7 @@
function f() {
return true;
}
function g() {
return true;
}

View File

@@ -0,0 +1,25 @@
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="jsunit/app/jsUnitCore.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript">
function test_f() {
assert(f());
}
/*
This code automatically stores coverage reports when running under
jscoverage-server.
*/
function tearDownPage() {
if (window.jscoverage_report) {
jscoverage_report();
}
}
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Example</title>
<script type="text/javascript" src="script.js"></script>
<style>
div.black {
color: black;
}
div.red {
color: red;
font-weight: bold;
}
</style>
</head>
<body>
<div id="request" class="red">Please select your favorite number:</div>
<input type="radio" name="number" id="radio1" onclick="go(this);"><label for="radio1">One</label><br>
<input type="radio" name="number" id="radio2" onclick="go(this);"><label for="radio2">Two</label><br>
<input type="radio" name="number" id="radio3" onclick="go(this);"><label for="radio3">Three</label><br>
<input type="radio" name="number" id="radio4" onclick="go(this);"><label for="radio4">Four</label><br>
<div id="result" class="red"></div>
</body>
</html>

View File

@@ -0,0 +1,20 @@
function go(element) {
var message;
if (element.id === 'radio1') {
message = 'You selected the number 1.';
}
else if (element.id === 'radio2') {
message = 'You selected the number 2.';
}
else if (element.id === 'radio3') {
message = 'You selected the number 3.';
}
else if (element.id === 'radio4') {
message = 'You selected the number 4.';
}
var div = document.getElementById('request');
div.className = 'black';
div = document.getElementById('result');
div.innerHTML = '<p>' + message + '</p>';
div.innerHTML += '<p>If you are running the instrumented version of this program, you can click the "Summary" tab to view a coverage report.</p>';
}

View File

@@ -0,0 +1,164 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>JSCoverage - FAQ</title>
<link rel="stylesheet" type="text/css" href="reset-fonts-grids.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="doc3" class="yui-t5">
<div id="hd"><h1><a href="./">JSCoverage</a><br><span class="tag">code coverage for JavaScript</span></h1></div>
<div id="bd">
<div id="yui-main">
<div id="jscoverage-main" class="yui-b">
<h2><abbr title="Frequently Asked Questions">FAQ</abbr></h2>
<h3>Can I use JSCoverage to measure code coverage for a page on <code>http://example.com/</code>?</h3>
<p>
In order to measure the code coverage of a page on <code>http://example.com/</code>,
you must run <code>jscoverage</code> to create a <code>jscoverage.html</code> file on the
<code>example.com</code> server. You cannot use <code>http://example.org/jscoverage.html</code>
to measure the code coverage of a page located on <code>http://example.com/</code>.
</p>
<p>
The fundamental reason for this limitation is the
<a href="http://www.mozilla.org/projects/security/components/same-origin.html">Same Origin Policy</a>
for untrusted JavaScript.
</p>
<p>
(In fact, the current version of JSCoverage is slightly more restrictive
than this: it requires that the JavaScript being measured reside under the
same <strong>directory</strong> as the <code>jscoverage.html</code> file.)
</p>
<h3>Why doesn't my test suite run under JSCoverage in Firefox 3?</h3>
<p>
Firefox 3 introduces <a
href="http://tech.groups.yahoo.com/group/jsunit/message/1075">new
security restrictions</a> on local files. Depending on the way your
test suite is organized, this may cause problems for JSCoverage.
(You may get the error "uncaught exception: Permission denied to get property Window._$jscoverage".)
There are several workarounds:
</p>
<ul class="list">
<li><p>Place your files on a web server instead of loading them from the file system.
This is usually the simplest solution.</p>
<li><p>Organize your HTML files in your test suite in a flat directory structure. For example, suppose that
you instrument your test suite with this command:</p>
<pre>
jscoverage src instrumented
</pre>
<p>If all your HTML files are located directly under the <code>src/</code> directory (i.e., not in a
subdirectory of <code>src/</code>), then you should not have any problems using Firefox 3.</p>
<li><p>Set the <a href="http://kb.mozillazine.org/Editing_configuration">Firefox preference</a> named
<code><a href="http://kb.mozillazine.org/Security.fileuri.origin_policy">security.fileuri.origin_policy</a></code>
to 3.</p>
</ul>
<h3>I'm trying to load my code with the URL
<code>file:///C:/foo/bar/jscoverage.html?foo/bar.html</code>
and I'm getting all kinds of JavaScript errors.</h3>
<p>
Internet Explorer 6 seems to have problems with a <code>file:</code> URL
that has a query string with a slash in it.
</p>
<p>
As a workaround:
</p>
<ul class="list">
<li><p>Place your files on a web server instead of loading them from the file system.
(<code>http:</code> URLs work fine.)</p>
<li><p>Do not use a query string; enter your URL in the "URL" field in the "Browser" tab.</p>
<li><p>Rearrange your directory structure so that <code>bar.html</code>
ends up in the same directory as <code>jscoverage.html</code>; then
you can use the URL
<code>file:///C:/foo/bar/jscoverage.html?bar.html</code>
with no slash in the query string.</p>
<li><p>Use a different browser. (IE 7 seems to work.)</p>
</ul>
<h3>JSCoverage changes my cursor to a busy cursor, and it never changes back!</h3>
<p>
Certain browsers (<i>e. g</i>., Internet Explorer 6, Opera, Safari) have trouble changing
the cursor. Try moving the mouse and your cursor should change back to normal.
</p>
<p>
See <a href="http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/631908bd63241136/783c307480f95d8c">this discussion</a> for more information.
</p>
<h3>JSCoverage hangs sometimes when rendering the coverage report.</h3>
<p>
With Internet Explorer 6 (I think I see a pattern here), garbage collection can cause performance problems.
(More information <a href="http://ajaxian.com/archives/garbage-collection-in-ie6">here</a>.)
</p>
<h3 id="jsunit">Can JSCoverage be used with <a href="http://www.jsunit.net/">JsUnit</a>?</h3>
<p>
It is necessary to run JSCoverage in <dfn>inverted mode</dfn>. You will have to
modify JsUnit to launch JSCoverage.
</p>
<p>
See the directory <code>doc/example-jsunit</code> for an example. It
contains a copy of JsUnit version 2.2alpha11, with the file
<code>jsunit/app/main-data.html</code> slightly modified to add a button
which launches JSCoverage. It also contains a simple unit test file <code>test.html</code>. You
can instrument this example as follows:
</p>
<pre>
jscoverage --no-instrument=jsunit doc/example-jsunit doc/instrumented-jsunit
</pre>
<p>
You can then run the <code>test.html</code> file in JsUnit's <code>jsunit/testRunner.html</code>.
The simplest way to do this is probably to copy the contents of <code>doc/instrumented-jsunit</code>
to the root of a web server and then access the URL
</p>
<pre>
http://127.0.0.1/jsunit/testRunner.html?testPage=http://127.0.0.1/test.html&amp;autoRun=true
</pre>
<p>
After the test suite has been run, click on the "Coverage report" button
to get a coverage report.
</p>
</div>
</div>
<div id="jscoverage-sidebar" class="yui-b">
<ul>
<li><a href="./">Home</a>
<li><a href="news.html">News</a> <a href="http://siliconforks.com/jscoverage/news.xml" type="application/rss+xml" title="RSS feed for JSCoverage"><img src="feed-icon-14x14.png" alt="RSS feed"></a>
<li><a href="manual.html">Documentation</a>
<li><a href="demo.html">Demo</a>
<li><a href="http://siliconforks.com/jscoverage/download.html">Download</a>
<li>FAQ
<li><a href="help.html">Help</a>
<li><a href="license.html">License</a>
<li><a href="links.html">Links</a>
<li><a href="users.html">Users</a>
<li><a href="http://siliconforks.com/jscoverage/bugs/">Bug tracker</a>
</ul>
</div>
</div>
<div id="ft">
<address>
Copyright &copy; 2007, 2008 <a href="http://siliconforks.com/"><img src="siliconforks-16x16.png" width="16" height="16" class="icon" alt="Silicon Forks"></a> <a href="http://siliconforks.com/">siliconforks.com</a><br>
<a href="mailto:jscoverage@siliconforks.com">jscoverage@siliconforks.com</a>
</address>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 689 B

View File

@@ -0,0 +1,45 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>JSCoverage - help</title>
<link rel="stylesheet" type="text/css" href="reset-fonts-grids.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="doc3" class="yui-t5">
<div id="hd"><h1><a href="./">JSCoverage</a><br><span class="tag">code coverage for JavaScript</span></h1></div>
<div id="bd">
<div id="yui-main">
<div id="jscoverage-main" class="yui-b">
<h2>Help</h2>
<p>
Questions, problems, suggestions, bug reports, and so on can be posted at the
online <a href="http://siliconforks.com/forum/viewforum.php?f=1">forum</a>.
</p>
</div>
</div>
<div id="jscoverage-sidebar" class="yui-b">
<ul>
<li><a href="./">Home</a>
<li><a href="news.html">News</a> <a href="http://siliconforks.com/jscoverage/news.xml" type="application/rss+xml" title="RSS feed for JSCoverage"><img src="feed-icon-14x14.png" alt="RSS feed"></a>
<li><a href="manual.html">Documentation</a>
<li><a href="demo.html">Demo</a>
<li><a href="http://siliconforks.com/jscoverage/download.html">Download</a>
<li><a href="faq.html">FAQ</a>
<li>Help
<li><a href="license.html">License</a>
<li><a href="links.html">Links</a>
<li><a href="users.html">Users</a>
<li><a href="http://siliconforks.com/jscoverage/bugs/">Bug tracker</a>
</ul>
</div>
</div>
<div id="ft">
<address>
Copyright &copy; 2007, 2008 <a href="http://siliconforks.com/"><img src="siliconforks-16x16.png" width="16" height="16" class="icon" alt="Silicon Forks"></a> <a href="http://siliconforks.com/">siliconforks.com</a><br>
<a href="mailto:jscoverage@siliconforks.com">jscoverage@siliconforks.com</a>
</address>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,151 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>JSCoverage - code coverage for JavaScript</title>
<link rel="stylesheet" type="text/css" href="reset-fonts-grids.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="doc3" class="yui-t5">
<div id="hd"><h1><span class="h1">JSCoverage</span><br><span class="tag">code coverage for JavaScript</span></h1></div>
<div id="bd">
<div id="yui-main">
<div id="jscoverage-main" class="yui-b">
<p>
JSCoverage is a tool that measures code coverage for
JavaScript programs.
</p>
<p>
<dfn>Code coverage</dfn> statistics show which lines of a program have
been executed (and which have been missed). This information is useful
for constructing comprehensive test suites (hence, it is often called
<dfn>test coverage</dfn>).
</p>
<p>
JSCoverage works by instrumenting the JavaScript code used in web
pages. Code coverage statistics are collected while the instrumented
JavaScript code is executed in a web browser.
</p>
<p>
JSCoverage supports the complete language syntax described in the
<cite>ECMAScript Language Specification</cite> (ECMA-262, 3rd edition).
JSCoverage works with any modern standards-compliant web browser -
including Internet Explorer (IE 6 and IE 7), Firefox (FF 2 and FF 3),
Opera, Safari, and Google Chrome - on Microsoft Windows and GNU/Linux.
</p>
<p>
JSCoverage is free software, distributed under the
<a href="license.html">GNU General Public License version 2</a>.
</p>
<h2>Latest News <a href="http://siliconforks.com/jscoverage/news.xml" type="application/rss+xml" title="RSS feed for JSCoverage"><img src="feed-icon-14x14.png" alt="RSS feed"></a></h2>
<h3><a name="20081211">December 11, 2008 - JSCoverage 0.4</a></h3>
<p>
JSCoverage 0.4 is available for <a href="http://siliconforks.com/jscoverage/download.html">download</a>.
</p>
<p>
This release includes many new features:
</p>
<ul class="list">
<li>
The new <code>jscoverage-server</code> program is provided as an
alternative to the <code>jscoverage</code> program. The
<code>jscoverage-server</code> program is a simple HTTP server which
instruments JavaScript code as it is served; this allows you to execute
JavaScript and gather code coverage statistics without a preliminary
step of creating instrumented code. The <code>jscoverage-server</code>
program can either serve files directly from the filesystem or run as a
proxy server (with the <code>--proxy</code> option), instrumenting
JavaScript provided by another web server.
<li>
Using <code>jscoverage-server</code>, coverage reports can now be stored
to the filesystem.
</li>
<li>
JSCoverage now recognizes special JavaScript comments which specify that
certain lines of code should be ignored in coverage reports.
</li>
<li>
The new <code>--encoding</code> option provides better support for
different character encodings.
</li>
<li>
The JSCoverage user interface is now faster and more responsive.
</li>
<li>
The new <code>--no-highlight</code> option can be used to disable syntax
highlighting (giving better performance for large JavaScript files).
</li>
<li>
The build system has been modified so that <code>make install</code>
only installs the <code>jscoverage</code> and
<code>jscoverage-server</code> executables and their manual pages.
(Previous versions installed SpiderMonkey library and executable files,
which could conflict with other versions of SpiderMonkey installed on
your system.)
</li>
<li>
JSCoverage now supports several features beyond those found in the
<cite>ECMAScript Language Specification</cite>, including the following:
<ul class="list">
<li>getters and setters
<li><code>for each</code> loops
<li>generators and iterators
<li>the <code>let</code> keyword
<li>destructuring assignment
<li>array comprehensions
<li>expression closures
<li>generator expressions
</ul>
Use the new <code>--js-version</code> option to enable these features.
</li>
</ul>
<p>
The GCC C++ compiler (<code>g++</code>) is now required to compile
JSCoverage. (Previously, only the C compiler was needed.)
</p>
<p>
Please report any bugs you find using the new <a href="http://siliconforks.com/jscoverage/bugs/">bug tracker</a>.
</p>
<h3><a name="20080331">March 31, 2008 - JSCoverage and Firefox 3</a></h3>
<p>
The <a href="faq.html">JSCoverage FAQ</a> has been updated to address problems using JSCoverage with Firefox 3.
</p>
<h3><a name="20080324">March 24, 2008 - JSCoverage in Debian GNU/Linux</a></h3>
<p>
JSCoverage is now <a href="http://packages.debian.org/sid/jscoverage">available</a> in the Debian unstable distribution.
</p>
<p>
<a href="news.html">All news items...</a>
</p>
</div>
</div>
<div id="jscoverage-sidebar" class="yui-b">
<ul>
<li>Home
<li><a href="news.html">News</a> <a href="http://siliconforks.com/jscoverage/news.xml" type="application/rss+xml" title="RSS feed for JSCoverage"><img src="feed-icon-14x14.png" alt="RSS feed"></a>
<li><a href="manual.html">Documentation</a>
<li><a href="demo.html">Demo</a>
<li><a href="http://siliconforks.com/jscoverage/download.html">Download</a>
<li><a href="faq.html">FAQ</a>
<li><a href="help.html">Help</a>
<li><a href="license.html">License</a>
<li><a href="links.html">Links</a>
<li><a href="users.html">Users</a>
<li><a href="http://siliconforks.com/jscoverage/bugs/">Bug tracker</a>
</ul>
</div>
</div>
<div id="ft">
<address>
Copyright &copy; 2007, 2008 <a href="http://siliconforks.com/"><img src="siliconforks-16x16.png" width="16" height="16" class="icon" alt="Silicon Forks"></a> <a href="http://siliconforks.com/">siliconforks.com</a><br>
<a href="mailto:jscoverage@siliconforks.com">jscoverage@siliconforks.com</a>
</address>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Example</title>
<script type="text/javascript" src="script.js"></script>
<style>
div.black {
color: black;
}
div.red {
color: red;
font-weight: bold;
}
</style>
</head>
<body>
<div id="request" class="red">Please select your favorite number:</div>
<input type="radio" name="number" id="radio1" onclick="go(this);"><label for="radio1">One</label><br>
<input type="radio" name="number" id="radio2" onclick="go(this);"><label for="radio2">Two</label><br>
<input type="radio" name="number" id="radio3" onclick="go(this);"><label for="radio3">Three</label><br>
<input type="radio" name="number" id="radio4" onclick="go(this);"><label for="radio4">Four</label><br>
<div id="result" class="red"></div>
<button onclick='window.open("jscoverage.html");'>Coverage report</button>
</body>
</html>

View File

@@ -0,0 +1,38 @@
/*
jscoverage-highlight.css - JSCoverage syntax highlighting style sheet
Copyright (C) 2008 siliconforks.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* keyword, type, symbol, cbracket */
#sourceTable .k {
font-weight: bold;
}
/* string, regexp, number */
#sourceTable .s {
color: #006400;
}
/* specialchar */
#sourceTable .t {
color: #2e8b57;
}
/* comment */
#sourceTable .c {
font-style: italic;
}

View File

@@ -0,0 +1,89 @@
#headingDiv {
position: static;
margin-left: 10px;
margin-right: 10px;
padding-top: 0.5em;
}
#tabs {
clear: all;
position: static;
top: auto;
left: auto;
right: auto;
height: auto;
margin-left: 10px;
margin-right: 10px;
}
#tabs div {
position: relative;
height: auto;
line-height: normal;
padding-top: 5px;
padding-bottom: 5px;
}
#tabs div.selected {
padding-bottom: 6px;
z-index: 2;
}
.TabPage {
position: relative;
top: -1px;
left: auto;
right: auto;
bottom: auto;
clear: left;
margin-left: 10px;
margin-right: 10px;
padding: 10px;
z-index: 1;
}
#locationDiv {
margin-bottom: 10px;
}
#iframeDiv {
position: static;
width: 100%;
}
#summaryDiv {
position: static;
width: 100%;
}
#fileDiv {
margin-bottom: 10px;
}
#sourceDiv {
position: static;
width: 100%;
}
#storeDiv {
position: static;
width: 100%;
}
/* some defaults */
.TabPage {
height: 650px;
}
#iframeDiv {
height: 600px;
}
#summaryDiv {
height: 600px;
}
#sourceDiv {
height: 600px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

View File

@@ -0,0 +1,328 @@
/*
jscoverage.css - code coverage for JavaScript
Copyright (C) 2007, 2008 siliconforks.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
body {
background-color: #bfffbf;
font-family: sans-serif;
font-size: 100%;
margin: 0;
}
#mainDiv {
font-size: 0.8125em;
}
#headingDiv {
position: absolute;
top: 0.5em;
left: 1.5em;
right: 1.5em;
bottom: 0;
line-height: 1.5em;
}
h1 {
float: left;
margin: 0;
padding-bottom: 0.5em;
font-size: 1.3em;
}
.ProgressBar {
float: left;
visibility: hidden;
}
.ProgressPercentage {
display: block;
float: left;
width: 5em;
text-align: right;
}
.ProgressGraph {
float: left;
width: 100px;
height: 10px;
border: 1px solid black;
margin-top: 0.3em;
background-color: #d4d0c8;
overflow: hidden;
}
.ProgressCovered {
/* windows system color ActiveCaption or Highlight */
background-color: #0a246a;
width: 0;
height: 10px;
overflow: hidden;
}
#progressLabel {
display: block;
float: left;
padding-left: 0.3em;
}
/*******************************************************************************
browser tab
*/
input#location, button {
border: 1px solid black;
margin-left: 1px;
margin-right: 1px;
}
#iframeDiv {
position: absolute;
top: 3.5em;
left: 1em;
right: 1em;
bottom: 1em;
}
iframe {
width: 100%;
height: 100%;
}
/*******************************************************************************
summary tab
*/
#summaryDiv {
position: absolute;
top: 3em;
left: 1em;
right: 1em;
bottom: 1em;
overflow: auto;
}
table#summaryTable {
width: 100%;
margin-left: 0px;
margin-right: 0px;
border-collapse: collapse;
font-size: small;
}
table#summaryTable th, table#summaryTable td {
border-left: 1px solid #d9d9d9;
}
table#summaryTable th.leftColumn, table#summaryTable td.leftColumn {
border-left-width: 0px;
}
table#summaryTable th, table#summaryTable td {
padding: 2px;
}
th {
background-color: #e6ffe6;
}
td.numeric {
text-align: right;
}
abbr {
cursor: help;
}
tr#summaryTotals td.leftColumn span {
float: right;
}
tr#summaryTotals td.leftColumn span.title {
float: left;
font-weight: bold;
}
tr#summaryTotals td {
background-color: #ffd;
}
td.coverage {
width: 150px;
}
td.coverage span {
float: right;
margin-right: 5px;
}
.pctGraph {
width: 100px;
height: 10px;
float: right;
border: 1px solid #000;
background-color: #e00000;
overflow: hidden;
margin-top: 4px;
}
.pctGraph .covered {
background-color: #00f000;
width: 0;
height: 10px;
}
.pctGraph .skipped {
background-color: #d4d0c8;
width: 100px;
height: 10px;
}
tbody#summaryTbody tr.even td {
background-color: #e6ffe6;
}
/*******************************************************************************
source tab
*/
#fileDiv {
font-size: large;
font-weight: bold;
}
#sourceDiv {
position: absolute;
top: 3em;
left: 1em;
right: 1em;
bottom: 1em;
overflow: auto;
}
table#sourceTable {
border: 0px;
border-collapse: collapse;
font-size: small;
}
/*
IE default behavior is to make <pre> smaller than surrounding text. Because
the table already has font-size small, this would make the font-size within the
<pre> x-small. So we don't rely on the default.
*/
table#sourceTable pre {
font-size: medium;
}
table#sourceTable td {
border: 0px;
padding-top: 0px;
padding-bottom: 0px;
padding-left: 10px;
padding-right: 10px;
}
table#sourceTable pre {
border: 0px;
margin: 0px;
}
.g {
background-color: #bfffbf;
}
.y {
background-color: #ffffbf;
}
.r {
background-color: #ffbfbf;
}
/*******************************************************************************
store tab
*/
#storeDiv {
position: absolute;
top: 3em;
left: 1em;
right: 1em;
bottom: 1em;
overflow: auto;
}
/*******************************************************************************
about tab
*/
p {
margin-top: 0;
}
/*******************************************************************************
tabs
*/
#tabs {
position: absolute;
top: 3em;
left: 1.5em;
right: 1.5em;
height: 2em;
}
#tabs div {
background-color: white;
position: relative;
float: left;
border: 1px solid black;
border-bottom-width: 0;
cursor: pointer;
margin-left: 0.5em;
margin-right: 0.5em;
padding-left: 0.5em;
padding-right: 0.5em;
height: 2em;
z-index: 1;
line-height: 1.8em;
}
#tabs div.selected {
z-index: 3;
cursor: default;
}
#tabs div.disabled {
/* windows system color GrayText */
color: #808080;
cursor: default;
}
.TabPage {
background-color: white;
border: 1px solid black;
position: absolute;
top: 5em;
left: 1.5em;
right: 1.5em;
bottom: 1.5em;
z-index: 2;
padding: 1em;
display: none;
}
#tabPages div.selected {
display: block;
}
img {
visibility: hidden;
}

View File

@@ -0,0 +1,125 @@
<!DOCTYPE html>
<!--
jscoverage.html - code coverage for JavaScript
Copyright (C) 2007, 2008 siliconforks.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-->
<html>
<head>
<title>JSCoverage</title>
<link rel="stylesheet" type="text/css" href="jscoverage-highlight.css">
<link rel="stylesheet" type="text/css" href="jscoverage.css">
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="jscoverage-ie.css">
<![endif]-->
<script type="text/javascript" src="jscoverage.js"></script>
</head>
<body onload="jscoverage_body_load();" onresize="jscoverage_body_resize();">
<div id="mainDiv">
<div id="headingDiv">
<h1>JSCoverage</h1>
<div class="ProgressBar" id="progressBar"><span class="ProgressPercentage"></span><div class="ProgressGraph"><div class="ProgressCovered"></div></div></div>
<span id="progressLabel"></span>
</div>
<div id="tabs" class="Tabs">
<div id="browserTab"><img src="jscoverage-throbber.gif" alt=""> Browser <img src="jscoverage-throbber.gif" alt=""></div>
<div id="summaryTab"><img id="summaryThrobber" src="jscoverage-throbber.gif" alt=""> Summary <img src="jscoverage-throbber.gif" alt=""></div>
<div id="sourceTab" class="disabled"><img src="jscoverage-throbber.gif" alt=""> Source <img src="jscoverage-throbber.gif" alt=""></div>
<div id="storeTab"><img id="storeThrobber" src="jscoverage-throbber.gif" alt=""> Store <img src="jscoverage-throbber.gif" alt=""></div>
<div id="aboutTab"><img src="jscoverage-throbber.gif" alt=""> About <img src="jscoverage-throbber.gif" alt=""></div>
</div>
<div id="tabPages" class="TabPages">
<div class="TabPage" id="browserTabPage">
<div id="locationDiv">
URL: <input id="location" type="text" size="70" onkeypress="jscoverage_input_keypress(event)">
<button onclick="jscoverage_button_click();">Go</button>
</div>
<div id="iframeDiv">
<iframe id="browserIframe" onload="jscoverage_browser_load();"></iframe>
</div>
</div>
<div class="TabPage">
<input type="checkbox" id="checkbox" onclick="return jscoverage_checkbox_click();"> <label for="checkbox">Show missing statements column</label>
<div id="summaryDiv">
<div id="summaryErrorDiv"></div>
<table id="summaryTable">
<thead>
<tr id="headerRow">
<th class="leftColumn">File</th>
<th><abbr title="The total number of executable statements">Statements</abbr></th>
<th><abbr title="The number of statements actually executed">Executed</abbr></th>
<th><abbr title="Number of executed statements as a percentage of total number of statements">Coverage</abbr></th>
</tr>
<tr id="summaryTotals">
<td class="leftColumn">
<span class="title">Total:</span>
<span>0</span>
</td>
<td class="numeric">0</td>
<td class="numeric">0</td>
<td class="coverage">
<div class="pctGraph">
<div class="covered"></div>
</div>
<span class="pct">0%</span>
</td>
</tr>
</thead>
<tbody id="summaryTbody">
<!--
<tr>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0%</td>
<td>0</td>
</tr>
-->
</tbody>
</table>
</div>
</div>
<div class="TabPage">
<div id="fileDiv"></div>
<div id="sourceDiv"></div>
</div>
<div class="TabPage" id="storeTabPage">
<button id="storeButton" onclick="jscoverage_storeButton_click();">Store Report</button>
<img id="storeImg" src="jscoverage-throbber.gif" alt="loading...">
<div id="storeDiv"></div>
</div>
<div class="TabPage">
<p>
This is version 0.4 of JSCoverage, a program that calculates code
coverage statistics for JavaScript.
</p>
<p>
See <a href="http://siliconforks.com/jscoverage/">http://siliconforks.com/jscoverage/</a> for more information.
</p>
<p>
Copyright &copy; 2007, 2008 siliconforks.com
</p>
</div>
</div>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
/* automatically generated by JSCoverage - do not edit */
if (! top._$jscoverage) {
top._$jscoverage = {};
}
var _$jscoverage = top._$jscoverage;
if (! _$jscoverage['script.js']) {
_$jscoverage['script.js'] = [];
_$jscoverage['script.js'][1] = 0;
_$jscoverage['script.js'][2] = 0;
_$jscoverage['script.js'][3] = 0;
_$jscoverage['script.js'][4] = 0;
_$jscoverage['script.js'][6] = 0;
_$jscoverage['script.js'][7] = 0;
_$jscoverage['script.js'][9] = 0;
_$jscoverage['script.js'][10] = 0;
_$jscoverage['script.js'][12] = 0;
_$jscoverage['script.js'][13] = 0;
_$jscoverage['script.js'][15] = 0;
_$jscoverage['script.js'][16] = 0;
_$jscoverage['script.js'][17] = 0;
_$jscoverage['script.js'][18] = 0;
_$jscoverage['script.js'][19] = 0;
}
_$jscoverage['script.js'][1]++;
function go(element) {
_$jscoverage['script.js'][2]++;
var message;
_$jscoverage['script.js'][3]++;
if (element.id === "radio1") {
_$jscoverage['script.js'][4]++;
message = "You selected the number 1.";
}
else {
_$jscoverage['script.js'][6]++;
if (element.id === "radio2") {
_$jscoverage['script.js'][7]++;
message = "You selected the number 2.";
}
else {
_$jscoverage['script.js'][9]++;
if (element.id === "radio3") {
_$jscoverage['script.js'][10]++;
message = "You selected the number 3.";
}
else {
_$jscoverage['script.js'][12]++;
if (element.id === "radio4") {
_$jscoverage['script.js'][13]++;
message = "You selected the number 4.";
}
}
}
}
_$jscoverage['script.js'][15]++;
var div = document.getElementById("request");
_$jscoverage['script.js'][16]++;
div.className = "black";
_$jscoverage['script.js'][17]++;
div = document.getElementById("result");
_$jscoverage['script.js'][18]++;
div.innerHTML = "<p>" + message + "</p>";
_$jscoverage['script.js'][19]++;
div.innerHTML += "<p>If you are running the instrumented version of this program, you can click the \"Coverage report\" button to view a coverage report.</p>";
}
_$jscoverage['script.js'].source = ["<span class=\"k\">function</span> go<span class=\"k\">(</span>element<span class=\"k\">)</span> <span class=\"k\">{</span>"," <span class=\"k\">var</span> message<span class=\"k\">;</span>"," <span class=\"k\">if</span> <span class=\"k\">(</span>element<span class=\"k\">.</span>id <span class=\"k\">===</span> <span class=\"s\">'radio1'</span><span class=\"k\">)</span> <span class=\"k\">{</span>"," message <span class=\"k\">=</span> <span class=\"s\">'You selected the number 1.'</span><span class=\"k\">;</span>"," <span class=\"k\">}</span>"," <span class=\"k\">else</span> <span class=\"k\">if</span> <span class=\"k\">(</span>element<span class=\"k\">.</span>id <span class=\"k\">===</span> <span class=\"s\">'radio2'</span><span class=\"k\">)</span> <span class=\"k\">{</span>"," message <span class=\"k\">=</span> <span class=\"s\">'You selected the number 2.'</span><span class=\"k\">;</span>"," <span class=\"k\">}</span>"," <span class=\"k\">else</span> <span class=\"k\">if</span> <span class=\"k\">(</span>element<span class=\"k\">.</span>id <span class=\"k\">===</span> <span class=\"s\">'radio3'</span><span class=\"k\">)</span> <span class=\"k\">{</span>"," message <span class=\"k\">=</span> <span class=\"s\">'You selected the number 3.'</span><span class=\"k\">;</span>"," <span class=\"k\">}</span>"," <span class=\"k\">else</span> <span class=\"k\">if</span> <span class=\"k\">(</span>element<span class=\"k\">.</span>id <span class=\"k\">===</span> <span class=\"s\">'radio4'</span><span class=\"k\">)</span> <span class=\"k\">{</span>"," message <span class=\"k\">=</span> <span class=\"s\">'You selected the number 4.'</span><span class=\"k\">;</span>"," <span class=\"k\">}</span>"," <span class=\"k\">var</span> div <span class=\"k\">=</span> document<span class=\"k\">.</span>getElementById<span class=\"k\">(</span><span class=\"s\">'request'</span><span class=\"k\">);</span>"," div<span class=\"k\">.</span>className <span class=\"k\">=</span> <span class=\"s\">'black'</span><span class=\"k\">;</span>"," div <span class=\"k\">=</span> document<span class=\"k\">.</span>getElementById<span class=\"k\">(</span><span class=\"s\">'result'</span><span class=\"k\">);</span>"," div<span class=\"k\">.</span>innerHTML <span class=\"k\">=</span> <span class=\"s\">'&lt;p&gt;'</span> <span class=\"k\">+</span> message <span class=\"k\">+</span> <span class=\"s\">'&lt;/p&gt;'</span><span class=\"k\">;</span>"," div<span class=\"k\">.</span>innerHTML <span class=\"k\">+=</span> <span class=\"s\">'&lt;p&gt;If you are running the instrumented version of this program, you can click the \"Coverage report\" button to view a coverage report.&lt;/p&gt;'</span><span class=\"k\">;</span>","<span class=\"k\">}</span>"];

Some files were not shown because too many files have changed in this diff Show More