SlideShare a Scribd company logo
1 of 39
Download to read offline
MunichJS: 2011-04-06
  Mike West (mkwst@google.com)
Hi. I'm Mike.
      You can email me at
mkwst@google.com, follow me on
 Twitter @mikewest, or visit my
 outdated blog at mikewest.org.
Two topics:
IndexedDB (which is awesome).
Chromium extension goodness.
IndexedDB
Uxebu are awesome.
 I'm thrilled that they're writing
abstraction layers. Seriously, this
  rocks. If you haven't read the
            article, do.
“But how is this better
    than localStorage? It
            isn't.”

I'm less thrilled that they're wrong.
My thesis: IndexedDB, or
  something like it, is the way
          forward.
 Yes, it's complex, and the API
could be better, but we're adults
         here. We'll deal.
Why IndexedDB?
A short intro to Chromium
         internals.
Chromium splits the world into one
    trusted browser and many
       untrusted renderers.
Browser
 All I/O goes through the browser;
  it's the only piece of Chromium
that can make system calls, access
 files or DBs, and display output to
               the user.
Sandboxed Renderers
Renderers run in processes with as
 few permissions as possible, and
   only have I/O access via IPC
messages to the browser's process.
I/O is a bottleneck
 There's only one I/O messaging
   thread on each renderer; it's
critical not to block while waiting
          for a response.
Asynchronous APIs!
   The additional conceptual
complexity aside, they allow you to
 smoothly continue responding to
        user interactions.
With that in mind...
    What's wrong with this code?

var x = JSON.stringify( complexObject );
window.localStorage['x'] = x;
window.localStorage['anotherX'] = x;
Problem 1: localStorage requires
 objects be flattened via stringify,
       called synchronously in
             user-space.

var x = JSON.stringify( complexObject );
window.localStorage['x'] = x;
window.localStorage['anotherX'] = x;
IndexedDB stores
 unserialized objects
  As far as your (single-threaded)
 JavaScript process is concerned,
you'll never block while processing
               JSON.
Problem 2: localStorage itself is
   synchronous, which means the
 assignment blocks while the write
  goes through to the file system.

var x = JSON.stringify( complexObject );
window.localStorage['x'] = x;
window.localStorage['anotherX'] = x;
IndexedDB is
    asynchronous.
db.transaction(store, READ_WRITE).
    objectStore(store).
    put({ ... }).
    addEventListener(
        'onsuccess',
        function (e) { ... });
Problem 3: There's no mechanism
 to ensure that both assignments go
 through successfully, nor that they
   both apply to the same baseline.

var x = JSON.stringify( complexObject );
window.localStorage['x'] = x;
window.localStorage['anotherX'] = x;
Transactions & Locking
 db.transaction(store, READ_WRITE)…
 db.transaction(store, READ_ONLY)…
Chrome Privacy
“Chromium provides
 users full transparency
  and control over the
information managed by
     the browser.”

Our privacy team's mission
        statement.
The team approaches this task in a
 number of ways, notably in terms
      of new extension APIs.
WebNavigation Events
     onBeforeNavigate
     onBeforeRetarget
        onCommitted
        onCompleted
    onDOMContentLoaded
     onErrorOccurred
Done when they're
     done...
     WebRequest API
  ContentSettings API
 DevTools (WebInspector,
      Debugger, etc.)
 And more... goo.gl/Hy6Jy
Stay up to date
chromestatus.com and Last Week
      in Chromium/Webkit
    (goo.gl/XWEY3) are great
            resources.
HTML5Rocks.com is full of useful
 tutorials (and will be localized
             soonish).
Questions?
mkwst@google.com
   @mikewest

More Related Content

Viewers also liked

Intro to IndexedDB (Beta)
Intro to IndexedDB (Beta)Intro to IndexedDB (Beta)
Intro to IndexedDB (Beta)Mike West
 
Mitigate Maliciousness -- jQuery Europe 2013
Mitigate Maliciousness -- jQuery Europe 2013Mitigate Maliciousness -- jQuery Europe 2013
Mitigate Maliciousness -- jQuery Europe 2013Mike West
 
comparatives
comparativescomparatives
comparativeshome
 
2nd Conditional
2nd Conditional2nd Conditional
2nd Conditionalhome
 
Love The Terminal
Love The TerminalLove The Terminal
Love The TerminalMike West
 
Webquest Template0[1]
Webquest Template0[1]Webquest Template0[1]
Webquest Template0[1]guest21e82c
 

Viewers also liked (7)

Intro to IndexedDB (Beta)
Intro to IndexedDB (Beta)Intro to IndexedDB (Beta)
Intro to IndexedDB (Beta)
 
Mitigate Maliciousness -- jQuery Europe 2013
Mitigate Maliciousness -- jQuery Europe 2013Mitigate Maliciousness -- jQuery Europe 2013
Mitigate Maliciousness -- jQuery Europe 2013
 
comparatives
comparativescomparatives
comparatives
 
Indexed db
Indexed dbIndexed db
Indexed db
 
2nd Conditional
2nd Conditional2nd Conditional
2nd Conditional
 
Love The Terminal
Love The TerminalLove The Terminal
Love The Terminal
 
Webquest Template0[1]
Webquest Template0[1]Webquest Template0[1]
Webquest Template0[1]
 

Similar to MunichJS - 2011-04-06

Automated JavaScript Deobfuscation - PacSec 2007
Automated JavaScript Deobfuscation - PacSec 2007Automated JavaScript Deobfuscation - PacSec 2007
Automated JavaScript Deobfuscation - PacSec 2007Stephan Chenette
 
Sandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession LearnedSandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession LearnedMinded Security
 
The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010Mario Heiderich
 
Real World Single Page App - A Knockout Case Study
Real World Single Page App - A Knockout Case StudyReal World Single Page App - A Knockout Case Study
Real World Single Page App - A Knockout Case Studyhousecor
 
Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java ProgrammingKaty Allen
 
Thug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclientThug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclientAngelo Dell'Aera
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin Vasil Remeniuk
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS UniverseStefano Di Paola
 
Dojo - from web page to web apps
Dojo - from web page to web appsDojo - from web page to web apps
Dojo - from web page to web appsyoavrubin
 
Node.js Enterprise Middleware
Node.js Enterprise MiddlewareNode.js Enterprise Middleware
Node.js Enterprise MiddlewareBehrad Zari
 
JS Libraries and jQuery Overview
JS Libraries and jQuery OverviewJS Libraries and jQuery Overview
JS Libraries and jQuery OverviewAleksandr Motsjonov
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tourcacois
 
Douglas - Real JavaScript
Douglas - Real JavaScriptDouglas - Real JavaScript
Douglas - Real JavaScriptd0nn9n
 
Locking the Throneroom 2.0
Locking the Throneroom 2.0Locking the Throneroom 2.0
Locking the Throneroom 2.0Mario Heiderich
 
The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008Stephan Chenette
 
Microservice pitfalls
Microservice pitfalls Microservice pitfalls
Microservice pitfalls Mite Mitreski
 

Similar to MunichJS - 2011-04-06 (20)

Automated JavaScript Deobfuscation - PacSec 2007
Automated JavaScript Deobfuscation - PacSec 2007Automated JavaScript Deobfuscation - PacSec 2007
Automated JavaScript Deobfuscation - PacSec 2007
 
Sandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession LearnedSandboxing JS and HTML. A lession Learned
Sandboxing JS and HTML. A lession Learned
 
The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010The Future of Web Attacks - CONFidence 2010
The Future of Web Attacks - CONFidence 2010
 
Real World Single Page App - A Knockout Case Study
Real World Single Page App - A Knockout Case StudyReal World Single Page App - A Knockout Case Study
Real World Single Page App - A Knockout Case Study
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
Designing A Project Using Java Programming
Designing A Project Using Java ProgrammingDesigning A Project Using Java Programming
Designing A Project Using Java Programming
 
Thug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclientThug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclient
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe
 
Dojo - from web page to web apps
Dojo - from web page to web appsDojo - from web page to web apps
Dojo - from web page to web apps
 
All of javascript
All of javascriptAll of javascript
All of javascript
 
Node.js Enterprise Middleware
Node.js Enterprise MiddlewareNode.js Enterprise Middleware
Node.js Enterprise Middleware
 
JS Libraries and jQuery Overview
JS Libraries and jQuery OverviewJS Libraries and jQuery Overview
JS Libraries and jQuery Overview
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tour
 
HTML5
HTML5HTML5
HTML5
 
Douglas - Real JavaScript
Douglas - Real JavaScriptDouglas - Real JavaScript
Douglas - Real JavaScript
 
Locking the Throneroom 2.0
Locking the Throneroom 2.0Locking the Throneroom 2.0
Locking the Throneroom 2.0
 
The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008The Ultimate Deobfuscator - ToorCON San Diego 2008
The Ultimate Deobfuscator - ToorCON San Diego 2008
 
Microservice pitfalls
Microservice pitfalls Microservice pitfalls
Microservice pitfalls
 

Recently uploaded

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
🐬 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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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 Scriptwesley chun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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 CVKhem
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
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...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

MunichJS - 2011-04-06

  • 1. MunichJS: 2011-04-06 Mike West (mkwst@google.com)
  • 2. Hi. I'm Mike. You can email me at mkwst@google.com, follow me on Twitter @mikewest, or visit my outdated blog at mikewest.org.
  • 3. Two topics: IndexedDB (which is awesome). Chromium extension goodness.
  • 5.
  • 6. Uxebu are awesome. I'm thrilled that they're writing abstraction layers. Seriously, this rocks. If you haven't read the article, do.
  • 7. “But how is this better than localStorage? It isn't.” I'm less thrilled that they're wrong.
  • 8.
  • 9. My thesis: IndexedDB, or something like it, is the way forward. Yes, it's complex, and the API could be better, but we're adults here. We'll deal.
  • 10. Why IndexedDB? A short intro to Chromium internals.
  • 11.
  • 12. Chromium splits the world into one trusted browser and many untrusted renderers.
  • 13. Browser All I/O goes through the browser; it's the only piece of Chromium that can make system calls, access files or DBs, and display output to the user.
  • 14.
  • 15. Sandboxed Renderers Renderers run in processes with as few permissions as possible, and only have I/O access via IPC messages to the browser's process.
  • 16.
  • 17. I/O is a bottleneck There's only one I/O messaging thread on each renderer; it's critical not to block while waiting for a response.
  • 18.
  • 19. Asynchronous APIs! The additional conceptual complexity aside, they allow you to smoothly continue responding to user interactions.
  • 20. With that in mind... What's wrong with this code? var x = JSON.stringify( complexObject ); window.localStorage['x'] = x; window.localStorage['anotherX'] = x;
  • 21. Problem 1: localStorage requires objects be flattened via stringify, called synchronously in user-space. var x = JSON.stringify( complexObject ); window.localStorage['x'] = x; window.localStorage['anotherX'] = x;
  • 22. IndexedDB stores unserialized objects As far as your (single-threaded) JavaScript process is concerned, you'll never block while processing JSON.
  • 23. Problem 2: localStorage itself is synchronous, which means the assignment blocks while the write goes through to the file system. var x = JSON.stringify( complexObject ); window.localStorage['x'] = x; window.localStorage['anotherX'] = x;
  • 24. IndexedDB is asynchronous. db.transaction(store, READ_WRITE). objectStore(store). put({ ... }). addEventListener( 'onsuccess', function (e) { ... });
  • 25. Problem 3: There's no mechanism to ensure that both assignments go through successfully, nor that they both apply to the same baseline. var x = JSON.stringify( complexObject ); window.localStorage['x'] = x; window.localStorage['anotherX'] = x;
  • 26. Transactions & Locking db.transaction(store, READ_WRITE)… db.transaction(store, READ_ONLY)…
  • 27.
  • 29. “Chromium provides users full transparency and control over the information managed by the browser.” Our privacy team's mission statement.
  • 30. The team approaches this task in a number of ways, notably in terms of new extension APIs.
  • 31.
  • 32.
  • 33.
  • 34. WebNavigation Events onBeforeNavigate onBeforeRetarget onCommitted onCompleted onDOMContentLoaded onErrorOccurred
  • 35. Done when they're done... WebRequest API ContentSettings API DevTools (WebInspector, Debugger, etc.) And more... goo.gl/Hy6Jy
  • 36. Stay up to date chromestatus.com and Last Week in Chromium/Webkit (goo.gl/XWEY3) are great resources. HTML5Rocks.com is full of useful tutorials (and will be localized soonish).
  • 37.
  • 38.