content: Make QuotaExceededError serializable (#38720)

Implements (de)serialization behavior for QuotaExceededError and enables
the annotation on the WebIDL spec.

Testing: Adds its own WPT tests
Fixes: https://github.com/servo/servo/issues/38685

---------

Signed-off-by: Rahul Menon <menonrahul02@gmail.com>
This commit is contained in:
Rahul Menon 2025-08-16 15:33:37 -05:00 committed by GitHub
parent e80d36783a
commit 389277fa72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 149 additions and 7 deletions

View file

@ -735329,7 +735329,7 @@
]
],
"structuredclone_0.html": [
"c8a6d38393c0217447992d47c994942e873e70ad",
"0d412baa701d5f1a5efb43bb470ca6aff849e082",
[
null,
{}

View file

@ -605,6 +605,42 @@
assert_unreached("Window must not be clonable");
});
},
function() {
var t = async_test("QuotaExceededError objects can be cloned");
t.id = 41;
worker.onmessage = t.step_func_done(function(e) {
assert_equals(Object.getPrototypeOf(e.data), QuotaExceededError.prototype, "Checking prototype");
assert_equals(e.data.constructor, QuotaExceededError, "Checking constructor");
assert_equals(e.data.name, "QuotaExceededError", "Checking name");
assert_equals(e.data.message, "some message", "Checking message");
assert_equals(e.data.code, DOMException.QUOTA_EXCEEDED_ERR, "Checking code");
assert_equals(e.data.quota, 0.1, "Checking quota");
assert_equals(e.data.requested, 1.0, "Checking requested");
assert_equals(e.data.foo, undefined, "Checking custom property");
});
t.step(function() {
const error = new QuotaExceededError(message = "some message", options = {quota: 0.1, requested: 1.0});
worker.postMessage(error);
});
},
function() {
var t = async_test("QuotaExceededError objects with empty quota/requested can be cloned");
t.id = 42;
worker.onmessage = t.step_func_done(function(e) {
assert_equals(Object.getPrototypeOf(e.data), QuotaExceededError.prototype, "Checking prototype");
assert_equals(e.data.constructor, QuotaExceededError, "Checking constructor");
assert_equals(e.data.name, "QuotaExceededError", "Checking name");
assert_equals(e.data.message, "some message", "Checking message");
assert_equals(e.data.code, DOMException.QUOTA_EXCEEDED_ERR, "Checking code");
assert_equals(e.data.quota, null, "Checking quota");
assert_equals(e.data.requested, null, "Checking requested");
assert_equals(e.data.foo, undefined, "Checking custom property");
});
t.step(function() {
const error = new QuotaExceededError(message = "some message");
worker.postMessage(error);
});
},
];
}, {explicit_done:true});