Gibraltar: Exposing Hardware Devices to Web Pages Using AJAX

  • Kaisen Lin ,
  • David Chu ,
  • James Mickens ,
  • Li Zhuang ,
  • Feng Zhao ,
  • Jian Qui

Proceedings of WebApps |

Published by USENIX

Gibraltar is a new framework for exposing hardware devices to web pages. Gibraltar’s fundamental insight is that JavaScript’s AJAX facility can be used as a hardware access protocol. Instead of relying on the browser to mediate device interactions, Gibraltar sandboxes the browser and uses a small device server to handle hardware requests. The server uses native code to interact with devices and exports a standard web server interface on the localhost. To access hardware, web pages send device commands to the server using HTTP requests; the server returns the data using HTTP responses.

Using a client-side JavaScript library, we build a simple yet powerful device API atop an HTTP transfer protocol. This API is particularly useful to developers of mobile web pages, since mobile platforms like cell phones have an increasingly wide array of sensors that, prior to Gibraltar, were only accessible via native code plugins or the limited, inconsistent APIs provided by HTML5. Our implementation of Gibraltar on Android shows that Gibraltar provides stronger security guarantees than HTML5; furthermore, it shows that HTTP is responsive enough to support interactive web pages that perform frequent hardware accesses. Gibraltar can also support an HTML5 compatibility layer that implements the HTML5 interface but provides Gibraltar’s stronger security.