commit 6983c8f09d0caceb60b2f903e2b05cd24720a4a3
parent 57bcbbafe3c61e6825302ce83d228a258ba17450
Author: Noam Rosenthal <nrosenthal@chromium.org>
Date: Sat, 20 Dec 2025 20:58:05 +0000
Bug 2007142 [wpt PR 56884] - Remove initial (now obsolete) patching prototype, a=testonly
Automatic update from web-platform-tests
Remove initial (now obsolete) patching prototype
The API is going in a different direction, that is already prototyped
as well.
Bug: 431374376
Change-Id: If07245646b770738c13ed4e377ad4caffcf3f7fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7269307
Commit-Queue: Noam Rosenthal <nrosenthal@google.com>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1561184}
--
wpt-commits: 525e570cf22fb4dc6d0bde61dead368f252bdfa1
wpt-pr: 56884
Diffstat:
5 files changed, 22 insertions(+), 313 deletions(-)
diff --git a/testing/web-platform/tests/css/css-values/random-computed.tentative.html b/testing/web-platform/tests/css/css-values/random-computed.tentative.html
@@ -391,6 +391,28 @@ test(() => {
document.body.appendChild(holder);
try {
+ for (let i = 0; i < iterations; ++i) {
+ const other1 = document.createElement('div');
+ other1.style.animationIterationCount = 'random(element-shared, 0, 100), random(element-shared, 0, 100)';
+ holder.appendChild(other1);
+ let [computed11, computed12] = getComputedStyle(other1)['animation-iteration-count'].split(', ');
+ const other2 = document.createElement('div');
+ other2.style.animationIterationCount = '300, random(element-shared, 0, 100)';
+ holder.appendChild(other2);
+ let [computed21, computed22] = getComputedStyle(other2)['animation-iteration-count'].split(', ');
+ assert_false(computed11 == computed12, "Random values for same property name but different value indexes should differ");
+ test_random_equals(computed11, computed22);
+ }
+ } finally {
+ document.body.removeChild(holder);
+ }
+}, `Shared by property name and value index: random(element-shared, a, b)`);
+
+test(() => {
+ const holder = document.createElement('div');
+ document.body.appendChild(holder);
+
+ try {
const el = document.createElement('div');
el.className = 'randomMatchElement';
holder.appendChild(el);
diff --git a/testing/web-platform/tests/html/dom/partial-updates/tentative/patch-non-element.html b/testing/web-platform/tests/html/dom/partial-updates/tentative/patch-non-element.html
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<html id="html">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<template patchfor="html">abc</template>
-</html>
-<script>
-promise_test(async () => {
- const fragment = document.createDocumentFragment();
-
- assert_throws_dom('HierarchyRequestError', () => {
- fragment.patchSelf();
- });
- assert_throws_dom('HierarchyRequestError', () => {
- document.patchSelf();
- });
-}, "Cannot patch container nodes without a context element");
-</script>
-\ No newline at end of file
diff --git a/testing/web-platform/tests/html/dom/partial-updates/tentative/patch-range.html b/testing/web-platform/tests/html/dom/partial-updates/tentative/patch-range.html
@@ -1,137 +0,0 @@
-<!DOCTYPE HTML>
-<meta charset="utf-8" />
-<title>HTML partial updates - patch range</title>
-<link rel=help href="https://github.com/WICG/declarative-partial-updates">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="placeholder">
- <span id="first"></span>
- <span id="last"></span>
-</div>
-<style id="style"></style>
-<p id="target"></p>
-<script>
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const before = placeholder.innerHTML;
- t.add_cleanup(() => { placeholder.innerHTML = before });
- const first = document.querySelector("#first");
- const last = document.querySelector("#last");
- const writable = placeholder.patchBetween(first, last);
- const response = new Response("<span id=middle>Content</span>", {headers: {"Content-Type": "text/html"}});
- response.body.pipeTo(writable);
- assert_true(placeholder.currentPatch instanceof Patch, "currentPatch should be a Patch right after connecting a stream");
- await placeholder.currentPatch.finished;
- assert_equals(placeholder.currentPatch, null);
- const middle = placeholder.querySelector("#middle");
- assert_true(middle instanceof HTMLSpanElement);
- assert_equals(middle.textContent, "Content");
- assert_equals(middle.previousElementSibling, first);
- assert_equals(middle.nextElementSibling, last);
-}, "using patchBetween() to insert an element betwen two other elements");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const before = placeholder.innerHTML;
- t.add_cleanup(() => { placeholder.innerHTML = before });
- const first = document.querySelector("#first");
- const last = document.querySelector("#last");
- const writable = placeholder.patchAfter(first);
- const response = new Response("<span id=middle>Content</span>", {headers: {"Content-Type": "text/html"}});
- response.body.pipeTo(writable);
- assert_true(placeholder.currentPatch instanceof Patch, "currentPatch should be a Patch right after connecting a stream");
- await placeholder.currentPatch.finished;
- assert_equals(placeholder.currentPatch, null);
- const middle = placeholder.querySelector("#middle");
- assert_true(middle instanceof HTMLSpanElement);
- assert_equals(middle.textContent, "Content");
- assert_equals(middle.previousElementSibling, first);
- assert_equals(middle.nextElementSibling, null);
-}, "using patchAfter() to insert an element after another element");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const before = placeholder.innerHTML;
- t.add_cleanup(() => { placeholder.innerHTML = before });
- const first = document.querySelector("#first");
- const last = document.querySelector("#last");
- const writable = placeholder.patchBefore(last);
- const response = new Response("<span id=middle>Content</span>", {headers: {"Content-Type": "text/html"}});
- response.body.pipeTo(writable);
- assert_true(placeholder.currentPatch instanceof Patch, "currentPatch should be a Patch right after connecting a stream");
- await placeholder.currentPatch.finished;
- assert_equals(placeholder.currentPatch, null);
- const middle = placeholder.querySelector("#middle");
- assert_true(middle instanceof HTMLSpanElement);
- assert_equals(middle.textContent, "Content");
- assert_equals(middle.previousElementSibling, null);
- assert_equals(middle.nextElementSibling, last);
-}, "using patchBefore() to insert an element before another element");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const before = placeholder.innerHTML;
- t.add_cleanup(() => { placeholder.innerHTML = before });
- const first = document.querySelector("#first");
- const last = document.querySelector("#last");
- const writable = placeholder.patchAfter(last);
- const response = new Response("<span id=middle>Content</span>", {headers: {"Content-Type": "text/html"}});
- response.body.pipeTo(writable);
- assert_true(placeholder.currentPatch instanceof Patch, "currentPatch should be a Patch right after connecting a stream");
- await placeholder.currentPatch.finished;
- assert_equals(placeholder.currentPatch, null);
- const middle = placeholder.querySelector("#middle");
- assert_true(middle instanceof HTMLSpanElement);
- assert_equals(middle.textContent, "Content");
- assert_equals(middle.previousElementSibling, last);
- assert_equals(middle.nextElementSibling, null);
-}, "using patchAfter() to insert an element after the last element");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const before = placeholder.innerHTML;
- t.add_cleanup(() => { placeholder.innerHTML = before });
- const first = document.querySelector("#first");
- const last = document.querySelector("#last");
- const writable = placeholder.patchBefore(first);
- const response = new Response("<span id=middle>Content</span>", {headers: {"Content-Type": "text/html"}});
- response.body.pipeTo(writable);
- assert_true(placeholder.currentPatch instanceof Patch, "currentPatch should be a Patch right after connecting a stream");
- await placeholder.currentPatch.finished;
- assert_equals(placeholder.currentPatch, null);
- const middle = placeholder.querySelector("#middle");
- assert_true(middle instanceof HTMLSpanElement);
- assert_equals(middle.textContent, "Content");
- assert_equals(middle.previousElementSibling, null);
- assert_equals(middle.nextElementSibling, first);
-}, "using patchBefore() to insert an element before the first element");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const before = placeholder.innerHTML;
- t.add_cleanup(() => { placeholder.innerHTML = before });
- const first = document.querySelector("#first");
- const writable = placeholder.patchBefore(first);
- const response = new Response("<span id=middle>Content</span>", {headers: {"Content-Type": "text/html"}});
- first.remove();
- const {finished} = placeholder.currentPatch;
- await promise_rejects_dom(t, "NotFoundError", response.body.pipeTo(writable));
- await promise_rejects_dom(t, "NotFoundError", finished);
-}, "using patchBefore() should fail if the reference node is removed while patching");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const before = placeholder.innerHTML;
- t.add_cleanup(() => { placeholder.innerHTML = before });
- const first = document.querySelector("#first");
- const last = document.querySelector("#last");
- const writable = placeholder.patchBetween(first, last);
- const response = new Response("<span id=middle>Content</span>", {headers: {"Content-Type": "text/html"}});
- last.remove();
- const {finished} = placeholder.currentPatch;
- await promise_rejects_dom(t, "NotFoundError", response.body.pipeTo(writable));
- await promise_rejects_dom(t, "NotFoundError", finished);
-}, "using patchBetween() should fail if the 'before' node is removed while patching");
-
-</script>
-\ No newline at end of file
diff --git a/testing/web-platform/tests/html/dom/partial-updates/tentative/patch-self-scripting.html b/testing/web-platform/tests/html/dom/partial-updates/tentative/patch-self-scripting.html
@@ -1,31 +0,0 @@
-<!DOCTYPE HTML>
-<meta charset="utf-8" />
-<title>HTML partial updates - executing scripts during streaming</title>
-<link rel=help href="https://github.com/WICG/declarative-partial-updates">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="placeholder">
-</div>
-<script>
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const writable = placeholder.patchSelf();
- assert_true(writable instanceof WritableStream, "node.patchSelf() returns a writable stream");
- const response = new Response("Content", {headers: {"Content-Type": "text/html"}});
- window.script_executed = false;
- const did_write_promise = writable.getWriter().write(`
- <br id=before>
- <script>
- assert_not_equals(document.querySelector("#before"), null);
- assert_equals(document.querySelector("#after"), null);
- window.script_executed = true;
- <` + `/script>
- <br id=after>`);
- assert_false(window.script_executed, "script should not execute before write() resolves");
- await did_write_promise;
- assert_not_equals(document.querySelector("#before"), null);
- assert_not_equals(document.querySelector("#after"), null);
- assert_true(window.script_executed, "script should execute immediately upon being written");
-}, "Patches should execute scripts as soon as they are written");
-
-</script>
-\ No newline at end of file
diff --git a/testing/web-platform/tests/html/dom/partial-updates/tentative/patch-self.html b/testing/web-platform/tests/html/dom/partial-updates/tentative/patch-self.html
@@ -1,122 +0,0 @@
-<!DOCTYPE HTML>
-<meta charset="utf-8" />
-<title>HTML partial updates - patch stream</title>
-<link rel=help href="https://github.com/WICG/declarative-partial-updates">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="placeholder">
-</div>
-<style id="style"></style>
-<p id="target"></p>
-<script>
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const writable = placeholder.patchSelf();
- assert_true(writable instanceof WritableStream, "node.patchSelf() returns a writable stream");
- const response = new Response("Content", {headers: {"Content-Type": "text/html"}});
- response.body.pipeTo(writable);
- assert_true(placeholder.currentPatch instanceof Patch, "currentPatch should be a Patch right after connecting a stream");
- await placeholder.currentPatch.finished;
- assert_equals(placeholder.textContent, "Content");
- assert_equals(placeholder.currentPatch, null);
- assert_true(response.bodyUsed);
-}, "streaming a response into node.patchSelf()");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const writable = placeholder.patchSelf();
- assert_true(writable instanceof WritableStream, "node.patchSelf() returns a writable stream");
- const writer = writable.getWriter();
- await writer.write("Text");
- const {currentPatch} = placeholder;
- assert_true(currentPatch instanceof Patch, "currentPatch should be a Patch right after connecting a stream");
- writer.close();
- await currentPatch.finished;
- assert_equals(placeholder.textContent, "Text");
- assert_equals(placeholder.currentPatch, null);
-}, "streaming text directly into node.patchSelf()");
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- placeholder.innerHTML = "Before";
- const writable = placeholder.patchSelf();
- assert_true(writable instanceof WritableStream, "node.patchSelf() returns a writable stream");
- const writer = writable.getWriter();
- const {currentPatch} = placeholder;
- const reason = await writer.write(Symbol("sym")).catch(e => Promise.resolve(e));
- const result = await currentPatch.finished.then(() => Promise.resolve("ok")).catch(e => Promise.resolve(e));
- assert_true(result instanceof DOMException, `Expected a DOMException and received ${result}`);
- assert_equals(result.name, "DataError");
- assert_equals(result, reason);
- assert_equals(placeholder.textContent, "");
- assert_equals(placeholder.currentPatch, null);
-}, "streaming a Symbol directly into node.patchSelf()");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const writable = placeholder.patchSelf();
- assert_true(writable instanceof WritableStream, "node.patchSelf() returns a writable stream");
- const writer = writable.getWriter();
- await writer.write(12345);
- const {currentPatch} = placeholder;
- writer.close();
- await currentPatch.finished;
- assert_equals(placeholder.textContent, "12345");
- assert_equals(placeholder.currentPatch, null);
-}, "streaming numbers directly into node.patchSelf()");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const writable = placeholder.patchSelf();
- assert_true(writable instanceof WritableStream, "node.patchSelf() returns a writable stream");
- const writer = writable.getWriter();
- await writer.write(null);
- await writer.write(" ");
- await writer.write(undefined);
- const {currentPatch} = placeholder;
- writer.close();
- await currentPatch.finished;
- assert_equals(placeholder.textContent, "null undefined");
- assert_equals(placeholder.currentPatch, null);
-}, "streaming null or undefined directly into node.patchSelf()");
-
-promise_test(async t => {
- const style = document.querySelector("#style");
- const writable = style.patchSelf();
- const response = new Response("#target { color: rgba(100, 0, 100); }", {headers: {"Content-Type": "text/css"}});
- await response.body.pipeTo(writable);
- assert_equals(getComputedStyle(document.querySelector("#target")).color, "rgb(100, 0, 100)");
-}, "patchSelf() can stream into elements that receive raw text like <style>");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- const writable = placeholder.patchSelf();
- const writer = writable.getWriter();
- const encoder = new TextEncoder();
- await writer.write(encoder.encode("ABC"));
- const patch = placeholder.currentPatch;
- await writer.abort("abort-reason");
- await writer.write(encoder.encode("DEF")).catch(() => {});
- const result = await patch.finished.then(() =>
- Promise.resolve("success")).catch(e => Promise.resolve(e));
- assert_equals(placeholder.textContent, "ABC");
- assert_equals(result, "abort-reason");
-}, "Aborting A node.patchSelf() stream");
-
-promise_test(async t => {
- const placeholder = document.querySelector("#placeholder");
- let writable = placeholder.patchSelf();
- assert_true(writable instanceof WritableStream, "node.patchSelf() returns a writable stream");
- const response1 = new Response("content1", {headers: {"Content-Type": "text/html"}});
- const response2 = new Response("content2", {headers: {"Content-Type": "text/html"}});
- response1.body.pipeTo(writable);
- const first_patch = placeholder.currentPatch;
- writable = placeholder.patchSelf();
- const {currentPatch} = placeholder;
- response2.body.pipeTo(writable);
- await promise_rejects_dom(t, "AbortError", first_patch.finished);
- await currentPatch.finished;
- assert_equals(placeholder.textContent, "content2");
- assert_equals(placeholder.currentPatch, null);
-}, "A newer patch aborts the old one with an AbortError");
-
-</script>
-\ No newline at end of file