Example #1
0
/**
 * Create a PromisesFront for a fake test tab.
 */
async function createTabPromisesFront() {
  const title = "test_promises";
  const target = await createTargetForFakeTab(title);

  // Retrieve the debuggee create by createTargetForFakeTab
  const debuggee = DebuggerServer.getTestGlobal(title);

  const promisesFront = await target.getFront("promises");

  registerCleanupFunction(async () => {
    // On XPCShell, the target isn't for a local tab and so target.destroy
    // won't close the client. So do it so here. It will automatically destroy the target.
    await target.client.close();
  });

  return { debuggee, client: target.client, promisesFront };
}