SlideShare une entreprise Scribd logo
1  sur  65
Télécharger pour lire hors ligne
PRERENDERING
REVISIT
WARNING
LONG session.
Ask for a break whenever you want.
credit: http://www.quickmeme.com/meme/352t2a
RESOURCE HINTS
• dns-prefetch, preconnect, prefetch, prerender
Resource Hints Concept
credit: https://docs.google.com/presentation/d/18zlAdKAxnc51y_kj-6sWLmnjl6TLnaru_WH0LJTjP-o
Examples
https://www.w3.org/TR/resource-hints/
Prerender in Chromium
• Minimizing resource contention.
• Handling dynamic media [video,
audio, plugins, canvas]
• Cancellation of pages on certain
corner cases.
• Minimizing server side effects.
• Mutations to shared local storage
[cookies, sessionStorage, etc.]
Main concerns:
credit: https://www.chromium.org/developers/design-documents/prerender
Prerender Cancellation in Chromium
• The top-level page is not an HTTP/HTTPS scheme, either on the initial link or during any server-side or client-
side redirects. For example, both ftp are canceled. Content scripts are allowed to run on prerendered pages.
• window.opener would be non-null when the page is navigated to.
• A download is triggered. The download is cancelled before it starts.
• A request is issued which is not a GET, HEAD, POST, OPTIONS, or TRACE.
• A authentication prompt would appear.
• An SSL Client Certificate is requested and requires the user to select a certificate.
• A script tries to open a new window.
• alert() is called.
• window.print() is called.
• Any of the resources on the page are flagged by Safe Browsing as malware or phishing.
• The fragment on the page does not match the navigated-to location.
Monitoring Prerender in Chromium
XPFE
• from XUL elements to docshells
nsWebShellWindow
nsWebShellWindow
browser.xul
nsWebShellWindow
<tabbrowser/>
browser.xul
browser.xul
<tabbrowser/>
<browser/>
<browser/>
<browser/>
content.js
DocShell XPCOM Module
browser.js
…
browser/base/content/browser.xul
browser/base/content/tabbrowser.xml
toolkit/content/widgets/browser.xml
toolkit/content/widgets/remote-browser.xml
browser/base/content/global-scripts.inc
browser/base/content/browser.js
browser/base/content/content.js
major source files
Usually referred as “gBrowser”
Browser High-level Overview
browser.xul
<tabbrowser/>
<remote-browser/>
<remote-browser/>
<remote-browser/>
(content process)
browser-child.jsmessage manager
browser-child.jsmessage manager
message manager browser-child.js
content.js
browser.js
…
DocShell XPCOM Module DocShell XPCOM ModulePBrowser.ipdl
Browser High-level Overview (e10s)
DOCSHELL
• the scary evil thing
The Ancient
WebShell…
credit: http://www-archive.mozilla.org/projects/webshell/design.html
Redesign Plan
credits:

http://www.symphonyinc.co.jp/mozilla/mazmoz/mazmoz_e/mm_embed2.html
https://developer.mozilla.org/en-US/docs/Gecko/Embedding_Mozilla/API_overview
DocLoader & DocShell Tree
chrome / non-e10s process
Chrome or non-e10s Tree
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
do_GetService(“@mozilla.org/docloaderservice;1”)
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
chrome tree owner
content tree owner
chrome / non-e10s process
Chrome or non-e10s Tree
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
nsDocLoader
do_GetService(“@mozilla.org/docloaderservice;1”)
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
chrome tree owner
content tree owner
e10s content process
Content Tree in e10s
nsDocLoader
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
do_GetService(“@mozilla.org/docloaderservice;1”)
tab A tree owner
tab B tree owner
Modules Relationship
DOM
Layout
DocShell
Widget View
Presentation
Layer
Model Layer
Modules Relationship
(complex ver.)
LoadURI
LoadURI
LoadURI
RENDERING
• the very basic concept
Document Parsing Components
credit: http://www-archive.mozilla.org/newlayout/doc/
(slightly outdated)
Document Rendering Components
credit: http://www-archive.mozilla.org/newlayout/doc/
Rendering Data Flow
credit: http://www-archive.mozilla.org/newlayout/doc/
More on Layout & Rendering
Goto http://dbaron.org/talks/
SESSION HISTORY
• browsing context, session history and bfcache
Browsing context
A browsing context is an
environment in which Document
objects are presented to the user.
The docshell is the toplevel object
responsible for managing a single
browsing context.
credit: https://developer.mozilla.org/en-US/docs/Inner_and_outer_windows
Session History
The sequence of Documents in a
browsing context is its session
history.
Session history consists of a flat list
of session history entries.
Session history entry =
URL + state + title + Document +
form data + scroll position + …, etc.
interface History {
readonly attribute long length;
readonly attribute any state;
void go(optional long delta);
void back();
void forward();
void pushState(any data, DOMString title,
optional DOMString? url = null);
void replaceState(any data, DOMString title,
optional DOMString? url = null);
};
Session History
page1
Multi-level History Entries
page1 page2
frame1
page2
frame1
Multi-level History Entries
page1 page2
frame1
page2
frame1frame2
Multi-level History Entries
DOM WINDOW
• inner & outer
Window
/*sealed*/ interface Window : EventTarget {
// the current browsing context
[Unforgeable] readonly attribute WindowProxy window;
[Unforgeable] readonly attribute Document document;
readonly attribute History history;
// other browsing contexts
[Unforgeable] readonly attribute WindowProxy top;
[Replaceable] readonly attribute WindowProxy parent;
WindowProxy open(optional DOMString url = "about:blank", optional DOMString target = “_blank”,
[TreatNullAs=EmptyString] optional DOMString features = "", optional boolean replace = false);
getter WindowProxy (unsigned long index);
getter object (DOMString name);
// the user agent
readonly attribute Navigator navigator;
};
(Partial) Window IDL definition
WindowProxy
credit: http://d.hatena.ne.jp/cou929_la/20110310/1299767973
var w = window.open();
Split Window
In SpiderMonkey, a split object is made up of two JSObjects: an inner
object and an outer object.
The inner window object is different for each page a browser window
visits. It serves as the "globals" object and provides the JSPrincipals for
scripts on that page.
The outer window object is the object returned by window.open. It
represents the window or tab itself and survives as the user navigates
in that window or tab.
The inner window => HTML5 Window object.
The outer window => HTML5 WindowProxy object.
Nested Windows
credit: https://developer.mozilla.org/en-US/docs/Inner_and_outer_windows
Nested Windows
browsing context
credit: https://developer.mozilla.org/en-US/docs/Inner_and_outer_windows
Nested Windows
var w = window.self;
browsing context
credit: https://developer.mozilla.org/en-US/docs/Inner_and_outer_windows
Nested Windows
var w = window.self;
var w = window.parent;
var w = window.top;
browsing context
credit: https://developer.mozilla.org/en-US/docs/Inner_and_outer_windows
Inner / Outer Window
Was Ideal Plan
Inner / Outer Window
Was Ideal PlanNow
Inner / Outer Window
Was Ideal PlanNow
Inner / Outer Window
Was Ideal PlanNow
WebIDL Bindings
'Window': {
'nativeType': 'nsGlobalWindow',
'binaryNames': {
'postMessage': 'postMessageMoz',
},
},
'WindowProxy': {
'nativeType': 'nsPIDOMWindowOuter',
'headerFile': 'nsPIDOMWindow.h',
'concrete': False
},
dom/bindings/Bindings.conf
PRERENDER
gecko’s (ongoing) implementation
Swapping
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
XUL Doc
xul:browser
xul:browser
nsFrameLoader
nsFrameLoader
Swapping
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
nsDocShell
XUL Doc
xul:browser
xul:browser
nsFrameLoader
nsFrameLoader
Swapping DocShells vs. ContentViewers
Swapping DocShells
Swapping DocShells vs. ContentViewers
Swapping Viewers
Swapping DocShells vs. ContentViewers
• Swapping DocShells.
• The bfcache issue.
• Swapping ContentViewers.
• Almost impossible to prerender out-of-process.
Solutions?
• Connects multiple session histories.
• With pseudo history entries, or
• With mIndexOffset, mExtraLength
• How to update SessionStore?
• How to manage lifetime of grouped tabs?
• Other ways?
BONUS!
chromium process models
Process Models in Chromium
• Process-per-site-instance (*)
• Process-per-site
• Process-per-tab
• Single process
credit:
https://www.chromium.org/developers/design-documents/process-models
http://www.aosabook.org/en/posa/high-performance-networking-in-chrome.html
General Limitations
• Script-connected tabs (unit of related browsing contexts) are always in the
same process.

http://w3c.github.io/html/single-page.html#groupings-of-browsing-contexts
• Chromium only swaps renderer processes for browser-initiated cross-site
navigations, such as typing a URL in the location bar or following a
bookmark (unless using rel=noreferrer target=_blank).
• Subframes are currently rendered in the same process as their parent
page (OOPIF is ongoing).
• There is a limit to the number of renderer processes that Chromium will
create.
Out-of-Process iframes
(OOPIFs)
• Process-per-frame, or more
preciously unit of related similar-
origin browsing context.

http://w3c.github.io/html/single-page.html#units-of-
related-similar-origin-browsing-contexts
• Support more JS-IPC excluding
those need access to page
content.
• On the way to Site Isolation.

https://www.chromium.org/developers/design-
documents/site-isolation
credit: https://www.chromium.org/developers/design-documents/oop-iframes
Prerendering: Revisit

Contenu connexe

Tendances

Introduction To Dojo
Introduction To DojoIntroduction To Dojo
Introduction To Dojo
yoavrubin
 
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
Coulawrence
 

Tendances (15)

Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The When
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDB
 
Dot netnuke
Dot netnukeDot netnuke
Dot netnuke
 
Incremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend DevelopmentIncremental DOM and Recent Trend of Frontend Development
Incremental DOM and Recent Trend of Frontend Development
 
OpenCms Days 2014 - Nested containers in action
OpenCms Days 2014 - Nested containers in actionOpenCms Days 2014 - Nested containers in action
OpenCms Days 2014 - Nested containers in action
 
10 java script projects full source code
10 java script projects full source code10 java script projects full source code
10 java script projects full source code
 
Introduction To Dojo
Introduction To DojoIntroduction To Dojo
Introduction To Dojo
 
Building Dojo in the Cloud
Building Dojo in the CloudBuilding Dojo in the Cloud
Building Dojo in the Cloud
 
Zero To Dojo
Zero To DojoZero To Dojo
Zero To Dojo
 
Attractive HTML5~開発者の視点から~
Attractive HTML5~開発者の視点から~Attractive HTML5~開発者の視点から~
Attractive HTML5~開発者の視点から~
 
How do i Meet MongoDB
How do i Meet MongoDBHow do i Meet MongoDB
How do i Meet MongoDB
 
Drupal8 migrate
Drupal8 migrateDrupal8 migrate
Drupal8 migrate
 
Render Caching for Drupal 8
Render Caching for Drupal 8Render Caching for Drupal 8
Render Caching for Drupal 8
 
Multi-threaded CoreData Done Right
Multi-threaded CoreData Done RightMulti-threaded CoreData Done Right
Multi-threaded CoreData Done Right
 
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
TURN YOUR CELL PHONE FROM A LIABILITY INTO AN ASSET!
 

Similaire à Prerendering: Revisit

Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery Internals
Artur Cistov
 
Chrome Apps & Extensions
Chrome Apps & ExtensionsChrome Apps & Extensions
Chrome Apps & Extensions
Varun Raj
 
Open writing-cloud-collab
Open writing-cloud-collabOpen writing-cloud-collab
Open writing-cloud-collab
Karen Vuong
 
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
mfrancis
 
Web app and more
Web app and moreWeb app and more
Web app and more
faming su
 
Firefox Extension Development
Firefox Extension DevelopmentFirefox Extension Development
Firefox Extension Development
phamvanvung
 

Similaire à Prerendering: Revisit (20)

Mobile Browser Internal (Blink Rendering Engine)
Mobile Browser Internal (Blink Rendering Engine)Mobile Browser Internal (Blink Rendering Engine)
Mobile Browser Internal (Blink Rendering Engine)
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery Internals
 
Local storage
Local storageLocal storage
Local storage
 
Chrome Apps & Extensions
Chrome Apps & ExtensionsChrome Apps & Extensions
Chrome Apps & Extensions
 
Notes on SF W3Conf
Notes on SF W3ConfNotes on SF W3Conf
Notes on SF W3Conf
 
Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...
Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...
Open Writing! Collaborative Authoring for CloudStack Documentation by Jessica...
 
Open writing-cloud-collab
Open writing-cloud-collabOpen writing-cloud-collab
Open writing-cloud-collab
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal StackDecoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
Decoupling Drupal mit dem Lupus Nuxt.js Drupal Stack
 
JavaScript and BOM events
JavaScript and BOM eventsJavaScript and BOM events
JavaScript and BOM events
 
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Co...
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
Using Web Taxonomies in Drupal
Using Web Taxonomies in DrupalUsing Web Taxonomies in Drupal
Using Web Taxonomies in Drupal
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Introduction to WEB HTML, CSS
Introduction to WEB HTML, CSSIntroduction to WEB HTML, CSS
Introduction to WEB HTML, CSS
 
Firefox Extension Development
Firefox Extension DevelopmentFirefox Extension Development
Firefox Extension Development
 
Rutgers - History Intranet
Rutgers - History IntranetRutgers - History Intranet
Rutgers - History Intranet
 
ownCloud overview and tutorial
ownCloud overview and tutorialownCloud overview and tutorial
ownCloud overview and tutorial
 
Mongo performance tuning: tips and tricks
Mongo performance tuning: tips and tricksMongo performance tuning: tips and tricks
Mongo performance tuning: tips and tricks
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

Prerendering: Revisit