From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out.smtp-auth.no-ip.com (smtp-auth.no-ip.com [8.23.224.61]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 14CDA77AD8 for ; Wed, 29 Jun 2016 21:27:53 -0700 (PDT) X-No-IP: carhart.net@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from carhart.net (unknown [99.52.200.227]) (Authenticated sender: carhart.net@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id E85B8401CD3 for ; Wed, 29 Jun 2016 21:29:29 -0700 (PDT) Received: from kevc (carhart.net [192.168.1.179]) by carhart.net (8.13.8/8.13.8) with ESMTP id u5U4TTOp029121; Wed, 29 Jun 2016 21:29:29 -0700 To: Edbrowse-dev@lists.the-brannons.com From: Kevin Carhart Reply-to: Kevin Carhart User-Agent: edbrowse/3.5.4.2 Date: Wed, 29 Jun 2016 21:29:29 -0700 Message-ID: <20160529212929.kevin@carhart.net > Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=nextpart-eb-190416 Content-Transfer-Encoding: 7bit Subject: [Edbrowse-dev] patch remarks X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.21 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2016 04:27:53 -0000 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --nextpart-eb-190416 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This is not the full code but some remarks on what and my reasoning. I hope this email style is readable. ----------------------------- Remark: This is the decorate.c portion +set_property_string(io, "class", ""); --------------------------- Remark: I am going to redundantly establish both 'class' and = 'className' in decorate because it seems that they are both used = sometimes. =20 ----------------------- Remark: Here I redundantly add class as well as className to the htmlclass if (htmlclass) { set_property_string(io, "className", htmlclass); + set_property_string(io, "class", htmlclass); } =20 ----------------------- Remark: Now I'm in jsNode. I specify nodeType in every case. It is mostly set to 1, which is the value for any element. Could this be done more generically - probably. It may help clarity if it is spread out. =20 set_property_number(t->jv, "nodeType", 3); set_property_number(t->jv, "nodeType", 1); etc etc =20 =20 -------------------- Remark: Next change is that I commented out the "iframe" entry from availableTags. It seemed to crash edbrowse. Pages do exotic things inside of iframes. So I wanted to see what would happen if I set it aside and work without them temporarily. @@ -1251,7 +1274,7 @@ const struct tagInfo availableTags[] =3D { {"form", "a form", TAGACT_FORM, 10, 1}, {"button", "a button", TAGACT_INPUT, 0, 4}, {"frame", "a frame", TAGACT_FRAME, 2, 4}, - {"iframe", "a frame", TAGACT_FRAME, 2, 4}, +// {"iframe", "a frame", TAGACT_FRAME, 2, 4}, ------------------------- Remark: Next is the jseng-moz.cpp portion. setTimeout is the only function that I changed. @@ -1888,12 +1888,17 @@ static JSObject *setTimeout(unsigned int argc, = jsval * argv, bool isInterval) =20 ------------------------ Remark: here are my setTimeout changes. This is the only thing I did to jseng-moz.cpp. Is my solution leaky? Could be. If the=20 callor sends legal code, I think it works. If the callor doesn't send legal code, you have problems other than the number of arguments. It could use improvement. - if (argc !=3D 2 || !JSVAL_IS_INT(argv[1])) - goto badarg; =20 v0 =3D argv[0]; - v1 =3D argv[1]; - n =3D JSVAL_TO_INT(v1); + if (argc !=3D 2 || !JSVAL_IS_INT(argv[1])) + { + // if only one parameter was supplied, hardcode + // a number of milliseconds. 1? 100? 1000? + n =3D 100; + } else { + v1 =3D argv[1]; + n =3D JSVAL_TO_INT(v1); + } if (JSVAL_IS_STRING(v0) || v0.isObject() && JS_ValueToObject(jcx, v0, fo.address()) && @@ -1980,9 +1985,6 @@ abort: return to; } =20 --------------------- Remark: I entirely removed the badargs label -badarg: - JS_ReportError(jcx, "invalid arguments to %s()", methname); - return NULL; } /* setTimeout */ =20 ------------------ Remark: The rest of my changes are entirely in startwindow.js -status =3D 0; +// document.status is removed because it creates a conflict with +// the status property of the XMLHttpRequest implementation +// pages seem to want document.style to exist +document.style =3D {"bgcolor":"white"}; =20 ------------------- Remark: I think maybe both sides of the comparison need to be lowercased in the three getElementsBy functions. My example scenario was that var weird =3D document.getElementsByClassName("liveSmall toggled links") returned no elements but var weird =3D document.getElementsByClassName("livesmall toggled links") did. document.gebtn$ =3D function(top, s) {=20 var a =3D new Array; -if(s =3D=3D=3D '*' || (top.nodeName && top.nodeName =3D=3D=3D s)) +if(s =3D=3D=3D '*' || (top.nodeName && top.nodeName.toLowerCase() = =3D=3D=3D s)) a.push(top); if(top.childNodes) { for(var i=3D0; i 0){ this.readyState =3D 4; +this.status =3D 200; +this.statusText =3D "OK"; this.onreadystatechange(); } =20 } =20 ---------------------- Remark: Pages want some things having to do with CSS that we haven't done yet, such as getComputedStyle, defaultView and the CSS Specification. So in the next change I add four things having to do with how pages query objects for their styles. +document.defaultView =3D function() +{ +return this.style; +} + +document.defaultView.getComputedStyle =3D function() +{ + obj =3D new CSSStyleDeclaration; + obj.element =3D document; + obj.style =3D document.style; + return obj; +} + +getComputedStyle =3D function(n) +{ + obj =3D new CSSStyleDeclaration; + obj.element =3D this; + obj.style =3D new Array; + obj.style.push({n:obj.style[n]}); + return obj; +} + +CSSStyleDeclaration =3D function(){ + this.element =3D null; + this.style =3D null; +}; + +CSSStyleDeclaration.prototype =3D { +getPropertyValue: function (n) + { + if (this.style[n] =3D=3D undefined) + { + this.style[n] =3D 0; + return 0; + } else { + return this.style[n]; + } + } +} + ------------------- Remark: Last thing: this is my implementation of Event, which I added = to the addEventHandler code. +Event =3D function(options){ + this._bubbles =3D true; + this._cancelable =3D true; + this._cancelled =3D false; + this._currentTarget =3D null; + this._target =3D null; + this._eventPhase =3D Event.AT_TARGET; + this._timeStamp =3D new Date().getTime(); + this._preventDefault =3D false; + this._stopPropagation =3D false; +}; + --=20 1.8.3.2 --nextpart-eb-190416--