Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,30 @@
const run_test = isolated => {
// Multiplier to convert the clamped timestamps to microseconds.
const multiplier = 1000;
const windowOrigin = performance.timeOrigin;
// Clamp to at least 5 microseconds in isolated contexts and at least 100 in
// non-isolated ones.
const resolution = isolated ? 5 : 100;
const create_worker = () => {
return new Promise(resolve => {
const workerScript = 'postMessage({timeOrigin: performance.timeOrigin})';
const blob = new Blob([workerScript]);
const worker = new Worker(URL.createObjectURL(blob));
worker.addEventListener('message', event => {
resolve(event.data.timeOrigin);
});
});
};
promise_test(async t => {
assert_equals(self.crossOriginIsolated, isolated,
"crossOriginIsolated is properly set");
let prev = windowOrigin;
let current;
for (let i = 1; i < 100; ++i) {
current = await create_worker();
assert_true(current === prev || current - prev > resolution / 1000);
prev = current;
}
}, 'timeOrigins are clamped.');
};

View File

@ -0,0 +1,9 @@
<!DOCTYPE HTML>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>window.performance.now frame</title>
<link rel="author" title="Google" href="http://www.google.com/" />
</head>
<body></body>
</html>

View File

@ -0,0 +1,4 @@
<!DOCTYPE HTML>
<script>
window.parent.postMessage('done');
</script>

View File

@ -0,0 +1,42 @@
function run_test(isolated) {
let resolution = 100;
if (isolated) {
resolution = 5;
}
test(function() {
function check_resolutions(times, length) {
const end = length - 2;
// we compare each value with the following ones
for (let i = 0; i < end; i++) {
const h1 = times[i];
for (let j = i+1; j < end; j++) {
const h2 = times[j];
const diff = h2 - h1;
assert_true((diff === 0) || ((diff * 1000) >= resolution),
"Differences smaller than ' + resolution + ' microseconds: " + diff);
}
}
return true;
}
const times = new Array(10);
let index = 0;
let hrt1, hrt2, hrt;
assert_equals(self.crossOriginIsolated, isolated, "Document cross-origin isolated value matches");
// rapid firing of performance.now
hrt1 = performance.now();
hrt2 = performance.now();
times[index++] = hrt1;
times[index++] = hrt2;
// ensure that we get performance.now() to return a different value
do {
hrt = performance.now();
times[index++] = hrt;
} while ((hrt - hrt1) === 0);
assert_true(check_resolutions(times, index), 'Difference should be at least ' + resolution + ' microseconds.');
}, 'The recommended minimum resolution of the Performance interface has been set to ' + resolution + ' microseconds for cross-origin isolated contexts.');
}

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Helper page for ../unload-manual.html</title>
</head>
<body>
<script src="./unload.js"></script>
<script>
setupListeners("a", "./unload-b.html");
</script>
<button id="proceed">Click me!</button>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Helper page for ../unload-manual.html</title>
</head>
<body>
<script src="./unload.js"></script>
<script>
setupListeners("b", "./unload-c.html");
</script>
<button id="proceed">Click me again!</button>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>Helper page for ../unload-manual.html</title>
</head>
<body>
<script src="./unload.js"></script>
<script>
setupListeners("c", null);
</script>
<button id="proceed">Click me, one last time!</button>
</body>
</html>

View File

@ -0,0 +1,51 @@
const syncDelay = ms => {
const start = performance.now();
let elapsedTime;
do {
elapsedTime = performance.now() - start;
} while (elapsedTime < ms);
};
const markTime = (docName, lifecycleEventName) => {
// Calculating these values before the below `mark` invocation ensures that delays in
// reaching across to the other window object doesn't interfere with the correctness
// of the test.
const dateNow = Date.now();
const performanceNow = performance.now();
window.opener.mark({
docName,
lifecycleEventName,
performanceNow: performanceNow,
dateNow: dateNow
});
};
const setupUnloadPrompt = (docName, msg) => {
window.addEventListener("beforeunload", ev => {
markTime(docName, "beforeunload");
return ev.returnValue = msg || "Click OK to continue test."
});
};
const setupListeners = (docName, nextDocument) => {
window.addEventListener("load", () => {
markTime(docName, "load");
document.getElementById("proceed").addEventListener("click", ev => {
ev.preventDefault();
if (nextDocument) {
document.location = nextDocument;
} else {
window.close();
}
})
});
setupUnloadPrompt(docName);
window.addEventListener("unload", () => {
markTime(docName, "unload");
if (docName !== "c") { syncDelay(1000); }
});
};