Make DOMDocument::getElementById actually return DOMElement

We were blindly returning a DOMText object for
DOMDocument::getElementById when it should return a DOMElement.

Reviewed By: @ptarjan

Differential Revision: D967622
Add toVector(), toMap(), toStableMap(), toSet() methods to collections

These methods provide a convenient way to materialize a lazy iterable into
a concrete collection, or to convert from one collection type to another.
Doing "$x->toX()" is equivalent to "new X($x)" (where $x is an Iterable
and 'X' is a collection type), but it's nice to have for the chaining use
case, ex:

  $v = $m->lazy()
         ->map(..)
         ->filter(..)
         ->toVector();

Reviewed By: @elgenie

Differential Revision: D978191
Add XboxServer support for asio events

This allows us to treat XboxTasks as external threads in the ASIO
framework.

We template the ServerTaskEvent class so that it may be used in the
future with other similar server interfaces, e.g. PageletServer.  We
expose XboxTransport for use in ServerTaskEvent.

Storing a Transport * in ServerTaskEvent instead of a Resource

Template; expose the Transport type from the Server

Also parametrize the Transport class

Expose XboxTransport

Reviewed By: @jano

Differential Revision: D975697
put back test 537

@markw65 confirmed we shouldn't expect the warning in repo mode. Either I disable the test in repo mode or make the warning optional. I went with optional.

Reviewed By: @elgenie

Differential Revision: D978593
Maintain linked list correctly in Sweepable

In a more complex scenarios where sweep() may unregister() other
Sweepables, linked list was not maintained correctly.

Imagine this example:

  HEAD <-> A <-> B <-> C <-> HEAD

If sweep(A) calls unregister(B) and unregister(A), the following
happens:

  // Sweepable::SweepAll delists A:
  HEAD <-> B <-> C <-> HEAD
  HEAD <- A -> B

  // and calls sweep(A), which calls unregister(B):
  HEAD <-> C <-> HEAD
  B <-> B
  HEAD <- A -> B

  // then unregister(A) that uses invalid pointers from A, creating this mess:
  HEAD <-> B -> B
  HEAD <- C <-> HEAD
  A <-> A

  // Sweepable::SweepAll then tries to incorrectly sweep(B), which
  // crashes stuff

After this diff, Sweepable::SweepAll delists stuff correctly:

  // Sweepable::SweepAll delists A:
  HEAD <-> B <-> C <-> HEAD
  A <-> A

  // and calls sweep(A), which calls unregister(B):
  HEAD <-> C <-> HEAD
  B <-> B
  A <-> A

  // then unregister(A) does nothing:
  HEAD <-> C <-> HEAD
  B <-> B
  A <-> A

  // so Sweepable::SweepAll can correctly continue with sweep(C)

Reviewed By: bertrand

Differential Revision: D979013
Keep source location table in memory so that source line number to byte code offset lookups don't hit the SQL database

Hitting the SQL database with at least two queries every time the debugger needs to map from source line number to byte code offset, or vice versa, makes no sense. This diff adds a table to Unit that can be used instead of the database. Note that when running in repo authoritative mode, the table will be empty because a) it is created lazily when a unit is loaded form the repo and b) in this mode, the repo does not contain the source line information needed for this table. This does not matter too much because we don't support debugging when running in repo authoritative mode.

Note, this diff does not remove all uses of the SQL database. That will be done in a follow up diff.

Reviewed By: @mikemag

Differential Revision: D978834
Don't try to unlink a non-existent repo

This'll throw spurious warnings on fresh checkouts

Reviewed By: @ptarjan

Differential Revision: D979499
Fix ~AutoloadHandler to never access its smart members

We potentially create the AutoloadHandler during repro
creation, from various work threads.  (Things are set up enough to
call builtins.)  Then we shutdown the execution context and then run
OnThreadExit handlers.  ~AutoloadHandler can access the memory manager
after it is destructed, triggering the post delete assertions.

Reviewed By: @markw65

Differential Revision: D979498
Remove one of the emitLea overloads

We don't need both.  The 3-arg one is also nicer in a lot of
code-gen situations because it checks for InvalidReg.

Reviewed By: @edwinsmith

Differential Revision: D976482
Don't allocate empty memory for empty FixedVectors

Reviewed By: drussi

Differential Revision: D976486
Move InsertStaticString to unnamed namespace

It's not supposed to be public, and I accidentally left it in
string-data.h

Reviewed By: @edwinsmith

Differential Revision: D977555
Refactor SNI support

The SNI code was married to LibEventServer, which made it incompatible with ProxygenServer.  Moved all the libevent specific code into LibEventServer, which actually simplified the Server::enableSSL interface I think.

Reviewed By: @paroski

Differential Revision: D966945