Closed Bug 255589 Opened 20 years ago Closed 20 years ago

calling nsIFileOuputStream fails with NS_ERROR_XPC_BAD_IID

Categories

(Core :: XPConnect, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: jstritar, Assigned: dbradley)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040813 Firefox/0.9.1+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040813 Firefox/0.9.1+

Whenever you try to get an nsIFileOutputStream object by doing something like
Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOuputStream),
it fails with this error in the javascript console:



Reproducible: Always
Steps to Reproduce:
1. execute
Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOuputStream)
in a script or in the JavaScript console.

Actual Results:  
Error: uncaught exception: [Exception... "Component returned failure code:
0x80570018 (NS_ERROR_XPC_BAD_IID) [nsIJSCID.createInstance]"  nsresult:
"0x80570018 (NS_ERROR_XPC_BAD_IID)"  location: "JS frame :: javascript:
Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOuputStream);
:: <TOP_LEVEL> :: line 1"  data: no]


When I try
Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance().QueryInterface(Components.interfaces.nsIFileOuputStream)
it also fails with:
 Error: uncaught exception: [Exception... "Could not convert JavaScript argument
(NULL value cannot be used for a C++ reference type) arg 0
[nsISupports.QueryInterface]"  nsresult: "0x8057000b
(NS_ERROR_XPC_BAD_CONVERT_JS_NULL_REF)"  location: "JS frame :: javascript:
Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance().QueryInterface(Components.interfaces.nsIFileOuputStream)
:: <TOP_LEVEL> :: line 1"  data: no]

I tried this on the 8/13/04 nightly, as well as 0.9.3 on two different windows
machines.
I worked with Jon on this a bit on IRC, and if you
alert(Components.interfaces.nsIFileOutputStream) you get "nsIFileOutputStream",
so it's not just that the xpt file is missing or something obvious.
Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOuputStream)

s/nsIFileOuputStream/nsIFileOutputStream/

???

INVALID as written.  use the correct interface name ;-)

please reopen if that was just a typo.  it worksforme if i correct the interface
name.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.