Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Modified the onNegotiated event to not allow setting modification

- Also modified the NegotiateFacts.js to account for not being able to
modify the settings

#1638
  • Loading branch information...
commit 498122b327cab49c4ac19124c43cba6bf96d7b41 1 parent aa85c01
@NTaylorMullen NTaylorMullen authored
View
3  src/Microsoft.AspNet.SignalR.Client.JS/jquery.signalR.core.js
@@ -673,7 +673,8 @@
return;
}
- $(connection).triggerHandler(events.onNegotiated, res);
+ // Copy the res settings, this is so users cannot modify the settings
+ $(connection).triggerHandler(events.onNegotiated, $.extend({}, res));
keepAliveData = connection.keepAliveData;
connection.appRelativeUrl = res.Url;
View
8 tests/Microsoft.AspNet.SignalR.Client.JS.Tests/Tests/FunctionalTests/Core/NegotiateFacts.js
@@ -141,16 +141,18 @@
};
});
- QUnit.asyncTimeoutTest(transport + " transport's onNegotiated event allows modification of settings.", testUtilities.defaultTestTimeout, function (end, assert, testName) {
- var connection = testUtilities.createConnection("signalr", testName);
+ QUnit.asyncTimeoutTest(transport + " transport's onNegotiated event does not allow permanent modification of settings.", testUtilities.defaultTestTimeout, function (end, assert, testName) {
+ var connection = testUtilities.createConnection("signalr", testName),
+ originalConnectionId;
connection.negotiated(function (settings) {
+ originalConnectionId = settings.ConnectionId;
settings.ConnectionId = "Foo";
});
// Using the starting event because this occurs prior to any transports starting, therefore we can end execution.
connection.starting(function () {
- assert.equal(connection.id, "Foo", "Connection ID was successfully modified to 'Foo'");
+ assert.equal(connection.id, originalConnectionId, "Connection ID was unsuccessfully modified and maintained its original value (" + originalConnectionId + ")");
end();
});
Please sign in to comment.
Something went wrong with that request. Please try again.