Diff
Modified: branches/safari-607-branch/LayoutTests/ChangeLog (239803 => 239804)
--- branches/safari-607-branch/LayoutTests/ChangeLog 2019-01-10 01:38:20 UTC (rev 239803)
+++ branches/safari-607-branch/LayoutTests/ChangeLog 2019-01-10 01:38:24 UTC (rev 239804)
@@ -1,5 +1,57 @@
2019-01-09 Kocsen Chung <[email protected]>
+ Cherry-pick r239746. rdar://problem/47158728
+
+ IDB storage of Crypto keys does not work in private browsing mode
+ https://bugs.webkit.org/show_bug.cgi?id=193219
+
+ Reviewed by Brady Eidson.
+
+ Source/WebCore:
+
+ https://trac.webkit.org/changeset/238677 moved from using a JSGlobalObject to a JSDOMGlobalObject for serialization/deserialization.
+ This does not work for crypto keys as they require not only a JSDOMGlobalObject but either a window or worker global object.
+
+ To fix the issue, revert 238677, and fix it by checking whether the dumping of an ArrayBuffer happens for a JSDOMGlobalObject or a JSGlobalObject.
+ If it is the latter, use JSC routines instead of toJS() which requires a JSDOMGlobalObject.
+
+ Covered by updated test.
+
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadVM):
+ (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadExecState):
+ * bindings/js/JSDOMGlobalObject.cpp:
+ * bindings/js/JSDOMGlobalObject.h:
+ * bindings/js/JSDOMWrapper.cpp:
+ (WebCore::JSDOMObject::JSDOMObject):
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneSerializer::dumpArrayBufferView):
+ (WebCore::CloneSerializer::toJSArrayBuffer):
+
+ LayoutTests:
+
+ Activate private browsing mode for these two tests.
+
+ * crypto/subtle/rsa-indexeddb-non-exportable-private.html:
+ * crypto/subtle/rsa-indexeddb-private.html:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-01-08 Youenn Fablet <[email protected]>
+
+ IDB storage of Crypto keys does not work in private browsing mode
+ https://bugs.webkit.org/show_bug.cgi?id=193219
+
+ Reviewed by Brady Eidson.
+
+ Activate private browsing mode for these two tests.
+
+ * crypto/subtle/rsa-indexeddb-non-exportable-private.html:
+ * crypto/subtle/rsa-indexeddb-private.html:
+
+2019-01-09 Kocsen Chung <[email protected]>
+
Cherry-pick r239694. rdar://problem/47158722
Deactivate audio session whenever possible
Modified: branches/safari-607-branch/LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-private.html (239803 => 239804)
--- branches/safari-607-branch/LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-private.html 2019-01-10 01:38:20 UTC (rev 239803)
+++ branches/safari-607-branch/LayoutTests/crypto/subtle/rsa-indexeddb-non-exportable-private.html 2019-01-10 01:38:24 UTC (rev 239804)
@@ -2,7 +2,8 @@
<html>
<head>
<script>
-enablePrivateBrowsing = true;
+if (window.testRunner)
+ testRunner.setPrivateBrowsingEnabled(true);
</script>
<script src=""
<script src=""
Modified: branches/safari-607-branch/LayoutTests/crypto/subtle/rsa-indexeddb-private.html (239803 => 239804)
--- branches/safari-607-branch/LayoutTests/crypto/subtle/rsa-indexeddb-private.html 2019-01-10 01:38:20 UTC (rev 239803)
+++ branches/safari-607-branch/LayoutTests/crypto/subtle/rsa-indexeddb-private.html 2019-01-10 01:38:24 UTC (rev 239804)
@@ -2,7 +2,8 @@
<html>
<head>
<script>
-enablePrivateBrowsing = true;
+if (window.testRunner)
+ testRunner.setPrivateBrowsingEnabled(true);
</script>
<script src=""
<script src=""
Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (239803 => 239804)
--- branches/safari-607-branch/Source/WebCore/ChangeLog 2019-01-10 01:38:20 UTC (rev 239803)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog 2019-01-10 01:38:24 UTC (rev 239804)
@@ -1,5 +1,71 @@
2019-01-09 Kocsen Chung <[email protected]>
+ Cherry-pick r239746. rdar://problem/47158728
+
+ IDB storage of Crypto keys does not work in private browsing mode
+ https://bugs.webkit.org/show_bug.cgi?id=193219
+
+ Reviewed by Brady Eidson.
+
+ Source/WebCore:
+
+ https://trac.webkit.org/changeset/238677 moved from using a JSGlobalObject to a JSDOMGlobalObject for serialization/deserialization.
+ This does not work for crypto keys as they require not only a JSDOMGlobalObject but either a window or worker global object.
+
+ To fix the issue, revert 238677, and fix it by checking whether the dumping of an ArrayBuffer happens for a JSDOMGlobalObject or a JSGlobalObject.
+ If it is the latter, use JSC routines instead of toJS() which requires a JSDOMGlobalObject.
+
+ Covered by updated test.
+
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadVM):
+ (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadExecState):
+ * bindings/js/JSDOMGlobalObject.cpp:
+ * bindings/js/JSDOMGlobalObject.h:
+ * bindings/js/JSDOMWrapper.cpp:
+ (WebCore::JSDOMObject::JSDOMObject):
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneSerializer::dumpArrayBufferView):
+ (WebCore::CloneSerializer::toJSArrayBuffer):
+
+ LayoutTests:
+
+ Activate private browsing mode for these two tests.
+
+ * crypto/subtle/rsa-indexeddb-non-exportable-private.html:
+ * crypto/subtle/rsa-indexeddb-private.html:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-01-08 Youenn Fablet <[email protected]>
+
+ IDB storage of Crypto keys does not work in private browsing mode
+ https://bugs.webkit.org/show_bug.cgi?id=193219
+
+ Reviewed by Brady Eidson.
+
+ https://trac.webkit.org/changeset/238677 moved from using a JSGlobalObject to a JSDOMGlobalObject for serialization/deserialization.
+ This does not work for crypto keys as they require not only a JSDOMGlobalObject but either a window or worker global object.
+
+ To fix the issue, revert 238677, and fix it by checking whether the dumping of an ArrayBuffer happens for a JSDOMGlobalObject or a JSGlobalObject.
+ If it is the latter, use JSC routines instead of toJS() which requires a JSDOMGlobalObject.
+
+ Covered by updated test.
+
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadVM):
+ (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadExecState):
+ * bindings/js/JSDOMGlobalObject.cpp:
+ * bindings/js/JSDOMGlobalObject.h:
+ * bindings/js/JSDOMWrapper.cpp:
+ (WebCore::JSDOMObject::JSDOMObject):
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneSerializer::dumpArrayBufferView):
+ (WebCore::CloneSerializer::toJSArrayBuffer):
+
+2019-01-09 Kocsen Chung <[email protected]>
+
Cherry-pick r239715. rdar://problem/47158638
Crash in SWServer::Connection::resolveRegistrationReadyRequests
Modified: branches/safari-607-branch/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (239803 => 239804)
--- branches/safari-607-branch/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2019-01-10 01:38:20 UTC (rev 239803)
+++ branches/safari-607-branch/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2019-01-10 01:38:24 UTC (rev 239804)
@@ -28,7 +28,6 @@
#if ENABLE(INDEXED_DATABASE)
-#include "DOMWrapperWorld.h"
#include "IDBBindingUtilities.h"
#include "IDBCursorInfo.h"
#include "IDBGetAllRecordsData.h"
@@ -43,7 +42,6 @@
#include "Logging.h"
#include "SerializedScriptValue.h"
#include "UniqueIDBDatabaseConnection.h"
-#include "WebCoreJSClientData.h"
#include <_javascript_Core/AuxiliaryBarrierInlines.h>
#include <_javascript_Core/HeapInlines.h>
#include <_javascript_Core/StrongInlines.h>
@@ -940,11 +938,6 @@
{
ASSERT(!isMainThread());
static VM* vm = &VM::create().leakRef();
- if (!vm->heap.hasAccess()) {
- vm->heap.acquireAccess();
- JSVMClientData::initNormalWorld(vm);
- }
-
return *vm;
}
@@ -952,10 +945,10 @@
{
ASSERT(!isMainThread());
- static NeverDestroyed<Strong<JSDOMGlobalObject>> domGlobalObject(databaseThreadVM(), JSDOMGlobalObject::create(databaseThreadVM(), JSDOMGlobalObject::createStructure(databaseThreadVM(), jsNull()), normalWorld(databaseThreadVM())));
+ static NeverDestroyed<Strong<JSGlobalObject>> globalObject(databaseThreadVM(), JSGlobalObject::create(databaseThreadVM(), JSGlobalObject::createStructure(databaseThreadVM(), jsNull())));
- RELEASE_ASSERT(domGlobalObject.get()->globalExec());
- return *domGlobalObject.get()->globalExec();
+ RELEASE_ASSERT(globalObject.get()->globalExec());
+ return *globalObject.get()->globalExec();
}
void UniqueIDBDatabase::performPutOrAdd(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData& keyData, const IDBValue& originalRecordValue, IndexedDB::ObjectStoreOverwriteMode overwriteMode)
Modified: branches/safari-607-branch/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp (239803 => 239804)
--- branches/safari-607-branch/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp 2019-01-10 01:38:20 UTC (rev 239803)
+++ branches/safari-607-branch/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp 2019-01-10 01:38:24 UTC (rev 239804)
@@ -75,13 +75,6 @@
static_cast<JSDOMGlobalObject*>(cell)->JSDOMGlobalObject::~JSDOMGlobalObject();
}
-JSDOMGlobalObject* JSDOMGlobalObject::create(JSC::VM& vm, JSC::Structure* structure, Ref<DOMWrapperWorld>&& world)
-{
- JSDOMGlobalObject* domGlobalObject = new (NotNull, JSC::allocateCell<JSDOMGlobalObject>(vm.heap)) JSDOMGlobalObject(vm, structure, WTFMove(world));
- domGlobalObject->finishCreation(vm);
- return domGlobalObject;
-}
-
EncodedJSValue JSC_HOST_CALL makeThisTypeErrorForBuiltins(ExecState* execState)
{
ASSERT(execState);
Modified: branches/safari-607-branch/Source/WebCore/bindings/js/JSDOMGlobalObject.h (239803 => 239804)
--- branches/safari-607-branch/Source/WebCore/bindings/js/JSDOMGlobalObject.h 2019-01-10 01:38:20 UTC (rev 239803)
+++ branches/safari-607-branch/Source/WebCore/bindings/js/JSDOMGlobalObject.h 2019-01-10 01:38:24 UTC (rev 239804)
@@ -53,8 +53,6 @@
void finishCreation(JSC::VM&, JSC::JSObject*);
public:
- static JSDOMGlobalObject* create(JSC::VM&, JSC::Structure*, Ref<DOMWrapperWorld>&&);
-
Lock& gcLock() { return m_gcLock; }
JSDOMStructureMap& structures(const AbstractLocker&) { return m_structures; }
Modified: branches/safari-607-branch/Source/WebCore/bindings/js/JSDOMWrapper.cpp (239803 => 239804)
--- branches/safari-607-branch/Source/WebCore/bindings/js/JSDOMWrapper.cpp 2019-01-10 01:38:20 UTC (rev 239803)
+++ branches/safari-607-branch/Source/WebCore/bindings/js/JSDOMWrapper.cpp 2019-01-10 01:38:24 UTC (rev 239804)
@@ -41,7 +41,7 @@
JSDOMObject::JSDOMObject(JSC::Structure* structure, JSC::JSGlobalObject& globalObject)
: Base(globalObject.vm(), structure)
{
- ASSERT(globalObject.classInfo() == JSDOMGlobalObject::info() || scriptExecutionContext() || globalObject.classInfo() == JSRemoteDOMWindow::info());
+ ASSERT(scriptExecutionContext() || globalObject.classInfo() == JSRemoteDOMWindow::info());
}
JSC::CompleteSubspace* outputConstraintSubspaceFor(JSC::VM& vm)
Modified: branches/safari-607-branch/Source/WebCore/bindings/js/SerializedScriptValue.cpp (239803 => 239804)
--- branches/safari-607-branch/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2019-01-10 01:38:20 UTC (rev 239803)
+++ branches/safari-607-branch/Source/WebCore/bindings/js/SerializedScriptValue.cpp 2019-01-10 01:38:24 UTC (rev 239804)
@@ -765,6 +765,19 @@
}
}
+ JSC::JSValue toJSArrayBuffer(ArrayBuffer& arrayBuffer)
+ {
+ auto& vm = m_exec->vm();
+ auto* globalObject = m_exec->lexicalGlobalObject();
+ if (globalObject->inherits<JSDOMGlobalObject>(vm))
+ return toJS(m_exec, jsCast<JSDOMGlobalObject*>(globalObject), &arrayBuffer);
+
+ if (auto* buffer = arrayBuffer.m_wrapper.get())
+ return buffer;
+
+ return JSC::JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(arrayBuffer.sharingMode()), &arrayBuffer);
+ }
+
bool dumpArrayBufferView(JSObject* obj, SerializationReturnCode& code)
{
VM& vm = m_exec->vm();
@@ -800,8 +813,8 @@
code = SerializationReturnCode::ValidationError;
return true;
}
- JSValue bufferObj = toJS(m_exec, jsCast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject()), arrayBuffer.get());
- return dumpIfTerminal(bufferObj, code);
+
+ return dumpIfTerminal(toJSArrayBuffer(*arrayBuffer), code);
}
void dumpDOMPoint(const DOMPointReadOnly& point)