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/02/29 01:02:06 UTC
weinre commit: fix a number of error conditions
Updated Branches:
refs/heads/master e455568d9 -> f4a798cfb
fix a number of error conditions
bug: https://issues.apache.org/jira/browse/CB-284
invocation exception on WeinreClientEventsImpl.connectionCreated(): \
TypeError: Cannot read property 'url' of undefined
The original problem logged in this issue was just one of the
problems fixed. There were a handful of others. Added
error checking where I could, and where I couldn't, I changed
the logger to not display a warning message (bug in Web Inspector).
Drive-by fixes for:
- changing the sequence number of channels to start at 1 instead
of a random number. Note that the primary reason to use a
random number is to because the server can get confused
when you start/stop but have clients/targets that try to
reconnect with the same channel number. Not a problem at all
in deployment, but a hassle at development time - or used to
be. I'm going to try turning the 'random' off and see how
it goes.
- dump the pid at startup when in verbose mode; making it
easier to run top/dtrace/etc.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/commit/f4a798cf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/tree/f4a798cf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/diff/f4a798cf
Branch: refs/heads/master
Commit: f4a798cfb08b28897a7aa75b0dbf874df77e9a0a
Parents: e455568
Author: Patrick Mueller <pm...@apache.org>
Authored: Tue Feb 28 18:38:30 2012 -0500
Committer: Patrick Mueller <pm...@apache.org>
Committed: Tue Feb 28 18:38:30 2012 -0500
----------------------------------------------------------------------
weinre.server/lib/utils.coffee | 2 +-
weinre.server/lib/weinre.coffee | 15 +++++++------
weinre.server/weinre-hot | 2 +-
.../weinre/client/WeinreClientEventsImpl.coffee | 16 +++++++++-----
.../modules/weinre/common/MessageDispatcher.coffee | 9 +++++++-
weinre.web/modules/weinre/target/NodeStore.coffee | 3 +-
.../modules/weinre/target/WiRuntimeImpl.coffee | 2 +-
7 files changed, 31 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/f4a798cf/weinre.server/lib/utils.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/utils.coffee b/weinre.server/lib/utils.coffee
index 39bc5ab..2225d22 100644
--- a/weinre.server/lib/utils.coffee
+++ b/weinre.server/lib/utils.coffee
@@ -24,7 +24,7 @@ utils = exports
utils.Program = Program = path.basename process.argv[1]
SequenceNumberMax = 100 * 1024 * 1024
-SequenceNumber = Math.floor(Math.random() * SequenceNumberMax)
+SequenceNumber = 0
#-------------------------------------------------------------------------------
utils.getNextSequenceNumber = (g) ->
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/f4a798cf/weinre.server/lib/weinre.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/weinre.coffee b/weinre.server/lib/weinre.coffee
index a334596..6027d05 100644
--- a/weinre.server/lib/weinre.coffee
+++ b/weinre.server/lib/weinre.coffee
@@ -61,13 +61,14 @@ processOptions = (options, cb) ->
options.staticWebDir = getStaticWebDir()
- utils.logVerbose "version: #{getVersion()}"
- utils.logVerbose "option httpPort: #{options.httpPort}"
- utils.logVerbose "option boundHost: #{options.boundHost}"
- utils.logVerbose "option verbose: #{options.verbose}"
- utils.logVerbose "option debug: #{options.debug}"
- utils.logVerbose "option readTimeout: #{options.readTimeout}"
- utils.logVerbose "option deathTimeout: #{options.deathTimeout}"
+ utils.logVerbose "pid: #{process.pid}"
+ utils.logVerbose "version: #{getVersion()}"
+ utils.logVerbose "option httpPort: #{options.httpPort}"
+ utils.logVerbose "option boundHost: #{options.boundHost}"
+ utils.logVerbose "option verbose: #{options.verbose}"
+ utils.logVerbose "option debug: #{options.debug}"
+ utils.logVerbose "option readTimeout: #{options.readTimeout}"
+ utils.logVerbose "option deathTimeout: #{options.deathTimeout}"
utils.setOptions options
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/f4a798cf/weinre.server/weinre-hot
----------------------------------------------------------------------
diff --git a/weinre.server/weinre-hot b/weinre.server/weinre-hot
index cce978b..700e780 100755
--- a/weinre.server/weinre-hot
+++ b/weinre.server/weinre-hot
@@ -25,6 +25,6 @@
# to determine whether to kill and restart the server.
cd `dirname $0`
-supervisor -n -p 1 -e txt -w ../weinre.build/out/build-done.txt node weinre
+supervisor -n -p 1 -e txt -w ../weinre.build/out/build-done.txt -- weinre $*
# supervisor: https://github.com/isaacs/node-supervisor
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/f4a798cf/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
index 8fcec0d..5152771 100644
--- a/weinre.web/modules/weinre/client/WeinreClientEventsImpl.coffee
+++ b/weinre.web/modules/weinre/client/WeinreClientEventsImpl.coffee
@@ -56,9 +56,10 @@ module.exports = class WeinreClientEventsImpl
#---------------------------------------------------------------------------
connectionCreated: (clientChannel, targetChannel) ->
- if @client.uiAvailable()
- WebInspector.panels.remote.setClientState clientChannel, "connected"
- WebInspector.panels.remote.setTargetState targetChannel, "connected"
+ return if !@client.uiAvailable()
+
+ WebInspector.panels.remote.setClientState clientChannel, "connected"
+ WebInspector.panels.remote.setTargetState targetChannel, "connected"
return unless clientChannel == Weinre.messageDispatcher.channel
@@ -67,6 +68,8 @@ module.exports = class WeinreClientEventsImpl
WebInspector.panels.resources.reset()
target = WebInspector.panels.remote.getTarget(targetChannel)
+ return if !target
+
document.title = titleConnectedPrefix + target.url
WebInspector.inspectedURLChanged target.url
@@ -75,9 +78,10 @@ module.exports = class WeinreClientEventsImpl
#---------------------------------------------------------------------------
connectionDestroyed: (clientChannel, targetChannel) ->
- if @client.uiAvailable()
- WebInspector.panels.remote.setClientState clientChannel, "not-connected"
- WebInspector.panels.remote.setTargetState targetChannel, "not-connected"
+ return if !@client.uiAvailable()
+
+ WebInspector.panels.remote.setClientState clientChannel, "not-connected"
+ WebInspector.panels.remote.setTargetState targetChannel, "not-connected"
return unless clientChannel == Weinre.messageDispatcher.channel
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/f4a798cf/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
index 404a951..37a0cc4 100644
--- a/weinre.web/modules/weinre/common/MessageDispatcher.coffee
+++ b/weinre.web/modules/weinre/common/MessageDispatcher.coffee
@@ -149,6 +149,12 @@ module.exports = class MessageDispatcher
#---------------------------------------------------------------------------
_handleMessage: (message) ->
+ skipErrorForMethods = [
+ 'domContentEventFired'
+ 'loadEventFired'
+ 'childNodeRemoved'
+ ]
+
try
data = JSON.parse(message.data)
catch e
@@ -176,7 +182,8 @@ module.exports = class MessageDispatcher
try
method.apply intf, args
catch e
- Weinre.logError "weinre: invocation exception on #{methodSignature}: " + e
+ if methodName not in skipErrorForMethods
+ Weinre.logError "weinre: invocation exception on #{methodSignature}: " + e
if Verbose
Weinre.logDebug @constructor.name + "[#{@_url}]: recv #{intfName}.#{methodName}(#{JSON.stringify(args)})"
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/f4a798cf/weinre.web/modules/weinre/target/NodeStore.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/target/NodeStore.coffee b/weinre.web/modules/weinre/target/NodeStore.coffee
index b12fe1f..c80339c 100644
--- a/weinre.web/modules/weinre/target/NodeStore.coffee
+++ b/weinre.web/modules/weinre/target/NodeStore.coffee
@@ -202,7 +202,8 @@ handleDOMNodeRemoved = (event) ->
return unless parentId
if targetId
- Weinre.wi.DOMNotify.childNodeRemoved parentId, targetId
+ if parentId
+ Weinre.wi.DOMNotify.childNodeRemoved parentId, targetId
else
childCount = Weinre.nodeStore.childNodeCount(event.relatedNode)
Weinre.wi.DOMNotify.childNodeCountUpdated parentId, childCount
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/f4a798cf/weinre.web/modules/weinre/target/WiRuntimeImpl.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/target/WiRuntimeImpl.coffee b/weinre.web/modules/weinre/target/WiRuntimeImpl.coffee
index 7a1584c..51b9b3e 100644
--- a/weinre.web/modules/weinre/target/WiRuntimeImpl.coffee
+++ b/weinre.web/modules/weinre/target/WiRuntimeImpl.coffee
@@ -53,7 +53,7 @@ module.exports = class WiRuntimeImpl
#---------------------------------------------------------------------------
releaseWrapperObjectGroup: (injectedScriptId, objectGroup, callback) ->
- result = Weinre.injectedScript.releaseWrapperObjectGroup(objectGroupName)
+ result = Weinre.injectedScript.releaseWrapperObjectGroup(objectGroup)
if callback
Weinre.WeinreTargetCommands.sendClientCallback callback, [ result ]