Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2017-02-10 14:08:18 +0000
committerGerrit Code Review @ Eclipse.org2017-02-23 08:55:45 +0000
commit2246ec8a5e92a28f29f9b441b02358cb0a06382b (patch)
tree2194c02aa326e6e4db7860ff8c3438f629bccbf9
parentfa38fe28c63a6e35de2e673541a4978ff87e8332 (diff)
downloadorg.eclipse.rap-2246ec8a5e92a28f29f9b441b02358cb0a06382b.tar.gz
org.eclipse.rap-2246ec8a5e92a28f29f9b441b02358cb0a06382b.tar.xz
org.eclipse.rap-2246ec8a5e92a28f29f9b441b02358cb0a06382b.zip
Don't send ServerPush requests with a timer
The timer for sending ServerPush requests has been introduced as a workaround for bug 353819. All recent (supported by RAP) WebKit browsers (including iOS Safary) now have this issue fixed. Remove the workaround as it's not needed anymore. 508727: Consider not using a Timer to send ServerPush https://bugs.eclipse.org/bugs/show_bug.cgi?id=508727 Change-Id: I3ea830d62c1f45528ea8d2d46517037b6c8f74c1
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/client/ServerPush.js12
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ServerPushTest.js10
2 files changed, 8 insertions, 14 deletions
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/client/ServerPush.js b/bundles/org.eclipse.rap.rwt/js/rwt/client/ServerPush.js
index 149c711f9e..69c54544a1 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/client/ServerPush.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/client/ServerPush.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2016 EclipseSource and others.
+ * Copyright (c) 2011, 2017 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,8 +15,6 @@ rwt.client.ServerPush = function() {
this._retryCount = 0;
this._active = false;
this._running = false;
- this._requestTimer = new rwt.client.Timer( 0 );
- this._requestTimer.addEventListener( "interval", this._doSendServerPushRequest, this );
};
rwt.client.ServerPush.getInstance = function() {
@@ -32,16 +30,10 @@ rwt.client.ServerPush.prototype = {
sendServerPushRequest : function() {
if( this._active && !this._running ) {
this._running = true;
- this._requestTimer.start();
+ this._createRequest().send();
}
},
- // workaround for bug 353819 - send ServerPushRequest with a timer
- _doSendServerPushRequest : function() {
- this._requestTimer.stop();
- this._createRequest().send();
- },
-
_createRequest : function() {
var connection = rwt.remote.Connection.getInstance();
var request = new rwt.remote.Request( connection.getUrl(), "GET", "application/javascript" );
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ServerPushTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ServerPushTest.js
index 4c4e0cfd36..f170705652 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ServerPushTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ServerPushTest.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 EclipseSource and others.
+ * Copyright (c) 2011, 2017 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -62,16 +62,18 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.ServerPushTest", {
serverPush.sendServerPushRequest();
- assertFalse( serverPush._requestTimer.getEnabled() );
+ assertFalse( serverPush._running );
},
testSendServerPushRequest_sendsUIRequest : function() {
- TestUtil.initRequestLog();
var serverPush = ServerPush.getInstance();
serverPush.setActive( true );
+ TestUtil.initRequestLog();
+ TestUtil.scheduleResponse( function() {
+ serverPush.setActive( false );
+ });
serverPush.sendServerPushRequest();
- TestUtil.forceInterval( serverPush._requestTimer );
assertEquals( 2, TestUtil.getRequestsSend() );
},

Back to the top