summaryrefslogtreecommitdiffstats
path: root/toolkit/actors/ContentMetaParent.jsm
blob: 5d350754cd5a22e67c2d82ae482b45315d77f52d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* 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";

const EXPORTED_SYMBOLS = ["ContentMetaParent"];

class ContentMetaParent extends JSWindowActorParent {
  receiveMessage(message) {
    if (message.name == "Meta:SetPageInfo") {
      let browser = this.manager.browsingContext.top.embedderElement;
      if (browser) {
        let event = new browser.ownerGlobal.CustomEvent("pageinfo", {
          bubbles: true,
          cancelable: false,
          detail: {
            url: message.data.url,
            description: message.data.description,
            previewImageURL: message.data.previewImageURL,
          },
        });
        browser.dispatchEvent(event);
      }
    }
  }
}