refactor-864370: Replace Function.bind shim for PhantomJS

Signed-off-by: Joe Walker <jwalker@mozilla.com>
xpcshellcrash-936451: Workaround XHR issues

Without this patch ‘mach package’ fails with a dump in xpcshell.

xpcshell is computing a startup cache by loading each of the JS files in
turn and running a single pass through the event loop on each to see
what things they load. Recent changes in GCLI split out a large file
(gcli.jsm) into a number of smaller files, some of which use other
resources fetched using an XHR request to a resource://... URL.

It looks like there is some sort of security principle which is normally
setup for a working Firefox, which isn't there in the xpcshell
environment, so when XHR tries to find out if it's allowed to read from
the resource://... URL, it dumps on an null pointer.

So there's an easy workaround, I simply setTimeout before doing the XHR
so the call doesn't happen on the first pass through the event loop.
This somewhat subverts the whole point of this process, however since
these files should not be parsed on startup, I'm not sure what the
performance impact will be.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
jsterm-911456: Testing - Update automators

The requisition automator now basically works (enough to pass all tests
with the exception of the increment/decrement tests for dates. So
now 'test —nodom' works.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Minor AMD → CommonJS

The firefox build code referred to AMD modules, but we’ve changed to
using CommonJS modules, so we need to update the code to reflect this.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Minor - Update cli.mapping changes

Warn on repeated mapping of the same requisition, and remove an unused
argument on a call to removeMapping()

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Minor - Update test suite names

When we were using absolute package names, we used the full module path
but since we moved to using relative package names this doesn’t work, so
we trim the names to just the leaf name, and remove the name trim code
from examiner.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Minor - Use KeyEvent constants

Until the code re-org, helpers.js was unable to easily require
'gcli/util/util' so we used the inlined constants rather than
KeyEvent.DOM_VK_* constants. Now we’re no longer under that constraint.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Minor - Various fixes

Automator only optionally has a focusManager, and it handles setCursor
directly rather than passing it onto a language implementation.

We moved promise.jsm from using an ES6 Map to old school {}, but left
behind a call to map.delete(…). Now we use the delete keyword instead.

Return a resolved promise from setCursor for consistency.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Minor - Update test commands

Steps toward making the 2 test commands be the same. They are different
because the nodejs version uses JS DOM, but we’re working towards
getting rid of that version because it causes too many hacks in our
code.

These changes mostly make the 2 code paths similar and introduce --nodom
testing to the web version of the code.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Remove JSDom support

It didn’t provide an environment close enough to the browser for the
additional testing to be worth while.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Merge test commands

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: requisition._split is synchronous

Make that clear by not returning a promise, and by calling
_setAssignmentInternal rather than setInternal (the former is
synchronous)

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Use Task.spawn in tests

The header that we add to our tests as we port them to run in Mochitest
now uses Task.spawn rather than helpers.addTabWithToolbar

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Split testPref in half

Mochitest complained that it was taking too long to run how that we
are using async promises.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
refactor-864370: Split testKeyboard2 in half

Mochitest complained that it was taking too long to run how that we
are using async promises.

Signed-off-by: Joe Walker <jwalker@mozilla.com>