From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from qmta13.westchester.pa.mail.comcast.net (qmta13.westchester.pa.mail.comcast.net [IPv6:2001:558:fe14:44:76:96:59:243]) by hurricane.the-brannons.com (Postfix) with ESMTP id 4B7B677AD6 for ; Sun, 5 Jan 2014 07:34:39 -0800 (PST) Received: from omta11.westchester.pa.mail.comcast.net ([76.96.62.36]) by qmta13.westchester.pa.mail.comcast.net with comcast id AFWv1n0030mv7h05DFaTfV; Sun, 05 Jan 2014 15:34:27 +0000 Received: from eklhad ([107.5.36.150]) by omta11.westchester.pa.mail.comcast.net with comcast id AFaS1n00u3EMmQj3XFaTTy; Sun, 05 Jan 2014 15:34:27 +0000 To: Edbrowse-dev@lists.the-brannons.com From: Karl Dahlke User-Agent: edbrowse/3.4.10 Date: Sun, 05 Jan 2014 10:34:26 -0500 Message-ID: <20140005103426.eklhad@comcast.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1388936067; bh=g8BKNrrkTNtw7szPVEA8KV29Dutfm+LQWlFtVw8ctzk=; h=Received:Received:To:From:Reply-to:Subject:Date:Message-ID: Mime-Version:Content-Type; b=FnToNSHENPYV1lDXTl+5/eu9yPVeyA6Rxki4XroKhZxW8uzr8N5kk1GDKF3uvM83s cF8BLUy+QAZK2KyfTwGCm0qFTe0oUWjiH3P+NJl2+wKAJkXaoch+aqFBK0H1lZfpDt ufiK72EpNfORsLRMq22FzzYFoZgm0VoPxU/xTCQXN1LPfI3ADe1xzpaVIrjuhFIGnb ZBSkPSLDexHT4pmTVSTPQGv30TyZk3lGYw1UpNs/2M+kp2h1T+0+SAUjjLgh7kz3Ye /jWjUPPRWL8Cx7vDNmh+UdisAFu4Bk13ThruvpK86679RbhtE8DscF5lbTsuJb5+g4 VaZ65GN8aIr5A== Subject: [Edbrowse-dev] Maybe do more with strings, maybe do everything with strings X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.17 Precedence: list Reply-To: Karl Dahlke List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 15:34:39 -0000 When I first create the js runtime context, and when I first create a window to go with the html page, there are quite a few variables and functions that I set up within js itself, only because it was easier to do it that way. Look for the word initScript in jsdom.c. And I likely could have put more stuff in there. This raises some questions. Are all the variables and functions that I made in that manner protected from gc? Is that a method that works? Could it be used more often, and would that be easier and safer, mostly safer, than what we are doing now? Example: the function establish_property_string, which puts a string beneath an object. This is in jsloc.c. What if it looked like this instead. establish_property_string(const char *this_obj, const char *name, const char *value) this_obj is the full name of the object, "document.forms.foo.bar" name and value are as they are today. The function is then a silly wrapper. { char delim = '"'; // string delimiter // you may need to switch delim to '\'' if value contains quotes. // If value contains both quotes and apostrophes I'm not sure what to do. string smallScript =this_obj + "." + name + " = " + delim + valu + delim; JS_EvaluateScript(jcx, jwin, smallScript, "establish_property_string", 1, &rval); } That last line being replaced with whatever the new call is to run the js engine on a string. Looks easy; easier than what we're doing - except we would have to maintain string pointers instead of object pointers, even outside of js*.c, possibly changing stuff in other files. Might be worth stepping back a bit and see if this is a better approach. It would almost surely be safer once complete, since everything is done in their world, playing by their rules. Karl Dahlke