hterm terminal emulator on firefox

494 views
Skip to first unread message

Krishna Srinivas

unread,
May 1, 2013, 3:07:44 PM5/1/13
to chromiu...@chromium.org
Hi Robert/all,
Has anyone tried to port hterm (just hterm, not ssh related files)
terminal emulator to firefox? if not how hard will it be to do it?
Thanks
Krishna

Robert Ginda

unread,
May 1, 2013, 3:48:16 PM5/1/13
to Krishna Srinivas, chromium-hterm
AFAIK, nobody is working on this.  I tried to keep hterm free from Chrome-isms, but have never tried to port it.  I expect it won't be that difficult.

There are a few places where "-webkit" prefixed CSS properties are used, but they don't look that important (I just grepped for "webkit" in hterm/js).  hterm_frame.js has some flexbox stuff, but that code isn't critical to the terminal itself.  The text-size-adjust code in hterm_scrollport.js was for detecting browser zoom and is busted now anyway.  There is some -webkit-transition going on in hterm_terminal.js, but that's just for a smoother cursor blink effect.

There is some Chrome specific stuff going on in the default preference storage class, but you can substitute lib.Storage.Chrome for lib.Storage.Local to use window.localStorage instead.

If you decide to do it, I'm happy to answer any porting questions you may have.


Rob.

Krishna Srinivas

unread,
May 1, 2013, 4:27:36 PM5/1/13
to Robert Ginda, chromium-hterm
Thanks Robert, I will get back if I have any questions.

Robert Ginda

unread,
May 1, 2013, 5:58:07 PM5/1/13
to Krishna Srinivas, chromium-hterm
Great.  Of course I'd prefer to avoid a fork, so please send along whatever changes need to be made and we'll get them merged into the existing repo.


Rob.

Krishna Srinivas

unread,
May 5, 2013, 1:24:23 AM5/5/13
to Robert Ginda, chromium-hterm
Robert,
Things were breaking of firefox because of this behavior:
http://stackoverflow.com/questions/16381648/behavior-of-iframe-contentdocument-in-chrome-and-firefox

If you have any idea please let me know.

Thanks,
web newbie.

Krishna Srinivas

unread,
May 5, 2013, 2:43:06 AM5/5/13
to Robert Ginda, chromium-hterm
Got it working on firefox! Looks like there is a race bug in firefox
(I have put an explanation in the stackoverflow link)

Robert Ginda

unread,
May 6, 2013, 3:51:57 PM5/6/13
to Krishna Srinivas, chromium-hterm
Great to hear.  What did you have to change?

Krishna Srinivas

unread,
May 6, 2013, 4:15:52 PM5/6/13
to Robert Ginda, chromium-hterm
On Tue, May 7, 2013 at 1:21 AM, Robert Ginda <rgi...@chromium.org> wrote:
> Great to hear. What did you have to change?

I will mail the changes that were done.

Have a look at the response by "Boris Zbarsky" here:
http://stackoverflow.com/questions/16381648/behavior-of-iframe-contentdocument-in-chrome-and-firefox

So it is not a race/bug. Just that once we create iframe we have to
wait till about:blank is loaded before we "decorate" it as about:blank
is loaded asynchronously.

in hterm.ScrollPort.prototype.decorate() immediately after we create
the iframe we decorate it. But all the decoration is lost because
"about:blank" page is loaded asynchronously into the iframe causing
the problem.

Harry Percival

unread,
Jun 7, 2013, 7:23:02 AM6/7/13
to chromiu...@chromium.org, Robert Ginda
Did this ever get merged back into hterm?  Am just trying to hack together an hterm in Firefox, and it's complaining a lot whenever there's a reference to "chrome."...

Harry Percival

unread,
Jun 7, 2013, 8:22:51 AM6/7/13
to chromiu...@chromium.org, Robert Ginda
fixed it with a few horrible hacks, and also the references to "FileError" (come on firefox, catch up!), but am now running into what I think is the same problem as Krishna saw -- the terminal appears briefly but then gets blown away.  I think this is the about:blank async load in the iframe killing all the nice stuff Terminal has done.

hterm.ScrollPort.prototype.decorate  seems to be the main place that suffers, but just doing a big naive setTimeout on the whole function doesn't work because other places expect this.screen to be ready...

maybe we could do something like create a this.screen that's a detached bit of DOM, and then attach it to the iframe once it's loaded? 

Robert Ginda

unread,
Jun 7, 2013, 10:55:07 AM6/7/13
to Harry Percival, chromium-hterm

No, it hasn't been merged back yet.  I've received the patches but haven't had a chance to review them yet.

I'm on vacation now and replying from my phone.  I'll update this thread again when I have a chance.

Krishna Srinivas

unread,
Jun 27, 2013, 3:32:46 PM6/27/13
to Robert Ginda, Harry Percival, chromium-hterm
Harry,

Here is the diff : https://nutty.io/hterm/firefox-hterm.diff.txt
Here is the modified hterm.js :
https://github.com/nuttydotio/nutty.io/blob/master/other/hterm.js

Note that for this to work the html file will already have iframe defined:

<div id='terminal' style="position:relative;">
<iframe id="terminal-iframe" style="border:0px; width:0px;
height:0px"></iframe>
</div>

So iframe is not added to the DOM dynamically. This was a quick fix
for me. It might not be clean way to do things for hterm code base.
Reply all
Reply to author
Forward
0 new messages