Bug 568564. Suppress the script filename for cross-origin onerror events. Patch by Boris Zbarsky <bzbarsky@mit.edu>, r=jst, a1.9.0.next=dveditz
git-svn-id: svn://10.0.0.236/trunk@260880 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
7095da4fbc
commit
b31208c5bf
@ -17,21 +17,31 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=461735
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
var errorFired = false;
|
||||
window.onerror = function(message, uri, line) {
|
||||
is(message, "Script error.", "Should have empty error message");
|
||||
is(uri, "http://example.com/tests/content/base/test/bug461735-post-redirect.js", "Unexpected error location URI");
|
||||
is(uri, "", "Should have empty error location URI");
|
||||
is(line, 0, "Shouldn't have a line here");
|
||||
errorFired = true;
|
||||
}
|
||||
</script>
|
||||
<script src="bug461735-redirect1.sjs"></script>
|
||||
<script>
|
||||
is(errorFired, true, "Should have error in redirected different origin script");
|
||||
errorFired = false;
|
||||
</script>
|
||||
<script type="application/javascript">
|
||||
window.onerror = function(message, uri, line) {
|
||||
is(message, "c is not defined", "Should have correct error message");
|
||||
is(uri, "http://localhost:8888/tests/content/base/test/bug461735-post-redirect.js", "Unexpected error location URI");
|
||||
is(line, 3, "Should have a line here");
|
||||
errorFired = true;
|
||||
}
|
||||
</script>
|
||||
<script src="bug461735-redirect2.sjs"></script>
|
||||
<script>
|
||||
is(errorFired, true, "Should have error in same origin script");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -480,6 +480,13 @@ public:
|
||||
NS_WARNING("Not same origin error!");
|
||||
errorevent.errorMsg = xoriginMsg.get();
|
||||
errorevent.lineNr = 0;
|
||||
// FIXME: once the principal of the script is not tied to
|
||||
// the filename, we can stop using the post-redirect
|
||||
// filename if we want and remove this line. Note that
|
||||
// apparently we can't handle null filenames in the error
|
||||
// event dispatching code.
|
||||
static PRUnichar nullFilename[] = { PRUnichar(0) };
|
||||
errorevent.fileName = nullFilename;
|
||||
}
|
||||
|
||||
nsEventDispatcher::Dispatch(win, presContext, &errorevent, nsnull,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user