Friday, April 26, 2013

Alternative UIWebView to Objective-C communication paths

WebViewJavascriptBridge (and similar libraries) rely on loading a custom URL scheme in an iframe and intercepting the request in shouldStartLoadWithRequest. Other approaches include embedded WebSockets and HTTP servers (see LinkedIn.

One alternative to consider is modifying document.cookie for some magic cookie name value, and then listening for those changes on the iOS side via NSHTTPCookieManagerCookiesChangedNotification. That might have fewer side-effects that triggering a (sub-)frame load.

Thursday, April 25, 2013

Tuneup JS

Tune-up is a collection of JavaScript utilities that builds upon and improves the UIAutomation library provided by Apple for testing iOS applications via Instruments. While the JavaScript library provided by Apple is fairly complete and robust, it is a bit wordy and repetitive at times. This project aims to reduce as much pain as possible when writing UI tests by enhancing the existing API. It also provides some basic structure for your tests in a manner familiar to most testers.

Tuesday, April 23, 2013

JavaScript Madness: Keyboard Events

Summarizes the results of some browser tests done while attempting to implement key stroke handling code in JavaScript. It documents inconsistencies in the way different browsers implement keyboard events.

Friday, April 19, 2013

Thursday, April 18, 2013

iOS WebKit modifications

Apple does code dumps on their open source releases site. For iOS, this contains WebCore and JavaScriptCore (because of LGPL), but not WebKit (BSD).

iOS 6.1 seems to track the open source WebKit repository up to r116247. You can diff Apple's code against the open source repo at that revision to see what is different in iOS.


Plugin that makes it easier to run Xcode without the main toolbar. It adds keyboard shortcuts for selecting the active scheme and device (Ctrl+7 / Ctrl + 8), and a compact popup menu in the window title bar that shows the currently selected run configuration.

Wednesday, April 17, 2013


FastClick is a simple, easy-to-use library for eliminating the 300ms delay between a physical tap and the firing of a click event on mobile browsers. The aim is to make your application feel less laggy and more responsive while avoiding any interference with your current logic.

See also Google's fast buttons article. Though it may not be necessary anymore, at least on Android (stock browser doesn't do a delay for fixed viewport sites since Gingerbread, and neither does Chrome).

Friday, April 12, 2013

Deep JS object comparisons

Micro-benchmark comparing doing manual object property traversal and using JSON.stringify and string comparison of the result. One might think that the JSON approach would be spending more time in native code, thus would be faster, despite the string allocation overhead. But the manual property traversal is always faster (JIT FTW).