1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
2 |
<html> |
<html> |
3 |
<head> |
<head> |
4 |
<title>JSCoverage - help</title> |
<title>JSCoverage - FAQ</title> |
5 |
<link rel="stylesheet" type="text/css" href="reset-fonts-grids.css"> |
<link rel="stylesheet" type="text/css" href="reset-fonts-grids.css"> |
6 |
<link rel="stylesheet" type="text/css" href="style.css"> |
<link rel="stylesheet" type="text/css" href="style.css"> |
7 |
</head> |
</head> |
13 |
<div id="jscoverage-main" class="yui-b"> |
<div id="jscoverage-main" class="yui-b"> |
14 |
<h2><abbr title="Frequently Asked Questions">FAQ</abbr></h2> |
<h2><abbr title="Frequently Asked Questions">FAQ</abbr></h2> |
15 |
|
|
16 |
|
<h3>Can I use JSCoverage to measure code coverage for a page on <code>http://<var>example.com</var>/</code>?</h3> |
17 |
|
|
18 |
|
<p> |
19 |
|
In order to measure the code coverage of a page on <code>http://example.com/</code>, |
20 |
|
you must run <code>jscoverage</code> to create a <code>jscoverage.html</code> file on the |
21 |
|
<code>example.com</code> server. You cannot use <code>http://example.org/jscoverage.html</code> |
22 |
|
to measure the code coverage of a page located on <code>http://example.com/</code>. |
23 |
|
</p> |
24 |
|
|
25 |
|
<p> |
26 |
|
The fundamental reason for this limitation is the |
27 |
|
<a href="http://www.mozilla.org/projects/security/components/same-origin.html">Same Origin Policy</a> |
28 |
|
for untrusted JavaScript. |
29 |
|
</p> |
30 |
|
|
31 |
|
<p> |
32 |
|
(In fact, the current version of JSCoverage is slightly more restrictive |
33 |
|
than this: it requires that the JavaScript being measured reside under the |
34 |
|
same <strong>directory</strong> as the <code>jscoverage.html</code> file.) |
35 |
|
</p> |
36 |
|
|
37 |
|
<h3>Why doesn't my test suite run under JSCoverage in Firefox 3?</h3> |
38 |
|
|
39 |
|
<p> |
40 |
|
Firefox 3 introduces <a |
41 |
|
href="http://tech.groups.yahoo.com/group/jsunit/message/1075">new |
42 |
|
security restrictions</a> on local files. Depending on the way your |
43 |
|
test suite is organized, this may cause problems for JSCoverage. |
44 |
|
(You may get the error "uncaught exception: Permission denied to get property Window._$jscoverage".) |
45 |
|
There are several workarounds: |
46 |
|
</p> |
47 |
|
|
48 |
|
<ul class="list"> |
49 |
|
<li><p>Place your files on a web server instead of loading them from the file system. |
50 |
|
This is usually the simplest solution.</p> |
51 |
|
<li><p>Organize your HTML files in your test suite in a flat directory structure. For example, suppose that |
52 |
|
you instrument your test suite with this command:</p> |
53 |
|
<pre> |
54 |
|
jscoverage src instrumented |
55 |
|
</pre> |
56 |
|
<p>If all your HTML files are located directly under the <code>src/</code> directory (i.e., not in a |
57 |
|
subdirectory of <code>src/</code>), then you should not have any problems using Firefox 3.</p> |
58 |
|
<li><p>Set the <a href="http://kb.mozillazine.org/Editing_configuration">Firefox preference</a> named |
59 |
|
<code><a href="http://kb.mozillazine.org/Security.fileuri.origin_policy">security.fileuri.origin_policy</a></code> |
60 |
|
to 3.</p> |
61 |
|
</ul> |
62 |
|
|
63 |
<h3>I'm trying to load my code with the URL |
<h3>I'm trying to load my code with the URL |
64 |
<code>file:///C:/foo/bar/jscoverage.html?foo/bar.html</code> |
<code>file:///C:/foo/bar/jscoverage.html?foo/bar.html</code> |
65 |
and I'm getting all kinds of JavaScript errors.</h3> |
and I'm getting all kinds of JavaScript errors.</h3> |
72 |
As a workaround: |
As a workaround: |
73 |
</p> |
</p> |
74 |
<ul class="list"> |
<ul class="list"> |
75 |
<li>Place your files on a web server instead of loading them from the file system. |
<li><p>Place your files on a web server instead of loading them from the file system. |
76 |
(<code>http:</code> URLs work fine.) |
(<code>http:</code> URLs work fine.)</p> |
77 |
<li>Do not use a query string; enter your URL in the "URL" field in the "Browser" tab. |
<li><p>Do not use a query string; enter your URL in the "URL" field in the "Browser" tab.</p> |
78 |
<li>Rearrange your directory structure so that <code>bar.html</code> |
<li><p>Rearrange your directory structure so that <code>bar.html</code> |
79 |
ends up in the same directory as <code>jscoverage.html</code>; then |
ends up in the same directory as <code>jscoverage.html</code>; then |
80 |
you can use the URL |
you can use the URL |
81 |
<code>file:///C:/foo/bar/jscoverage.html?bar.html</code> |
<code>file:///C:/foo/bar/jscoverage.html?bar.html</code> |
82 |
with no slash in the query string. |
with no slash in the query string.</p> |
83 |
<li>Use a different browser. (IE 7 seems to work.) |
<li><p>Use a different browser. (IE 7 seems to work.)</p> |
84 |
</ul> |
</ul> |
85 |
|
|
86 |
<h3>JSCoverage changes my cursor to a busy cursor, and it never changes back!</h3> |
<h3>JSCoverage changes my cursor to a busy cursor, and it never changes back!</h3> |
101 |
(More information <a href="http://ajaxian.com/archives/garbage-collection-in-ie6">here</a>.) |
(More information <a href="http://ajaxian.com/archives/garbage-collection-in-ie6">here</a>.) |
102 |
</p> |
</p> |
103 |
|
|
104 |
<h3>Can JSCoverage be used with <a href="http://www.jsunit.net/">JsUnit</a>?</h3> |
<h3 id="jsunit">Can JSCoverage be used with <a href="http://www.jsunit.net/">JsUnit</a>?</h3> |
105 |
|
|
106 |
<p> |
<p> |
107 |
It is necessary to run JSCoverage in <dfn>inverted mode</dfn>. You will have to |
It is necessary to run JSCoverage in <dfn>inverted mode</dfn>. You will have to |
127 |
</p> |
</p> |
128 |
|
|
129 |
<pre> |
<pre> |
130 |
http://127.0.0.1/jsunit/testRunner.html?testPage=http://127.0.0.1/test.html&autorun=true |
http://127.0.0.1/jsunit/testRunner.html?testPage=http://127.0.0.1/test.html&autoRun=true |
131 |
</pre> |
</pre> |
132 |
|
|
133 |
<p> |
<p> |
143 |
<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="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> |
144 |
<li><a href="manual.html">Documentation</a> |
<li><a href="manual.html">Documentation</a> |
145 |
<li><a href="demo.html">Demo</a> |
<li><a href="demo.html">Demo</a> |
146 |
<li><a href="download.html">Download</a> |
<li><a href="http://siliconforks.com/jscoverage/download.html">Download</a> |
147 |
<li>FAQ |
<li>FAQ |
148 |
<li><a href="help.html">Help</a> |
<li><a href="help.html">Help</a> |
149 |
<li><a href="license.html">License</a> |
<li><a href="license.html">License</a> |
150 |
<li><a href="links.html">Links</a> |
<li><a href="links.html">Links</a> |
151 |
|
<li><a href="users.html">Users</a> |
152 |
|
<li><a href="http://siliconforks.com/jscoverage/bugs/">Bug tracker</a> |
153 |
</ul> |
</ul> |
154 |
</div> |
</div> |
155 |
</div> |
</div> |
156 |
<div id="ft"> |
<div id="ft"> |
157 |
<address> |
<address> |
158 |
Copyright © 2007 siliconforks.com<br> |
Copyright © 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> |
|
Last updated August 15, 2007<br> |
|
159 |
<a href="mailto:jscoverage@siliconforks.com">jscoverage@siliconforks.com</a> |
<a href="mailto:jscoverage@siliconforks.com">jscoverage@siliconforks.com</a> |
160 |
</address> |
</address> |
161 |
</div> |
</div> |