You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Ilya (JIRA)" <ji...@apache.org> on 2013/05/24 17:38:20 UTC
[jira] [Created] (CB-3503) Incorrect way of
Ilya created CB-3503:
------------------------
Summary: Incorrect way of
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
Steps to reproduce:
1) Create html file:
{code}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="cordova-2.7.0.js"></script>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
{code}
2. Add cordova-2.7.0.js at the same directory
3. Open newly created file in chrome
4. The prompt alert will be shown -> 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