For Programmers: Free Programming Magazines  


Home > Archive > Tcl > February 2005 > Tcl plugin in Firefox 1.0









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Tcl plugin in Firefox 1.0
Courtney Plater

2005-02-06, 3:59 am

Any one know how to correctly install the Tcl plugin in Firefox for
Windows XP-pro. It used to work but with 1.0 I'm getting errors like this:

"MAIN" is no unique abbreviation of a level name

invalid command name "npNewInstance" while executing "npNewInstance
3639172 type application/......

It continues on like this. I've done the usual, un-install, re-install
but no joy. I figure there is something else I need to set (maybe
windows permissions). Anybody know what it takes to get it working again?

Courtney Plater
Michael Schlenker

2005-02-06, 3:59 pm

Courtney Plater schrieb:
> Any one know how to correctly install the Tcl plugin in Firefox for
> Windows XP-pro. It used to work but with 1.0 I'm getting errors like this:
>
> "MAIN" is no unique abbreviation of a level name
>
> invalid command name "npNewInstance" while executing "npNewInstance
> 3639172 type application/......
>
> It continues on like this. I've done the usual, un-install, re-install
> but no joy. I figure there is something else I need to set (maybe
> windows permissions). Anybody know what it takes to get it working again?


Which version of the plugin did you try to install? The recent 3.x
version or the ancient 2.0 version?

(Writing plugins/extensions for mozilla/firefox is a mess, they keep
changing the API and don't document its limitations too well, especially
the installer API (XPInstall) is total crap...)

Michael
Courtney Plater

2005-02-07, 9:02 pm

Michael Schlenker wrote:
> Courtney Plater schrieb:
>
>
>
> Which version of the plugin did you try to install? The recent 3.x
> version or the ancient 2.0 version?
>
> (Writing plugins/extensions for mozilla/firefox is a mess, they keep
> changing the API and don't document its limitations too well, especially
> the installer API (XPInstall) is total crap...)
>
> Michael


Tried them both. I've sort of fixed it so it just hands it off to the
Active Tcl script application. Not quite what I was looking for but it
will have to do for now. I'll wait for the next go around and try
again. I will be getting the upgrade to the Tcl Dev. Kit and that may
help. Hopefully Mozilla will stabilize the plug in process and quit
breaking things. I do enough of that on my own with out their help.


Courtney
Jeff Hobbs

2005-02-08, 4:00 am

Courtney Plater wrote:
>
>
> Tried them both. I've sort of fixed it so it just hands it off to the
> Active Tcl script application. Not quite what I was looking for but it
> will have to do for now. I'll wait for the next go around and try
> again. I will be getting the upgrade to the Tcl Dev. Kit and that may
> help. Hopefully Mozilla will stabilize the plug in process and quit
> breaking things. I do enough of that on my own with out their help.


The v3 plugin should operate correctly in Firefox 1.0. I have
tested it myself on Linux, Solaris and Windows. It did have a
few recent changes (yet again ... ugh) to handle plugin changes.
That may not be in any of the most recent releases.

The plugin is likely to be broken out of the Tcl Dev Kit in the
near future (it is already a free component). I have the plugin
working as a specialized starpack dll. That may be the best
path going forward, but there are still things that require work.

--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos
DanielDaboul@despammed.com.INVALID

2005-02-19, 3:58 pm

Jeff Hobbs <jeffh@activestate.com> wrote:
> The v3 plugin should operate correctly in Firefox 1.0. I have
> tested it myself on Linux, Solaris and Windows. It did have a

[...]

I didn't want to miss that, so I tried it today on my Debian GNU/Linux
(unstable) system. I basically did:

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/tclplugin login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/tclplugin co tclplugin
mkdir -p build/plugin/
cd build/plugin/
.../../tclplugin/configure --with-mozilla=$HOME/.mozilla --with-tcl=/usr/lib/tcl8.4 --with-tk=/usr/lib/tk8.4
make
make install
grep '^set ::plugin(executable' /usr/lib/nptcl3.0/installed.cfg

The last grep gives
set ::plugin(executable) {/usr/bin/wish8.4}
which should be OK.

I then started various browsers and pointed them to
http://www.tcl.tk/software/plugin/applets.html
with the following results:

mozilla-1.7.3
Segmentation fault

mozilla-firefox (Version 1.0+dfsg.1-6)
MSG [Plug_Init/PkgRequire]: "MAIN" is no unique abbreviation of a level name
Segmentation fault

konqueror (Version 3.3 (using KDE 3.3.2))
MSG [Plug_Init/PkgRequire]: "MAIN" is no unique abbreviation of a level name
nspluginviewer (plugin): ERROR: Can't create plugin class

Konqueror didn't crash. My tcl_patchLevel is 8.4.9. Any clues how
this could be fixed? - Thanks, Daniel
Jeff Hobbs

2005-02-19, 8:58 pm

DanielDaboul@despammed.com.INVALID wrote:
> Jeff Hobbs <jeffh@activestate.com> wrote:
>
> [...]
>
> I didn't want to miss that, so I tried it today on my Debian GNU/Linux
> (unstable) system. I basically did:
>
> cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/tclplugin login
> cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/tclplugin co tclplugin
> mkdir -p build/plugin/
> cd build/plugin/
> ../../tclplugin/configure --with-mozilla=$HOME/.mozilla --with-tcl=/usr/lib/tcl8.4 --with-tk=/usr/lib/tk8.4
> make
> make install
> grep '^set ::plugin(executable' /usr/lib/nptcl3.0/installed.cfg
>
> The last grep gives
> set ::plugin(executable) {/usr/bin/wish8.4}
> which should be OK.


If you run that wish, can you do 'package require plugin' and
does it return 3.0?

> I then started various browsers and pointed them to
> http://www.tcl.tk/software/plugin/applets.html
> with the following results:


Before trying the plugin demos, go to about :plugins to see that
it initialized correctly.

> mozilla-1.7.3
> Segmentation fault
>
> mozilla-firefox (Version 1.0+dfsg.1-6)
> MSG [Plug_Init/PkgRequire]: "MAIN" is no unique abbreviation of a level name
> Segmentation fault
>
> konqueror (Version 3.3 (using KDE 3.3.2))
> MSG [Plug_Init/PkgRequire]: "MAIN" is no unique abbreviation of a level name
> nspluginviewer (plugin): ERROR: Can't create plugin class
>
> Konqueror didn't crash. My tcl_patchLevel is 8.4.9. Any clues how
> this could be fixed? - Thanks, Daniel


So the same problem is basically happening, but I can't recall
off-hand what the root cause of that is. There is one bug in
8.4.9 that affects the re-init of Tk, but the first load should
work just fine. Out of curiosity, what exact demo were you
trying? Did you see the first little circle OK? Perhaps it is
the reload error in 8.4.9, if the little circle works. Try to
make sure that all pages load in a new tab or window (so you
don't lose that first tclet).

For debugging, there are 2 magic env vars to set:
TCL_PLUGIN_DLL_LOGFILE and TCL_PLUGIN_LOGFILE

The first prints out the operation of the dll/so on loading,
the second the Tcl side of initialization and running. If you
can create those (set each to a separate file) and send them to
me, it will be easier to debug the issue.

--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos
DanielDaboul@despammed.com.INVALID

2005-02-19, 8:58 pm

Jeff Hobbs <jeffh@activestate.com> wrote:
> DanielDaboul@despammed.com.INVALID wrote:

[...]
>
> If you run that wish, can you do 'package require plugin' and
> does it return 3.0?


Well, only on the second attempt. I see an init problem sort of
opposite of what you described. The error depends on the magic env
vars, as you can see in the following session-log:

cd $HOME
unset TCL_PLUGIN_DLL_LOGFILE
unset TCL_PLUGIN_LOGFILE

/usr/bin/wish8.4
% package require plugin
"MAIN" is no unique abbreviation of a level name
% package require plugin
3.0
% exit

export TCL_PLUGIN_DLL_LOGFILE=TCL_PLUGIN_DLL.log
export TCL_PLUGIN_LOGFILE=TCL_PLUGIN.log
/usr/bin/wish8.4
% package require plugin
invalid command name "::log::setup"
% package require plugin
3.0
% exit

No logfile was created until now.

firefox &

First requesting...
about :plugins
----------
Tcl Plugin 3.0a4

File name: libnptcl3.0.so

TCL Plugin 3.0a4 (3.0.0.4). Executes tclets found in Web pages.See the
Tcl Plugin home page for more details.

MIME Type Description Suffixes Enabled
application/x-tcl Tcl Web Applets .tcl Yes
----------

Then asking for...
http://www.tcl.tk/software/plugin/applets.html

[1]+ Segmentation fault firefox

Only one logfile was created. Since it's short I include it here.

cat TCL_PLUGIN.log
cat: TCL_PLUGIN.log: No such file or directory

cat TCL_PLUGIN_DLL.log
[1108856307]
###### LOG STARTED ###### [NEW]

[1108856307] NPP_Initialize [STACK=0, INSTANCES=0, STREAMS=0]
[1108856307] ENTERING NpCreateMainInterp
[1108856307] Attempt to load Tcl dll (default) '/usr/lib/libtcl8.4.so'
[1108856308] using dladdr '/usr/lib/libtcl8.4.so' => '/usr/lib/libtcl8.4.so'
[1108856308] NpCreateMainInterp: Using dll '/usr/lib/libtcl8.4.so'
[1108856308] Tcl_FindExecutable(/usr/lib/libtcl8.4.so)
[1108856308] Tcl_CreateInterp()
[1108856308] Tcl_InitStubs(0x967fd50)
[1108856308] tcl_Init(0x967fd50)
[1108856308] package require Tk
[1108856309] LEAVING NpCreateMainInterp interp == 0x967fd50
[1108856309] Service ALL events [STACK=0, INSTANCES=0, STREAMS=0]
[1108856309] >>> NpInit(0x967fd50)
[1108856309] NpInit: PnInit(0x967fd50)
[1108856309] NpInit: Plugin_Init(0x967fd50, 1)
[1108856309] MSG [Plug_Init/PkgRequire]: invalid command name "::log::setup"
[1108856309] NPP_Initialize: NpInterp != TCL_OK
[1108856309] ENTERED NPP_Shutdown, oldServiceMode == 1 [1108856309] [[ STACK = 1, INSTANCES = 0, STREAMS = 0 ]]
[1108856309] LEAVING NPP_Shutdown, oldServiceMode == 1 [1108856309] [[ STACK = 0, INSTANCES = 0, STREAMS = 0 ]]
[1108856309] Tcl_DeleteInterp(0x967fd50)
[1108856309] EXITING SHUTDOWN
[1108856309]
###### LOG STARTED ###### [EXISTING LOGFILE]

[1108856309] NPP_Initialize [STACK=0, INSTANCES=0, STREAMS=0]
[1108856309] ENTERING NpCreateMainInterp
[1108856309] NpCreateMainInterp: Using dll ''
[1108856309] NpCreateMainInterp: using dladdr '' => '/usr/lib/libtcl8.4.so'
[1108856309] Tcl_FindExecutable(/usr/lib/libtcl8.4.so)
[1108856309] Tcl_CreateInterp()
[1108856309] Tcl_InitStubs(0x967e950)
[1108856309] tcl_Init(0x967e950)


> [...] Out of curiosity, what exact demo were you
> trying? Did you see the first little circle OK? Perhaps it is
> the reload error in 8.4.9, if the little circle works. Try to


It crashes before showing the circle. No re-init. - Daniel
Jeff Hobbs

2005-02-20, 4:03 am

In-Reply-To: <cv8j2o$61d$1@news.iucc.ac.il>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <qpKdnez2tbyUeorfRVn-1A@novus-tele.net>
Lines: 20
NNTP-Posting-Host: 216.187.83.253
X-Trace: sv3-ASEPO/ vL64DkqmWA5KscFU6eHY8onrHob6epQBOAyi5+vb
q+aN9Rg3615xZqiXMvKd4v0oQxI7aTJ56!NBjDGO
w35g4yNJR40qa79DEibZw8bLDEzWh446PRiexKFS
um/ W3QT+l9T4JVlLuV8EN9Xm1n2TuX!tM4CzRfmq4yP
frgGuhy8EA==
X-Complaints-To: abuse@novus-tele.net
X-DMCA-Complaints-To: abuse@novus-tele.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.31
Xref: number1.nntp.dca.giganews.com comp.lang.tcl:243028

DanielDaboul@despammed.com.INVALID wrote:
> Well, only on the second attempt. I see an init problem sort of
> opposite of what you described. The error depends on the magic env
> vars, as you can see in the following session-log:


> % package require plugin
> invalid command name "::log::setup"


OK, this is the source of the problem. When I do a grep -R
for 'log::setup', I do not find any reference to log::setup.
That sounds like you might have old sources, as I did do
some code renaming. Are you sure you have the latest sources?
The last entry in ChangeLog should be from 2005-01-09.

Also, to further diagnose, what is $::errorInfo' directly
following the error you receive above?

--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos
DanielDaboul@despammed.com.INVALID

2005-02-20, 3:58 pm

Jeff Hobbs <jeffh@activestate.com> wrote:
> DanielDaboul@despammed.com.INVALID wrote:
>
> OK, this is the source of the problem. When I do a grep -R
> for 'log::setup', I do not find any reference to log::setup.
> That sounds like you might have old sources, as I did do
> some code renaming. Are you sure you have the latest sources?
> The last entry in ChangeLog should be from 2005-01-09.


Yes, that's the last entry. As I wrote, I did a fresh cvs checkout
yesterday. Also here
grep -r 'log::setup' tclplugin/
gives no reference to "log::setup"; it only finds "pluglog::setup".

> Also, to further diagnose, what is $::errorInfo' directly
> following the error you receive above?


I'm currently away from that Linux machine, so I'll send the errorInfo
later. In the meantime I compiled the tclplugin on Solaris. Here the
error is still a little different (with tcl_patchLevel 8.4.4):

cd $HOME
export TCL_PLUGIN_DLL_LOGFILE=TCL_PLUGIN_DLL.log
export TCL_PLUGIN_LOGFILE=TCL_PLUGIN.log
$HOME/.local/bin/wish8.4
% package require plugin
can't read "plugin(patchLevel)": no such element in array
% puts $::errorInfo
can't read "plugin(patchLevel)": no such element in array
while executing
"::pluglog::log MAIN "PATCHLEVEL = $plugin(patchLevel)""
(file "/users/danield/.local/lib/nptcl3.0/plugmain.tcl" line 46)
invoked from within
"source /users/danield/.local/lib/nptcl3.0/plugmain.tcl"
("package ifneeded" script)
invoked from within
"package require plugin"
% package require plugin
3.0
% exit

cat TCL_PLUGIN_DLL.log
cat: TCL_PLUGIN_DLL.log: No such file or directory
cat TCL_PLUGIN.log
[Feb 20 14:38:57] : Pid 29284, Log Started (TCL_PLUGIN.log,file9) NOTICE
[Feb 20 14:38:57] MAIN : PLUGIN(LIBRARY) = /users/danield/.local/lib/nptcl3.0 NOTICE
DanielDaboul@despammed.com.INVALID

2005-02-20, 3:58 pm

DanielDaboul@despammed.com.invalid wrote:
> [...] In the meantime I compiled the tclplugin on Solaris. Here the
> error is still a little different (with tcl_patchLevel 8.4.4): [...]


I can now report partial success on Solaris despite the reported
error-message. In both

Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7.5) Gecko/20041109 Firefox/1.0

Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0

the plugin basically works. (The first invocation in Netscape seemed
to fail, without crash, but now I can't reproduce that.)

Now the next problem appears, which I remember from earlier versions
of the plugin: Keyboard focus. I couldn't get any keyboard input in
either of the two browsers. - Daniel
DanielDaboul@despammed.com.INVALID

2005-02-20, 8:58 pm

DanielDaboul@despammed.com.invalid wrote:
> Jeff Hobbs <jeffh@activestate.com> wrote:
>
> I'm currently away from that Linux machine, so I'll send the errorInfo
> later. In the meantime I compiled the tclplugin on Solaris. Here the


Back at Linux, looking at $::errorInfo revealed the cause. I have
/usr/local/lib on my TCLLIBPATH where embarrassingly an old version of
the plugin files were still waiting to interfere. After removing
them, I got the same error message I reported on the Solaris machine:

> can't read "plugin(patchLevel)": no such element in array
> while executing
> "::pluglog::log MAIN "PATCHLEVEL = $plugin(patchLevel)""
> (file "/users/..../lib/nptcl3.0/plugmain.tcl" line 46)

[...]

I did a quick fix, by putting
set plugin(patchLevel) 3.0a4
set plugin(pkgVersion) 3.0
right after the
set plugin(library) [file dirname [info script]]

Now I have the plugin working in

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20050210
Firefox/1.0 (Debian package 1.0+dfsg.1-6)

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040924
Debian/1.7.3-2

and Konqueror 3.3

Keyboard focus works flawlessly in Firefox and Mozilla (the mouse
pointer just has to be above the plugin area to give it the
keystrokes) but behaves a little strange in Konqueror. Sometimes the
plugin gets the keystrokes but once Konqueror uses one, it doesn't
give the focus back. I have to go through the Window Manager,
i.e. give it a key, and then move the mouse back to the plugin. I.e.,
when focus follows the mouse, the behavior which I generally use.

Can the key-problem be fixed at the plugin or user-level? Or is that
something the browser-developers control (beyond what the WM does)?

BTW, I now see the re-init problem which you say is unique to
tcl_patchLevel 8.4.9. - Daniel
Jeff Hobbs

2005-02-20, 8:58 pm

DanielDaboul@despammed.com.INVALID wrote:
> Back at Linux, looking at $::errorInfo revealed the cause. I have
> /usr/local/lib on my TCLLIBPATH where embarrassingly an old version of
> the plugin files were still waiting to interfere. After removing
> them, I got the same error message I reported on the Solaris machine:
>
>

OK, looked at this code again to remind myself why this is an
"error". It's not ... really. The 'plugin' package is only
expected to be loaded from the plugin environment. You will
find that generic/npTcl.c sets these variables before it does
'package require plugin' at the C level.
[color=darkred]
> Keyboard focus works flawlessly in Firefox and Mozilla (the mouse
> pointer just has to be above the plugin area to give it the
> keystrokes) but behaves a little strange in Konqueror. Sometimes the
> plugin gets the keystrokes but once Konqueror uses one, it doesn't
> give the focus back. I have to go through the Window Manager,
> i.e. give it a key, and then move the mouse back to the plugin. I.e.,
> when focus follows the mouse, the behavior which I generally use.
>
> Can the key-problem be fixed at the plugin or user-level? Or is that
> something the browser-developers control (beyond what the WM does)?


This was introduced in the rewriting of the plugin internals
by the Mozilla folks. This all worked fine with the Xt type
event loop in N4, but is problematic now. I believe that
the fixes will have to be at the C level, possibly at the Tk
core level. It might involve adding Xembed support to Tk
and going that route. I think that has advantages in
general for future integration stuff anyways, but it isn't a
"quick fix", if that's what you were hoping for.

> BTW, I now see the re-init problem which you say is unique to
> tcl_patchLevel 8.4.9. - Daniel


Yes, that fix went in last month and was Tk-specific. If you
just rebuild Tk, you are good to go.

--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos
DanielDaboul@despammed.com.INVALID

2005-02-21, 9:00 pm

Jeff Hobbs wrote:
> Daniel Daboul wrote:
>
> This was introduced in the rewriting of the plugin internals
> by the Mozilla folks. This all worked fine with the Xt type
> event loop in N4, but is problematic now. I believe that
> the fixes will have to be at the C level, possibly at the Tk
> core level. It might involve adding Xembed support to Tk
> and going that route. I think that has advantages in
> general for future integration stuff anyways, but it isn't a
> "quick fix", if that's what you were hoping for.


Yes, I was hoping for a quick fix. But I can live with the current
situation, now that I have learned how to manage the focus with the
help of my window manager (in all browsers I tried).

In the meantime I found that the Tcl-plugin also works (again) in a
recent version of Opera:
Version 7.54 u1
Build 892
Platform SunOS
System sun4u, 5.8
Qt library 3.0.5

I have found only earlier reports of Opera 6 working with Tcl-plugin
v2.0, and the Tcl-plugin isn't even mentioned on their page "Plug-ins"
http://www.opera.com/docs/plugins/index.dml

Thanks again for the help and great work, Daniel.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com