I worked on two things that have been showing up in nasa.gov. The only file I modified is startwindow- please grab it from:

Here are the two topics.

I. The INVALID_STATE console log message that shows up in XHR actions. Basically, to fix this I addressed two things.

A. Deal with encodeURI. It was double-encoding. I found a trick for preventing this. Test if (URL == decode(URL)). Since you can decode(decode(decode))) any number of times and not make additional changes, you can use this to verify that your starting point is non-encoded, and only encode if it is necessary. This took care of one of the JSON requests which was returning an HTTP "400 Bad Request". It works now, so more content can flow in.

B. Clean up the use of onreadystatechange() and onload().They are used in the XHR implementation, but to do the same thing. I believe they're mutually exclusive and onload has been brought in as a replacement for onreadystatechange. So it's a mistake to call them both, I think, and this was causing problems. My remedy was to wrap each in a try-catch.

II. There is some widget code that gets added dynamically to nasa.gov and raises a runtime. It's possible we could just ignore the runtime, but when I checked into it, it looked broadly useful to address this.

The error is:
widgets.js line 2661: TypeError: cannot read property 'prototype' of undefined

The code is expecting a type of element, HTMLElement, (and then it tries to access its prototype, etc.)

So I added HTMLElement in startwindow. In three places where we establish a long litany of element types and then when it loops over them to put all of the functions on their prototypes, I added HTMLElement to the lists.


Here's a related subject that I noticed while working. I think it involves the URL class. I think there's an issue with scripts that do not have an src. What should we do with those? It should at least have an empty string rather than undefined, right? There are a lot of console warnings in nasa, saying "hrefset boolean". I didn't quite want to mess with that eval... but I think that may be the place to fix it.


Edbrowse-dev mailing list

Reply via email to