зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1796819 - Remove OffscreenCanvas origin trial / domain allowlist. r=aosmond
We've shipped this, a single pref should be enough. Differential Revision: https://phabricator.services.mozilla.com/D159947
This commit is contained in:
Родитель
605f03838c
Коммит
afcb3962b4
|
@ -341,40 +341,6 @@ bool HasDrawWindowPrivilege(JSContext* aCx, JSObject* /* unused */) {
|
|||
nsGkAtoms::all_urlsPermission);
|
||||
}
|
||||
|
||||
bool IsOffscreenCanvasEnabled(JSContext* aCx, JSObject* aObj) {
|
||||
if (StaticPrefs::gfx_offscreencanvas_enabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (OriginTrials::IsEnabled(aCx, aObj, OriginTrial::OffscreenCanvas)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!StaticPrefs::gfx_offscreencanvas_domain_enabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
dom::WorkerPrivate* workerPrivate = dom::GetWorkerPrivateFromContext(aCx);
|
||||
if (workerPrivate->UsesSystemPrincipal() ||
|
||||
workerPrivate->OriginNoSuffix() == u"resource://pdf.js"_ns) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto prefLock = StaticPrefs::gfx_offscreencanvas_domain_allowlist();
|
||||
return nsContentUtils::IsURIInList(workerPrivate->GetBaseURI(), *prefLock);
|
||||
}
|
||||
|
||||
nsIPrincipal* principal = nsContentUtils::SubjectPrincipal(aCx);
|
||||
if (principal->IsSystemPrincipal() || nsContentUtils::IsPDFJS(principal)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri = principal->GetURI();
|
||||
const auto prefLock = StaticPrefs::gfx_offscreencanvas_domain_allowlist();
|
||||
return nsContentUtils::IsURIInList(uri, *prefLock);
|
||||
}
|
||||
|
||||
bool CheckWriteOnlySecurity(bool aCORSUsed, nsIPrincipal* aPrincipal,
|
||||
bool aHadCrossOriginRedirects) {
|
||||
if (!aPrincipal) {
|
||||
|
|
|
@ -446,11 +446,7 @@ already_AddRefed<OffscreenCanvas> OffscreenCanvas::CreateFromCloneData(
|
|||
/* static */
|
||||
bool OffscreenCanvas::PrefEnabledOnWorkerThread(JSContext* aCx,
|
||||
JSObject* aObj) {
|
||||
if (NS_IsMainThread()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return CanvasUtils::IsOffscreenCanvasEnabled(aCx, aObj);
|
||||
return NS_IsMainThread() || StaticPrefs::gfx_offscreencanvas_enabled();
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(OffscreenCanvas, DOMEventTargetHelper,
|
||||
|
|
|
@ -210,8 +210,6 @@ static int32_t PrefState(OriginTrial aTrial) {
|
|||
switch (aTrial) {
|
||||
case OriginTrial::TestTrial:
|
||||
return StaticPrefs::dom_origin_trials_test_trial_state();
|
||||
case OriginTrial::OffscreenCanvas:
|
||||
return StaticPrefs::dom_origin_trials_offscreen_canvas_state();
|
||||
case OriginTrial::CoepCredentialless:
|
||||
return StaticPrefs::dom_origin_trials_coep_credentialless_state();
|
||||
case OriginTrial::MAX:
|
||||
|
|
|
@ -9,8 +9,7 @@ use std::ffi::c_void;
|
|||
pub enum OriginTrial {
|
||||
// NOTE(emilio): 0 is reserved for WebIDL usage.
|
||||
TestTrial = 1,
|
||||
OffscreenCanvas = 2,
|
||||
CoepCredentialless = 3,
|
||||
CoepCredentialless = 2,
|
||||
|
||||
MAX,
|
||||
}
|
||||
|
@ -19,7 +18,6 @@ impl OriginTrial {
|
|||
fn from_str(s: &str) -> Option<Self> {
|
||||
Some(match s {
|
||||
"TestTrial" => Self::TestTrial,
|
||||
"OffscreenCanvas" => Self::OffscreenCanvas,
|
||||
"CoepCredentialless" => Self::CoepCredentialless,
|
||||
_ => return None,
|
||||
})
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
<!doctype html>
|
||||
<!-- Created with: mktoken --origin 'https://example.com' --feature TestTrial --expiry 'Wed, 01 Jan 3000 01:00:00 +0100' --sign test-keys/test-ecdsa.pkcs8 -->
|
||||
<meta http-equiv="origin-trial" content="AyGdETIKWLLqe+chG57f74gZcjYSfbdYAapEq7DA49E6CmaYaPmaoXh/4tAe5XJJJdwwpFVal7hz/irC+Wvp1HgAAABLeyJvcmlnaW4iOiJodHRwczovL2V4YW1wbGUuY29tIiwiZmVhdHVyZSI6IlRlc3RUcmlhbCIsImV4cGlyeSI6MzI1MDM2ODAwMDB9">
|
||||
<!-- Created with: mktoken --origin 'https://example.com' --feature OffscreenCanvas --expiry 'Wed, 01 Jan 3000 01:00:00 +0100' --sign test-keys/test-ecdsa.pkcs8 -->
|
||||
<meta http-equiv="origin-trial" content="Ay92n3CdO5VIYbmQB7t7r7e4c34nT1k9zbX5ON2JthrXaOFxLn5NieN7ITlKhPbmPSLA4qoS+TBdshqEUwmVaIwAAABReyJvcmlnaW4iOiJodHRwczovL2V4YW1wbGUuY29tIiwiZmVhdHVyZSI6Ik9mZnNjcmVlbkNhbnZhcyIsImV4cGlyeSI6MzI1MDM2ODAwMDB9">
|
||||
<!-- Created with: mktoken --origin 'https://example.com' --feature CoepCredentialless --expiry 'Wed, 01 Jan 3000 01:00:00 +0100' --sign test-keys/test-ecdsa.pkcs8 -->
|
||||
<meta http-equiv="origin-trial" content="Az+DK2Kczk8Xz1cAlD+TkvPZmuM2uJZ2CFefbp2hLuCU9FbUqxWTyQ2tEYr50r0syKELcOZLAPaABw8aYTLHn5YAAABUeyJvcmlnaW4iOiJodHRwczovL2V4YW1wbGUuY29tIiwiZmVhdHVyZSI6IkNvZXBDcmVkZW50aWFsbGVzcyIsImV4cGlyeSI6MzI1MDM2ODAwMDB9">
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="common.js"></script>
|
||||
<script>
|
||||
assertTestTrialActive(true);
|
||||
add_task(function() {
|
||||
ok(!!self.OffscreenCanvas, "OffscreenCanvas trial works.");
|
||||
});
|
||||
add_task(function() {
|
||||
ok(!!SpecialPowers.DOMWindowUtils.isCoepCredentialless(), "CoepCredentialless trial works.");
|
||||
});
|
||||
|
|
|
@ -49,7 +49,7 @@ partial interface HTMLCanvasElement {
|
|||
// For OffscreenCanvas
|
||||
// Reference: https://wiki.whatwg.org/wiki/OffscreenCanvas
|
||||
partial interface HTMLCanvasElement {
|
||||
[Func="CanvasUtils::IsOffscreenCanvasEnabled", Throws]
|
||||
[Pref="gfx.offscreencanvas.enabled", Throws]
|
||||
OffscreenCanvas transferControlToOffscreen();
|
||||
};
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@ dictionary ImageEncodeOptions {
|
|||
|
||||
enum OffscreenRenderingContextId { "2d", "bitmaprenderer", "webgl", "webgl2", "webgpu" };
|
||||
|
||||
[Exposed=(Window,Worker),
|
||||
Func="CanvasUtils::IsOffscreenCanvasEnabled"]
|
||||
[Exposed=(Window,Worker), Pref="gfx.offscreencanvas.enabled"]
|
||||
interface OffscreenCanvas : EventTarget {
|
||||
constructor([EnforceRange] unsigned long width, [EnforceRange] unsigned long height);
|
||||
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
* https://html.spec.whatwg.org/#the-offscreen-2d-rendering-context
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker),
|
||||
Func="CanvasUtils::IsOffscreenCanvasEnabled"]
|
||||
[Exposed=(Window,Worker), Pref="gfx.offscreencanvas.enabled"]
|
||||
interface OffscreenCanvasRenderingContext2D {
|
||||
[Throws]
|
||||
undefined commit();
|
||||
|
|
|
@ -3073,13 +3073,6 @@
|
|||
value: 0
|
||||
mirror: always
|
||||
|
||||
# Origin trial state for OffscreenCanvas.
|
||||
# 0: normal, 1: always-enabled, 2: always-disabled
|
||||
- name: dom.origin-trials.offscreen-canvas.state
|
||||
type: RelaxedAtomicInt32
|
||||
value: 0
|
||||
mirror: always
|
||||
|
||||
# Origin trial state for COEP: Credentialless.
|
||||
# 0: normal, 1: always-enabled, 2: always-disabled
|
||||
- name: dom.origin-trials.coep-credentialless.state
|
||||
|
@ -5979,18 +5972,6 @@
|
|||
value: true
|
||||
mirror: always
|
||||
|
||||
# Enable OffscreenCanvas based on the domain allowlist.
|
||||
- name: gfx.offscreencanvas.domain-enabled
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Domains included in the allowlist.
|
||||
- name: gfx.offscreencanvas.domain-allowlist
|
||||
type: DataMutexString
|
||||
value: "*.zoom.us,zoom.us"
|
||||
mirror: always
|
||||
|
||||
- name: gfx.omta.background-color
|
||||
type: bool
|
||||
value: true
|
||||
|
|
Загрузка…
Ссылка в новой задаче