Add Cursor._warnIfExecuted tests.
Add Cursor._executeQuery test (before execution).
Add Cursor._executeQuery after execution test.
Fix async bug in cursor.next/hasNext.

The methods were returning instantly when they should have been waiting
for the callback to finish. The associated AJAX calls were made
synchronous to compensate.

A few other bugs and code cleanup also took place.

The tests were updated accordingly, but note they need to be made more
robust as _executeQuery has additional functionality.