testing/mochitest/BrowserTestUtils/ContentEventListenerParent.jsm
author Kashav Madan <kmadan@mozilla.com>
Wed, 06 Nov 2019 15:35:18 +0000
changeset 500882 1beab20978b27832e8ec3222c3cffbcc4d11e862
parent 500748 5eaefee2f30d79446a86a325d51095fa6e022399
child 500921 42999b620bba2e3cabf71af4928b8716dcb11fc8
permissions -rw-r--r--
Bug 1588193 - Fix BrowserTestUtils.waitForContentEvent with Fission, r=mccr8 This also changes BrowserTestUtils.addContentEventListener to use browsing contexts to track added listeners and their associated targets. Differential Revision: https://phabricator.services.mozilla.com/D51441

/* vim: set ts=2 sw=2 sts=2 et tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";

var EXPORTED_SYMBOLS = ["ContentEventListenerParent"];

const { BrowserTestUtils } = ChromeUtils.import(
  "resource://testing-common/BrowserTestUtils.jsm"
);

class ContentEventListenerParent extends JSWindowActorParent {
  receiveMessage(aMessage) {
    switch (aMessage.name) {
      case "ContentEventListener:Run": {
        BrowserTestUtils._receivedContentEventListener(
          aMessage.data.listenerId,
          this.browsingContext.top
        );
        break;
      }
    }
  }
}