Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B33C1D666 for ; Fri, 24 May 2013 15:46:23 +0000 (UTC) Received: (qmail 33239 invoked by uid 500); 24 May 2013 15:46:23 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 33192 invoked by uid 500); 24 May 2013 15:46:23 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 33162 invoked by uid 99); 24 May 2013 15:46:23 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 May 2013 15:46:23 +0000 Date: Fri, 24 May 2013 15:46:23 +0000 (UTC) From: "Ilya (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CB-3503) Incorrect way of message processing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-3503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ilya updated CB-3503: --------------------- Description: Steps to reproduce: 1) Create html file: {code} Insert title here

Hello World!

{code} 2. Add cordova-2.7.0.js in the same directory 3. Open newly created file in chrome 4. The prompt alert will be shown !prompt.png! -> press "Ok" -> cordova.js will trap in endless loop NOTE: the root of the problem is pretty obvious - incorrect while cycle (lines 988 - 1009) {code} while (messagesFromNative.length) { // Don't unshift until the end so that reentrancy can be detected. messages = messagesFromNative[0]; // The Java side can send a * message to indicate that it // still has messages waiting to be retrieved. if (messages == '*') { messagesFromNative.shift(); window.setTimeout(pollOnce, 0); return; } var spaceIdx = messages.indexOf(' '); var msgLen = +messages.slice(0, spaceIdx); var message = messages.substr(spaceIdx + 1, msgLen); messages = messages.slice(spaceIdx + msgLen + 1); processMessage(message); if (messages) { messagesFromNative[0] = messages; } else { messagesFromNative.shift(); } } {code} was: Steps to reproduce: 1) Create html file: {code} Insert title here

Hello World!

{code} 2. Add cordova-2.7.0.js in the same directory 3. Open newly created file in chrome 4. The prompt alert will be shown prompt.png -> press "Ok" -> cordova.js will trap in endless loop NOTE: the root of the problem is pretty obvious - incorrect while cycle (lines 988 - 1009) {code} while (messagesFromNative.length) { // Don't unshift until the end so that reentrancy can be detected. messages = messagesFromNative[0]; // The Java side can send a * message to indicate that it // still has messages waiting to be retrieved. if (messages == '*') { messagesFromNative.shift(); window.setTimeout(pollOnce, 0); return; } var spaceIdx = messages.indexOf(' '); var msgLen = +messages.slice(0, spaceIdx); var message = messages.substr(spaceIdx + 1, msgLen); messages = messages.slice(spaceIdx + msgLen + 1); processMessage(message); if (messages) { messagesFromNative[0] = messages; } else { messagesFromNative.shift(); } } {code} > Incorrect way of message processing > ----------------------------------- > > Key: CB-3503 > URL: https://issues.apache.org/jira/browse/CB-3503 > Project: Apache Cordova > Issue Type: Bug > Components: CordovaJS > Affects Versions: 2.7.0 > Reporter: Ilya > Assignee: Filip Maj > Attachments: prompt.png > > > Steps to reproduce: > 1) Create html file: > {code} > > > > > > Insert title here > > >

Hello World!

> > > {code} > 2. Add cordova-2.7.0.js in the same directory > 3. Open newly created file in chrome > 4. The prompt alert will be shown !prompt.png! -> press "Ok" -> cordova.js will trap in endless loop > NOTE: the root of the problem is pretty obvious - incorrect while cycle (lines 988 - 1009) > {code} > while (messagesFromNative.length) { > // Don't unshift until the end so that reentrancy can be detected. > messages = messagesFromNative[0]; > // The Java side can send a * message to indicate that it > // still has messages waiting to be retrieved. > if (messages == '*') { > messagesFromNative.shift(); > window.setTimeout(pollOnce, 0); > return; > } > var spaceIdx = messages.indexOf(' '); > var msgLen = +messages.slice(0, spaceIdx); > var message = messages.substr(spaceIdx + 1, msgLen); > messages = messages.slice(spaceIdx + msgLen + 1); > processMessage(message); > if (messages) { > messagesFromNative[0] = messages; > } else { > messagesFromNative.shift(); > } > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira