You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pm...@apache.org on 2012/01/03 19:39:31 UTC

[21/27] closes #35

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/ExtensionRegistryImpl.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/ExtensionRegistryImpl.scoop b/weinre.web/modules/weinre/client/ExtensionRegistryImpl.scoop
deleted file mode 100644
index bee7c42..0000000
--- a/weinre.web/modules/weinre/client/ExtensionRegistryImpl.scoop
+++ /dev/null
@@ -1,35 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2011 IBM Corporation
- */
-
-requireClass ../common/Ex
-requireClass ../common/Binding
-requireClass ../common/Weinre
-
-//-----------------------------------------------------------------------------
-class ExtensionRegistryImpl
-
-//-----------------------------------------------------------------------------
-init
-    var extensions = []
-
-//-----------------------------------------------------------------------------
-method getExtensionsAsync
-    if (extensions.length) return
-    
-    Weinre.WeinreClientCommands.getExtensions(Binding(this, this._cb_getExtensions))
-        
-//-----------------------------------------------------------------------------
-method _cb_getExtensions(extensionsResult)
-    extensions = extensionsResult
-    this._installExtensions()
-    
-//-----------------------------------------------------------------------------
-method _installExtensions    
-    WebInspector.addExtensions(extensions)
-    
-    
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/InspectorBackendImpl.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/InspectorBackendImpl.coffee b/weinre.web/modules/weinre/client/InspectorBackendImpl.coffee
new file mode 100644
index 0000000..1dcf45e
--- /dev/null
+++ b/weinre.web/modules/weinre/client/InspectorBackendImpl.coffee
@@ -0,0 +1,70 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+Ex                = require('../common/Ex')
+IDLTools          = require('../common/IDLTools')
+MessageDispatcher = require('../common/MessageDispatcher')
+Weinre            = require('../common/Weinre')
+
+#-------------------------------------------------------------------------------
+module.exports = class InspectorBackendImpl
+
+    constructor: ->
+        @registeredDomainDispatchers = {}
+        MessageDispatcher.setInspectorBackend this
+
+    #---------------------------------------------------------------------------
+    @setupProxies: ->
+        intfNames = [
+            "ApplicationCache"
+            "BrowserDebugger"
+            "CSS"
+            "Console"
+            "DOM"
+            "DOMStorage"
+            "Database"
+            "Debugger"
+            "InjectedScript"
+            "Inspector"
+            "Network"
+            "Profiler"
+            "Runtime"
+        ]
+
+        for intfName in intfNames
+            proxy = Weinre.messageDispatcher.createProxy(intfName)
+
+            if window[intfName]
+                throw new Ex(arguments, "backend interface '#{intfName}' already created")
+
+            intf = IDLTools.getIDL(intfName)
+            unless intf
+                throw new Ex(arguments, "interface not registered: '#{intfName}'")
+
+            window[intfName] = {}
+            for method in intf.methods
+                proxyMethod = InspectorBackendImpl.getProxyMethod(proxy, method)
+                InspectorBackendImpl::[method.name] = proxyMethod
+                window[intfName][method.name] = proxyMethod
+
+    #---------------------------------------------------------------------------
+    @getProxyMethod: (proxy, method) ->
+        ->
+            proxy[method.name].apply proxy, arguments
+
+    #---------------------------------------------------------------------------
+    registerDomainDispatcher: (name, intf) ->
+        @registeredDomainDispatchers[name] = intf
+
+    #---------------------------------------------------------------------------
+    getRegisteredDomainDispatcher: (name) ->
+        return null unless @registeredDomainDispatchers.hasOwnProperty(name)
+        @registeredDomainDispatchers[name]
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/InspectorBackendImpl.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/InspectorBackendImpl.scoop b/weinre.web/modules/weinre/client/InspectorBackendImpl.scoop
deleted file mode 100644
index a39ee09..0000000
--- a/weinre.web/modules/weinre/client/InspectorBackendImpl.scoop
+++ /dev/null
@@ -1,73 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2010, 2011 IBM Corporation
- */
-
-requireClass ../common/Ex
-requireClass ../common/IDLTools
-requireClass ../common/MessageDispatcher
-requireClass ../common/Weinre
-
-//-----------------------------------------------------------------------------
-class InspectorBackendImpl
-    this.registeredDomainDispatchers = {}
-    MessageDispatcher.setInspectorBackend(this)
-
-//-----------------------------------------------------------------------------
-static method setupProxies
-
-    var intfNames = [
-        "ApplicationCache",
-        "BrowserDebugger",
-        "CSS",
-        "Console",
-        "DOM",
-        "DOMStorage",
-        "Database",
-        "Debugger",
-        "InjectedScript",
-        "Inspector",
-        "Network",
-        "Profiler",
-        "Runtime"
-    ]
-
-    intfNames.forEach(function(intfName) {
-        var proxy = Weinre.messageDispatcher.createProxy(intfName)
-        if (window[intfName]) {
-            throw new Ex(arguments, "backend interface '" + intfName + "' already created")
-        }
-        
-        var intf = IDLTools.getIDL(intfName)
-        if (!intf) {
-            throw new Ex(arguments, "interface not registered: '" + intfName + "'")
-        }
-
-        window[intfName] = {}
-        
-        intf.methods.forEach(function(method) {
-            var proxyMethod = InspectorBackendImpl.getProxyMethod(proxy, method)
-            InspectorBackendImpl.prototype[method.name] = proxyMethod
-            window[intfName][method.name] = proxyMethod
-        })
-    })
-    
-
-//-----------------------------------------------------------------------------
-static method getProxyMethod(proxy, method)
-    return function() {
-        return proxy[method.name].apply(proxy, arguments)
-    }
-
-//-----------------------------------------------------------------------------
-method registerDomainDispatcher(name, intf)
-    this.registeredDomainDispatchers[name] = intf
-    
-//-----------------------------------------------------------------------------
-method getRegisteredDomainDispatcher(name)
-    if (!this.registeredDomainDispatchers.hasOwnProperty(name)) return null
-    
-    return this.registeredDomainDispatchers[name]

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/InspectorFrontendHostImpl.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/InspectorFrontendHostImpl.coffee b/weinre.web/modules/weinre/client/InspectorFrontendHostImpl.coffee
new file mode 100644
index 0000000..0c71e63
--- /dev/null
+++ b/weinre.web/modules/weinre/client/InspectorFrontendHostImpl.coffee
@@ -0,0 +1,87 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+Weinre   = require('../common/Weinre')
+IDLTools = require('../common/IDLTools')
+
+_extensionAPI = null
+
+#-------------------------------------------------------------------------------
+module.exports = class InspectorFrontendHostImpl
+
+    constructor: ->
+        @_getPlatformAndPort()
+
+    #---------------------------------------------------------------------------
+    loaded: ->
+
+    #---------------------------------------------------------------------------
+    localizedStringsURL: ->
+        "nls/English.lproj/localizedStrings.js"
+
+    #---------------------------------------------------------------------------
+    hiddenPanels: ->
+        "audits,profiles,network"
+
+    #---------------------------------------------------------------------------
+    platform: ->
+        "weinre"
+
+    #---------------------------------------------------------------------------
+    port: ->
+        "weinre"
+
+    #---------------------------------------------------------------------------
+    sendMessageToBackend: (message) ->
+        object = JSON.parse(message)
+        object[1] = "<long script elided>" if object[0] == "setInjectedScriptSource"
+        Weinre.logInfo arguments.callee.name + "(#{JSON.stringify(object, null, 4)})"
+
+    #---------------------------------------------------------------------------
+    setExtensionAPI: (extensionAPI) ->
+        _extensionAPI = extensionAPI
+
+    #---------------------------------------------------------------------------
+    getExtensionAPI: ->
+        _extensionAPI
+
+    #---------------------------------------------------------------------------
+    inspectedURLChanged: ->
+
+    #---------------------------------------------------------------------------
+    _getPlatformAndPort: ->
+        @_platform = "weinre"
+        @_platformFlavor = "weinre"
+        @_port = "weinre"
+        return if true
+        uas = navigator.userAgent
+        if uas.match(/mac os x/i)
+            @_platform = "mac"
+        else if uas.match(/macintosh/i)
+            @_platform = "mac"
+        else if uas.match(/linux/i)
+            @_platform = "linux"
+        else @_platform = "windows" if uas.match(/windows/i)
+        url = window.location.href
+        splits = url.split("#", 2)
+        if splits.length > 1
+            properties = splits[1]
+            properties = properties.split("&")
+            for property in properties
+                pieces = property.split("=")
+                if pieces.length > 1
+                    key = pieces[0]
+                    val = pieces[1]
+                    if key == "platform"
+                        @_platform = val
+                    else if key == "platformFlavor"
+                        @_platformFlavor = val
+                    else @_port = val if key == "port"
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/InspectorFrontendHostImpl.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/InspectorFrontendHostImpl.scoop b/weinre.web/modules/weinre/client/InspectorFrontendHostImpl.scoop
deleted file mode 100644
index cbdb6c1..0000000
--- a/weinre.web/modules/weinre/client/InspectorFrontendHostImpl.scoop
+++ /dev/null
@@ -1,96 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2010, 2011 IBM Corporation
- */
-
-requireClass ../common/Weinre
-requireClass ../common/IDLTools
-
-//-----------------------------------------------------------------------------
-class InspectorFrontendHostImpl
-        
-    this._getPlatformAndPort()
-
-//-----------------------------------------------------------------------------
-init
-    var _extensionAPI
-    
-//-----------------------------------------------------------------------------
-method loaded
-
-//-----------------------------------------------------------------------------
-method localizedStringsURL
-    return "nls/English.lproj/localizedStrings.js";
-
-//-----------------------------------------------------------------------------
-method hiddenPanels
-//    return "audits,profiles,resources,network"
-    return "audits,profiles,network"
-//    return "audits,profiles,resources,scripts,timeline,network"
-
-//-----------------------------------------------------------------------------
-method platform
-    return "weinre"
-
-//-----------------------------------------------------------------------------
-method port
-    return "weinre"
-
-//-----------------------------------------------------------------------------
-method sendMessageToBackend(message)
-    var object = JSON.parse(message)
-    if (object[0] == "setInjectedScriptSource") {
-        object[1] = "<long script elided>"
-    }
-    Weinre.logInfo(arguments.callee.signature + "(" + JSON.stringify(object,null,4) + ")")
-
-//-----------------------------------------------------------------------------
-method setExtensionAPI(extensionAPI)
-    _extensionAPI = extensionAPI
-
-//-----------------------------------------------------------------------------
-method getExtensionAPI
-    return _extensionAPI
-
-//-----------------------------------------------------------------------------
-method inspectedURLChanged
-
-//-----------------------------------------------------------------------------
-method _getPlatformAndPort
-    this._platform       = "weinre"
-    this._platformFlavor = "weinre"
-    this._port           = "weinre"
-        
-    if (true) return
-    
-    // get values from user agent
-    var uas = navigator.userAgent
-    if      (uas.match(/mac os x/i))  this._platform = "mac"
-    else if (uas.match(/macintosh/i)) this._platform = "mac"
-    else if (uas.match(/linux/i))     this._platform = "linux"
-    else if (uas.match(/windows/i))   this._platform = "windows"
-        
-    // get values from hash value
-    var url = window.location.href
-    
-    var splits = url.split("#",2)
-    if (splits.length > 1) {
-        var properties = splits[1]
-        properties = properties.split("&")
-        
-        properties.forEach(function(property) {
-            var pieces = property.split("=")
-            if (pieces.length > 1) {
-                var key = pieces[0]
-                var val = pieces[1]
-                
-                if      (key == "platform")       this._platform       = val
-                else if (key == "platformFlavor") this._platformFlavor = val
-                else if (key == "port")           this._port           = val
-            }
-        })
-        
-    }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/RemotePanel.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/RemotePanel.coffee b/weinre.web/modules/weinre/client/RemotePanel.coffee
new file mode 100644
index 0000000..a6c6110
--- /dev/null
+++ b/weinre.web/modules/weinre/client/RemotePanel.coffee
@@ -0,0 +1,211 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+Binding       = require('../common/Binding')
+Weinre        = require('../common/Weinre')
+
+ConnectorList = require('./ConnectorList')
+DT            = require('./DOMTemplates')
+
+# fix WebInspector.Panel's prototype so our super call works
+WebInspector.Panel.prototype.constructor = WebInspector.Panel
+
+#-------------------------------------------------------------------------------
+module.exports = class RemotePanel extends WebInspector.Panel
+
+    RemotePanel::__defineGetter__("toolbarItemClass", -> "remote")
+    RemotePanel::__defineGetter__("toolbarItemLabel", -> "Remote")
+    RemotePanel::__defineGetter__("statusBarItems", -> [])
+    RemotePanel::__defineGetter__("defaultFocusedElement", -> @contentElement)
+
+    constructor: ->
+        super "remote"
+        @initialize()
+
+    #---------------------------------------------------------------------------
+    initialize: () ->
+        div = DT.DIV()
+        div.style.position = "absolute"
+        div.style.top = "1em"
+        div.style.right = "1em"
+        div.style.left = "1em"
+        div.style.bottom = "1em"
+        div.style.overflow = "auto"
+        icon = DT.IMG(src: "../images/weinre-icon-128x128.png")
+        icon.style.float = "right"
+        div.appendChild icon
+        @targetList = new TargetList()
+        @clientList = new ClientList()
+        div.appendChild @targetList.getElement()
+        div.appendChild @clientList.getElement()
+        @serverProperties = DT.DIV($className: "weinreServerProperties")
+        div.appendChild DT.H1("Server Properties")
+        div.appendChild @serverProperties
+        @element.appendChild div
+        @reset()
+
+    #---------------------------------------------------------------------------
+    addClient: (client) ->
+        @clientList.add client
+
+
+    addTarget: (target) ->
+        @targetList.add target
+
+
+    getTarget: (channel) ->
+        @targetList.get channel
+
+
+    removeClient: (channel) ->
+        @clientList.remove channel
+
+
+    removeTarget: (channel) ->
+        @targetList.remove channel
+
+
+    setCurrentClient: (channel) ->
+        @clientList.setCurrent channel
+
+
+    setCurrentTarget: (channel) ->
+        @targetList.setCurrent channel
+
+
+    setClientState: (channel, state) ->
+        @clientList.setState channel, state
+
+
+    setTargetState: (channel, state) ->
+        @targetList.setState channel, state
+
+    #---------------------------------------------------------------------------
+    getNewestTargetChannel: (ignoring) ->
+        @targetList.getNewestConnectorChannel ignoring
+
+    #---------------------------------------------------------------------------
+    afterInitialConnection: ->
+        @clientList.afterInitialConnection()
+
+    #---------------------------------------------------------------------------
+    reset: ->
+        @clientList.removeAll()
+        @targetList.removeAll()
+        Weinre.WeinreClientCommands.getTargets Binding(this, "cb_getTargets")
+        Weinre.WeinreClientCommands.getClients Binding(this, "cb_getClients")
+
+    #---------------------------------------------------------------------------
+    connectionClosed: ->
+        @clientList.removeAll()
+        @targetList.removeAll()
+
+    #---------------------------------------------------------------------------
+    cb_getTargets: (targets) ->
+        for target in targets
+            @addTarget target
+
+        return unless Weinre.client.autoConnect()
+        newestTargetChannel = @getNewestTargetChannel()
+        return unless newestTargetChannel
+        return unless Weinre.messageDispatcher
+        Weinre.WeinreClientCommands.connectTarget Weinre.messageDispatcher.channel, newestTargetChannel
+
+    #---------------------------------------------------------------------------
+    cb_getClients: (clients) ->
+        for client in clients
+            @addClient client
+
+    #---------------------------------------------------------------------------
+    show: ->
+        super()
+
+    #---------------------------------------------------------------------------
+    hide: () ->
+        super()
+
+    #---------------------------------------------------------------------------
+    setServerProperties: (properties) ->
+        table = "<table>"
+        keys = []
+        for key of properties
+            keys.push key
+        keys = keys.sort()
+        for key in keys
+            val = properties[key]
+            if typeof val == "string"
+                val = val.escapeHTML()
+            else
+                finalVal = ""
+                for aVal in val
+                    finalVal += "<li>" + aVal.escapeHTML()
+
+                val = "<ul>#{finalVal}</ul>"
+            table += "<tr class='weinre-normal-text-size'><td valign='top'>#{key.escapeHTML()}: <td>" + val
+
+        table += "</table>"
+        @serverProperties.innerHTML = table
+
+#-------------------------------------------------------------------------------
+class TargetList extends ConnectorList
+
+    constructor: ->
+        super "Targets"
+
+    #---------------------------------------------------------------------------
+    getListItem: (target) ->
+        self = this
+        text = target.hostName + " [channel: #{target.channel} id: #{target.id}]" + " - " + target.url
+        item = DT.LI($connectorChannel: target.channel, text)
+        item.addStyleClass "weinre-connector-item"
+        item.addStyleClass "target"
+        item.addEventListener "click", ((e) ->
+            self.connectToTarget target.channel, e
+        ), false
+        target.element = item
+        item
+
+    #---------------------------------------------------------------------------
+    connectToTarget: (targetChannel, event) ->
+        if event
+            event.preventDefault()
+            event.stopPropagation()
+        target = @connectors[targetChannel]
+        return false unless target
+        return false if target.closed
+        Weinre.WeinreClientCommands.connectTarget Weinre.messageDispatcher.channel, targetChannel
+        false
+
+#-------------------------------------------------------------------------------
+class ClientList extends ConnectorList
+
+    constructor: ->
+        super "Clients"
+        @noneItem.innerHTML = "Waiting for connection..."
+
+    #---------------------------------------------------------------------------
+    afterInitialConnection: () ->
+        @noneItem.innerHTML = "Connection lost, reload this page to reconnect."
+        @noneItem.addStyleClass "error"
+
+    #---------------------------------------------------------------------------
+    getListItem: (client) ->
+        text = client.hostName + " [channel: #{client.channel} id: #{client.id}]"
+        item = DT.LI($connectorChannel: client.channel, text)
+        item.addStyleClass "weinre-connector-item"
+        item.addStyleClass "client"
+
+        if Weinre.messageDispatcher
+            if client.channel == Weinre.messageDispatcher.channel
+                item.addStyleClass "current"
+
+        client.element = item
+        item
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/RemotePanel.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/RemotePanel.scoop b/weinre.web/modules/weinre/client/RemotePanel.scoop
deleted file mode 100644
index fe7c5b8..0000000
--- a/weinre.web/modules/weinre/client/RemotePanel.scoop
+++ /dev/null
@@ -1,255 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2010, 2011 IBM Corporation
- */
-
-requireClass ../common/Binding
-requireClass ../common/Weinre
-
-requireClass ./ConnectorList
-requireClass ./DOMTemplates as dt
-
-//-----------------------------------------------------------------------------
-class RemotePanel < WebInspector.Panel
-    super("remote")
-
-    this.initialize()
-
-//-----------------------------------------------------------------------------
-method initialize()
-    
-    // main div
-    var div = dt.DIV()
-    div.style.position = "absolute"
-    div.style.top      = "1em"
-    div.style.right    = "1em"
-    div.style.left     = "1em"
-    div.style.bottom   = "1em"
-    div.style.overflow = "auto"
-
-    // create icon
-    var icon = dt.IMG({
-        src: "../images/weinre-icon-128x128.png"
-    })
-    
-    icon.style.float = "right"
-    div.appendChild(icon)
-        
-    // create target and client lists
-    this.targetList = new TargetList()
-    this.clientList = new ClientList()
-    
-    div.appendChild(this.targetList.getElement())
-    div.appendChild(this.clientList.getElement())
-    
-    // create server properties
-    this.serverProperties = dt.DIV({
-        $className: "weinreServerProperties"
-    })
-        
-    div.appendChild(dt.H1("Server Properties"))
-    div.appendChild(this.serverProperties)
-    
-    // add main div to page
-    this.element.appendChild(div)
-    this.reset();
-
-//-----------------------------------------------------------------------------
-method addClient(client) 
-    this.clientList.add(client)
-    
-method addTarget(target) 
-    this.targetList.add(target)
-
-method getTarget(channel)
-    return this.targetList.get(channel)
-    
-method removeClient(channel) 
-    this.clientList.remove(channel)
-    
-method removeTarget(channel) 
-    this.targetList.remove(channel)
-
-method setCurrentClient(channel) 
-    this.clientList.setCurrent(channel)
-    
-method setCurrentTarget(channel) 
-    this.targetList.setCurrent(channel)
-
-method setClientState(channel, state) 
-    this.clientList.setState(channel, state)
-    
-method setTargetState(channel, state) 
-    this.targetList.setState(channel, state)
-
-//-----------------------------------------------------------------------------
-method getNewestTargetChannel(ignoring)
-    return this.targetList.getNewestConnectorChannel(ignoring)
-
-//-----------------------------------------------------------------------------
-method afterInitialConnection
-    this.clientList.afterInitialConnection()
-
-//-----------------------------------------------------------------------------
-method reset
-    this.clientList.removeAll()
-    this.targetList.removeAll()
-    
-    Weinre.WeinreClientCommands.getTargets(Binding(this, "cb_getTargets"))
-    Weinre.WeinreClientCommands.getClients(Binding(this, "cb_getClients"))
-
-//-----------------------------------------------------------------------------
-method connectionClosed
-    this.clientList.removeAll()
-    this.targetList.removeAll()
-
-//-----------------------------------------------------------------------------
-method cb_getTargets(targets)
-    targets.forEach(function(target) {
-        this.addTarget(target)
-    }, this)
-   
-    if (!Weinre.client.autoConnect()) return
-    
-    var newestTargetChannel = this.getNewestTargetChannel()
-    if (!newestTargetChannel) return
-    if (!Weinre.messageDispatcher) return
-
-    Weinre.WeinreClientCommands.connectTarget(Weinre.messageDispatcher.channel, newestTargetChannel)
-    
-    
-//-----------------------------------------------------------------------------
-method cb_getClients(clients)
-    clients.forEach(function(client) {
-        this.addClient(client)
-    }, this)
-
-//-----------------------------------------------------------------------------
-getter toolbarItemClass
-    return "remote"
-
-//-----------------------------------------------------------------------------
-getter toolbarItemLabel
-    return "Remote"
-
-//-----------------------------------------------------------------------------
-getter statusBarItems
-    return []
-
-//-----------------------------------------------------------------------------
-getter defaultFocusedElement
-    return this.contentElement
-
-//-----------------------------------------------------------------------------
-method show
-    super()
-
-//-----------------------------------------------------------------------------
-method hide()
-    super()
-
-//-----------------------------------------------------------------------------
-method setServerProperties(properties)
-    var table = "<table>"
-    var keys = []
-    for (var key in properties) {
-        keys.push(key)
-    }
-    
-    keys = keys.sort()
-    keys.forEach(function(key) {
-        val = properties[key]
-        if (typeof val == "string") {
-            val = val.escapeHTML()
-        }
-        else {
-            var finalVal = ""
-            val.forEach(function(aVal){
-                finalVal += "<li>" + aVal.escapeHTML()
-            })
-            val = "<ul>" + finalVal + "</ul>"
-        }
-        table += "<tr class='weinre-normal-text-size'><td valign='top'>" + key.escapeHTML() + ": <td>" + val
-    })
-    table += "</table>"
-    this.serverProperties.innerHTML = table
-
-//=============================================================================
-//=============================================================================
-    
-//-----------------------------------------------------------------------------
-class TargetList < ConnectorList
-    super("Targets")
-
-//-----------------------------------------------------------------------------
-method getListItem(target)
-    var self = this
-    var text = target.hostName + " [channel: " + target.channel + " id: " + target.id + "]" + " - " + target.url 
-
-    var item = dt.LI(
-        { $connectorChannel: target.channel },
-        text
-    )
-    
-    item.addStyleClass("weinre-connector-item")
-    item.addStyleClass("target")
-    
-    item.addEventListener("click", function(e) {self.connectToTarget(target.channel, e)}, false)
-
-    target.element = item
-
-    return item
-
-//-----------------------------------------------------------------------------
-method connectToTarget(targetChannel, event)
-    if (event) {
-        event.preventDefault()
-        event.stopPropagation()
-    }
-    
-    var target = this.connectors[targetChannel]
-    if (!target) return false
-    if (target.closed) return false
-    
-    Weinre.WeinreClientCommands.connectTarget(Weinre.messageDispatcher.channel, targetChannel)
-    
-    return false
-
-//=============================================================================
-//=============================================================================
-
-//-----------------------------------------------------------------------------
-class ClientList < ConnectorList
-    super("Clients")
-
-    this.noneItem.innerHTML = "Waiting for connection..."
-
-//-----------------------------------------------------------------------------
-method afterInitialConnection()
-    this.noneItem.innerHTML = "Connection lost, reload this page to reconnect."
-    this.noneItem.addStyleClass("error")
-
-//-----------------------------------------------------------------------------
-method getListItem(client)
-    var text = client.hostName + " [channel: " + client.channel + " id: " + client.id  + "]"
-    
-    var item = dt.LI(
-        { $connectorChannel: client.channel },
-        text
-    )
-
-    item.addStyleClass("weinre-connector-item")
-    item.addStyleClass("client")
-    
-    if (Weinre.messageDispatcher) {
-        if (client.channel == Weinre.messageDispatcher.channel) {
-            item.addStyleClass("current")
-        }
-    }
-
-    client.element = item
-    
-    return item

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/WeinreClientEventsImpl.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/WeinreClientEventsImpl.coffee b/weinre.web/modules/weinre/client/WeinreClientEventsImpl.coffee
new file mode 100644
index 0000000..a3e4038
--- /dev/null
+++ b/weinre.web/modules/weinre/client/WeinreClientEventsImpl.coffee
@@ -0,0 +1,91 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+Callback                    = require('../common/Callback')
+Weinre                      = require('../common/Weinre')
+
+WeinreExtraTargetEventsImpl = require('./WeinreExtraTargetEventsImpl')
+
+titleNotConnected    = "weinre: target not connected"
+titleConnectedPrefix = "weinre: "
+
+document.title = titleNotConnected
+
+#-------------------------------------------------------------------------------
+module.exports = class WeinreClientEventsImpl
+
+    constructor: (client) ->
+        @client = client
+
+    #---------------------------------------------------------------------------
+    clientRegistered: (clientDescription) ->
+        WebInspector.panels.remote.addClient clientDescription if @client.uiAvailable()
+
+    #---------------------------------------------------------------------------
+    targetRegistered: (targetDescription) ->
+        WebInspector.panels.remote.addTarget targetDescription if @client.uiAvailable()
+        return unless Weinre.client.autoConnect()
+        return unless Weinre.messageDispatcher
+
+        Weinre.WeinreClientCommands.connectTarget Weinre.messageDispatcher.channel, targetDescription.channel
+
+    #---------------------------------------------------------------------------
+    clientUnregistered: (clientChannel) ->
+        WebInspector.panels.remote.removeClient clientChannel if @client.uiAvailable()
+
+    #---------------------------------------------------------------------------
+    targetUnregistered: (targetChannel) ->
+        WebInspector.panels.remote.removeTarget targetChannel if @client.uiAvailable()
+
+    #---------------------------------------------------------------------------
+    connectionCreated: (clientChannel, targetChannel) ->
+        if @client.uiAvailable()
+            WebInspector.panels.remote.setClientState clientChannel, "connected"
+            WebInspector.panels.remote.setTargetState targetChannel, "connected"
+
+        return unless clientChannel == Weinre.messageDispatcher.channel
+
+        WebInspector.panels.elements.reset()
+        WebInspector.panels.timeline._clearPanel()
+        WebInspector.panels.resources.reset()
+
+        target = WebInspector.panels.remote.getTarget(targetChannel)
+        document.title = titleConnectedPrefix + target.url
+        WebInspector.inspectedURLChanged target.url
+
+        Weinre.WeinreExtraClientCommands.getDatabases (databaseRecords) ->
+            WeinreExtraTargetEventsImpl.addDatabaseRecords databaseRecords
+
+    #---------------------------------------------------------------------------
+    connectionDestroyed: (clientChannel, targetChannel) ->
+        if @client.uiAvailable()
+            WebInspector.panels.remote.setClientState clientChannel, "not-connected"
+            WebInspector.panels.remote.setTargetState targetChannel, "not-connected"
+
+        return unless clientChannel == Weinre.messageDispatcher.channel
+
+        document.title = titleNotConnected
+        return unless Weinre.client.autoConnect()
+        return unless @client.uiAvailable()
+
+        nextTargetChannel = WebInspector.panels.remote.getNewestTargetChannel(targetChannel)
+        return unless nextTargetChannel
+
+        Weinre.WeinreClientCommands.connectTarget Weinre.messageDispatcher.channel, nextTargetChannel
+        Weinre.logInfo "autoconnecting to " + nextTargetChannel
+
+    #---------------------------------------------------------------------------
+    sendCallback: (callbackId, result) ->
+        Callback.invoke callbackId, result
+
+    #---------------------------------------------------------------------------
+    serverProperties: (properties) ->
+        WebInspector.panels.remote.setServerProperties properties if @client.uiAvailable()
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/WeinreClientEventsImpl.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/WeinreClientEventsImpl.scoop b/weinre.web/modules/weinre/client/WeinreClientEventsImpl.scoop
deleted file mode 100644
index 7fd6a65..0000000
--- a/weinre.web/modules/weinre/client/WeinreClientEventsImpl.scoop
+++ /dev/null
@@ -1,105 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2010, 2011 IBM Corporation
- */
-
-requireClass ../common/Callback
-requireClass ../common/Weinre
-
-requireClass ./WeinreExtraTargetEventsImpl
-
-//-----------------------------------------------------------------------------
-class WeinreClientEventsImpl(client)
-    this.client = client
-
-//-----------------------------------------------------------------------------
-init
-    var titleNotConnected    = "weinre: target not connected"
-    var titleConnectedPrefix = "weinre: "
-    
-    document.title = titleNotConnected
-     
-//-----------------------------------------------------------------------------
-method clientRegistered(clientDescription)
-    if (this.client.uiAvailable()) {
-        WebInspector.panels.remote.addClient(clientDescription)
-    }
-
-//-----------------------------------------------------------------------------
-method targetRegistered(targetDescription)
-    if (this.client.uiAvailable()) {
-        WebInspector.panels.remote.addTarget(targetDescription)
-    }
-    
-    if (!Weinre.client.autoConnect()) return
-    if (!Weinre.messageDispatcher) return
-    
-    Weinre.WeinreClientCommands.connectTarget(Weinre.messageDispatcher.channel, targetDescription.channel)
-
-//-----------------------------------------------------------------------------
-method clientUnregistered(/*int*/ clientChannel)
-    if (this.client.uiAvailable()) {
-        WebInspector.panels.remote.removeClient(clientChannel)
-    }
-
-//-----------------------------------------------------------------------------
-method targetUnregistered(/*int*/ targetChannel)
-    if (this.client.uiAvailable()) {
-        WebInspector.panels.remote.removeTarget(targetChannel)
-    }
-
-//-----------------------------------------------------------------------------
-method connectionCreated(/*int*/ clientChannel, /*int*/ targetChannel)
-    if (this.client.uiAvailable()) {
-        WebInspector.panels.remote.setClientState(clientChannel, "connected") 
-        WebInspector.panels.remote.setTargetState(targetChannel, "connected")
-    }
-    
-    if (clientChannel != Weinre.messageDispatcher.channel) return
-
-    WebInspector.panels.elements.reset()
-    WebInspector.panels.timeline._clearPanel()
-    WebInspector.panels.resources.reset()
-    
-    var target = WebInspector.panels.remote.getTarget(targetChannel)
-    document.title = titleConnectedPrefix + target.url
-    
-    WebInspector.inspectedURLChanged(target.url)
-
-    Weinre.WeinreExtraClientCommands.getDatabases(function(databaseRecords) {
-        WeinreExtraTargetEventsImpl.addDatabaseRecords(databaseRecords)
-    })
-    
-//-----------------------------------------------------------------------------
-method connectionDestroyed(/*int*/ clientChannel, /*int*/ targetChannel)
-
-    if (this.client.uiAvailable()) {
-        WebInspector.panels.remote.setClientState(clientChannel, "not-connected") 
-        WebInspector.panels.remote.setTargetState(targetChannel, "not-connected")
-    }
-    
-    if (clientChannel != Weinre.messageDispatcher.channel) return
-
-    document.title = titleNotConnected
-    
-    if (!Weinre.client.autoConnect()) return
-    if (!this.client.uiAvailable()) return
-    
-    var nextTargetChannel = WebInspector.panels.remote.getNewestTargetChannel(targetChannel)
-    if (!nextTargetChannel) return
-    
-    Weinre.WeinreClientCommands.connectTarget(Weinre.messageDispatcher.channel, nextTargetChannel)
-    Weinre.logInfo("autoconnecting to " + nextTargetChannel)
-
-//-----------------------------------------------------------------------------
-method sendCallback(/*int*/ callbackId, /*any*/ result)
-    Callback.invoke(callbackId, result)
-
-//-----------------------------------------------------------------------------
-method serverProperties(/*any*/ properties)
-    if (this.client.uiAvailable()) {
-        WebInspector.panels.remote.setServerProperties(properties)
-    }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/WeinreExtraTargetEventsImpl.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/WeinreExtraTargetEventsImpl.coffee b/weinre.web/modules/weinre/client/WeinreExtraTargetEventsImpl.coffee
new file mode 100644
index 0000000..66c88d3
--- /dev/null
+++ b/weinre.web/modules/weinre/client/WeinreExtraTargetEventsImpl.coffee
@@ -0,0 +1,35 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+module.exports = class WeinreExtraTargetEventsImpl
+
+    constructor: ->
+
+    #---------------------------------------------------------------------------
+    databaseOpened: (databaseRecord) ->
+        WeinreExtraTargetEventsImpl.addDatabaseRecords [ databaseRecord ]
+
+    #---------------------------------------------------------------------------
+    @addDatabaseRecords: (databaseRecords) ->
+        return unless WebInspector.panels
+        return unless WebInspector.panels.resources
+        return unless WebInspector.panels.resources._databases
+
+        existingDbs = WebInspector.panels.resources._databases
+        existingDbNames = {}
+
+        for existingDb in existingDbs
+            existingDbNames[existingDb.name] = existingDb
+
+        for databaseRecord in databaseRecords
+            continue if existingDbNames[databaseRecord.name]
+            database = new WebInspector.Database(databaseRecord.id, databaseRecord.domain, databaseRecord.name, databaseRecord.version)
+            WebInspector.panels.resources.addDatabase database
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/client/WeinreExtraTargetEventsImpl.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/client/WeinreExtraTargetEventsImpl.scoop b/weinre.web/modules/weinre/client/WeinreExtraTargetEventsImpl.scoop
deleted file mode 100644
index 76abaad..0000000
--- a/weinre.web/modules/weinre/client/WeinreExtraTargetEventsImpl.scoop
+++ /dev/null
@@ -1,48 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2011 IBM Corporation
- */
-
-//-----------------------------------------------------------------------------
-class WeinreExtraTargetEventsImpl
-
-//-----------------------------------------------------------------------------
-method databaseOpened(databaseRecord)
-    WeinreExtraTargetEventsImpl.addDatabaseRecords([databaseRecord])
-    
-//-----------------------------------------------------------------------------
-static method addDatabaseRecords(databaseRecords)
-    // databaseRecord.id
-    // databaseRecord.domain
-    // databaseRecord.name
-    // databaseRecord.version
-    
-    if (!WebInspector.panels) return
-    if (!WebInspector.panels.resources) return
-    if (!WebInspector.panels.resources._databases) return
-    
-    var existingDbs = WebInspector.panels.resources._databases
-    var existingDbNames = {}
-    
-    for (var i=0; i<existingDbs.length; i++) {
-        existingDbNames[existingDbs[i].name] = existingDbs[i]
-    }
-    
-    for (var i=0; i<databaseRecords.length; i++) {
-        if (existingDbNames[databaseRecords[i].name]) continue
-        
-        var databaseRecord = databaseRecords[i]
-        var database = new WebInspector.Database(
-            databaseRecord.id,
-            databaseRecord.domain,
-            databaseRecord.name,
-            databaseRecord.version
-            )
-        
-        WebInspector.panels.resources.addDatabase(database)
-    }
-    
-    

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/Binding.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/Binding.coffee b/weinre.web/modules/weinre/common/Binding.coffee
new file mode 100644
index 0000000..ad7ab14
--- /dev/null
+++ b/weinre.web/modules/weinre/common/Binding.coffee
@@ -0,0 +1,26 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+Ex = require('./Ex')
+
+#-------------------------------------------------------------------------------
+module.exports = class Binding
+
+    constructor: (receiver, method) ->
+        if not receiver
+            throw new Ex(arguments, "receiver argument for Binding constructor was null")
+
+        method = receiver[method] if typeof (method) == "string"
+
+        if typeof (method) is not "function"
+            throw new Ex(arguments, "method argument didn't specify a function")
+
+        return -> method.apply(receiver, [].slice.call(arguments))
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/Binding.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/Binding.scoop b/weinre.web/modules/weinre/common/Binding.scoop
deleted file mode 100644
index 9db156b..0000000
--- a/weinre.web/modules/weinre/common/Binding.scoop
+++ /dev/null
@@ -1,20 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2010, 2011 IBM Corporation
- */
-
-requireClass ./Ex
-
-//-----------------------------------------------------------------------------
-class Binding(receiver, method)
-
-    if (receiver == null) throw new Ex(arguments, "receiver argument for Binding constructor was null")
-    if (typeof(method) == "string") method = receiver[method]
-    if (typeof(method) != "function") throw new Ex(arguments, "method argument didn't specify a function")
-
-    return function() {
-        return method.apply(receiver, [].slice.call(arguments))
-    }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/Callback.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/Callback.coffee b/weinre.web/modules/weinre/common/Callback.coffee
new file mode 100644
index 0000000..ee2baf2
--- /dev/null
+++ b/weinre.web/modules/weinre/common/Callback.coffee
@@ -0,0 +1,72 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+Ex = require('./Ex')
+
+CallbackTable    = {}
+CallbackIndex    = 1
+ConnectorChannel = "???"
+
+#-------------------------------------------------------------------------------
+module.exports = class Callback
+
+    constructor: ->
+        throw new Ex(arguments, "this class is not intended to be instantiated")
+
+    #---------------------------------------------------------------------------
+    @setConnectorChannel: (connectorChannel) ->
+        ConnectorChannel = "" + connectorChannel
+
+    #---------------------------------------------------------------------------
+    @register: (callback) ->
+        callback = [ null, callback ] if typeof callback == "function"
+        unless typeof callback.slice == "function"
+            throw new Ex(arguments, "callback must be an array or function")
+
+        receiver = callback[0]
+        func = callback[1]
+        data = callback.slice(2)
+        func = receiver[func] if typeof func == "string"
+
+        unless typeof func == "function"
+            throw new Ex(arguments, "callback function was null or not found")
+
+        index = ConnectorChannel + "::" + CallbackIndex
+
+        CallbackIndex++
+        CallbackIndex = 1 if CallbackIndex >= 65536 * 65536
+        CallbackTable[index] = [ receiver, func, data ]
+
+        index
+
+    #---------------------------------------------------------------------------
+    @deregister: (index) ->
+        delete CallbackTable[index]
+
+    #---------------------------------------------------------------------------
+    @invoke: (index, args) ->
+        callback = CallbackTable[index]
+
+        unless callback
+            throw new Ex(arguments, "callback #{index} not registered or already invoked")
+
+        receiver = callback[0]
+        func = callback[1]
+        args = callback[2].concat(args)
+
+        try
+            func.apply receiver, args
+        catch e
+            funcName = func.name || func.signature
+            funcName = "<unnamed>" unless funcName
+            require("./Weinre").logError arguments.callee.signature + " exception invoking callback: #{funcName}(#{args.join(',')}): " + e
+        finally
+            Callback.deregister index
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/Callback.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/Callback.scoop b/weinre.web/modules/weinre/common/Callback.scoop
deleted file mode 100644
index b2edba1..0000000
--- a/weinre.web/modules/weinre/common/Callback.scoop
+++ /dev/null
@@ -1,69 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2010, 2011 IBM Corporation
- */
-
-requireClass ./Ex
-
-//-----------------------------------------------------------------------------
-class Callback
-    throw new Ex(arguments, "this class is not intended to be instantiated")
-
-//-----------------------------------------------------------------------------
-init 
-    var CallbackTable    = {}
-    var CallbackIndex    = 1
-    var ConnectorChannel = "???"
-
-//-----------------------------------------------------------------------------
-static method setConnectorChannel(connectorChannel)
-    ConnectorChannel = ""  + connectorChannel
-
-//-----------------------------------------------------------------------------
-static method register(callback)
-    if (typeof callback == "function") callback = [null, callback]
-    if (typeof callback.slice != "function") throw new Ex(arguments, "callback must be an array or function")
-    
-    var receiver = callback[0]
-    var func     = callback[1]
-    var data     = callback.slice(2)
-    
-    if (typeof func == "string") func = receiver.func
-    if (typeof func != "function") throw new Ex(arguments, "callback function was null or not found")
-
-    var index = ConnectorChannel + "::" + CallbackIndex
-    
-    CallbackIndex++
-    if (CallbackIndex >= 65536 * 65536) CallbackIndex = 1
-    
-    CallbackTable[index] = [receiver, func, data]
-    
-    return index
-
-//-----------------------------------------------------------------------------
-static method deregister(index)
-    delete CallbackTable[index]
-
-//-----------------------------------------------------------------------------
-static method invoke(index, args)
-    var callback = CallbackTable[index]
-    if (!callback) throw new Ex(arguments, "callback " + index + " not registered or already invoked")
-    
-    var receiver = callback[0]
-    var func     = callback[1]
-    var args     = callback[2].concat(args)
-    
-    try {
-        func.apply(receiver,args)
-    }
-    catch (e) {
-        var funcName = func.name
-        if (!funcName) funcName = "<unnamed>"
-        require("./Weinre").getClass().logError(arguments.callee.signature + " exception invoking callback: " + funcName + "(" + args.join(",") + "): " + e)
-    }
-    finally {
-        Callback.deregister(index)
-    }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/EventListeners.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/EventListeners.coffee b/weinre.web/modules/weinre/common/EventListeners.coffee
new file mode 100644
index 0000000..535b48f
--- /dev/null
+++ b/weinre.web/modules/weinre/common/EventListeners.coffee
@@ -0,0 +1,56 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+Ex     = require('./Ex')
+Weinre = require('./Weinre')
+
+#-------------------------------------------------------------------------------
+module.exports = class EventListeners
+
+    constructor: ->
+        @listeners = []
+
+    #---------------------------------------------------------------------------
+    add: (listener, useCapture) ->
+        @listeners.push [ listener, useCapture ]
+
+    #---------------------------------------------------------------------------
+    remove: (listener, useCapture) ->
+        listeners = @listeners.slice()
+
+        for _listener in listeners
+            continue unless _listener[0] == listener
+            continue unless _listener[1] == useCapture
+
+            @_listeners.splice i, 1
+            return
+
+    #---------------------------------------------------------------------------
+    fire: (event) ->
+        listeners = @listeners.slice()
+        for listener in listeners
+            listener = listener[0]
+
+            if typeof listener is "function"
+                try
+                    listener.call null, event
+                catch e
+                    Weinre.logError "#{arguments.callee.name} invocation exception: #{e}"
+                continue
+
+            if typeof listener?.handleEvent isnt "function"
+                throw new Ex(arguments, "listener does not implement the handleEvent() method")
+
+            try
+                listener.handleEvent.call listener, event
+            catch e
+                Weinre.logError "#{arguments.callee.name} invocation exception: #{e}"
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/EventListeners.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/EventListeners.scoop b/weinre.web/modules/weinre/common/EventListeners.scoop
deleted file mode 100644
index 0c9d987..0000000
--- a/weinre.web/modules/weinre/common/EventListeners.scoop
+++ /dev/null
@@ -1,56 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2010, 2011 IBM Corporation
- */
-
-requireClass ./Ex
-requireClass ./Weinre
-
-//-----------------------------------------------------------------------------
-class EventListeners
-    this._listeners = []
-
-//-----------------------------------------------------------------------------
-method add(listener, useCapture)
-    this._listeners.push([listener, useCapture])
-
-//-----------------------------------------------------------------------------
-method remove(listener, useCapture)
-    for (var i=0; i<this._listeners.length; i++) {
-        var listener = this._listeners[i]
-        if (listener[0] != listener) continue;
-        if (listener[1] != useCapture) continue;
-        
-        this._listeners.splice(i,1)
-        return
-    }
-
-//-----------------------------------------------------------------------------
-method fire(event)
-    this._listeners.slice().forEach(function(listener) {
-        var listener = listener[0]
-        
-        if (typeof listener == "function") {
-            try {
-                listener.call(null, event)
-            }
-            catch(e) {
-                Weinre.logError(arguments.callee.signature + " invocation exception: " + e)
-            }
-            return
-        }
-        
-        if (typeof listener.handleEvent != "function") {
-            throw new Ex(arguments, "listener does not implement the handleEvent() method")
-        }
-        
-        try {
-            listener.handleEvent.call(listener, event)
-        }
-        catch(e) {
-            Weinre.logError(arguments.callee.signature + " invocation exception: " + e)
-        }
-    })

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/Ex.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/Ex.coffee b/weinre.web/modules/weinre/common/Ex.coffee
new file mode 100644
index 0000000..e5c1591
--- /dev/null
+++ b/weinre.web/modules/weinre/common/Ex.coffee
@@ -0,0 +1,31 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+StackTrace = require('./StackTrace')
+
+#-------------------------------------------------------------------------------
+module.exports = class Ex
+
+    constructor: (args, message) ->
+        if not args or not args.callee
+            throw Ex(arguments, "first parameter must be an Arguments object")
+
+        StackTrace.dump args
+        message = "threw error: " + message if message instanceof Error
+        new Error(prefix(args, message))
+
+#-------------------------------------------------------------------------------
+prefix = (args, string) ->
+      return args.callee.signature   + ": " + string if args.callee.signature
+      return args.callee.displayName + ": " + string if args.callee.displayName
+      return args.callee.name        + ": " + string if args.callee.name
+
+      "<anonymous>" + ": " + string
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/Ex.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/Ex.scoop b/weinre.web/modules/weinre/common/Ex.scoop
deleted file mode 100644
index e6d0bf7..0000000
--- a/weinre.web/modules/weinre/common/Ex.scoop
+++ /dev/null
@@ -1,30 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2010, 2011 IBM Corporation
- */
-
-requireClass ./StackTrace
-
-//-----------------------------------------------------------------------------
-class Ex(args, message)
-    if (!args || !args.callee) {
-        throw Ex(arguments, "first parameter must be an Arguments object") 
-    }
-    
-    StackTrace.dump(args)
-    
-    if (message instanceof Error) {
-        message = "threw error: " + message
-    }
-    
-    return new Error(prefix(args, message))
-    
-//-----------------------------------------------------------------------------
-function prefix(args, string)
-    if (args.callee.signature)   return args.callee.signature +   ": " + string
-    if (args.callee.displayName) return args.callee.displayName + ": " + string
-    if (args.callee.name)        return args.callee.name +        ": " + string
-    return "<anonymous>" +                                        ": " + string

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/IDGenerator.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/IDGenerator.coffee b/weinre.web/modules/weinre/common/IDGenerator.coffee
new file mode 100644
index 0000000..0a4f599
--- /dev/null
+++ b/weinre.web/modules/weinre/common/IDGenerator.coffee
@@ -0,0 +1,41 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+nextIdValue = 1
+idName      = "__weinre__id"
+
+module.exports = class IDGenerator
+
+    #---------------------------------------------------------------------------
+    @checkId: (object) ->
+        object[idName]
+
+    #---------------------------------------------------------------------------
+    @getId: (object, map) ->
+        id = IDGenerator.checkId(object)
+
+        unless id
+            id = nextId()
+            object[idName] = id
+
+        map[id] = object if map
+
+        id
+
+    #---------------------------------------------------------------------------
+    @next: ->
+        nextId()
+
+#-------------------------------------------------------------------------------
+nextId = () ->
+      result = nextIdValue
+      nextIdValue += 1
+      result
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/IDGenerator.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/IDGenerator.scoop b/weinre.web/modules/weinre/common/IDGenerator.scoop
deleted file mode 100644
index 5af26cd..0000000
--- a/weinre.web/modules/weinre/common/IDGenerator.scoop
+++ /dev/null
@@ -1,53 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2011 IBM Corporation
- */
-
-//-----------------------------------------------------------------------------
-class IDGenerator
-
-//-----------------------------------------------------------------------------
-init
-    var nextIdValue = 1
-    var idName      = "__weinre__id"
-
-//-----------------------------------------------------------------------------
-static method checkId(object)
-    return object[idName]
-    
-//-----------------------------------------------------------------------------
-static method getId(object, map)
-    var id = IDGenerator.checkId(object)
-    
-    if (!id) {
-        id = nextId()
-        
-        // note:
-        // attempted to use Object.defineProperty() to make
-        // the id property non-enumerable, etc, but doesn't 
-        // work in JSC (TypeError), and still shows up in
-        // Web Inspector property views anyway.
-        object[idName] = id
-    }
-    
-    if (map) {
-        if (map[id] != object) {
-            map[id] = object
-        }
-    }
-    
-    return id
-
-//-----------------------------------------------------------------------------
-static method next
-    return nextId()
-
-//-----------------------------------------------------------------------------
-function nextId
-    var result = nextIdValue
-    nextIdValue += 1
-    return result
-

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/IDLTools.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/IDLTools.coffee b/weinre.web/modules/weinre/common/IDLTools.coffee
new file mode 100644
index 0000000..a989836
--- /dev/null
+++ b/weinre.web/modules/weinre/common/IDLTools.coffee
@@ -0,0 +1,112 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+Ex       = require('./Ex')
+Callback = require('./Callback')
+
+IDLs = {}
+
+#-------------------------------------------------------------------------------
+module.exports = class IDLTools
+
+    #---------------------------------------------------------------------------
+    constructor: ->
+        throw new Ex(arguments, "this class is not intended to be instantiated")
+
+    #---------------------------------------------------------------------------
+    @addIDLs: (idls) ->
+        for idl in idls
+            for intf in idl.interfaces
+                IDLs[intf.name] = intf
+                intf.module = idl.name
+
+    #---------------------------------------------------------------------------
+    @getIDL: (name) ->
+        IDLs[name]
+
+    #---------------------------------------------------------------------------
+    @getIDLsMatching: (regex) ->
+        results = []
+
+        for intfName of IDLs
+            intf = IDLs[intfName]
+            results.push intf if intfName.match(regex)
+
+        results
+
+    #---------------------------------------------------------------------------
+    @validateAgainstIDL: (klass, interfaceName) ->
+        intf          = IDLTools.getIDL(interfaceName)
+        messagePrefix = "IDL validation for #{interfaceName}: "
+        if null == intf
+            throw new Ex(arguments, messagePrefix + "idl not found: '#{interfaceName}'")
+
+        errors = []
+        for intfMethod in intf.methods
+            classMethod = klass::[intfMethod.name]
+            printName = klass.name + "::" + intfMethod.name
+
+            if null == classMethod
+                errors.push messagePrefix + "method not implemented: '#{printName}'"
+                continue
+
+            unless classMethod.length == intfMethod.parameters.length
+                unless classMethod.length == intfMethod.parameters.length + 1
+                    errors.push messagePrefix + "wrong number of parameters: '#{printName}'"
+                    continue
+
+        for propertyName of klass::
+            continue if klass::hasOwnProperty(propertyName)
+            continue if propertyName.match(/^_.*/)
+            printName = klass.name + "::" + propertyName
+
+            unless intf.methods[propertyName]
+                errors.push messagePrefix + "method should not be implemented: '#{printName}'"
+                continue
+
+        return unless errors.length
+
+        for error in errors
+            require("./Weinre").logError error
+
+    #---------------------------------------------------------------------------
+    @buildProxyForIDL: (proxyObject, interfaceName) ->
+        intf = IDLTools.getIDL(interfaceName)
+        messagePrefix = "building proxy for IDL #{interfaceName}: "
+
+        if null == intf
+            throw new Ex(arguments, messagePrefix + "idl not found: '#{interfaceName}'")
+
+        for intfMethod in intf.methods
+            proxyObject[intfMethod.name] = getProxyMethod(intf, intfMethod)
+
+#-------------------------------------------------------------------------------
+getProxyMethod = (intf, method) ->
+      result = proxyMethod = ->
+
+          callbackId = null
+          args = [].slice.call(arguments)
+
+          if args.length > 0
+              if typeof args[args.length - 1] == "function"
+                  callbackId = Callback.register(args[args.length - 1])
+                  args = args.slice(0, args.length - 1)
+
+          while args.length < method.parameters.length
+              args.push null
+
+          args.push callbackId
+          @__invoke intf.name, method.name, args
+
+      result.displayName = intf.name + "__" + method.name
+
+      result
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/IDLTools.scoop
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/IDLTools.scoop b/weinre.web/modules/weinre/common/IDLTools.scoop
deleted file mode 100644
index 9dcbe7a..0000000
--- a/weinre.web/modules/weinre/common/IDLTools.scoop
+++ /dev/null
@@ -1,123 +0,0 @@
-
-/*
- * weinre is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- * 
- * Copyright (c) 2010, 2011 IBM Corporation
- */
-
-requireClass ./Ex
-requireClass ./Callback
-
-//-----------------------------------------------------------------------------
-class IDLTools
-    throw new Ex(arguments, "this class is not intended to be instantiated")
-
-//-----------------------------------------------------------------------------
-init
-    var IDLs = {}
-    IDLTools._idls = IDLs
-
-//-----------------------------------------------------------------------------
-static method addIDLs(idls)
-    idls.forEach(function(idl){
-        idl.interfaces.forEach(function(intf){
-            IDLs[intf.name] = intf
-            intf.module = idl.name
-        })
-    })
-
-//-----------------------------------------------------------------------------
-static method getIDL(name)
-    return IDLs[name]
-
-//-----------------------------------------------------------------------------
-static method getIDLsMatching(regex)
-    var results = []
-    
-    for (var intfName in IDLs) {
-        var intf = IDLs[intfName]
-        if (intfName.match(regex)) {
-            results.push(intf)
-        }
-    }
-    return results
-
-//-----------------------------------------------------------------------------
-static method validateAgainstIDL(klass, interfaceName)
-    var intf = IDLTools.getIDL(interfaceName)
-    var messagePrefix = "IDL validation for " + interfaceName + ": "
-    if (null == intf) throw new Ex(arguments, messagePrefix + "idl not found: '" + interfaceName + "'")
-    
-    var errors = []
-    // check that class implements all the methods
-    intf.methods.forEach(function(intfMethod) {
-        var classMethod  = klass.prototype[intfMethod.name]
-        var printName    = klass.name + "::" + intfMethod.name
-        
-        if (null == classMethod) {
-            errors.push(messagePrefix + "method not implemented: '" + printName + "'")
-            return
-        }
-
-        if (classMethod.length != intfMethod.parameters.length) {
-            if (classMethod.length != intfMethod.parameters.length + 1) {
-                errors.push(messagePrefix + "wrong number of parameters: '" + printName + "'")
-                return
-            }
-        }
-    })
-    
-    // check that class doesn't implement extra methods
-    for (var propertyName in klass.prototype) {
-        if (klass.prototype.hasOwnProperty(propertyName)) continue
-        if (propertyName.match(/^_.*/)) continue
-        
-        var printName = klass.name + "::" + propertyName
-        
-        if (!intf.methods[propertyName]) {
-            errors.push(messagePrefix + "method should not be implemented: '" + printName + "'")
-            continue
-        }
-    }
-    
-    if (!errors.length) return
-    
-    errors.forEach(function(error){
-        require("./Weinre").getClass().logError(error)
-    })
-
-//-----------------------------------------------------------------------------
-static method buildProxyForIDL(proxyObject, interfaceName)
-    var intf = IDLTools.getIDL(interfaceName)
-    var messagePrefix = "building proxy for IDL " + interfaceName + ": "
-    if (null == intf) throw new Ex(arguments, messagePrefix + "idl not found: '" + interfaceName + "'")
-    
-    intf.methods.forEach(function(intfMethod) {
-        proxyObject[intfMethod.name] = getProxyMethod(intf, intfMethod)
-    })
-
-//-----------------------------------------------------------------------------
-function getProxyMethod(intf, method)
-    var result = function proxyMethod() {
-        var callbackId = null
-        var args       = [].slice.call(arguments)
-        
-        if (args.length > 0) {
-            if (typeof args[args.length-1] == "function") {
-                callbackId   = Callback.register(args[args.length-1])
-                args         = args.slice(0, args.length-1)
-            }
-        }
-        
-        while (args.length < method.parameters.length) {
-            args.push(null)
-        }
-        
-        args.push(callbackId)
-
-        this.__invoke(intf.name, method.name, args)
-    }
-    
-    result.displayName = intf.name + "__" + method.name
-    return result

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/9f1c7663/weinre.web/modules/weinre/common/MessageDispatcher.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/common/MessageDispatcher.coffee b/weinre.web/modules/weinre/common/MessageDispatcher.coffee
new file mode 100644
index 0000000..5f1a4be
--- /dev/null
+++ b/weinre.web/modules/weinre/common/MessageDispatcher.coffee
@@ -0,0 +1,179 @@
+
+#---------------------------------------------------------------------------------
+# weinre is available under *either* the terms of the modified BSD license *or* the
+# MIT License (2008). See http:#opensource.org/licenses/alphabetical for full text.
+#
+# Copyright (c) 2010, 2011 IBM Corporation
+#---------------------------------------------------------------------------------
+
+Weinre       = require('./Weinre')
+WebSocketXhr = require('./WebSocketXhr')
+IDLTools     = require('./IDLTools')
+Binding      = require('./Binding')
+Ex           = require('./Ex')
+Callback     = require('./Callback')
+
+Verbose = false
+InspectorBackend = null
+
+#-------------------------------------------------------------------------------
+module.exports = class MessageDispatcher
+
+    #---------------------------------------------------------------------------
+    constructor: (url, id) ->
+        id = "anonymous" unless id
+        @_url = url
+        @_id = id
+        @error = null
+        @_opening = false
+        @_opened = false
+        @_closed = false
+        @_interfaces = {}
+        @_open()
+
+    #---------------------------------------------------------------------------
+    @setInspectorBackend: (inspectorBackend) ->
+        InspectorBackend = inspectorBackend
+
+    #---------------------------------------------------------------------------
+    @verbose: (value) ->
+        Verbose = not not value if arguments.length >= 1
+        Verbose
+
+    #---------------------------------------------------------------------------
+    _open: ->
+        return if @_opened or @_opening
+        throw new Ex(arguments, "socket has already been closed") if @_closed
+        @_opening = true
+        @_socket = new WebSocketXhr(@_url, @_id)
+        @_socket.addEventListener "open", Binding(this, "_handleOpen")
+        @_socket.addEventListener "error", Binding(this, "_handleError")
+        @_socket.addEventListener "message", Binding(this, "_handleMessage")
+        @_socket.addEventListener "close", Binding(this, "_handleClose")
+
+    #---------------------------------------------------------------------------
+    close: ->
+        return if @_closed
+        @_opened = false
+        @_closed = true
+        @_socket.close()
+
+    #---------------------------------------------------------------------------
+    send: (data) ->
+        @_socket.send data
+
+    #---------------------------------------------------------------------------
+    getWebSocket: ->
+        @_socket
+
+    #---------------------------------------------------------------------------
+    registerInterface: (intfName, intf, validate) ->
+        if validate
+            IDLTools.validateAgainstIDL intf.constructor, intfName
+
+        if @_interfaces[intfName]
+            throw new Ex(arguments, "interface #{intfName} has already been registered")
+
+        @_interfaces[intfName] = intf
+
+    #---------------------------------------------------------------------------
+    createProxy: (intfName) ->
+        proxy = {}
+        IDLTools.buildProxyForIDL proxy, intfName
+        self = this
+
+        proxy.__invoke = __invoke = (intfName, methodName, args) ->
+            self._sendMethodInvocation intfName, methodName, args
+
+        proxy
+
+    #---------------------------------------------------------------------------
+    _sendMethodInvocation: (intfName, methodName, args) ->
+        unless typeof intfName == "string"
+            throw new Ex(arguments, "expecting intf parameter to be a string")
+
+        unless typeof methodName == "string"
+            throw new Ex(arguments, "expecting method parameter to be a string")
+
+        data =
+            interface: intfName
+            method:    methodName
+            args:      args
+
+        data = JSON.stringify(data)
+        @_socket.send data
+
+        if Verbose
+            Weinre.logDebug @constructor.name + "[#{@_url}]: send #{intfName}.#{methodName}(#{JSON.stringify(args)})"
+
+    #---------------------------------------------------------------------------
+    getState: ->
+        return "opening" if @_opening
+        return "opened"  if @_opened
+        return "closed"  if @_closed
+        "unknown"
+
+    #---------------------------------------------------------------------------
+    isOpen: ->
+        @_opened == true
+
+    #---------------------------------------------------------------------------
+    _handleOpen: (event) ->
+        @_opening = false
+        @_opened = true
+        @channel = event.channel
+        Callback.setConnectorChannel @channel
+
+        if Verbose
+            Weinre.logDebug @constructor.name + "[#{@_url}]: opened"
+
+    #---------------------------------------------------------------------------
+    _handleError: (message) ->
+        @error = message
+        @close()
+
+        if Verbose
+            Weinre.logDebug @constructor.name + "[#{@_url}]: error: " + message
+
+    #---------------------------------------------------------------------------
+    _handleMessage: (message) ->
+        try
+            data = JSON.parse(message.data)
+        catch e
+            throw new Ex(arguments, "invalid JSON data received: #{e}: '#{message.data}'")
+
+        intfName = data["interface"]
+        methodName = data.method
+        args = data.args
+        methodSignature = intfName + ".#{methodName}()"
+        intf = @_interfaces.hasOwnProperty(intfName) and @_interfaces[intfName]
+
+        if not intf and InspectorBackend and intfName.match(/.*Notify/)
+            intf = InspectorBackend.getRegisteredDomainDispatcher(intfName.substr(0, intfName.length - 6))
+
+        unless intf
+            Weinre.logWarning "weinre: request for non-registered interface:" + methodSignature
+            return
+
+        methodSignature = intf.constructor.name + ".#{methodName}()"
+        method = intf[methodName]
+
+        unless typeof method == "function"
+            Weinre.notImplemented methodSignature
+            return
+        try
+            method.apply intf, args
+        catch e
+            Weinre.logError "weinre: invocation exception on #{methodSignature}: " + e
+
+        if Verbose
+            Weinre.logDebug @constructor.name + "[#{@_url}]: recv #{intfName}.#{methodName}(#{JSON.stringify(args)})"
+
+    #---------------------------------------------------------------------------
+    _handleClose: ->
+        @_reallyClosed = true
+        if Verbose
+            Weinre.logDebug @constructor.name + "[#{@_url}]: closed"
+
+#-------------------------------------------------------------------------------
+require("../common/MethodNamer").setNamesForClass(module.exports)