GetDocument function returns 0x80004005 error code




DOM: Core & HTML
10 years ago
3 years ago


(Reporter: freshhotnews, Unassigned)



1.9.0 Branch
Windows Server 2003

Firefox Tracking Flags

(Not tracked)



(2 attachments)



10 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv: Gecko/2008070208 Firefox/3.0.1 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv: Gecko/2008070208 Firefox/3.0.1 (.NET CLR 3.5.30729)

CString CSomeClass::GetURL( nsCOMPtr win )
CString url;

//get main URL
nsCOMPtr doc;
nsAString name;
nsresult res/* = win->GetName( name )*/;
res = win->GetDocument( getter_AddRefs( doc ) ); // 0x80004005 error here

Reproducible: Always

Steps to Reproduce:
Can you attach a testcase?

Comment 2

10 years ago
I can't. I've faced with the problem while porting rather big application from ff2 to ff3. So I can't attach full source codes. I get content window as follows: 

//get the current content window
nsCOMPtr<nsIDOMWindow> CSomeClass::GetContentWindow()
 nsCOMPtr<nsIDOMWindow> win;

 nsCOMPtr<nsIDOMAbstractView> mainview;
 nsCOMPtr<nsIDOMDocumentView> docview( do_QueryInterface( mXULDoc ) );
 if (!docview)
  return win;

 docview->GetDefaultView( getter_AddRefs( mainview ) );
 if (!mainview)
  return win;

  /* FF2 */
 nsCOMPtr<nsIDOMWindowInternal> wininternal( do_QueryInterface( mainview ) );
 if (!wininternal)
    /* FF3 */
    mainview->QueryInterface(NS_IDOMWINDOWINTERNAL_FF3_IID, getter_AddRefs(wininternal));
    if (!wininternal)
      return win;

 nsCOMPtr<nsIDOMWindow> content;
 wininternal->GetContent( getter_AddRefs( content ) );

  if (!content)
  return win;

 return content;

And then I call the GetURL method (from the original post) with the "content" passed as parameter.
Note, if I call the GetDocument directly from the GetContentWindow (right before the "return content;" line) I get the same error.

Any thoughts, please? 

Many thanks in advance.
Component: General → DOM: Core & HTML
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.9.0 Branch

Comment 3

10 years ago

Comment 4

10 years ago
Any comment, please.
The problem is really that there is no testcase. This is necessary to identify and to fix the problem:
Did you say that it worked correctly in Firefox 2?
Keywords: testcase-wanted

Comment 6

10 years ago
Yes. It works ok in FF2.
Keywords: regression
So... nsGlobalWindow::GetDocument never returns anything but NS_OK.  You're getting NS_ERROR_FAILURE.  So whatever method you're calling it's definitely not nsGlobalWindow::GetDocument.

Have you tried stepping through your code in a debugger and seeing what happens when you step into that GetDocument() call?

Comment 8

10 years ago
Here is a test code that recreates the problem. Take a look, please.
I don't have a Windows build setup offhand, unfortunately...  Reading through the code it looks like it should work, but have you tried using a debugger as suggested in comment 7?

Comment 10

10 years ago
I don't know how to run the xpi plugin under debugger. Could you explain, how to do that, please?
Run Firefox under a debugger (documented on, I'm pretty sure) and then breakpoint in your code?
I really can't say more than that about Windows; haven't used it in a long time...

Comment 13

10 years ago
btw I use 3.0rc3 version. is it ok?

Comment 14

10 years ago
Created attachment 345511 [details]
The error occures in the xul.dll

Can this help?
Are you running against an existing xul.dll, then, not compiling your own?

Comment 16

10 years ago
yep. I'm loading release (v3.0.3) version into debugger. but debugger is configured to load symbols from the mozilla server.

Comment 17

10 years ago
Created attachment 345517 [details]

As you can see, some symbols are being loaded, but not for the xul.dll
Something is going wrong with that, then...  timeless, any idea what's up?  Getting symbols there should make this pretty simple.

Comment 19

10 years ago
And from where I can get the symbols? It will take much time for me to build the FF3 from the ground.

Comment 20

10 years ago
(In reply to comment #14)
> Created an attachment (id=345511) [details]
> The error occures in the xul.dll
> Can this help?

Not sure if this is any help, but that code is the nsHistory::GetLength function.

Comment 21

10 years ago
i don't really use visual studio's debugger much (i did w/ bernd in barcelona on Sunday, it's definitely not a bad debugger, but I'm quite happy w/o it).

is my friend.

!sym noisy
.reload /f

can explain why symbols aren't happy if they happen to fail.

If comment 20 is correct, then there's not much interesting to see,

someone should breakpoint nsHistory::GetSessionHistoryFromDocShell

in windbg, that's bp xul!nsHistory::GetSessionHistoryFromDocShell

Comment 22

10 years ago
Ok. What is the next step then?

Comment 23

10 years ago
Hello?  Any idea how to proceed?
You could try windbg as comment 21 suggests.

But in general, it sounds like you're getting your vtables wrong somehow and calling into random code when you call GetDocument().  It's really sort of up to you to use your debugger to figure out what happens to cause that.
Closing this as incomplete due to inactivity and the lack of a reproducible test case. Feel free to reopen the bug if there's a testcase that still reproduces the issue.
Last Resolved: 3 years ago
Keywords: testcase-wanted
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.