mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1770754 - [bidi] Support serialization of complex objects with container value fields. r=webdriver-reviewers,jdescottes,whimboo
Depends on D157813 Differential Revision: https://phabricator.services.mozilla.com/D157635
This commit is contained in:
parent
70a87b65a8
commit
f32dba0420
@ -49,6 +49,20 @@ function getUUID() {
|
||||
.slice(1, -1);
|
||||
}
|
||||
|
||||
const TYPED_ARRAY_CLASSES = [
|
||||
"Uint8Array",
|
||||
"Uint8ClampedArray",
|
||||
"Uint16Array",
|
||||
"Uint32Array",
|
||||
"Int8Array",
|
||||
"Int16Array",
|
||||
"Int32Array",
|
||||
"Float32Array",
|
||||
"Float64Array",
|
||||
"BigInt64Array",
|
||||
"BigUint64Array",
|
||||
];
|
||||
|
||||
/**
|
||||
* Build the serialized RemoteValue.
|
||||
*
|
||||
@ -472,7 +486,6 @@ function serialize(
|
||||
return { type, value };
|
||||
}
|
||||
|
||||
const className = ChromeUtils.getClassName(value);
|
||||
const handleId = getHandleForObject(realm, ownershipType, value);
|
||||
const knownObject = serializationInternalMap.has(value);
|
||||
|
||||
@ -480,6 +493,16 @@ function serialize(
|
||||
const childOwnership = OwnershipModel.None;
|
||||
|
||||
// Remote values
|
||||
|
||||
// symbols are primitive JS values which can only be serialized
|
||||
// as remote values.
|
||||
if (type == "symbol") {
|
||||
return buildSerialized("symbol", handleId);
|
||||
}
|
||||
|
||||
// All other remote values are non-primitives and their
|
||||
// className can be extracted with ChromeUtils.getClassName
|
||||
const className = ChromeUtils.getClassName(value);
|
||||
if (className == "Array") {
|
||||
const serialized = buildSerialized("array", handleId);
|
||||
setInternalIdsIfNeeded(serializationInternalMap, serialized, value);
|
||||
@ -530,10 +553,24 @@ function serialize(
|
||||
realm
|
||||
);
|
||||
}
|
||||
|
||||
return serialized;
|
||||
} else if (
|
||||
[
|
||||
"ArrayBuffer",
|
||||
"Function",
|
||||
"Promise",
|
||||
"WeakMap",
|
||||
"WeakSet",
|
||||
"Window",
|
||||
].includes(className)
|
||||
) {
|
||||
return buildSerialized(className.toLowerCase(), handleId);
|
||||
} else if (lazy.error.isError(value)) {
|
||||
return buildSerialized("error", handleId);
|
||||
} else if (TYPED_ARRAY_CLASSES.includes(className)) {
|
||||
return buildSerialized("typedarray", handleId);
|
||||
}
|
||||
// TODO: Bug 1770754. Remove the if condition when the serialization of all the other types is implemented,
|
||||
// TODO: Bug 1770733 and 1792524. Remove the if condition when the serialization of all the other types is implemented,
|
||||
// since then the serialization of plain objects should be the fallback.
|
||||
else if (className == "Object") {
|
||||
const serialized = buildSerialized("object", handleId);
|
||||
|
@ -56,6 +56,7 @@ const REMOTE_SIMPLE_VALUES = [
|
||||
];
|
||||
|
||||
const REMOTE_COMPLEX_VALUES = [
|
||||
{ value: Symbol("foo"), serialized: { type: "symbol" } },
|
||||
{
|
||||
value: [1],
|
||||
serialized: {
|
||||
@ -221,6 +222,22 @@ const REMOTE_COMPLEX_VALUES = [
|
||||
},
|
||||
deserializable: true,
|
||||
},
|
||||
{ value: new WeakMap([[{}, 1]]), serialized: { type: "weakmap" } },
|
||||
{ value: new WeakSet([{}]), serialized: { type: "weakset" } },
|
||||
{ value: new Error("error message"), serialized: { type: "error" } },
|
||||
{
|
||||
value: new SyntaxError("syntax error message"),
|
||||
serialized: { type: "error" },
|
||||
},
|
||||
{
|
||||
value: new TypeError("type error message"),
|
||||
serialized: { type: "error" },
|
||||
},
|
||||
{ value: new Promise(() => true), serialized: { type: "promise" } },
|
||||
{ value: new Int8Array(), serialized: { type: "typedarray" } },
|
||||
{ value: new ArrayBuffer(), serialized: { type: "arraybuffer" } },
|
||||
{ value: () => true, serialized: { type: "function" } },
|
||||
{ value() {}, serialized: { type: "function" } },
|
||||
{
|
||||
value: {},
|
||||
maxDepth: 1,
|
||||
|
@ -1,9 +0,0 @@
|
||||
[context_created.py]
|
||||
|
||||
[test_evaluate_window_open_without_url]
|
||||
bug: 1770754
|
||||
expected: FAIL
|
||||
|
||||
[test_evaluate_window_open_with_url]
|
||||
bug: 1770754
|
||||
expected: FAIL
|
@ -1,6 +0,0 @@
|
||||
[await_promise.py]
|
||||
[test_await_promise_delayed[False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_await_promise_async_arrow[False\]]
|
||||
expected: FAIL
|
@ -1,71 +1,22 @@
|
||||
[exception_details.py]
|
||||
[test_invalid_function]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(Symbol('foo'))-expected13-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(Symbol('foo'))-expected13-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(()=>{})-expected16-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(()=>{})-expected16-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(function(){})-expected17-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(function(){})-expected17-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(async ()=>{})-expected18-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(async ()=>{})-expected18-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(async function(){})-expected19-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(async function(){})-expected19-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new WeakMap()-expected24-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new WeakMap()-expected24-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new WeakSet()-expected25-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new WeakSet()-expected25-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new Error('SOME_ERROR_TEXT')-expected26-True\]]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1791715
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new Error('SOME_ERROR_TEXT')-expected26-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[Promise.resolve()-expected27-True\]]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1791715
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[Promise.resolve()-expected27-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new Int32Array()-expected28-True\]]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1791715
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new Int32Array()-expected28-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new ArrayBuffer()-expected29-True\]]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1791715
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new ArrayBuffer()-expected29-False\]]
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1791715
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[document.createElement('div')-expected30-True\]]
|
||||
@ -74,8 +25,6 @@
|
||||
[test_exception_details[document.createElement('div')-expected30-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[window-expected31-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[window-expected31-False\]]
|
||||
expected: FAIL
|
||||
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1791715
|
||||
|
@ -1,75 +1,6 @@
|
||||
[result.py]
|
||||
[test_remote_values[(Symbol('foo'))-expected0-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(Symbol('foo'))-expected0-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(()=>{})-expected3-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(()=>{})-expected3-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(function(){})-expected4-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(function(){})-expected4-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(async ()=>{})-expected5-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(async ()=>{})-expected5-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(async function(){})-expected6-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(async function(){})-expected6-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new WeakMap()-expected11-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new WeakMap()-expected11-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new WeakSet()-expected12-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new WeakSet()-expected12-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new Error('SOME_ERROR_TEXT')-expected13-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new Error('SOME_ERROR_TEXT')-expected13-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new Int32Array()-expected14-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new Int32Array()-expected14-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new ArrayBuffer()-expected15-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new ArrayBuffer()-expected15-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[document.createElement('div')-expected16-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[document.createElement('div')-expected16-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[window-expected17-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[window-expected17-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_value_promise_no_await]
|
||||
expected: FAIL
|
||||
|
@ -1,18 +0,0 @@
|
||||
[result_ownership.py]
|
||||
[test_invalid_script[root-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_invalid_script[none-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_invalid_script[None-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_return_value[root-True-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_return_value[none-False-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_return_value[None-False-False\]]
|
||||
expected: FAIL
|
@ -1,3 +0,0 @@
|
||||
[strict_mode.py]
|
||||
[test_strict_mode]
|
||||
expected: FAIL
|
@ -1,3 +0,0 @@
|
||||
[this.py]
|
||||
[test_default_this]
|
||||
expected: FAIL
|
@ -1,6 +0,0 @@
|
||||
[await_promise.py]
|
||||
[test_no_await_promise_rejected]
|
||||
expected: FAIL
|
||||
|
||||
[test_no_await_promise_resolved]
|
||||
expected: FAIL
|
@ -1,81 +1,6 @@
|
||||
[exception_details.py]
|
||||
[test_invalid_script]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(Symbol('foo'))-expected13-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(Symbol('foo'))-expected13-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(()=>{})-expected16-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(()=>{})-expected16-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(function(){})-expected17-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(function(){})-expected17-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(async ()=>{})-expected18-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(async ()=>{})-expected18-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(async function(){})-expected19-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[(async function(){})-expected19-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new WeakMap()-expected24-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new WeakMap()-expected24-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new WeakSet()-expected25-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new WeakSet()-expected25-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new Error('SOME_ERROR_TEXT')-expected26-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new Error('SOME_ERROR_TEXT')-expected26-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[Promise.resolve()-expected27-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[Promise.resolve()-expected27-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new Int32Array()-expected28-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new Int32Array()-expected28-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new ArrayBuffer()-expected29-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[new ArrayBuffer()-expected29-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[document.createElement('div')-expected30-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[document.createElement('div')-expected30-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[window-expected31-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_exception_details[window-expected31-False\]]
|
||||
expected: FAIL
|
||||
|
@ -1,39 +1,3 @@
|
||||
[result.py]
|
||||
[test_remote_values[new Int32Array()-expected15\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[document.createElement('div')-expected17\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[window-expected18\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(async function(){})-expected6\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(async ()=>{})-expected5\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(function(){})-expected4\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new ArrayBuffer()-expected16\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(Symbol('foo'))-expected0\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new WeakMap()-expected11\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[(()=>{})-expected3\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new Error('SOME_ERROR_TEXT')-expected13\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[new WeakSet()-expected12\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_remote_values[Promise.resolve()-expected14\]]
|
||||
expected: FAIL
|
||||
|
@ -1,18 +0,0 @@
|
||||
[result_ownership.py]
|
||||
[test_invalid_script[root-True\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_invalid_script[none-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_invalid_script[None-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_return_value[root-True-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_return_value[none-False-False\]]
|
||||
expected: FAIL
|
||||
|
||||
[test_return_value[None-False-False\]]
|
||||
expected: FAIL
|
@ -1,3 +0,0 @@
|
||||
[strict_mode.py]
|
||||
[test_strict_mode]
|
||||
expected: FAIL
|
Loading…
Reference in New Issue
Block a user