Java Liveconnect

Till Krech till at snafu.de
Thu Oct 24 20:17:33 BST 2002


On Thursday 24 October 2002 19:40, Koos Vriezen wrote:
> On Thu, 24 Oct 2002, Dirk Mueller wrote:
> > On Mit, 23 Okt 2002, Koos Vriezen wrote:
> > > (All methods of netscape/javascript/JSObject, are implemented in
> > > Javascript)
> >
> > hmm, can they only call the interpreter of the "own" frame or also the
> > one of other frames ?
>
> Don't quite follow your hmm'ing, but in the base class of
> HTMLAppletElementImpl, LiveConnectElementImpl::liveConnectEvent(..)
> does
>     KHTMLView* w = getDocument()->view();
>     w->part()->executeScript(this, script);
> Guess that's the interpreter of the "own" frame.
>
> > can they survive a site-reload ?
>
> Don't think so, KHTMLPart::clear() does a d->m_javaContext->deleteLater(),
> remember, which should delete the applet. Also LC is disabled when
> detaching.
>
> Till, do you see a way an applet can inter-context communicate?
No, I don't. With java-to-javascript communication, the Applet can only obtain 
a reference to the window in which it is embedded. It could perhaps get the 
value of frames['whatever'] but since scripts are only executed in the 
embedding window the same restrictions apply here (should apply) as to pure 
javascript.
To get the return value of any javascript operation on the embedding window, a 
small script is injected into the window which is executed there. The script 
executes with privileges applying to any javascript wich is executed in this 
window.
The other way round (javascript-to-java), a script in a 'foreign' frame is 
unable to access the document.applets javascript array in the embedding 
window and hence can't call any java methods of the applet.
In java (java-to-java), an applet-to-applet communication is only possible 
between applets in the same AppletContext, i.e. in the same document. First, 
an applet cannot get a reference to another applet in a different context. 
Second, if the applets stem from different sites, they have different 
classloaders and java security restrictions apply.

regards, till
>
> Koos

-- 
Till Krech from Berlin, Germany is happy with
SuSE Linux 8.0 (i386) 2.4.18-64GB-SMP * KDE: 3.0.8 (KDE 3.1 beta2)
Qt: 3.1.0-b2 * gcc version 3.2





More information about the kfm-devel mailing list