Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | /* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */ |
michael@0 | 2 | /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | include protocol PBrowser; |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | using mozilla::layout::ScrollingBehavior from "mozilla/layout/RenderFrameUtils.h"; |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | namespace dom { |
michael@0 | 14 | |
michael@0 | 15 | // An IPCTabContext which corresponds to a PBrowser opened by a child when it |
michael@0 | 16 | // receives window.open(). |
michael@0 | 17 | // |
michael@0 | 18 | // If isBrowserElement is false, this PopupIPCTabContext corresponds to an app |
michael@0 | 19 | // frame, and the frame's app-id and app-frame-owner-app-id will be equal to the |
michael@0 | 20 | // opener's values. |
michael@0 | 21 | // |
michael@0 | 22 | // If isBrowserElement is true, the frame's browserFrameOwnerAppId will be equal |
michael@0 | 23 | // to the opener's app-id. |
michael@0 | 24 | // |
michael@0 | 25 | // It's an error to set isBrowserElement == false if opener is a browser |
michael@0 | 26 | // element. Such a PopupIPCTabContext should be rejected by code which receives |
michael@0 | 27 | // it. |
michael@0 | 28 | struct PopupIPCTabContext |
michael@0 | 29 | { |
michael@0 | 30 | PBrowser opener; |
michael@0 | 31 | bool isBrowserElement; |
michael@0 | 32 | }; |
michael@0 | 33 | |
michael@0 | 34 | // An IPCTabContext which corresponds to an app frame. |
michael@0 | 35 | struct AppFrameIPCTabContext |
michael@0 | 36 | { |
michael@0 | 37 | // The ID of the app this frame corresponds to. May be NO_APP_ID. |
michael@0 | 38 | uint32_t ownAppId; |
michael@0 | 39 | |
michael@0 | 40 | // The ID of the app containing this frame. May be NO_APP_ID. |
michael@0 | 41 | uint32_t appFrameOwnerAppId; |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | // An IPCTabContext which corresponds to a browser frame. |
michael@0 | 45 | struct BrowserFrameIPCTabContext |
michael@0 | 46 | { |
michael@0 | 47 | // The ID of the app which contains this browser frame. May be NO_APP_ID. |
michael@0 | 48 | uint32_t browserFrameOwnerAppId; |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | // This is equivalent to AppFrameIPCTabContext with all fields set to NO_APP_ID. |
michael@0 | 52 | struct VanillaFrameIPCTabContext |
michael@0 | 53 | {}; |
michael@0 | 54 | |
michael@0 | 55 | // IPCTabContext is an analog to mozilla::dom::TabContext. Both specify an |
michael@0 | 56 | // iframe/PBrowser's own and containing app-ids and tell you whether the |
michael@0 | 57 | // iframe/PBrowser is a browser frame. But only IPCTabContext is allowed to |
michael@0 | 58 | // travel over IPC. |
michael@0 | 59 | // |
michael@0 | 60 | // We need IPCTabContext (specifically, PopupIPCTabContext) to prevent a |
michael@0 | 61 | // privilege escalation attack by a compromised child process. See the comment |
michael@0 | 62 | // on AllocPBrowser for details. |
michael@0 | 63 | union IPCTabAppBrowserContext |
michael@0 | 64 | { |
michael@0 | 65 | PopupIPCTabContext; |
michael@0 | 66 | AppFrameIPCTabContext; |
michael@0 | 67 | BrowserFrameIPCTabContext; |
michael@0 | 68 | VanillaFrameIPCTabContext; |
michael@0 | 69 | }; |
michael@0 | 70 | |
michael@0 | 71 | struct IPCTabContext { |
michael@0 | 72 | IPCTabAppBrowserContext appBrowserContext; |
michael@0 | 73 | ScrollingBehavior scrollingBehavior; |
michael@0 | 74 | }; |
michael@0 | 75 | |
michael@0 | 76 | } |
michael@0 | 77 | } |