testing/mochitest/BrowserTestUtils/ContentEventListenerParent.jsm
author Dorel Luca <dluca@mozilla.com>
Wed, 06 Nov 2019 21:30:29 +0200
changeset 500921 42999b620bba2e3cabf71af4928b8716dcb11fc8
parent 500882 1beab20978b27832e8ec3222c3cffbcc4d11e862
child 501184 9944bddc7b997b433f348d5ad3603952f7a258b8
permissions -rw-r--r--
Backed out 4 changesets (bug 1588193) for Broswer-chrome failures on browser/base/content/test/favicons/browser_favicon_change_not_in_document.js. CLOSED TREE Backed out changeset df4c4004abc5 (bug 1588193) Backed out changeset 1beab20978b2 (bug 1588193) Backed out changeset 1ada54e7ba7c (bug 1588193) Backed out changeset a0d9537d24c6 (bug 1588193)

/* 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": {
        let browser = this.browsingContext.top.embedderElement;
        if (!browser) {
          break;
        }
        // Handle RDM.
        if (browser.outerBrowser) {
          browser = browser.outerBrowser;
        }
        BrowserTestUtils._receivedContentEventListener(
          aMessage.data.listenerId,
          browser
        );
        break;
      }
    }
  }
}