From 8c0fb9003d874fcbee0b1a6f6ee30dfb58c668bc Mon Sep 17 00:00:00 2001 From: Jamie <5964236+jamsinclair@users.noreply.github.com> Date: Wed, 6 Dec 2023 22:20:28 +0900 Subject: feat(ext/web): add ImageData Web API (#21183) Fixes #19288 Adds the `ImageData` Web API. This would be beneficial to projects using `ImageData` as a convenient transport layer for pixel data. This is common in Web Assembly projects that manipulate images. Having this global available in Deno would improve compatibility of existing JS libraries. **References** - [MDN ImageData Web API](https://developer.mozilla.org/en-US/docs/Web/API/ImageData) - [whatwg HTML Standard Canvas Spec](https://html.spec.whatwg.org/multipage/canvas.html#pixel-manipulation) --- tools/core_import_map.json | 1 + tools/wpt.ts | 17 +++++++++-------- tools/wpt/expectation.json | 6 +++++- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/core_import_map.json b/tools/core_import_map.json index b4eed19f0..6dff4c930 100644 --- a/tools/core_import_map.json +++ b/tools/core_import_map.json @@ -222,6 +222,7 @@ "ext:deno_web/13_message_port.js": "../ext/web/13_message_port.js", "ext:deno_web/14_compression.js": "../ext/web/14_compression.js", "ext:deno_web/15_performance.js": "../ext/web/15_performance.js", + "ext:deno_web/16_image_data.js": "../ext/web/16_image_data.js", "ext:deno_webidl/00_webidl.js": "../ext/webidl/00_webidl.js", "ext:deno_websocket/01_websocket.js": "../ext/websocket/01_websocket.js", "ext:deno_websocket/02_websocketstream.js": "../ext/websocket/02_websocketstream.js", diff --git a/tools/wpt.ts b/tools/wpt.ts index 07f6b6ba9..1867c1ed5 100755 --- a/tools/wpt.ts +++ b/tools/wpt.ts @@ -711,14 +711,15 @@ function discoverTestsToRun( 1, ) as ManifestTestVariation[] ) { - if (!path) continue; - const url = new URL(path, "http://web-platform.test:8000"); - if ( - !url.pathname.endsWith(".any.html") && - !url.pathname.endsWith(".window.html") && - !url.pathname.endsWith(".worker.html") && - !url.pathname.endsWith(".worker-module.html") - ) { + // Test keys ending with ".html" include their own html boilerplate. + // Test keys ending with ".js" will have the necessary boilerplate generated and + // the manifest path will contain the full path to the generated html test file. + // See: https://web-platform-tests.org/writing-tests/testharness.html + if (!key.endsWith(".html") && !key.endsWith(".js")) continue; + + const testHtmlPath = path ?? `${prefix}/${key}`; + const url = new URL(testHtmlPath, "http://web-platform.test:8000"); + if (!url.pathname.endsWith(".html")) { continue; } // These tests require an HTTP2 compatible server. diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json index 3b4b3b9d4..2c9aa8ceb 100644 --- a/tools/wpt/expectation.json +++ b/tools/wpt/expectation.json @@ -7011,6 +7011,11 @@ } }, "embedded-content": { + "the-canvas-element": { + "imagedata.html": [ + "ImageData(buffer, w, opt h), Uint8ClampedArray argument type check" + ] + }, "the-iframe-element": { "cross-origin-to-whom-part-2.window.html": false, "cross-origin-to-whom.window.html": false, @@ -8389,7 +8394,6 @@ "interface-objects": { "001.worker.html": [ "The SharedWorker interface object should be exposed.", - "The ImageData interface object should be exposed.", "The ImageBitmap interface object should be exposed.", "The CanvasGradient interface object should be exposed.", "The CanvasPattern interface object should be exposed.", -- cgit v1.2.3