-
Notifications
You must be signed in to change notification settings - Fork 3
/
firefox.patch
192 lines (180 loc) · 6.38 KB
/
firefox.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
diff --git a/dom/media/eme/EMEUtils.cpp b/dom/media/eme/EMEUtils.cpp
index 68e6df1..8232816 100644
--- a/dom/media/eme/EMEUtils.cpp
+++ b/dom/media/eme/EMEUtils.cpp
@@ -83,6 +83,7 @@ ParseKeySystem(const nsAString& aExpectedKeySystem,
static const char16_t* sKeySystems[] = {
MOZ_UTF16("org.w3.clearkey"),
MOZ_UTF16("com.adobe.primetime"),
+ MOZ_UTF16("com.widevine.alpha"),
};
bool
@@ -140,6 +141,9 @@ KeySystemToGMPName(const nsAString& aKeySystem)
if (aKeySystem.EqualsLiteral("org.w3.clearkey")) {
return NS_LITERAL_STRING("gmp-clearkey");
}
+ if (aKeySystem.EqualsLiteral("com.widevine.alpha")) {
+ return NS_LITERAL_STRING("gmp-widevine");
+ }
MOZ_ASSERT(false, "We should only call this for known GMPs");
return EmptyString();
}
diff --git a/dom/media/eme/MediaKeySystemAccess.cpp b/dom/media/eme/MediaKeySystemAccess.cpp
index e665df3..9592955 100644
--- a/dom/media/eme/MediaKeySystemAccess.cpp
+++ b/dom/media/eme/MediaKeySystemAccess.cpp
@@ -283,6 +283,10 @@ MediaKeySystemAccess::GetKeySystemStatus(const nsAString& aKeySystem,
return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
}
+ if (aKeySystem.EqualsLiteral("com.widevine.alpha")) {
+ return EnsureMinCDMVersion(mps, aKeySystem, aMinCdmVersion, aOutMessage, aOutCdmVersion);
+ }
+
#ifdef PRIMETIME_EME_SUPPORTED
if (aKeySystem.EqualsLiteral("com.adobe.primetime")) {
if (!Preferences::GetBool("media.gmp-eme-adobe.enabled", false)) {
diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp
index 95ee0eb..3be4f92 100644
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -32,6 +32,10 @@ static const int MAX_VOUCHER_LENGTH = 500000;
#include <unistd.h> // for _exit()
#endif
+#ifdef XP_LINUX
+#include <dlfcn.h>
+#endif
+
#if defined(MOZ_GMP_SANDBOX)
#if defined(XP_MACOSX)
#include "mozilla/Sandbox.h"
@@ -128,7 +132,7 @@ GetPluginFile(const nsAString& aPluginPath,
return true;
}
-#ifdef XP_WIN
+#if defined(XP_WIN) || defined(XP_LINUX)
static bool
GetInfoFile(const nsAString& aPluginPath,
nsCOMPtr<nsIFile>& aInfoFile)
@@ -319,7 +323,7 @@ ReadIntoArray(nsIFile* aFile,
return (bytesRead == length);
}
-#ifdef XP_WIN
+#if defined(XP_WIN) || defined(XP_LINUX)
static bool
ReadIntoString(nsIFile* aFile,
nsCString& aOutDst,
@@ -383,12 +387,18 @@ GMPChild::PreLoadLibraries(const nsAString& aPluginPath)
SplitAt(",", Substring(line, offset + strlen(libraries)), libs);
for (nsCString lib : libs) {
lib.Trim(" ");
+#ifdef XP_WIN
for (const char* whiteListedLib : whitelist) {
if (lib.EqualsASCII(whiteListedLib)) {
LoadLibraryA(lib.get());
break;
}
}
+#endif
+#ifdef XP_LINUX
+ // XXX: no whitelist?
+ dlopen(lib.get(), RTLD_NOW | RTLD_GLOBAL);
+#endif
}
}
@@ -430,7 +440,7 @@ GMPChild::AnswerStartPlugin()
{
LOGD("%s", __FUNCTION__);
-#if defined(XP_WIN)
+#if defined(XP_WIN) || defined(XP_LINUX)
PreLoadLibraries(mPluginPath);
#endif
if (!PreLoadPluginVoucher()) {
diff --git a/dom/media/gmp/GMPChild.h b/dom/media/gmp/GMPChild.h
index 83956b2..9aad56f 100644
--- a/dom/media/gmp/GMPChild.h
+++ b/dom/media/gmp/GMPChild.h
@@ -31,7 +31,7 @@ public:
base::ProcessId aParentPid,
MessageLoop* aIOLoop,
IPC::Channel* aChannel);
-#ifdef XP_WIN
+#if defined(XP_WIN) || defined(XP_LINUX)
bool PreLoadLibraries(const nsAString& aPluginPath);
#endif
MessageLoop* GMPMessageLoop();
diff --git a/dom/media/gmp/GMPDecryptorParent.cpp b/dom/media/gmp/GMPDecryptorParent.cpp
index 60d206e..48f3315 100644
--- a/dom/media/gmp/GMPDecryptorParent.cpp
+++ b/dom/media/gmp/GMPDecryptorParent.cpp
@@ -169,15 +169,20 @@ GMPDecryptorParent::Decrypt(uint32_t aId,
}
// Caller should ensure parameters passed in are valid.
- MOZ_ASSERT(!aBuffer.IsEmpty() && aCrypto.mValid);
-
- GMPDecryptionData data(aCrypto.mKeyId,
- aCrypto.mIV,
- aCrypto.mPlainSizes,
- aCrypto.mEncryptedSizes,
- aCrypto.mSessionIds);
-
- Unused << SendDecrypt(aId, aBuffer, data);
+ MOZ_ASSERT(!aBuffer.IsEmpty());
+
+ if (aCrypto.mValid) {
+ GMPDecryptionData data(aCrypto.mKeyId,
+ aCrypto.mIV,
+ aCrypto.mPlainSizes,
+ aCrypto.mEncryptedSizes,
+ aCrypto.mSessionIds);
+
+ Unused << SendDecrypt(aId, aBuffer, data);
+ } else {
+ GMPDecryptionData data;
+ Unused << SendDecrypt(aId, aBuffer, data);
+ }
}
bool
diff --git a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
index 867b1e8..638f1c4 100644
--- a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
+++ b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
@@ -179,8 +179,8 @@ GMPVideoDecoder::GMPInitDone(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost)
codec.mGMPApiVersion = kGMPVersion33;
codec.mCodecType = kGMPVideoCodecH264;
- codec.mWidth = mConfig.mDisplay.width;
- codec.mHeight = mConfig.mDisplay.height;
+ codec.mWidth = mConfig.mImage.width;
+ codec.mHeight = mConfig.mImage.height;
nsTArray<uint8_t> codecSpecific;
codecSpecific.AppendElement(0); // mPacketizationMode.
diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
index 2c01b56..e6fc8ee 100644
--- a/security/sandbox/linux/SandboxFilter.cpp
+++ b/security/sandbox/linux/SandboxFilter.cpp
@@ -145,7 +145,11 @@ public:
case __NR_clock_gettime: {
Arg<clockid_t> clk_id(0);
return If(clk_id == CLOCK_MONOTONIC, Allow())
+ .ElseIf(clk_id == CLOCK_MONOTONIC_COARSE, Allow())
+ .ElseIf(clk_id == CLOCK_PROCESS_CPUTIME_ID, Allow())
.ElseIf(clk_id == CLOCK_REALTIME, Allow())
+ .ElseIf(clk_id == CLOCK_REALTIME_COARSE, Allow())
+ .ElseIf(clk_id == CLOCK_THREAD_CPUTIME_ID, Allow())
.Else(InvalidSyscall());
}
case __NR_gettimeofday:
@@ -711,6 +715,15 @@ public:
.Else(InvalidSyscall());
}
+ case __NR_brk:
+ case __NR_geteuid:
+ case __NR_sched_getparam:
+ case __NR_sched_getscheduler:
+ case __NR_sched_get_priority_min:
+ case __NR_sched_get_priority_max:
+ case __NR_sched_setscheduler:
+ return Allow();
+
default:
return SandboxPolicyCommon::EvaluateSyscall(sysno);
}