Skip to content

Commit

Permalink
Bug 1875340 - use JavaScript's DecompressionStream instead of 'pako' …
Browse files Browse the repository at this point in the history
…package
  • Loading branch information
Archaeopteryx committed Apr 26, 2024
1 parent efbe618 commit 9b2adc9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"mobx": "6.10.2",
"moment": "2.29.4",
"numeral": "2.0.6",
"pako": "2.0.4",
"prop-types": "15.7.2",
"query-string": "7.0.1",
"react": "17.0.2",
Expand Down
12 changes: 0 additions & 12 deletions tests/ui/helpers/gzip_test.js

This file was deleted.

16 changes: 8 additions & 8 deletions ui/helpers/gzip.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { inflate } from 'pako';

export const unGzip = async (binData) => {
const decompressed = await inflate(binData, { to: 'string' });
return JSON.parse(decompressed);
};

export default unGzip;
export default async function unGzip(blob) {
const decompressionStream = new DecompressionStream('gzip');
const decompressedStream = blob.stream().pipeThrough(decompressionStream);
const payloadText = await (
await new Response(decompressedStream).blob()
).text();
return JSON.parse(payloadText);
}
3 changes: 1 addition & 2 deletions ui/job-view/pushes/Push.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ const fetchGeckoDecisionArtifact = async (project, revision, filePath) => {
if (url.endsWith('.gz')) {
if ([200, 303, 304].includes(response.status)) {
const blob = await response.blob();
const binData = await blob.arrayBuffer();
artifactContents = await decompress(binData);
artifactContents = await decompress(blob);
}
} else if (url.endsWith('.json')) {
if ([200, 303, 304].includes(response.status)) {
Expand Down

0 comments on commit 9b2adc9

Please sign in to comment.