Diff
Modified: trunk/LayoutTests/ChangeLog (276371 => 276372)
--- trunk/LayoutTests/ChangeLog 2021-04-21 17:10:11 UTC (rev 276371)
+++ trunk/LayoutTests/ChangeLog 2021-04-21 17:43:50 UTC (rev 276372)
@@ -1,3 +1,13 @@
+2021-04-21 Chris Lord <cl...@igalia.com>
+
+ DOMException should be Serializable
+ https://bugs.webkit.org/show_bug.cgi?id=224865
+
+ Reviewed by Chris Dumez.
+
+ * storage/indexeddb/resources/structured-clone.js: Cloning DOMException is valid.
+ * storage/indexeddb/resources/structured-clone-expected.txt:
+
2021-04-21 Rob Buis <rb...@igalia.com>
RenderGeometryMap should know about individual transform properties
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (276371 => 276372)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-04-21 17:10:11 UTC (rev 276371)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-04-21 17:43:50 UTC (rev 276372)
@@ -1,3 +1,15 @@
+2021-04-21 Chris Lord <cl...@igalia.com>
+
+ DOMException should be Serializable
+ https://bugs.webkit.org/show_bug.cgi?id=224865
+
+ Reviewed by Chris Dumez.
+
+ DOMException is now serializable, rebaseline related tests.
+
+ * web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window-expected.txt:
+ * web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0-expected.txt:
+
2021-04-21 Ziran Sun <z...@igalia.com>
[css-grid] last-baseline shouldn't affect baseline alignment
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window-expected.txt (276371 => 276372)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window-expected.txt 2021-04-21 17:10:11 UTC (rev 276371)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window-expected.txt 2021-04-21 17:43:50 UTC (rev 276372)
@@ -3,6 +3,8 @@
Blocked access to external URL http://www1.127.0.0.1:8800/html/infrastructure/safe-passing-of-structured-data/resources/echo-iframe.html
Blocked access to external URL http://www1.127.0.0.1:8800/html/infrastructure/safe-passing-of-structured-data/resources/echo-iframe.html
+Harness Error (TIMEOUT), message = null
+
FAIL page-created Error (worker) The object can not be cloned.
FAIL page-created Error (cross-site iframe) The object can not be cloned.
PASS page-created DOMException (worker)
@@ -11,6 +13,6 @@
FAIL JS-engine-created TypeError (cross-site iframe) The object can not be cloned.
FAIL web API-created TypeError (worker) The object can not be cloned.
FAIL web API-created TypeError (cross-site iframe) The object can not be cloned.
-FAIL web API-created DOMException (worker) The object can not be cloned.
-FAIL web API-created DOMException (cross-site iframe) The object can not be cloned.
+FAIL web API-created DOMException (worker) assert_equals: expected (string) "createElement@[native code]\n@http://localhost:8800/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window.js:33:27\n@http://localhost:8800/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window.js:41:31\n@http://localhost:8800/resources/testharness.js:2044:30\nasync_test@http://localhost:8800/resources/testharness.js:609:38\nstackTests@http://localhost:8800/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window.js:40:13\nglobal code@http://localhost:8800/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-stack-optional.sub.window.js:31:11" but got (undefined) undefined
+TIMEOUT web API-created DOMException (cross-site iframe) Test timed out
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0-expected.txt (276371 => 276372)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0-expected.txt 2021-04-21 17:10:11 UTC (rev 276371)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/infrastructure/safe-passing-of-structured-data/structuredclone_0-expected.txt 2021-04-21 17:43:50 UTC (rev 276372)
@@ -38,6 +38,6 @@
FAIL Cloning a modified Error The object can not be cloned.
FAIL Error.message: getter is ignored when cloning The object can not be cloned.
FAIL Error.message: undefined property is stringified The object can not be cloned.
-FAIL DOMException objects can be cloned The object can not be cloned.
-FAIL DOMException objects created by the UA can be cloned The object can not be cloned.
+PASS DOMException objects can be cloned
+PASS DOMException objects created by the UA can be cloned
Modified: trunk/LayoutTests/storage/indexeddb/resources/structured-clone.js (276371 => 276372)
--- trunk/LayoutTests/storage/indexeddb/resources/structured-clone.js 2021-04-21 17:10:11 UTC (rev 276371)
+++ trunk/LayoutTests/storage/indexeddb/resources/structured-clone.js 2021-04-21 17:43:50 UTC (rev 276372)
@@ -42,7 +42,8 @@
testMap,
testSet,
testGeometryTypes,
- testCryptoKey
+ testCryptoKey,
+ testDOMExceptionObject
];
function nextTest() {
@@ -613,6 +614,31 @@
});
}
+function testDOMExceptionObject(callback)
+{
+ debug("Testing DOMException objects");
+ function testDOMException(string, callback) {
+ debug("Testing: " + string);
+ var value = eval("value = (" + string + ")");
+ test_data = value;
+ testValue(test_data, function(result) {
+ self.result = result;
+ shouldBeEqualToString("typeof result", "object");
+ shouldBe("Object.prototype.toString.call(result)", "Object.prototype.toString.call(test_data)");
+ shouldBeTrue("test_data !== result");
+ shouldBe("result.toString()", "test_data.toString()");
+ callback();
+ });
+ }
+
+ forEachWithCallback(testDOMException, [
+ "new DOMException()",
+ "new DOMException(\"message\")",
+ "new DOMException(\"message\", \"name\")",
+ "new DOMException(\"\", \"\")"
+ ], callback);
+}
+
function testBadTypes()
{
debug("Test types that can't be cloned:");
@@ -627,8 +653,6 @@
evalAndExpectException("store.put(new Error, 'key')", "DOMException.DATA_CLONE_ERR");
debug("Testing Function");
evalAndExpectException("store.put(new Function, 'key')", "DOMException.DATA_CLONE_ERR");
- debug("Testing DOMException");
- evalAndExpectException("store.put(new DOMException, 'key')", "DOMException.DATA_CLONE_ERR");
debug("Testing other host object types");
evalAndExpectException("store.put(self, 'key')", "DOMException.DATA_CLONE_ERR");
Modified: trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt (276371 => 276372)
--- trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt 2021-04-21 17:10:11 UTC (rev 276371)
+++ trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt 2021-04-21 17:43:50 UTC (rev 276372)
@@ -951,6 +951,44 @@
PASS test_data.algorithm.toString() is result.algorithm.toString()
PASS arrayCompare(test_data.usages, result.usages) is true
+Testing DOMException objects
+Testing: new DOMException()
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS typeof result is "object"
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data !== result is true
+PASS result.toString() is test_data.toString()
+Testing: new DOMException("message")
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS typeof result is "object"
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data !== result is true
+PASS result.toString() is test_data.toString()
+Testing: new DOMException("message", "name")
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS typeof result is "object"
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data !== result is true
+PASS result.toString() is test_data.toString()
+Testing: new DOMException("", "")
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS typeof result is "object"
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data !== result is true
+PASS result.toString() is test_data.toString()
+
Test types that can't be cloned:
transaction = db.transaction('storeName', 'readwrite')
store = transaction.objectStore('storeName')
@@ -964,11 +1002,6 @@
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: The object can not be cloned.
-Testing DOMException
-Expecting exception from store.put(new DOMException, 'key')
-PASS Exception was thrown.
-PASS code is DOMException.DATA_CLONE_ERR
-Exception message: The object can not be cloned.
Testing other host object types
Expecting exception from store.put(self, 'key')
PASS Exception was thrown.
Modified: trunk/Source/WebCore/ChangeLog (276371 => 276372)
--- trunk/Source/WebCore/ChangeLog 2021-04-21 17:10:11 UTC (rev 276371)
+++ trunk/Source/WebCore/ChangeLog 2021-04-21 17:43:50 UTC (rev 276372)
@@ -1,3 +1,16 @@
+2021-04-21 Chris Lord <cl...@igalia.com>
+
+ DOMException should be Serializable
+ https://bugs.webkit.org/show_bug.cgi?id=224865
+
+ Reviewed by Chris Dumez.
+
+ Implement serialization of DOMException objects.
+
+ No new tests, rebaselined existing tests.
+
+ * bindings/js/SerializedScriptValue.cpp:
+
2021-04-21 Rob Buis <rb...@igalia.com>
RenderGeometryMap should know about individual transform properties
Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (276371 => 276372)
--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2021-04-21 17:10:11 UTC (rev 276371)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2021-04-21 17:43:50 UTC (rev 276372)
@@ -40,6 +40,7 @@
#include "JSCryptoKey.h"
#include "JSDOMBinding.h"
#include "JSDOMConvertBufferSource.h"
+#include "JSDOMException.h"
#include "JSDOMGlobalObject.h"
#include "JSDOMMatrix.h"
#include "JSDOMPoint.h"
@@ -191,6 +192,7 @@
#if ENABLE(WEB_RTC)
RTCDataChannelTransferTag = 50,
#endif
+ DOMExceptionTag = 51,
ErrorTag = 255
};
@@ -381,6 +383,7 @@
* | OffscreenCanvasTransferTag <value:uint32_t>
* | WasmMemoryTag <value:uint32_t>
* | RTCDataChannelTransferTag <processIdentifier:uint64_t><rtcDataChannelIdentifier:uint64_t><label:String>
+ * | DOMExceptionTag <message:String> <name:String>
*
* Inside certificate, data is serialized in this format as per spec:
*
@@ -1123,6 +1126,18 @@
}
#endif
+ void dumpDOMException(JSObject* obj, SerializationReturnCode& code)
+ {
+ if (auto* exception = JSDOMException::toWrapped(m_lexicalGlobalObject->vm(), obj)) {
+ write(DOMExceptionTag);
+ write(exception->message());
+ write(exception->name());
+ return;
+ }
+
+ code = SerializationReturnCode::DataCloneError;
+ }
+
bool dumpIfTerminal(JSValue value, SerializationReturnCode& code)
{
if (!value.isCell()) {
@@ -1383,6 +1398,11 @@
return true;
}
#endif
+ if (obj->inherits(vm, JSDOMException::info())) {
+ dumpDOMException(obj, code);
+ return true;
+ }
+
return false;
}
// Any other types are expected to serialize as null.
@@ -3148,6 +3168,18 @@
return getJSValue(bitmap);
}
+ JSValue readDOMException()
+ {
+ CachedStringRef message;
+ if (!readStringData(message))
+ return JSValue();
+ CachedStringRef name;
+ if (!readStringData(name))
+ return JSValue();
+ auto exception = DOMException::create(message->string(), name->string());
+ return getJSValue(exception);
+ }
+
JSValue readBigInt()
{
uint8_t sign = 0;
@@ -3582,6 +3614,9 @@
case RTCDataChannelTransferTag:
return readRTCDataChannel();
#endif
+ case DOMExceptionTag:
+ return readDOMException();
+
default:
m_ptr--; // Push the tag back
return JSValue();