Re: nsIDocShell in FF3.5. How to get?

2009-07-29 Thread Boris Zbarsky

Michael A. Borisov wrote:

Yes, I use it to get nsIContentViewer and to get and set char encoding.
Maybe there is a "right" way to do that?


There is not, but probably should be.

It's worth filing bugs on embedding APIs missing useful pieces instead 
of relying on internal functionality that's liable to break any moment...


You are right, but unfortunately I can't wait.


Still file the bugs...

In your code where you do the QI or GetInterface call that returns 0, 
what is NS_GET_IID(nsIDocShell)? That is, if you do something like this:

...

Output is: '{dc4daea1-b43d-406f-bd62-c2ee879192ad}'.


Hmm.  That's the right value for 1.9.1 (so Firefox 3.5)...

Next step is probably to step into the code and see what's going on. 
What you're doing should be working.


-Boris
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: nsIDocShell in FF3.5. How to get?

2009-07-29 Thread Michael A. Borisov

Boris Zbarsky wrote:

Michael A. Borisov wrote:

1) Why exactly do you need a docshell?


I need it for many things. For example, to change page zoom.


Uh...  The zoom setter on docshell just throws.  Do you really mean that 
you use it as a way to get to the document viewer?


Yes, I use it to get nsIContentViewer and to get and set char encoding.
Maybe there is a "right" way to do that?



It's worth filing bugs on embedding APIs missing useful pieces instead 
of relying on internal functionality that's liable to break any moment...


You are right, but unfortunately I can't wait.

The GtkMozEmbed API which I use is really poor. So, my goal is to 
implement a Qt widget which would be a wrapper around GtkMozEmbed.





2) Does

  nsCOMPtr docShell = do_GetInterface(_browser);

   not do what you want?


No, it returns 0.


Sounds like your code's idea of the nsIDocShell IID and the browser 
core's idea are different.



Are you compiling against 3.0.x headers and running against 3.5?



No, I built FF3.5.1 myself. As I did FF3.0.11 before. So, I build and 
run my browser against FF3.5.1.


In your code where you do the QI or GetInterface call that returns 0, 
what is NS_GET_IID(nsIDocShell)? That is, if you do something like this:


  nsIID iid = NS_GET_IID(nsIDocShell);
  char* str = iir.ToString();
  printf("The iid: '%s'\n", str);
  NS_Free(str);

what is the output?


Output is: '{dc4daea1-b43d-406f-bd62-c2ee879192ad}'.

BTW ToString() method is not available because XPCOM_GLUE_AVOID_NSPR is 
defined.


Michael



-Boris

___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: nsIDocShell in FF3.5. How to get?

2009-07-29 Thread Boris Zbarsky

Michael A. Borisov wrote:

1) Why exactly do you need a docshell?


I need it for many things. For example, to change page zoom.


Uh...  The zoom setter on docshell just throws.  Do you really mean that 
you use it as a way to get to the document viewer?


It's worth filing bugs on embedding APIs missing useful pieces instead 
of relying on internal functionality that's liable to break any moment...



2) Does

  nsCOMPtr docShell = do_GetInterface(_browser);

   not do what you want?


No, it returns 0.


Sounds like your code's idea of the nsIDocShell IID and the browser 
core's idea are different.



Are you compiling against 3.0.x headers and running against 3.5?



No, I built FF3.5.1 myself. As I did FF3.0.11 before. So, I build and 
run my browser against FF3.5.1.


In your code where you do the QI or GetInterface call that returns 0, 
what is NS_GET_IID(nsIDocShell)? That is, if you do something like this:


  nsIID iid = NS_GET_IID(nsIDocShell);
  char* str = iir.ToString();
  printf("The iid: '%s'\n", str);
  NS_Free(str);

what is the output?

-Boris
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: nsIDocShell in FF3.5. How to get?

2009-07-29 Thread Michael A. Borisov

Boris Zbarsky wrote:

Michael A. Borisov wrote:

Ok, I tried another way which I learned from Galeon.


Here's when I have to ask some questions:

1) Why exactly do you need a docshell?


I need it for many things. For example, to change page zoom.


2) Does

  nsCOMPtr docShell = do_GetInterface(_browser);

   not do what you want?


No, it returns 0.




// QI that back to a doc shell.
nsCOMPtr ds;
if (!(ds = do_QueryInterface(contentItem)))
return CO_ERROR(Co::MSG_NO_INTERFACE, "nsIDocShell");


The last do_QueryInterface returns 0 in FF3.5. But everything is OK in 
FF3.0.x.


Are you compiling against 3.0.x headers and running against 3.5?



No, I built FF3.5.1 myself. As I did FF3.0.11 before. So, I build and 
run my browser against FF3.5.1.


Michael


-Boris

___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: nsIDocShell in FF3.5. How to get?

2009-07-27 Thread Boris Zbarsky

Michael A. Borisov wrote:

Ok, I tried another way which I learned from Galeon.


Here's when I have to ask some questions:

1) Why exactly do you need a docshell?
2) Does

  nsCOMPtr docShell = do_GetInterface(_browser);

   not do what you want?


// QI that back to a doc shell.
nsCOMPtr ds;
if (!(ds = do_QueryInterface(contentItem)))
return CO_ERROR(Co::MSG_NO_INTERFACE, "nsIDocShell");


The last do_QueryInterface returns 0 in FF3.5. But everything is OK in 
FF3.0.x.


Are you compiling against 3.0.x headers and running against 3.5?

-Boris
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: nsIDocShell in FF3.5. How to get?

2009-07-27 Thread Michael A. Borisov

Boris Zbarsky wrote:

Michael A. Borisov wrote:

Does anybody know what happened to nsIDocShell in FF3.5?


Nothing.

Before for FF3.0.x I just did do_queryInterface for nsIWebBrowser 
instance.


Which presumably returned 0, assuming that's what you actually did. 
Certainly there's no mention of nsIDocShell in 
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp&rev=1.169&mark=168-185#168 



-Boris


Ok, I tried another way which I learned from Galeon.

int CoMozEmbed::docShell(nsIDocShell **docShell) const
{
CO_CHECK_POINTER(docShell);

int res;

nsCOMPtr browserAsItem;
if (!(browserAsItem = do_QueryInterface(_browser)))
return CO_ERROR(Co::MSG_NO_INTERFACE, "nsIDocShellTreeItem");

// Get the owner for that item.
nsCOMPtr treeOwner;
if (NS_FAILED(res = 
browserAsItem->GetTreeOwner(getter_AddRefs(treeOwner

return CO_ERROR(qPrintable(errorString(res)));
CO_CHECK_POINTER(treeOwner);

// Get the primary content shell as an item.
nsCOMPtr contentItem;
if (NS_FAILED(res = 
treeOwner->GetPrimaryContentShell(getter_AddRefs(contentItem

return CO_ERROR(qPrintable(errorString(res)));
CO_CHECK_POINTER(contentItem);

// QI that back to a doc shell.
nsCOMPtr ds;
if (!(ds = do_QueryInterface(contentItem)))
return CO_ERROR(Co::MSG_NO_INTERFACE, "nsIDocShell");

*docShell = ds.get();
NS_IF_ADDREF(*docShell);

return CO_OK;
}

The last do_QueryInterface returns 0 in FF3.5. But everything is OK in 
FF3.0.x.


So, what is the right way to get that interface?

Thank you,
Michael
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding


Re: nsIDocShell in FF3.5. How to get?

2009-07-26 Thread Boris Zbarsky

Michael A. Borisov wrote:

Does anybody know what happened to nsIDocShell in FF3.5?


Nothing.

Before for FF3.0.x I just did do_queryInterface for nsIWebBrowser 
instance.


Which presumably returned 0, assuming that's what you actually did. 
Certainly there's no mention of nsIDocShell in 
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/embedding/browser/webBrowser/nsWebBrowser.cpp&rev=1.169&mark=168-185#168


-Boris
___
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding