From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: None (mailfrom) identity=mailfrom; client-ip=8.23.224.60; helo=out.smtp-auth.no-ip.com; envelope-from=kevin@carhart.net; receiver= Received: from out.smtp-auth.no-ip.com (smtp-auth.no-ip.com [8.23.224.60]) by hurricane.the-brannons.com (Postfix) with ESMTPS id C009F77CAA for ; Mon, 12 Feb 2018 01:42:57 -0800 (PST) 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 4E71C236 for ; Mon, 12 Feb 2018 01:43:42 -0800 (PST) Received: from carhart.net (localhost [127.0.0.1]) by carhart.net (8.13.8/8.13.8) with ESMTP id w1C9herV006163 for ; Mon, 12 Feb 2018 01:43:40 -0800 Received: from localhost (kevin@localhost) by carhart.net (8.13.8/8.13.8/Submit) with ESMTP id w1C9het6006157 for ; Mon, 12 Feb 2018 01:43:40 -0800 Date: Mon, 12 Feb 2018 01:43:39 -0800 (PST) From: Kevin Carhart To: Edbrowse-dev@lists.the-brannons.com Message-ID: User-Agent: Alpine 2.03 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Subject: [Edbrowse-dev] XHR - link to patch X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.25 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2018 09:42:57 -0000 I worked on two things that have been showing up in nasa.gov. The only file I modified is startwindow- please grab it from: http://carhart.net/~kevin/startwindow_20180212.zip 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. thanks Kevin