Volunteer-driven episode guide for The Joy of Coding
Bug 1529276 - resource:///modules/WindowsJumpLists.jsm still does main thread I/O
Still hacking on WindowsJumpLists!
(abstract) class JumpListManager HRESULT BeginList HRESULT AddUserTasks HRESULT AppendCategory HRESULT CommitList
// Two implementations: // 1: "Real" one that wraps one of these things: RefPtr jumpListMgr; HRESULT hr = ::CoCreateInstance( CLSIDDestinationList, nullptr, CLSCTXINPROCSERVER, IIDICustomDestinationList, getter_AddRefs(jumpListMgr));
// 2: "Fake" one that allows us to interrogate it for things it has been passed, for testing. class MockJumpListManager HRESULT BeginList(outparam maxitems and outparam IObjectArray) Wants to be prepared to provide an outparam which is an IObjectArray. We can do that by creating an empty collection, or a collection that returns ShellLinks. HRESULT AddUserTasks(collection) Takes an array of tasks and returns an HRESULT. We can then examine what was passed. HRESULT AppendCategory(string, collection) Takes a string and collection for the custom list. HRESULT CommitList Just returns an HRESULT.
We’re going to be calling PopulateJumpList method on the JumpListBuilder, and then what we can do is take the returned DOM Promise and use a DOMPromiseListener to set up some lambda functions that write into some Maybe’s like this, and then we spin the event loop (like that prior example) to wait until the Promise either resolves or rejects and then we assert the resolving or the rejecting.