Skip to content
This repository has been archived by the owner on Dec 10, 2022. It is now read-only.

Commit

Permalink
Prevent extension UUID leak via Origin on Firefox. (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
sammacbeth authored Dec 20, 2018
1 parent 788dc7c commit fa48781
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/features/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@

function fetchPolyfill(url) {
return new Promise((resolve) => {
const req = new XMLHttpRequest();
req.withCredentials = true;
req.addEventListener('load', () => {
console.log('loaded', url);
resolve({
status: req.status,
statusText: req.statusText,
text: () => Promise.resolve(req.responseText),
});
});
req.open('GET', url);
req.send();
});
}

export async function fetchDocument(url, format = 'html') { // eslint-disable-line import/prefer-default-export
const response = await fetch(url, { credentials: 'include' });
const response = await fetchPolyfill(url);

if (response.status !== 200) {
throw Error(response.statusText);
Expand Down

0 comments on commit fa48781

Please sign in to comment.