Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E37A79D1A for ; Wed, 29 Feb 2012 00:02:31 +0000 (UTC) Received: (qmail 33078 invoked by uid 500); 29 Feb 2012 00:02:31 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 33062 invoked by uid 500); 29 Feb 2012 00:02:31 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 33048 invoked by uid 99); 29 Feb 2012 00:02:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Feb 2012 00:02:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.114] (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Feb 2012 00:02:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A513C4CC7C; Wed, 29 Feb 2012 00:02:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pmuellr@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: weinre commit: fix a number of error conditions Message-Id: <20120229000206.A513C4CC7C@tyr.zones.apache.org> Date: Wed, 29 Feb 2012 00:02:06 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org 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 Authored: Tue Feb 28 18:38:30 2012 -0500 Committer: Patrick Mueller 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 ]