mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00

Site isolation is a common technique to reduce the chance that malicious sites can access data from other sites. When the user navigates, we now check if the target site is the same as the current site. If not, we instruct the UI to perform the navigation in a new WebContent process. The phrase "site" here is defined as the public suffix of the URL plus one level. This means that navigating from "www.example.com" to "sub.example.com" remains in the same process. There's plenty of room for optimization around this. For example, we can create a spare WebContent process ahead of time to hot-swap the target site. We can also create a policy to keep the navigated-from process around, in case the user quickly navigates back.
109 lines
3 KiB
CMake
109 lines
3 KiB
CMake
include(fontconfig)
|
|
|
|
set(SOURCES
|
|
Application.cpp
|
|
Attribute.cpp
|
|
ChromeProcess.cpp
|
|
ConsoleOutput.cpp
|
|
CookieJar.cpp
|
|
Database.cpp
|
|
HelperProcess.cpp
|
|
InspectorClient.cpp
|
|
Mutation.cpp
|
|
Plugins/FontPlugin.cpp
|
|
Plugins/ImageCodecPlugin.cpp
|
|
Process.cpp
|
|
ProcessHandle.cpp
|
|
ProcessManager.cpp
|
|
SearchEngine.cpp
|
|
SiteIsolation.cpp
|
|
SourceHighlighter.cpp
|
|
URL.cpp
|
|
UserAgent.cpp
|
|
Utilities.cpp
|
|
ViewImplementation.cpp
|
|
WebContentClient.cpp
|
|
)
|
|
|
|
if (APPLE)
|
|
list(APPEND SOURCES MachPortServer.cpp)
|
|
endif()
|
|
|
|
if (ENABLE_QT)
|
|
list(APPEND SOURCES
|
|
EventLoop/EventLoopImplementationQt.cpp
|
|
EventLoop/EventLoopImplementationQtEventTarget.cpp
|
|
)
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
find_package(Qt6 REQUIRED COMPONENTS Core)
|
|
elseif (APPLE)
|
|
list(APPEND SOURCES
|
|
EventLoop/EventLoopImplementationMacOS.mm
|
|
)
|
|
endif()
|
|
|
|
set(GENERATED_SOURCES ${CURRENT_LIB_GENERATED})
|
|
|
|
embed_as_string(
|
|
"NativeStyleSheetSource.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/Native.css"
|
|
"NativeStyleSheetSource.cpp"
|
|
"native_stylesheet_source"
|
|
NAMESPACE "WebView"
|
|
)
|
|
|
|
compile_ipc(UIProcessServer.ipc UIProcessServerEndpoint.h)
|
|
compile_ipc(UIProcessClient.ipc UIProcessClientEndpoint.h)
|
|
|
|
if (NOT APPLE AND NOT CMAKE_INSTALL_LIBEXECDIR STREQUAL "libexec")
|
|
set_source_files_properties(Utilities.cpp PROPERTIES COMPILE_DEFINITIONS LADYBIRD_LIBEXECDIR="${CMAKE_INSTALL_LIBEXECDIR}")
|
|
endif()
|
|
|
|
set(GENERATED_SOURCES
|
|
${GENERATED_SOURCES}
|
|
../../Services/RequestServer/RequestClientEndpoint.h
|
|
../../Services/RequestServer/RequestServerEndpoint.h
|
|
../../Services/WebContent/WebContentClientEndpoint.h
|
|
../../Services/WebContent/WebContentServerEndpoint.h
|
|
../../Services/WebContent/WebDriverClientEndpoint.h
|
|
../../Services/WebContent/WebDriverServerEndpoint.h
|
|
NativeStyleSheetSource.cpp
|
|
UIProcessClientEndpoint.h
|
|
UIProcessServerEndpoint.h
|
|
)
|
|
|
|
serenity_lib(LibWebView webview)
|
|
target_link_libraries(LibWebView PRIVATE LibCore LibDevTools LibFileSystem LibGfx LibImageDecoderClient LibIPC LibRequests LibJS LibWeb LibUnicode LibURL LibSyntax)
|
|
|
|
if (APPLE)
|
|
target_link_libraries(LibWebView PRIVATE LibThreading)
|
|
endif()
|
|
|
|
# Third-party
|
|
find_package(SQLite3 REQUIRED)
|
|
target_link_libraries(LibWebView PRIVATE SQLite::SQLite3)
|
|
|
|
if (ENABLE_QT)
|
|
target_link_libraries(LibWebView PRIVATE Qt::Core)
|
|
elseif (APPLE)
|
|
target_link_libraries(LibWebView PRIVATE "-framework Cocoa")
|
|
endif()
|
|
|
|
if (HAS_FONTCONFIG)
|
|
target_link_libraries(LibWebView PRIVATE Fontconfig::Fontconfig)
|
|
endif()
|
|
|
|
if (ENABLE_INSTALL_HEADERS)
|
|
foreach(header ${GENERATED_SOURCES})
|
|
get_filename_component(extension ${header} EXT)
|
|
if (NOT "${extension}" STREQUAL ".h")
|
|
continue()
|
|
endif()
|
|
|
|
get_filename_component(subdirectory ${header} DIRECTORY)
|
|
string(REGEX REPLACE "^\\.\\./\\.\\./" "" subdirectory "${subdirectory}")
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${header}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${subdirectory}")
|
|
endforeach()
|
|
endif()
|