Commit Graph

3 Commits

Author SHA1 Message Date
Mike Conley
17fc92be52 Bug 1144797 - Add ContentTaskUtils.jsm into ContentTask scope. r=smacleod. 2015-03-27 18:51:25 -04:00
Steven MacLeod
44d7b83237 Bug 1093566 - Add Cc, Ci, Cu, Cr to scope of spawned ContentTasks; r=Gijs r=paolo 2015-02-26 11:49:36 -05:00
Steven MacLeod
2cfbc7bdd4 Bug 1107609 - Implement ContentTask.spawn; r=Gijs r=mconley
This introduces a new medule ContentTask, which includes a spawn method.
This new method can be used to spawn a task in the content process of a
browser. When called, a promise will be returned which resolves to the
value returned by the task.

This allows you to quickly write test code which can touch the content
and return information without having to write custom framescripts all
the time (The content code can be written inline as a simple generator
definition). ContentTask is automatically included in the scope of
mochitests.

An example use follows:

yield ContentTask.spawn(browser, {}, function* gen_replaceState() {
  content.window.history.replaceState({}, "", 'test-entry/');
  return "Value that the promise will resolve with";
});
2015-02-11 17:28:44 -05:00