diff options
author | Luca Casonato <hello@lcas.dev> | 2024-09-03 11:24:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-03 11:24:25 +0200 |
commit | 5cf97f539bb0c3d2bda918f53cd4a976c03b37e3 (patch) | |
tree | 82f05b270b3df52609e3d0d6c86a768d1399e257 /tests/unit | |
parent | b5695d02df75719bca0df1aae0622b22761b1533 (diff) |
BREAKING(permissions): remove --allow-hrtime (#25367)
Remove `--allow-hrtime` and `--deny-hrtime`. We are doing this because
it is already possible to get access to high resolution timers through
workers and SharedArrayBuffer.
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/files_test.ts | 4 | ||||
-rw-r--r-- | tests/unit/performance_test.ts | 2 | ||||
-rw-r--r-- | tests/unit/permissions_test.ts | 10 | ||||
-rw-r--r-- | tests/unit/worker_test.ts | 5 |
4 files changed, 9 insertions, 12 deletions
diff --git a/tests/unit/files_test.ts b/tests/unit/files_test.ts index fb45e3ad6..c9c3c0110 100644 --- a/tests/unit/files_test.ts +++ b/tests/unit/files_test.ts @@ -782,14 +782,14 @@ Deno.test({ permissions: { read: true } }, function fsFileIsTerminal() { }); Deno.test( - { permissions: { read: true, run: true, hrtime: true } }, + { permissions: { read: true, run: true } }, async function fsFileLockFileSync() { await runFlockTests({ sync: true }); }, ); Deno.test( - { permissions: { read: true, run: true, hrtime: true } }, + { permissions: { read: true, run: true } }, async function fsFileLockFileAsync() { await runFlockTests({ sync: false }); }, diff --git a/tests/unit/performance_test.ts b/tests/unit/performance_test.ts index 0c9ed21df..93af641ad 100644 --- a/tests/unit/performance_test.ts +++ b/tests/unit/performance_test.ts @@ -7,7 +7,7 @@ import { assertThrows, } from "./test_util.ts"; -Deno.test({ permissions: { hrtime: false } }, async function performanceNow() { +Deno.test({ permissions: {} }, async function performanceNow() { const { promise, resolve } = Promise.withResolvers<void>(); const start = performance.now(); let totalTime = 0; diff --git a/tests/unit/permissions_test.ts b/tests/unit/permissions_test.ts index 4dab0696a..e18b0c8f2 100644 --- a/tests/unit/permissions_test.ts +++ b/tests/unit/permissions_test.ts @@ -70,7 +70,7 @@ Deno.test(function permissionSysInvalidKindSync() { }); Deno.test(async function permissionQueryReturnsEventTarget() { - const status = await Deno.permissions.query({ name: "hrtime" }); + const status = await Deno.permissions.query({ name: "read", path: "." }); assert(["granted", "denied", "prompt"].includes(status.state)); let called = false; status.addEventListener("change", () => { @@ -78,11 +78,13 @@ Deno.test(async function permissionQueryReturnsEventTarget() { }); status.dispatchEvent(new Event("change")); assert(called); - assert(status === (await Deno.permissions.query({ name: "hrtime" }))); + assert( + status === (await Deno.permissions.query({ name: "read", path: "." })), + ); }); Deno.test(function permissionQueryReturnsEventTargetSync() { - const status = Deno.permissions.querySync({ name: "hrtime" }); + const status = Deno.permissions.querySync({ name: "read", path: "." }); assert(["granted", "denied", "prompt"].includes(status.state)); let called = false; status.addEventListener("change", () => { @@ -90,7 +92,7 @@ Deno.test(function permissionQueryReturnsEventTargetSync() { }); status.dispatchEvent(new Event("change")); assert(called); - assert(status === Deno.permissions.querySync({ name: "hrtime" })); + assert(status === Deno.permissions.querySync({ name: "read", path: "." })); }); Deno.test(async function permissionQueryForReadReturnsSameStatus() { diff --git a/tests/unit/worker_test.ts b/tests/unit/worker_test.ts index e5966348f..700f57b6b 100644 --- a/tests/unit/worker_test.ts +++ b/tests/unit/worker_test.ts @@ -451,7 +451,6 @@ Deno.test("Worker limit children permissions granularly", async function () { deno: { permissions: { env: ["foo"], - hrtime: true, net: ["foo", "bar:8000"], ffi: [new URL("foo", workerUrl), "bar"], read: [new URL("foo", workerUrl), "bar"], @@ -468,7 +467,6 @@ Deno.test("Worker limit children permissions granularly", async function () { envGlobal: "prompt", envFoo: "granted", envAbsent: "prompt", - hrtime: "granted", netGlobal: "prompt", netFoo: "granted", netFoo8000: "granted", @@ -508,7 +506,6 @@ Deno.test("Nested worker limit children permissions", async function () { envGlobal: "prompt", envFoo: "prompt", envAbsent: "prompt", - hrtime: "prompt", netGlobal: "prompt", netFoo: "prompt", netFoo8000: "prompt", @@ -586,7 +583,6 @@ Deno.test("Worker permissions are not inherited with empty permission object", a worker.postMessage(null); assertEquals(await promise, { env: "prompt", - hrtime: "prompt", net: "prompt", ffi: "prompt", read: "prompt", @@ -611,7 +607,6 @@ Deno.test("Worker permissions are not inherited with single specified permission worker.postMessage(null); assertEquals(await promise, { env: "prompt", - hrtime: "prompt", net: "granted", ffi: "prompt", read: "prompt", |