downthemall / anticontainer

DownThemAll! AntiContainer (Extension to a Firefox, Seamonkey extension)
Mozilla Public License 2.0
93 stars 41 forks source link

Creating XMLHttpRequest in sandbox throws error #52

Closed poke closed 12 years ago

poke commented 12 years ago

When calling new XMLHttpRequest from within a sandbox plugin, the following exception is raised:

Error: [Exception... "Failure"
    nsresult: "0x80004005 (NS_ERROR_FAILURE)"
    location: "JS frame :: resource://dtaac/sandboxfactories.jsm :: XMLHttpRequest_WRAP :: line 55"
    data: no]
Source File: resource://dtaac/sandboxfactories.jsm
Line: 55

The line in question is within the constructor of the wrapped XHR, where the inner XHR object is instantiated. Apparently the constructor throws an exception:

this._xhr = new XMLHttpRequest();

I tried to figure out why it happens, but I’m a bit lost now. The constructor XMLHttpRequest itself is available; and many related problems on the web with that error code say it’s cross-site-related, but by the time the line gets executed there’s no information about any URL yet.

nmaier commented 12 years ago

Are you on Nightly by chance?

nmaier commented 12 years ago

Nightly bug: https://bugzilla.mozilla.org/show_bug.cgi?id=741367

poke commented 12 years ago

Good catch! I keep forgetting that I should expect such issues in Nightly (it works so well most of the time ^^). Guess I should install Aurora for testing as well.

nmaier commented 12 years ago

I had stumbled upon this problem in other extensions and already had a TODO to find an existing bug or otherwise track down the culprit and file one myself. Actually quite a few extensions are affected :p Closing this issue now as I expect this will be fixed in m-c directly. In the unlikely case the bug makes it into m-a, then we may re-evaluate that decision.

poke commented 12 years ago

Just a quick note: It works perfectly in Aurora, and after fixing the plugin a bit more, that works perfect as well ;)