edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Chuck Hallenbeck <chuckhallenbeck@gmail.com>
Cc: Karl Dahlke <eklhad@comcast.net>, edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] amazon and its JS
Date: Sat, 13 Jan 2018 17:27:15 +0100	[thread overview]
Message-ID: <20180113162715.GA16048@nautica> (raw)
In-Reply-To: <alpine.DEB.2.21.1801131054540.1328@debian.pulsar.com>

Hi all,

On my end I cannot log in either, using duktape's master, but I've been
playing a bit with duktape's debugging.

One thing I find odd is that the loading time for www.amazon.com (not
the sign in page) seems to vary greatly from one run to another.
Sometimes it loads in tens of seconds (slow but bearable), but sometimes
it takes as much as five minutes to load, and I'd be hard pressed to say
what's different... I was blaming the duktape's debugger for speed but
it could be something else entierly.


On the other hand, I have implemented some of the duktape's debugging
protocol into edbrowse, you will need to build with a checkout of
duktape's and you need to edit duk_config.h to make at least
DUK_USE_DEBUGGER_SUPPORT into #define, then pull in my master's branch
(https://github.com/martinetd/edbrowse.git)


So far I don't do anything with debugger except listening to events,
duktape is kind enough to tell us about all 'throw' exceptions in the js
code even if they are caught -- without debugging we can only see the
uncaught ones, maybe some caught exceptions can be a hint.

I've got to say though that amazon's code really is a pain to debug with
the obfuscated variables though...

So far I've had these errors (without demin here so don't trust line
numbers too much)


uncaught throw: ReferenceError: identifier 'querySelectorAll' undefined
(line 1417)

uncaught throw: TypeError: undefined not callable (property
'appendChild' of [object Object]) (line 887)

caught throw: ReferenceError: identifier 'Canvas' undefined (line 1227)

caught throw: TypeError: cannot read property 'indexOf' of undefined
(line 13)

uncaught throw: TypeError: undefined not callable (property
'setAttribute' of [object Object]) (line 18)

uncaught throw: TypeError: undefined not callable (property
'setAttribute' of [object Object]) (line 17)


and in a timer (I removed prints when in timer in last commit):
caught throw: TypeError: undefined not callable (property 'getAttribute'
of [object Object]) (line 27)


I have only walked through the very first of these :
querySelectorAll seems to be invoked from document
 (e.g. document.querySelectorAll()) modulo tons of obfuscation.
I thought this would be easy to fix by just adding a line in
startwindows.js like this :
document.querySelectorAll = querySelectorAll
But that doesn't seem to work because querySelectorAll is defined in
third.js, not sure how to proceed here.


It took me a long time just to figure that querySelectorAll was looked
at from document though, mostly because of amazon's code, but I think
stopping in the context of the duktape debugger might help a bit. We
could have the js call stack at the time of the throw for example (might
not be of much help for amazon), or we could dump local variables.
See https://github.com/svaarala/duktape/blob/master/doc/debugger.rst for
available functions, anything under "Commands sent by debug client"
would be available with a bit more glue.

Initially I wanted to just let us run the jdb prompt from buffer.c
whenever a throw came in, but we can't because this assumes it can
process js normally (timers etc) and I think this will hang while
debugger is paused, we need to use the debugger eval at this point so I
might make a second jdb on that side if it works well.

-- 
Dominique

  reply	other threads:[~2018-01-13 16:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-13  0:12 Kevin Carhart
2018-01-13 14:11 ` Karl Dahlke
2018-01-13 15:55   ` Chuck Hallenbeck
2018-01-13 16:27     ` Dominique Martinet [this message]
2018-01-13 17:12       ` Dominique Martinet
2018-01-13 22:06       ` Karl Dahlke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180113162715.GA16048@nautica \
    --to=asmadeus@codewreck.org \
    --cc=chuckhallenbeck@gmail.com \
    --cc=edbrowse-dev@lists.the-brannons.com \
    --cc=eklhad@comcast.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).