From: Artur Signell Date: Mon, 19 Aug 2013 15:27:35 +0000 (+0300) Subject: Search only remaining message for delimiter (#12404) X-Git-Tag: 7.1.4~34 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=61dbe9caa1daee4ce2ddddc38de1ec604c464ef5;p=vaadin-framework.git Search only remaining message for delimiter (#12404) Change-Id: I0d61984aa795ec2b3bd384c2f93f6e3ee2a71be3 --- diff --git a/WebContent/VAADIN/jquery.atmosphere.js b/WebContent/VAADIN/jquery.atmosphere.js index b2dd99f5d2..b6f86d428a 100644 --- a/WebContent/VAADIN/jquery.atmosphere.js +++ b/WebContent/VAADIN/jquery.atmosphere.js @@ -1213,9 +1213,13 @@ jQuery.atmosphere = function() { messageLength = jQuery.trim(message.substring(messageLength, messageStart)); message = message.substring(messageStart + request.messageDelimiter.length, message.length); + // Stop search if there is not enough characters remaining (wait for next part to arrive) if (message.length == 0 || message.length < messageLength) break; - messageStart = message.indexOf(request.messageDelimiter); + // Find start of a possibly existing subsequent message from the remaining data + messageStart = message.substring(messageLength).indexOf(request.messageDelimiter); + + // Store the completely received message messages.push(message.substring(0, messageLength)); } diff --git a/uitest/src/com/vaadin/tests/push/BarInUIDL.html b/uitest/src/com/vaadin/tests/push/BarInUIDL.html new file mode 100644 index 0000000000..66f03158b6 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/BarInUIDL.html @@ -0,0 +1,42 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run-push/com.vaadin.tests.push.BarInUIDL?restartApplication
clickvaadin=runpushcomvaadintestspushBarInUIDL::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]
assertTextvaadin=runpushcomvaadintestspushBarInUIDL::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]Thank you for clicking | bar
clickvaadin=runpushcomvaadintestspushBarInUIDL::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]
assertTextvaadin=runpushcomvaadintestspushBarInUIDL::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VLabel[0]Thank you for clicking | bar
+ + diff --git a/uitest/src/com/vaadin/tests/push/BarInUIDL.java b/uitest/src/com/vaadin/tests/push/BarInUIDL.java new file mode 100644 index 0000000000..7e414cc89d --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/BarInUIDL.java @@ -0,0 +1,66 @@ +/* + * Copyright 2000-2013 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package com.vaadin.tests.push; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Label; + +public class BarInUIDL extends AbstractTestUI { + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + Button button = new Button("Click Me"); + button.addClickListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + addComponent(new Label("Thank you for clicking | bar")); + } + }); + addComponent(button); + + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Verify that there is no problem with messages containing | by clicking the button repeatedly"; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 12404; + } + +}