edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Adam Thompson <arthompson1990@gmail.com>
To: Karl Dahlke <eklhad@comcast.net>
Cc: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] compartments
Date: Wed, 5 Feb 2014 22:09:44 +0000	[thread overview]
Message-ID: <20140205220944.GQ32200@toaster.adamthompson.me.uk> (raw)
In-Reply-To: <20140105085547.eklhad@comcast.net>

On Wed, Feb 05, 2014 at 08:55:47AM -0500, Karl Dahlke wrote:
> There are two paths to javascript,
> creating the global object in the first place,
> and then activating js later, which always calls jSyncup
> to get things ready.
> But aha, raii won't work here.
> jSyncup calls and sets everything up and returns.
> Then all the other js functions are called.
> Set the compartment via raii in jSyncup, and when it returns
> your compartment is lost.
This is unfortunate as it'd be a nice simplification.

> We can only simplify things if there is a straight,
> old fashioned "set this compartment" call,
> that does not involve scope or distructors etc.
> I don't know if such a function exists.
> If yes then we can clean things up a lot.
> If no then we can't.

There is but it's being phased out (i.e.
may disappear whenever the mozilla developers get round to deleting it,
with the possibility of such a removal not being documented).
In addition it doesn't check if you've already switched into this compartment
so you could quickly find yourself building up a stack of equal compartment (pointers?
not sure) which just eat memory and can't be freed as they're protected properties
of the js context (I think).
At least I'm assuming that's how things work since you have to leave
compartments in the reverse order to that inwhich you entered them.

I tried to work around the RAII compartment logic,
but the thing exploded when I went back a page for some reason (NULL
compartment property in the context or a different compartment to that of the
global object or something). Anyway the only way to get things working without
a larger rewrite was to just use the recommended (if not particularly nice in
my opinion) RAII way of doing things.

To be honest I'm all for cleaning up these calls,
but I'd rather get all the good things we're doing at the moment stable and
ready for release then work out what kind of rewrite is required to tidy up the
Mozilla update.
Particularly as I think there've been many major bug fixes recently which really should be released relatively soon.
To do this properly we need to have some time when the code is stable
and we can just test for any other major bugs rather than making huge rewrites.
I also need to work out why the debian mozjs24d package causes edbrowse to just
segfault on startup whereas a manually compiled one doesn't (still haven't
heard about the compilation flags).

That being said, my first version of this message caused Edbrowse to segfault
(typing in too longer line I think),
so maybe we need to look into that one as well.

Cheers,
Adam.

  reply	other threads:[~2014-02-05 22:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05 13:55 Karl Dahlke
2014-02-05 22:09 ` Adam Thompson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-02-04 22:03 Karl Dahlke
2014-02-05 10:44 ` Adam Thompson
2014-02-04 19:17 Karl Dahlke
2014-02-04 21:00 ` Adam Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140205220944.GQ32200@toaster.adamthompson.me.uk \
    --to=arthompson1990@gmail.com \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    --cc=eklhad@comcast.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).