* [Edbrowse-dev] showscripts()
@ 2018-01-30 15:41 Karl Dahlke
0 siblings, 0 replies; 11+ messages in thread
From: Karl Dahlke @ 2018-01-30 15:41 UTC (permalink / raw)
To: Edbrowse-dev
[-- Attachment #1: Type: text/plain, Size: 549 bytes --]
The showscripts command, for debugging, only shows the scripts produced by html.
This is a problem as more and more scripts are created dynamically.
Pass in 1, or true, showscripts(1), to see all scripts under document.
These are gathered by getElementsByTagName("script");
The resulting list is left in document.scripts2,
so if you want to know more about script 4, access document.scripts2[4].
You can see the difference on most sites, example nasa; the second list is longer than the first, and indexes need not correspond.
Karl Dahlke
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Edbrowse-dev] showscripts()
2017-09-20 23:56 ` Dominique Martinet
@ 2017-09-23 23:40 ` Kevin Carhart
0 siblings, 0 replies; 11+ messages in thread
From: Kevin Carhart @ 2017-09-23 23:40 UTC (permalink / raw)
To: edbrowse-dev
On Thu, 21 Sep 2017, Dominique Martinet wrote:
>
> That aside I'd like to say good work everyone, I haven't had much time
> recently but it's good to see the list active !
hear hear. Thank you DM. It is an exciting period!
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Edbrowse-dev] showscripts()
2017-09-20 23:32 ` Geoff McLane
2017-09-20 23:56 ` Dominique Martinet
2017-09-20 23:59 ` Kevin Carhart
@ 2017-09-21 1:56 ` Karl Dahlke
2 siblings, 0 replies; 11+ messages in thread
From: Karl Dahlke @ 2017-09-21 1:56 UTC (permalink / raw)
To: edbrowse-dev
Well I think others have answered your questions; but here's a screen snap.
$ edbrowse
edbrowse ready
demin
deminimize javascript
b www.nasa.gov
15852
1839
lines 49 through 50 have been added
jdb
7+8+9
24
document.body.childNodes[0].nodeName
div
dumptree(document.head)
head {
script {
}
script {
}
meta
meta
meta
meta
meta
meta
meta
meta
link
meta
link
meta
meta
meta
meta
meta
link
link
meta
meta
meta
meta
meta
meta
meta
meta
meta
meta
meta
link
link
link
link
style {
text @import url("/sites/all/modules/custom/scald_before_after_image/scald_before_after_image.css?");
}
link
link
script {
}
script {
}
script {
}
script {
}
script {
}
script {
}
script {
}
script {
}
}
undefined
showscripts()
0: default https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency=NASA&yt=true&dclink=true length 20237
1: text/javascript inline length 865
2: default inline length 32
3: default https://www.nasa.gov/sites/all/themes/custom/nasatwo/js/vendor.js? length 2097837 deminimized
4: default https://www.nasa.gov/sites/all/themes/custom/nasatwo/js/nasa.js? length 2361381 deminimized
5: default inline length 9340
6: default inline length 532
7: default inline length 0
8: text/x-placeholder inline length 0
undefined
document.scripts[3].data ^> /tmp/vendor_demin.js
2097837 bytes
.
bye
q
$
Karl Dahlke
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Edbrowse-dev] showscripts()
2017-09-20 13:38 ` Karl Dahlke
@ 2017-09-21 0:33 ` Geoff McLane
0 siblings, 0 replies; 11+ messages in thread
From: Geoff McLane @ 2017-09-21 0:33 UTC (permalink / raw)
To: edbrowse-dev
> if it adds 100K ... removes 100K ... no gain.
Understood...
Well for windows zlib would still be a good choice... just add
find_package( ZLIB ), like the present find_package( Tidy ), etc, in
CMakeLists.txt, since at lease most Windows developers are very, VERY
likely to have ZLIB installed, as it is needed for a **lot** of projects...
And already have to setup the PATH to include other DLL's, like CURL...
to run eb...
But also understand this is not high priority... and actually
compression would certainly add a lot of other wrinkles, that may not be
worth the effort... and in Windows, a large EXE footprint, and
allocating lots of memory is the norm, and Windows handles it well...
Just for information, the eb Windows Release EXE is 1.9 MB, the Debug is
3 MB, plus 3.3 MB pdb, and 1.1 MB ilk files... and on loading the
nasa.gov site, using the MSVC debugger, shows some 67 MB of process
memory used, and takes about 3.5 minutes to load, using about 25% of the
CPU power, like 1 core, before falling to 0, waiting for the next
input... relatively quite a light-weight app compared to some I play
with...
So do not see any concern about eb memory usage... in Windows at
least... so shaving 50-100 K likewise does not seem worth the effort...
Regards, Geoff.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Edbrowse-dev] showscripts()
2017-09-20 23:32 ` Geoff McLane
2017-09-20 23:56 ` Dominique Martinet
@ 2017-09-20 23:59 ` Kevin Carhart
2017-09-21 1:56 ` Karl Dahlke
2 siblings, 0 replies; 11+ messages in thread
From: Kevin Carhart @ 2017-09-20 23:59 UTC (permalink / raw)
To: edbrowse-dev
Hi Geoff
We're using two javascript libraries in rapid succession to demin.
They're located in third.js and Karl's code then addresses them.
The first one is called esprima, and it turns javascript into an abstract
syntax tree. The second is called escodegen, which does the reverse,
turns an abstract syntax tree into JS. But it just so happens that
escodegen demins what it converts! So in a way we are using a
sledgehammer to bonk a mosquito since it's a lot of code. But it does
amount to nice demin'ed javascript at the end of the day. Thank you Karl!
K
On Thu, 21 Sep 2017, Geoff McLane wrote:
> Hi Karl,
>
> Ok, using strstrCI compiled fine in Windows... thanks...
>
> Now if I could find the actual code that demin's the code...
>
> I found html.c[543], that does if (demin) run_function_onearg(cf->winobj,
> "ed$demin", t->jv);, but still looking for the code...
>
> I tried running -
> $ edbrowse http://www.nasa.gov, and get -
> 15852
> 1839
> lines 49 through 50 have been added
>
> But then when I type showscipts(), I just get a ?
>
> Likewise typing dumptree() gets me another ?
>
> Obviously missing something here... sorry for being such a klutz... any help
> appreciated...
>
> Regards,
> Geoff.
>
> _______________________________________________
> Edbrowse-dev mailing list
> Edbrowse-dev@lists.the-brannons.com
> http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev
>
--------
Kevin Carhart * 415 225 5306 * The Ten Ninety Nihilists
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Edbrowse-dev] showscripts()
2017-09-20 23:32 ` Geoff McLane
@ 2017-09-20 23:56 ` Dominique Martinet
2017-09-23 23:40 ` Kevin Carhart
2017-09-20 23:59 ` Kevin Carhart
2017-09-21 1:56 ` Karl Dahlke
2 siblings, 1 reply; 11+ messages in thread
From: Dominique Martinet @ 2017-09-20 23:56 UTC (permalink / raw)
To: Geoff McLane; +Cc: edbrowse-dev
Hi Geoff,
Geoff McLane wrote on Thu, Sep 21, 2017:
> But then when I type showscipts(), I just get a ?
>
> Likewise typing dumptree() gets me another ?
>
> Obviously missing something here... sorry for being such a klutz...
> any help appreciated...
I think these are js function, so you should type them after entering
'jdb' mode ; I haven't tried yet though.
That aside I'd like to say good work everyone, I haven't had much time
recently but it's good to see the list active !
I was also curious about the startup time from having huge functions
like that compiled at every window, but with eb$master it's probably
fine now. Good idea.
--
Dominique
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Edbrowse-dev] showscripts()
2017-09-19 19:31 ` Karl Dahlke
@ 2017-09-20 23:32 ` Geoff McLane
2017-09-20 23:56 ` Dominique Martinet
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Geoff McLane @ 2017-09-20 23:32 UTC (permalink / raw)
To: edbrowse-dev
Hi Karl,
Ok, using strstrCI compiled fine in Windows... thanks...
Now if I could find the actual code that demin's the code...
I found html.c[543], that does if (demin)
run_function_onearg(cf->winobj, "ed$demin", t->jv);, but still looking
for the code...
I tried running -
$ edbrowse http://www.nasa.gov, and get -
15852
1839
lines 49 through 50 have been added
But then when I type showscipts(), I just get a ?
Likewise typing dumptree() gets me another ?
Obviously missing something here... sorry for being such a klutz... any
help appreciated...
Regards,
Geoff.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Edbrowse-dev] showscripts()
2017-09-19 17:58 ` Geoff McLane
2017-09-19 19:31 ` Karl Dahlke
@ 2017-09-20 13:38 ` Karl Dahlke
2017-09-21 0:33 ` Geoff McLane
1 sibling, 1 reply; 11+ messages in thread
From: Karl Dahlke @ 2017-09-20 13:38 UTC (permalink / raw)
To: Edbrowse-dev
[-- Attachment #1: Type: text/plain, Size: 646 bytes --]
> Concerning a Windows compression/decompression library ...
> total source is less than 500K.
Well yeah but if it adds 100K to the binary and removes 100K in the compressed string then we've done a lot of work for no gain.
Guess I was thinking about a shared library / dll that was just always there, that we could use for free.
Honestly I'm probably not going to bother with this any further, not a high priority.
I reduced the footprint by 218K just by stripping the comments out of the js files, and that's pretty good.
I could remove another 12.5% 53K by realizing the string is all ascii. That wouldn't be too hard.
Karl Dahlke
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Edbrowse-dev] showscripts()
2017-09-19 17:58 ` Geoff McLane
@ 2017-09-19 19:31 ` Karl Dahlke
2017-09-20 23:32 ` Geoff McLane
2017-09-20 13:38 ` Karl Dahlke
1 sibling, 1 reply; 11+ messages in thread
From: Karl Dahlke @ 2017-09-19 19:31 UTC (permalink / raw)
To: Edbrowse-dev
We wrote our own strstrCI() founction long ago for case independent strstr.
Latest push should solve your problem.
Karl Dahlke
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Edbrowse-dev] showscripts()
2017-09-19 2:38 Karl Dahlke
@ 2017-09-19 17:58 ` Geoff McLane
2017-09-19 19:31 ` Karl Dahlke
2017-09-20 13:38 ` Karl Dahlke
0 siblings, 2 replies; 11+ messages in thread
From: Geoff McLane @ 2017-09-19 17:58 UTC (permalink / raw)
To: Karl Dahlke, Edbrowse-dev
Hi Karl,
Got interested in trying your showscripts(), especially about your
choices on how to nicely split javascript into better readable lines...
I have tried this a few times in the past, and was interested in another
persons idea on how to do that...
But ran into the problem that I can not compile eb, in Windows... you
have added a strcasestr() in http.c which does not exist in Windows
system libraries...
I have started looking around, and so far it seems we will have to write
our own substitute function in windows... should not be too hard... and
see at least one example out there where this has been done...
But before I do this, thought I should check in with you... maybe you
know of something... and alternative...
Concerning a Windows compression/decompression library I have seen, and
used https://zlib.net, in several projects. The total source is less
than 500K, and has always compiled well in Windows... and if setup in
CMakeLists.txt can use the unix install, which always seems to be there...
But the first step is getting eb to compile in Windows... any help
appreciated... thanks...
Regards, Geoff.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Edbrowse-dev] showscripts()
@ 2017-09-19 2:38 Karl Dahlke
2017-09-19 17:58 ` Geoff McLane
0 siblings, 1 reply; 11+ messages in thread
From: Karl Dahlke @ 2017-09-19 2:38 UTC (permalink / raw)
To: Edbrowse-dev
This is a function just for our debugging, rather like dumptree().
On www.nasa.gov, this is the output.
showscripts()
0: default https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency=NASA&yt=true&dclink=true length 20237
1: text/javascript inline length 865
2: default inline length 32
3: default https://www.nasa.gov/sites/all/themes/custom/nasatwo/js/vendor.js? length 2097837 deminimized
4: default https://www.nasa.gov/sites/all/themes/custom/nasatwo/js/nasa.js? length 2361381 deminimized
5: default inline length 6116
6: default inline length 532
7: default inline length 0
8: text/x-placeholder inline length 0
Karl Dahlke
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-01-30 15:41 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-30 15:41 [Edbrowse-dev] showscripts() Karl Dahlke
-- strict thread matches above, loose matches on Subject: below --
2017-09-19 2:38 Karl Dahlke
2017-09-19 17:58 ` Geoff McLane
2017-09-19 19:31 ` Karl Dahlke
2017-09-20 23:32 ` Geoff McLane
2017-09-20 23:56 ` Dominique Martinet
2017-09-23 23:40 ` Kevin Carhart
2017-09-20 23:59 ` Kevin Carhart
2017-09-21 1:56 ` Karl Dahlke
2017-09-20 13:38 ` Karl Dahlke
2017-09-21 0:33 ` Geoff McLane
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).