Bug 1685680 [wpt PR 27099] - Add missing jsapi tests for wasm reference-types proposa...
[gecko.git] / browser / actors / PageStyleParent.jsm
blobaba972ec0b823db8e9cd021c7c8cc2a344170a82
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 "use strict";
6 var EXPORTED_SYMBOLS = ["PageStyleParent"];
8 class PageStyleParent extends JSWindowActorParent {
9   receiveMessage(msg) {
10     // The top browser.
11     let browser = this.browsingContext.top.embedderElement;
12     if (!browser) {
13       return;
14     }
16     let permanentKey = browser.permanentKey;
17     let window = browser.ownerGlobal;
18     let styleMenu = window.gPageStyleMenu;
19     if (window.closed || !styleMenu) {
20       return;
21     }
23     switch (msg.name) {
24       case "PageStyle:Add":
25         styleMenu.addBrowserStyleSheets(msg.data, permanentKey);
26         break;
27       case "PageStyle:Clear":
28         styleMenu.clearBrowserStyleSheets(permanentKey);
29         break;
30     }
31   }