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

tests/perf: add cross-origin isolation for more precise measurement #8910

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions bin/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

'use strict';

const http = require('http');
var watch = require('watch-glob');
var http_server = require('http-server');
const serveHandler = require('serve-handler');
var debounce = require('lodash.debounce');
var browserify = require('browserify');
var fs = require('fs');
Expand Down Expand Up @@ -92,7 +93,15 @@ var readyCallback;

function startServers(callback) {
readyCallback = callback;
http_server.createServer().listen(HTTP_PORT, function () {
const server = http.createServer((req, res) => {
// Add cross-origin isolation headers to allow for more precise performance measurements.
// See: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now#security_requirements
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');

return serveHandler(req, res, { trailingSlash:true });
});
server.listen(HTTP_PORT, () => {
var testRoot = 'http://127.0.0.1:' + HTTP_PORT;
const query = new URLSearchParams(queryParams);
console.log(`Integration tests: ${testRoot}/tests/integration/?${query}`);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"express-pouchdb": "4.2.0",
"find-requires": "1.0.0",
"glob": "7.1.5",
"http-server": "0.12.3",
"istanbul": "0.4.5",
"istanbul-coveralls": "1.0.3",
"less": "3.9.0",
Expand All @@ -99,6 +98,7 @@
"rollup-plugin-node-resolve": "4.2.4",
"rollup-plugin-replace": "1.2.1",
"seedrandom": "3.0.5",
"serve-handler": "6.1.5",
"source-map": "0.7.4",
"stacktrace-parser": "0.1.10",
"stream-to-promise": "1.1.1",
Expand Down