Web Sandbox Architecture: Pipeline

The Web Sandbox's Pipeline translates all of the required source references of a web component (gadget) into a safe version that can be executed by the client side Web Sandbox's virtual machine. An additional set of Pipeline features allows for:

The WebSandbox's Transformation Pipeline follows a general asynchronous execution pattern depicted in the diagram below:

Web Sandbox's Pipeline Flow

STEP 1: Fetching Source

This optional Pipeline step is performed if there are no layers above the “Process HTML Phase 1” that pass the raw HTML directly into the pipeline. This step simply fetches the resource specified through a Url and passes the returned Data as the raw HTML to the next step in the Pipeline. The Url will be used as the basis for the default Base Href in the next step of the Pipeline.

STEP 2: Process HTML Phase 1

This step is the entry point in scenarios where another source is converted or translated to HTML before it is passed to the pipeline. The parameters that are passed to this step in the pipeline are, the raw HTML, a Key value (a unique identifier of the Pipeline instance currently executed), Url from where the HTML originated (this can be left null if a Base Href is included in the raw HTML), and the actual implementation of a standard interface (IFetch) used to get all the external references. This step is broken down into few sub-steps:

STEP 3: Process HTML Phase 2

In this WebSandbox Pipeline step, the HTML Header is re-processed and the Body of the document extracted:

STEP 4: Convert to JSON Representation and Instrument (Crunch) JavaScript Code

This step translates all the data structures and markup into a form suitable for client side processing. There are a few sub-steps outlined in order below: