Need help converting JavaScript to C++ - Mozilla
This is a discussion on Need help converting JavaScript to C++ - Mozilla ; I have some JavaScript code that sets up an event listener on
"TabOpen", and when I receive that event, I retrieve the browser by
doing this:
function tabOpenListener(event)
{
var b = event.target.linkedBrowser;
so now I want to have that ...
-
Need help converting JavaScript to C++
I have some JavaScript code that sets up an event listener on
"TabOpen", and when I receive that event, I retrieve the browser by
doing this:
function tabOpenListener(event)
{
var b = event.target.linkedBrowser;
so now I want to have that same functionality in C++ (in a Firefox add-
on). I have a class that implements nsIDOMEventListener, and in my
HandleEvent() function I am getting an nsIDOMEvent *pEvent, I can then
call pEvent->GetTarget() to get a nsCOMPtr target,
so I can successfully do the equivalent of the "event.target" part of
the JavaScript code, but then what?
How do I do that magic "target.linkedBrowser" that is so easy in
JavaScript?
I've searched the Firefox site, and there doesn't appear to be any
interface that has a "linkedBrowser" element of any type (function or
data). I run into this a lot in C++, there seem to be values that
JavaScript is allowed to access that C++ isn't. Or is there some
hidden interface that all Firefox objects implement, something like
"nsIGetOtherStuff"?
Thanks,
Chris
-
Re: Need help converting JavaScript to C++
By the way, the reason I'm doing this is because I want to know the
URL of the page that was opened in that new tab, and in JavaScript I
can do that by setting up an nsIWebProgressListener on
b.webProgress.addProgressListener(); if there is a better way to get
that URL (in C++), I'm certainly open to that idea too!
Chris