function LiveDocument(protocol, urlResolver, doc, editor, roots) {
        this.protocol = protocol;
        this.urlResolver = urlResolver;
        this.doc = doc;
        this.roots = roots || [];

        this._onActiveEditorChange = this._onActiveEditorChange.bind(this);
        this._onCursorActivity = this._onCursorActivity.bind(this);
        this._onHighlightPrefChange = this._onHighlightPrefChange.bind(this);

        EditorManager.on("activeEditorChange", this._onActiveEditorChange);

        PreferencesManager.stateManager.getPreference("livedev.highlight")
            .on("change", this._onHighlightPrefChange);

        // Redraw highlights when window gets focus. This ensures that the highlights
        // will be in sync with any DOM changes that may have occurred.
        $(window).focus(this._onHighlightPrefChange);

        if (editor) {
            // Attach now
            this._attachToEditor(editor);
        }
    }
@constructor
Base class for managing the connection between a live editor and the browser. Provides functions
for subclasses to highlight relevant nodes in the browser, and to mark errors in the editor.

Raises these events:
    "connect" - when a browser connects from the URL that maps to this live document. Passes the
         URL as a parameter.
    "errorStatusChanged" - when the status of errors that might prevent live edits from
         working (e.g. HTML syntax errors) has changed. Passes a boolean that's true if there
         are errors, false otherwise.

@param {LiveDevProtocol} protocol The protocol to use for communicating with the browser.
@param {function(string): string} urlResolver A function that, given a path on disk, should return
    the URL that Live Development serves that path at.
@param {Document} doc The Brackets document that this live document is connected to.
@param {?Editor} editor If specified, a particular editor that this live document is managing.
    If not specified initially, the LiveDocument will connect to the editor for the given document
    when it next becomes the active editor.