Closed
Bug 392338
Opened 18 years ago
Closed 18 years ago
[FIX]Request created via document.load causes Component does not have requested interface arg 0 [nsIHttpChannel.notificationCallbacks]
Categories
(Core :: XML, defect)
Core
XML
Tracking
()
RESOLVED
FIXED
People
(Reporter: colin, Assigned: bzbarsky)
Details
Attachments
(2 files)
1.96 KB,
text/plain
|
Details | |
7.52 KB,
patch
|
mrbkap
:
review+
jst
:
superreview+
mtschrep
:
approval1.9+
|
Details | Diff | Splinter Review |
This is somewhat similar to bug 317448. The difference is that instead of creating the request via
XMLHTTPRequest it is created via document.implementation.createDocument. Any, a request for an XML
document is created but when we try to access channel.notificationCallbacks (for example in
http-on-modify-request observer) we get:
Component does not have requested interface arg 0 [nsIHttpChannel.notificationCallbacks]
![]() |
Assignee | |
Comment 1•18 years ago
|
||
createDocument() doesn't do HTTP requests. What's this bug actually about?
Reporter | ||
Comment 2•18 years ago
|
||
I was referring to client-side JS which initiates XML requests using this technique:
var doc = document.implementation.createDocument("", "", null);
doc.addEventListener("load", myListener, false);
doc.load(aURL, "application/xml");
![]() |
Assignee | |
Comment 3•18 years ago
|
||
Care to attach a testcase that shows the problem, then? I'm working on a fix, but I need a way to test.
Updated•18 years ago
|
Summary: Request created via document.implementation.createDocument causes Component does not have requested interface arg 0 [nsIHttpChannel.notificationCallbacks] → Request created via document.load causes Component does not have requested interface arg 0 [nsIHttpChannel.notificationCallbacks]
![]() |
Assignee | |
Comment 4•18 years ago
|
||
Ideally, a chrome mochitest. That is a file to be run as -chrome that performs the test and follows <http://developer.mozilla.org/en/docs/Mochitest>. But if it's easier, just a JS snippet to run in the Firefox window (see http://developer.mozilla.org/en/docs/Browser_chrome_tests).
Reporter | ||
Comment 5•18 years ago
|
||
Sorry this is not a self contained example, but our builds don't have mochitest. Heck, we don't even pull the
testing directory. The attached file contains some js which I just appended to one of our js components so that
it gets loaded when our product starts up. The js just installs an http-on-modify-request observer which then
attempts to get nsIXMLHttpRequest from the notification callbacks, logging progress to the js error console.
Fire up venkman and create an XMLHTTPRequest and you'll see (on the error console) that we can
access the nsIXMLHttpRequest:
xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
xmlhttp.open("GET","http://localhost/xmlnote1.xml",true); // insert valid URL
xmlhttp.send(null);
Create an XML request using createDocument/load and you'll see the exception:
xmlDoc = document.implementation.createDocument("","",null);
xmlDoc.load("http://localhost/xmlnote2.xml");
![]() |
Assignee | |
Comment 6•18 years ago
|
||
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #294926 -
Flags: superreview?(jst)
Attachment #294926 -
Flags: review?(mrbkap)
![]() |
Assignee | |
Updated•18 years ago
|
OS: Windows XP → All
Hardware: PC → All
Summary: Request created via document.load causes Component does not have requested interface arg 0 [nsIHttpChannel.notificationCallbacks] → [FIX]Request created via document.load causes Component does not have requested interface arg 0 [nsIHttpChannel.notificationCallbacks]
Version: 1.8 Branch → Trunk
Comment 7•18 years ago
|
||
bz, care to explain this bug and how your patch fixes it? In general, I'm really not keen on flagging more things as noAccess, at least not unless there's no other way...
![]() |
Assignee | |
Comment 8•18 years ago
|
||
The bug here is that the XMLDocument is set as the notification callbacks on the channel, and implements nsIInterfaceRequestor, and QIs to it, but does NOT expose it in classinfo. Which means XPConnect throws when you try to get the callbacks from the channel, because it thinks it can't create the wrapper.
So the fix is the classinfo change. The other changes are just there for reasons similar to bug 317448. If we think it's safe to let web script call getInterface in this case, we can not add the noAccess lines.
The other option would be to use a shim interface requestor object here with no classinfo (so that untrusted script couldn't get at it no matter what), and leave nsIInterfaceRequestor out of the XMLDocument classinfo...
Comment 9•18 years ago
|
||
Comment on attachment 294926 [details] [diff] [review]
Fix plus test
Ok, let's do this w/o the noAccess changes then. sr=jst with that removed.
Attachment #294926 -
Flags: superreview?(jst) → superreview+
Updated•18 years ago
|
Attachment #294926 -
Flags: review?(mrbkap) → review+
Reporter | ||
Comment 10•18 years ago
|
||
FYI: I applied the patch to our code base here and it fixed the problem. Thanks!
![]() |
Assignee | |
Comment 11•18 years ago
|
||
Comment on attachment 294926 [details] [diff] [review]
Fix plus test
Looking for approval. This makes it possible to hook properly into XMLDocument.load loads from extensions.
Attachment #294926 -
Flags: approval1.9?
Updated•18 years ago
|
Attachment #294926 -
Flags: approval1.9? → approval1.9+
![]() |
Assignee | |
Comment 12•18 years ago
|
||
Checked in without the all.js changes.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
FWIW. I'm planning on killing the test added here. It no longer works since we have no need to add any .notificationCallbacks any more since we can enforce same-origin through other means.
Looking at the patch, the bug was in code that's dead these days anyway?
You need to log in
before you can comment on or make changes to this bug.
Description
•