XMLHttpRequest.open uncaught exception error after JM merge

Ask for help about NoScript, no registration needed to post
D A

XMLHttpRequest.open uncaught exception error after JM merge

Post 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.
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b7pre) Gecko/20100918 Firefox/4.0b7pre
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: XMLHttpRequest.open uncaught exception error after JM me

Post by Giorgio Maone »

Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10
D A

Re: XMLHttpRequest.open uncaught exception error after JM me

Post 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"]
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b7pre) Gecko/20100918 Firefox/4.0b7pre
User avatar
Giorgio Maone
Site Admin
Posts: 9524
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: XMLHttpRequest.open uncaught exception error after JM me

Post 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.
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10
Post Reply