Madhu Tadiparthi | 3 May 13:36 2011
Picon

FireFox 4 crashes when trying to find the parent document for an internal document using DOM API GetParentDocument()

I have a web application where I have frames/Iframes in that. What I am
trying is to get the top level document from the internal document which is
a child of Frame/Iframe. I am facing an issue in getting the parent document
node from an internal document node in FireFox 4 using GetParentDocument
API. The browser is crashing at the Line 7 in the sample code. Here is the
sample code that I tried. The same is working good till Firefox 3.6

nsIDocument* getParentDocument(nsIDOMHTMLDocumentPtr htmlDocument )
{
nsIDocumentPtr document = do_QueryInterface(htmlDocument) ;
nsIDocument* parentDoc ;
 parentDoc = document->GetParentDocument(); //Line 7
 return parentDoc;
}

How can I get the parent document for the internal documents. Any
inputs/comments are higly appreciated.

Thanks
Madhu Tadiparthi
smaug | 3 May 13:49 2011

Re: FireFox 4 crashes when trying to find the parent document for an internal document using DOM API GetParentDocument()

On 05/03/2011 02:36 PM, Madhu Tadiparthi wrote:
> I have a web application where I have frames/Iframes in that. What I am
> trying is to get the top level document from the internal document which is
> a child of Frame/Iframe. I am facing an issue in getting the parent document
> node from an internal document node in FireFox 4 using GetParentDocument
> API. The browser is crashing at the Line 7 in the sample code. Here is the
> sample code that I tried. The same is working good till Firefox 3.6
>
> nsIDocument* getParentDocument(nsIDOMHTMLDocumentPtr htmlDocument )
> {
> nsIDocumentPtr document = do_QueryInterface(htmlDocument) ;
> nsIDocument* parentDoc ;
>   parentDoc = document->GetParentDocument(); //Line 7
>   return parentDoc;
> }
>
> How can I get the parent document for the internal documents. Any
> inputs/comments are higly appreciated.

Have you debugged why the code is crashing?
Is 'document' null when you call GetParentDocument()?
If so, I assume also htmlDocument is null, unless you use
the same binary for Fx3.6 and Fx4.0.
(nsIDocument interface has changed in Fx4.0, so you can't use the
  exactly *binary* code to access the object in Fx3.6 and Fx4.0.
  You need to at least recompile the code.)

-Olli

>
(Continue reading)

mads | 3 May 15:52 2011
Picon

Re: FireFox 4 crashes when trying to find the parent document for an internal document using DOM API GetParentDocument()

HI Olli,
Thanks for the quick response. Here are my comments.

> Have you debugged why the code is crashing?
> Is 'document' null when you call GetParentDocument()?
> If so, I assume also htmlDocument is null, unless you use
> the same binary for Fx3.6 and Fx4.0.

Madhu : I have taken care of NULL pointer checks. They are not NULL
pointers.

> (nsIDocument interface has changed in Fx4.0, so you can't use the
>   exactly *binary* code to access the object in Fx3.6 and Fx4.0.
>   You need to at least recompile the code.)

Madhu: I have extension to the browser, which has a dll compiled with
the  Gecko SDK 2.0 latest. Our code will try to traverse over the DOM
tree for the web application in FF4.0 to get the DOM hierarchy and
other stuff. Could you elaborate more on this recompiling the code?

Appreciate any inputs/comments.

Thanks
Madhu Tadiparthi
Sheppy | 5 May 14:53 2011
Picon

Wiki Wednesday (DOM) - May 4, 2011

Here are today's Wiki Wednesday articles! If you know about these
topics, please try to find a few minutes to look over these articles
that are marked as needing technical intervention and see if you can
fix them up. You can do so either by logging into the wiki and editing
the articles directly, or by emailing your notes, sample code, or
feedback to mdnwiki <at> mozilla.org.

Contributors to Wiki Wednesday will get recognition in next week's
Wiki Wednesday announcement. Thanks in advance for your help!

Thanks to ilmarihei for contributing last week.

1) HTMLCanvasElement ( http://mzl.la/grmRja )
2) HTMLElement ( http://mzl.la/gVwGYR )
3) document.createTreeWalker ( http://mzl.la/hFOPgq )
Sheppy | 11 May 20:26 2011
Picon

Wiki Wednesday (DOM) - May 11, 2011

Here are today's Wiki Wednesday articles! If you know about these
topics, please try to find a few minutes to look over these articles
that are marked as needing technical intervention and see if you can
fix them up. You can do so either by logging into the wiki and editing
the articles directly, or by emailing your notes, sample code, or
feedback to mdnwiki <at> mozilla.org.

Contributors to Wiki Wednesday will get recognition in next week's
Wiki Wednesday announcement. Thanks in advance for your help!

Thanks to Neil Rashbrook for contributing last week.

1) cssRule ( http://mzl.la/gfrjzg )
2) HTMLAnchorElement ( http://mzl.la/gZfdYL )
3) HTMLSelectElement ( http://mzl.la/gyTJLz )
Sheppy | 25 May 20:02 2011
Picon

Wiki Wednesday (DOM) - May 25, 2011

Here are today's Wiki Wednesday articles! If you know about these
topics, please try to find a few minutes to look over these articles
that are marked as needing technical intervention and see if you can
fix them up. You can do so either by logging into the wiki and editing
the articles directly, or by emailing your notes, sample code, or
feedback to mdnwiki <at> mozilla.org.

Contributors to Wiki Wednesday will get recognition in next week's
Wiki Wednesday announcement. Thanks in advance for your help!

Thanks to Sevenspade for contributing last week.

1) HTMLSelectElement ( http://mzl.la/gyTJLz )
2) HTMLHRElement ( http://mzl.la/hHWcKH )
3) HTMLKeygenElement ( http://mzl.la/eyNT9n )

Gmane