Page 1 of 1

XMLHttpRequest.open uncaught exception error after JM merge

Posted: Sat Sep 18, 2010 5:39 pm
by D A
See this testcase{/url] for [url=https://bugzilla.mozilla.org/show_bug.cgi?id=595917]bug 595917,

It will give the following error in the error console:

Code: Select all

Error: uncaught exception: [Exception... "Component returned failure code:
0x805e0006 [nsIXMLHttpRequest.open]"  nsresult: "0x805e0006 (<unknown>)" 
location: "JS frame :: http://people.mozilla.org/~shaver/router-error-test.html
:: test :: line 10"  data: no]
The testcase can be simplified even further to this:

Code: Select all

var req = new XMLHttpRequest();
req.open("GET", "data:,Hello%2C%20World!", false);
It will give the same error message to the full test case.

Re: XMLHttpRequest.open uncaught exception error after JM me

Posted: Sat Sep 18, 2010 7:28 pm
by Giorgio Maone

Re: XMLHttpRequest.open uncaught exception error after JM me

Posted: Sat Sep 18, 2010 8:05 pm
by D A
This happens in the latest development build too.

I've been able to track down the problem a little further:

This will fail with NoScript:

Code: Select all

req.open("GET", "data:text/plain,0123", false);
This too:

Code: Select all

req.open("GET", "data:,0123", false);
This however will not (is this data URI even valid?):

Code: Select all

req.open("GET", "data,0123", false);
Nor will this fail (assuming test.txt exists, this however won't cause the error below):

Code: Select all

req.open("GET", "test.txt", false);
{/code]

This problem started when JM was merged into TM (and later M-C).

If NoScript isn't installed or not the 3rd code example is used this error message with show up (this error isn't related to NoScript itself):
[code]Error: uncaught exception: [Exception... "Access to restricted URI denied" 
code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"  location:
"http://192.168.1.1/ajax.js Line: 117"]

Re: XMLHttpRequest.open uncaught exception error after JM me

Posted: Sat Sep 18, 2010 8:26 pm
by Giorgio Maone
OK, this seems to be caused by NoScript, but it's not a bug and has nothing to do with JM.
http://evil.hackademix.net/test/xhr/data.html fails with NoScript both on Firefox 3.6.10 (no JM) and in latest Minefield, just because NoScript prevents cross-site XHR unless the target is in the whitelist, and data: URIs are considered untrusted.
I might consider changing that (i.e. allowing XHR to load data: URIs), but I doubt this would be useful because the load will be prevented anyway on send() by Firefox itself.

On a side note, "data,0123" succeed because it's not a data: URI, but just a relative URL resolving against page's origin.