SlideShare una empresa de Scribd logo
1 de 29
Descargar para leer sin conexión
WebKit2 and You
WebKit2 for Application Developers
Martin Robinson
Igalia
Quick Review
WebKit
· Web content engine
· Processes and renders web content
· Started as a fork of KTHML and KJS
· Open source since 2005
· Goals: open source, compatibility, compliance, stability, performance,
security, portability, usability, hackability
· Non-goals: being a full web browser, being a science project, having
reusable components, unlimited scope
· Split into ports: GTK+, Qt, EFL, Mac, Windows

4/29
WebKitGTK+
· Each WebKit port is composed of
- Platform interfaces
- API layer
· WebKitGTK+ platform layer:
- libsoup for networking
- cairo for rasterization
- OpenGL for making the scene graph and WebGL
- GStreamer for media
- Various GTK+ APIs for talking with the system
· API layer is a GtkWidget and a set of GObject APIs
· WebKitGTK+ is used by Epiphany, Midori, yelp, devhelp

5/29
Architecture

6/29
Minor Philosophical Point
· Code has bugs that crash the program.
· Code has bugs that allow arbitrary code execution.
· Code relies on dependencies with bugs.
· Code handles fonts and images that are essentially small programs.
· WebKit2 is a pragmatic response

7/29
Why WebKit2?
·
·
·
·

The web platform is huge

Make crashes less inconvenient for users
Prevent bugs and crashes from exposing user data
Prevent bugs and crashes from damaging the system or executing
arbitrary code
· Stop web applications from blocking each other

8/29
WebKit2
· Give the web rendering parts of WebKit their own process
· Page crashes don't crash the browser
· Can put vulnerable data into a separate address space
· Sandbox web rendering
· Prevent pages from accessing the disk and operating system
interface

9/29
WebKit2 Architecture

10/29
Details
IPC
· IPC glues the different processes together
· Three types of IPC in use in Webkit
- Messaging: Unix domain socket for sending messages
synchronously or asynchronously
- Shared memory: shmem for passing large messages and bitmaps
- Shared surfaces: XComposite/XDamage for passing hardware
accelerated surfaces cheaply

12/29
Accelerated Compositing
· WebKit has its own hardware-accelerated scene graph of page content
- Prevent unnecessary redraw
- 3D CSS transforms
- WebGL
· Scene graph is in the WebProcess, but drawing happens in the
UIProcess
· XComposite/XDamage allows compositing and final paint in different
processes

13/29
Practical Bits
Should I port my application to WebKit2?

Yes
Why Port?
· WebKit1 development has moved to maintenance mode
· WebKit1 will be deprecated in the future
· The WebKit2GTK+ API is richer and better tested
· Porting to WebKit2 brings immediate performance, security, and
stability benefits

16/29
Porting Challenges
· There is not yet a porting guide
- Extensive API documentation
· Many synchronous APIs with return values are now asynchronous
void webkit_web_view_save (WebKitWebView *web_view,
WebKitSaveMode save_mode,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);

C

· Two-way communication from the page is more complicated
- Injected script source
- Custom protocols
- GObject DOM bindings
- Page access via the JSC API

17/29
Injected Script Source
· Strings of JavaScript source code executed asynchronously in the
WebProces
· Can return a value which is serialized and sent across the IPC
messaging channel

18/29
Injected Script Source
webkit_web_view_run_javascript (web_view, "window.document.body.textContent;", 0,
run_javascript_finished_callback, NULL);

static void
run_javascript_finished_callback (GObject *source_object, GAsyncResult *result, gpointer user_data)
{
GError *error;
WebKitJavaScriptResult *javascript_result =
webkit_web_view_run_javascript_finish (WEBKIT_WEB_VIEW(source_object), result, &error);

C

C

JSStringRef string_value = JSValueToStringCopy (
webkit_javascript_result_get_global_context (javascript_result),
webkit_javascript_result_get_value (javascript_result), NULL);
char *string = g_malloc (JSStringGetMaximumUTF8CStringSize (string_value));
JSStringGetUTF8CString (string_value, string, JSStringGetMaximumUTF8CStringSize (string_value));
printf ("result: %sn", string);
...
}

19/29
Custom Protocols
· Page to WebKit communication by accessing a resourcess across a
custom protocol
· Example of this approach are about: pages
· Communicate without reloading the page via AJAX
· Subject to same-origin security restrictions

20/29
Custom Protocols
WebKitContext *context = webkit_web_context_get_default ();
webkit_web_context_register_uri_scheme (context, "about", about_uri_scheme_request_cb, NULL, NULL);

static void
about_uri_scheme_request_cb (WebKitURISchemeRequest *request,
gpointer
user_data)
{
GInputStream *stream;
const gchar *path;
gchar
*contents;

C

C

path = webkit_uri_scheme_request_get_path (request);
contents = g_strdup_printf ("Loaded about:%s page", path);
stream = g_memory_input_stream_new_from_data (contents, strlen (contents), g_free);
webkit_uri_scheme_request_finish (request, stream, stream_length, "text/html");
g_object_unref (stream);
}

21/29
Web Extensions
· Web extensions are shared objects that execute in the WebProcess
· No IPC penalties
- Synchronous behavior does not block the UI
- Direct access to page state including the DOM
- Timing is less of an issue
· Written on top of the port-independent WebKit InjectedBundle
· No IPC API, but you can use DBus for communication with the
UIProcess

22/29
Web Extensions
C

void
webkit_web_extension_initialize (WebKitWebExtension *extension)
{
printf ("Hello from a WebProcessn");
}

$ gcc -c -Wall -Werror -fpic web-extension.c
$ gcc -shared -o web-extension.so web-extension.o

SHELL

webkit_web_context_set_web_extensions_directory (webkit_web_context_get_default (),
"/path/to/shared-object");

C

23/29
GObject DOM Bindings via Web Extensions
· GObject DOM bindings allow accessing page DOM using GObject APIs
· Cannot run in the UIProcess, the DOM is in a different address space
· In WebKit2, these are only accessible via Web Extensions
static void
document_loaded_callback (WebKitWebPage *page, gpointer user_data)
{
printf ("title: %sn", webkit_dom_document_get_title (webkit_web_page_get_dom_document (page)));
}

C

static void
page_created_callback (WebKitWebExtension *extension, WebKitWebPage *page, gpointer user_data)
{
g_signal_connect (page, "document-loaded", G_CALLBACK(document_loaded_callback), 0);
}
void
webkit_web_extension_initialize (WebKitWebExtension *extension)
{
g_signal_connect (extension, "page-created", G_CALLBACK(page_created_callback), NULL);
}

24/29
Injected JavaScript via Web Extensions
· Similar to the GObject DOM bindings approach
· Instead of using the GObject API, use the JSC C API
· Can interact with the page as well as insert JavaScript objects backed
by native code
· The most flexible approach
· Necessary Web Extension API should appear soon in a future release

25/29
The Near Future
More Processes

27/29
WebKit2
· Multiple WebProcesses
- Isolate applications from each other as well as from the UI
- Prevents crash from crashing every tab
· Networking Process
- Necessary for multiple web processes
- Avoids complexity of caches/databases with multiple writers
· Offline Storage Process
· Disk access blocking and insecure
· More easily sandbox WebProcesses

28/29
Thank You!
(q&a)

twitter @abandonedwig
www abandonedwig.info
29/29

Más contenido relacionado

La actualidad más candente

WebKit and GStreamer
WebKit and GStreamerWebKit and GStreamer
WebKit and GStreamercalvaris
 
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...Igalia
 
Pairing WebKit and Wayland for Linux-Based Embedded Web Content Presentation ...
Pairing WebKit and Wayland for Linux-Based Embedded Web Content Presentation ...Pairing WebKit and Wayland for Linux-Based Embedded Web Content Presentation ...
Pairing WebKit and Wayland for Linux-Based Embedded Web Content Presentation ...Igalia
 
The Internal Architecture of Chrome Developer Tools
The Internal Architecture of Chrome Developer ToolsThe Internal Architecture of Chrome Developer Tools
The Internal Architecture of Chrome Developer ToolsMiroslav Bajtoš
 
Android Chromium Rendering Pipeline
Android Chromium Rendering PipelineAndroid Chromium Rendering Pipeline
Android Chromium Rendering PipelineHyungwook Lee
 
WebKit Clutter Port Present and Future; WebKitGtk Status and Roadmap to WebKi...
WebKit Clutter Port Present and Future; WebKitGtk Status and Roadmap to WebKi...WebKit Clutter Port Present and Future; WebKitGtk Status and Roadmap to WebKi...
WebKit Clutter Port Present and Future; WebKitGtk Status and Roadmap to WebKi...Igalia
 
WebKit and Blink: open development powering the HTML5 revolution
WebKit and Blink: open development powering the HTML5 revolutionWebKit and Blink: open development powering the HTML5 revolution
WebKit and Blink: open development powering the HTML5 revolutionjuanjosanchezpenas
 
LCU14 208- Chromium-Blink Migration for RDK
LCU14 208- Chromium-Blink Migration for RDKLCU14 208- Chromium-Blink Migration for RDK
LCU14 208- Chromium-Blink Migration for RDKLinaro
 
Webkit Chromium Contribution Process
Webkit Chromium Contribution ProcessWebkit Chromium Contribution Process
Webkit Chromium Contribution ProcessGyuyoung Kim
 
Chromium Ozone
Chromium OzoneChromium Ozone
Chromium OzoneIgalia
 
The WebKit project (LinuxCon North America 2012)
The WebKit project (LinuxCon North America 2012)The WebKit project (LinuxCon North America 2012)
The WebKit project (LinuxCon North America 2012)Igalia
 
2021 WebKit Contributors Meeting, Igalia
2021 WebKit Contributors Meeting, Igalia2021 WebKit Contributors Meeting, Igalia
2021 WebKit Contributors Meeting, IgaliaIgalia
 
The pathway to Chromium on Wayland (Web Engines Hackfest 2018)
The pathway to Chromium on Wayland (Web Engines Hackfest 2018)The pathway to Chromium on Wayland (Web Engines Hackfest 2018)
The pathway to Chromium on Wayland (Web Engines Hackfest 2018)Igalia
 
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...Igalia
 
HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)
HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)
HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)Igalia
 
Driving and virtualizing control systems: the Open Source approach used in Wh...
Driving and virtualizing control systems: the Open Source approach used in Wh...Driving and virtualizing control systems: the Open Source approach used in Wh...
Driving and virtualizing control systems: the Open Source approach used in Wh...Igalia
 
Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...
Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...
Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...Igalia
 
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 RevolutionWebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolutionjuanjosanchezpenas
 
GStreamer support in WebKit. what’s new?
GStreamer support in WebKit. what’s new?GStreamer support in WebKit. what’s new?
GStreamer support in WebKit. what’s new?philn2
 

La actualidad más candente (19)

WebKit and GStreamer
WebKit and GStreamerWebKit and GStreamer
WebKit and GStreamer
 
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
HTML5 Apps on AGL Platform with the Web Application Manager (Automotive Grade...
 
Pairing WebKit and Wayland for Linux-Based Embedded Web Content Presentation ...
Pairing WebKit and Wayland for Linux-Based Embedded Web Content Presentation ...Pairing WebKit and Wayland for Linux-Based Embedded Web Content Presentation ...
Pairing WebKit and Wayland for Linux-Based Embedded Web Content Presentation ...
 
The Internal Architecture of Chrome Developer Tools
The Internal Architecture of Chrome Developer ToolsThe Internal Architecture of Chrome Developer Tools
The Internal Architecture of Chrome Developer Tools
 
Android Chromium Rendering Pipeline
Android Chromium Rendering PipelineAndroid Chromium Rendering Pipeline
Android Chromium Rendering Pipeline
 
WebKit Clutter Port Present and Future; WebKitGtk Status and Roadmap to WebKi...
WebKit Clutter Port Present and Future; WebKitGtk Status and Roadmap to WebKi...WebKit Clutter Port Present and Future; WebKitGtk Status and Roadmap to WebKi...
WebKit Clutter Port Present and Future; WebKitGtk Status and Roadmap to WebKi...
 
WebKit and Blink: open development powering the HTML5 revolution
WebKit and Blink: open development powering the HTML5 revolutionWebKit and Blink: open development powering the HTML5 revolution
WebKit and Blink: open development powering the HTML5 revolution
 
LCU14 208- Chromium-Blink Migration for RDK
LCU14 208- Chromium-Blink Migration for RDKLCU14 208- Chromium-Blink Migration for RDK
LCU14 208- Chromium-Blink Migration for RDK
 
Webkit Chromium Contribution Process
Webkit Chromium Contribution ProcessWebkit Chromium Contribution Process
Webkit Chromium Contribution Process
 
Chromium Ozone
Chromium OzoneChromium Ozone
Chromium Ozone
 
The WebKit project (LinuxCon North America 2012)
The WebKit project (LinuxCon North America 2012)The WebKit project (LinuxCon North America 2012)
The WebKit project (LinuxCon North America 2012)
 
2021 WebKit Contributors Meeting, Igalia
2021 WebKit Contributors Meeting, Igalia2021 WebKit Contributors Meeting, Igalia
2021 WebKit Contributors Meeting, Igalia
 
The pathway to Chromium on Wayland (Web Engines Hackfest 2018)
The pathway to Chromium on Wayland (Web Engines Hackfest 2018)The pathway to Chromium on Wayland (Web Engines Hackfest 2018)
The pathway to Chromium on Wayland (Web Engines Hackfest 2018)
 
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...
A Browser for the Automotive: Introduction to WebKit for Wayland (Automotive ...
 
HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)
HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)
HTML5 on the AGL demo platform with Chromium and WAM (AGL AMM March 2021)
 
Driving and virtualizing control systems: the Open Source approach used in Wh...
Driving and virtualizing control systems: the Open Source approach used in Wh...Driving and virtualizing control systems: the Open Source approach used in Wh...
Driving and virtualizing control systems: the Open Source approach used in Wh...
 
Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...
Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...
Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...
 
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 RevolutionWebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolution
 
GStreamer support in WebKit. what’s new?
GStreamer support in WebKit. what’s new?GStreamer support in WebKit. what’s new?
GStreamer support in WebKit. what’s new?
 

Similar a WebKit2 And You (GUADEC 2013)

Igalia and WebKit: Status update and plans
Igalia and WebKit: Status update and plansIgalia and WebKit: Status update and plans
Igalia and WebKit: Status update and plansIgalia
 
Wayland support in WebKit2GTK+ (GUADEC 2014)
Wayland support in WebKit2GTK+ (GUADEC 2014)Wayland support in WebKit2GTK+ (GUADEC 2014)
Wayland support in WebKit2GTK+ (GUADEC 2014)Igalia
 
WebKit and GStreamer (GStreamer Conference 2013)
WebKit and GStreamer (GStreamer Conference 2013)WebKit and GStreamer (GStreamer Conference 2013)
WebKit and GStreamer (GStreamer Conference 2013)Igalia
 
Developments in the Qt WebKit Integration
Developments in the Qt WebKit IntegrationDevelopments in the Qt WebKit Integration
Developments in the Qt WebKit Integrationaccount inactive
 
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolutio...
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolutio...WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolutio...
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolutio...Igalia
 
Add the power of the Web to your embedded devices with WPE WebKit
Add the power of the Web to your embedded devices with WPE WebKitAdd the power of the Web to your embedded devices with WPE WebKit
Add the power of the Web to your embedded devices with WPE WebKitIgalia
 
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...Igalia
 
WebKit and Blink: Open Development Powering the HTML5 Revolution (LinuxCon No...
WebKit and Blink: Open Development Powering the HTML5 Revolution (LinuxCon No...WebKit and Blink: Open Development Powering the HTML5 Revolution (LinuxCon No...
WebKit and Blink: Open Development Powering the HTML5 Revolution (LinuxCon No...Igalia
 
Next Generation Hybrid Applications with Qt - presentation for SEE 2009
Next Generation Hybrid Applications with Qt - presentation for SEE 2009Next Generation Hybrid Applications with Qt - presentation for SEE 2009
Next Generation Hybrid Applications with Qt - presentation for SEE 2009Nokia
 
Lessons from Contributing to WebKit and Blink
Lessons from Contributing to WebKit and BlinkLessons from Contributing to WebKit and Blink
Lessons from Contributing to WebKit and BlinkBruno Abinader
 
Update on the open source browser space (16th GENIVI AMM)
Update on the open source browser space (16th GENIVI AMM)Update on the open source browser space (16th GENIVI AMM)
Update on the open source browser space (16th GENIVI AMM)Igalia
 
Web 3.12: A browser to make us proud (GUADEC 2014)
Web 3.12: A browser to make us proud (GUADEC 2014)Web 3.12: A browser to make us proud (GUADEC 2014)
Web 3.12: A browser to make us proud (GUADEC 2014)Igalia
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTCGiacomo Vacca
 
JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK
 
Multimedia in WebKitGTK+ (FOSDEM 2010)
Multimedia in WebKitGTK+ (FOSDEM 2010)Multimedia in WebKitGTK+ (FOSDEM 2010)
Multimedia in WebKitGTK+ (FOSDEM 2010)Igalia
 
Serving QML applications over the network
Serving QML applications over the networkServing QML applications over the network
Serving QML applications over the networkJeremy Lainé
 
Browsers and Web Runtimes for Automotive: Alternatives, Challenges, and Curre...
Browsers and Web Runtimes for Automotive: Alternatives, Challenges, and Curre...Browsers and Web Runtimes for Automotive: Alternatives, Challenges, and Curre...
Browsers and Web Runtimes for Automotive: Alternatives, Challenges, and Curre...Igalia
 
WebRTC in WPE/GTK Ports: Current status and challenges
WebRTC in WPE/GTK Ports: Current status and challengesWebRTC in WPE/GTK Ports: Current status and challenges
WebRTC in WPE/GTK Ports: Current status and challengesIgalia
 

Similar a WebKit2 And You (GUADEC 2013) (20)

Igalia and WebKit: Status update and plans
Igalia and WebKit: Status update and plansIgalia and WebKit: Status update and plans
Igalia and WebKit: Status update and plans
 
Wayland support in WebKit2GTK+ (GUADEC 2014)
Wayland support in WebKit2GTK+ (GUADEC 2014)Wayland support in WebKit2GTK+ (GUADEC 2014)
Wayland support in WebKit2GTK+ (GUADEC 2014)
 
The WebKit project
The WebKit projectThe WebKit project
The WebKit project
 
WebKit and GStreamer (GStreamer Conference 2013)
WebKit and GStreamer (GStreamer Conference 2013)WebKit and GStreamer (GStreamer Conference 2013)
WebKit and GStreamer (GStreamer Conference 2013)
 
Developments in the Qt WebKit Integration
Developments in the Qt WebKit IntegrationDevelopments in the Qt WebKit Integration
Developments in the Qt WebKit Integration
 
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolutio...
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolutio...WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolutio...
WebKit and Blink: Bridging the Gap Between the Kernel and the HTML5 Revolutio...
 
Add the power of the Web to your embedded devices with WPE WebKit
Add the power of the Web to your embedded devices with WPE WebKitAdd the power of the Web to your embedded devices with WPE WebKit
Add the power of the Web to your embedded devices with WPE WebKit
 
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...
WPEWebKit, the WebKit port for embedded platforms (Linaro Connect San Diego 2...
 
WebKit and Blink: Open Development Powering the HTML5 Revolution (LinuxCon No...
WebKit and Blink: Open Development Powering the HTML5 Revolution (LinuxCon No...WebKit and Blink: Open Development Powering the HTML5 Revolution (LinuxCon No...
WebKit and Blink: Open Development Powering the HTML5 Revolution (LinuxCon No...
 
Next Generation Hybrid Applications with Qt - presentation for SEE 2009
Next Generation Hybrid Applications with Qt - presentation for SEE 2009Next Generation Hybrid Applications with Qt - presentation for SEE 2009
Next Generation Hybrid Applications with Qt - presentation for SEE 2009
 
Lessons from Contributing to WebKit and Blink
Lessons from Contributing to WebKit and BlinkLessons from Contributing to WebKit and Blink
Lessons from Contributing to WebKit and Blink
 
Update on the open source browser space (16th GENIVI AMM)
Update on the open source browser space (16th GENIVI AMM)Update on the open source browser space (16th GENIVI AMM)
Update on the open source browser space (16th GENIVI AMM)
 
Web 3.12: A browser to make us proud (GUADEC 2014)
Web 3.12: A browser to make us proud (GUADEC 2014)Web 3.12: A browser to make us proud (GUADEC 2014)
Web 3.12: A browser to make us proud (GUADEC 2014)
 
Transforming the web into a real application platform
Transforming the web into a real application platformTransforming the web into a real application platform
Transforming the web into a real application platform
 
[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC[workshop] The Revolutionary WebRTC
[workshop] The Revolutionary WebRTC
 
JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013JooinK - DevFest Piemonte 2013
JooinK - DevFest Piemonte 2013
 
Multimedia in WebKitGTK+ (FOSDEM 2010)
Multimedia in WebKitGTK+ (FOSDEM 2010)Multimedia in WebKitGTK+ (FOSDEM 2010)
Multimedia in WebKitGTK+ (FOSDEM 2010)
 
Serving QML applications over the network
Serving QML applications over the networkServing QML applications over the network
Serving QML applications over the network
 
Browsers and Web Runtimes for Automotive: Alternatives, Challenges, and Curre...
Browsers and Web Runtimes for Automotive: Alternatives, Challenges, and Curre...Browsers and Web Runtimes for Automotive: Alternatives, Challenges, and Curre...
Browsers and Web Runtimes for Automotive: Alternatives, Challenges, and Curre...
 
WebRTC in WPE/GTK Ports: Current status and challenges
WebRTC in WPE/GTK Ports: Current status and challengesWebRTC in WPE/GTK Ports: Current status and challenges
WebRTC in WPE/GTK Ports: Current status and challenges
 

Más de Igalia

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEIgalia
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesIgalia
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceIgalia
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfIgalia
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JITIgalia
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!Igalia
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerIgalia
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in MesaIgalia
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIgalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera LinuxIgalia
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVMIgalia
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsIgalia
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesIgalia
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSIgalia
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webIgalia
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersIgalia
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...Igalia
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on RaspberryIgalia
 

Más de Igalia (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Building End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPEBuilding End-user Applications on Embedded Devices with WPE
Building End-user Applications on Embedded Devices with WPE
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded DevicesAutomated Testing for Web-based Systems on Embedded Devices
Automated Testing for Web-based Systems on Embedded Devices
 
Embedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to MaintenanceEmbedding WPE WebKit - from Bring-up to Maintenance
Embedding WPE WebKit - from Bring-up to Maintenance
 
Optimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdfOptimizing Scheduler for Linux Gaming.pdf
Optimizing Scheduler for Linux Gaming.pdf
 
Running JS via WASM faster with JIT
Running JS via WASM      faster with JITRunning JS via WASM      faster with JIT
Running JS via WASM faster with JIT
 
To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!To crash or not to crash: if you do, at least recover fast!
To crash or not to crash: if you do, at least recover fast!
 
Implementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamerImplementing a Vulkan Video Encoder From Mesa to GStreamer
Implementing a Vulkan Video Encoder From Mesa to GStreamer
 
8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa8 Years of Open Drivers, including the State of Vulkan in Mesa
8 Years of Open Drivers, including the State of Vulkan in Mesa
 
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por IgaliaIntroducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
Introducción a Mesa. Caso específico dos dispositivos Raspberry Pi por Igalia
 
2023 in Chimera Linux
2023 in Chimera                    Linux2023 in Chimera                    Linux
2023 in Chimera Linux
 
Building a Linux distro with LLVM
Building a Linux distro        with LLVMBuilding a Linux distro        with LLVM
Building a Linux distro with LLVM
 
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUsturnip: Update on Open Source Vulkan Driver for Adreno GPUs
turnip: Update on Open Source Vulkan Driver for Adreno GPUs
 
Graphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devicesGraphics stack updates for Raspberry Pi devices
Graphics stack updates for Raspberry Pi devices
 
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOSDelegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
Delegated Compositing - Utilizing Wayland Protocols for Chromium on ChromeOS
 
MessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the webMessageFormat: The future of i18n on the web
MessageFormat: The future of i18n on the web
 
Replacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shadersReplacing the geometry pipeline with mesh shaders
Replacing the geometry pipeline with mesh shaders
 
I'm not an AMD expert, but...
I'm not an AMD expert, but...I'm not an AMD expert, but...
I'm not an AMD expert, but...
 
Status of Vulkan on Raspberry
Status of Vulkan on RaspberryStatus of Vulkan on Raspberry
Status of Vulkan on Raspberry
 

Último

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

WebKit2 And You (GUADEC 2013)

  • 1.
  • 2. WebKit2 and You WebKit2 for Application Developers Martin Robinson Igalia
  • 4. WebKit · Web content engine · Processes and renders web content · Started as a fork of KTHML and KJS · Open source since 2005 · Goals: open source, compatibility, compliance, stability, performance, security, portability, usability, hackability · Non-goals: being a full web browser, being a science project, having reusable components, unlimited scope · Split into ports: GTK+, Qt, EFL, Mac, Windows 4/29
  • 5. WebKitGTK+ · Each WebKit port is composed of - Platform interfaces - API layer · WebKitGTK+ platform layer: - libsoup for networking - cairo for rasterization - OpenGL for making the scene graph and WebGL - GStreamer for media - Various GTK+ APIs for talking with the system · API layer is a GtkWidget and a set of GObject APIs · WebKitGTK+ is used by Epiphany, Midori, yelp, devhelp 5/29
  • 7. Minor Philosophical Point · Code has bugs that crash the program. · Code has bugs that allow arbitrary code execution. · Code relies on dependencies with bugs. · Code handles fonts and images that are essentially small programs. · WebKit2 is a pragmatic response 7/29
  • 8. Why WebKit2? · · · · The web platform is huge Make crashes less inconvenient for users Prevent bugs and crashes from exposing user data Prevent bugs and crashes from damaging the system or executing arbitrary code · Stop web applications from blocking each other 8/29
  • 9. WebKit2 · Give the web rendering parts of WebKit their own process · Page crashes don't crash the browser · Can put vulnerable data into a separate address space · Sandbox web rendering · Prevent pages from accessing the disk and operating system interface 9/29
  • 12. IPC · IPC glues the different processes together · Three types of IPC in use in Webkit - Messaging: Unix domain socket for sending messages synchronously or asynchronously - Shared memory: shmem for passing large messages and bitmaps - Shared surfaces: XComposite/XDamage for passing hardware accelerated surfaces cheaply 12/29
  • 13. Accelerated Compositing · WebKit has its own hardware-accelerated scene graph of page content - Prevent unnecessary redraw - 3D CSS transforms - WebGL · Scene graph is in the WebProcess, but drawing happens in the UIProcess · XComposite/XDamage allows compositing and final paint in different processes 13/29
  • 15. Should I port my application to WebKit2? Yes
  • 16. Why Port? · WebKit1 development has moved to maintenance mode · WebKit1 will be deprecated in the future · The WebKit2GTK+ API is richer and better tested · Porting to WebKit2 brings immediate performance, security, and stability benefits 16/29
  • 17. Porting Challenges · There is not yet a porting guide - Extensive API documentation · Many synchronous APIs with return values are now asynchronous void webkit_web_view_save (WebKitWebView *web_view, WebKitSaveMode save_mode, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); C · Two-way communication from the page is more complicated - Injected script source - Custom protocols - GObject DOM bindings - Page access via the JSC API 17/29
  • 18. Injected Script Source · Strings of JavaScript source code executed asynchronously in the WebProces · Can return a value which is serialized and sent across the IPC messaging channel 18/29
  • 19. Injected Script Source webkit_web_view_run_javascript (web_view, "window.document.body.textContent;", 0, run_javascript_finished_callback, NULL); static void run_javascript_finished_callback (GObject *source_object, GAsyncResult *result, gpointer user_data) { GError *error; WebKitJavaScriptResult *javascript_result = webkit_web_view_run_javascript_finish (WEBKIT_WEB_VIEW(source_object), result, &error); C C JSStringRef string_value = JSValueToStringCopy ( webkit_javascript_result_get_global_context (javascript_result), webkit_javascript_result_get_value (javascript_result), NULL); char *string = g_malloc (JSStringGetMaximumUTF8CStringSize (string_value)); JSStringGetUTF8CString (string_value, string, JSStringGetMaximumUTF8CStringSize (string_value)); printf ("result: %sn", string); ... } 19/29
  • 20. Custom Protocols · Page to WebKit communication by accessing a resourcess across a custom protocol · Example of this approach are about: pages · Communicate without reloading the page via AJAX · Subject to same-origin security restrictions 20/29
  • 21. Custom Protocols WebKitContext *context = webkit_web_context_get_default (); webkit_web_context_register_uri_scheme (context, "about", about_uri_scheme_request_cb, NULL, NULL); static void about_uri_scheme_request_cb (WebKitURISchemeRequest *request, gpointer user_data) { GInputStream *stream; const gchar *path; gchar *contents; C C path = webkit_uri_scheme_request_get_path (request); contents = g_strdup_printf ("Loaded about:%s page", path); stream = g_memory_input_stream_new_from_data (contents, strlen (contents), g_free); webkit_uri_scheme_request_finish (request, stream, stream_length, "text/html"); g_object_unref (stream); } 21/29
  • 22. Web Extensions · Web extensions are shared objects that execute in the WebProcess · No IPC penalties - Synchronous behavior does not block the UI - Direct access to page state including the DOM - Timing is less of an issue · Written on top of the port-independent WebKit InjectedBundle · No IPC API, but you can use DBus for communication with the UIProcess 22/29
  • 23. Web Extensions C void webkit_web_extension_initialize (WebKitWebExtension *extension) { printf ("Hello from a WebProcessn"); } $ gcc -c -Wall -Werror -fpic web-extension.c $ gcc -shared -o web-extension.so web-extension.o SHELL webkit_web_context_set_web_extensions_directory (webkit_web_context_get_default (), "/path/to/shared-object"); C 23/29
  • 24. GObject DOM Bindings via Web Extensions · GObject DOM bindings allow accessing page DOM using GObject APIs · Cannot run in the UIProcess, the DOM is in a different address space · In WebKit2, these are only accessible via Web Extensions static void document_loaded_callback (WebKitWebPage *page, gpointer user_data) { printf ("title: %sn", webkit_dom_document_get_title (webkit_web_page_get_dom_document (page))); } C static void page_created_callback (WebKitWebExtension *extension, WebKitWebPage *page, gpointer user_data) { g_signal_connect (page, "document-loaded", G_CALLBACK(document_loaded_callback), 0); } void webkit_web_extension_initialize (WebKitWebExtension *extension) { g_signal_connect (extension, "page-created", G_CALLBACK(page_created_callback), NULL); } 24/29
  • 25. Injected JavaScript via Web Extensions · Similar to the GObject DOM bindings approach · Instead of using the GObject API, use the JSC C API · Can interact with the page as well as insert JavaScript objects backed by native code · The most flexible approach · Necessary Web Extension API should appear soon in a future release 25/29
  • 28. WebKit2 · Multiple WebProcesses - Isolate applications from each other as well as from the UI - Prevents crash from crashing every tab · Networking Process - Necessary for multiple web processes - Avoids complexity of caches/databases with multiple writers · Offline Storage Process · Disk access blocking and insecure · More easily sandbox WebProcesses 28/29