The previous implementation has two bugs:
1) When calling process() and then cancel() before then continuation
runs on a microtask, the ongoing work is not actually cancelled. This
can happen at least in the case of loading highlightjs, but probably
also in other cases.
2) When cancel() is called, the promise returned by promise() is
currenty not rejected, potentially dangling there forever and leaking
memory.
Both are fixed in this change by canceling the promise when cancel() is
called.
Change-Id: Ieb0f1fcccd2cda3b2f9648347bc4e4311eb07a06