Labs/Jetpack/Reboot/JEP/108

From MozillaWiki
< Labs‎ | Jetpack‎ | Reboot‎ | JEP
Jump to navigation Jump to search

JEP 108 - Background Pages

  • Champion: Daniel Buchner - daniel@mozilla.com
  • Status: Accepted/In-Queue
  • Bug Ticket:
  • Type: API


Proposal

Background Pages are like a more open and free sandbox for doing most anything in a traditional web page with a DOM context, but with a key difference: the page is augmented with escalated, waterfall chrome privileges. It is essentially along the same line of a Web Worker, just more open and accessible.

Key Issues

Dependencies & Requirements

  • We must be able to give the code in the top window of this page chrome privileges that are strictly one-way/descending in nature.
  • Dynamically generated code sent to the Background Page should be injected and executed in the Background Page's window context.


Internal Methods

  • TBD


API Methods

$Moz.background({ interval: 10000, bind:jetpack.tabs[0] }, function(){
    return window.document;
});
  • Background Page work units are bound with the Background Page's window object by default
  • If interval option is present, the function is wrapped with setInterval(); and the $Moz.background method returns the interval timer so that it may be cleared outside of the Background Page.
  • Functional context for the function passed to the background page can be passed as an option