Labs/Jetpack/Reboot/JEP/108: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1: Line 1:
== JEP 108 - Background Page ==
== JEP 108 - DOM Worker ==


* Champion: Daniel Buchner - daniel@mozilla.com
* Champion: Daniel Buchner - daniel@mozilla.com
Line 8: Line 8:


=== Proposal ===
=== 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.
DOM Worker is like a more open 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.


=== Use-Cases ===
=== Use-Cases ===
Line 19: Line 19:
=== Dependencies & Requirements ===
=== 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.
* 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.
* Dynamically generated code sent to the DOM Worker should be injected and executed in the DOM Worker's window context.




Line 27: Line 27:
== API Methods ==
== API Methods ==


==== Background Page Global: <i>$dom</i> ====
==== DOM Worker Global: <i>$dom</i> ====


==== Background Page Method: <i>run</i> ====
==== DOM Worker Method: <i>run</i> ====
<b>Description:</b>
<b>Description:</b>


Line 41: Line 41:
#* timeout: (<i>number</i>) a number that is used to set the timeout duration
#* timeout: (<i>number</i>) a number that is used to set the timeout duration
#* interval: (<i>number</i>)  a number that is used to set the interval duration
#* interval: (<i>number</i>)  a number that is used to set the interval duration
#<b><i>action</i></b> - (<i>function</i>) a function to be executed within the DOM of the Background Page - by default, the Background Page's window object is the bound 'this' within the function
#<b><i>action</i></b> - (<i>function</i>) a function to be executed within the DOM of the DOM Worker - by default, the DOM Worker's window object is the bound 'this' within the function


<b>Returns:</b>
<b>Returns:</b>
Line 64: Line 64:
</pre>
</pre>


==== Background Page Method: <i>empty</i> ====
==== DOM Worker Method: <i>empty</i> ====
<b>Description:</b>
<b>Description:</b>


Line 75: Line 75:
<b>Returns:</b>
<b>Returns:</b>


The Background Page Global object: <i>$dom</i>
The DOM Worker Global object: <i>$dom</i>


<b>Examples:</b>
<b>Examples:</b>
Line 83: Line 83:
</pre>
</pre>


==== Background Page Method: <i>reset</i> ====
==== DOM Worker Method: <i>reset</i> ====
<b>Description:</b>
<b>Description:</b>


Line 94: Line 94:
<b>Returns:</b>
<b>Returns:</b>


The Background Page Global object: <i>$dom</i>
The DOM Worker Global object: <i>$dom</i>


<b>Examples:</b>
<b>Examples:</b>
1,273

edits