Closed Bug 454991 Opened 16 years ago Closed 9 years ago

GetDocument function returns 0x80004005 error code

Categories

(Core :: DOM: Core & HTML, defect)

1.9.0 Branch
x86
Windows Server 2003
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: freshhotnews, Unassigned)

Details

(Keywords: regression)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.1) 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:1.9.0.1) 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:
1.
2.
3.
Can you attach a testcase?
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
Hello?
Any comment, please.
The problem is really that there is no testcase. This is necessary to identify and to fix the problem: http://developer.mozilla.org/en/Reducing_testcases
Did you say that it worked correctly in Firefox 2?
Yes. It works ok in FF2.
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?
Here is a test code that recreates the problem. Take a look, please.
http://rapidshare.com/files/158343574/GetDocumentTest.rar.html
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?
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 developer.mozilla.org, 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...
btw I use 3.0rc3 version. is it ok?
Can this help?
Are you running against an existing xul.dll, then, not compiling your own?
yep. I'm loading release (v3.0.3) version into debugger. but debugger is configured to load symbols from the mozilla server.
Attached image Symbols
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.
And from where I can get the symbols? It will take much time for me to build the FF3 from the ground.
(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.
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).

http://developer.mozilla.org/en/docs/How_to_get_a_stacktrace_with_WinDbg

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,
http://mxr.mozilla.org/mozilla-central/source/dom/src/base/nsHistory.cpp#92

someone should breakpoint nsHistory::GetSessionHistoryFromDocShell

in windbg, that's bp xul!nsHistory::GetSessionHistoryFromDocShell
Ok. What is the next step then?
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.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Keywords: testcase-wanted
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: