Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: code issues and nits #977

Merged
merged 5 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const getReportMeta = (report: Report): ReportMeta => {
.createHash("sha1")
.update(buffer)
.digest("hex")
.substr(0, 10);
.substring(0, 10);

// Get user agent details
const ua = parseUA(report.userAgent, bcdBrowsers);
Expand Down
2 changes: 1 addition & 1 deletion lib/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class CloudStorage extends Storage {
await Promise.all(
files.map(async (file) => {
assert(file.name.startsWith(prefix));
const key = decodeURIComponent(file.name.substr(prefix.length));
const key = decodeURIComponent(file.name.substring(prefix.length));
const data = (await file.download())[0];
result[key] = JSON.parse(data.toString());
}),
Expand Down
2 changes: 1 addition & 1 deletion prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ const prepare = async () => {
};

if (esMain(import.meta)) {
prepare();
await prepare();
}
2 changes: 1 addition & 1 deletion scripts/find-missing-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const traverseFeatures = (
if (statement.prefix) {
let name = id;
if (path.startsWith("api.")) {
name = name[0].toUpperCase() + name.substr(1);
name = name[0].toUpperCase() + name.substring(1);
}
aliases.add(statement.prefix + name);
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/selenium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,8 @@
if (!ctx.testenv) {
const filename = path.basename(new URL(downloadUrl).pathname);
log(task, `Downloading ${filename} ...`);
const report = await (await fetch(downloadUrl)).buffer();
const report = await (await fetch(downloadUrl)).arrayBuffer();
queengooborg marked this conversation as resolved.
Show resolved Hide resolved
await fs.writeFile(path.join(RESULTS_DIR, filename), report);

Check failure on line 663 in scripts/selenium.ts

View workflow job for this annotation

GitHub Actions / Test (Linux)

Argument of type 'ArrayBuffer' is not assignable to parameter of type 'string | ArrayBufferView'.
}
} finally {
driver.quit().catch(() => {});
Expand Down
1 change: 0 additions & 1 deletion static/resources/harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,6 @@
serviceWorker.removeEventListener("statechange", stateListener);

reject(new Error("Installing service worker became redundant"));
return;
}
}

Expand Down
2 changes: 1 addition & 1 deletion test-builder/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ const buildTest = async (
let property = parts[parts.length - 1];

if (property.startsWith("@@")) {
property = `Symbol.${property.substr(2)}`;
property = `Symbol.${property.substring(2)}`;
}

const owner =
Expand Down
6 changes: 3 additions & 3 deletions views/extensioncheck.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ See the LICENSE file for copyright details
}
}
};
};
}

function checkChromeExtension(id, callback) {
if (id) {
Expand Down Expand Up @@ -80,7 +80,7 @@ See the LICENSE file for copyright details
});
}
})
};
}

function renderNote(extension) {
var el = document.createElement('div');
Expand Down Expand Up @@ -133,7 +133,7 @@ See the LICENSE file for copyright details
}
});
});
};
}

checkExtensions(<%- JSON.stringify(browserExtensions) %>);
})();
Expand Down
2 changes: 0 additions & 2 deletions views/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ See the LICENSE file for copyright details

<script>
function main() {
var form = document.getElementById('test-form');
var testSelection = document.getElementById('test-selection');
var limitExposure = document.getElementById('limit-exposure');
var limitExposureBox = document.getElementById('limit-exposure-box');

testSelection.onchange = function() {
Expand Down
2 changes: 1 addition & 1 deletion views/layout.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ See the LICENSE file for copyright details
<a href="/"><span class="mdi mdi-home"> Home</span></a>
<a href="/docs/about.md"><span class="mdi mdi-information"> About</span></a>
<a href="/docs"><span class="mdi mdi-file-document-multiple"> Docs</span></a>
<a href="https://opencollective.com/open-web-docs"><span class="mdi mdi-hand-coin"></span> Donate</title>
<a href="https://opencollective.com/open-web-docs"><span class="mdi mdi-hand-coin"></span> Donate</a>
<a href="https://github.com/openwebdocs/mdn-bcd-collector"><span class="mdi mdi-github"> GitHub</span></a>
<a href="/changelog">v<%- appVersion %></a>
</nav>
Expand Down
6 changes: 3 additions & 3 deletions views/tests.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ See the LICENSE file for copyright details
default:
throw new Error(`Tried to load an unknown instance type of ${resource.type}!`)
}
}; %>
} %>
</div>

<script src="/resources/harness.js"></script>

<script>
<% for (const [instanceId, instance] of Object.entries(resources)
.filter((item) => (item[1].type === 'instance'))) {
.filter((item) => (item[1].type === 'instance'))) {
if (resourcesToLoad.has(instanceId)) { %>
bcd.addInstance("<%- instanceId %>", <%- JSON.stringify(instance.src) %>, {callback: <%- !!instance.callback %>});
<% }
}; %>
} %>
<% tests.forEach(function(test) { %>
bcd.addTest("<%- test.ident %>", <%- JSON.stringify(test.tests) %>, "<%- test.exposure %>");
<% }); %>
Expand Down
Loading