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 E257077AD8 for ; Wed, 29 Jun 2016 21:34:03 -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 AE533400D36 for ; Wed, 29 Jun 2016 21:35:40 -0700 (PDT) Received: from kevc (carhart.net [192.168.1.179]) by carhart.net (8.13.8/8.13.8) with ESMTP id u5U4Zdoc000578; Wed, 29 Jun 2016 21:35:40 -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:35:39 -0700 Message-ID: <20160529213539.kevin@carhart.net > Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=nextpart-eb-157919 Content-Transfer-Encoding: 7bit Subject: [Edbrowse-dev] [PATCH] bundle of changes that makes diedrescher link work 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:34:04 -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-157919 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>From 3881be938b602018cf426006d9a29e32b49d1041 Mon Sep 17 00:00:00 2001 From: Kevin Carhart Date: Wed, 29 Jun 2016 20:10:30 -0700 Subject: [PATCH] Changes that get you successfully from a click on a diedrescher.com link, to javascript, to xhr, to content coming back = over xhr and into a div on the edbrowse side, thus illustrating the complete = circuit for other pages as well. Please see edbrowse-dev post for more detail = of what was done and why. --- src/decorate.c | 25 ++++++++- src/jseng-moz.cpp | 16 +++--- src/startwindow.js | 150 = ++++++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 177 insertions(+), 14 deletions(-) diff --git a/src/decorate.c b/src/decorate.c index 3773e26..4092ac5 100644 --- a/src/decorate.c +++ b/src/decorate.c @@ -820,6 +820,7 @@ call out to process those and add them to the = object */ /* Other attributes that are expected by pages, even if they * aren't populated at domLink-time */ set_property_string(io, "className", ""); +set_property_string(io, "class", ""); set_property_string(io, "nodeValue",""); instantiate_array(io, "attributes"); set_property_object(io, "ownerDocument", cw->docobj); @@ -894,6 +895,7 @@ set_property_object(io, "ownerDocument", = cw->docobj); =20 if (htmlclass) { set_property_string(io, "className", htmlclass); + set_property_string(io, "class", htmlclass); } =20 t->jv =3D io; @@ -1025,6 +1027,7 @@ static void jsNode(struct htmlTag *t, bool = opentag) w =3D emptyString; set_property_string(t->jv, "data", w); set_property_string(t->jv, "nodeName", "text"); + set_property_number(t->jv, "nodeType", 3); } break; =20 @@ -1050,52 +1053,62 @@ static void jsNode(struct htmlTag *t, bool = opentag) }else { set_property_string(t->jv, "data", ""); } + set_property_number(t->jv, "nodeType", 1); break; case TAGACT_FORM: domLink(t, "Form", "action", "forms", cw->docobj, 0); set_onhandlers(t); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_INPUT: formControlJS(t); if (t->itype =3D=3D INP_TA) establish_inner(t->jv, t->value, 0, true); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_OPTION: optionJS(t); // The parent child relationship has already been established, // don't break, just return; + set_property_number(t->jv, "nodeType", 1); return; =20 case TAGACT_A: domLink(t, "Anchor", "href", "anchors", cw->docobj, 0); set_onhandlers(t); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_HEAD: domLink(t, "Head", 0, "heads", cw->docobj, 0); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_BODY: domLink(t, "Body", 0, "bodies", cw->docobj, 0); set_onhandlers(t); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_OL: case TAGACT_UL: case TAGACT_DL: domLink(t, "Lister", 0, 0, cw->docobj, 0); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_LI: domLink(t, "Listitem", 0, 0, cw->docobj, 0); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_TABLE: domLink(t, "Table", 0, "tables", cw->docobj, 0); /* create the array of rows under the table */ instantiate_array(t->jv, "rows"); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_TR: @@ -1103,6 +1116,7 @@ static void jsNode(struct htmlTag *t, bool = opentag) domLink(t, "Trow", 0, "rows", above->jv, 0); instantiate_array(t->jv, "cells"); } + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_TD: @@ -1110,16 +1124,19 @@ static void jsNode(struct htmlTag *t, bool = opentag) domLink(t, "Cell", 0, "cells", above->jv, 0); establish_inner(t->jv, t->innerHTML, 0, false); } + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_DIV: domLink(t, "Div", 0, "divs", cw->docobj, 0); establish_inner(t->jv, t->innerHTML, 0, false); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_OBJECT: domLink(t, "HtmlObj", 0, "htmlobjs", cw->docobj, 0); establish_inner(t->jv, t->innerHTML, 0, false); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_SPAN: @@ -1128,28 +1145,34 @@ static void jsNode(struct htmlTag *t, bool = opentag) case TAGACT_OVB: domLink(t, "Span", 0, "spans", cw->docobj, 0); establish_inner(t->jv, t->innerHTML, 0, false); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_AREA: domLink(t, "Area", "href", "areas", cw->docobj, 0); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_FRAME: domLink(t, "Frame", "src", "frames", cw->winobj, 0); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_IMAGE: domLink(t, "Image", "src", "images", cw->docobj, 0); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_P: domLink(t, "P", 0, "paragraphs", cw->docobj, 0); establish_inner(t->jv, t->innerHTML, 0, false); + set_property_number(t->jv, "nodeType", 1); break; =20 case TAGACT_TITLE: if (cw->ft) set_property_string(cw->docobj, "title", cw->ft); + set_property_number(t->jv, "nodeType", 1); break; =20 } /* switch */ @@ -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}, {"map", "an image map", TAGACT_MAP, 2, 4}, {"area", "an image map area", TAGACT_AREA, 0, 4}, {"table", "a table", TAGACT_TABLE, 10, 1}, diff --git a/src/jseng-moz.cpp b/src/jseng-moz.cpp index 429353e..9a0adca 100644 --- a/src/jseng-moz.cpp +++ b/src/jseng-moz.cpp @@ -1888,12 +1888,17 @@ static JSObject *setTimeout(unsigned int argc, = jsval * argv, bool isInterval) const char *allocatedName =3D NULL; const char *s =3D NULL; =20 - 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 -badarg: - JS_ReportError(jcx, "invalid arguments to %s()", methname); - return NULL; } /* setTimeout */ =20 /* set timer and set interval */ diff --git a/src/startwindow.js b/src/startwindow.js index b9b8451..77053c5 100644 --- a/src/startwindow.js +++ b/src/startwindow.js @@ -16,7 +16,8 @@ The classes are created first, so that you can write = meaningful prototypes here. * Better to have something than nothing at all. */ height =3D 768; width =3D 1024; -status =3D 0; +// document.status is removed because it creates a conflict with +// the status property of the XMLHttpRequest implementation defaultStatus =3D 0; returnValue =3D true; menubar =3D true; @@ -30,6 +31,8 @@ document.bgcolor =3D "white"; document.readyState =3D "loading"; document.nodeType =3D 9; document.implementation =3D {}; +// pages seem to want document.style to exist +document.style =3D {"bgcolor":"white"}; =20 screen =3D new Object; screen.height =3D 768; @@ -64,7 +67,7 @@ return document.gebtn$(this, s); } 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 @@ -1247,3 +1333,55 @@ new_url =3D sideprotocol + '//' + sidehost + = path; return new_url; } =20 +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]; + } + } +} + +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-157919--