Packages that successfully built are now stored internally
so they can be quickly accessed on future calls instead of
returning an array of newly built packages on each call.
Mock loading of TextMate snippets or Atom snippets and only enable
loading for the type of snippet being currently tested. This limits
logging of warning to the single warning we expect for each type, which
allows us to not call through on the mocking of `console.warn` and
explicitly check for the single expected call.
Since `snippets.add` can still be called from the window thread, we need
to retain the ability to parse the body without relying on the loading
task. But this commit only loads the parser in the window if it's actually
needed, instead of always loading it when the snippets extension is
loaded. This avoids the loading performance hit while still allowing
specs to pass and letting us call `snippets.add` manually in the window
if we want to.
This commit makes all interactions between Task and Worker look
like method calls. The worker now has a global `callTaskMethod`
function that it can use to call methods on the Task object. And the
Task can use `callWorkerMethod` to call methods on a global `handler`
object in the worker. The worker's initial `handler` actually contains
the `start` method, which the Task initially calls to kick things off.
Then the global `handler` gets replaced with whatever `handlerPath`
is specified by the Task. The worker then calls `workerStarted` on its
parent Task object.
This commit also gets rid of the `onProgress` method with the reply
semantics, favoring a more explicit interaction. When `snippetsLoaded`
finishes adding the snippet data, we call `loadNextPackageSnippets`
explicitly rather than returning a reply message.
Clearing the mini editor when closing is something
all sub-classes were already doing so it makes sense
to pull it up to the base class as the default
cancelled() implementation that can still be overridden
if needed.
Previously if the select list was cancelled with no open
editors the mini editor would be given focus before being
detached causing nothing to have focus after detach completed.
Now the select list tracks the previously focused elements and
restores focus to that element at the end of the cancel.