edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] NASA is so weird we may never understand it
@ 2018-03-16 15:26 Karl Dahlke
  2018-03-18  6:43 ` Kevin Carhart
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Dahlke @ 2018-03-16 15:26 UTC (permalink / raw)
  To: Edbrowse-dev

[-- Attachment #1: Type: text/plain, Size: 2592 bytes --]

First, a new feature, which for laziness is overloaded on an old feature.

uvw trace

At db3 or higher, this injects codes into the output stream as to where execution is happening.

d254    (for illustration)

The letter is the script running and the number is a meaningless sequence number.
If you look in the script vendor.js for nasa you'll find alert3('d254');
Such an alert is placed before each var, since those are the only syntactically safe places to do so.
I couldn't find any other place that is safe.
So only about 9% of lines havve markers, but it's something.

vendor.js in nasa is 43,000 lines of nightmare.
I believe it equalizes all javascript environments for third party companies or government agencies,
and it puts a layer on top of javascript, like jquery, but of course it's not jquery, because why use something that's standard and established and has a pool of people who understand it when you can come up with something new?
Anyways, here are two of many weirdnesses.

Out of the box, there is no sinh function hyperbolic sine.
Math.sinh is undefined.
After vendor.js runs Math.sinh exists and runs the correct calculations. (I checked)
Fine, a script can always paste a function onto Math that was not there before.
No mystery so far.
But, in jdb, Math.sinh says the function is native code.
vendor.js can't possibly add native code.
I can even find the javascript that does the hyperbolic sine calculation.
It's not native, so what gives?
I can only guess that vendor.js put it's own toString() function on sinh,
so it would blurt out the words "native code", because on some browsers, it is native,
and remember, we want all browsers to look the same.
So I guess that's what they did, but even more than that.
I think they did something like this.

Math.sinh.toString = Math.sqrt.toString

Borrow the toString from a function that is already there.
Verified by

Math.sqrt.toString == Math.sinh.toString
true

The next weirdness is even weirder.
>From inside jdb, type

"abc".match(/./)
d254
a

Yes, a piece of vendor.js runs when you ask whether a string matches a regular expression.
Somehow the String object method match has been overwritten.
String.match = their stuff.
Are you serious!!
Same happens with "abc".split("b"), but not with "abc".substr(1).
They chose to overwrite some of the String methods but not all.

With all this in mind, we'd have to hire a fulltime engineer just to understand the nasa website and/or vendor.js.
Obviously we don't have the resources to do that.

Karl Dahlke

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Edbrowse-dev] NASA is so weird we may never understand it
  2018-03-16 15:26 [Edbrowse-dev] NASA is so weird we may never understand it Karl Dahlke
@ 2018-03-18  6:43 ` Kevin Carhart
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Carhart @ 2018-03-18  6:43 UTC (permalink / raw)
  To: Edbrowse-dev




> Such an alert is placed before each var, since those are the only syntactically safe places to do so.
> I couldn't find any other place that is safe.
> So only about 9% of lines havve markers, but it's something.

Interesting, good stuff.  About "syntactically safe", weren't 
you saying that anything could be put anywhere, if you use || and commas 
rather than semicolons in order to inject logging, etc?  I am interested 
to know how come this is different?

About nasa, I think to some extent the components are downloadable on 
their own, so we could test them in a vacuum if we want to do that.  I've 
done it a little with a jquery using a tiny test.html like 
<HTML>
<SCRIPT SRC="jquery.js">
</SCRIPT>
some text
</HTML>

I just point edbrowse at test.html and find out what happens in a vacuum 
before trying it in combination.  It might also be 
possible with ember, which has a site at emberjs.com.  The other majors 
that I know of are bootstrap, mootools 
(used by fastmail), possibly rails which I think the xqsuperschools 
website uses.  There are some, but not that many.  jquery has some 
other projects like Sizzle which is CSS-related, and jqueryUI which people 
appear to be including quite a bit.

It's a little helpful up to a point to know this.  The insane overloading 
is still a problem, but there are fewer of these large popular frameworks
than we may think so it will go far when we do get one.

thank you for the research, I am sure a lot of blood sweat and tears went 
in to going that deep into vendor.js.

Kevin


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-18  6:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16 15:26 [Edbrowse-dev] NASA is so weird we may never understand it Karl Dahlke
2018-03-18  6:43 ` Kevin Carhart

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).