Closed Bug 42750 Opened 24 years ago Closed 24 years ago

"No Components in scope" xpconnect error on first download attempt

Categories

(Core :: XPConnect, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: jrgmorrison, Assigned: jband_mozilla)

References

()

Details

(Keywords: crash, topcrash, Whiteboard: [dogfood+][nsbeta2+])

Attachments

(1 file)

Overview Description:

  win32 & mac : HTTP download of a binary file fails the first time it
               is attempted (but succeeds on the second attempt)
  linux : HTTP download of a binary file fails the first time, but
          crashes on the second attempt.

  Sending this to Networking, but this may be XPConnect (cc: mccabe).

Steps to Reproduce:

1) start mozilla and go to 
     http://www.mozilla.org/projects/seamonkey/release-notes/
2) click the hyperlink for a '.zip' or '.exe' file
3) accept the default filename and download location from the filepicker

(When the first attempt fails, repeat 2 & 3 above.)

Actual Results:
  First time: 
    win,mac,linux : the download progress dialog comes up, but makes 
                    no progress
 
    On windows, this exception is thrown: 

JavaScript error: line 0: uncaught exception: [Exception... "Could not convert 
Native argument arg 0 [nsIStreamTransferOperation.source]"  nsresult: 
"0x8057000a (NS_ERROR_XPC_BAD_CONVERT_NATIVE)"  location: "JS frame :: 
chrome://global/content/downloadProgress.js :: loadDialog :: line 28"  data: 
no]

    On linux, this assertion, then exception, is thrown: 

###!!! ASSERTION: No 'Components' in scope!: '0', file 
xpcwrappednativescope.cpp, 
       line 115
###!!! Break: at file xpcwrappednativescope.cpp, line 115
JavaScript error: 
 line 0: uncaught exception: [Exception... " arg 0 
[nsIStreamTransferOperation.source]"  nsresult: "0x8057000a (<unknown>)"  
location: "JS frame :: chrome://global/content/downloadProgress.js :: 
loadDialog :: line 28"  data: no]

  Second time: 
    win,mac : download succeeds (no errors)

    linux   : throws up and alert that says "Unknown error". When 
              this alert is dismissed, mozilla then crashes

Expected Results:
  Download the file.

Reproducibility: always

Build Date & Platform Bug Found:
  20000615nn win32,mac and linux comm. opt. builds

Additional Builds and Platforms Tested On: 
  A debug linux build from 6/14 3pm

Additional Information:

This is a lightly edited version of the console messages on linux,
followed with a stack trace for the crash (build from 06/14 3pm)

This is reproducable in today's release builds on linux. 

------- click on the line for an .exe file ----------


###!!! ASSERTION: 
NS_ENSURE_TRUE(NS_SUCCEEDED(mDocShell->CreateContentViewer(aContentType, 
aOpenedChannel, aContentHandler))) failed: 
'(!((mDocShell->CreateContentViewer(aContentType, aOpenedChannel, 
aContentHandler)) & 0x80000000))', file nsDSURIContentListener.cpp, line 100
###!!! Break: at file nsDSURIContentListener.cpp, line 100
nsUnknownContentTypeHandler component created
WEBSHELL+ = 5
###!!! ASSERTION: OnDataAvailable fired after OnStopRequest: 'mOnStopFired == 
PR_FALSE', file nsHTTPResponseListener.cpp, line 1227
###!!! Break: at file nsHTTPResponseListener.cpp, line 1227
Document: Done (1.394 secs)
Error loading URL 
http://ftp.mozilla.org/pub/mozilla/releases/m16/mozilla-win32-installer-M16.exe 
nsStreamTransfer component created
-*- filepicker: CI: {c47de916-1dd1-11b2-8141-82507fa02b21}
-*- filepicker: IID:nsIFilePicker
nsIDOMWindow id value = {a6cf906b-15b3-11d2-932e-00805f8add32}
WEBSHELL+ = 6
WEBSHELL- = 5

result native path = //mozilla-win32-installer-M16.exe

WEBSHELL+ = 6
WEBSHELL- = 5

------ Yikes, no Components ?? ---------

###!!! ASSERTION: No 'Components' in scope!: '0', file 
xpcwrappednativescope.cpp, line 115
###!!! Break: at file xpcwrappednativescope.cpp, line 115
JavaScript error: 
 line 0: uncaught exception: [Exception... " arg 0 
[nsIStreamTransferOperation.source]"  nsresult: "0x8057000a (<unknown>)"  
location: "JS frame :: chrome://global/content/downloadProgress.js :: 
loadDialog :: line 28"  data: no]

WEBSHELL- = 4

------- try to download a second time ---------

###!!! ASSERTION: 
NS_ENSURE_TRUE(NS_SUCCEEDED(mDocShell->CreateContentViewer(aContentType, 
aOpenedChannel, aContentHandler))) failed: 
'(!((mDocShell->CreateContentViewer(aContentType, aOpenedChannel, 
aContentHandler)) & 0x80000000))', file nsDSURIContentListener.cpp, line 100
###!!! Break: at file nsDSURIContentListener.cpp, line 100
WEBSHELL+ = 5
###!!! ASSERTION: OnDataAvailable fired after OnStopRequest: 'mOnStopFired == 
PR_FALSE', file nsHTTPResponseListener.cpp, line 1227
###!!! Break: at file nsHTTPResponseListener.cpp, line 1227
Document: Done (0.559 secs)
Error loading URL 
http://ftp.mozilla.org/pub/mozilla/releases/m16/mozilla-win32-installer-M16.exe 
-*- filepicker: CI: {c47de916-1dd1-11b2-8141-82507fa02b21}
-*- filepicker: IID:nsIFilePicker
nsIDOMWindow id value = {a6cf906b-15b3-11d2-932e-00805f8add32}
WEBSHELL+ = 6
WEBSHELL- = 5

result native path = //mozilla-win32-installer-M16.exe

WEBSHELL+ = 6
WEBSHELL- = 5
WEBSHELL+ = 6
WEBSHELL- = 5
WEBSHELL- = 4

Program received signal SIGSEGV, Segmentation fault.
0x4069e7f6 in nsXPCWrappedJSClass::GetInterfaceName (this=0x42b1ed30)
    at xpcwrappedjsclass.cpp:1102
1102            mInfo->GetName(&mName);
(gdb) list
1097    
1098    const char*
1099    nsXPCWrappedJSClass::GetInterfaceName()
1100    {
1101        if(!mName)
1102            mInfo->GetName(&mName);
1103        return mName;
1104    }
1105    
1106    JSObject*
(gdb) frame 1
#1  0x4069d7f4 in nsXPCWrappedJSClass::CallMethod (this=0x42b1ed30, 
    wrapper=0x42b1ed60, methodIndex=3, info=0x429d87e0, 
    nativeParams=0xbffff1a8) at xpcwrappedjsclass.cpp:780
780                                                         GetInterfaceName(), 
name);
(gdb) list
775         /* JS might throw an expection whether the reporter was called or 
not */
776         if(JS_GetPendingException(cx, &js_exception))

777         {
778             if(!xpc_exception)
779                 xpc_exception = XPCConvert::JSValToXPCException(cx, 
js_exception,
780                                                         GetInterfaceName(), 
name);
781     
782             /* cleanup and set failed even if we can't build an exception 
*/
783             if(!xpc_exception)
784             {
(gdb) bt
#0  0x4069e7f6 in nsXPCWrappedJSClass::GetInterfaceName (this=0x42b1ed30)
    at xpcwrappedjsclass.cpp:1102
#1  0x4069d7f4 in nsXPCWrappedJSClass::CallMethod (this=0x42b1ed30, 
    wrapper=0x42b1ed60, methodIndex=3, info=0x429d87e0, 
    nativeParams=0xbffff1a8) at xpcwrappedjsclass.cpp:780
#2  0x4069b53e in nsXPCWrappedJS::CallMethod (this=0x42b1ed60, methodIndex=3, 
    info=0x429d87e0, params=0xbffff1a8) at xpcwrappedjs.cpp:309
#3  0x40132304 in PrepareAndDispatch (self=0x42b1ed60, methodIndex=3, 
    args=0xbffff260) at xptcstubs_unixish_x86.cpp:92
#4  0x401323de in nsXPTCStubBase::Stub3 (this=0x42b1ed60)
    at ../../../../../../dist/include/xptcstubsdef.inc:5
#5  0x41f3e8f7 in nsStreamXferOp::OnError (this=0x42b04400, operation=3, 
    errorCode=2147500037) at nsStreamXferOp.cpp:144
#6  0x41f3ef2f in nsStreamXferOp::OnStartRequest (this=0x42b04400, 
    channel=0x42b04708, aContext=0x0) at nsStreamXferOp.cpp:285
#7  0x40e67dd3 in nsHTTPFinalListener::OnStartRequest (this=0x42b1ee70, 
    aChannel=0x42b04708, aContext=0x0) at nsHTTPResponseListener.cpp:1167
#8  0x40e37ff1 in InterceptStreamListener::OnStartRequest (this=0x429b6878, 
    channel=0x42b04708, ctxt=0x0) at nsCachedNetData.cpp:1139
#9  0x40e678d6 in nsHTTPServerListener::FinishedResponseHeaders (
    this=0x42b3d548) at nsHTTPResponseListener.cpp:1093
#10 0x40e65b59 in nsHTTPServerListener::OnDataAvailable (this=0x42b3d548, 
    channel=0x42b1e66c, context=0x42b04708, i_pStream=0x4292071c, 
    i_SourceOffset=0, i_Length=7886) at nsHTTPResponseListener.cpp:427
#11 0x40e0241f in nsOnDataAvailableEvent::HandleEvent (this=0x80c6348)
    at nsAsyncStreamListener.cpp:406
#12 0x40e016a7 in nsStreamListenerEvent::HandlePLEvent (aEvent=0x8148ad0)
    at nsAsyncStreamListener.cpp:97
#13 0x4011419e in PL_HandleEvent (self=0x8148ad0) at plevent.c:575
#14 0x4011404c in PL_ProcessPendingEvents (self=0x810db98) at plevent.c:520
#15 0x40115dd9 in nsEventQueueImpl::ProcessPendingEvents (this=0x8121368)
    at nsEventQueue.cpp:356
#16 0x40a38424 in event_processor_callback (data=0x8121368, source=9, 
    condition=GDK_INPUT_READ) at nsAppShell.cpp:158
#17 0x40a3805f in our_gdk_io_invoke (source=0x40fa93d8, condition=G_IO_IN, 
    data=0x40fa50e0) at nsAppShell.cpp:58
#18 0x40c0152a in g_io_unix_dispatch () from /usr/lib/libglib-1.2.so.0
#19 0x40c02be6 in g_main_dispatch () from /usr/lib/libglib-1.2.so.0
#20 0x40c031a1 in g_main_iterate () from /usr/lib/libglib-1.2.so.0
#21 0x40c03341 in g_main_run () from /usr/lib/libglib-1.2.so.0
#22 0x40b2a209 in gtk_main () from /usr/lib/libgtk-1.2.so.0
#23 0x40a38b1a in nsAppShell::Run (this=0x80645f8) at nsAppShell.cpp:334
#24 0x4070b9d4 in nsAppShellService::Run (this=0x811dfa8)
    at nsAppShellService.cpp:386
#25 0x8053ab9 in main1 (argc=2, argv=0xbffffa84, nativeApp=0x0)
    at nsAppRunner.cpp:906
#26 0x805419e in main (argc=2, argv=0xbffffa84) at nsAppRunner.cpp:1092
(gdb)
looks like Bill's progress dialog box. 
Assignee: gagan → law
Yeah, looks like Bill's file progress dialog box is exposing yet another bug in 
Necko :-).

Seriously, I don't think it's Necko this time :-).

Something is horked in JS.  I guess I'll have to figure out what's happening and 
route this to the appropriate party.  I've heard a rumor of another odd JS 
window loading error that danm is working on; maybe it's all the same bug.
Status: NEW → ASSIGNED
Here's the call stack when I hit the "Components not in scope" assertion:

NTDLL! 77f76148()
nsDebug::Assertion(const char * 0x00fd4828, const char * 0x00fd4824, const char 
* 0x00fd47e8, int 0x00000073) line 242 + 13 bytes
nsXPCWrappedNativeScope::FindInJSObjectScope(XPCContext * 0x0322ec50, JSObject * 
0x02998c98) line 115 + 32 bytes
XPCConvert::NativeInterface2JSObject(JSContext * 0x031fde90, 
nsIXPConnectJSObjectHolder * * 0x0012e1ac, nsISupports * 0x031ecf30, const nsID 
* 0x032af1d0, JSObject * 0x0299f080, unsigned int * 0x0012e3f4) line 774 + 36 
bytes
XPCConvert::NativeData2JS(JSContext * 0x031fde90, long * 0x0012e2ac, const void 
* 0x0012e364, const nsXPTType & {...}, const nsID * 0x032af1d0, JSObject * 
0x0299f080, unsigned int * 0x0012e3f4) line 382 + 49 bytes
nsXPCWrappedNativeClass::CallWrappedMethod(JSContext * 0x031fde90, 
nsXPCWrappedNative * 0x031fbac0, const XPCNativeMemberDescriptor * 0x031fa3d4, 
nsXPCWrappedNativeClass::CallMode CALL_GETTER, unsigned int 0x00000000, long * 
0x00000000, long * 0x0012ec00) line 1000 + 47 bytes
nsXPCWrappedNativeClass::GetAttributeAsJSVal(JSContext * 0x031fde90, 
nsXPCWrappedNative * 0x031fbac0, const XPCNativeMemberDescriptor * 0x031fa3d4, 
long * 0x0012ec00) line 893
WrappedNative_GetProperty(JSContext * 0x031fde90, JSObject * 0x0299f080, long 
0x00d3eb90, long * 0x0012ec00) line 244 + 24 bytes
js_Interpret(JSContext * 0x031fde90, long * 0x0012ed88) line 2348 + 1446 bytes
js_Invoke(JSContext * 0x031fde90, unsigned int 0x00000001, unsigned int 
0x00000002) line 702 + 13 bytes
js_InternalInvoke(JSContext * 0x031fde90, JSObject * 0x0299f088, long 
0x029983f0, unsigned int 0x00000000, unsigned int 0x00000001, long * 0x0012ef20, 
long * 0x0012eec0) line 775 + 19 bytes
JS_CallFunctionValue(JSContext * 0x031fde90, JSObject * 0x0299f088, long 
0x029983f0, unsigned int 0x00000001, long * 0x0012ef20, long * 0x0012eec0) line 
2801 + 31 bytes
nsJSContext::CallEventHandler(nsJSContext * const 0x031fca30, void * 0x0299f088, 
void * 0x029983f0, unsigned int 0x00000001, void * 0x0012ef20, int * 0x0012ef1c, 
int 0x00000000) line 788 + 33 bytes
nsJSEventListener::HandleEvent(nsIDOMEvent * 0x032adea4) line 154 + 64 bytes
nsEventListenerManager::HandleEventSubType(nsListenerStruct * 0x03287930, 
nsIDOMEvent * 0x032adea4, nsIDOMEventTarget * 0x031fcaa0, unsigned int 
0x00000001, unsigned int 0x00000007) line 754 + 19 bytes
nsEventListenerManager::HandleEvent(nsIPresContext * 0x03231890, nsEvent * 
0x0012fa54, nsIDOMEvent * * 0x0012f3f8, nsIDOMEventTarget * 0x031fcaa0, unsigned 
int 0x00000007, nsEventStatus * 0x0012fa94) line 1323 + 39 bytes
GlobalWindowImpl::HandleDOMEvent(GlobalWindowImpl * const 0x031fca90, 
nsIPresContext * 0x03231890, nsEvent * 0x0012fa54, nsIDOMEvent * * 0x0012f3f8, 
unsigned int 0x00000001, nsEventStatus * 0x0012fa94) line 413
nsWebShell::OnEndDocumentLoad(nsWebShell * const 0x031fb1a4, nsIDocumentLoader * 
0x031fcf40, nsIChannel * 0x0322e0d0, unsigned int 0x00000000) line 1153 + 56 
bytes
nsDocLoaderImpl::FireOnEndDocumentLoad(nsDocLoaderImpl * 0x031fcf40, nsIChannel 
* 0x0322e0d0, unsigned int 0x00000000) line 712
nsDocLoaderImpl::DocLoaderIsEmpty(unsigned int 0x00000000) line 542
nsDocLoaderImpl::OnStopRequest(nsDocLoaderImpl * const 0x031fcf44, nsIChannel * 
0x03288650, nsISupports * 0x00000000, unsigned int 0x00000000, const unsigned 
short * 0x00000000) line 485
nsLoadGroup::RemoveChannel(nsLoadGroup * const 0x031fcee0, nsIChannel * 
0x03288650, nsISupports * 0x00000000, unsigned int 0x00000000, const unsigned 
short * 0x00000000) line 544 + 39 bytes
nsFileChannel::OnStopRequest(nsFileChannel * const 0x03288658, nsIChannel * 
0x032882c0, nsISupports * 0x00000000, unsigned int 0x00000000, const unsigned 
short * 0x00000000) line 644
nsOnStopRequestEvent::HandleEvent(nsOnStopRequestEvent * const 0x03289ef0) line 
307
nsStreamListenerEvent::HandlePLEvent(PLEvent * 0x03289860) line 97 + 12 bytes
PL_HandleEvent(PLEvent * 0x03289860) line 575 + 10 bytes
PL_ProcessPendingEvents(PLEventQueue * 0x010e09a0) line 520 + 9 bytes
_md_EventReceiverProc(HWND__ * 0x00bc04a4, unsigned int 0x0000c0d9, unsigned int 
0x00000000, long 0x010e09a0) line 1032 + 9 bytes
USER32! 77e713ed()
010e09a0()
And here's the console at the same point:

nsStreamTransfer component created

Setting display directory to C:\WINNT\Profiles\law\Desktop\

WARNING: Error: possible unintended null in string, file e:\mozilla\xpcom\ds\nsS
tring.cpp, line 928

File picker result = 0x0000


result native path = C:\WINNT\Profiles\law\Desktop\big.xxx


browser.download.dir has been reset

WEBSHELL+ = 5
WEBSHELL- = 4
###!!! ASSERTION: No 'Components' in scope!: '0', file e:\mozilla\js\src\xpconne
ct\src\xpcwrappednativescope.cpp, line 115
###!!! Break: at file e:\mozilla\js\src\xpconnect\src\xpcwrappednativescope.cpp,
 line 115
per law's comments above cc'ng the big dan!
Here's my theory:

nsStreamTransfer::SelectFile has been called and has returned (we see its output 
on the console but it isn't on the call stack).  That function is called from 
nsStreamTransfer::SelectFileAndTransferLocation, which has also completed (it 
ain't on the stack, either).  That function opens a new dialog which kicks off a 
complex sequence of asynchronous events, culminating in completion of the 
document load and invocation of the dialogs onload handler.

That has happened (I believe; see the stack entries in the neighborhood of 
GlobalWindowImpl::HandleDOMEvent) and the onload handler is executing 
(presumably).  That code does this: "data.observer = observer" where data is an 
xpconnect wrapper for a nsStreamXferOp object.  So it is trying to call, via 
xpconnect nsStreamXferOp::SetObserver.

Note that there is no reference to "Components" in downloadProgress.js.  My 
theory is that xpconnect references Components when trying to call the 
nsStreamXferOp method (either SetObserver or Start).  More likely the former 
since it actually has an argument.

Why this fails is the question at hand.  I'm reassigning to the XPConnect 
component.  Note that I've got a slightly modified 
nsStreamTransfer/nsStreamXferOp implementation (but identical, for all intents 
and purposes) up to this point.  If you encounter a different scenario and need 
assistance understanding the stream-xfer aspects of it, please don't hesitate to 
ask.
Assignee: law → jband
Status: ASSIGNED → NEW
Component: Networking → XPConnect
QA Contact: tever → rginda
Adding danm back to cc: list (lost due to mid-air collision).
*** Bug 42853 has been marked as a duplicate of this bug. ***
this sounds rather similar to bug 42155... could this be a dup? or not, they
certainly sound related.

adding dogfood kw and nominating for beta2. this is pretty serious, as it
prevents many downloads. for example, i cannot download from download.com,
c|net's site:

1. try to download Doom for linux at
http://download.cnet.com/downloads/0-10143-100-902777.html?tag=st.dl.10143_106_1.lst.td
2. click the "Download Now" link.
3. when the Unknown File Type dialog appears, click the Save As... button.
4. when the filepicker (Save File) appears, click its OK button.

result: watch how the progress bar never updates --nothing gets downloaded, and
i get the console error in JavaScript that jrgm originally reported. and, as
jrgm had said --if i try this again on linux, the browser crashes.
Severity: normal → critical
Keywords: crash, dogfood, nsbeta2
*** Bug 42155 has been marked as a duplicate of this bug. ***
Putting on [dogfood+] radar.
Whiteboard: [dogfood+]
Making nsbeta2+
Whiteboard: [dogfood+] → [dogfood+][nsbeta2+]
jband is on sabbatical, right? Reassigning to mccabe
Assignee: jband → mccabe
I've changed the summary (because I keep getting dups and can't find this bug 
:-).

It was "Binary download via HTTP fails; nsIStreamTransferOperation triggers 
XPConnect errors."
Summary: Binary download via HTTP fails; nsIStreamTransferOperation triggers XPConnect errors → "No Components in scope" xpconnect error on first download attempt
*** Bug 43876 has been marked as a duplicate of this bug. ***
Attached patch proposed fixSplinter Review
The JS code executing is:

0 loadDialog() ["chrome://global/content/downloadProgress.js":28]
    this = [object Window]
1 onLoad() ["chrome://global/content/downloadProgress.js":110]
    this = [object Window]
2 onload(event = [object KeyEvent]) ["<unknown>":0]
    this = [object Window]
3 <TOP LEVEL> ["<unknown>":0]

XPConnect is trying to convert the parameter "data.source.URI.spec". 'data' is a 
wrapped native object. To do the conversion it needs to make/get the wrapper for 
"data.source" which is in fact already a wrapped native.

XPConnect needs to find a xpconnect 'scope' in which to build or find a wrapper. 
It does this by doing a JS lookup for the 'Components' object in the static JS 
scope of the JS object in question. Usually this works fine. However, I believe 
that this object was originally wrapped in some other window (i.e. has some 
other global object) and that window's properties (including the 'Components' 
object) have since been cleared - probably the window is closed(?).

Anyway, since the JS object in question is *already* a wrapped native - which 
contains a pointer to the xpconnect 'scope' anyway - it is not always necessary 
to do that JS lookup for the 'Components' object. So, the fix is to try to get 
the xpconnect 'scope' directly from the object before trying to lookup the 
'Components' object.
Assignee: mccabe → jband
Whiteboard: [dogfood+][nsbeta2+] → [dogfood+][nsbeta2+] [fix in hand]
Status: NEW → ASSIGNED
fix checked in
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Whiteboard: [dogfood+][nsbeta2+] [fix in hand] → [dogfood+][nsbeta2+]
Adding "topcrash" keyword, as this has made it to the top 5 crashes list on 
talkback for today.
Keywords: topcrash
Marking as verified -

Checked both the original URL above, and the download.cnet.com site below
on WinNT, Linux, and Mac.
Status: RESOLVED → VERIFIED
Verified with: 

Linux and WinNT debug builds built on 2000-07-05 
Mac commercial build 2000-07-05-10.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: