Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore responses to missing remote calls. #87

Merged
merged 2 commits into from
Aug 24, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions nevow/js/Nevow/Athena/__init__.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ Nevow.Athena.PageWidget.methods(
var d = self.remoteCalls[responseId];
delete self.remoteCalls[responseId];

if (d === undefined) {
// If the transport is running then something strange has happened,
// otherwise just do nothing.
if (self.deliveryChannel.running) {
Divmod.msg('Received response to missing call: ' + responseId);
Copy link
Contributor

@mithrandi mithrandi Aug 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"missing call" is a little mysterious if you're not deeply familiar with this bit of the code already; how about "unknown or already-responded call" instead?

}
return;
}

if (success) {
d.callback(result);
} else {
Expand Down
9 changes: 9 additions & 0 deletions nevow/js/Nevow/Test/TestWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ Nevow.Test.TestWidget.PageWidgetTests.methods(
self.assertIdentical(innerResult, RESULT);
},

/**
* Trying to respond to a missing call doesn't explode.
*/
function test_respondMissingCall(self) {
var OPAQUE_ID = "opaque test remote call id";
var RESULT = "opaque test result";
self.page.action_respond(OPAQUE_ID, true, RESULT);
},

/**
* Test that the 'noop' action does nothing, so the server can ping us.
*/
Expand Down