csnover / csnover/TraceKit

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.

Open
#13 17 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
1.1k
Forks
162
PR merge metrics
No merged PRs in 30d

Description

I get the following error in chrome when loadSource is called:

```
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
```

``` javascript
function loadSource(url) {
if (typeof url !== 'string') {
return [];
}

if (!TraceKit.remoteFetching) { //Only attempt request if remoteFetching is on.
return '';
}
try {
var getXHR = function() {
try {
return new window.XMLHttpRequest();
} catch (e) {
// explicitly bubble up the exception if not found
return new window.ActiveXObject('Microsoft.XMLHTTP');
}
};

var request = getXHR();
request.open('GET', url, false);
request.send('');
return request.responseText;
} catch (e) {
return '';
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing loadSource and its callers, then reproduce the warning in Chrome with remoteFetching enabled. Determine how source loading can avoid the synchronous XMLHttpRequest while preserving the existing behavior; done means the deprecation warning no longer occurs and remote source loading still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.