Move context request from xhr.js to network.js
Clean up

Get rid of duplicate state held in top level variables and within context.
publish context_info with the full updated context, not just the passed in context.
Add is* functions to helpers, use isObject to ensure setContext is called with valid parameters.

* add isArray, isFunction, isObject, isString
Clear all timeouts between tests to prevent cross-test pollution.
Update with suggestions made by @6a68. Thanks man!
Merge pull request #3667 from shane-tomlinson/issue_3666_context_out_of_xhr

Issue 3666 context out of xhr

@6a68 gave the r+. Backend tests pass. Selenium tests pass. Frontend tests pass. Merging.