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 7A85E789FB for ; Sun, 27 Sep 2015 22:57:37 -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 DE34C4004A2 for ; Sun, 27 Sep 2015 23:00:54 -0700 (PDT) Received: from kevc (carhart.net [192.168.1.179]) by carhart.net (8.13.8/8.13.8) with ESMTP id t8S60qQF010585; Sun, 27 Sep 2015 23:00:53 -0700 To: Edbrowse-dev@lists.the-brannons.com From: Kevin Carhart Reply-to: Kevin Carhart User-Agent: edbrowse/3.5.4.2 Date: Sun, 27 Sep 2015 23:00:52 -0700 Message-ID: <20150827230052.kevin@carhart.net > Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=nextpart-eb-791056 Content-Transfer-Encoding: 7bit Subject: [Edbrowse-dev] [patch] [experimental] JS console patch X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2015 05:57:37 -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-791056 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Here is my JS console code. The commands I currently use are: eg =3D enumerate globals jex =3D javascript execute ok =3D object keys - this is the JS function that eg runs, so you can then call it in an expression like alert(ok(blah)) 'eg' and 'jex' do not exactly roll off the tongue. Could be changed into another command. What my fingers are accustomed to is 'x' and 'y' Here is some sample usage: b http://pizza.com [the page loads and the file sizes are returned] eg [voluminous output of about 100 objects and scalars, most having to do = with google ads and god knows what] jex alert('hello world') hello world jex var x =3D 5 ? jex alert(x) 5 jex alert(ok(document)) [voluminous output of enumeration of all objects under document, = presently ending in our gc objects gc$$814, gc$$815, gc$$816] jex for (blah in window) { alert(blah) } [all of the objects in window, formatted with newlines] jex alert(google_adk2_experiment) N [Well that's a relief! Nice to know I am not a subject in an adk2 = experiment. All I wanted was some pizza...] jex alert(google_jobrunner) [object Object] [google_jobrunner is an object. I'm curious what's in it.] jex alert(ok(google_jobrunner)) u,m,l,s,G jex var jr =3D google_jobrunner ? [Making an alias on the fly.] jex alert(jr) [object Object] jex alert(jr.u) [object Object] jex alert(jr.m) [object Window] jex alert(jr.l) 0 jex alert(jr.s) null jex alert(jr.G) 0 [This scratches the surface .. function bodies can also be echoed and = can be run using eval. Get a sanity check on what you are debugging.. = take 'typeof' different things to verify your assumptions... etc.] --nextpart-eb-791056 Content-Type: text/plain; name="/home/kevin/public_html/c7/edbrowse/jsconsole_20150927.patch" Content-Transfer-Encoding: 7bit diff -Naur 1/src/buffers.c 2/src/buffers.c --- 1/src/buffers.c 2015-09-27 11:06:51.000000000 -0700 +++ 2/src/buffers.c 2015-09-27 22:15:31.656778785 -0700 @@ -3554,6 +3554,44 @@ return true; } + if (stringEqual(line, "eg")) { + static const char jsconsole1[] = "ok = Object.keys = Object.keys || (function () { \n\ + var hasOwnProperty = Object.prototype.hasOwnProperty, \n\ + hasDontEnumBug = !{toString:null}.propertyIsEnumerable(\"toString\"),\n\ + DontEnums = [ \n\ + 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', \n\ + 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' \n\ + ], \n\ + DontEnumsLength = DontEnums.length; \n\ + return function (o) { \n\ + if (typeof o != \"object\" && typeof o != \"function\" || o === null) \n\ + throw new TypeError(\"Object.keys called on a non-object\");\n\ + var result = []; \n\ + for (var name in o) { \n\ + if (hasOwnProperty.call(o, name)) \n\ + result.push(name); \n\ + } \n\ + if (hasDontEnumBug) { \n\ + for (var i = 0; i < DontEnumsLength; i++) { \n\ + if (hasOwnProperty.call(o, DontEnums[i]))\n\ + result.push(DontEnums[i]);\n\ + }\n\ + }\n\ + return result; \n\ + }; \n\ + })(); \n\ + alert(Object.keys(this)); \n\ + "; + javaParseExecute(cw->winobj, jsconsole1, "",1); + return true; + } + + if (!strncmp(line, "jex ", 4)) { + char* routineonly = line + 4; + javaParseExecute(cw->winobj, routineonly, "",1); + return true; + } + if (stringEqual(line, "lna")) { listNA ^= 1; if (helpMessagesOn || debugLevel >= 1) --nextpart-eb-791056--