refactor(management): move handlers and server to separate files

Handlers and server-starting code will be shared by the runserver
command and the customized LiveServerTestCase.
feat(document): allow Firefox to open editor

Add Firefox to allowed browser in the editor browser-check script.
test(document): create working Selenium tests

Selenium tests will be needed for thorough testing of editor behavior in
Firefox. Two simplest-possible caret tests are added in document.tests.

The tests use LiveTornadoTestCase, which is Django's LiveServerTestCase
customized to run a Tornado server, using the code earlier refactored
from base.management.commands.runserver.

Additionally, javascript helper functions are added in the newly created
test folder. They are passed as a python string to Selenium to execute
inside the browser.
fix(test): add the required license text to Django code

test.testcases.LiveTornadoTestCase and LiveTornadoThread are almost
entirely code from the original Django LiveServerTestCase. Using that
code requires presence of the Django license.
Thanks @maciej-filip-sz ! This switches to your selenium testing setup, also for Chrome testing.