wiki.webvm.net/ gears

Default mobile Plugins

Difference between webvm and Gears APIs

Gears maintains a centralised list of APIs, that utilised via a Gears.factory.

WebVM hopes to differentiate here by allowing 3rd parties to become API vendors.

Aplix WebVM developers want to spend less time writing APIs and more time focussing on the plugin and difficult security bindings. It’s very difficult to compete with the quality of Gears project APIs, so instead we encourage you to develop the APIs instead with the SDK.

Although Gears is an opensource project, their barrier to contribution to gears-eng is actually quite high.

Say as example.com you have a particular API you need for your product to function. You could write your own NPAPI and ActiveX plugin (for IE), however:

  1. Writing an NPAPI or ActiveX plugin is very difficult
  2. How do you get it installed on millions of mobile devices? (deployment!)
  3. Oh, you also need to write some security functionality to appease stakeholders like operators

With WebVM’s ‘dynamically loaded’ native C and Java interfaces:

  1. Writing a browser plugin with webvm.h is much easier (a fraction of the cost)
  2. Deployment happens dynamically by URL e.g. webvm.load("http://example.com/yourAPI")
  3. You leverage our security model

Since Gears is BSD licensed you could port their C++ code to WebVM as C (or Java) APIs. For e.g. Gears Camera API could be loaded like:

`webvm.load("http://example.com/gears/camera")`

WebVM also differs from Gears with a:

Gears recently has JNI support with Android.

More about Gears

Note as of June 2008, it’s Gears not google-gears.

NPAPI support currently is still not there. I am interested on how they package up the plugin with Localized.r and that other crap seemingly required by Darwin.

Security permissions

Drafted for 0.3 in their API history.

Factory API:

boolean getPermission([siteName], [imageUrl], [extraMessage])

Security dialogs or dialogues

Google gears security dialog

Tools -> Google gear settings

Older:

Security dialog for Google Gears

Gears as a Web testing framework

npsimple in Gear's test harness

Trouble with tests like sunspider that use Javascript to sequentially load in tests (as HTML files in their own right) is that can be difficult to catch errors with onerror.

The Sunspider test driver works well as the tests are performance tests that are known to work. If the test fails and Javascript stops executing, you could have a simple workaround with a button onclick to proceed to the next test. There is also several very elaborate inter-frame communication and fragile mechanisms (heartbeat) you can use.

live dom viewer works well, though I am not sure how to modify for individual tests.

Gears test seems to workaround this by using in their harness their own inbuilt httprequest & timer functions.

Converting Google’s test framework to npsimple involved:

foo_tests.js looks like:

function testFoo() {
  assertEqual(42, foo.scriptSimple());
}

The published JSON results look like:

{"gears_info":"0.4.20.0;official;opt;linux;firefox","browser_info":"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071618 Iceweasel/3.0.1 (Debian-3.0.1-1)","url":"http://gears.webvm.net/test.cgi","results":[{"suitename":"Basic","filename":"../webvmcases/foo_tests.js","results":{"testFooToo":{"status":"passed","elapsed":0},"testFoo":{"status":"passed","elapsed":0}},"elapsed":0.13899993896484375}]}