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>I'm trying to load my code with the URL |
<h3>I'm trying to load my code with the URL |
38 |
<code>file:///C:/foo/bar/jscoverage.html?foo/bar.html</code> |
<code>file:///C:/foo/bar/jscoverage.html?foo/bar.html</code> |
39 |
and I'm getting all kinds of JavaScript errors.</h3> |
and I'm getting all kinds of JavaScript errors.</h3> |