Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.
This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.
Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
-
thosrtanner
- Lunatic
- Posts: 395
- Joined: 2014-05-10, 18:19
- Location: UK
Unread post
by thosrtanner » 2018-05-27, 14:25
This snippet:
Code: Select all
const url = "http://rawrtacular.com/bataneart/";
const xmlHttpRequest = new XMLHttpRequest();
xmlHttpRequest.open("GET", url);
xmlHttpRequest.ontimeout = evt => { console.log("timed out", evt, url) };
xmlHttpRequest.onabort = evt => { console.log("aborted", evt, url) };
xmlHttpRequest.onerror = evt => { console.log("error", evt, url) };
xmlHttpRequest.onload = evt => { console.log("complete", evt, url) };
xmlHttpRequest.timeout = 10000;
xmlHttpRequest.send();
works absolutely fine. But replace the url with "
http://rawrtacular.com/bataneart" - and the request times out. Typing the url in the browser window without the '/' at the end works fine. Having said which it grows a trailing / in the process and the console says this:
Code: Select all
GET http://rawrtacular.com/bataneart [HTTP/1.1 301 Moved Permanently 250ms]
GET http://rawrtacular.com/bataneart/ [HTTP/1.1 200 OK 250ms]
so maybe the question should be why my XMLHttpRequest isn't behaving the same as the browser, and what should I do?
Addendum: I looked at the value of evt in the timeout and it has had the '/' appended to the responseURL.
Last edited by thosrtanner on 2018-05-27, 14:38, edited 1 time in total.
-
JustOff
Unread post
by JustOff » 2018-05-27, 15:02
I can't reproduce your issue, both urls work just fine:
Code: Select all
17:49:44.676 GET XHR http://rawrtacular.com/bataneart/ [HTTP/1.1 200 OK 1631ms]
17:49:46.280 "complete" load { target: XMLHttpRequest, isTrusted: true, lengthComputable: true, loaded: 28029, total: 28029, currentTarget: XMLHttpRequest, eventPhase: 2, bubbles: false, cancelable: false, defaultPrevented: false, timeStamp: 1527432586280000 } "http://rawrtacular.com/bataneart/" Scratchpad/1:7:37
17:50:01.663 GET XHR http://rawrtacular.com/bataneart [HTTP/1.1 301 Moved Permanently 309ms]
17:50:01.978 GET XHR http://rawrtacular.com/bataneart/ [HTTP/1.1 200 OK 305ms]
17:50:02.259 "complete" load { target: XMLHttpRequest, isTrusted: true, lengthComputable: true, loaded: 28029, total: 28029, currentTarget: XMLHttpRequest, eventPhase: 2, bubbles: false, cancelable: false, defaultPrevented: false, timeStamp: 1527432602259000 } "http://rawrtacular.com/bataneart"
-
thosrtanner
- Lunatic
- Posts: 395
- Joined: 2014-05-10, 18:19
- Location: UK
Unread post
by thosrtanner » 2018-05-27, 16:36
Oh great. it works consistently in the console but fails consistently in the context of my extension
-
JustOff
Unread post
by JustOff » 2018-05-27, 16:39
Just as a guess, try using var/let instead of const.
-
thosrtanner
- Lunatic
- Posts: 395
- Joined: 2014-05-10, 18:19
- Location: UK
Unread post
by thosrtanner » 2018-05-27, 16:42
no, broken in console. i'd put the wrong name in the request. once i'd fixed the name it times out still.
I had an issue a bit like this once that I think went away when I deleted places db, but that doesn't seem to have worked this time.
Addendum. It works in safe mode so sounds like 'hunt the extension"
Last edited by thosrtanner on 2018-05-27, 16:55, edited 1 time in total.
-
thosrtanner
- Lunatic
- Posts: 395
- Joined: 2014-05-10, 18:19
- Location: UK
Unread post
by thosrtanner » 2018-05-27, 17:03
and now I commit the sin of replying to myself. It's apparently adblock latitude that is doing this...
-
JustOff
Unread post
by JustOff » 2018-05-27, 17:05
Well ... you know ...
-
thosrtanner
- Lunatic
- Posts: 395
- Joined: 2014-05-10, 18:19
- Location: UK
Unread post
by thosrtanner » 2018-05-27, 18:03
Now what do I do about adblock latitude (printable answers only please!)
-
JustOff
Unread post
by JustOff » 2018-05-27, 18:13
Perhaps use a clean profile for development?
-
thosrtanner
- Lunatic
- Posts: 395
- Joined: 2014-05-10, 18:19
- Location: UK
Unread post
by thosrtanner » 2018-05-28, 21:23
It appears there's a rule that effectively blocks websites that are too short and don't end in a slash...