edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] error legs first step
@ 2014-02-09 21:02 Karl Dahlke
  2014-02-09 21:50 ` Chris Brannon
  0 siblings, 1 reply; 3+ messages in thread
From: Karl Dahlke @ 2014-02-09 21:02 UTC (permalink / raw)
  To: Edbrowse-dev

I wanted to ask you about this before I did anything.

I think the first step in error legs is to allow for the possibility
of cw->jss = null.
It would become null if we encountered an error,
and decided to free the java context,
but still march on with the rest of edbrowse.
That would among other things reclaim the memory used by that context.

And I wouldn't even create the context if javascript was disabled
or disabled for that site.
This is something Adam asked about earlier.
It would be just one line of code change in buffers.c line 4850.
But I have to make sure things don't blow up if jss is null.
So many functions now start out with AutoCompartment as their first line;
before that I would put in

if(!cw->jss) return;

Or something like that.
Anyways I would suggest this as the first step.

Karl Dahlke

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Edbrowse-dev] error legs first step
  2014-02-09 21:02 [Edbrowse-dev] error legs first step Karl Dahlke
@ 2014-02-09 21:50 ` Chris Brannon
  2014-02-10 10:17   ` Adam Thompson
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Brannon @ 2014-02-09 21:50 UTC (permalink / raw)
  To: Edbrowse-dev

Karl Dahlke <eklhad@comcast.net> writes:

> I think the first step in error legs is to allow for the possibility
> of cw->jss = null.
> It would become null if we encountered an error,

This sounds good to me.

-- Chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Edbrowse-dev] error legs first step
  2014-02-09 21:50 ` Chris Brannon
@ 2014-02-10 10:17   ` Adam Thompson
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Thompson @ 2014-02-10 10:17 UTC (permalink / raw)
  To: Chris Brannon; +Cc: Edbrowse-dev

On Sun, Feb 09, 2014 at 01:50:08PM -0800, Chris Brannon wrote:
> Karl Dahlke <eklhad@comcast.net> writes:
> 
> > I think the first step in error legs is to allow for the possibility
> > of cw->jss = null.
> > It would become null if we encountered an error,
> 
> This sounds good to me.

Same here. To be honest, I've half been thinking of making a macro to do
something like:
#define SWITCH_COMPARTMENT(retval) if ((cw->jss == NULL) || (cw->jss->jcx == NULL)) \
 return (retval); \
JSAutoCompartment ac(cw->jss->jcx, cw->jss->jwin)

Usage would probably look like (for an eb_bool function):
SWITCH_COMPARTMENT(eb_false);

For a void function it would be:
SWITCH_COMPARTMENT(void);

This needs to be a macro for the return,
and of course assumes we never use ac as a var name for something else (could be made a parameter if we need).

Cheers,
Adam.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-10 10:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-09 21:02 [Edbrowse-dev] error legs first step Karl Dahlke
2014-02-09 21:50 ` Chris Brannon
2014-02-10 10:17   ` Adam Thompson

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).