https://bugs.webkit.org/show_bug.cgi?id=192599
Reviewed by Brady Eidson.
Source/WebCore:
In case there is no script execution context, do not create a JS DOM wrapper for RTCCertificate.
Instead, create an empty object so that the deserialization can still succeed.
This should only impact IDB deserialization in the Network Process which does not need the actual JS DOM wrapper.
Test: webrtc/certificates-indexeddb.html
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal):
LayoutTests:
* webrtc/certificates-indexeddb-expected.txt: Added.
* webrtc/certificates-indexeddb.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239211
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-12-14 Youenn Fablet <youenn@apple.com>
+
+ IDB should store RTCCertificate
+ https://bugs.webkit.org/show_bug.cgi?id=192599
+
+ Reviewed by Brady Eidson.
+
+ * webrtc/certificates-indexeddb-expected.txt: Added.
+ * webrtc/certificates-indexeddb.html: Added.
+
2018-12-13 Ryosuke Niwa <rniwa@webkit.org>
Make HTMLConverter work across shadow boundaries
--- /dev/null
+
+PASS Testing certificates IndexedDB storage
+
--- /dev/null
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Testing certificates IndexedDB storage</title>
+ <script src="../resources/testharness.js"></script>
+ <script src="../resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <script>
+let certificate;
+
+function storeKey() {
+ var objectStore = db.transaction("certificate", "readwrite").objectStore("certificate");
+ var req = objectStore.put(certificate, "mycertificate");
+ req.onerror = function(event) {
+ assert_unreached("Could not put a key into database: " + event.target.error.name);
+ }
+ req.onsuccess = function(event) { readKey(); }
+}
+
+function readKey() {
+ var objectStore = db.transaction("certificate").objectStore("certificate");
+ var req = objectStore.get("mycertificate");
+ req.onerror = function(event) {
+ assert_not_reached("Could not get a key from database: " + event.target.error.name);
+ }
+ req.onsuccess = function(event) {
+ assert_not_equals(event.target.result, undefined);
+ assert_equals(event.target.result.expires, certificate.expires);
+ done();
+ }
+}
+
+async function doTest() {
+ certificate = await RTCPeerConnection.generateCertificate({ name: 'ECDSA', namedCurve: 'P-256' });
+
+ var openRequest = indexedDB.open("rtc");
+ openRequest.onupgradeneeded = function(event) {
+ var objectStore = event.target.result.createObjectStore("certificate");
+ }
+ openRequest.onerror = function(event) {
+ assert_not_reached("Could not open database: " + event.target.error.name);
+ }
+ openRequest.onsuccess = function(event) {
+ db = event.target.result;
+ storeKey();
+ }
+}
+doTest();
+
+ </script>
+ </body>
+</html>
+2018-12-14 Youenn Fablet <youenn@apple.com>
+
+ IDB should store RTCCertificate
+ https://bugs.webkit.org/show_bug.cgi?id=192599
+
+ Reviewed by Brady Eidson.
+
+ In case there is no script execution context, do not create a JS DOM wrapper for RTCCertificate.
+ Instead, create an empty object so that the deserialization can still succeed.
+ This should only impact IDB deserialization in the Network Process which does not need the actual JS DOM wrapper.
+
+ Test: webrtc/certificates-indexeddb.html
+
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneDeserializer::readTerminal):
+
2018-12-14 Zalan Bujtas <zalan@apple.com>
[LFC][BFC] Transition to logical margin types.
fingerprints.uncheckedAppend(RTCCertificate::DtlsFingerprint { algorithm->string(), value->string() });
}
+ if (!m_isDOMGlobalObject)
+ return constructEmptyObject(m_exec, m_globalObject->objectPrototype());
+
auto rtcCertificate = RTCCertificate::create(SecurityOrigin::createFromString(origin->string()), expires, WTFMove(fingerprints), certificate->takeString(), keyedMaterial->takeString());
return toJSNewlyCreated(m_exec, jsCast<JSDOMGlobalObject*>(m_globalObject), WTFMove(rtcCertificate));
}