debugging mobile web apps

for: IBM internal Tech Talk - January 10 2013

by:   Patrick Mueller
@pmuellr
http://muellerware.org/

etc

canonical links to presentation

slide template

last modified

what

This presentation will cover:

what is a 'mobile web app'?

debug tools by platforms

RIM

first mobile platform vendor to ship real remote Web Inspector implementation from WebKit

links

iOS

Real remote Web Inspector like Safari 6 Web Inspector

links

Android

Real remote Web Inspector like Chrome Dev Tools

links

Windows

???

Ongoing work to get weinre running on Windows Phone.

Boot to Gecko / Firefox OS

Runs applications implemented entirely in HTML, CSS and JavaScript. [link]

Also see the slide on r2d2b2g in this presentation.

links

debugging tools for platform simulators

ripple

Chrome extension allowing you to quickly see how your application looks and functions on multiple mobile devices and platforms.

links

r2d2b2g

Firefox extension to run the Boot to Gecko desktop and apps within Firefox.

links

platform agnostic debugging tools

jsbin

From the web site:

JS Bin is a webapp specifically designed to help JavaScript and CSS folk test snippets of code, within some context, and debug the code collaboratively.

links

aardwolf

From the web site:

Aardwolf is a remote JavaScript debugger for iPhone / Android / WindowsPhone 7 / BlackBerry OS 6+. It is written in JavaScript.

links

jsfiddle

Popular HTML, CSS, JavaScript snippet testing environment

links

Adobe Edge Inspect

Preview and inspect web designs on mobile devices.

links

rsprofiler

proof-of-concept project for extracting and displaying dtrace-ishly precise JavaScript performance profiling

links

rsprofiler demo source

function run() {
    rsprofiler.start("jquery profile")
    runTests()
    rsprofiler.stop(function(err) { ... })
}

function runTests() {
    for (var i=0; i<40; i++) { runTestsDiv1(); runTestsSpan1() }
}

function runTestsDiv1() {
    for (var i=0; i<1000; i++) { $("#div-1").text() }
}

function runTestsSpan1() {
    for (var i=0; i<1000; i++) { $("#span-1").text($("#span-1").text()) }
}
                

rsprofiler demo flame graph

Hover over a box! Click a box!



            

weinre

links

weinre tips and tricks

For issues with Cordova, PhoneGap, Worklight:

demo time!

weinre movies here:

old rsprofiler movie here:

contribute to weinre!

weinre war stories

long term goal

the purpose of the PhoneGap project is for PhoneGap to cease to exist

long term goal

same for weinre:

short term goals:

pick a good name

There are only two hard things in Computer Science: cache invalidation and naming things.

pick a good name

more from Phil Karlton: YAILWAD (Yet another interpreted language without a debugger)

pick a good name

original name, remwi - REMote Web Inspector

tips:

Example: Apache Callback lasted a few weeks, renamed to Apache Cordova.

pick a good name

weinre is WEb INspector REmote. Pronounced like the word 'winery'. Or maybe like the word 'weiner'. Who knows, really.
weinre tag line

language usage

server:

client/target:

language usage

why change languages?

port from scoop to CoffeeScript was automated with js2coffee

language usage: JavaScript

//---------------------------------------------------------
function Animal(name) {
    this.init(name)
}

Animal.prototype.init = function(name) {
    this.name = name
}

Animal.prototype.answer = function(string) {
    console.log(this.constructor.name + " " + this.name + ": " + string)
}

Animal.prototype.talk = function() {
    this.answer("I can't talk")
}

//---------------------------------------------------------
function Fish(name) {
    Animal.call(this, name)
}

Fish.prototype.__proto__ = Animal.prototype

//---------------------------------------------------------
function Cat(name) {
    Animal.call(this, name)
}

Cat.prototype.talk = function() {
    this.answer("meow")
}

Cat.prototype.__proto__ = Animal.prototype

language usage: scoop

//---------------------------------------------------------
class Animal(name)
    this.init(name)

method init(name)
    this.name = name

method answer(string)
    console.log(this.constructor.name + " " + this.name + ": " + string)

method talk()
    this.answer("I can't talk")

//---------------------------------------------------------
class Fish(name) << Animal
    super(name)

//---------------------------------------------------------
class Cat(name) << Animal
    super(name)

method talk()
    this.answer("meow")

language usage: CoffeeScript

#---------------------------------------------------------
class Animal
    constructor: (aName) ->
        @init(aName)

    init: (aName) ->
        @name = aName

    answer: (string) ->
        console.log "#{@constructor.name} #{@name}: #{string}"

    talk: ->
        @answer "I can't talk"

#---------------------------------------------------------
class Fish extends Animal
    constructor: (aName) ->
        super

#---------------------------------------------------------
class Cat extends Animal
    constructor: (aName) ->
        super

    talk: ->
        @answer "meow"

pick a good home

I'm still fixing links

make it easy to install and run

 

 

$ sudo npm -g install weinre

...

$ weinre

weinre: starting server ...

...

great artists steal

Immature poets imitate; mature poets steal; bad poets deface what they take, and good poets make it into something better, or at least something different.

- T.S. Eliot 1921, from "Philip Massinger" in "The Sacred Wood".

great artists steal

source code:

security

weinre is:

So, what's the security story?

security smecurity

"About security for weinre: there is none."

security smecurity

Biggest potential problem, leaving your weinre injection script in your HTML, in your product, on the public web. I have seen it.

<script src="http://localhost:8080/target/target-script.js"></script>

security smecurity

what to do about it:

security smecurity

biggest "security" pain in the ass:

waiting for someone to care enough to send a pull request:

"good news everyone":

questions?