Source code

Revision control

Other Tools

1
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
2
/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
include "mozilla/dom/TabMessageUtils.h";
8
9
include protocol PBrowser;
10
include PBrowserOrId;
11
12
using UIStateChangeType from "nsPIDOMWindow.h";
13
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
14
15
namespace mozilla {
16
namespace dom {
17
18
// An IPCTabContext which corresponds to a PBrowser opened by a child when it
19
// receives window.open().
20
//
21
// If isMozBrowserElement is false, this PopupIPCTabContext is either a
22
// <xul:browser> or an app frame. The frame's app-id and app-frame-owner-app-id
23
// will be equal to the opener's values.
24
//
25
// It's an error to set isMozBrowserElement == false if opener is a mozbrowser
26
// element. Such a PopupIPCTabContext should be rejected by code which receives
27
// it.
28
struct PopupIPCTabContext
29
{
30
PBrowserOrId opener;
31
bool isMozBrowserElement;
32
uint64_t chromeOuterWindowID;
33
};
34
35
// An IPCTabContext which corresponds to an app, browser, or normal frame.
36
struct FrameIPCTabContext
37
{
38
// The originAttributes dictionary.
39
OriginAttributes originAttributes;
40
41
// Whether this is a mozbrowser frame. <iframe mozbrowser mozapp> and
42
// <xul:browser> are not considered to be mozbrowser frames.
43
bool isMozBrowserElement;
44
45
uint64_t chromeOuterWindowID;
46
47
// The requested presentation URL.
48
// This value would be empty if the TabContext isn't created for
49
// presented content.
50
nsString presentationURL;
51
52
// Keyboard indicator state inherited from the parent.
53
UIStateChangeType showFocusRings;
54
55
// Maximum number of touch points on the screen.
56
uint32_t maxTouchPoints;
57
};
58
59
struct JSPluginFrameIPCTabContext
60
{
61
uint32_t jsPluginId;
62
};
63
64
// XXXcatalinb: This is only used by ServiceWorkerClients::OpenWindow.
65
// Because service workers don't have an associated BrowserChild
66
// we can't satisfy the security constraints on b2g. As such, the parent
67
// process will accept this tab context only on desktop.
68
struct UnsafeIPCTabContext
69
{ };
70
71
// IPCTabContext is an analog to mozilla::dom::TabContext. Both specify an
72
// iframe/PBrowser's own and containing app-ids and tell you whether the
73
// iframe/PBrowser is a browser frame. But only IPCTabContext is allowed to
74
// travel over IPC.
75
//
76
// We need IPCTabContext (specifically, PopupIPCTabContext) to prevent a
77
// privilege escalation attack by a compromised child process.
78
union IPCTabContext
79
{
80
PopupIPCTabContext;
81
FrameIPCTabContext;
82
JSPluginFrameIPCTabContext;
83
UnsafeIPCTabContext;
84
};
85
86
}
87
}