1 of 92

A Short Tour of

Fission's

Architecture

June 20, 2019

2 of 92

Pre-electrolysis

Single Process

Runs everything

3 of 92

Electrolysis

Parent Process

Runs browser code

Content Process

Runs all web content

4 of 92

Electrolysis-multi

Parent Process

Runs browser code

Content Processes

Run individual "tabs"

5 of 92

Electrolysis-multi

6 of 92

Fission

Parent Process

Runs browser code

Content Processes

Run individual "sites"

7 of 92

Fission

8 of 92

Fission

Architecture

Designing for Fission

01.

Browsing Context

02.

Navigation

03.

Embedding

04.

9 of 92

Fission

Architecture

Designing for Fission

01.

Browsing Context

02.

Navigation

03.

Embedding

04.

10 of 92

Browsing Contexts

"Container" for documents

Instance exists in every "relevant process"

"Cross-process nsDocShell"

Parent process has extra info on CanonicalBrowsingContext

11 of 92

Tree Syncing

Browsing

Context

Browsing Context

Canonical Browsing Context

Canonical

Browsing Context

Canonical

Browsing Context

Browsing

Context

Browsing

Context

Browsing Context

Browsing

Context

12 of 92

interface BrowsingContext

BrowsingContext? parent;

BrowsingContext top;

BrowsingContext? opener;

array<BrowsingContext> getChildren();

nsIDocShell? docShell; // embedded

Element? embedderElement; // embedder

13 of 92

Synced Fields

docshell/base/BrowsingContextFieldList.h

14 of 92

Browsing Context Groups

https://news.com/

https://videos.com/

social.com

video.com

Document

Toplevel Browsing Context

Nested Browsing Context

Browsing Context Group

15 of 92

Browsing Context Groups

https://news.com/

https://videos.com/

social.com

video.com

https://social.com/

https://social.com/

video.com

news.com

opener

16 of 92

Fission

Architecture

01.

Browsing Context

02.

Navigation

03.

Embedding

04.

Designing for Fission

17 of 92

Navigation

DocShell

Browsing Context

Document

Window

Document

Window

Document

Window

Document

Window

DocShell

Navigate

Navigate

X-Origin Navigate

18 of 92

Window Global Actors

Canonical Browsing Context

PWindowGlobal Parent ↔ Child

Inner Window

DocShell

WGP

WGC

Window

WGP

WGC

Window

DocShell

WGP

WGC

Window

DocShell

WGP

WGC

Window

WGP

WGC

Window

19 of 92

Window Global Actors

Canonical Browsing Context

PWindowGlobal Parent ↔ Child

Inner Window

DocShell

WGP

WGC

Window

WGP

WGC

Window

DocShell

WGP

WGC

Window

DocShell

WGP

WGC

Window

WGP

WGC

Window

  • Actor Replaced on Navigation
  • 1:1 with nsGlobalWindowInner
  • Bridges from Parent ↔ Inner Window
  • Exists for in-parent globals too!

20 of 92

interface WindowGlobalParent

BrowsingContext? browsingContext;

uint64_t innerWindowId;

uint64_t outerWindowId;

nsIPrincipal documentPrincipal;

nsIURI? documentURI;

JSWindowActor? getActor(DOMString name);

21 of 92

JSWindowActors

ChromeUtils.registerWindowActor("Actor", {

parent: { moduleURI: "/ActorParent.jsm" },

child: {

moduleURI: "/ActorChild.jsm",

events: { "EventSomething": {…}, … },

},

allFrames: true,

});

22 of 92

JSWindowActors

class ActorParent extends JSWindowActorParent {

async receiveMessage(msg) {

// …

await this.sendQuery("withreply", …);

this.sendAsyncMessage("noreply", …);

return this.browsingContext.stuff;

}

handleEvent(evt) { … }

};

23 of 92

Fission

Architecture

01.

Browsing Context

02.

Navigation

03.

Embedding

04.

Designing for Fission

24 of 92

It's Always Trees

news.com

video.com

social.com

video.com

Tabbed Browser UI

other tab

other tab

25 of 92

It's Always Trees

news.com

video.com

social.com

video.com

Tabbed Browser UI

other tab

other tab

Browser

In-Process

Fission

26 of 92

In-Process Embedding

nsFrameLoader

nsDocShell

27 of 92

Browser Embedding

BrowserChild

nsDocShell

nsFrameLoader

BrowserParent

28 of 92

Fission Embedding

BrowserBridgeChild

nsFrameLoader

BrowserChild

nsDocShell

BrowserBridgeParent

BrowserParent

29 of 92

Fission

Architecture

01.

Browsing Context

02.

Navigation

03.

Embedding

04.

Designing for Fission

30 of 92

Avoid Process-Local Objects

Methods like GetParentDocument() and GetTopWindow() can't work with Fission!

Prefer using BrowsingContext's GetParent(), Top(), and Children() APIs when possible.

  • Top DocShell => Top Browsing Context
  • Top Document => Top WindowGlobalParent

* Renaming Soon! - Bug 1559414

31 of 92

Fine-grained Actors

A tab can have many PBrowsers

  • Don't expect 1:1 PBrowser ↔ <xul:browser>

Use PWindowGlobal for per-window msgs

  • It even works for documents loaded in-parent!

Use JSWindowActors instead of FrameScripts

  • FrameScripts won't load in subframes

32 of 92

Small Children

Only use resources when they're needed!

  • We're going to have a lot of content processes!

Move responsibility to the Parent

  • Some state will only be there!

33 of 92

Build Tests for Fission

await SpecialPowers.spawn(

window, [a, b, c],

async (a, b, c) => {

return content.document.whatever;

});

* Coming Soon! - Bug 1532795

34 of 92

What's Been Done?

35 of 92

8.5 MB

4.1 MB

JavaScript

Q2 2018

Q3 2019

51%

36 of 92

21.5 MB

14.8 MB

Windows

Q2 2018

Q3 2019

43%

37 of 92

34.3 MB

19.5 MB

Linux

Q2 2018

Q3 2019

31%

38 of 92

32.7 MB

24.6 MB

macOS

Q2 2018

Q3 2019

25%

39 of 92

fission.autostart

40 of 92

Demo

41 of 92

Thank You!

42 of 92

43 of 92

44 of 92

15 Origins!

45 of 92

Embedding Trees

news.com

video.com

social.com

video.com

Tabbed Browser UI

other tab

other tab

46 of 92

Embedder Embedded Links

Embedder (iframe/browser)

Embedded (nsDocShell)

In-Process

Subframe

Browser

47 of 92

Embedding Trees

news.com

video.com

social.com

video.com

Tabbed Browser UI

other tab

other tab

Browser

In-Process

Subframe

48 of 92

Subframe Edges

Embedder Process

<iframe>

nsFrameLoader

BrowserBridge{Child,Parent}

Parent Process

Browser{Parent,Child}

Embedded Process

nsDocShell

New!

49 of 92

Takeaways

PBrowserBridge embeds oop iframes

Multiple PBrowser actors per tab

Subframes can be in a different process than their embedder

"Top Window" & "Root DocShell" should be replaced with "Top BrowsingContext"

50 of 92

Navigation

"Embedding Link"

DocShell

BrowsingContext

Frame Element

All Relevant Processes

Document

Window

Document

Window

Document

Window

Document

Window

DocShell

Load

Load

X-Origin Load

<iframe> / <xul:browser>

nsFrameLoader, PBrowser, etc.

JS Global

Document Loader

"Embed. Link"

51 of 92

Navigation

"Embedding Link"

DocShell

BrowsingContext

Frame Element

All Relevant Processes

Document

Window

Document

Window

Document

Window

Document

Window

DocShell

Load

Load

X-Origin Load

<iframe> / <xul:browser>

nsFrameLoader, PBrowser, etc.

JS Global

Document Loader

"Embed. Link"

52 of 92

Split Trees

social.com

video.com

news.com

social.com

video.com

social.com

video.com

news.com

53 of 92

Unfortunately, <iframe>

https://news.com/

https://videos.com/

social.com

video.com

https://social.com/

https://social.com/

video.com

news.com

54 of 92

Fission

55 of 92

56 of 92

General tips

Please try and keep amount of single slide content as low as possible. Use speaker notes vs reading from slide.

Showing and speaking to key points works well. Expand on points using speaker notes, avoiding wordy slides.

Limit bullet usage.

57 of 92

Presentation Accessibility Guidelines

58 of 92

Accessibility - Themes

When in doubt, use the theme as designed as it has been created based on accessibility guidelines.

(right click image, ‘Apply layout’)

59 of 92

Accessibility - Typography

Headlines

Body copy

36pt, Zilla Slab Semi Bold

24pt, Open Sans Normal

No smaller than 36pt for headlines.

Body copy for important information should not drop below 24pt.

Avoid ALLCAPS.

60 of 92

Accessibility - Color

Do not only use colour to convey essential information. This won’t be accessible to people who are colour blind.

If you use colours, choose a good high contrast between text and background and avoid pale colours on coloured backgrounds.

61 of 92

Accessibility - Color grades

Color combo grades with white or black text. Please try and use these passing combos at all times.

AA Large

AAA Large

Fails

AAA

AA Large

AAA Large

AAA

AA Large

AAA

AAA

62 of 92

Accessibility - Imagery

Add alternative text to describe images and graphs so that people with visual impairments know what they are.

(right click image, ‘Alt text…’)

63 of 92

Example Usage

64 of 92

Example Agenda

01.

Topic title

02.

Topic title

03.

Topic title

04.

Topic title

65 of 92

Fruitcake topping gummies. Icing brownie jelly-o toffee cookie lemon drops. Carrot cake pastry icing marshmallow cake muffin.

66 of 92

67 of 92

68 of 92

69 of 92

Bold

70 of 92

One line

71 of 92

Impact

72 of 92

Example Agenda

01.

Topic title

02.

Topic title

03.

Topic title

04.

Topic title

73 of 92

Fruitcake topping gummies. Icing brownie jelly-o toffee cookie lemon drops. Carrot cake pastry icing marshmallow cake muffin.

Fruitcake topping gummies. Icing brownie jelly-o toffee cookie lemon drops. Carrot cake pastry icing marshmallow cake muffin.

74 of 92

75 of 92

Example

76 of 92

Example

77 of 92

Example

78 of 92

79 of 92

80 of 92

81 of 92

82 of 92

83 of 92

84 of 92

85 of 92

86 of 92

87 of 92

88 of 92

Venue

Location

89 of 92

90 of 92

91 of 92

92 of 92