29.11.2012 Views

2nd USENIX Conference on Web Application Development ...

2nd USENIX Conference on Web Application Development ...

2nd USENIX Conference on Web Application Development ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Point (7): Composing layout The CSS layout algorithm<br />

describes how to transform the document tree (the<br />

c<strong>on</strong>tent model) into a tree of boxes of varying types, appearances<br />

and positi<strong>on</strong>s. Some boxes represent lines of<br />

text, while others represent checkboxes, for example. This<br />

transformati<strong>on</strong> is not obviously compositi<strong>on</strong>al: many<br />

CSS properties interact with each other in n<strong>on</strong>-trivial<br />

ways to determine precisely which types of boxes to c<strong>on</strong>struct.<br />

Rather than hard-code the interacti<strong>on</strong>s, the layout<br />

transformati<strong>on</strong> must become table-driven as well. Then<br />

both types of extensi<strong>on</strong> above become easy: extensi<strong>on</strong>s<br />

can create new box subtypes, and patch entries in the<br />

transformati<strong>on</strong> table to indicate when to create them.<br />

4 Evaluati<strong>on</strong><br />

The C3 platform is rapidly evolving, and <strong>on</strong>ly a few extensi<strong>on</strong>s<br />

have yet been written. To evaluate our platform,<br />

we examine: the performance of our extensi<strong>on</strong> points,<br />

ensuring that the benefits are not outweighed by huge<br />

overheads; the expressiveness, both in the ease of “porting”<br />

existing extensi<strong>on</strong>s to our model and in comparis<strong>on</strong><br />

to other browsers’ models; and the security implicati<strong>on</strong>s<br />

of providing such pervasive customizati<strong>on</strong>s.<br />

4.1 Performance<br />

Any time spent running the extensi<strong>on</strong> manager or c<strong>on</strong>flict<br />

analyses slows down the perceived performance of the<br />

browser. Fortunately, this process is very cheap: with <strong>on</strong>e<br />

extensi<strong>on</strong> of each supported type, it costs roughly 100ms<br />

to run the extensi<strong>on</strong>s. This time includes: enumerating all<br />

extensi<strong>on</strong>s (27ms), loading all extensi<strong>on</strong>s (4ms), and detecting<br />

parser-tag c<strong>on</strong>flicts (3ms), mutator c<strong>on</strong>flicts (2ms),<br />

and overlay c<strong>on</strong>flicts (72ms). All but the last of these<br />

tasks runs just <strong>on</strong>ce, at browser startup; overlay c<strong>on</strong>flict<br />

detecti<strong>on</strong> must run per-page. Enumerating all extensi<strong>on</strong>s<br />

currently reads a directory, and so scales linearly with<br />

the number of extensi<strong>on</strong>s. Parser and mutator c<strong>on</strong>flict<br />

detecti<strong>on</strong> scale linearly with the number of extensi<strong>on</strong>s<br />

as well; overlay c<strong>on</strong>flict detecti<strong>on</strong> is more expensive as<br />

each overlay provides more interacting c<strong>on</strong>straints than<br />

other types of extensi<strong>on</strong>s do. If necessary, these costs<br />

can be amortized further by caching the results of c<strong>on</strong>flict<br />

detecti<strong>on</strong> between browser executi<strong>on</strong>s.<br />

4.2 Expressiveness<br />

Figure 6 lists several examples of extensi<strong>on</strong>s available<br />

for IE, Chrome, and Firefox, and the corresp<strong>on</strong>ding C3<br />

extensi<strong>on</strong> points they would use if ported to C3. Many of<br />

these extensi<strong>on</strong>s simply overlay the browser’s user interface<br />

and require no additi<strong>on</strong>al support from the browser.<br />

Some, such as Smooth Gestures or LastTab, add or revise<br />

10<br />

UI functi<strong>on</strong>ality. As our UI is entirely script-driven, we<br />

support these via script extensi<strong>on</strong>s. Others, such as the<br />

various Native Client libraries, are sandboxed programs<br />

that are then exposed through JS objects; we support the<br />

JS objects and .Net provides the sandboxing.<br />

Figure 6 also shows some research projects that are not<br />

implementable as extensi<strong>on</strong>s in any other browser except<br />

C3. As described below, these projects extend the HTML<br />

language, CSS layout, and JS envir<strong>on</strong>ment to achieve<br />

their functi<strong>on</strong>ality. Implementing these <strong>on</strong> C3 requires<br />

no hacking of C3 , leading to a much lower learning<br />

curve and fewer implementati<strong>on</strong> pitfalls than modifying<br />

existing browsers. We examine some examples, and how<br />

they might look in C3, in more detail here.<br />

4.2.1 XML3D: Extending HTML, CSS and layout<br />

XML3D [14] is a recent project aiming to provide<br />

3D scenes and real-time ray-traced graphics for web<br />

pages, in a declarative form analogous to 〈svg/〉 for twodimensi<strong>on</strong>al<br />

c<strong>on</strong>tent. This work uses XML namespaces to<br />

define new scene-descripti<strong>on</strong> tags and requires modifying<br />

each browser to recognize them and c<strong>on</strong>struct specialized<br />

DOM nodes accordingly. To style the scenes, this<br />

work must modify the CSS engine to recognize new style<br />

attributes. Scripting the scenes and making them interactive<br />

requires c<strong>on</strong>structing JS objects that expose the<br />

customized properties of the new DOM nodes. It also<br />

entails informing the browser of a new scripting language<br />

(AnySL) tailored to animating 3D scenes.<br />

Instead of modifying the browser to recognize new tag<br />

names, we can use the new-tag extensi<strong>on</strong> point to define<br />

them in an extensi<strong>on</strong>, and provide a subclassed 〈script/〉<br />

implementati<strong>on</strong> recognizing AnySL. Similarly, we can<br />

provide new CSS values and new box subclasses for<br />

layout to use. The full XML3D extensi<strong>on</strong> would c<strong>on</strong>sist<br />

of these four extensi<strong>on</strong> hooks and the ray-tracer engine.<br />

4.2.2 Maverick: Extensi<strong>on</strong>s to the global scope<br />

Maverick [12] aims to c<strong>on</strong>nect devices such as webcams<br />

or USB keys to web c<strong>on</strong>tent, by writing device drivers in<br />

JS and c<strong>on</strong>necting them to the devices via Native Client<br />

(NaCl) [17]. NaCl exposes a socket-like interface to web<br />

JS over which all interacti<strong>on</strong>s with native modules are<br />

multiplexed. To expose its API to JS, Maverick injects an<br />

actual DOM 〈embed/〉 node into the document, stashing<br />

state within it, and using JS properties <strong>on</strong> that object to<br />

communicate with NaCl. This object can then transliterate<br />

the image frames from the webcam into Base64-encoded<br />

src URLs for other scripts’ use in 〈img/〉 tags, and so<br />

reuse the browser’s image decoding libraries.<br />

There are two main annoyances with Maverick’s implementati<strong>on</strong><br />

that could be avoided in C3. First, NaCl<br />

70 <strong>Web</strong>Apps ’11: <str<strong>on</strong>g>2nd</str<strong>on</strong>g> <str<strong>on</strong>g>USENIX</str<strong>on</strong>g> <str<strong>on</strong>g>C<strong>on</strong>ference</str<strong>on</strong>g> <strong>on</strong> <strong>Web</strong> Applicati<strong>on</strong> <strong>Development</strong> <str<strong>on</strong>g>USENIX</str<strong>on</strong>g> Associati<strong>on</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!