michael@0: /* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */ michael@0: /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: include protocol PBrowser; michael@0: michael@0: michael@0: using mozilla::layout::ScrollingBehavior from "mozilla/layout/RenderFrameUtils.h"; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: // An IPCTabContext which corresponds to a PBrowser opened by a child when it michael@0: // receives window.open(). michael@0: // michael@0: // If isBrowserElement is false, this PopupIPCTabContext corresponds to an app michael@0: // frame, and the frame's app-id and app-frame-owner-app-id will be equal to the michael@0: // opener's values. michael@0: // michael@0: // If isBrowserElement is true, the frame's browserFrameOwnerAppId will be equal michael@0: // to the opener's app-id. michael@0: // michael@0: // It's an error to set isBrowserElement == false if opener is a browser michael@0: // element. Such a PopupIPCTabContext should be rejected by code which receives michael@0: // it. michael@0: struct PopupIPCTabContext michael@0: { michael@0: PBrowser opener; michael@0: bool isBrowserElement; michael@0: }; michael@0: michael@0: // An IPCTabContext which corresponds to an app frame. michael@0: struct AppFrameIPCTabContext michael@0: { michael@0: // The ID of the app this frame corresponds to. May be NO_APP_ID. michael@0: uint32_t ownAppId; michael@0: michael@0: // The ID of the app containing this frame. May be NO_APP_ID. michael@0: uint32_t appFrameOwnerAppId; michael@0: }; michael@0: michael@0: // An IPCTabContext which corresponds to a browser frame. michael@0: struct BrowserFrameIPCTabContext michael@0: { michael@0: // The ID of the app which contains this browser frame. May be NO_APP_ID. michael@0: uint32_t browserFrameOwnerAppId; michael@0: }; michael@0: michael@0: // This is equivalent to AppFrameIPCTabContext with all fields set to NO_APP_ID. michael@0: struct VanillaFrameIPCTabContext michael@0: {}; michael@0: michael@0: // IPCTabContext is an analog to mozilla::dom::TabContext. Both specify an michael@0: // iframe/PBrowser's own and containing app-ids and tell you whether the michael@0: // iframe/PBrowser is a browser frame. But only IPCTabContext is allowed to michael@0: // travel over IPC. michael@0: // michael@0: // We need IPCTabContext (specifically, PopupIPCTabContext) to prevent a michael@0: // privilege escalation attack by a compromised child process. See the comment michael@0: // on AllocPBrowser for details. michael@0: union IPCTabAppBrowserContext michael@0: { michael@0: PopupIPCTabContext; michael@0: AppFrameIPCTabContext; michael@0: BrowserFrameIPCTabContext; michael@0: VanillaFrameIPCTabContext; michael@0: }; michael@0: michael@0: struct IPCTabContext { michael@0: IPCTabAppBrowserContext appBrowserContext; michael@0: ScrollingBehavior scrollingBehavior; michael@0: }; michael@0: michael@0: } michael@0: }