Vector<uint8_t> CompositingManager::authenticate() { IPC::DataReference data; m_connection->sendSync(Messages::CompositingManagerProxy::Authenticate(), Messages::CompositingManagerProxy::Authenticate::Reply(data), 0); return data.vector(); }
bool DecoderAdapter::decodeBytes(Vector<uint8_t>& bytes) { IPC::DataReference dataReference; if (!m_decoder.decode(dataReference)) return false; bytes = dataReference.vector(); return true; }
void WebIDBConnectionToClient::putOrAdd(const IDBRequestData& request, const IDBKeyData& key, const IPC::DataReference& data, unsigned overwriteMode) { if (overwriteMode != static_cast<unsigned>(IndexedDB::ObjectStoreOverwriteMode::NoOverwrite) && overwriteMode != static_cast<unsigned>(IndexedDB::ObjectStoreOverwriteMode::Overwrite) && overwriteMode != static_cast<unsigned>(IndexedDB::ObjectStoreOverwriteMode::OverwriteForCursor)) { // FIXME: This message from the WebProcess is corrupt. // The DatabaseProcess should return early at this point, but can we also kill the bad WebProcess? return; } IndexedDB::ObjectStoreOverwriteMode mode = static_cast<IndexedDB::ObjectStoreOverwriteMode>(overwriteMode); auto buffer = ThreadSafeDataBuffer::copyVector(data.vector()); DatabaseProcess::singleton().idbServer().putOrAdd(request, key, buffer, mode); }
void WebUserContentControllerProxy::didPostMessage(IPC::Connection& connection, uint64_t pageID, uint64_t frameID, const WebCore::SecurityOriginData& securityOrigin, uint64_t messageHandlerID, const IPC::DataReference& dataReference) { WebPageProxy* page = WebProcessProxy::webPage(pageID); if (!page) return; WebProcessProxy* webProcess = WebProcessProxy::fromConnection(&connection); WebFrameProxy* frame = webProcess->webFrame(frameID); if (!frame) return; if (!HashMap<uint64_t, RefPtr<WebScriptMessageHandler>>::isValidKey(messageHandlerID)) return; RefPtr<WebScriptMessageHandler> handler = m_scriptMessageHandlers.get(messageHandlerID); if (!handler) return; auto buffer = dataReference.vector(); RefPtr<WebCore::SerializedScriptValue> value = WebCore::SerializedScriptValue::adopt(buffer); handler->client().didPostMessage(*page, *frame, securityOrigin, *value); }
bool UserData::decode(IPC::ArgumentDecoder& decoder, RefPtr<API::Object>& result) { API::Object::Type type; if (!decoder.decodeEnum(type)) return false; switch (type) { case API::Object::Type::Array: { uint64_t size; if (!decoder.decode(size)) return false; Vector<RefPtr<API::Object>> elements; for (size_t i = 0; i < size; ++i) { RefPtr<API::Object> element; if (!decode(decoder, element)) return false; elements.append(std::move(element)); } result = API::Array::create(std::move(elements)); break; } case API::Object::Type::Boolean: if (!API::Boolean::decode(decoder, result)) return false; break; case API::Object::Type::Data: if (!API::Data::decode(decoder, result)) return false; break; case API::Object::Type::Dictionary: { uint64_t size; if (!decoder.decode(size)) return false; ImmutableDictionary::MapType map; for (size_t i = 0; i < size; ++i) { String key; if (!decoder.decode(key)) return false; RefPtr<API::Object> value; if (!decode(decoder, value)) return false; if (!map.add(std::move(key), std::move(value)).isNewEntry) return false; } result = ImmutableDictionary::create(std::move(map)); break; } case API::Object::Type::Double: if (!API::Double::decode(decoder, result)) return false; break; case API::Object::Type::Error: if (!API::Error::decode(decoder, result)) return false; break; case API::Object::Type::FrameHandle: { uint64_t frameID; if (!decoder.decode(frameID)) return false; result = API::FrameHandle::create(frameID); break; } case API::Object::Type::Null: result = nullptr; break; case API::Object::Type::Point: if (!API::Point::decode(decoder, result)) return false; break; case API::Object::Type::Rect: if (!API::Rect::decode(decoder, result)) return false; break; case API::Object::Type::SerializedScriptValue: { IPC::DataReference dataReference; if (!decoder.decode(dataReference)) return false; auto vector = dataReference.vector(); result = WebSerializedScriptValue::adopt(vector); break; } case API::Object::Type::Size: if (!API::Size::decode(decoder, result)) return false; break; case API::Object::Type::String: { String string; if (!decoder.decode(string)) return false; result = API::String::create(string); break; } case API::Object::Type::URL: if (!API::URL::decode(decoder, result)) return false; break; case API::Object::Type::URLRequest: if (!API::URLRequest::decode(decoder, result)) return false; break; case API::Object::Type::URLResponse: if (!API::URLResponse::decode(decoder, result)) return false; break; case API::Object::Type::UInt64: if (!API::UInt64::decode(decoder, result)) return false; break; default: ASSERT_NOT_REACHED(); } return true; }