On Tue, Feb 04, 2014 at 02:17:19PM -0500, Karl Dahlke wrote: > > In edbrowse each window has its own js context. > > Ok. > > > Each page within that window has its own global object. > > But there is only one page within the window. > An edbrowse window has one html file, one context, > and One global object via JS_NewGlobalObject(). > Each context has one global object, and thus one compartment. > So the context is given as the first argument to a js function, > and from there there should be just one compartment and one global object. > I don't see how js could ever get the wrong compartment, > there is only one to choose from.
In theory, but the compartment field is, by default, NULL. The context needs to explicitly be told to use the compartment of the global object. > > What this means when switching pages is that the context needs to be > > switched > > Switch to another edbrowse page and you get another js context, > with its one and only one global object. > > I don't doubt you at all when you say the compartment calls > are necessary, I'm just trying to figure out why they are necessary. > If they are, maybe could be confined to jSyncup(), > which starts the javascript thread, and j new context to build > the global for the first time. When I say a page within a window I'm referring to the ability of edbrowse to go back pages. This seems to be where the trouble happens with compartments, and to fix this I just used the autocompartment construct. How are js contexts handled in this case? Cheers, Adam. _______________________________________________ Edbrowse-dev mailing list [email protected] http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev
