Bug 1820641: Make a test that calls window.restore handle zoomed windows. r=mstange
[gecko.git] / toolkit / actors / BrowserElementChild.jsm
blobab02a52a7f1e55126c6e461fca01921b3d4330f1
1 /* vim: set ts=2 sw=2 sts=2 et tw=80: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 "use strict";
7 var EXPORTED_SYMBOLS = ["BrowserElementChild"];
9 class BrowserElementChild extends JSWindowActorChild {
10   handleEvent(event) {
11     if (
12       event.type == "DOMWindowClose" &&
13       !this.manager.browsingContext.parent
14     ) {
15       this.sendAsyncMessage("DOMWindowClose", {});
16     }
17   }
19   receiveMessage(message) {
20     switch (message.name) {
21       case "EnterModalState": {
22         this.contentWindow.windowUtils.enterModalState();
23         break;
24       }
26       case "LeaveModalState": {
27         if (
28           !message.data.forceLeave &&
29           !this.contentWindow.windowUtils.isInModalState()
30         ) {
31           break;
32         }
33         this.contentWindow.windowUtils.leaveModalState();
34         break;
35       }
36     }
37   }