Update to 102.8.0
(cherry picked from commit 9b872d091231f6b50f67a87e6fe20252589b7dce)
This commit is contained in:
parent
211202b5cc
commit
a2a40044b3
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
firefox-langpacks-102.8.0esr-20230214.tar.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
firefox-102.8.0esr.b2.processed-source.tar.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
44
0001-GLIBCXX-fix-for-GCC-12.patch
Normal file
44
0001-GLIBCXX-fix-for-GCC-12.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From efd5bc0715e5477318be95a76811cda0a89e8289 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= <emilio@crisal.io>
|
||||||
|
Date: Fri, 4 Mar 2022 12:00:26 +0100
|
||||||
|
Subject: [PATCH] GLIBCXX fix for GCC 12?
|
||||||
|
|
||||||
|
---
|
||||||
|
build/unix/stdc++compat/stdc++compat.cpp | 14 ++++++++++++++
|
||||||
|
1 file changed, 14 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/build/unix/stdc++compat/stdc++compat.cpp b/build/unix/stdc++compat/stdc++compat.cpp
|
||||||
|
index 0180f6bcfa998..8d7a542ff11f0 100644
|
||||||
|
--- a/build/unix/stdc++compat/stdc++compat.cpp
|
||||||
|
+++ b/build/unix/stdc++compat/stdc++compat.cpp
|
||||||
|
@@ -24,6 +24,7 @@
|
||||||
|
GLIBCXX_3.4.27 is from gcc 10
|
||||||
|
GLIBCXX_3.4.28 is from gcc 10
|
||||||
|
GLIBCXX_3.4.29 is from gcc 11
|
||||||
|
+ GLIBCXX_3.4.30 is from gcc 12
|
||||||
|
|
||||||
|
This file adds the necessary compatibility tricks to avoid symbols with
|
||||||
|
version GLIBCXX_3.4.20 and bigger, keeping binary compatibility with
|
||||||
|
@@ -69,6 +70,19 @@ void __attribute__((weak)) __throw_bad_array_new_length() { MOZ_CRASH(); }
|
||||||
|
} // namespace std
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#if _GLIBCXX_RELEASE >= 12
|
||||||
|
+namespace std {
|
||||||
|
+
|
||||||
|
+/* This avoids the GLIBCXX_3.4.30 symbol version. */
|
||||||
|
+void __attribute__((weak))
|
||||||
|
+__glibcxx_assert_fail(const char* __file, int __line, const char* __function,
|
||||||
|
+ const char* __condition) {
|
||||||
|
+ MOZ_CRASH();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+} // namespace std
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* While we generally don't build with exceptions, we have some host tools
|
||||||
|
* that do use them. libstdc++ from GCC 5.0 added exception constructors with
|
||||||
|
* char const* argument. Older versions only have a constructor with
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
From 49d1846b55bcd4b54a8b8eb2b4ae0b29be0b36a1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: bzg1107 <preloyalwhite@163.com>
|
|
||||||
Date: Tue, 11 Jan 2022 17:36:03 +0800
|
|
||||||
Subject: [PATCH] fix wl_proxy_marshal_flags
|
|
||||||
|
|
||||||
---
|
|
||||||
widget/gtk/mozwayland/mozwayland.c | 5 +++++
|
|
||||||
1 file changed, 5 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/widget/gtk/mozwayland/mozwayland.c b/widget/gtk/mozwayland/mozwayland.c
|
|
||||||
index 5cea1c5..bbf97a5 100644
|
|
||||||
--- a/widget/gtk/mozwayland/mozwayland.c
|
|
||||||
+++ b/widget/gtk/mozwayland/mozwayland.c
|
|
||||||
@@ -41,6 +41,11 @@ MOZ_EXPORT void wl_proxy_marshal(struct wl_proxy* p, uint32_t opcode, ...) {}
|
|
||||||
MOZ_EXPORT void wl_proxy_marshal_array(struct wl_proxy* p, uint32_t opcode,
|
|
||||||
union wl_argument* args) {}
|
|
||||||
|
|
||||||
+MOZ_EXPORT struct wl_proxy *wl_proxy_marshal_flags(struct wl_proxy* proxy, uint32_t opcode,
|
|
||||||
+ const struct wl_interface *interface, uint32_t version, uint32_t flags, ...) {
|
|
||||||
+ return NULL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
MOZ_EXPORT struct wl_proxy* wl_proxy_create(
|
|
||||||
struct wl_proxy* factory, const struct wl_interface* interface) {
|
|
||||||
return NULL;
|
|
||||||
--
|
|
||||||
2.30.0
|
|
||||||
|
|
||||||
@ -1,200 +0,0 @@
|
|||||||
diff --git a/python/mach/mach/config.py b/python/mach/mach/config.py
|
|
||||||
index 7210eca..edb4d2e 100644
|
|
||||||
--- a/python/mach/mach/config.py
|
|
||||||
+++ b/python/mach/mach/config.py
|
|
||||||
@@ -144,7 +144,7 @@ def reraise_attribute_error(func):
|
|
||||||
return _
|
|
||||||
|
|
||||||
|
|
||||||
-class ConfigSettings(collections.Mapping):
|
|
||||||
+class ConfigSettings(collections.abc.Mapping):
|
|
||||||
"""Interface for configuration settings.
|
|
||||||
|
|
||||||
This is the main interface to the configuration.
|
|
||||||
@@ -190,7 +190,7 @@ class ConfigSettings(collections.Mapping):
|
|
||||||
will result in exceptions being raised.
|
|
||||||
"""
|
|
||||||
|
|
||||||
- class ConfigSection(collections.MutableMapping, object):
|
|
||||||
+ class ConfigSection(collections.abc.MutableMapping, object):
|
|
||||||
"""Represents an individual config section."""
|
|
||||||
def __init__(self, config, name, settings):
|
|
||||||
object.__setattr__(self, '_config', config)
|
|
||||||
diff --git a/python/mach/mach/decorators.py b/python/mach/mach/decorators.py
|
|
||||||
index f69a75b..afc1797 100644
|
|
||||||
--- a/python/mach/mach/decorators.py
|
|
||||||
+++ b/python/mach/mach/decorators.py
|
|
||||||
@@ -5,7 +5,7 @@
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
-import collections
|
|
||||||
+import collections.abc
|
|
||||||
import inspect
|
|
||||||
import sys
|
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ def CommandProvider(cls):
|
|
||||||
'Conditions argument must take a list ' + \
|
|
||||||
'of functions. Found %s instead.'
|
|
||||||
|
|
||||||
- if not isinstance(command.conditions, collections.Iterable):
|
|
||||||
+ if not isinstance(command.conditions, collections.abc.Iterable):
|
|
||||||
msg = msg % (command.name, type(command.conditions))
|
|
||||||
raise MachError(msg)
|
|
||||||
|
|
||||||
diff --git a/python/mach/mach/main.py b/python/mach/mach/main.py
|
|
||||||
index 95f492f..5b8d205 100644
|
|
||||||
--- a/python/mach/mach/main.py
|
|
||||||
+++ b/python/mach/mach/main.py
|
|
||||||
@@ -16,7 +16,7 @@ import os
|
|
||||||
import sys
|
|
||||||
import traceback
|
|
||||||
import uuid
|
|
||||||
-from collections import Iterable
|
|
||||||
+from collections.abc import Iterable
|
|
||||||
|
|
||||||
from mach.sentry import register_sentry, report_exception
|
|
||||||
from six import string_types
|
|
||||||
diff --git a/python/mozbuild/mozbuild/backend/configenvironment.py b/python/mozbuild/mozbuild/backend/configenvironment.py
|
|
||||||
index 20d1a9f..898cabb 100644
|
|
||||||
--- a/python/mozbuild/mozbuild/backend/configenvironment.py
|
|
||||||
+++ b/python/mozbuild/mozbuild/backend/configenvironment.py
|
|
||||||
@@ -9,7 +9,8 @@ import six
|
|
||||||
import sys
|
|
||||||
import json
|
|
||||||
|
|
||||||
-from collections import Iterable, OrderedDict
|
|
||||||
+from collections.abc import Iterable
|
|
||||||
+from collections import OrderedDict
|
|
||||||
from types import ModuleType
|
|
||||||
|
|
||||||
import mozpack.path as mozpath
|
|
||||||
diff --git a/python/mozbuild/mozbuild/makeutil.py b/python/mozbuild/mozbuild/makeutil.py
|
|
||||||
index 4da1a3b..4ce5684 100644
|
|
||||||
--- a/python/mozbuild/mozbuild/makeutil.py
|
|
||||||
+++ b/python/mozbuild/mozbuild/makeutil.py
|
|
||||||
@@ -7,7 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import six
|
|
||||||
-from collections import Iterable
|
|
||||||
+from collections.abc import Iterable
|
|
||||||
|
|
||||||
|
|
||||||
class Makefile(object):
|
|
||||||
diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py
|
|
||||||
index 044cf64..98ed3ef 100644
|
|
||||||
--- a/python/mozbuild/mozbuild/util.py
|
|
||||||
+++ b/python/mozbuild/mozbuild/util.py
|
|
||||||
@@ -782,7 +782,7 @@ class HierarchicalStringList(object):
|
|
||||||
self._strings = StrictOrderingOnAppendList()
|
|
||||||
self._children = {}
|
|
||||||
|
|
||||||
- class StringListAdaptor(collections.Sequence):
|
|
||||||
+ class StringListAdaptor(collections.abc.Sequence):
|
|
||||||
def __init__(self, hsl):
|
|
||||||
self._hsl = hsl
|
|
||||||
|
|
||||||
diff --git a/testing/mozbase/manifestparser/manifestparser/filters.py b/testing/mozbase/manifestparser/manifestparser/filters.py
|
|
||||||
index 9b57b2f..9bcca5b 100644
|
|
||||||
--- a/testing/mozbase/manifestparser/manifestparser/filters.py
|
|
||||||
+++ b/testing/mozbase/manifestparser/manifestparser/filters.py
|
|
||||||
@@ -12,7 +12,8 @@ from __future__ import absolute_import
|
|
||||||
|
|
||||||
import itertools
|
|
||||||
import os
|
|
||||||
-from collections import defaultdict, MutableSequence
|
|
||||||
+from collections.abc import MutableSequence
|
|
||||||
+from collections import defaultdict
|
|
||||||
|
|
||||||
import six
|
|
||||||
from six import string_types
|
|
||||||
diff --git a/testing/mozbase/versioninfo.py b/testing/mozbase/versioninfo.py
|
|
||||||
index 91d1a04..8c16800 100755
|
|
||||||
--- a/testing/mozbase/versioninfo.py
|
|
||||||
+++ b/testing/mozbase/versioninfo.py
|
|
||||||
@@ -11,7 +11,7 @@ from commit messages.
|
|
||||||
|
|
||||||
from __future__ import absolute_import, print_function
|
|
||||||
|
|
||||||
-from collections import Iterable
|
|
||||||
+from collections.abc import Iterable
|
|
||||||
from distutils.version import StrictVersion
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
diff --git a/third_party/python/gyp/pylib/gyp/common.py b/third_party/python/gyp/pylib/gyp/common.py
|
|
||||||
index b268d22..4f9cb0e 100644
|
|
||||||
--- a/third_party/python/gyp/pylib/gyp/common.py
|
|
||||||
+++ b/third_party/python/gyp/pylib/gyp/common.py
|
|
||||||
@@ -494,7 +494,7 @@ def uniquer(seq, idfun=None):
|
|
||||||
|
|
||||||
|
|
||||||
# Based on http://code.activestate.com/recipes/576694/.
|
|
||||||
-class OrderedSet(collections.MutableSet):
|
|
||||||
+class OrderedSet(collections.abc.MutableSet):
|
|
||||||
def __init__(self, iterable=None):
|
|
||||||
self.end = end = []
|
|
||||||
end += [None, end, end] # sentinel node for doubly linked list
|
|
||||||
diff --git a/third_party/python/gyp/pylib/gyp/msvs_emulation.py b/third_party/python/gyp/pylib/gyp/msvs_emulation.py
|
|
||||||
index 63d40e6..43fbbbb 100644
|
|
||||||
--- a/third_party/python/gyp/pylib/gyp/msvs_emulation.py
|
|
||||||
+++ b/third_party/python/gyp/pylib/gyp/msvs_emulation.py
|
|
||||||
@@ -91,7 +91,7 @@ def _AddPrefix(element, prefix):
|
|
||||||
"""Add |prefix| to |element| or each subelement if element is iterable."""
|
|
||||||
if element is None:
|
|
||||||
return element
|
|
||||||
- if (isinstance(element, collections.Iterable) and
|
|
||||||
+ if (isinstance(element, collections.abc.Iterable) and
|
|
||||||
not isinstance(element, basestring)):
|
|
||||||
return [prefix + e for e in element]
|
|
||||||
else:
|
|
||||||
@@ -104,7 +104,7 @@ def _DoRemapping(element, map):
|
|
||||||
if map is not None and element is not None:
|
|
||||||
if not callable(map):
|
|
||||||
map = map.get # Assume it's a dict, otherwise a callable to do the remap.
|
|
||||||
- if (isinstance(element, collections.Iterable) and
|
|
||||||
+ if (isinstance(element, collections.abc.Iterable) and
|
|
||||||
not isinstance(element, basestring)):
|
|
||||||
element = filter(None, [map(elem) for elem in element])
|
|
||||||
else:
|
|
||||||
@@ -117,7 +117,7 @@ def _AppendOrReturn(append, element):
|
|
||||||
then add |element| to it, adding each item in |element| if it's a list or
|
|
||||||
tuple."""
|
|
||||||
if append is not None and element is not None:
|
|
||||||
- if (isinstance(element, collections.Iterable) and
|
|
||||||
+ if (isinstance(element, collections.abc.Iterable) and
|
|
||||||
not isinstance(element, basestring)):
|
|
||||||
append.extend(element)
|
|
||||||
else:
|
|
||||||
diff --git a/third_party/python/virtualenv/virtualenv.py b/third_party/python/virtualenv/virtualenv.py
|
|
||||||
index 9eaedaf..3ef431c 100755
|
|
||||||
--- a/third_party/python/virtualenv/virtualenv.py
|
|
||||||
+++ b/third_party/python/virtualenv/virtualenv.py
|
|
||||||
@@ -1804,7 +1804,7 @@ def fix_local_scheme(home_dir, symlink=True):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
# noinspection PyProtectedMember
|
|
||||||
- if sysconfig._get_default_scheme() == "posix_local":
|
|
||||||
+ if sysconfig.get_default_scheme() == "posix_local":
|
|
||||||
local_path = os.path.join(home_dir, "local")
|
|
||||||
if not os.path.exists(local_path):
|
|
||||||
os.mkdir(local_path)
|
|
||||||
diff --git a/third_party/python/voluptuous/voluptuous/schema_builder.py b/third_party/python/voluptuous/voluptuous/schema_builder.py
|
|
||||||
index 8d7a81a..92b60ac 100644
|
|
||||||
--- a/third_party/python/voluptuous/voluptuous/schema_builder.py
|
|
||||||
+++ b/third_party/python/voluptuous/voluptuous/schema_builder.py
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-import collections
|
|
||||||
+import collections.abc
|
|
||||||
import inspect
|
|
||||||
import re
|
|
||||||
from functools import wraps
|
|
||||||
@@ -280,7 +280,7 @@ class Schema(object):
|
|
||||||
return schema.__voluptuous_compile__(self)
|
|
||||||
if isinstance(schema, Object):
|
|
||||||
return self._compile_object(schema)
|
|
||||||
- if isinstance(schema, collections.Mapping):
|
|
||||||
+ if isinstance(schema, collections.abc.Mapping):
|
|
||||||
return self._compile_dict(schema)
|
|
||||||
elif isinstance(schema, list):
|
|
||||||
return self._compile_list(schema)
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
From 782e0bd5d5b00a95833a1f187b856f9632331e84 Mon Sep 17 00:00:00 2001
|
|
||||||
From: wang--ge <wang__ge@126.com>
|
|
||||||
Date: Tue, 14 Feb 2023 16:19:03 +0800
|
|
||||||
Subject: [PATCH] fix build failure due to arc4random feature activated
|
|
||||||
|
|
||||||
---
|
|
||||||
ipc/chromium/src/third_party/libevent/arc4random.c | 2 +-
|
|
||||||
old-configure | 7 ++++++-
|
|
||||||
2 files changed, 7 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/ipc/chromium/src/third_party/libevent/arc4random.c b/ipc/chromium/src/third_party/libevent/arc4random.c
|
|
||||||
index a2338e6..0dee5b4 100644
|
|
||||||
--- a/ipc/chromium/src/third_party/libevent/arc4random.c
|
|
||||||
+++ b/ipc/chromium/src/third_party/libevent/arc4random.c
|
|
||||||
@@ -494,7 +494,7 @@ arc4random(void)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-ARC4RANDOM_EXPORT void
|
|
||||||
+void
|
|
||||||
arc4random_buf(void *buf_, size_t n)
|
|
||||||
{
|
|
||||||
unsigned char *buf = buf_;
|
|
||||||
diff --git a/old-configure b/old-configure
|
|
||||||
index d37324e..a175081 100644
|
|
||||||
--- a/old-configure
|
|
||||||
+++ b/old-configure
|
|
||||||
@@ -6504,6 +6504,11 @@ fi
|
|
||||||
|
|
||||||
for ac_func in stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall
|
|
||||||
do
|
|
||||||
+if [ "$ac_func" == "arc4random" ] || [ "$ac_func" == "arc4random_buf" ];then
|
|
||||||
+ ac_exeext_addend=t
|
|
||||||
+else
|
|
||||||
+ ac_exeext_addend=
|
|
||||||
+fi
|
|
||||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
|
||||||
echo "configure:6509: checking for $ac_func" >&5
|
|
||||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
|
||||||
@@ -6537,7 +6542,7 @@ $ac_func();
|
|
||||||
|
|
||||||
; return 0; }
|
|
||||||
EOF
|
|
||||||
-if { (eval echo configure:6541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
|
||||||
+if { (eval echo configure:6541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}${ac_exeext_addend}; then
|
|
||||||
rm -rf conftest*
|
|
||||||
eval "ac_cv_func_$ac_func=yes"
|
|
||||||
else
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
|
|
||||||
# HG changeset patch
|
|
||||||
# User Jed Davis <jld@mozilla.com>
|
|
||||||
# Date 1598606638 0
|
|
||||||
# Node ID a65fc6aca1f2337cb5e8e69f50b539d3c0de95ab
|
|
||||||
# Parent a6c226548fa02c3ac4681499103cd85217c6de07
|
|
||||||
Bug 1660901 - Support the fstat-like subset of fstatat in the Linux sandbox policies. r=gcp, a=RyanVM
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D88499
|
|
||||||
|
|
||||||
diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
--- a/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
+++ b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
@@ -238,16 +238,22 @@ class SandboxPolicyCommon : public Sandb
|
|
||||||
}
|
|
||||||
|
|
||||||
static intptr_t StatAtTrap(ArgsRef aArgs, void* aux) {
|
|
||||||
auto broker = static_cast<SandboxBrokerClient*>(aux);
|
|
||||||
auto fd = static_cast<int>(aArgs.args[0]);
|
|
||||||
auto path = reinterpret_cast<const char*>(aArgs.args[1]);
|
|
||||||
auto buf = reinterpret_cast<statstruct*>(aArgs.args[2]);
|
|
||||||
auto flags = static_cast<int>(aArgs.args[3]);
|
|
||||||
+
|
|
||||||
+ if (fd != AT_FDCWD && (flags & AT_EMPTY_PATH) != 0 &&
|
|
||||||
+ strcmp(path, "") == 0) {
|
|
||||||
+ return ConvertError(fstatsyscall(fd, buf));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (fd != AT_FDCWD && path[0] != '/') {
|
|
||||||
SANDBOX_LOG_ERROR("unsupported fd-relative fstatat(%d, \"%s\", %p, %d)",
|
|
||||||
fd, path, buf, flags);
|
|
||||||
return BlockedSyscallTrap(aArgs, nullptr);
|
|
||||||
}
|
|
||||||
if ((flags & ~AT_SYMLINK_NOFOLLOW) != 0) {
|
|
||||||
SANDBOX_LOG_ERROR("unsupported flags %d in fstatat(%d, \"%s\", %p, %d)",
|
|
||||||
(flags & ~AT_SYMLINK_NOFOLLOW), fd, path, buf, flags);
|
|
||||||
diff --git a/security/sandbox/linux/broker/SandboxBrokerUtils.h b/security/sandbox/linux/broker/SandboxBrokerUtils.h
|
|
||||||
--- a/security/sandbox/linux/broker/SandboxBrokerUtils.h
|
|
||||||
+++ b/security/sandbox/linux/broker/SandboxBrokerUtils.h
|
|
||||||
@@ -14,17 +14,19 @@
|
|
||||||
// On 32-bit Linux, stat calls are translated by libc into stat64
|
|
||||||
// calls. We'll intercept those and handle them in the stat functions
|
|
||||||
// but must be sure to use the right structure layout.
|
|
||||||
|
|
||||||
#if defined(__NR_stat64)
|
|
||||||
typedef struct stat64 statstruct;
|
|
||||||
# define statsyscall stat64
|
|
||||||
# define lstatsyscall lstat64
|
|
||||||
+# define fstatsyscall fstat64
|
|
||||||
#elif defined(__NR_stat)
|
|
||||||
typedef struct stat statstruct;
|
|
||||||
# define statsyscall stat
|
|
||||||
# define lstatsyscall lstat
|
|
||||||
+# define fstatsyscall fstat
|
|
||||||
#else
|
|
||||||
# error Missing stat syscall include.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // mozilla_SandboxBrokerUtils_h
|
|
||||||
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
|
|
||||||
# HG changeset patch
|
|
||||||
# User Julien Cristau <jcristau@mozilla.com>
|
|
||||||
# Date 1599423639 0
|
|
||||||
# Node ID 8ecb82a2f65cf6082d50d1e00453fbeba97633fb
|
|
||||||
# Parent 0ce38d3c2aa2357df4a8fcc5fd39d3af05fce7e1
|
|
||||||
Bug 1660901 - ignore AT_NO_AUTOMOUNT in fstatat system call. r=jld, a=RyanVM
|
|
||||||
|
|
||||||
Per the manpage "Both stat() and lstat() act as though AT_NO_AUTOMOUNT
|
|
||||||
was set.", so don't bail if it's set in a call to fstatat.
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D89121
|
|
||||||
|
|
||||||
diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
--- a/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
+++ b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
@@ -249,19 +249,20 @@ class SandboxPolicyCommon : public Sandb
|
|
||||||
return ConvertError(fstatsyscall(fd, buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fd != AT_FDCWD && path[0] != '/') {
|
|
||||||
SANDBOX_LOG_ERROR("unsupported fd-relative fstatat(%d, \"%s\", %p, %d)",
|
|
||||||
fd, path, buf, flags);
|
|
||||||
return BlockedSyscallTrap(aArgs, nullptr);
|
|
||||||
}
|
|
||||||
- if ((flags & ~AT_SYMLINK_NOFOLLOW) != 0) {
|
|
||||||
+ if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)) != 0) {
|
|
||||||
SANDBOX_LOG_ERROR("unsupported flags %d in fstatat(%d, \"%s\", %p, %d)",
|
|
||||||
- (flags & ~AT_SYMLINK_NOFOLLOW), fd, path, buf, flags);
|
|
||||||
+ (flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)), fd,
|
|
||||||
+ path, buf, flags);
|
|
||||||
return BlockedSyscallTrap(aArgs, nullptr);
|
|
||||||
}
|
|
||||||
return (flags & AT_SYMLINK_NOFOLLOW) == 0 ? broker->Stat(path, buf)
|
|
||||||
: broker->LStat(path, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static intptr_t ChmodTrap(ArgsRef aArgs, void* aux) {
|
|
||||||
auto broker = static_cast<SandboxBrokerClient*>(aux);
|
|
||||||
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
|
|
||||||
# HG changeset patch
|
|
||||||
# User Jed Davis <jld@mozilla.com>
|
|
||||||
# Date 1603832709 0
|
|
||||||
# Node ID 13d5867b039948a79fa80fc2081a17b8089f1ed7
|
|
||||||
# Parent 0322427df80a91fdeace25c1508105074dc8adad
|
|
||||||
Bug 1673202 - Call fstat directly in Linux sandbox fstatat interception. r=gcp, a=RyanVM
|
|
||||||
|
|
||||||
Sandbox policies handle the case of `fstatat(fd, "", AT_EMPTY_PATH|...)`
|
|
||||||
by invoking the SIGSYS handler (because seccomp-bpf can't tell if the
|
|
||||||
string will be empty when the syscall would use it), which makes the
|
|
||||||
equivalent call to `fstat`.
|
|
||||||
|
|
||||||
Unfortunately, recent development versions of glibc implement `fstat` by
|
|
||||||
calling `fstatat`, which causes unbounded recursion and stack overflow.
|
|
||||||
(This depends on the headers present at build time; see the bug for more
|
|
||||||
details.) This patch switches it to use the `fstat` (or `fstat64` on
|
|
||||||
32-bit) syscall directly.
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D94798
|
|
||||||
|
|
||||||
diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
--- a/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
+++ b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
@@ -241,17 +241,21 @@ class SandboxPolicyCommon : public Sandb
|
|
||||||
auto broker = static_cast<SandboxBrokerClient*>(aux);
|
|
||||||
auto fd = static_cast<int>(aArgs.args[0]);
|
|
||||||
auto path = reinterpret_cast<const char*>(aArgs.args[1]);
|
|
||||||
auto buf = reinterpret_cast<statstruct*>(aArgs.args[2]);
|
|
||||||
auto flags = static_cast<int>(aArgs.args[3]);
|
|
||||||
|
|
||||||
if (fd != AT_FDCWD && (flags & AT_EMPTY_PATH) != 0 &&
|
|
||||||
strcmp(path, "") == 0) {
|
|
||||||
- return ConvertError(fstatsyscall(fd, buf));
|
|
||||||
+#ifdef __NR_fstat64
|
|
||||||
+ return DoSyscall(__NR_fstat64, fd, buf);
|
|
||||||
+#else
|
|
||||||
+ return DoSyscall(__NR_fstat, fd, buf);
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fd != AT_FDCWD && path[0] != '/') {
|
|
||||||
SANDBOX_LOG_ERROR("unsupported fd-relative fstatat(%d, \"%s\", %p, %d)",
|
|
||||||
fd, path, buf, flags);
|
|
||||||
return BlockedSyscallTrap(aArgs, nullptr);
|
|
||||||
}
|
|
||||||
if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)) != 0) {
|
|
||||||
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
|
|
||||||
# HG changeset patch
|
|
||||||
# User Jed Davis <jld@mozilla.com>
|
|
||||||
# Date 1603993288 0
|
|
||||||
# Node ID 3962fa9f3084c5bca8458cecdaac664dc431164a
|
|
||||||
# Parent 4e708898d49e078de5f946d03b0627779b282fd0
|
|
||||||
Bug 1673770 - Extend the handling of fstatat-as-fstat to sandboxes that don't use a file broker. r=gcp, a=RyanVM
|
|
||||||
|
|
||||||
The fix for bug 1660901, to handle the subset of fstatat that is
|
|
||||||
equivalent to fstat, was incomplete: it was added to the existing
|
|
||||||
hook for the file broker, so processes that don't use a broker (like
|
|
||||||
GMP) didn't get the fix. That wasn't a problem when the only use of
|
|
||||||
that feature was in content processes via GTK, but now that glibc has
|
|
||||||
reimplemented fstat that way, it's necessary for all processes.
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D95108
|
|
||||||
|
|
||||||
diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
--- a/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
+++ b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
@@ -248,16 +248,20 @@ class SandboxPolicyCommon : public Sandb
|
|
||||||
strcmp(path, "") == 0) {
|
|
||||||
#ifdef __NR_fstat64
|
|
||||||
return DoSyscall(__NR_fstat64, fd, buf);
|
|
||||||
#else
|
|
||||||
return DoSyscall(__NR_fstat, fd, buf);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (!broker) {
|
|
||||||
+ return BlockedSyscallTrap(aArgs, nullptr);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (fd != AT_FDCWD && path[0] != '/') {
|
|
||||||
SANDBOX_LOG_ERROR("unsupported fd-relative fstatat(%d, \"%s\", %p, %d)",
|
|
||||||
fd, path, buf, flags);
|
|
||||||
return BlockedSyscallTrap(aArgs, nullptr);
|
|
||||||
}
|
|
||||||
if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)) != 0) {
|
|
||||||
SANDBOX_LOG_ERROR("unsupported flags %d in fstatat(%d, \"%s\", %p, %d)",
|
|
||||||
(flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)), fd,
|
|
||||||
@@ -442,17 +446,17 @@ class SandboxPolicyCommon : public Sandb
|
|
||||||
return Nothing();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ResultExpr EvaluateSyscall(int sysno) const override {
|
|
||||||
// If a file broker client was provided, route syscalls to it;
|
|
||||||
// otherwise, fall through to the main policy, which will deny
|
|
||||||
// them.
|
|
||||||
- if (mBroker != nullptr) {
|
|
||||||
+ if (mBroker) {
|
|
||||||
switch (sysno) {
|
|
||||||
case __NR_open:
|
|
||||||
return Trap(OpenTrap, mBroker);
|
|
||||||
case __NR_openat:
|
|
||||||
return Trap(OpenAtTrap, mBroker);
|
|
||||||
case __NR_access:
|
|
||||||
return Trap(AccessTrap, mBroker);
|
|
||||||
case __NR_faccessat:
|
|
||||||
@@ -481,16 +485,23 @@ class SandboxPolicyCommon : public Sandb
|
|
||||||
return Trap(RmdirTrap, mBroker);
|
|
||||||
case __NR_unlink:
|
|
||||||
return Trap(UnlinkTrap, mBroker);
|
|
||||||
case __NR_readlink:
|
|
||||||
return Trap(ReadlinkTrap, mBroker);
|
|
||||||
case __NR_readlinkat:
|
|
||||||
return Trap(ReadlinkAtTrap, mBroker);
|
|
||||||
}
|
|
||||||
+ } else {
|
|
||||||
+ // In the absence of a broker we still need to handle the
|
|
||||||
+ // fstat-equivalent subset of fstatat; see bug 1673770.
|
|
||||||
+ switch (sysno) {
|
|
||||||
+ CASES_FOR_fstatat:
|
|
||||||
+ return Trap(StatAtTrap, nullptr);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (sysno) {
|
|
||||||
// Timekeeping
|
|
||||||
case __NR_clock_nanosleep:
|
|
||||||
case __NR_clock_getres:
|
|
||||||
#ifdef __NR_clock_gettime64
|
|
||||||
case __NR_clock_gettime64:
|
|
||||||
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
# HG changeset patch
|
|
||||||
# User Emilio Cobos Álvarez <emilio@crisal.io>
|
|
||||||
# Date 1606915787 -3600
|
|
||||||
# Node ID 8aa3952dd7208d96648ea171f814c748ec027630
|
|
||||||
# Parent ff436849850a87dfa3db032e80eaba5e5a3536f4
|
|
||||||
Bug 1680166 - GCC is smarter than clang, so ignore the warning properly. a=RyanVM
|
|
||||||
|
|
||||||
diff --git a/security/sandbox/linux/gtest/TestBroker.cpp b/security/sandbox/linux/gtest/TestBroker.cpp
|
|
||||||
--- a/security/sandbox/linux/gtest/TestBroker.cpp
|
|
||||||
+++ b/security/sandbox/linux/gtest/TestBroker.cpp
|
|
||||||
@@ -212,23 +212,27 @@ TEST_F(SandboxBrokerTest, Access) {
|
|
||||||
|
|
||||||
TEST_F(SandboxBrokerTest, Stat) {
|
|
||||||
statstruct realStat, brokeredStat;
|
|
||||||
ASSERT_EQ(0, statsyscall("/dev/null", &realStat)) << "Shouldn't ever fail!";
|
|
||||||
EXPECT_EQ(0, Stat("/dev/null", &brokeredStat));
|
|
||||||
EXPECT_EQ(realStat.st_ino, brokeredStat.st_ino);
|
|
||||||
EXPECT_EQ(realStat.st_rdev, brokeredStat.st_rdev);
|
|
||||||
|
|
||||||
- // Add some indirection to avoid -Wnonnull warnings.
|
|
||||||
- [&](const char* aPath) {
|
|
||||||
- EXPECT_EQ(-1, statsyscall(aPath, &realStat));
|
|
||||||
- EXPECT_EQ(errno, EFAULT);
|
|
||||||
+#if defined(__clang__) || defined(__GNUC__)
|
|
||||||
+# pragma GCC diagnostic push
|
|
||||||
+# pragma GCC diagnostic ignored "-Wnonnull"
|
|
||||||
+#endif
|
|
||||||
+ EXPECT_EQ(-1, statsyscall(nullptr, &realStat));
|
|
||||||
+ EXPECT_EQ(errno, EFAULT);
|
|
||||||
|
|
||||||
- EXPECT_EQ(-EFAULT, Stat(aPath, &brokeredStat));
|
|
||||||
- }(nullptr);
|
|
||||||
+ EXPECT_EQ(-EFAULT, Stat(nullptr, &brokeredStat));
|
|
||||||
+#if defined(__clang__) || defined(__GNUC__)
|
|
||||||
+# pragma GCC diagnostic pop
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
EXPECT_EQ(-ENOENT, Stat("/var/empty/qwertyuiop", &brokeredStat));
|
|
||||||
EXPECT_EQ(-EACCES, Stat("/dev", &brokeredStat));
|
|
||||||
|
|
||||||
EXPECT_EQ(0, Stat("/proc/self", &brokeredStat));
|
|
||||||
EXPECT_TRUE(S_ISDIR(brokeredStat.st_mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,120 +0,0 @@
|
|||||||
|
|
||||||
# HG changeset patch
|
|
||||||
# User Emilio Cobos Álvarez <emilio@crisal.io>
|
|
||||||
# Date 1606907116 0
|
|
||||||
# Node ID ff436849850a87dfa3db032e80eaba5e5a3536f4
|
|
||||||
# Parent f326cd8f9f19a8f3b5edf9d6838fdce5b02d9c64
|
|
||||||
Bug 1680166 - Return EFAULT when given a null path to stat* calls in the sandbox filter. r=gcp, a=RyanVM
|
|
||||||
|
|
||||||
It's a common way to check the existence of system calls. Glibc may fall
|
|
||||||
back to fstatat when statx is called, passing down the null path.
|
|
||||||
|
|
||||||
Since we handle fstatat, let's return -EFAULT the same way the real
|
|
||||||
fstatat syscall would do.
|
|
||||||
|
|
||||||
This is needed for the sandbox not to constantly crash due to this statx
|
|
||||||
call in rustc:
|
|
||||||
|
|
||||||
https://github.com/rust-lang/rust/blob/09c9c9f7da72b774cc445c0f56fc0b9792a49647/library/std/src/sys/unix/fs.rs#L119-L123
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D98414
|
|
||||||
|
|
||||||
diff --git a/security/sandbox/linux/SandboxBrokerClient.cpp b/security/sandbox/linux/SandboxBrokerClient.cpp
|
|
||||||
--- a/security/sandbox/linux/SandboxBrokerClient.cpp
|
|
||||||
+++ b/security/sandbox/linux/SandboxBrokerClient.cpp
|
|
||||||
@@ -154,21 +154,29 @@ int SandboxBrokerClient::Open(const char
|
|
||||||
}
|
|
||||||
|
|
||||||
int SandboxBrokerClient::Access(const char* aPath, int aMode) {
|
|
||||||
Request req = {SANDBOX_FILE_ACCESS, aMode, 0};
|
|
||||||
return DoCall(&req, aPath, nullptr, nullptr, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
int SandboxBrokerClient::Stat(const char* aPath, statstruct* aStat) {
|
|
||||||
+ if (!aPath || !aStat) {
|
|
||||||
+ return -EFAULT;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
Request req = {SANDBOX_FILE_STAT, 0, sizeof(statstruct)};
|
|
||||||
return DoCall(&req, aPath, nullptr, (void*)aStat, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
int SandboxBrokerClient::LStat(const char* aPath, statstruct* aStat) {
|
|
||||||
+ if (!aPath || !aStat) {
|
|
||||||
+ return -EFAULT;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
Request req = {SANDBOX_FILE_STAT, O_NOFOLLOW, sizeof(statstruct)};
|
|
||||||
return DoCall(&req, aPath, nullptr, (void*)aStat, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
int SandboxBrokerClient::Chmod(const char* aPath, int aMode) {
|
|
||||||
Request req = {SANDBOX_FILE_CHMOD, aMode, 0};
|
|
||||||
return DoCall(&req, aPath, nullptr, nullptr, false);
|
|
||||||
}
|
|
||||||
diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
--- a/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
+++ b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
@@ -239,30 +239,30 @@ class SandboxPolicyCommon : public Sandb
|
|
||||||
|
|
||||||
static intptr_t StatAtTrap(ArgsRef aArgs, void* aux) {
|
|
||||||
auto broker = static_cast<SandboxBrokerClient*>(aux);
|
|
||||||
auto fd = static_cast<int>(aArgs.args[0]);
|
|
||||||
auto path = reinterpret_cast<const char*>(aArgs.args[1]);
|
|
||||||
auto buf = reinterpret_cast<statstruct*>(aArgs.args[2]);
|
|
||||||
auto flags = static_cast<int>(aArgs.args[3]);
|
|
||||||
|
|
||||||
- if (fd != AT_FDCWD && (flags & AT_EMPTY_PATH) != 0 &&
|
|
||||||
- strcmp(path, "") == 0) {
|
|
||||||
+ if (fd != AT_FDCWD && (flags & AT_EMPTY_PATH) && path &&
|
|
||||||
+ !strcmp(path, "")) {
|
|
||||||
#ifdef __NR_fstat64
|
|
||||||
return DoSyscall(__NR_fstat64, fd, buf);
|
|
||||||
#else
|
|
||||||
return DoSyscall(__NR_fstat, fd, buf);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!broker) {
|
|
||||||
return BlockedSyscallTrap(aArgs, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (fd != AT_FDCWD && path[0] != '/') {
|
|
||||||
+ if (fd != AT_FDCWD && path && path[0] != '/') {
|
|
||||||
SANDBOX_LOG_ERROR("unsupported fd-relative fstatat(%d, \"%s\", %p, %d)",
|
|
||||||
fd, path, buf, flags);
|
|
||||||
return BlockedSyscallTrap(aArgs, nullptr);
|
|
||||||
}
|
|
||||||
if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)) != 0) {
|
|
||||||
SANDBOX_LOG_ERROR("unsupported flags %d in fstatat(%d, \"%s\", %p, %d)",
|
|
||||||
(flags & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)), fd,
|
|
||||||
path, buf, flags);
|
|
||||||
diff --git a/security/sandbox/linux/gtest/TestBroker.cpp b/security/sandbox/linux/gtest/TestBroker.cpp
|
|
||||||
--- a/security/sandbox/linux/gtest/TestBroker.cpp
|
|
||||||
+++ b/security/sandbox/linux/gtest/TestBroker.cpp
|
|
||||||
@@ -212,16 +212,24 @@ TEST_F(SandboxBrokerTest, Access) {
|
|
||||||
|
|
||||||
TEST_F(SandboxBrokerTest, Stat) {
|
|
||||||
statstruct realStat, brokeredStat;
|
|
||||||
ASSERT_EQ(0, statsyscall("/dev/null", &realStat)) << "Shouldn't ever fail!";
|
|
||||||
EXPECT_EQ(0, Stat("/dev/null", &brokeredStat));
|
|
||||||
EXPECT_EQ(realStat.st_ino, brokeredStat.st_ino);
|
|
||||||
EXPECT_EQ(realStat.st_rdev, brokeredStat.st_rdev);
|
|
||||||
|
|
||||||
+ // Add some indirection to avoid -Wnonnull warnings.
|
|
||||||
+ [&](const char* aPath) {
|
|
||||||
+ EXPECT_EQ(-1, statsyscall(aPath, &realStat));
|
|
||||||
+ EXPECT_EQ(errno, EFAULT);
|
|
||||||
+
|
|
||||||
+ EXPECT_EQ(-EFAULT, Stat(aPath, &brokeredStat));
|
|
||||||
+ }(nullptr);
|
|
||||||
+
|
|
||||||
EXPECT_EQ(-ENOENT, Stat("/var/empty/qwertyuiop", &brokeredStat));
|
|
||||||
EXPECT_EQ(-EACCES, Stat("/dev", &brokeredStat));
|
|
||||||
|
|
||||||
EXPECT_EQ(0, Stat("/proc/self", &brokeredStat));
|
|
||||||
EXPECT_TRUE(S_ISDIR(brokeredStat.st_mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SandboxBrokerTest, LStat) {
|
|
||||||
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Kris Maglione <maglione.k@gmail.com>
|
|
||||||
# Date 1597420945 0
|
|
||||||
# Fri Aug 14 16:02:25 2020 +0000
|
|
||||||
# Node ID 1edd9346c110b011ed87e50eb3d417202ea445fb
|
|
||||||
# Parent f69f80e5659f11977e7f1bd48386ea22e921dd52
|
|
||||||
Bug 1658214: Only construct JS-implemented objects if inner window is current. r=bholley
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D86614
|
|
||||||
|
|
||||||
diff -r f69f80e5659f -r 1edd9346c110 dom/bindings/BindingUtils.cpp
|
|
||||||
--- a/dom/bindings/BindingUtils.cpp Fri Aug 14 15:57:45 2020 +0000
|
|
||||||
+++ b/dom/bindings/BindingUtils.cpp Fri Aug 14 16:02:25 2020 +0000
|
|
||||||
@@ -2547,6 +2547,12 @@
|
|
||||||
{
|
|
||||||
AutoNoJSAPI nojsapi;
|
|
||||||
|
|
||||||
+ nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
|
|
||||||
+ if (!window->IsCurrentInnerWindow()) {
|
|
||||||
+ aRv.ThrowInvalidStateError("Window no longer active");
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
// Get the XPCOM component containing the JS implementation.
|
|
||||||
nsresult rv;
|
|
||||||
nsCOMPtr<nsISupports> implISupports = do_CreateInstance(aContractId, &rv);
|
|
||||||
@@ -2561,7 +2567,6 @@
|
|
||||||
// and our global is a window.
|
|
||||||
nsCOMPtr<nsIDOMGlobalPropertyInitializer> gpi =
|
|
||||||
do_QueryInterface(implISupports);
|
|
||||||
- nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal);
|
|
||||||
if (gpi) {
|
|
||||||
JS::Rooted<JS::Value> initReturn(RootingCx());
|
|
||||||
rv = gpi->Init(window, &initReturn);
|
|
||||||
@ -1,137 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Gijs Kruitbosch <gijskruitbosch@gmail.com>
|
|
||||||
# Date 1594843114 0
|
|
||||||
# Wed Jul 15 19:58:34 2020 +0000
|
|
||||||
# Node ID 8079eea73df334803da5b07322b19d32aa8ed9e3
|
|
||||||
# Parent 8dee8cb525a2c7cff36a89be107eb50628619201
|
|
||||||
Bug 1651636 - reset the address bar when beforeunload prompts close, r=mak
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D83213
|
|
||||||
|
|
||||||
diff -r 8dee8cb525a2 -r 8079eea73df3 browser/actors/PromptParent.jsm
|
|
||||||
--- a/browser/actors/PromptParent.jsm Wed Jul 15 19:45:37 2020 +0000
|
|
||||||
+++ b/browser/actors/PromptParent.jsm Wed Jul 15 19:58:34 2020 +0000
|
|
||||||
@@ -169,7 +169,10 @@
|
|
||||||
|
|
||||||
this.unregisterPrompt(id);
|
|
||||||
|
|
||||||
- PromptUtils.fireDialogEvent(window, "DOMModalDialogClosed", browser);
|
|
||||||
+ PromptUtils.fireDialogEvent(window, "DOMModalDialogClosed", browser, {
|
|
||||||
+ wasPermitUnload: args.inPermitUnload,
|
|
||||||
+ areLeaving: args.ok,
|
|
||||||
+ });
|
|
||||||
resolver(args);
|
|
||||||
browser.maybeLeaveModalState();
|
|
||||||
};
|
|
||||||
diff -r 8dee8cb525a2 -r 8079eea73df3 browser/base/content/tabbrowser.js
|
|
||||||
--- a/browser/base/content/tabbrowser.js Wed Jul 15 19:45:37 2020 +0000
|
|
||||||
+++ b/browser/base/content/tabbrowser.js Wed Jul 15 19:58:34 2020 +0000
|
|
||||||
@@ -5418,6 +5418,26 @@
|
|
||||||
true
|
|
||||||
);
|
|
||||||
|
|
||||||
+ // When cancelling beforeunload tabmodal dialogs, reset the URL bar to
|
|
||||||
+ // avoid spoofing risks.
|
|
||||||
+ this.addEventListener(
|
|
||||||
+ "DOMModalDialogClosed",
|
|
||||||
+ event => {
|
|
||||||
+ if (
|
|
||||||
+ !event.detail?.wasPermitUnload ||
|
|
||||||
+ event.detail.areLeaving ||
|
|
||||||
+ event.target.nodeName != "browser"
|
|
||||||
+ ) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ event.target.userTypedValue = null;
|
|
||||||
+ if (event.target == this.selectedBrowser) {
|
|
||||||
+ gURLBar.setURI();
|
|
||||||
+ }
|
|
||||||
+ },
|
|
||||||
+ true
|
|
||||||
+ );
|
|
||||||
+
|
|
||||||
let onTabCrashed = event => {
|
|
||||||
if (!event.isTrusted || !event.isTopFrame) {
|
|
||||||
return;
|
|
||||||
diff -r 8dee8cb525a2 -r 8079eea73df3 browser/base/content/test/tabPrompts/browser.ini
|
|
||||||
--- a/browser/base/content/test/tabPrompts/browser.ini Wed Jul 15 19:45:37 2020 +0000
|
|
||||||
+++ b/browser/base/content/test/tabPrompts/browser.ini Wed Jul 15 19:58:34 2020 +0000
|
|
||||||
@@ -1,3 +1,5 @@
|
|
||||||
+[browser_beforeunload_urlbar.js]
|
|
||||||
+support-files = file_beforeunload_stop.html
|
|
||||||
[browser_closeTabSpecificPanels.js]
|
|
||||||
skip-if = (verify && debug && (os == 'linux')) || (fission && os == 'linux' && bits == 64 && os_version == '18.04') # Bug 1548664
|
|
||||||
[browser_multiplePrompts.js]
|
|
||||||
diff -r 8dee8cb525a2 -r 8079eea73df3 browser/base/content/test/tabPrompts/browser_beforeunload_urlbar.js
|
|
||||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
||||||
+++ b/browser/base/content/test/tabPrompts/browser_beforeunload_urlbar.js Wed Jul 15 19:58:34 2020 +0000
|
|
||||||
@@ -0,0 +1,57 @@
|
|
||||||
+/* Any copyright is dedicated to the Public Domain.
|
|
||||||
+ http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
||||||
+
|
|
||||||
+"use strict";
|
|
||||||
+
|
|
||||||
+const TEST_ROOT = getRootDirectory(gTestPath).replace(
|
|
||||||
+ "chrome://mochitests/content",
|
|
||||||
+ "http://example.com"
|
|
||||||
+);
|
|
||||||
+
|
|
||||||
+add_task(async function test_beforeunload_stay_clears_urlbar() {
|
|
||||||
+ await SpecialPowers.pushPrefEnv({
|
|
||||||
+ set: [["dom.require_user_interaction_for_beforeunload", false]],
|
|
||||||
+ });
|
|
||||||
+ const TEST_URL = TEST_ROOT + "file_beforeunload_stop.html";
|
|
||||||
+ await BrowserTestUtils.withNewTab(TEST_URL, async function(browser) {
|
|
||||||
+ gURLBar.focus();
|
|
||||||
+ const inputValue = "http://example.org/?q=typed";
|
|
||||||
+ gURLBar.inputField.value = inputValue.slice(0, -1);
|
|
||||||
+ EventUtils.sendString(inputValue.slice(-1));
|
|
||||||
+
|
|
||||||
+ let promptOpenedPromise = TestUtils.topicObserved("tabmodal-dialog-loaded");
|
|
||||||
+ EventUtils.synthesizeKey("VK_RETURN");
|
|
||||||
+ await promptOpenedPromise;
|
|
||||||
+ let promptElement = browser.parentNode.querySelector("tabmodalprompt");
|
|
||||||
+
|
|
||||||
+ // Click the cancel button
|
|
||||||
+ promptElement.querySelector(".tabmodalprompt-button1").click();
|
|
||||||
+
|
|
||||||
+ await TestUtils.waitForCondition(
|
|
||||||
+ () => promptElement.parentNode == null,
|
|
||||||
+ "tabprompt should be removed"
|
|
||||||
+ );
|
|
||||||
+ // Can't just compare directly with TEST_URL because the URL may be trimmed.
|
|
||||||
+ // Just need it to not be the example.org thing we typed in.
|
|
||||||
+ ok(
|
|
||||||
+ gURLBar.value.endsWith("_stop.html"),
|
|
||||||
+ "Url bar should be reset to point to the stop html file"
|
|
||||||
+ );
|
|
||||||
+ ok(
|
|
||||||
+ gURLBar.value.includes("example.com"),
|
|
||||||
+ "Url bar should be reset to example.com"
|
|
||||||
+ );
|
|
||||||
+ // Check the lock/identity icons are back:
|
|
||||||
+ is(
|
|
||||||
+ gURLBar.textbox.getAttribute("pageproxystate"),
|
|
||||||
+ "valid",
|
|
||||||
+ "Should be in valid pageproxy state."
|
|
||||||
+ );
|
|
||||||
+
|
|
||||||
+ // Now we need to get rid of the handler to avoid the prompt coming up when trying to close the
|
|
||||||
+ // tab when we exit `withNewTab`. :-)
|
|
||||||
+ await SpecialPowers.spawn(browser, [], function() {
|
|
||||||
+ content.window.onbeforeunload = null;
|
|
||||||
+ });
|
|
||||||
+ });
|
|
||||||
+});
|
|
||||||
diff -r 8dee8cb525a2 -r 8079eea73df3 browser/base/content/test/tabPrompts/file_beforeunload_stop.html
|
|
||||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
||||||
+++ b/browser/base/content/test/tabPrompts/file_beforeunload_stop.html Wed Jul 15 19:58:34 2020 +0000
|
|
||||||
@@ -0,0 +1,8 @@
|
|
||||||
+<body>
|
|
||||||
+ <p>I will ask not to be closed.</p>
|
|
||||||
+ <script>
|
|
||||||
+ window.onbeforeunload = function() {
|
|
||||||
+ return "true";
|
|
||||||
+ };
|
|
||||||
+ </script>
|
|
||||||
+</body>
|
|
||||||
@ -1,113 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Sebastian Streich <sstreich@mozilla.com>
|
|
||||||
# Date 1594901018 0
|
|
||||||
# Thu Jul 16 12:03:38 2020 +0000
|
|
||||||
# Node ID b8f37ab6318150a94022625b0500efce2c456947
|
|
||||||
# Parent 7e7affa995d31d0325c26d7a9994971e7682f3a0
|
|
||||||
Bug 1450853 - Use Generic Error for 3rdparty MediaElement r=ckerschb,smaug
|
|
||||||
|
|
||||||
***
|
|
||||||
Add test
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D80080
|
|
||||||
|
|
||||||
diff -r 7e7affa995d3 -r b8f37ab63181 dom/html/HTMLMediaElement.cpp
|
|
||||||
--- a/dom/html/HTMLMediaElement.cpp Thu Jul 16 12:23:08 2020 +0000
|
|
||||||
+++ b/dom/html/HTMLMediaElement.cpp Thu Jul 16 12:03:38 2020 +0000
|
|
||||||
@@ -2354,7 +2354,24 @@
|
|
||||||
if (mDecoder) {
|
|
||||||
ShutdownDecoder();
|
|
||||||
}
|
|
||||||
- mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED, aErrorDetails);
|
|
||||||
+
|
|
||||||
+ bool isThirdPartyLoad = false;
|
|
||||||
+ nsresult rv = NS_ERROR_NOT_AVAILABLE;
|
|
||||||
+ if (mSrcAttrTriggeringPrincipal) {
|
|
||||||
+ rv = mSrcAttrTriggeringPrincipal->IsThirdPartyURI(mLoadingSrc,
|
|
||||||
+ &isThirdPartyLoad);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (NS_SUCCEEDED(rv) && isThirdPartyLoad) {
|
|
||||||
+ // aErrorDetails can include sensitive details like MimeType or HTTP Status
|
|
||||||
+ // Code. In case we're loading a 3rd party resource we should not leak this
|
|
||||||
+ // and pass a Generic Error Message
|
|
||||||
+ mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED,
|
|
||||||
+ NS_LITERAL_CSTRING("Failed to open media"));
|
|
||||||
+ } else {
|
|
||||||
+ mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED, aErrorDetails);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
RemoveMediaTracks();
|
|
||||||
ChangeDelayLoadStatus(false);
|
|
||||||
UpdateAudioChannelPlayingState();
|
|
||||||
diff -r 7e7affa995d3 -r b8f37ab63181 dom/security/test/general/mochitest.ini
|
|
||||||
--- a/dom/security/test/general/mochitest.ini Thu Jul 16 12:23:08 2020 +0000
|
|
||||||
+++ b/dom/security/test/general/mochitest.ini Thu Jul 16 12:03:38 2020 +0000
|
|
||||||
@@ -63,3 +63,4 @@
|
|
||||||
[test_sec_fetch_websocket.html]
|
|
||||||
skip-if = toolkit == 'android' # no websocket support Bug 982828
|
|
||||||
support-files = file_sec_fetch_websocket_wsh.py
|
|
||||||
+[test_bug1450853.html]
|
|
||||||
\ No newline at end of file
|
|
||||||
diff -r 7e7affa995d3 -r b8f37ab63181 dom/security/test/general/test_bug1450853.html
|
|
||||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
||||||
+++ b/dom/security/test/general/test_bug1450853.html Thu Jul 16 12:03:38 2020 +0000
|
|
||||||
@@ -0,0 +1,58 @@
|
|
||||||
+<!DOCTYPE html>
|
|
||||||
+<html>
|
|
||||||
+<!--
|
|
||||||
+https://bugzilla.mozilla.org/show_bug.cgi?id=1450853
|
|
||||||
+-->
|
|
||||||
+<head>
|
|
||||||
+<meta charset="utf-8">
|
|
||||||
+<title>Test for Cross-origin resouce status leak via MediaError</title>
|
|
||||||
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
+<script src="/tests/SimpleTest/ChromeTask.js"></script>
|
|
||||||
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
|
||||||
+
|
|
||||||
+<audio autoplay id="audio"></audio>
|
|
||||||
+
|
|
||||||
+<script type="application/javascript">
|
|
||||||
+
|
|
||||||
+/** Test for Bug 1450853 **/
|
|
||||||
+CONST_GENERIC_ERROR_MESSAGE = "Failed to open media";
|
|
||||||
+
|
|
||||||
+add_task(function() {
|
|
||||||
+ return new Promise((resolve) => {
|
|
||||||
+ let audioElement = document.getElementById("audio");
|
|
||||||
+
|
|
||||||
+ audioElement.onerror = function() {
|
|
||||||
+ let err = this.error;
|
|
||||||
+ let message = err.message;
|
|
||||||
+ info(`Got Audio Error -> ${message}`);
|
|
||||||
+ ok(message.includes("404"), "Same-Origin Error Message may contain status data");
|
|
||||||
+ resolve();
|
|
||||||
+ };
|
|
||||||
+ audioElement.src = "/media/test.mp3";
|
|
||||||
+ });
|
|
||||||
+});
|
|
||||||
+
|
|
||||||
+add_task(function() {
|
|
||||||
+ return new Promise((resolve) => {
|
|
||||||
+ let audioElement = document.getElementById("audio");
|
|
||||||
+
|
|
||||||
+ audioElement.onerror = function() {
|
|
||||||
+ let err = this.error;
|
|
||||||
+ let message = err.message;
|
|
||||||
+
|
|
||||||
+ info(`Got Audio Error -> ${message}`);
|
|
||||||
+ is(message,CONST_GENERIC_ERROR_MESSAGE, "Cross-Origin Error Message is only Generic");
|
|
||||||
+ resolve();
|
|
||||||
+ };
|
|
||||||
+ audioElement.src = "https://example.com/media/test.mp3";
|
|
||||||
+ });
|
|
||||||
+});
|
|
||||||
+
|
|
||||||
+</script>
|
|
||||||
+</head>
|
|
||||||
+
|
|
||||||
+<body>
|
|
||||||
+ <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1450853">Mozilla Bug 1450853</a>
|
|
||||||
+ <iframe width="0" height="0"></iframe>
|
|
||||||
+ </body>
|
|
||||||
+</html>
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Molly Howell <mhowell@mozilla.com>
|
|
||||||
# Date 1595024754 0
|
|
||||||
# Fri Jul 17 22:25:54 2020 +0000
|
|
||||||
# Node ID b79b6cc78248eea7fda10bfb76aa273c19c9fa65
|
|
||||||
# Parent 0c0f777161a9499dd149853ff62d356f75d16c2a
|
|
||||||
Bug 1653371 - Don't used a signed type for a length parameter. r=bytesized
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D84031
|
|
||||||
|
|
||||||
diff -r 0c0f777161a9 -r b79b6cc78248 modules/libmar/src/mar_read.c
|
|
||||||
--- a/modules/libmar/src/mar_read.c Sat Jul 18 02:57:28 2020 +0300
|
|
||||||
+++ b/modules/libmar/src/mar_read.c Fri Jul 17 22:25:54 2020 +0000
|
|
||||||
@@ -26,7 +26,7 @@
|
|
||||||
return CityHash64(name, strlen(name)) % TABLESIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
-static int mar_insert_item(MarFile* mar, const char* name, int namelen,
|
|
||||||
+static int mar_insert_item(MarFile* mar, const char* name, uint32_t namelen,
|
|
||||||
uint32_t offset, uint32_t length, uint32_t flags) {
|
|
||||||
MarItem *item, *root;
|
|
||||||
uint32_t hash;
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Kevin Jacobs <kjacobs@mozilla.com>
|
|
||||||
# Date 1594335948 0
|
|
||||||
# Thu Jul 09 23:05:48 2020 +0000
|
|
||||||
# Node ID 06be9b59deb034f3ec6ab93c55e3ba4039f690cd
|
|
||||||
# Parent 93092fe1e43c69a0b7e7b2960b4b55524ba30db0
|
|
||||||
Bug 1651520 - slotLock race in NSC_GetTokenInfo r=kjacobs
|
|
||||||
2020-07-09 J.C. Jones <jjones@mozilla.com>
|
|
||||||
|
|
||||||
* lib/softoken/pkcs11.c:
|
|
||||||
Bug 1651520 - slotLock race in NSC_GetTokenInfo r=kjacobs
|
|
||||||
|
|
||||||
Basically, NSC_GetTokenInfo doesn't lock slot->slotLock before
|
|
||||||
accessing slot after obtaining it, even though slotLock is defined
|
|
||||||
as its lock. [0]
|
|
||||||
|
|
||||||
[0] https://searchfox.org/nss/rev/a412e70e55218aaf670f1f10322fa734d8
|
|
||||||
a9fbde/lib/softoken/pkcs11i.h#320-321
|
|
||||||
[58c2abd7404e] [tip]
|
|
||||||
|
|
||||||
diff -r 93092fe1e43c -r 06be9b59deb0 security/nss/lib/softoken/pkcs11.c
|
|
||||||
--- a/security/nss/lib/softoken/pkcs11.c Thu Jul 09 23:16:09 2020 +0000
|
|
||||||
+++ b/security/nss/lib/softoken/pkcs11.c Thu Jul 09 23:05:48 2020 +0000
|
|
||||||
@@ -3661,10 +3661,12 @@
|
|
||||||
PORT_Memcpy(pInfo->model, "NSS 3 ", 16);
|
|
||||||
PORT_Memcpy(pInfo->serialNumber, "0000000000000000", 16);
|
|
||||||
PORT_Memcpy(pInfo->utcTime, "0000000000000000", 16);
|
|
||||||
- pInfo->ulMaxSessionCount = 0; /* arbitrarily large */
|
|
||||||
+ pInfo->ulMaxSessionCount = 0; /* arbitrarily large */
|
|
||||||
+ pInfo->ulMaxRwSessionCount = 0; /* arbitarily large */
|
|
||||||
+ PZ_Lock(slot->slotLock); /* Protect sessionCount / rwSessioncount */
|
|
||||||
pInfo->ulSessionCount = slot->sessionCount;
|
|
||||||
- pInfo->ulMaxRwSessionCount = 0; /* arbitarily large */
|
|
||||||
pInfo->ulRwSessionCount = slot->rwSessionCount;
|
|
||||||
+ PZ_Unlock(slot->slotLock); /* Unlock before sftk_getKeyDB */
|
|
||||||
pInfo->firmwareVersion.major = 0;
|
|
||||||
pInfo->firmwareVersion.minor = 0;
|
|
||||||
PORT_Memcpy(pInfo->label, slot->tokDescription, sizeof(pInfo->label));
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Kagami Sascha Rosylight <krosylight@mozilla.com>
|
|
||||||
# Date 1599489912 0
|
|
||||||
# Mon Sep 07 14:45:12 2020 +0000
|
|
||||||
# Node ID 67c242c00ce3e796dafb7e98bbbf025e29cc1c67
|
|
||||||
# Parent 749fda4e5eb11918833fa57e25adc77e4ed1db95
|
|
||||||
Bug 1646140 - Fire SVG onload only when scripting is enabled r=hsivonen
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D89218
|
|
||||||
|
|
||||||
diff -r 749fda4e5eb1 -r 67c242c00ce3 parser/html/nsHtml5TreeBuilderCppSupplement.h
|
|
||||||
--- a/parser/html/nsHtml5TreeBuilderCppSupplement.h Mon Sep 07 13:35:31 2020 +0000
|
|
||||||
+++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h Mon Sep 07 14:45:12 2020 +0000
|
|
||||||
@@ -1072,6 +1072,9 @@
|
|
||||||
}
|
|
||||||
if (aNamespace == kNameSpaceID_SVG) {
|
|
||||||
if (aName == nsGkAtoms::svg) {
|
|
||||||
+ if (!scriptingEnabled || mPreventScriptExecution) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
if (mBuilder) {
|
|
||||||
nsHtml5TreeOperation::SvgLoad(static_cast<nsIContent*>(aElement));
|
|
||||||
return;
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Gijs Kruitbosch <gijskruitbosch@gmail.com>
|
|
||||||
# Date 1597251031 0
|
|
||||||
# Wed Aug 12 16:50:31 2020 +0000
|
|
||||||
# Node ID 082de8244278d76f9d6d216a7fd5da772b5152d3
|
|
||||||
# Parent cc6db3162f6e3e9cdb85749054b52074b78c1643
|
|
||||||
Bug 1641487, r=jaws
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D86761
|
|
||||||
|
|
||||||
diff -r cc6db3162f6e -r 082de8244278 browser/components/downloads/DownloadsViewUI.jsm
|
|
||||||
--- a/browser/components/downloads/DownloadsViewUI.jsm Wed Aug 12 14:52:18 2020 +0000
|
|
||||||
+++ b/browser/components/downloads/DownloadsViewUI.jsm Wed Aug 12 16:50:31 2020 +0000
|
|
||||||
@@ -342,15 +342,7 @@
|
|
||||||
* Downloads View. Type is either l10n object or string literal.
|
|
||||||
*/
|
|
||||||
showStatusWithDetails(stateLabel, hoverStatus) {
|
|
||||||
- let referrer =
|
|
||||||
- this.download.source.referrerInfo &&
|
|
||||||
- this.download.source.referrerInfo.originalReferrer
|
|
||||||
- ? this.download.source.referrerInfo.originalReferrer.spec
|
|
||||||
- : null;
|
|
||||||
-
|
|
||||||
- let [displayHost] = DownloadUtils.getURIHost(
|
|
||||||
- referrer || this.download.source.url
|
|
||||||
- );
|
|
||||||
+ let [displayHost] = DownloadUtils.getURIHost(this.download.source.url);
|
|
||||||
let [displayDate] = DownloadUtils.getReadableDates(
|
|
||||||
new Date(this.download.endTime)
|
|
||||||
);
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Botond Ballo <botond@mozilla.com>
|
|
||||||
# Date 1598039821 0
|
|
||||||
# Fri Aug 21 19:57:01 2020 +0000
|
|
||||||
# Node ID 5718234b1f27780b0d98ca4e6f1a22e1b012205a
|
|
||||||
# Parent b6b562c539e326715fda1dcd020c1095a9520e93
|
|
||||||
Bug 1660211 - Respect iterator invalidation rules in ComputeClippedCompositionBounds(). r=kats
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D87893
|
|
||||||
|
|
||||||
diff -r b6b562c539e3 -r 5718234b1f27 gfx/layers/apz/src/APZCTreeManager.cpp
|
|
||||||
--- a/gfx/layers/apz/src/APZCTreeManager.cpp Fri Aug 21 20:42:59 2020 +0000
|
|
||||||
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp Fri Aug 21 19:57:01 2020 +0000
|
|
||||||
@@ -899,14 +899,13 @@
|
|
||||||
ParentLayerRect APZCTreeManager::ComputeClippedCompositionBounds(
|
|
||||||
const MutexAutoLock& aProofOfMapLock, ClippedCompositionBoundsMap& aDestMap,
|
|
||||||
ScrollableLayerGuid aGuid) {
|
|
||||||
- auto insertResult = aDestMap.insert(std::make_pair(aGuid, ParentLayerRect()));
|
|
||||||
- if (!insertResult.second) {
|
|
||||||
+ if (auto iter = aDestMap.find(aGuid); iter != aDestMap.end()) {
|
|
||||||
// We already computed it for this one, early-exit. This might happen
|
|
||||||
// because on a later iteration of mApzcMap we might encounter an ancestor
|
|
||||||
// of an APZC that we processed on an earlier iteration. In this case we
|
|
||||||
// would have computed the ancestor's clipped composition bounds when
|
|
||||||
// recursing up on the earlier iteration.
|
|
||||||
- return insertResult.first->second;
|
|
||||||
+ return iter->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
ParentLayerRect bounds = mApzcMap[aGuid].apzc->GetCompositionBounds();
|
|
||||||
@@ -916,7 +915,7 @@
|
|
||||||
// Recursion base case, where the APZC with guid `aGuid` has no parent.
|
|
||||||
// In this case, we don't need to clip `bounds` any further and can just
|
|
||||||
// early exit.
|
|
||||||
- insertResult.first->second = bounds;
|
|
||||||
+ aDestMap.emplace(aGuid, bounds);
|
|
||||||
return bounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -950,7 +949,7 @@
|
|
||||||
PixelCastJustification::MovingDownToChildren));
|
|
||||||
|
|
||||||
// Done!
|
|
||||||
- insertResult.first->second = bounds;
|
|
||||||
+ aDestMap.emplace(aGuid, bounds);
|
|
||||||
return bounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Dan Minor <dminor@mozilla.com>
|
|
||||||
# Date 1600897949 0
|
|
||||||
# Wed Sep 23 21:52:29 2020 +0000
|
|
||||||
# Node ID ed2a659e965f27943d9b0c15d6e78d14e1ce9cb2
|
|
||||||
# Parent 7b2de9e57a768d949b569ac83fe5d58147e731b5
|
|
||||||
Bug 1666570 - Cherrypick ffed0925f27d404173c1e3e750d818f432d2c019 from usrsctp; r=drno
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D91047
|
|
||||||
|
|
||||||
diff -r 7b2de9e57a76 -r ed2a659e965f netwerk/sctp/src/netinet/sctp_indata.c
|
|
||||||
--- a/netwerk/sctp/src/netinet/sctp_indata.c Wed Sep 23 19:42:19 2020 +0000
|
|
||||||
+++ b/netwerk/sctp/src/netinet/sctp_indata.c Wed Sep 23 21:52:29 2020 +0000
|
|
||||||
@@ -1664,6 +1664,7 @@ sctp_process_a_data_chunk(struct sctp_tc
|
|
||||||
/* Process a data chunk */
|
|
||||||
/* struct sctp_tmit_chunk *chk; */
|
|
||||||
struct sctp_tmit_chunk *chk;
|
|
||||||
+ struct sctp_stream_in *strm;
|
|
||||||
uint32_t tsn, fsn, gap, mid;
|
|
||||||
struct mbuf *dmbuf;
|
|
||||||
int the_len;
|
|
||||||
@@ -2296,12 +2297,13 @@ finish_express_del:
|
|
||||||
/* All can be removed */
|
|
||||||
TAILQ_FOREACH_SAFE(control, &asoc->pending_reply_queue, next, ncontrol) {
|
|
||||||
TAILQ_REMOVE(&asoc->pending_reply_queue, control, next);
|
|
||||||
+ strm = &asoc->strmin[control->sinfo_stream];
|
|
||||||
sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check);
|
|
||||||
if (*abort_flag) {
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
if (need_reasm_check) {
|
|
||||||
- (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[control->sinfo_stream], SCTP_READ_LOCK_NOT_HELD);
|
|
||||||
+ (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD);
|
|
||||||
need_reasm_check = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2316,12 +2318,13 @@ finish_express_del:
|
|
||||||
* control->sinfo_tsn > liste->tsn
|
|
||||||
*/
|
|
||||||
TAILQ_REMOVE(&asoc->pending_reply_queue, control, next);
|
|
||||||
+ strm = &asoc->strmin[control->sinfo_stream];
|
|
||||||
sctp_queue_data_to_stream(stcb, asoc, control, abort_flag, &need_reasm_check);
|
|
||||||
if (*abort_flag) {
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
if (need_reasm_check) {
|
|
||||||
- (void)sctp_deliver_reasm_check(stcb, asoc, &asoc->strmin[control->sinfo_stream], SCTP_READ_LOCK_NOT_HELD);
|
|
||||||
+ (void)sctp_deliver_reasm_check(stcb, asoc, strm, SCTP_READ_LOCK_NOT_HELD);
|
|
||||||
need_reasm_check = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Werner Lemberg <wl@gnu.org>
|
|
||||||
# Date 1603223819 0
|
|
||||||
# Tue Oct 20 19:56:59 2020 +0000
|
|
||||||
# Node ID 5c356dd9b0f31f612ce90b1f35b14d8cdb0b4ecb
|
|
||||||
# Parent a2ed93bf78d53309eb234b72ce0bf60ad93a3ac3
|
|
||||||
Bug 1672223 - [sfnt] Fix heap buffer overflow. r=jfkthame
|
|
||||||
|
|
||||||
This is CVE-2020-15999.
|
|
||||||
|
|
||||||
* src/sfnt/pngshim.c (Load_SBit_Png): Test bitmap size earlier.
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D94153
|
|
||||||
|
|
||||||
diff -r a2ed93bf78d5 -r 5c356dd9b0f3 modules/freetype2/src/sfnt/pngshim.c
|
|
||||||
--- a/modules/freetype2/src/sfnt/pngshim.c Tue Oct 20 21:14:51 2020 +0000
|
|
||||||
+++ b/modules/freetype2/src/sfnt/pngshim.c Tue Oct 20 19:56:59 2020 +0000
|
|
||||||
@@ -328,6 +328,13 @@
|
|
||||||
|
|
||||||
if ( populate_map_and_metrics )
|
|
||||||
{
|
|
||||||
+ /* reject too large bitmaps similarly to the rasterizer */
|
|
||||||
+ if ( imgHeight > 0x7FFF || imgWidth > 0x7FFF )
|
|
||||||
+ {
|
|
||||||
+ error = FT_THROW( Array_Too_Large );
|
|
||||||
+ goto DestroyExit;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
metrics->width = (FT_UShort)imgWidth;
|
|
||||||
metrics->height = (FT_UShort)imgHeight;
|
|
||||||
|
|
||||||
@@ -336,13 +343,6 @@
|
|
||||||
map->pixel_mode = FT_PIXEL_MODE_BGRA;
|
|
||||||
map->pitch = (int)( map->width * 4 );
|
|
||||||
map->num_grays = 256;
|
|
||||||
-
|
|
||||||
- /* reject too large bitmaps similarly to the rasterizer */
|
|
||||||
- if ( map->rows > 0x7FFF || map->width > 0x7FFF )
|
|
||||||
- {
|
|
||||||
- error = FT_THROW( Array_Too_Large );
|
|
||||||
- goto DestroyExit;
|
|
||||||
- }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* convert palette/gray image to rgb */
|
|
||||||
@ -1,406 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Lee Salzman <lsalzman@mozilla.com>
|
|
||||||
# Date 1601995009 0
|
|
||||||
# Tue Oct 06 14:36:49 2020 +0000
|
|
||||||
# Node ID 48c0f5033c286bd515b6f16e0905ff4ca94faf98
|
|
||||||
# Parent 5bc02423412647e3ee9a0681b38e418a10901601
|
|
||||||
Bug 1642028 - cherry-pick Skia blitting cleanups. r=jrmuizel
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D92476
|
|
||||||
|
|
||||||
diff -r 5bc024234126 -r 48c0f5033c28 gfx/skia/skia/src/opts/SkBlitRow_opts.h
|
|
||||||
--- a/gfx/skia/skia/src/opts/SkBlitRow_opts.h Tue Oct 06 16:58:11 2020 +0000
|
|
||||||
+++ b/gfx/skia/skia/src/opts/SkBlitRow_opts.h Tue Oct 06 14:36:49 2020 +0000
|
|
||||||
@@ -58,37 +58,114 @@
|
|
||||||
|
|
||||||
return _mm256_add_epi32(src, _mm256_or_si256(rb, ga));
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
-#elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
|
|
||||||
+#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
|
|
||||||
#include <immintrin.h>
|
|
||||||
|
|
||||||
static inline __m128i SkPMSrcOver_SSE2(const __m128i& src, const __m128i& dst) {
|
|
||||||
- auto SkAlphaMulQ_SSE2 = [](const __m128i& c, const __m128i& scale) {
|
|
||||||
- const __m128i mask = _mm_set1_epi32(0xFF00FF);
|
|
||||||
- __m128i s = _mm_or_si128(_mm_slli_epi32(scale, 16), scale);
|
|
||||||
+ __m128i scale = _mm_sub_epi32(_mm_set1_epi32(256),
|
|
||||||
+ _mm_srli_epi32(src, 24));
|
|
||||||
+ __m128i scale_x2 = _mm_or_si128(_mm_slli_epi32(scale, 16), scale);
|
|
||||||
+
|
|
||||||
+ __m128i rb = _mm_and_si128(_mm_set1_epi32(0x00ff00ff), dst);
|
|
||||||
+ rb = _mm_mullo_epi16(rb, scale_x2);
|
|
||||||
+ rb = _mm_srli_epi16(rb, 8);
|
|
||||||
|
|
||||||
- // uint32_t rb = ((c & mask) * scale) >> 8
|
|
||||||
- __m128i rb = _mm_and_si128(mask, c);
|
|
||||||
- rb = _mm_mullo_epi16(rb, s);
|
|
||||||
- rb = _mm_srli_epi16(rb, 8);
|
|
||||||
+ __m128i ga = _mm_srli_epi16(dst, 8);
|
|
||||||
+ ga = _mm_mullo_epi16(ga, scale_x2);
|
|
||||||
+ ga = _mm_andnot_si128(_mm_set1_epi32(0x00ff00ff), ga);
|
|
||||||
+
|
|
||||||
+ return _mm_add_epi32(src, _mm_or_si128(rb, ga));
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
- // uint32_t ag = ((c >> 8) & mask) * scale
|
|
||||||
- __m128i ag = _mm_srli_epi16(c, 8);
|
|
||||||
- ag = _mm_mullo_epi16(ag, s);
|
|
||||||
-
|
|
||||||
- // (rb & mask) | (ag & ~mask)
|
|
||||||
- ag = _mm_andnot_si128(mask, ag);
|
|
||||||
- return _mm_or_si128(rb, ag);
|
|
||||||
+#if defined(SK_ARM_HAS_NEON)
|
|
||||||
+ #include <arm_neon.h>
|
|
||||||
+ // SkMulDiv255Round() applied to each lane.
|
|
||||||
+ static inline uint8x8_t SkMulDiv255Round_neon8(uint8x8_t x, uint8x8_t y) {
|
|
||||||
+ uint16x8_t prod = vmull_u8(x, y);
|
|
||||||
+ return vraddhn_u16(prod, vrshrq_n_u16(prod, 8));
|
|
||||||
+ }
|
|
||||||
+ static inline uint8x8x4_t SkPMSrcOver_neon8(uint8x8x4_t dst, uint8x8x4_t src) {
|
|
||||||
+ uint8x8_t nalphas = vmvn_u8(src.val[3]); // 256 - alpha
|
|
||||||
+ return {
|
|
||||||
+ vadd_u8(src.val[0], SkMulDiv255Round_neon8(nalphas, dst.val[0])),
|
|
||||||
+ vadd_u8(src.val[1], SkMulDiv255Round_neon8(nalphas, dst.val[1])),
|
|
||||||
+ vadd_u8(src.val[2], SkMulDiv255Round_neon8(nalphas, dst.val[2])),
|
|
||||||
+ vadd_u8(src.val[3], SkMulDiv255Round_neon8(nalphas, dst.val[3])),
|
|
||||||
};
|
|
||||||
- return _mm_add_epi32(src,
|
|
||||||
- SkAlphaMulQ_SSE2(dst, _mm_sub_epi32(_mm_set1_epi32(256),
|
|
||||||
- _mm_srli_epi32(src, 24))));
|
|
||||||
+ }
|
|
||||||
+ // Variant assuming dst and src contain the color components of two consecutive pixels.
|
|
||||||
+ static inline uint8x8_t SkPMSrcOver_neon2(uint8x8_t dst, uint8x8_t src) {
|
|
||||||
+ const uint8x8_t alpha_indices = vcreate_u8(0x0707070703030303);
|
|
||||||
+ uint8x8_t nalphas = vmvn_u8(vtbl1_u8(src, alpha_indices));
|
|
||||||
+ return vadd_u8(src, SkMulDiv255Round_neon8(nalphas, dst));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace SK_OPTS_NS {
|
|
||||||
|
|
||||||
+/*not static*/
|
|
||||||
+inline void blit_row_s32a_opaque(SkPMColor* dst, const SkPMColor* src, int len, U8CPU alpha) {
|
|
||||||
+ SkASSERT(alpha == 0xFF);
|
|
||||||
+ sk_msan_assert_initialized(src, src+len);
|
|
||||||
+
|
|
||||||
+#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2
|
|
||||||
+ while (len >= 8) {
|
|
||||||
+ _mm256_storeu_si256((__m256i*)dst,
|
|
||||||
+ SkPMSrcOver_AVX2(_mm256_loadu_si256((const __m256i*)src),
|
|
||||||
+ _mm256_loadu_si256((const __m256i*)dst)));
|
|
||||||
+ src += 8;
|
|
||||||
+ dst += 8;
|
|
||||||
+ len -= 8;
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
|
|
||||||
+ while (len >= 4) {
|
|
||||||
+ _mm_storeu_si128((__m128i*)dst, SkPMSrcOver_SSE2(_mm_loadu_si128((const __m128i*)src),
|
|
||||||
+ _mm_loadu_si128((const __m128i*)dst)));
|
|
||||||
+ src += 4;
|
|
||||||
+ dst += 4;
|
|
||||||
+ len -= 4;
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+#if defined(SK_ARM_HAS_NEON)
|
|
||||||
+ while (len >= 8) {
|
|
||||||
+ vst4_u8((uint8_t*)dst, SkPMSrcOver_neon8(vld4_u8((const uint8_t*)dst),
|
|
||||||
+ vld4_u8((const uint8_t*)src)));
|
|
||||||
+ src += 8;
|
|
||||||
+ dst += 8;
|
|
||||||
+ len -= 8;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ while (len >= 2) {
|
|
||||||
+ vst1_u8((uint8_t*)dst, SkPMSrcOver_neon2(vld1_u8((const uint8_t*)dst),
|
|
||||||
+ vld1_u8((const uint8_t*)src)));
|
|
||||||
+ src += 2;
|
|
||||||
+ dst += 2;
|
|
||||||
+ len -= 2;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (len != 0) {
|
|
||||||
+ uint8x8_t result = SkPMSrcOver_neon2(vcreate_u8((uint64_t)*dst),
|
|
||||||
+ vcreate_u8((uint64_t)*src));
|
|
||||||
+ vst1_lane_u32(dst, vreinterpret_u32_u8(result), 0);
|
|
||||||
+ }
|
|
||||||
+ return;
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ while (len --> 0) {
|
|
||||||
+ *dst = SkPMSrcOver(*src, *dst);
|
|
||||||
+ src++;
|
|
||||||
+ dst++;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
// Blend constant color over count src pixels, writing into dst.
|
|
||||||
+/*not static*/
|
|
||||||
inline void blit_row_color32(SkPMColor* dst, const SkPMColor* src, int count, SkPMColor color) {
|
|
||||||
constexpr int N = 4; // 8, 16 also reasonable choices
|
|
||||||
using U32 = skvx::Vec< N, uint32_t>;
|
|
||||||
@@ -120,259 +197,6 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-#if defined(SK_ARM_HAS_NEON)
|
|
||||||
-
|
|
||||||
-// Return a uint8x8_t value, r, computed as r[i] = SkMulDiv255Round(x[i], y[i]), where r[i], x[i],
|
|
||||||
-// y[i] are the i-th lanes of the corresponding NEON vectors.
|
|
||||||
-static inline uint8x8_t SkMulDiv255Round_neon8(uint8x8_t x, uint8x8_t y) {
|
|
||||||
- uint16x8_t prod = vmull_u8(x, y);
|
|
||||||
- return vraddhn_u16(prod, vrshrq_n_u16(prod, 8));
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-// The implementations of SkPMSrcOver below perform alpha blending consistently with
|
|
||||||
-// SkMulDiv255Round. They compute the color components (numbers in the interval [0, 255]) as:
|
|
||||||
-//
|
|
||||||
-// result_i = src_i + rint(g(src_alpha, dst_i))
|
|
||||||
-//
|
|
||||||
-// where g(x, y) = ((255.0 - x) * y) / 255.0 and rint rounds to the nearest integer.
|
|
||||||
-
|
|
||||||
-// In this variant of SkPMSrcOver each NEON register, dst.val[i], src.val[i], contains the value
|
|
||||||
-// of the same color component for 8 consecutive pixels. The result of this function follows the
|
|
||||||
-// same convention.
|
|
||||||
-static inline uint8x8x4_t SkPMSrcOver_neon8(uint8x8x4_t dst, uint8x8x4_t src) {
|
|
||||||
- uint8x8_t nalphas = vmvn_u8(src.val[3]);
|
|
||||||
- uint8x8x4_t result;
|
|
||||||
- result.val[0] = vadd_u8(src.val[0], SkMulDiv255Round_neon8(nalphas, dst.val[0]));
|
|
||||||
- result.val[1] = vadd_u8(src.val[1], SkMulDiv255Round_neon8(nalphas, dst.val[1]));
|
|
||||||
- result.val[2] = vadd_u8(src.val[2], SkMulDiv255Round_neon8(nalphas, dst.val[2]));
|
|
||||||
- result.val[3] = vadd_u8(src.val[3], SkMulDiv255Round_neon8(nalphas, dst.val[3]));
|
|
||||||
- return result;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-// In this variant of SkPMSrcOver dst and src contain the color components of two consecutive
|
|
||||||
-// pixels. The return value follows the same convention.
|
|
||||||
-static inline uint8x8_t SkPMSrcOver_neon2(uint8x8_t dst, uint8x8_t src) {
|
|
||||||
- const uint8x8_t alpha_indices = vcreate_u8(0x0707070703030303);
|
|
||||||
- uint8x8_t nalphas = vmvn_u8(vtbl1_u8(src, alpha_indices));
|
|
||||||
- return vadd_u8(src, SkMulDiv255Round_neon8(nalphas, dst));
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
-/*not static*/ inline
|
|
||||||
-void blit_row_s32a_opaque(SkPMColor* dst, const SkPMColor* src, int len, U8CPU alpha) {
|
|
||||||
- SkASSERT(alpha == 0xFF);
|
|
||||||
- sk_msan_assert_initialized(src, src+len);
|
|
||||||
-// Require AVX2 because of AVX2 integer calculation intrinsics in SrcOver
|
|
||||||
-#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_AVX2
|
|
||||||
- while (len >= 32) {
|
|
||||||
- // Load 32 source pixels.
|
|
||||||
- auto s0 = _mm256_loadu_si256((const __m256i*)(src) + 0),
|
|
||||||
- s1 = _mm256_loadu_si256((const __m256i*)(src) + 1),
|
|
||||||
- s2 = _mm256_loadu_si256((const __m256i*)(src) + 2),
|
|
||||||
- s3 = _mm256_loadu_si256((const __m256i*)(src) + 3);
|
|
||||||
-
|
|
||||||
- const auto alphaMask = _mm256_set1_epi32(0xFF000000);
|
|
||||||
-
|
|
||||||
- auto ORed = _mm256_or_si256(s3, _mm256_or_si256(s2, _mm256_or_si256(s1, s0)));
|
|
||||||
- if (_mm256_testz_si256(ORed, alphaMask)) {
|
|
||||||
- // All 32 source pixels are transparent. Nothing to do.
|
|
||||||
- src += 32;
|
|
||||||
- dst += 32;
|
|
||||||
- len -= 32;
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- auto d0 = (__m256i*)(dst) + 0,
|
|
||||||
- d1 = (__m256i*)(dst) + 1,
|
|
||||||
- d2 = (__m256i*)(dst) + 2,
|
|
||||||
- d3 = (__m256i*)(dst) + 3;
|
|
||||||
-
|
|
||||||
- auto ANDed = _mm256_and_si256(s3, _mm256_and_si256(s2, _mm256_and_si256(s1, s0)));
|
|
||||||
- if (_mm256_testc_si256(ANDed, alphaMask)) {
|
|
||||||
- // All 32 source pixels are opaque. SrcOver becomes Src.
|
|
||||||
- _mm256_storeu_si256(d0, s0);
|
|
||||||
- _mm256_storeu_si256(d1, s1);
|
|
||||||
- _mm256_storeu_si256(d2, s2);
|
|
||||||
- _mm256_storeu_si256(d3, s3);
|
|
||||||
- src += 32;
|
|
||||||
- dst += 32;
|
|
||||||
- len -= 32;
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- // TODO: This math is wrong.
|
|
||||||
- // Do SrcOver.
|
|
||||||
- _mm256_storeu_si256(d0, SkPMSrcOver_AVX2(s0, _mm256_loadu_si256(d0)));
|
|
||||||
- _mm256_storeu_si256(d1, SkPMSrcOver_AVX2(s1, _mm256_loadu_si256(d1)));
|
|
||||||
- _mm256_storeu_si256(d2, SkPMSrcOver_AVX2(s2, _mm256_loadu_si256(d2)));
|
|
||||||
- _mm256_storeu_si256(d3, SkPMSrcOver_AVX2(s3, _mm256_loadu_si256(d3)));
|
|
||||||
- src += 32;
|
|
||||||
- dst += 32;
|
|
||||||
- len -= 32;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
-#elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41
|
|
||||||
- while (len >= 16) {
|
|
||||||
- // Load 16 source pixels.
|
|
||||||
- auto s0 = _mm_loadu_si128((const __m128i*)(src) + 0),
|
|
||||||
- s1 = _mm_loadu_si128((const __m128i*)(src) + 1),
|
|
||||||
- s2 = _mm_loadu_si128((const __m128i*)(src) + 2),
|
|
||||||
- s3 = _mm_loadu_si128((const __m128i*)(src) + 3);
|
|
||||||
-
|
|
||||||
- const auto alphaMask = _mm_set1_epi32(0xFF000000);
|
|
||||||
-
|
|
||||||
- auto ORed = _mm_or_si128(s3, _mm_or_si128(s2, _mm_or_si128(s1, s0)));
|
|
||||||
- if (_mm_testz_si128(ORed, alphaMask)) {
|
|
||||||
- // All 16 source pixels are transparent. Nothing to do.
|
|
||||||
- src += 16;
|
|
||||||
- dst += 16;
|
|
||||||
- len -= 16;
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- auto d0 = (__m128i*)(dst) + 0,
|
|
||||||
- d1 = (__m128i*)(dst) + 1,
|
|
||||||
- d2 = (__m128i*)(dst) + 2,
|
|
||||||
- d3 = (__m128i*)(dst) + 3;
|
|
||||||
-
|
|
||||||
- auto ANDed = _mm_and_si128(s3, _mm_and_si128(s2, _mm_and_si128(s1, s0)));
|
|
||||||
- if (_mm_testc_si128(ANDed, alphaMask)) {
|
|
||||||
- // All 16 source pixels are opaque. SrcOver becomes Src.
|
|
||||||
- _mm_storeu_si128(d0, s0);
|
|
||||||
- _mm_storeu_si128(d1, s1);
|
|
||||||
- _mm_storeu_si128(d2, s2);
|
|
||||||
- _mm_storeu_si128(d3, s3);
|
|
||||||
- src += 16;
|
|
||||||
- dst += 16;
|
|
||||||
- len -= 16;
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- // TODO: This math is wrong.
|
|
||||||
- // Do SrcOver.
|
|
||||||
- _mm_storeu_si128(d0, SkPMSrcOver_SSE2(s0, _mm_loadu_si128(d0)));
|
|
||||||
- _mm_storeu_si128(d1, SkPMSrcOver_SSE2(s1, _mm_loadu_si128(d1)));
|
|
||||||
- _mm_storeu_si128(d2, SkPMSrcOver_SSE2(s2, _mm_loadu_si128(d2)));
|
|
||||||
- _mm_storeu_si128(d3, SkPMSrcOver_SSE2(s3, _mm_loadu_si128(d3)));
|
|
||||||
- src += 16;
|
|
||||||
- dst += 16;
|
|
||||||
- len -= 16;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
-#elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
|
|
||||||
- while (len >= 16) {
|
|
||||||
- // Load 16 source pixels.
|
|
||||||
- auto s0 = _mm_loadu_si128((const __m128i*)(src) + 0),
|
|
||||||
- s1 = _mm_loadu_si128((const __m128i*)(src) + 1),
|
|
||||||
- s2 = _mm_loadu_si128((const __m128i*)(src) + 2),
|
|
||||||
- s3 = _mm_loadu_si128((const __m128i*)(src) + 3);
|
|
||||||
-
|
|
||||||
- const auto alphaMask = _mm_set1_epi32(0xFF000000);
|
|
||||||
-
|
|
||||||
- auto ORed = _mm_or_si128(s3, _mm_or_si128(s2, _mm_or_si128(s1, s0)));
|
|
||||||
- if (0xffff == _mm_movemask_epi8(_mm_cmpeq_epi8(_mm_and_si128(ORed, alphaMask),
|
|
||||||
- _mm_setzero_si128()))) {
|
|
||||||
- // All 16 source pixels are transparent. Nothing to do.
|
|
||||||
- src += 16;
|
|
||||||
- dst += 16;
|
|
||||||
- len -= 16;
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- auto d0 = (__m128i*)(dst) + 0,
|
|
||||||
- d1 = (__m128i*)(dst) + 1,
|
|
||||||
- d2 = (__m128i*)(dst) + 2,
|
|
||||||
- d3 = (__m128i*)(dst) + 3;
|
|
||||||
-
|
|
||||||
- auto ANDed = _mm_and_si128(s3, _mm_and_si128(s2, _mm_and_si128(s1, s0)));
|
|
||||||
- if (0xffff == _mm_movemask_epi8(_mm_cmpeq_epi8(_mm_and_si128(ANDed, alphaMask),
|
|
||||||
- alphaMask))) {
|
|
||||||
- // All 16 source pixels are opaque. SrcOver becomes Src.
|
|
||||||
- _mm_storeu_si128(d0, s0);
|
|
||||||
- _mm_storeu_si128(d1, s1);
|
|
||||||
- _mm_storeu_si128(d2, s2);
|
|
||||||
- _mm_storeu_si128(d3, s3);
|
|
||||||
- src += 16;
|
|
||||||
- dst += 16;
|
|
||||||
- len -= 16;
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- // TODO: This math is wrong.
|
|
||||||
- // Do SrcOver.
|
|
||||||
- _mm_storeu_si128(d0, SkPMSrcOver_SSE2(s0, _mm_loadu_si128(d0)));
|
|
||||||
- _mm_storeu_si128(d1, SkPMSrcOver_SSE2(s1, _mm_loadu_si128(d1)));
|
|
||||||
- _mm_storeu_si128(d2, SkPMSrcOver_SSE2(s2, _mm_loadu_si128(d2)));
|
|
||||||
- _mm_storeu_si128(d3, SkPMSrcOver_SSE2(s3, _mm_loadu_si128(d3)));
|
|
||||||
-
|
|
||||||
- src += 16;
|
|
||||||
- dst += 16;
|
|
||||||
- len -= 16;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
-#elif defined(SK_ARM_HAS_NEON)
|
|
||||||
- // Do 8-pixels at a time. A 16-pixels at a time version of this code was also tested, but it
|
|
||||||
- // underperformed on some of the platforms under test for inputs with frequent transitions of
|
|
||||||
- // alpha (corresponding to changes of the conditions [~]alpha_u64 == 0 below). It may be worth
|
|
||||||
- // revisiting the situation in the future.
|
|
||||||
- while (len >= 8) {
|
|
||||||
- // Load 8 pixels in 4 NEON registers. src_col.val[i] will contain the same color component
|
|
||||||
- // for 8 consecutive pixels (e.g. src_col.val[3] will contain all alpha components of 8
|
|
||||||
- // pixels).
|
|
||||||
- uint8x8x4_t src_col = vld4_u8(reinterpret_cast<const uint8_t*>(src));
|
|
||||||
- src += 8;
|
|
||||||
- len -= 8;
|
|
||||||
-
|
|
||||||
- // We now detect 2 special cases: the first occurs when all alphas are zero (the 8 pixels
|
|
||||||
- // are all transparent), the second when all alphas are fully set (they are all opaque).
|
|
||||||
- uint8x8_t alphas = src_col.val[3];
|
|
||||||
- uint64_t alphas_u64 = vget_lane_u64(vreinterpret_u64_u8(alphas), 0);
|
|
||||||
- if (alphas_u64 == 0) {
|
|
||||||
- // All pixels transparent.
|
|
||||||
- dst += 8;
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (~alphas_u64 == 0) {
|
|
||||||
- // All pixels opaque.
|
|
||||||
- vst4_u8(reinterpret_cast<uint8_t*>(dst), src_col);
|
|
||||||
- dst += 8;
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- uint8x8x4_t dst_col = vld4_u8(reinterpret_cast<uint8_t*>(dst));
|
|
||||||
- vst4_u8(reinterpret_cast<uint8_t*>(dst), SkPMSrcOver_neon8(dst_col, src_col));
|
|
||||||
- dst += 8;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- // Deal with leftover pixels.
|
|
||||||
- for (; len >= 2; len -= 2, src += 2, dst += 2) {
|
|
||||||
- uint8x8_t src2 = vld1_u8(reinterpret_cast<const uint8_t*>(src));
|
|
||||||
- uint8x8_t dst2 = vld1_u8(reinterpret_cast<const uint8_t*>(dst));
|
|
||||||
- vst1_u8(reinterpret_cast<uint8_t*>(dst), SkPMSrcOver_neon2(dst2, src2));
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (len != 0) {
|
|
||||||
- uint8x8_t result = SkPMSrcOver_neon2(vcreate_u8(*dst), vcreate_u8(*src));
|
|
||||||
- vst1_lane_u32(dst, vreinterpret_u32_u8(result), 0);
|
|
||||||
- }
|
|
||||||
- return;
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
- while (len-- > 0) {
|
|
||||||
- // This 0xFF000000 is not semantically necessary, but for compatibility
|
|
||||||
- // with chromium:611002 we need to keep it until we figure out where
|
|
||||||
- // the non-premultiplied src values (like 0x00FFFFFF) are coming from.
|
|
||||||
- // TODO(mtklein): sort this out and assert *src is premul here.
|
|
||||||
- if (*src & 0xFF000000) {
|
|
||||||
- *dst = (*src >= 0xFF000000) ? *src : SkPMSrcOver(*src, *dst);
|
|
||||||
- }
|
|
||||||
- src++;
|
|
||||||
- dst++;
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
} // SK_OPTS_NS
|
|
||||||
|
|
||||||
#endif//SkBlitRow_opts_DEFINED
|
|
||||||
@ -1,102 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Henri Sivonen <hsivonen@hsivonen.fi>
|
|
||||||
# Date 1603457336 0
|
|
||||||
# Fri Oct 23 12:48:56 2020 +0000
|
|
||||||
# Node ID 9143f95d5ab3896f5461fa1666500f6fc1f9e73b
|
|
||||||
# Parent b067b0d3670b37daad95505b87bddca6bb113d11
|
|
||||||
Bug 1667113. r=smaug
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D93482
|
|
||||||
|
|
||||||
diff -r b067b0d3670b -r 9143f95d5ab3 browser/base/content/test/static/browser_parsable_css.js
|
|
||||||
--- a/browser/base/content/test/static/browser_parsable_css.js Fri Oct 23 12:48:52 2020 +0000
|
|
||||||
+++ b/browser/base/content/test/static/browser_parsable_css.js Fri Oct 23 12:48:56 2020 +0000
|
|
||||||
@@ -496,9 +496,9 @@
|
|
||||||
checkWhitelist(propNameWhitelist);
|
|
||||||
|
|
||||||
// Clean up to avoid leaks:
|
|
||||||
- iframe.remove();
|
|
||||||
doc.head.innerHTML = "";
|
|
||||||
doc = null;
|
|
||||||
+ iframe.remove();
|
|
||||||
iframe = null;
|
|
||||||
win = null;
|
|
||||||
hiddenFrame.destroy();
|
|
||||||
diff -r b067b0d3670b -r 9143f95d5ab3 dom/base/nsContentUtils.cpp
|
|
||||||
--- a/dom/base/nsContentUtils.cpp Fri Oct 23 12:48:52 2020 +0000
|
|
||||||
+++ b/dom/base/nsContentUtils.cpp Fri Oct 23 12:48:56 2020 +0000
|
|
||||||
@@ -4817,6 +4817,7 @@
|
|
||||||
|
|
||||||
nsIContent* target = aTargetNode;
|
|
||||||
|
|
||||||
+ RefPtr<Document> inert;
|
|
||||||
RefPtr<DocumentFragment> fragment;
|
|
||||||
// We sanitize if the fragment occurs in a system privileged
|
|
||||||
// context, an about: page, or if there are explicit sanitization flags.
|
|
||||||
@@ -4828,8 +4828,12 @@
|
|
||||||
nodePrincipal->SchemeIs("about") || aFlags >= 0;
|
|
||||||
if (shouldSanitize) {
|
|
||||||
if (!AllowsUnsanitizedContentForAboutNewTab(nodePrincipal)) {
|
|
||||||
- fragment = new (aTargetNode->OwnerDoc()->NodeInfoManager())
|
|
||||||
- DocumentFragment(aTargetNode->OwnerDoc()->NodeInfoManager());
|
|
||||||
+ inert = nsContentUtils::CreateInertHTMLDocument(aTargetNode->OwnerDoc());
|
|
||||||
+ if (!inert) {
|
|
||||||
+ return NS_ERROR_FAILURE;
|
|
||||||
+ }
|
|
||||||
+ fragment = new (inert->NodeInfoManager())
|
|
||||||
+ DocumentFragment(inert->NodeInfoManager());
|
|
||||||
target = fragment;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4908,22 +4908,7 @@
|
|
||||||
MOZ_ASSERT(contentsink, "Sink doesn't QI to nsIContentSink!");
|
|
||||||
sXMLFragmentParser->SetContentSink(contentsink);
|
|
||||||
|
|
||||||
- sXMLFragmentSink->SetTargetDocument(aDocument);
|
|
||||||
- sXMLFragmentSink->SetPreventScriptExecution(aPreventScriptExecution);
|
|
||||||
-
|
|
||||||
- nsresult rv = sXMLFragmentParser->ParseFragment(aSourceBuffer, aTagStack);
|
|
||||||
- if (NS_FAILED(rv)) {
|
|
||||||
- // Drop the fragment parser and sink that might be in an inconsistent state
|
|
||||||
- NS_IF_RELEASE(sXMLFragmentParser);
|
|
||||||
- NS_IF_RELEASE(sXMLFragmentSink);
|
|
||||||
- return rv;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- rv = sXMLFragmentSink->FinishFragmentParsing(aReturn);
|
|
||||||
-
|
|
||||||
- sXMLFragmentParser->Reset();
|
|
||||||
- NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
-
|
|
||||||
+ RefPtr<Document> doc;
|
|
||||||
nsCOMPtr<nsIPrincipal> nodePrincipal = aDocument->NodePrincipal();
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
@@ -4929,6 +4929,27 @@
|
|
||||||
// an about: scheme principal.
|
|
||||||
bool shouldSanitize = nodePrincipal->IsSystemPrincipal() ||
|
|
||||||
nodePrincipal->SchemeIs("about") || aFlags >= 0;
|
|
||||||
+ if (shouldSanitize) {
|
|
||||||
+ doc = nsContentUtils::CreateInertXMLDocument(aDocument);
|
|
||||||
+ } else {
|
|
||||||
+ doc = aDocument;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ sXMLFragmentSink->SetTargetDocument(doc);
|
|
||||||
+ sXMLFragmentSink->SetPreventScriptExecution(aPreventScriptExecution);
|
|
||||||
+
|
|
||||||
+ nsresult rv = sXMLFragmentParser->ParseFragment(aSourceBuffer, aTagStack);
|
|
||||||
+ if (NS_FAILED(rv)) {
|
|
||||||
+ // Drop the fragment parser and sink that might be in an inconsistent state
|
|
||||||
+ NS_IF_RELEASE(sXMLFragmentParser);
|
|
||||||
+ NS_IF_RELEASE(sXMLFragmentSink);
|
|
||||||
+ return rv;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rv = sXMLFragmentSink->FinishFragmentParsing(aReturn);
|
|
||||||
+
|
|
||||||
+ sXMLFragmentParser->Reset();
|
|
||||||
+ NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (shouldSanitize) {
|
|
||||||
uint32_t sanitizationFlags =
|
|
||||||
@ -1,177 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Henri Sivonen <hsivonen@hsivonen.fi>
|
|
||||||
# Date 1605719930 0
|
|
||||||
# Wed Nov 18 17:18:50 2020 +0000
|
|
||||||
# Node ID 027514ba89006dfd5c346c307e46ed8f79e358c1
|
|
||||||
# Parent 782446e715644da3ca8226d0c3413e3fafb69d6f
|
|
||||||
Bug 1667113 test - Test innerHTML sanitizer in chrome context. r=smaug
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D93928
|
|
||||||
|
|
||||||
diff -r 782446e71564 -r 027514ba8900 dom/security/test/general/chrome.ini
|
|
||||||
--- a/dom/security/test/general/chrome.ini Wed Nov 18 17:18:56 2020 +0000
|
|
||||||
+++ b/dom/security/test/general/chrome.ini Wed Nov 18 17:18:50 2020 +0000
|
|
||||||
@@ -3,6 +3,8 @@
|
|
||||||
favicon_bug1277803.ico
|
|
||||||
bug1277803.html
|
|
||||||
|
|
||||||
+[test_innerhtml_sanitizer.html]
|
|
||||||
+[test_innerhtml_sanitizer.xhtml]
|
|
||||||
[test_bug1277803.xhtml]
|
|
||||||
skip-if = os == 'android' || verify
|
|
||||||
|
|
||||||
diff -r 782446e71564 -r 027514ba8900 dom/security/test/general/test_innerhtml_sanitizer.html
|
|
||||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
||||||
+++ b/dom/security/test/general/test_innerhtml_sanitizer.html Wed Nov 18 17:18:50 2020 +0000
|
|
||||||
@@ -0,0 +1,74 @@
|
|
||||||
+<!DOCTYPE HTML>
|
|
||||||
+<html>
|
|
||||||
+<head>
|
|
||||||
+ <meta charset=utf-8>
|
|
||||||
+ <title>Test for Bug 1667113</title>
|
|
||||||
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
|
||||||
+</head>
|
|
||||||
+<body>
|
|
||||||
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1667113">Mozilla Bug 1667113</a>
|
|
||||||
+<div></div>
|
|
||||||
+<script>
|
|
||||||
+SimpleTest.waitForExplicitFinish();
|
|
||||||
+
|
|
||||||
+// Please note that 'fakeServer' does not exist because the test relies
|
|
||||||
+// on "csp-on-violate-policy" , and "specialpowers-http-notify-request"
|
|
||||||
+// which fire if either the request is blocked or fires. The test does
|
|
||||||
+// not rely on the result of the load.
|
|
||||||
+
|
|
||||||
+function fail() {
|
|
||||||
+ ok(false, "Should not call this")
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function examiner() {
|
|
||||||
+ SpecialPowers.addObserver(this, "csp-on-violate-policy");
|
|
||||||
+ SpecialPowers.addObserver(this, "specialpowers-http-notify-request");
|
|
||||||
+}
|
|
||||||
+examiner.prototype = {
|
|
||||||
+ observe(subject, topic, data) {
|
|
||||||
+ if (topic === "csp-on-violate-policy") {
|
|
||||||
+ let asciiSpec = SpecialPowers.getPrivilegedProps(
|
|
||||||
+ SpecialPowers.do_QueryInterface(subject, "nsIURI"),
|
|
||||||
+ "asciiSpec");
|
|
||||||
+ if (asciiSpec.includes("fakeServer")) {
|
|
||||||
+ ok (false, "Should not attempt fetch, not even blocked by CSP.");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (topic === "specialpowers-http-notify-request") {
|
|
||||||
+ if (data.includes("fakeServer")) {
|
|
||||||
+ ok (false, "Should not try fetch");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ },
|
|
||||||
+ remove() {
|
|
||||||
+ SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
|
||||||
+ SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+window.examiner = new examiner();
|
|
||||||
+
|
|
||||||
+let div = document.getElementsByTagName("div")[0];
|
|
||||||
+div.innerHTML = "<svg><style><title><audio src=fakeServer onerror=fail() onload=fail()>";
|
|
||||||
+
|
|
||||||
+let svg = div.firstChild;
|
|
||||||
+is(svg.nodeName, "svg", "Node name should be svg");
|
|
||||||
+
|
|
||||||
+let style = svg.firstChild;
|
|
||||||
+if (style) {
|
|
||||||
+ is(style.firstChild, null, "Style should not have child nodes.");
|
|
||||||
+} else {
|
|
||||||
+ ok(false, "Should have gotten a node.");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+SimpleTest.executeSoon(function() {
|
|
||||||
+ window.examiner.remove();
|
|
||||||
+ SimpleTest.finish();
|
|
||||||
+});
|
|
||||||
+
|
|
||||||
+</script>
|
|
||||||
+</body>
|
|
||||||
+</html>
|
|
||||||
diff -r 782446e71564 -r 027514ba8900 dom/security/test/general/test_innerhtml_sanitizer.xhtml
|
|
||||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
||||||
+++ b/dom/security/test/general/test_innerhtml_sanitizer.xhtml Wed Nov 18 17:18:50 2020 +0000
|
|
||||||
@@ -0,0 +1,73 @@
|
|
||||||
+<!DOCTYPE HTML>
|
|
||||||
+<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
+<head>
|
|
||||||
+ <title>Test for Bug 1667113</title>
|
|
||||||
+ <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
|
||||||
+</head>
|
|
||||||
+<body>
|
|
||||||
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1667113">Mozilla Bug 1667113</a>
|
|
||||||
+<div></div>
|
|
||||||
+<script><![CDATA[
|
|
||||||
+SimpleTest.waitForExplicitFinish();
|
|
||||||
+
|
|
||||||
+// Please note that 'fakeServer' does not exist because the test relies
|
|
||||||
+// on "csp-on-violate-policy" , and "specialpowers-http-notify-request"
|
|
||||||
+// which fire if either the request is blocked or fires. The test does
|
|
||||||
+// not rely on the result of the load.
|
|
||||||
+
|
|
||||||
+function fail() {
|
|
||||||
+ ok(false, "Should not call this")
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function examiner() {
|
|
||||||
+ SpecialPowers.addObserver(this, "csp-on-violate-policy");
|
|
||||||
+ SpecialPowers.addObserver(this, "specialpowers-http-notify-request");
|
|
||||||
+}
|
|
||||||
+examiner.prototype = {
|
|
||||||
+ observe(subject, topic, data) {
|
|
||||||
+ if (topic === "csp-on-violate-policy") {
|
|
||||||
+ let asciiSpec = SpecialPowers.getPrivilegedProps(
|
|
||||||
+ SpecialPowers.do_QueryInterface(subject, "nsIURI"),
|
|
||||||
+ "asciiSpec");
|
|
||||||
+ if (asciiSpec.includes("fakeServer")) {
|
|
||||||
+ ok (false, "Should not attempt fetch, not even blocked by CSP.");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (topic === "specialpowers-http-notify-request") {
|
|
||||||
+ if (data.includes("fakeServer")) {
|
|
||||||
+ ok (false, "Should not try fetch");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ },
|
|
||||||
+ remove() {
|
|
||||||
+ SpecialPowers.removeObserver(this, "csp-on-violate-policy");
|
|
||||||
+ SpecialPowers.removeObserver(this, "specialpowers-http-notify-request");
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+window.examiner = new examiner();
|
|
||||||
+
|
|
||||||
+let div = document.getElementsByTagName("div")[0];
|
|
||||||
+div.innerHTML = "<svg xmlns='http://www.w3.org/2000/svg'><style><title><audio xmlns='http://www.w3.org/1999/xhtml' src='fakeServer' onerror='fail()' onload='fail()'></audio></title></style></svg>";
|
|
||||||
+
|
|
||||||
+let svg = div.firstChild;
|
|
||||||
+is(svg.nodeName, "svg", "Node name should be svg");
|
|
||||||
+
|
|
||||||
+let style = svg.firstChild;
|
|
||||||
+if (style) {
|
|
||||||
+ is(style.firstChild, null, "Style should not have child nodes.");
|
|
||||||
+} else {
|
|
||||||
+ ok(false, "Should have gotten a node.");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+SimpleTest.executeSoon(function() {
|
|
||||||
+ window.examiner.remove();
|
|
||||||
+ SimpleTest.finish();
|
|
||||||
+});
|
|
||||||
+
|
|
||||||
+]]></script>
|
|
||||||
+</body>
|
|
||||||
+</html>
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Alphan Chen <alchen@mozilla.com>
|
|
||||||
# Date 1593745253 0
|
|
||||||
# Fri Jul 03 03:00:53 2020 +0000
|
|
||||||
# Node ID aff172a1f77244bf24cfccc966c917bf801b5cbd
|
|
||||||
# Parent d69131a21feedc02c202912955ae015c74c4c8ec
|
|
||||||
Bug 1644484 - Handle the TypeError and InvalidStateError when calling FullScreen.cleanupDomFullscreen() from DOMFullscreenParent.didDestroy() r=Gijs
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D81716
|
|
||||||
|
|
||||||
diff -r d69131a21fee -r aff172a1f772 browser/base/content/browser-fullScreenAndPointerLock.js
|
|
||||||
--- a/browser/base/content/browser-fullScreenAndPointerLock.js Fri Jul 03 01:30:12 2020 +0000
|
|
||||||
+++ b/browser/base/content/browser-fullScreenAndPointerLock.js Fri Jul 03 03:00:53 2020 +0000
|
|
||||||
@@ -345,7 +345,9 @@
|
|
||||||
},
|
|
||||||
|
|
||||||
exitDomFullScreen() {
|
|
||||||
- document.exitFullscreen();
|
|
||||||
+ if (document.fullscreen) {
|
|
||||||
+ document.exitFullscreen();
|
|
||||||
+ }
|
|
||||||
},
|
|
||||||
|
|
||||||
handleEvent(event) {
|
|
||||||
@@ -508,8 +510,15 @@
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Search for the first ancestor of aActor that lives in a different process.
|
|
||||||
- * If found, that ancestor is sent the message. Otherwise, the recipient should
|
|
||||||
- * be the actor of the request origin.
|
|
||||||
+ * If found, that ancestor is sent the message and return false.
|
|
||||||
+ * Otherwise, the recipient should be the actor of the request origin and return true
|
|
||||||
+ * from this function.
|
|
||||||
+ *
|
|
||||||
+ * The method will be called again as a result of targeted child process doing
|
|
||||||
+ * "FullScreen.enterDomFullscreen()" or "FullScreen.cleanupDomFullscreen()".
|
|
||||||
+ * The return value is used to postpone entering or exiting Full Screen in the parent
|
|
||||||
+ * until there is no ancestor anymore.
|
|
||||||
+ *
|
|
||||||
*
|
|
||||||
* @param {JSWindowActorParent} aActor
|
|
||||||
* The actor that called this function.
|
|
||||||
@@ -517,6 +526,10 @@
|
|
||||||
* Message to be sent.
|
|
||||||
*
|
|
||||||
* @return {boolean}
|
|
||||||
+ * The return value is used to postpone entering or exiting Full Screen in the
|
|
||||||
+ * parent until there is no ancestor anymore.
|
|
||||||
+ * Return false if the message is send to the first ancestor of aActor that
|
|
||||||
+ * lives in a different process
|
|
||||||
* Return true if the message is sent to the request source
|
|
||||||
* or false otherwise.
|
|
||||||
*/
|
|
||||||
@@ -530,6 +543,9 @@
|
|
||||||
let parentBC = childBC.parent;
|
|
||||||
|
|
||||||
while (parentBC) {
|
|
||||||
+ if (!childBC.currentWindowGlobal || !parentBC.currentWindowGlobal) {
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
let childPid = childBC.currentWindowGlobal.osPid;
|
|
||||||
let parentPid = parentBC.currentWindowGlobal.osPid;
|
|
||||||
|
|
||||||
@@ -541,7 +557,7 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (parentBC) {
|
|
||||||
+ if (parentBC && parentBC.currentWindowGlobal) {
|
|
||||||
let parentActor = parentBC.currentWindowGlobal.getActor("DOMFullscreen");
|
|
||||||
parentActor.sendAsyncMessage(aMessage, {
|
|
||||||
remoteFrameBC: childBC,
|
|
||||||
@@ -554,8 +570,10 @@
|
|
||||||
// have entered or exited fullscreen at this point.
|
|
||||||
// So let's notify the process where the original request
|
|
||||||
// comes from.
|
|
||||||
- aActor.requestOrigin.sendAsyncMessage(aMessage, {});
|
|
||||||
- aActor.requestOrigin = null;
|
|
||||||
+ if (!aActor.requestOrigin.hasBeenDestroyed()) {
|
|
||||||
+ aActor.requestOrigin.sendAsyncMessage(aMessage, {});
|
|
||||||
+ aActor.requestOrigin = null;
|
|
||||||
+ }
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
|
|
||||||
@ -1,231 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Steven MacLeod <steven@smacleod.ca>
|
|
||||||
# Date 1601937483 0
|
|
||||||
# Mon Oct 05 22:38:03 2020 +0000
|
|
||||||
# Node ID 3e884c48633fb4017402ef2c7053f8d947676dd5
|
|
||||||
# Parent b4b7e943b93cdc77a479bd5484f7661985bdb7d4
|
|
||||||
Bug 1656741, r=Gijs
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D91760
|
|
||||||
|
|
||||||
diff -r b4b7e943b93c -r 3e884c48633f browser/actors/DOMFullscreenParent.jsm
|
|
||||||
--- a/browser/actors/DOMFullscreenParent.jsm Mon Oct 05 22:20:41 2020 +0000
|
|
||||||
+++ b/browser/actors/DOMFullscreenParent.jsm Mon Oct 05 22:38:03 2020 +0000
|
|
||||||
@@ -9,6 +9,8 @@
|
|
||||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
||||||
|
|
||||||
class DOMFullscreenParent extends JSWindowActorParent {
|
|
||||||
+ waitingForChildFullscreen = false;
|
|
||||||
+
|
|
||||||
updateFullscreenWindowReference(aWindow) {
|
|
||||||
if (aWindow.document.documentElement.hasAttribute("inDOMFullscreen")) {
|
|
||||||
this._fullscreenWindow = aWindow;
|
|
||||||
@@ -23,6 +25,20 @@
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (this.waitingForChildFullscreen) {
|
|
||||||
+ // We were killed while waiting for our DOMFullscreenChild
|
|
||||||
+ // to transition to fullscreen so we abort the entire
|
|
||||||
+ // fullscreen transition to prevent getting stuck in a
|
|
||||||
+ // partial fullscreen state. We need to go through the
|
|
||||||
+ // document since window.Fullscreen could be undefined
|
|
||||||
+ // at this point.
|
|
||||||
+ //
|
|
||||||
+ // This could reject if we're not currently in fullscreen
|
|
||||||
+ // so just ignore rejection.
|
|
||||||
+ window.document.exitFullscreen().catch(() => {});
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
// Need to resume Chrome UI if the window is still in fullscreen UI
|
|
||||||
// to avoid the window stays in fullscreen problem. (See Bug 1620341)
|
|
||||||
if (window.document.documentElement.hasAttribute("inDOMFullscreen")) {
|
|
||||||
@@ -64,6 +80,7 @@
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "DOMFullscreen:Entered": {
|
|
||||||
+ this.waitingForChildFullscreen = false;
|
|
||||||
window.FullScreen.enterDomFullscreen(browser, this);
|
|
||||||
this.updateFullscreenWindowReference(window);
|
|
||||||
break;
|
|
||||||
diff -r b4b7e943b93c -r 3e884c48633f browser/base/content/browser-fullScreenAndPointerLock.js
|
|
||||||
--- a/browser/base/content/browser-fullScreenAndPointerLock.js Mon Oct 05 22:20:41 2020 +0000
|
|
||||||
+++ b/browser/base/content/browser-fullScreenAndPointerLock.js Mon Oct 05 22:38:03 2020 +0000
|
|
||||||
@@ -420,12 +420,27 @@
|
|
||||||
// before the check is fine since we also check the activeness of
|
|
||||||
// the requesting document in content-side handling code.
|
|
||||||
if (this._isRemoteBrowser(aBrowser)) {
|
|
||||||
- if (
|
|
||||||
- !this._sendMessageToTheRightContent(aActor, "DOMFullscreen:Entered")
|
|
||||||
- ) {
|
|
||||||
+ let [targetActor, inProcessBC] = this._getNextMsgRecipientActor(aActor);
|
|
||||||
+ if (!targetActor) {
|
|
||||||
+ // If there is no appropriate actor to send the message we have
|
|
||||||
+ // no way to complete the transition and should abort by exiting
|
|
||||||
+ // fullscreen.
|
|
||||||
+ this._abortEnterFullscreen();
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ targetActor.sendAsyncMessage("DOMFullscreen:Entered", {
|
|
||||||
+ remoteFrameBC: inProcessBC,
|
|
||||||
+ });
|
|
||||||
+
|
|
||||||
+ // Record that the actor is waiting for its child to enter
|
|
||||||
+ // fullscreen so that if it dies we can abort.
|
|
||||||
+ targetActor.waitingForChildFullscreen = true;
|
|
||||||
+ if (inProcessBC) {
|
|
||||||
+ // We aren't messaging the request origin yet, skip this time.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+
|
|
||||||
// If we've received a fullscreen notification, we have to ensure that the
|
|
||||||
// element that's requesting fullscreen belongs to the browser that's currently
|
|
||||||
// active. If not, we exit fullscreen since the "full-screen document" isn't
|
|
||||||
@@ -437,9 +452,7 @@
|
|
||||||
// full-screen was made. Cancel full-screen.
|
|
||||||
Services.focus.activeWindow != window
|
|
||||||
) {
|
|
||||||
- // This function is called synchronously in fullscreen change, so
|
|
||||||
- // we have to avoid calling exitFullscreen synchronously here.
|
|
||||||
- setTimeout(() => document.exitFullscreen(), 0);
|
|
||||||
+ this._abortEnterFullscreen();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -453,7 +466,6 @@
|
|
||||||
this._logWarningPermissionPromptFS("promptCanceled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-
|
|
||||||
document.documentElement.setAttribute("inDOMFullscreen", true);
|
|
||||||
|
|
||||||
if (gFindBarInitialized) {
|
|
||||||
@@ -488,9 +500,25 @@
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
+ /**
|
|
||||||
+ * Clean up full screen, starting from the request origin's first ancestor
|
|
||||||
+ * frame that is OOP.
|
|
||||||
+ *
|
|
||||||
+ * If there are OOP ancestor frames, we notify the first of those and then bail to
|
|
||||||
+ * be called again in that process when it has dealt with the change. This is
|
|
||||||
+ * repeated until all ancestor processes have been updated. Once that has happened
|
|
||||||
+ * we remove our handlers and attributes and notify the request origin to complete
|
|
||||||
+ * the cleanup.
|
|
||||||
+ */
|
|
||||||
cleanupDomFullscreen(aActor) {
|
|
||||||
- if (!this._sendMessageToTheRightContent(aActor, "DOMFullscreen:CleanUp")) {
|
|
||||||
- return;
|
|
||||||
+ let [target, inProcessBC] = this._getNextMsgRecipientActor(aActor);
|
|
||||||
+ if (target) {
|
|
||||||
+ target.sendAsyncMessage("DOMFullscreen:CleanUp", {
|
|
||||||
+ remoteFrameBC: inProcessBC,
|
|
||||||
+ });
|
|
||||||
+ if (inProcessBC) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
PopupNotifications.panel.removeEventListener(
|
|
||||||
@@ -508,40 +536,43 @@
|
|
||||||
document.documentElement.removeAttribute("inDOMFullscreen");
|
|
||||||
},
|
|
||||||
|
|
||||||
+ _abortEnterFullscreen() {
|
|
||||||
+ // This function is called synchronously in fullscreen change, so
|
|
||||||
+ // we have to avoid calling exitFullscreen synchronously here.
|
|
||||||
+ setTimeout(() => document.exitFullscreen(), 0);
|
|
||||||
+ if (TelemetryStopwatch.running("FULLSCREEN_CHANGE_MS")) {
|
|
||||||
+ // Cancel the stopwatch for any fullscreen change to avoid
|
|
||||||
+ // errors if it is started again.
|
|
||||||
+ TelemetryStopwatch.cancel("FULLSCREEN_CHANGE_MS");
|
|
||||||
+ }
|
|
||||||
+ },
|
|
||||||
+
|
|
||||||
/**
|
|
||||||
* Search for the first ancestor of aActor that lives in a different process.
|
|
||||||
- * If found, that ancestor is sent the message and return false.
|
|
||||||
- * Otherwise, the recipient should be the actor of the request origin and return true
|
|
||||||
- * from this function.
|
|
||||||
- *
|
|
||||||
- * The method will be called again as a result of targeted child process doing
|
|
||||||
- * "FullScreen.enterDomFullscreen()" or "FullScreen.cleanupDomFullscreen()".
|
|
||||||
- * The return value is used to postpone entering or exiting Full Screen in the parent
|
|
||||||
- * until there is no ancestor anymore.
|
|
||||||
+ * If found, that ancestor actor and the browsing context for its child which
|
|
||||||
+ * was in process are returned. Otherwise [request origin, null].
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param {JSWindowActorParent} aActor
|
|
||||||
* The actor that called this function.
|
|
||||||
- * @param {String} message
|
|
||||||
- * Message to be sent.
|
|
||||||
*
|
|
||||||
- * @return {boolean}
|
|
||||||
- * The return value is used to postpone entering or exiting Full Screen in the
|
|
||||||
- * parent until there is no ancestor anymore.
|
|
||||||
- * Return false if the message is send to the first ancestor of aActor that
|
|
||||||
- * lives in a different process
|
|
||||||
- * Return true if the message is sent to the request source
|
|
||||||
- * or false otherwise.
|
|
||||||
+ * @return {[JSWindowActorParent, BrowsingContext]}
|
|
||||||
+ * The parent actor which should be sent the next msg and the
|
|
||||||
+ * in process browsing context which is its child. Will be
|
|
||||||
+ * [null, null] if there is no OOP parent actor and request origin
|
|
||||||
+ * is unset. [null, null] is also returned if the intended actor or
|
|
||||||
+ * the calling actor has been destroyed.
|
|
||||||
*/
|
|
||||||
- _sendMessageToTheRightContent(aActor, aMessage) {
|
|
||||||
+ _getNextMsgRecipientActor(aActor) {
|
|
||||||
if (aActor.hasBeenDestroyed()) {
|
|
||||||
- // Just restore the chrome UI when the actor is dead.
|
|
||||||
- return true;
|
|
||||||
+ return [null, null];
|
|
||||||
}
|
|
||||||
|
|
||||||
let childBC = aActor.browsingContext;
|
|
||||||
let parentBC = childBC.parent;
|
|
||||||
|
|
||||||
+ // Walk up the browsing context tree from aActor's browsing context
|
|
||||||
+ // to find the first ancestor browsing context that's in a different process.
|
|
||||||
while (parentBC) {
|
|
||||||
if (!childBC.currentWindowGlobal || !parentBC.currentWindowGlobal) {
|
|
||||||
break;
|
|
||||||
@@ -557,24 +588,20 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ let target = null;
|
|
||||||
+ let inProcessBC = null;
|
|
||||||
+
|
|
||||||
if (parentBC && parentBC.currentWindowGlobal) {
|
|
||||||
- let parentActor = parentBC.currentWindowGlobal.getActor("DOMFullscreen");
|
|
||||||
- parentActor.sendAsyncMessage(aMessage, {
|
|
||||||
- remoteFrameBC: childBC,
|
|
||||||
- });
|
|
||||||
- return false;
|
|
||||||
+ target = parentBC.currentWindowGlobal.getActor("DOMFullscreen");
|
|
||||||
+ inProcessBC = childBC;
|
|
||||||
+ } else {
|
|
||||||
+ target = aActor.requestOrigin;
|
|
||||||
}
|
|
||||||
|
|
||||||
- // All content frames living outside the process where
|
|
||||||
- // the element requesting fullscreen lives should
|
|
||||||
- // have entered or exited fullscreen at this point.
|
|
||||||
- // So let's notify the process where the original request
|
|
||||||
- // comes from.
|
|
||||||
- if (!aActor.requestOrigin.hasBeenDestroyed()) {
|
|
||||||
- aActor.requestOrigin.sendAsyncMessage(aMessage, {});
|
|
||||||
- aActor.requestOrigin = null;
|
|
||||||
+ if (!target || target.hasBeenDestroyed()) {
|
|
||||||
+ return [null, null];
|
|
||||||
}
|
|
||||||
- return true;
|
|
||||||
+ return [target, inProcessBC];
|
|
||||||
},
|
|
||||||
|
|
||||||
_isRemoteBrowser(aBrowser) {
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Henri Sivonen <hsivonen@hsivonen.fi>
|
|
||||||
# Date 1603457329 0
|
|
||||||
# Fri Oct 23 12:48:49 2020 +0000
|
|
||||||
# Node ID 3476387362fb15c82f133f390afef719ad36de0a
|
|
||||||
# Parent fd45fcfd6261e9ed6cf83e54ad8286717f1b4762
|
|
||||||
Bug 1666300 part 1 - Remove attributes from descendants when setting sanitized style. r=smaug
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D93215
|
|
||||||
|
|
||||||
diff -r fd45fcfd6261 -r 3476387362fb dom/base/nsTreeSanitizer.cpp
|
|
||||||
--- a/dom/base/nsTreeSanitizer.cpp Fri Oct 23 13:04:19 2020 +0000
|
|
||||||
+++ b/dom/base/nsTreeSanitizer.cpp Fri Oct 23 12:48:49 2020 +0000
|
|
||||||
@@ -1341,6 +1341,7 @@
|
|
||||||
nsAutoString sanitizedStyle;
|
|
||||||
SanitizeStyleSheet(styleText, sanitizedStyle, aRoot->OwnerDoc(),
|
|
||||||
node->GetBaseURI());
|
|
||||||
+ RemoveAllAttributesFromDescendants(elt);
|
|
||||||
nsContentUtils::SetNodeTextContent(node, sanitizedStyle, true);
|
|
||||||
|
|
||||||
if (!mOnlyConditionalCSS) {
|
|
||||||
@@ -1427,6 +1428,18 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+void nsTreeSanitizer::RemoveAllAttributesFromDescendants(
|
|
||||||
+ mozilla::dom::Element* aElement) {
|
|
||||||
+ nsIContent* node = aElement->GetFirstChild();
|
|
||||||
+ while (node) {
|
|
||||||
+ if (node->IsElement()) {
|
|
||||||
+ mozilla::dom::Element* elt = node->AsElement();
|
|
||||||
+ RemoveAllAttributes(elt);
|
|
||||||
+ }
|
|
||||||
+ node = node->GetNextNode(aElement);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void nsTreeSanitizer::LogMessage(const char* aMessage, Document* aDoc,
|
|
||||||
Element* aElement, nsAtom* aAttr) {
|
|
||||||
if (mLogRemovals) {
|
|
||||||
diff -r fd45fcfd6261 -r 3476387362fb dom/base/nsTreeSanitizer.h
|
|
||||||
--- a/dom/base/nsTreeSanitizer.h Fri Oct 23 13:04:19 2020 +0000
|
|
||||||
+++ b/dom/base/nsTreeSanitizer.h Fri Oct 23 12:48:49 2020 +0000
|
|
||||||
@@ -200,6 +200,12 @@
|
|
||||||
void RemoveAllAttributes(mozilla::dom::Element* aElement);
|
|
||||||
|
|
||||||
/**
|
|
||||||
+ * Removes all attributes from the descendants of an element but not from
|
|
||||||
+ * the element itself.
|
|
||||||
+ */
|
|
||||||
+ void RemoveAllAttributesFromDescendants(mozilla::dom::Element* aElement);
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
* Log a Console Service message to indicate we removed something.
|
|
||||||
* If you pass an element and/or attribute, their information will
|
|
||||||
* be appended to the message.
|
|
||||||
@ -1,171 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Henri Sivonen <hsivonen@hsivonen.fi>
|
|
||||||
# Date 1603457332 0
|
|
||||||
# Fri Oct 23 12:48:52 2020 +0000
|
|
||||||
# Node ID b067b0d3670b37daad95505b87bddca6bb113d11
|
|
||||||
# Parent 3476387362fb15c82f133f390afef719ad36de0a
|
|
||||||
Bug 1666300 part 2 - Parse into an inert document. r=smaug
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D93478
|
|
||||||
|
|
||||||
diff -r 3476387362fb -r b067b0d3670b dom/base/nsContentUtils.cpp
|
|
||||||
--- a/dom/base/nsContentUtils.cpp Fri Oct 23 12:48:49 2020 +0000
|
|
||||||
+++ b/dom/base/nsContentUtils.cpp Fri Oct 23 12:48:52 2020 +0000
|
|
||||||
@@ -4968,17 +4968,12 @@
|
|
||||||
nsAString& aResultBuffer,
|
|
||||||
uint32_t aFlags,
|
|
||||||
uint32_t aWrapCol) {
|
|
||||||
- nsCOMPtr<nsIURI> uri;
|
|
||||||
- NS_NewURI(getter_AddRefs(uri), "about:blank");
|
|
||||||
- nsCOMPtr<nsIPrincipal> principal =
|
|
||||||
- NullPrincipal::CreateWithoutOriginAttributes();
|
|
||||||
- RefPtr<Document> document;
|
|
||||||
- nsresult rv = NS_NewDOMDocument(getter_AddRefs(document), EmptyString(),
|
|
||||||
- EmptyString(), nullptr, uri, uri, principal,
|
|
||||||
- true, nullptr, DocumentFlavorHTML);
|
|
||||||
- NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
-
|
|
||||||
- rv = nsContentUtils::ParseDocumentHTML(
|
|
||||||
+ RefPtr<Document> document = nsContentUtils::CreateInertHTMLDocument(nullptr);
|
|
||||||
+ if (!document) {
|
|
||||||
+ return NS_ERROR_FAILURE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ nsresult rv = nsContentUtils::ParseDocumentHTML(
|
|
||||||
aSourceBuffer, document,
|
|
||||||
!(aFlags & nsIDocumentEncoder::OutputNoScriptContent));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
@@ -4994,6 +4989,58 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
|
||||||
+already_AddRefed<Document> nsContentUtils::CreateInertXMLDocument(
|
|
||||||
+ const Document* aTemplate) {
|
|
||||||
+ return nsContentUtils::CreateInertDocument(aTemplate, DocumentFlavorXML);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* static */
|
|
||||||
+already_AddRefed<Document> nsContentUtils::CreateInertHTMLDocument(
|
|
||||||
+ const Document* aTemplate) {
|
|
||||||
+ return nsContentUtils::CreateInertDocument(aTemplate, DocumentFlavorHTML);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* static */
|
|
||||||
+already_AddRefed<Document> nsContentUtils::CreateInertDocument(
|
|
||||||
+ const Document* aTemplate, DocumentFlavor aFlavor) {
|
|
||||||
+ if (aTemplate) {
|
|
||||||
+ bool hasHad = true;
|
|
||||||
+ nsIScriptGlobalObject* sgo = aTemplate->GetScriptHandlingObject(hasHad);
|
|
||||||
+ NS_ENSURE_TRUE(sgo || !hasHad, nullptr);
|
|
||||||
+
|
|
||||||
+ nsCOMPtr<Document> doc;
|
|
||||||
+ nsresult rv = NS_NewDOMDocument(
|
|
||||||
+ getter_AddRefs(doc), NS_LITERAL_STRING(""), NS_LITERAL_STRING(""), nullptr,
|
|
||||||
+ aTemplate->GetDocumentURI(), aTemplate->GetDocBaseURI(),
|
|
||||||
+ aTemplate->NodePrincipal(), true, sgo, aFlavor);
|
|
||||||
+ if (NS_FAILED(rv)) {
|
|
||||||
+ return nullptr;
|
|
||||||
+ }
|
|
||||||
+ return doc.forget();
|
|
||||||
+ }
|
|
||||||
+ nsCOMPtr<nsIURI> uri;
|
|
||||||
+ NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("about:blank"));
|
|
||||||
+ if (!uri) {
|
|
||||||
+ return nullptr;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ RefPtr<NullPrincipal> nullPrincipal =
|
|
||||||
+ NullPrincipal::CreateWithoutOriginAttributes();
|
|
||||||
+ if (!nullPrincipal) {
|
|
||||||
+ return nullptr;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ nsCOMPtr<Document> doc;
|
|
||||||
+ nsresult rv =
|
|
||||||
+ NS_NewDOMDocument(getter_AddRefs(doc), NS_LITERAL_STRING(""), NS_LITERAL_STRING(""), nullptr, uri, uri,
|
|
||||||
+ nullPrincipal, true, nullptr, aFlavor);
|
|
||||||
+ if (NS_FAILED(rv)) {
|
|
||||||
+ return nullptr;
|
|
||||||
+ }
|
|
||||||
+ return doc.forget();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/* static */
|
|
||||||
nsresult nsContentUtils::SetNodeTextContent(nsIContent* aContent,
|
|
||||||
const nsAString& aValue,
|
|
||||||
bool aTryReuse) {
|
|
||||||
diff -r 3476387362fb -r b067b0d3670b dom/base/nsContentUtils.h
|
|
||||||
--- a/dom/base/nsContentUtils.h Fri Oct 23 12:48:49 2020 +0000
|
|
||||||
+++ b/dom/base/nsContentUtils.h Fri Oct 23 12:48:52 2020 +0000
|
|
||||||
@@ -1831,6 +1831,25 @@
|
|
||||||
uint32_t aWrapCol);
|
|
||||||
|
|
||||||
/**
|
|
||||||
+ * Creates a 'loaded-as-data' HTML document that takes that principal,
|
|
||||||
+ * script global, and URL from the argument, which may be null.
|
|
||||||
+ */
|
|
||||||
+ static already_AddRefed<Document> CreateInertHTMLDocument(
|
|
||||||
+ const Document* aTemplate);
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
+ * Creates a 'loaded-as-data' XML document that takes that principal,
|
|
||||||
+ * script global, and URL from the argument, which may be null.
|
|
||||||
+ */
|
|
||||||
+ static already_AddRefed<Document> CreateInertXMLDocument(
|
|
||||||
+ const Document* aTemplate);
|
|
||||||
+
|
|
||||||
+ private:
|
|
||||||
+ static already_AddRefed<Document> CreateInertDocument(
|
|
||||||
+ const Document* aTemplate, DocumentFlavor aFlavor);
|
|
||||||
+
|
|
||||||
+ public:
|
|
||||||
+ /**
|
|
||||||
* Sets the text contents of a node by replacing all existing children
|
|
||||||
* with a single text child.
|
|
||||||
*
|
|
||||||
diff -r 3476387362fb -r b067b0d3670b editor/libeditor/HTMLEditorDataTransfer.cpp
|
|
||||||
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp Fri Oct 23 12:48:49 2020 +0000
|
|
||||||
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp Fri Oct 23 12:48:52 2020 +0000
|
|
||||||
@@ -3039,8 +3039,13 @@
|
|
||||||
bool aTrustedInput) {
|
|
||||||
nsAutoScriptBlockerSuppressNodeRemoved autoBlocker;
|
|
||||||
|
|
||||||
- RefPtr<DocumentFragment> fragment = new (aTargetDocument->NodeInfoManager())
|
|
||||||
- DocumentFragment(aTargetDocument->NodeInfoManager());
|
|
||||||
+ nsCOMPtr<Document> doc =
|
|
||||||
+ nsContentUtils::CreateInertHTMLDocument(aTargetDocument);
|
|
||||||
+ if (!doc) {
|
|
||||||
+ return NS_ERROR_FAILURE;
|
|
||||||
+ }
|
|
||||||
+ RefPtr<DocumentFragment> fragment =
|
|
||||||
+ new (doc->NodeInfoManager()) DocumentFragment(doc->NodeInfoManager());
|
|
||||||
nsresult rv = nsContentUtils::ParseFragmentHTML(
|
|
||||||
aFragStr, fragment,
|
|
||||||
aContextLocalName ? aContextLocalName : nsGkAtoms::body,
|
|
||||||
diff -r 3476387362fb -r b067b0d3670b parser/html/nsParserUtils.cpp
|
|
||||||
--- a/parser/html/nsParserUtils.cpp Fri Oct 23 12:48:49 2020 +0000
|
|
||||||
+++ b/parser/html/nsParserUtils.cpp Fri Oct 23 12:48:52 2020 +0000
|
|
||||||
@@ -45,17 +45,13 @@
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsParserUtils::Sanitize(const nsAString& aFromStr, uint32_t aFlags,
|
|
||||||
nsAString& aToStr) {
|
|
||||||
- nsCOMPtr<nsIURI> uri;
|
|
||||||
- NS_NewURI(getter_AddRefs(uri), "about:blank");
|
|
||||||
- nsCOMPtr<nsIPrincipal> principal =
|
|
||||||
- mozilla::NullPrincipal::CreateWithoutOriginAttributes();
|
|
||||||
- RefPtr<Document> document;
|
|
||||||
- nsresult rv = NS_NewDOMDocument(getter_AddRefs(document), EmptyString(),
|
|
||||||
- EmptyString(), nullptr, uri, uri, principal,
|
|
||||||
- true, nullptr, DocumentFlavorHTML);
|
|
||||||
- NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
+ RefPtr<Document> document = nsContentUtils::CreateInertHTMLDocument(nullptr);
|
|
||||||
|
|
||||||
- rv = nsContentUtils::ParseDocumentHTML(aFromStr, document, false);
|
|
||||||
+ if (!document) {
|
|
||||||
+ return NS_ERROR_FAILURE;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ nsresult rv = nsContentUtils::ParseDocumentHTML(aFromStr, document, false);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
nsTreeSanitizer sanitizer(aFlags);
|
|
||||||
@ -1,99 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Henri Sivonen <hsivonen@hsivonen.fi>
|
|
||||||
# Date 1605719936 0
|
|
||||||
# Wed Nov 18 17:18:56 2020 +0000
|
|
||||||
# Node ID 782446e715644da3ca8226d0c3413e3fafb69d6f
|
|
||||||
# Parent 42be1816b3857a3962cd0ec4be551830b6639aee
|
|
||||||
Bug 1666300 test - Test SVG style sanitization on paste. r=smaug
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D93634
|
|
||||||
|
|
||||||
diff -r 42be1816b385 -r 782446e71564 editor/libeditor/tests/file_sanitizer_on_paste.sjs
|
|
||||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
||||||
+++ b/editor/libeditor/tests/file_sanitizer_on_paste.sjs Wed Nov 18 17:18:56 2020 +0000
|
|
||||||
@@ -0,0 +1,16 @@
|
|
||||||
+function handleRequest(request, response)
|
|
||||||
+{
|
|
||||||
+ if (request.queryString.indexOf("report") != -1) {
|
|
||||||
+ response.setHeader("Content-Type", "text/javascript", false);
|
|
||||||
+ if (getState("loaded") == "loaded") {
|
|
||||||
+ response.write("ok(false, 'There was an attempt to preload the image.');");
|
|
||||||
+ } else {
|
|
||||||
+ response.write("ok(true, 'There was no attempt to preload the image.');");
|
|
||||||
+ }
|
|
||||||
+ response.write("SimpleTest.finish();");
|
|
||||||
+ } else {
|
|
||||||
+ setState("loaded", "loaded");
|
|
||||||
+ response.setHeader("Content-Type", "image/svg", false);
|
|
||||||
+ response.write("<svg xmlns='http://www.w3.org/2000/svg'>Not supposed to load this</svg>");
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff -r 42be1816b385 -r 782446e71564 editor/libeditor/tests/mochitest.ini
|
|
||||||
--- a/editor/libeditor/tests/mochitest.ini Wed Dec 16 10:40:06 2020 +0200
|
|
||||||
+++ b/editor/libeditor/tests/mochitest.ini Wed Nov 18 17:18:56 2020 +0000
|
|
||||||
@@ -21,6 +21,7 @@
|
|
||||||
file_bug966155.html
|
|
||||||
file_bug966552.html
|
|
||||||
file_select_all_without_body.html
|
|
||||||
+ file_sanitizer_on_paste.sjs
|
|
||||||
green.png
|
|
||||||
spellcheck.js
|
|
||||||
|
|
||||||
@@ -305,3 +306,4 @@
|
|
||||||
[test_selection_move_commands.html]
|
|
||||||
[test_pasteImgTextarea.html]
|
|
||||||
[test_execCommandPaste_noTarget.html]
|
|
||||||
+[test_sanitizer_on_paste.html]
|
|
||||||
diff -r 42be1816b385 -r 782446e71564 editor/libeditor/tests/test_sanitizer_on_paste.html
|
|
||||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
||||||
+++ b/editor/libeditor/tests/test_sanitizer_on_paste.html Wed Nov 18 17:18:56 2020 +0000
|
|
||||||
@@ -0,0 +1,48 @@
|
|
||||||
+<!DOCTYPE HTML>
|
|
||||||
+<html>
|
|
||||||
+<head>
|
|
||||||
+ <meta charset="utf-8">
|
|
||||||
+ <title>Test pasting table rows</title>
|
|
||||||
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
|
|
||||||
+ <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
|
||||||
+</head>
|
|
||||||
+<body>
|
|
||||||
+<textarea></textarea>
|
|
||||||
+<div contenteditable="true">Paste target</div>
|
|
||||||
+<script>
|
|
||||||
+ SimpleTest.waitForExplicitFinish();
|
|
||||||
+ function fail() {
|
|
||||||
+ ok(false, "Should not run event handlers.");
|
|
||||||
+ }
|
|
||||||
+ document.addEventListener('copy', ev => {
|
|
||||||
+ dump("IN LISTENER\n");
|
|
||||||
+ const payload = `<svg><style><image href=file_sanitizer_on_paste.sjs onerror=fail() onload=fail()>`
|
|
||||||
+
|
|
||||||
+ ev.preventDefault();
|
|
||||||
+ ev.clipboardData.setData('text/html', payload);
|
|
||||||
+ ev.clipboardData.setData('text/plain', payload);
|
|
||||||
+ });
|
|
||||||
+
|
|
||||||
+ document.getElementsByTagName("textarea")[0].focus();
|
|
||||||
+ synthesizeKey("c", { accelKey: true } /* aEvent*/);
|
|
||||||
+
|
|
||||||
+ let div = document.getElementsByTagName("div")[0];
|
|
||||||
+ div.focus();
|
|
||||||
+ synthesizeKey("v", { accelKey: true } /* aEvent*/);
|
|
||||||
+
|
|
||||||
+ let svg = div.firstChild;
|
|
||||||
+ is(svg.nodeName, "svg", "Node name should be svg");
|
|
||||||
+
|
|
||||||
+ let style = svg.firstChild;
|
|
||||||
+ if (style) {
|
|
||||||
+ is(style.firstChild, null, "Style should not have child nodes.");
|
|
||||||
+ } else {
|
|
||||||
+ ok(false, "Should have gotten a node.");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ var s = document.createElement("script");
|
|
||||||
+ s.src = "file_sanitizer_on_paste.sjs?report=1";
|
|
||||||
+ document.body.appendChild(s);
|
|
||||||
+</script>
|
|
||||||
+</body>
|
|
||||||
\ No newline at end of file
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Agi Sferro <agi@sferro.dev>
|
|
||||||
# Date 1602608252 0
|
|
||||||
# Tue Oct 13 16:57:32 2020 +0000
|
|
||||||
# Node ID 1aa2dc4b280e4ac1d5d5742e1923d5d39c04c102
|
|
||||||
# Parent 943130e5f28ed6ee3e6b8bbf0f9c9f60fb5a7053
|
|
||||||
Bug 1667179 - Initialize OneCRL when GeckoView starts. r=snorp,jcj
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D93250
|
|
||||||
|
|
||||||
diff -r 943130e5f28e -r 1aa2dc4b280e mobile/android/chrome/geckoview/geckoview.js
|
|
||||||
--- a/mobile/android/chrome/geckoview/geckoview.js Tue Oct 13 16:59:30 2020 +0000
|
|
||||||
+++ b/mobile/android/chrome/geckoview/geckoview.js Tue Oct 13 16:57:32 2020 +0000
|
|
||||||
@@ -18,6 +18,8 @@
|
|
||||||
GeckoViewSettings: "resource://gre/modules/GeckoViewSettings.jsm",
|
|
||||||
GeckoViewUtils: "resource://gre/modules/GeckoViewUtils.jsm",
|
|
||||||
HistogramStopwatch: "resource://gre/modules/GeckoViewTelemetry.jsm",
|
|
||||||
+ RemoteSecuritySettings:
|
|
||||||
+ "resource://gre/modules/psm/RemoteSecuritySettings.jsm",
|
|
||||||
});
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "WindowEventDispatcher", () =>
|
|
||||||
@@ -610,6 +612,10 @@
|
|
||||||
Services.obs.notifyObservers(window, "extensions-late-startup");
|
|
||||||
});
|
|
||||||
|
|
||||||
+ InitLater(() => {
|
|
||||||
+ RemoteSecuritySettings.init();
|
|
||||||
+ });
|
|
||||||
+
|
|
||||||
// This should always go last, since the idle tasks (except for the ones with
|
|
||||||
// timeouts) should execute in order. Note that this observer notification is
|
|
||||||
// not guaranteed to fire, since the window could close before we get here.
|
|
||||||
@ -1,768 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Andrew Sutherland <asutherland@asutherland.org>
|
|
||||||
# Date 1603887323 0
|
|
||||||
# Wed Oct 28 12:15:23 2020 +0000
|
|
||||||
# Node ID 6873589e0ede3c11bc48243be67c3d51e214873f
|
|
||||||
# Parent e6a1286e25b70d36a1e251fb056596181565d839
|
|
||||||
Bug 1669355 - Refactor MIME type warnings into base class. r=necko-reviewers,valentin
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D93906
|
|
||||||
|
|
||||||
diff -r e6a1286e25b7 -r 6873589e0ede netwerk/protocol/http/HttpBaseChannel.cpp
|
|
||||||
--- a/netwerk/protocol/http/HttpBaseChannel.cpp 2020-07-21 06:49:41.000000000 +0800
|
|
||||||
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp 2021-01-06 11:26:44.608483314 +0800
|
|
||||||
@@ -24,10 +24,12 @@
|
|
||||||
#include "mozilla/NullPrincipal.h"
|
|
||||||
#include "mozilla/Services.h"
|
|
||||||
#include "mozilla/StaticPrefs_browser.h"
|
|
||||||
+#include "mozilla/StaticPrefs_security.h"
|
|
||||||
#include "mozilla/Telemetry.h"
|
|
||||||
#include "mozilla/Tokenizer.h"
|
|
||||||
#include "mozilla/dom/BrowsingContext.h"
|
|
||||||
#include "mozilla/dom/CanonicalBrowsingContext.h"
|
|
||||||
+#include "mozilla/dom/Document.h"
|
|
||||||
#include "mozilla/dom/Performance.h"
|
|
||||||
#include "mozilla/dom/PerformanceStorage.h"
|
|
||||||
#include "mozilla/dom/WindowGlobalParent.h"
|
|
||||||
@@ -2385,6 +2387,354 @@ nsresult HttpBaseChannel::ComputeCrossOr
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
+enum class Report { Error, Warning };
|
|
||||||
+
|
|
||||||
+// Helper Function to report messages to the console when the loaded
|
|
||||||
+// script had a wrong MIME type.
|
|
||||||
+void ReportMimeTypeMismatch(HttpBaseChannel* aChannel, const char* aMessageName,
|
|
||||||
+ nsIURI* aURI, const nsACString& aContentType,
|
|
||||||
+ Report report) {
|
|
||||||
+ NS_ConvertUTF8toUTF16 spec(aURI->GetSpecOrDefault());
|
|
||||||
+ NS_ConvertUTF8toUTF16 contentType(aContentType);
|
|
||||||
+
|
|
||||||
+ aChannel->LogMimeTypeMismatch(nsCString(aMessageName),
|
|
||||||
+ report == Report::Warning, spec, contentType);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Check and potentially enforce X-Content-Type-Options: nosniff
|
|
||||||
+nsresult ProcessXCTO(HttpBaseChannel* aChannel, nsIURI* aURI,
|
|
||||||
+ nsHttpResponseHead* aResponseHead,
|
|
||||||
+ nsILoadInfo* aLoadInfo) {
|
|
||||||
+ if (!aURI || !aResponseHead || !aLoadInfo) {
|
|
||||||
+ // if there is no uri, no response head or no loadInfo, then there is
|
|
||||||
+ // nothing to do
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // 1) Query the XCTO header and check if 'nosniff' is the first value.
|
|
||||||
+ nsAutoCString contentTypeOptionsHeader;
|
|
||||||
+ if (!aResponseHead->GetContentTypeOptionsHeader(contentTypeOptionsHeader)) {
|
|
||||||
+ // if failed to get XCTO header, then there is nothing to do.
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // let's compare the header (ignoring case)
|
|
||||||
+ // e.g. "NoSniFF" -> "nosniff"
|
|
||||||
+ // if it's not 'nosniff' then there is nothing to do here
|
|
||||||
+ if (!contentTypeOptionsHeader.EqualsIgnoreCase("nosniff")) {
|
|
||||||
+ // since we are getting here, the XCTO header was sent;
|
|
||||||
+ // a non matching value most likely means a mistake happenend;
|
|
||||||
+ // e.g. sending 'nosnif' instead of 'nosniff', let's log a warning.
|
|
||||||
+ AutoTArray<nsString, 1> params;
|
|
||||||
+ CopyUTF8toUTF16(contentTypeOptionsHeader, *params.AppendElement());
|
|
||||||
+ RefPtr<dom::Document> doc;
|
|
||||||
+ aLoadInfo->GetLoadingDocument(getter_AddRefs(doc));
|
|
||||||
+ nsContentUtils::ReportToConsole(
|
|
||||||
+ nsIScriptError::warningFlag, NS_LITERAL_CSTRING("XCTO"), doc,
|
|
||||||
+ nsContentUtils::eSECURITY_PROPERTIES, "XCTOHeaderValueMissing", params);
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // 2) Query the content type from the channel
|
|
||||||
+ nsAutoCString contentType;
|
|
||||||
+ aResponseHead->ContentType(contentType);
|
|
||||||
+
|
|
||||||
+ // 3) Compare the expected MIME type with the actual type
|
|
||||||
+ if (aLoadInfo->GetExternalContentPolicyType() ==
|
|
||||||
+ nsIContentPolicy::TYPE_STYLESHEET) {
|
|
||||||
+ if (contentType.EqualsLiteral(TEXT_CSS)) {
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+ ReportMimeTypeMismatch(aChannel, "MimeTypeMismatch2", aURI, contentType,
|
|
||||||
+ Report::Error);
|
|
||||||
+ return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (aLoadInfo->GetExternalContentPolicyType() ==
|
|
||||||
+ nsIContentPolicy::TYPE_SCRIPT) {
|
|
||||||
+ if (nsContentUtils::IsJavascriptMIMEType(
|
|
||||||
+ NS_ConvertUTF8toUTF16(contentType))) {
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+ ReportMimeTypeMismatch(aChannel, "MimeTypeMismatch2", aURI, contentType,
|
|
||||||
+ Report::Error);
|
|
||||||
+ return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ auto policyType = aLoadInfo->GetExternalContentPolicyType();
|
|
||||||
+ if ((policyType == nsIContentPolicy::TYPE_DOCUMENT ||
|
|
||||||
+ policyType == nsIContentPolicy::TYPE_SUBDOCUMENT) &&
|
|
||||||
+ gHttpHandler->IsDocumentNosniffEnabled()) {
|
|
||||||
+ // If the header XCTO nosniff is set for any browsing context, then
|
|
||||||
+ // we set the skipContentSniffing flag on the Loadinfo. Within
|
|
||||||
+ // GetMIMETypeFromContent we then bail early and do not do any sniffing.
|
|
||||||
+ aLoadInfo->SetSkipContentSniffing(true);
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return NS_OK;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Ensure that a load of type script has correct MIME type
|
|
||||||
+nsresult EnsureMIMEOfScript(HttpBaseChannel* aChannel, nsIURI* aURI,
|
|
||||||
+ nsHttpResponseHead* aResponseHead,
|
|
||||||
+ nsILoadInfo* aLoadInfo) {
|
|
||||||
+ if (!aURI || !aResponseHead || !aLoadInfo) {
|
|
||||||
+ // if there is no uri, no response head or no loadInfo, then there is
|
|
||||||
+ // nothing to do
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (aLoadInfo->GetExternalContentPolicyType() !=
|
|
||||||
+ nsIContentPolicy::TYPE_SCRIPT) {
|
|
||||||
+ // if this is not a script load, then there is nothing to do
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ nsAutoCString contentType;
|
|
||||||
+ aResponseHead->ContentType(contentType);
|
|
||||||
+ NS_ConvertUTF8toUTF16 typeString(contentType);
|
|
||||||
+
|
|
||||||
+ if (nsContentUtils::IsJavascriptMIMEType(typeString)) {
|
|
||||||
+ // script load has type script
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::javaScript);
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ switch (aLoadInfo->InternalContentPolicyType()) {
|
|
||||||
+ case nsIContentPolicy::TYPE_SCRIPT:
|
|
||||||
+ case nsIContentPolicy::TYPE_INTERNAL_SCRIPT:
|
|
||||||
+ case nsIContentPolicy::TYPE_INTERNAL_SCRIPT_PRELOAD:
|
|
||||||
+ case nsIContentPolicy::TYPE_INTERNAL_MODULE:
|
|
||||||
+ case nsIContentPolicy::TYPE_INTERNAL_MODULE_PRELOAD:
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::script_load);
|
|
||||||
+ break;
|
|
||||||
+ case nsIContentPolicy::TYPE_INTERNAL_WORKER:
|
|
||||||
+ case nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER:
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::worker_load);
|
|
||||||
+ break;
|
|
||||||
+ case nsIContentPolicy::TYPE_INTERNAL_SERVICE_WORKER:
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::serviceworker_load);
|
|
||||||
+ break;
|
|
||||||
+ case nsIContentPolicy::TYPE_INTERNAL_WORKER_IMPORT_SCRIPTS:
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::importScript_load);
|
|
||||||
+ break;
|
|
||||||
+ case nsIContentPolicy::TYPE_INTERNAL_AUDIOWORKLET:
|
|
||||||
+ case nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET:
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::worklet_load);
|
|
||||||
+ break;
|
|
||||||
+ default:
|
|
||||||
+ MOZ_ASSERT_UNREACHABLE("unexpected script type");
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ bool isPrivateWin = aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
|
||||||
+ bool isSameOrigin = false;
|
|
||||||
+ aLoadInfo->GetLoadingPrincipal()->IsSameOrigin(aURI, isPrivateWin,
|
|
||||||
+ &isSameOrigin);
|
|
||||||
+ if (isSameOrigin) {
|
|
||||||
+ // same origin
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::same_origin);
|
|
||||||
+ } else {
|
|
||||||
+ bool cors = false;
|
|
||||||
+ nsAutoCString corsOrigin;
|
|
||||||
+ nsresult rv = aResponseHead->GetHeader(
|
|
||||||
+ nsHttp::ResolveAtom("Access-Control-Allow-Origin"), corsOrigin);
|
|
||||||
+ if (NS_SUCCEEDED(rv)) {
|
|
||||||
+ if (corsOrigin.Equals("*")) {
|
|
||||||
+ cors = true;
|
|
||||||
+ } else {
|
|
||||||
+ nsCOMPtr<nsIURI> corsOriginURI;
|
|
||||||
+ rv = NS_NewURI(getter_AddRefs(corsOriginURI), corsOrigin);
|
|
||||||
+ if (NS_SUCCEEDED(rv)) {
|
|
||||||
+ bool isPrivateWin =
|
|
||||||
+ aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
|
||||||
+ bool isSameOrigin = false;
|
|
||||||
+ aLoadInfo->GetLoadingPrincipal()->IsSameOrigin(
|
|
||||||
+ corsOriginURI, isPrivateWin, &isSameOrigin);
|
|
||||||
+ if (isSameOrigin) {
|
|
||||||
+ cors = true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (cors) {
|
|
||||||
+ // cors origin
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::CORS_origin);
|
|
||||||
+ } else {
|
|
||||||
+ // cross origin
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::cross_origin);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ bool block = false;
|
|
||||||
+ if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("image/"))) {
|
|
||||||
+ // script load has type image
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::image);
|
|
||||||
+ block = true;
|
|
||||||
+ } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("audio/"))) {
|
|
||||||
+ // script load has type audio
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::audio);
|
|
||||||
+ block = true;
|
|
||||||
+ } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("video/"))) {
|
|
||||||
+ // script load has type video
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::video);
|
|
||||||
+ block = true;
|
|
||||||
+ } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/csv"))) {
|
|
||||||
+ // script load has type text/csv
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_csv);
|
|
||||||
+ block = true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (block) {
|
|
||||||
+ // Do not block the load if the feature is not enabled.
|
|
||||||
+ if (!StaticPrefs::security_block_script_with_wrong_mime()) {
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ReportMimeTypeMismatch(aChannel, "BlockScriptWithWrongMimeType2", aURI,
|
|
||||||
+ contentType, Report::Error);
|
|
||||||
+ return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/plain"))) {
|
|
||||||
+ // script load has type text/plain
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_plain);
|
|
||||||
+ } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/xml"))) {
|
|
||||||
+ // script load has type text/xml
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_xml);
|
|
||||||
+ } else if (StringBeginsWith(contentType,
|
|
||||||
+ NS_LITERAL_CSTRING("application/octet-stream"))) {
|
|
||||||
+ // script load has type application/octet-stream
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_octet_stream);
|
|
||||||
+ } else if (StringBeginsWith(contentType,
|
|
||||||
+ NS_LITERAL_CSTRING("application/xml"))) {
|
|
||||||
+ // script load has type application/xml
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_xml);
|
|
||||||
+ } else if (StringBeginsWith(contentType,
|
|
||||||
+ NS_LITERAL_CSTRING("application/json"))) {
|
|
||||||
+ // script load has type application/json
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_json);
|
|
||||||
+ } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/json"))) {
|
|
||||||
+ // script load has type text/json
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_json);
|
|
||||||
+ } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/html"))) {
|
|
||||||
+ // script load has type text/html
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_html);
|
|
||||||
+ } else if (contentType.IsEmpty()) {
|
|
||||||
+ // script load has no type
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::empty);
|
|
||||||
+ } else {
|
|
||||||
+ // script load has unknown type
|
|
||||||
+ AccumulateCategorical(
|
|
||||||
+ Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::unknown);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // We restrict importScripts() in worker code to JavaScript MIME types.
|
|
||||||
+ nsContentPolicyType internalType = aLoadInfo->InternalContentPolicyType();
|
|
||||||
+ if (internalType == nsIContentPolicy::TYPE_INTERNAL_WORKER_IMPORT_SCRIPTS) {
|
|
||||||
+ // Do not block the load if the feature is not enabled.
|
|
||||||
+ if (!StaticPrefs::security_block_importScripts_with_wrong_mime()) {
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ReportMimeTypeMismatch(aChannel, "BlockImportScriptsWithWrongMimeType",
|
|
||||||
+ aURI, contentType, Report::Error);
|
|
||||||
+ return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (internalType == nsIContentPolicy::TYPE_INTERNAL_WORKER ||
|
|
||||||
+ internalType == nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER) {
|
|
||||||
+ // Do not block the load if the feature is not enabled.
|
|
||||||
+ if (!StaticPrefs::security_block_Worker_with_wrong_mime()) {
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ ReportMimeTypeMismatch(aChannel, "BlockWorkerWithWrongMimeType", aURI,
|
|
||||||
+ contentType, Report::Error);
|
|
||||||
+ return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // ES6 modules require a strict MIME type check.
|
|
||||||
+ if (internalType == nsIContentPolicy::TYPE_INTERNAL_MODULE ||
|
|
||||||
+ internalType == nsIContentPolicy::TYPE_INTERNAL_MODULE_PRELOAD) {
|
|
||||||
+ ReportMimeTypeMismatch(aChannel, "BlockModuleWithWrongMimeType", aURI,
|
|
||||||
+ contentType, Report::Error);
|
|
||||||
+ return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return NS_OK;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Warn when a load of type script uses a wrong MIME type and
|
|
||||||
+// wasn't blocked by EnsureMIMEOfScript or ProcessXCTO.
|
|
||||||
+void WarnWrongMIMEOfScript(HttpBaseChannel* aChannel, nsIURI* aURI,
|
|
||||||
+ nsHttpResponseHead* aResponseHead,
|
|
||||||
+ nsILoadInfo* aLoadInfo) {
|
|
||||||
+ if (!aURI || !aResponseHead || !aLoadInfo) {
|
|
||||||
+ // If there is no uri, no response head or no loadInfo, then there is
|
|
||||||
+ // nothing to do.
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (aLoadInfo->GetExternalContentPolicyType() !=
|
|
||||||
+ nsIContentPolicy::TYPE_SCRIPT) {
|
|
||||||
+ // If this is not a script load, then there is nothing to do.
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ bool succeeded;
|
|
||||||
+ MOZ_ALWAYS_SUCCEEDS(aChannel->GetRequestSucceeded(&succeeded));
|
|
||||||
+ if (!succeeded) {
|
|
||||||
+ // Do not warn for failed loads: HTTP error pages are usually in HTML.
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ nsAutoCString contentType;
|
|
||||||
+ aResponseHead->ContentType(contentType);
|
|
||||||
+ NS_ConvertUTF8toUTF16 typeString(contentType);
|
|
||||||
+ if (!nsContentUtils::IsJavascriptMIMEType(typeString)) {
|
|
||||||
+ ReportMimeTypeMismatch(aChannel, "WarnScriptWithWrongMimeType", aURI,
|
|
||||||
+ contentType, Report::Warning);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+nsresult HttpBaseChannel::ValidateMIMEType() {
|
|
||||||
+ nsresult rv = EnsureMIMEOfScript(this, mURI, mResponseHead.get(), mLoadInfo);
|
|
||||||
+ if (NS_FAILED(rv)) {
|
|
||||||
+ return rv;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ rv = ProcessXCTO(this, mURI, mResponseHead.get(), mLoadInfo);
|
|
||||||
+ if (NS_FAILED(rv)) {
|
|
||||||
+ return rv;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ WarnWrongMIMEOfScript(this, mURI, mResponseHead.get(), mLoadInfo);
|
|
||||||
+ return NS_OK;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
NS_IMETHODIMP
|
|
||||||
HttpBaseChannel::SetCookie(const nsACString& aCookieHeader) {
|
|
||||||
if (mLoadFlags & LOAD_ANONYMOUS) return NS_OK;
|
|
||||||
diff -r e6a1286e25b7 -r 6873589e0ede netwerk/protocol/http/HttpBaseChannel.h
|
|
||||||
--- a/netwerk/protocol/http/HttpBaseChannel.h 2020-07-21 04:53:32.000000000 +0800
|
|
||||||
+++ b/netwerk/protocol/http/HttpBaseChannel.h 2021-01-06 10:53:17.326264473 +0800
|
|
||||||
@@ -610,6 +610,8 @@ class HttpBaseChannel : public nsHashPro
|
|
||||||
|
|
||||||
nsresult ComputeCrossOriginOpenerPolicyMismatch();
|
|
||||||
|
|
||||||
+ nsresult ValidateMIMEType();
|
|
||||||
+
|
|
||||||
friend class PrivateBrowsingChannel<HttpBaseChannel>;
|
|
||||||
friend class InterceptFailedOnStop;
|
|
||||||
|
|
||||||
diff -r e6a1286e25b7 -r 6873589e0ede netwerk/protocol/http/InterceptedHttpChannel.cpp
|
|
||||||
--- a/netwerk/protocol/http/InterceptedHttpChannel.cpp 2020-07-21 06:49:41.000000000 +0800
|
|
||||||
+++ b/netwerk/protocol/http/InterceptedHttpChannel.cpp 2021-01-06 10:53:17.326264473 +0800
|
|
||||||
@@ -1046,6 +1046,12 @@ InterceptedHttpChannel::OnStartRequest(n
|
|
||||||
Cancel(mStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ rv = ValidateMIMEType();
|
|
||||||
+ if (NS_FAILED(rv)) {
|
|
||||||
+ mStatus = rv;
|
|
||||||
+ Cancel(mStatus);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
mOnStartRequestCalled = true;
|
|
||||||
if (mListener) {
|
|
||||||
return mListener->OnStartRequest(this);
|
|
||||||
diff -r e6a1286e25b7 -r 6873589e0ede netwerk/protocol/http/nsHttpChannel.cpp
|
|
||||||
--- a/netwerk/protocol/http/nsHttpChannel.cpp 2021-01-06 10:53:17.330264533 +0800
|
|
||||||
+++ b/netwerk/protocol/http/nsHttpChannel.cpp 2021-01-06 11:10:19.257650688 +0800
|
|
||||||
@@ -1485,339 +1485,6 @@ HttpTrafficCategory nsHttpChannel::Creat
|
|
||||||
NS_UsePrivateBrowsing(this), isSystemPrincipal, isThirdParty, cos, tc);
|
|
||||||
}
|
|
||||||
|
|
||||||
-enum class Report { Error, Warning };
|
|
||||||
-
|
|
||||||
-// Helper Function to report messages to the console when the loaded
|
|
||||||
-// script had a wrong MIME type.
|
|
||||||
-void ReportMimeTypeMismatch(nsHttpChannel* aChannel, const char* aMessageName,
|
|
||||||
- nsIURI* aURI, const nsACString& aContentType,
|
|
||||||
- Report report) {
|
|
||||||
- NS_ConvertUTF8toUTF16 spec(aURI->GetSpecOrDefault());
|
|
||||||
- NS_ConvertUTF8toUTF16 contentType(aContentType);
|
|
||||||
-
|
|
||||||
- aChannel->LogMimeTypeMismatch(nsCString(aMessageName),
|
|
||||||
- report == Report::Warning, spec, contentType);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-// Check and potentially enforce X-Content-Type-Options: nosniff
|
|
||||||
-nsresult ProcessXCTO(nsHttpChannel* aChannel, nsIURI* aURI,
|
|
||||||
- nsHttpResponseHead* aResponseHead,
|
|
||||||
- nsILoadInfo* aLoadInfo) {
|
|
||||||
- if (!aURI || !aResponseHead || !aLoadInfo) {
|
|
||||||
- // if there is no uri, no response head or no loadInfo, then there is
|
|
||||||
- // nothing to do
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- // 1) Query the XCTO header and check if 'nosniff' is the first value.
|
|
||||||
- nsAutoCString contentTypeOptionsHeader;
|
|
||||||
- if (!aResponseHead->GetContentTypeOptionsHeader(contentTypeOptionsHeader)) {
|
|
||||||
- // if failed to get XCTO header, then there is nothing to do.
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- // let's compare the header (ignoring case)
|
|
||||||
- // e.g. "NoSniFF" -> "nosniff"
|
|
||||||
- // if it's not 'nosniff' then there is nothing to do here
|
|
||||||
- if (!contentTypeOptionsHeader.EqualsIgnoreCase("nosniff")) {
|
|
||||||
- // since we are getting here, the XCTO header was sent;
|
|
||||||
- // a non matching value most likely means a mistake happenend;
|
|
||||||
- // e.g. sending 'nosnif' instead of 'nosniff', let's log a warning.
|
|
||||||
- AutoTArray<nsString, 1> params;
|
|
||||||
- CopyUTF8toUTF16(contentTypeOptionsHeader, *params.AppendElement());
|
|
||||||
- RefPtr<Document> doc;
|
|
||||||
- aLoadInfo->GetLoadingDocument(getter_AddRefs(doc));
|
|
||||||
- nsContentUtils::ReportToConsole(
|
|
||||||
- nsIScriptError::warningFlag, NS_LITERAL_CSTRING("XCTO"), doc,
|
|
||||||
- nsContentUtils::eSECURITY_PROPERTIES, "XCTOHeaderValueMissing", params);
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- // 2) Query the content type from the channel
|
|
||||||
- nsAutoCString contentType;
|
|
||||||
- aResponseHead->ContentType(contentType);
|
|
||||||
-
|
|
||||||
- // 3) Compare the expected MIME type with the actual type
|
|
||||||
- if (aLoadInfo->GetExternalContentPolicyType() ==
|
|
||||||
- nsIContentPolicy::TYPE_STYLESHEET) {
|
|
||||||
- if (contentType.EqualsLiteral(TEXT_CSS)) {
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
- ReportMimeTypeMismatch(aChannel, "MimeTypeMismatch2", aURI, contentType,
|
|
||||||
- Report::Error);
|
|
||||||
- return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (aLoadInfo->GetExternalContentPolicyType() ==
|
|
||||||
- nsIContentPolicy::TYPE_SCRIPT) {
|
|
||||||
- if (nsContentUtils::IsJavascriptMIMEType(
|
|
||||||
- NS_ConvertUTF8toUTF16(contentType))) {
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
- ReportMimeTypeMismatch(aChannel, "MimeTypeMismatch2", aURI, contentType,
|
|
||||||
- Report::Error);
|
|
||||||
- return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- auto policyType = aLoadInfo->GetExternalContentPolicyType();
|
|
||||||
- if ((policyType == nsIContentPolicy::TYPE_DOCUMENT ||
|
|
||||||
- policyType == nsIContentPolicy::TYPE_SUBDOCUMENT) &&
|
|
||||||
- gHttpHandler->IsDocumentNosniffEnabled()) {
|
|
||||||
- // If the header XCTO nosniff is set for any browsing context, then
|
|
||||||
- // we set the skipContentSniffing flag on the Loadinfo. Within
|
|
||||||
- // GetMIMETypeFromContent we then bail early and do not do any sniffing.
|
|
||||||
- aLoadInfo->SetSkipContentSniffing(true);
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- return NS_OK;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-// Ensure that a load of type script has correct MIME type
|
|
||||||
-nsresult EnsureMIMEOfScript(nsHttpChannel* aChannel, nsIURI* aURI,
|
|
||||||
- nsHttpResponseHead* aResponseHead,
|
|
||||||
- nsILoadInfo* aLoadInfo) {
|
|
||||||
- if (!aURI || !aResponseHead || !aLoadInfo) {
|
|
||||||
- // if there is no uri, no response head or no loadInfo, then there is
|
|
||||||
- // nothing to do
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (aLoadInfo->GetExternalContentPolicyType() !=
|
|
||||||
- nsIContentPolicy::TYPE_SCRIPT) {
|
|
||||||
- // if this is not a script load, then there is nothing to do
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- nsAutoCString contentType;
|
|
||||||
- aResponseHead->ContentType(contentType);
|
|
||||||
- NS_ConvertUTF8toUTF16 typeString(contentType);
|
|
||||||
-
|
|
||||||
- if (nsContentUtils::IsJavascriptMIMEType(typeString)) {
|
|
||||||
- // script load has type script
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::javaScript);
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- switch (aLoadInfo->InternalContentPolicyType()) {
|
|
||||||
- case nsIContentPolicy::TYPE_SCRIPT:
|
|
||||||
- case nsIContentPolicy::TYPE_INTERNAL_SCRIPT:
|
|
||||||
- case nsIContentPolicy::TYPE_INTERNAL_SCRIPT_PRELOAD:
|
|
||||||
- case nsIContentPolicy::TYPE_INTERNAL_MODULE:
|
|
||||||
- case nsIContentPolicy::TYPE_INTERNAL_MODULE_PRELOAD:
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::script_load);
|
|
||||||
- break;
|
|
||||||
- case nsIContentPolicy::TYPE_INTERNAL_WORKER:
|
|
||||||
- case nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER:
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::worker_load);
|
|
||||||
- break;
|
|
||||||
- case nsIContentPolicy::TYPE_INTERNAL_SERVICE_WORKER:
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::serviceworker_load);
|
|
||||||
- break;
|
|
||||||
- case nsIContentPolicy::TYPE_INTERNAL_WORKER_IMPORT_SCRIPTS:
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::importScript_load);
|
|
||||||
- break;
|
|
||||||
- case nsIContentPolicy::TYPE_INTERNAL_AUDIOWORKLET:
|
|
||||||
- case nsIContentPolicy::TYPE_INTERNAL_PAINTWORKLET:
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::worklet_load);
|
|
||||||
- break;
|
|
||||||
- default:
|
|
||||||
- MOZ_ASSERT_UNREACHABLE("unexpected script type");
|
|
||||||
- break;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- bool isPrivateWin = aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
|
||||||
- bool isSameOrigin = false;
|
|
||||||
- aLoadInfo->GetLoadingPrincipal()->IsSameOrigin(aURI, isPrivateWin,
|
|
||||||
- &isSameOrigin);
|
|
||||||
- if (isSameOrigin) {
|
|
||||||
- // same origin
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::same_origin);
|
|
||||||
- } else {
|
|
||||||
- bool cors = false;
|
|
||||||
- nsAutoCString corsOrigin;
|
|
||||||
- nsresult rv = aResponseHead->GetHeader(
|
|
||||||
- nsHttp::ResolveAtom("Access-Control-Allow-Origin"), corsOrigin);
|
|
||||||
- if (NS_SUCCEEDED(rv)) {
|
|
||||||
- if (corsOrigin.Equals("*")) {
|
|
||||||
- cors = true;
|
|
||||||
- } else {
|
|
||||||
- nsCOMPtr<nsIURI> corsOriginURI;
|
|
||||||
- rv = NS_NewURI(getter_AddRefs(corsOriginURI), corsOrigin);
|
|
||||||
- if (NS_SUCCEEDED(rv)) {
|
|
||||||
- bool isPrivateWin =
|
|
||||||
- aLoadInfo->GetOriginAttributes().mPrivateBrowsingId > 0;
|
|
||||||
- bool isSameOrigin = false;
|
|
||||||
- aLoadInfo->GetLoadingPrincipal()->IsSameOrigin(
|
|
||||||
- corsOriginURI, isPrivateWin, &isSameOrigin);
|
|
||||||
- if (isSameOrigin) {
|
|
||||||
- cors = true;
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- if (cors) {
|
|
||||||
- // cors origin
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::CORS_origin);
|
|
||||||
- } else {
|
|
||||||
- // cross origin
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::cross_origin);
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- bool block = false;
|
|
||||||
- if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("image/"))) {
|
|
||||||
- // script load has type image
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::image);
|
|
||||||
- block = true;
|
|
||||||
- } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("audio/"))) {
|
|
||||||
- // script load has type audio
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::audio);
|
|
||||||
- block = true;
|
|
||||||
- } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("video/"))) {
|
|
||||||
- // script load has type video
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::video);
|
|
||||||
- block = true;
|
|
||||||
- } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/csv"))) {
|
|
||||||
- // script load has type text/csv
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_csv);
|
|
||||||
- block = true;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (block) {
|
|
||||||
- // Do not block the load if the feature is not enabled.
|
|
||||||
- if (!StaticPrefs::security_block_script_with_wrong_mime()) {
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- ReportMimeTypeMismatch(aChannel, "BlockScriptWithWrongMimeType2", aURI,
|
|
||||||
- contentType, Report::Error);
|
|
||||||
- return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/plain"))) {
|
|
||||||
- // script load has type text/plain
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_plain);
|
|
||||||
- } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/xml"))) {
|
|
||||||
- // script load has type text/xml
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_xml);
|
|
||||||
- } else if (StringBeginsWith(contentType,
|
|
||||||
- NS_LITERAL_CSTRING("application/octet-stream"))) {
|
|
||||||
- // script load has type application/octet-stream
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_octet_stream);
|
|
||||||
- } else if (StringBeginsWith(contentType,
|
|
||||||
- NS_LITERAL_CSTRING("application/xml"))) {
|
|
||||||
- // script load has type application/xml
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_xml);
|
|
||||||
- } else if (StringBeginsWith(contentType,
|
|
||||||
- NS_LITERAL_CSTRING("application/json"))) {
|
|
||||||
- // script load has type application/json
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_json);
|
|
||||||
- } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/json"))) {
|
|
||||||
- // script load has type text/json
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_json);
|
|
||||||
- } else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/html"))) {
|
|
||||||
- // script load has type text/html
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_html);
|
|
||||||
- } else if (contentType.IsEmpty()) {
|
|
||||||
- // script load has no type
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::empty);
|
|
||||||
- } else {
|
|
||||||
- // script load has unknown type
|
|
||||||
- AccumulateCategorical(
|
|
||||||
- Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::unknown);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- // We restrict importScripts() in worker code to JavaScript MIME types.
|
|
||||||
- nsContentPolicyType internalType = aLoadInfo->InternalContentPolicyType();
|
|
||||||
- if (internalType == nsIContentPolicy::TYPE_INTERNAL_WORKER_IMPORT_SCRIPTS) {
|
|
||||||
- // Do not block the load if the feature is not enabled.
|
|
||||||
- if (!StaticPrefs::security_block_importScripts_with_wrong_mime()) {
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- ReportMimeTypeMismatch(aChannel, "BlockImportScriptsWithWrongMimeType",
|
|
||||||
- aURI, contentType, Report::Error);
|
|
||||||
- return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (internalType == nsIContentPolicy::TYPE_INTERNAL_WORKER ||
|
|
||||||
- internalType == nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER) {
|
|
||||||
- // Do not block the load if the feature is not enabled.
|
|
||||||
- if (!StaticPrefs::security_block_Worker_with_wrong_mime()) {
|
|
||||||
- return NS_OK;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- ReportMimeTypeMismatch(aChannel, "BlockWorkerWithWrongMimeType", aURI,
|
|
||||||
- contentType, Report::Error);
|
|
||||||
- return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- // ES6 modules require a strict MIME type check.
|
|
||||||
- if (internalType == nsIContentPolicy::TYPE_INTERNAL_MODULE ||
|
|
||||||
- internalType == nsIContentPolicy::TYPE_INTERNAL_MODULE_PRELOAD) {
|
|
||||||
- ReportMimeTypeMismatch(aChannel, "BlockModuleWithWrongMimeType", aURI,
|
|
||||||
- contentType, Report::Error);
|
|
||||||
- return NS_ERROR_CORRUPTED_CONTENT;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- return NS_OK;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-// Warn when a load of type script uses a wrong MIME type and
|
|
||||||
-// wasn't blocked by EnsureMIMEOfScript or ProcessXCTO.
|
|
||||||
-void WarnWrongMIMEOfScript(nsHttpChannel* aChannel, nsIURI* aURI,
|
|
||||||
- nsHttpResponseHead* aResponseHead,
|
|
||||||
- nsILoadInfo* aLoadInfo) {
|
|
||||||
- if (!aURI || !aResponseHead || !aLoadInfo) {
|
|
||||||
- // If there is no uri, no response head or no loadInfo, then there is
|
|
||||||
- // nothing to do.
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (aLoadInfo->GetExternalContentPolicyType() !=
|
|
||||||
- nsIContentPolicy::TYPE_SCRIPT) {
|
|
||||||
- // If this is not a script load, then there is nothing to do.
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- bool succeeded;
|
|
||||||
- MOZ_ALWAYS_SUCCEEDS(aChannel->GetRequestSucceeded(&succeeded));
|
|
||||||
- if (!succeeded) {
|
|
||||||
- // Do not warn for failed loads: HTTP error pages are usually in HTML.
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- nsAutoCString contentType;
|
|
||||||
- aResponseHead->ContentType(contentType);
|
|
||||||
- NS_ConvertUTF8toUTF16 typeString(contentType);
|
|
||||||
- if (!nsContentUtils::IsJavascriptMIMEType(typeString)) {
|
|
||||||
- ReportMimeTypeMismatch(aChannel, "WarnScriptWithWrongMimeType", aURI,
|
|
||||||
- contentType, Report::Warning);
|
|
||||||
- }
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
void nsHttpChannel::SetCachedContentType() {
|
|
||||||
if (!mResponseHead) {
|
|
||||||
return;
|
|
||||||
@@ -1913,14 +1580,9 @@ nsresult nsHttpChannel::CallOnStartReque
|
|
||||||
mOnStartRequestCalled = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
- nsresult rv = EnsureMIMEOfScript(this, mURI, mResponseHead.get(), mLoadInfo);
|
|
||||||
- NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
-
|
|
||||||
- rv = ProcessXCTO(this, mURI, mResponseHead.get(), mLoadInfo);
|
|
||||||
+ nsresult rv = ValidateMIMEType();
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
- WarnWrongMIMEOfScript(this, mURI, mResponseHead.get(), mLoadInfo);
|
|
||||||
-
|
|
||||||
// Allow consumers to override our content type
|
|
||||||
if (mLoadFlags & LOAD_CALL_CONTENT_SNIFFERS) {
|
|
||||||
// NOTE: We can have both a txn pump and a cache pump when the cache
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Luca Greco <lgreco@mozilla.com>
|
|
||||||
# Date 1603810809 0
|
|
||||||
# Tue Oct 27 15:00:09 2020 +0000
|
|
||||||
# Node ID 8de8cd3371e801d408650f102df04252c846f33d
|
|
||||||
# Parent 5058a78c1008f0917866aa09abff7430bcefa085
|
|
||||||
Bug 1669466 - Change WebRequestService singleton to a StaticRefPtr. r=glandium,mixedpuppy
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D94692
|
|
||||||
|
|
||||||
diff -r 5058a78c1008 -r 8de8cd3371e8 toolkit/components/extensions/webrequest/WebRequestService.cpp
|
|
||||||
--- a/toolkit/components/extensions/webrequest/WebRequestService.cpp Tue Oct 27 15:07:07 2020 +0000
|
|
||||||
+++ b/toolkit/components/extensions/webrequest/WebRequestService.cpp Tue Oct 27 15:00:09 2020 +0000
|
|
||||||
@@ -13,22 +13,14 @@
|
|
||||||
using namespace mozilla::dom;
|
|
||||||
using namespace mozilla::extensions;
|
|
||||||
|
|
||||||
-static WebRequestService* sWeakWebRequestService;
|
|
||||||
-
|
|
||||||
-WebRequestService::~WebRequestService() { sWeakWebRequestService = nullptr; }
|
|
||||||
+static StaticRefPtr<WebRequestService> sWebRequestService;
|
|
||||||
|
|
||||||
/* static */ WebRequestService& WebRequestService::GetSingleton() {
|
|
||||||
- static RefPtr<WebRequestService> instance;
|
|
||||||
- if (!sWeakWebRequestService) {
|
|
||||||
- instance = new WebRequestService();
|
|
||||||
- ClearOnShutdown(&instance);
|
|
||||||
-
|
|
||||||
- // A separate weak instance that we keep a reference to as long as the
|
|
||||||
- // original service is alive, even after our strong reference is cleared to
|
|
||||||
- // allow the service to be destroyed.
|
|
||||||
- sWeakWebRequestService = instance;
|
|
||||||
+ if (!sWebRequestService) {
|
|
||||||
+ sWebRequestService = new WebRequestService();
|
|
||||||
+ ClearOnShutdown(&sWebRequestService);
|
|
||||||
}
|
|
||||||
- return *sWeakWebRequestService;
|
|
||||||
+ return *sWebRequestService;
|
|
||||||
}
|
|
||||||
|
|
||||||
UniquePtr<WebRequestChannelEntry> WebRequestService::RegisterChannel(
|
|
||||||
@@ -56,7 +48,7 @@
|
|
||||||
: mChannelId(aChannel->Id()), mChannel(aChannel) {}
|
|
||||||
|
|
||||||
WebRequestChannelEntry::~WebRequestChannelEntry() {
|
|
||||||
- if (sWeakWebRequestService) {
|
|
||||||
- sWeakWebRequestService->mChannelEntries.Remove(mChannelId);
|
|
||||||
+ if (sWebRequestService) {
|
|
||||||
+ sWebRequestService->mChannelEntries.Remove(mChannelId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff -r 5058a78c1008 -r 8de8cd3371e8 toolkit/components/extensions/webrequest/WebRequestService.h
|
|
||||||
--- a/toolkit/components/extensions/webrequest/WebRequestService.h Tue Oct 27 15:07:07 2020 +0000
|
|
||||||
+++ b/toolkit/components/extensions/webrequest/WebRequestService.h Tue Oct 27 15:00:09 2020 +0000
|
|
||||||
@@ -64,7 +64,7 @@
|
|
||||||
dom::ContentParent* aContentParent);
|
|
||||||
|
|
||||||
private:
|
|
||||||
- ~WebRequestService();
|
|
||||||
+ ~WebRequestService() = default;
|
|
||||||
|
|
||||||
friend ChannelEntry;
|
|
||||||
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Jon Coppeard <jcoppeard@mozilla.com>
|
|
||||||
# Date 1603288236 0
|
|
||||||
# Wed Oct 21 13:50:36 2020 +0000
|
|
||||||
# Node ID 7e223284a9225c66b590aaad671c7448d1ff0b57
|
|
||||||
# Parent dfcb025567da9e33bf724520e0146fef3d776d5f
|
|
||||||
Bug 1670358 - Don't use realloc for shrinking nsTArrays and similar when RelocationStrategy::allowRealloc is false r=sg
|
|
||||||
|
|
||||||
My original patch handled the grow case but not the shrink case. When the
|
|
||||||
current and new allocation sizes are in different size classes jemalloc's
|
|
||||||
realloc will move the allocation when shrinking, not just truncate the existing
|
|
||||||
one.
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D93654
|
|
||||||
|
|
||||||
diff -r dfcb025567da -r 7e223284a922 xpcom/ds/nsTArray-inl.h
|
|
||||||
--- a/xpcom/ds/nsTArray-inl.h Thu Oct 22 07:36:15 2020 +0000
|
|
||||||
+++ b/xpcom/ds/nsTArray-inl.h Wed Oct 21 13:50:36 2020 +0000
|
|
||||||
@@ -259,10 +259,27 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
size_type size = sizeof(Header) + length * aElemSize;
|
|
||||||
- void* ptr = nsTArrayFallibleAllocator::Realloc(mHdr, size);
|
|
||||||
- if (!ptr) {
|
|
||||||
- return;
|
|
||||||
+ void* ptr;
|
|
||||||
+
|
|
||||||
+ if (!RelocationStrategy::allowRealloc) {
|
|
||||||
+ // Malloc() and copy.
|
|
||||||
+ ptr = static_cast<Header*>(nsTArrayFallibleAllocator::Malloc(size));
|
|
||||||
+ if (!ptr) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ RelocationStrategy::RelocateNonOverlappingRegionWithHeader(
|
|
||||||
+ ptr, mHdr, Length(), aElemSize);
|
|
||||||
+
|
|
||||||
+ nsTArrayFallibleAllocator::Free(mHdr);
|
|
||||||
+ } else {
|
|
||||||
+ // Realloc() existing data.
|
|
||||||
+ ptr = nsTArrayFallibleAllocator::Realloc(mHdr, size);
|
|
||||||
+ if (!ptr) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
+
|
|
||||||
mHdr = static_cast<Header*>(ptr);
|
|
||||||
mHdr->mCapacity = length;
|
|
||||||
}
|
|
||||||
@ -1,136 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Jon Coppeard <jcoppeard@mozilla.com>
|
|
||||||
# Date 1603288237 0
|
|
||||||
# Wed Oct 21 13:50:37 2020 +0000
|
|
||||||
# Node ID 8a8d7fdc7038fb360d7c50f5943ccafd7f0bb829
|
|
||||||
# Parent 7e223284a9225c66b590aaad671c7448d1ff0b57
|
|
||||||
Bug 1670358 - Add test for shrinking nsTArrays of JS::Heap<T> r=sg
|
|
||||||
|
|
||||||
Depends on D93654
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D94270
|
|
||||||
|
|
||||||
diff -r 7e223284a922 -r 8a8d7fdc7038 xpcom/tests/gtest/TestGCPostBarriers.cpp
|
|
||||||
--- a/xpcom/tests/gtest/TestGCPostBarriers.cpp Wed Oct 21 13:50:36 2020 +0000
|
|
||||||
+++ b/xpcom/tests/gtest/TestGCPostBarriers.cpp Wed Oct 21 13:50:37 2020 +0000
|
|
||||||
@@ -9,6 +9,8 @@
|
|
||||||
* implemented for nsTArrays that contain JavaScript Values.
|
|
||||||
*/
|
|
||||||
|
|
||||||
+#include "mozilla/UniquePtr.h"
|
|
||||||
+
|
|
||||||
#include "jsapi.h"
|
|
||||||
#include "nsTArray.h"
|
|
||||||
|
|
||||||
@@ -37,11 +39,13 @@
|
|
||||||
const size_t InitialElements = ElementCount / 10;
|
|
||||||
|
|
||||||
template <class ArrayT>
|
|
||||||
-static void RunTest(JSContext* cx, ArrayT* array) {
|
|
||||||
+static void TestGrow(JSContext* cx) {
|
|
||||||
JS_GC(cx);
|
|
||||||
|
|
||||||
+ auto array = MakeUnique<ArrayT>();
|
|
||||||
ASSERT_TRUE(array != nullptr);
|
|
||||||
- JS_AddExtraGCRootsTracer(cx, TraceArray<ArrayT>, array);
|
|
||||||
+
|
|
||||||
+ JS_AddExtraGCRootsTracer(cx, TraceArray<ArrayT>, array.get());
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create the array and fill it with new JS objects. With GGC these will be
|
|
||||||
@@ -66,7 +70,8 @@
|
|
||||||
/*
|
|
||||||
* Sanity check that our array contains what we expect.
|
|
||||||
*/
|
|
||||||
- for (size_t i = 0; i < ElementCount; ++i) {
|
|
||||||
+ ASSERT_EQ(array->Length(), ElementCount);
|
|
||||||
+ for (size_t i = 0; i < array->Length(); i++) {
|
|
||||||
RootedObject obj(cx, array->ElementAt(i));
|
|
||||||
ASSERT_TRUE(JS::ObjectIsTenured(obj));
|
|
||||||
ASSERT_TRUE(JS_GetProperty(cx, obj, property, &value));
|
|
||||||
@@ -74,7 +79,54 @@
|
|
||||||
ASSERT_EQ(static_cast<int32_t>(i), value.toInt32());
|
|
||||||
}
|
|
||||||
|
|
||||||
- JS_RemoveExtraGCRootsTracer(cx, TraceArray<ArrayT>, array);
|
|
||||||
+ JS_RemoveExtraGCRootsTracer(cx, TraceArray<ArrayT>, array.get());
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+template <class ArrayT>
|
|
||||||
+static void TestShrink(JSContext* cx) {
|
|
||||||
+ JS_GC(cx);
|
|
||||||
+
|
|
||||||
+ auto array = MakeUnique<ArrayT>();
|
|
||||||
+ ASSERT_TRUE(array != nullptr);
|
|
||||||
+
|
|
||||||
+ JS_AddExtraGCRootsTracer(cx, TraceArray<ArrayT>, array.get());
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ * Create the array and fill it with new JS objects. With GGC these will be
|
|
||||||
+ * allocated in the nursery.
|
|
||||||
+ */
|
|
||||||
+ RootedValue value(cx);
|
|
||||||
+ const char* property = "foo";
|
|
||||||
+ for (size_t i = 0; i < ElementCount; ++i) {
|
|
||||||
+ RootedObject obj(cx, JS_NewPlainObject(cx));
|
|
||||||
+ ASSERT_FALSE(JS::ObjectIsTenured(obj));
|
|
||||||
+ value = Int32Value(i);
|
|
||||||
+ ASSERT_TRUE(JS_SetProperty(cx, obj, property, value));
|
|
||||||
+ ASSERT_TRUE(array->AppendElement(obj, fallible));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /* Shrink and compact the array */
|
|
||||||
+ array->RemoveElementsAt(InitialElements, ElementCount - InitialElements);
|
|
||||||
+ array->Compact();
|
|
||||||
+
|
|
||||||
+ JS_GC(cx);
|
|
||||||
+
|
|
||||||
+ ASSERT_EQ(array->Length(), InitialElements);
|
|
||||||
+ for (size_t i = 0; i < array->Length(); i++) {
|
|
||||||
+ RootedObject obj(cx, array->ElementAt(i));
|
|
||||||
+ ASSERT_TRUE(JS::ObjectIsTenured(obj));
|
|
||||||
+ ASSERT_TRUE(JS_GetProperty(cx, obj, property, &value));
|
|
||||||
+ ASSERT_TRUE(value.isInt32());
|
|
||||||
+ ASSERT_EQ(static_cast<int32_t>(i), value.toInt32());
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ JS_RemoveExtraGCRootsTracer(cx, TraceArray<ArrayT>, array.get());
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+template <class ArrayT>
|
|
||||||
+static void TestArrayType(JSContext* cx) {
|
|
||||||
+ TestGrow<ArrayT>(cx);
|
|
||||||
+ TestShrink<ArrayT>(cx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CreateGlobalAndRunTest(JSContext* cx) {
|
|
||||||
@@ -89,25 +141,11 @@
|
|
||||||
|
|
||||||
JS::Realm* oldRealm = JS::EnterRealm(cx, global);
|
|
||||||
|
|
||||||
- typedef Heap<JSObject*> ElementT;
|
|
||||||
-
|
|
||||||
- {
|
|
||||||
- nsTArray<ElementT>* array = new nsTArray<ElementT>(InitialElements);
|
|
||||||
- RunTest(cx, array);
|
|
||||||
- delete array;
|
|
||||||
- }
|
|
||||||
+ using ElementT = Heap<JSObject*>;
|
|
||||||
|
|
||||||
- {
|
|
||||||
- FallibleTArray<ElementT>* array =
|
|
||||||
- new FallibleTArray<ElementT>(InitialElements);
|
|
||||||
- RunTest(cx, array);
|
|
||||||
- delete array;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- {
|
|
||||||
- AutoTArray<ElementT, InitialElements> array;
|
|
||||||
- RunTest(cx, &array);
|
|
||||||
- }
|
|
||||||
+ TestArrayType<nsTArray<ElementT>>(cx);
|
|
||||||
+ TestArrayType<FallibleTArray<ElementT>>(cx);
|
|
||||||
+ TestArrayType<AutoTArray<ElementT, 1>>(cx);
|
|
||||||
|
|
||||||
JS::LeaveRealm(cx, oldRealm);
|
|
||||||
}
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Valentin Gosu <valentin.gosu@gmail.com>
|
|
||||||
# Date 1604497734 0
|
|
||||||
# Wed Nov 04 13:48:54 2020 +0000
|
|
||||||
# Node ID 179e399ac08119ef3da61766c73f265679a6cf51
|
|
||||||
# Parent 6810172b5a5861dbf847848d0a34f13787c1a6ba
|
|
||||||
Bug 1672528 - Check IPv4-mapped IPv6 addresses for being local r=dragana,necko-reviewers
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D95414
|
|
||||||
|
|
||||||
diff -r 6810172b5a58 -r 179e399ac081 netwerk/dns/DNS.cpp
|
|
||||||
--- a/netwerk/dns/DNS.cpp Wed Nov 04 17:16:26 2020 +0000
|
|
||||||
+++ b/netwerk/dns/DNS.cpp Wed Nov 04 13:48:54 2020 +0000
|
|
||||||
@@ -183,27 +183,37 @@ bool IsIPAddrV4Mapped(const NetAddr* add
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static bool isLocalIPv4(uint32_t networkEndianIP) {
|
|
||||||
+ uint32_t addr32 = ntohl(networkEndianIP);
|
|
||||||
+ if (addr32 >> 24 == 0x0A || // 10/8 prefix (RFC 1918).
|
|
||||||
+ addr32 >> 20 == 0xAC1 || // 172.16/12 prefix (RFC 1918).
|
|
||||||
+ addr32 >> 16 == 0xC0A8 || // 192.168/16 prefix (RFC 1918).
|
|
||||||
+ addr32 >> 16 == 0xA9FE) { // 169.254/16 prefix (Link Local).
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ return false;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
bool IsIPAddrLocal(const NetAddr* addr) {
|
|
||||||
MOZ_ASSERT(addr);
|
|
||||||
|
|
||||||
// IPv4 RFC1918 and Link Local Addresses.
|
|
||||||
if (addr->raw.family == AF_INET) {
|
|
||||||
- uint32_t addr32 = ntohl(addr->inet.ip);
|
|
||||||
- if (addr32 >> 24 == 0x0A || // 10/8 prefix (RFC 1918).
|
|
||||||
- addr32 >> 20 == 0xAC1 || // 172.16/12 prefix (RFC 1918).
|
|
||||||
- addr32 >> 16 == 0xC0A8 || // 192.168/16 prefix (RFC 1918).
|
|
||||||
- addr32 >> 16 == 0xA9FE) { // 169.254/16 prefix (Link Local).
|
|
||||||
- return true;
|
|
||||||
- }
|
|
||||||
+ return isLocalIPv4(addr->inet.ip);
|
|
||||||
}
|
|
||||||
// IPv6 Unique and Link Local Addresses.
|
|
||||||
+ // or mapped IPv4 address
|
|
||||||
if (addr->raw.family == AF_INET6) {
|
|
||||||
uint16_t addr16 = ntohs(addr->inet6.ip.u16[0]);
|
|
||||||
if (addr16 >> 9 == 0xfc >> 1 || // fc00::/7 Unique Local Address.
|
|
||||||
addr16 >> 6 == 0xfe80 >> 6) { // fe80::/10 Link Local Address.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
+ if (IPv6ADDR_IS_V4MAPPED(&addr->inet6.ip)) {
|
|
||||||
+ return isLocalIPv4(IPv6ADDR_V4MAPPED_TO_IPADDR(&addr->inet6.ip));
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
+
|
|
||||||
// Not an IPv4/6 local address.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Valentin Gosu <valentin.gosu@gmail.com>
|
|
||||||
# Date 1604497736 0
|
|
||||||
# Wed Nov 04 13:48:56 2020 +0000
|
|
||||||
# Node ID b18b9e52050cb671b57c011daa4a173fe46aec5a
|
|
||||||
# Parent 179e399ac08119ef3da61766c73f265679a6cf51
|
|
||||||
Bug 1672528 - Test r=necko-reviewers,dragana
|
|
||||||
|
|
||||||
Depends on D95414
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D95415
|
|
||||||
|
|
||||||
diff -r 179e399ac081 -r b18b9e52050c netwerk/test/unit/test_trr.js
|
|
||||||
--- a/netwerk/test/unit/test_trr.js Wed Nov 04 13:48:54 2020 +0000
|
|
||||||
+++ b/netwerk/test/unit/test_trr.js Wed Nov 04 13:48:56 2020 +0000
|
|
||||||
@@ -556,6 +556,19 @@
|
|
||||||
!Components.isSuccessCode(inStatus),
|
|
||||||
`${inStatus} should be an error code`
|
|
||||||
);
|
|
||||||
+ Services.prefs.setCharPref(
|
|
||||||
+ "network.trr.uri",
|
|
||||||
+ `https://foo.example.com:${h2Port}/doh?responseIP=::ffff:192.168.0.1`
|
|
||||||
+ );
|
|
||||||
+ [, , inStatus] = await new DNSListener(
|
|
||||||
+ "rfc1918-ipv6.example.com",
|
|
||||||
+ undefined,
|
|
||||||
+ false
|
|
||||||
+ );
|
|
||||||
+ Assert.ok(
|
|
||||||
+ !Components.isSuccessCode(inStatus),
|
|
||||||
+ `${inStatus} should be an error code`
|
|
||||||
+ );
|
|
||||||
});
|
|
||||||
|
|
||||||
// verify RFC1918 address from the server is fine when told so
|
|
||||||
@@ -568,6 +581,11 @@
|
|
||||||
);
|
|
||||||
Services.prefs.setBoolPref("network.trr.allow-rfc1918", true);
|
|
||||||
await new DNSListener("rfc1918.example.com", "192.168.0.1");
|
|
||||||
+ Services.prefs.setCharPref(
|
|
||||||
+ "network.trr.uri",
|
|
||||||
+ `https://foo.example.com:${h2Port}/doh?responseIP=::ffff:192.168.0.1`
|
|
||||||
+ );
|
|
||||||
+ await new DNSListener("rfc1918-ipv6.example.com", "::ffff:192.168.0.1");
|
|
||||||
});
|
|
||||||
|
|
||||||
// use GET and disable ECS (makes a larger request)
|
|
||||||
@ -1,371 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User pbz <pbz@mozilla.com>
|
|
||||||
# Date 1600689290 0
|
|
||||||
# Mon Sep 21 11:54:50 2020 +0000
|
|
||||||
# Node ID efcefed227f304781326e7c8a52633559a79b6adlist oniguruma.spec
|
|
||||||
# Parent 32d03662a363850006f648c22e825b3e886b29bc
|
|
||||||
Bug 1314912 - Rate limit calls to History and Location interfaces. r=smaug9.0-3
|
|
||||||
|
|
||||||
This adds a rate limit to methods and setters of the History and Location
|
|
||||||
for non-system callers.
|
|
||||||
The rate limit is counted per BrowsingContext and can be controlled by prefs.
|
|
||||||
|
|
||||||
This patch is based on the original rate limit patch by :freesamael.
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D90136
|
|
||||||
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 docshell/base/BrowsingContext.cpp
|
|
||||||
--- a/docshell/base/BrowsingContext.cpp 2020-07-21 06:49:37.000000000 +0800
|
|
||||||
+++ b/docshell/base/BrowsingContext.cpp 2021-01-06 10:22:57.966851379 +0800
|
|
||||||
@@ -2459,6 +2459,56 @@ bool BrowsingContext::CanSet(FieldIndex<
|
|
||||||
return GetBrowserId() == 0 && IsTop() && Children().IsEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
+nsresult BrowsingContext::CheckLocationChangeRateLimit(CallerType aCallerType) {
|
|
||||||
+ // We only rate limit non system callers
|
|
||||||
+ if (aCallerType == CallerType::System) {
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Fetch rate limiting preferences
|
|
||||||
+ uint32_t limitCount =
|
|
||||||
+ StaticPrefs::dom_navigation_locationChangeRateLimit_count();
|
|
||||||
+ uint32_t timeSpanSeconds =
|
|
||||||
+ StaticPrefs::dom_navigation_locationChangeRateLimit_timespan();
|
|
||||||
+
|
|
||||||
+ // Disable throttling if either of the preferences is set to 0.
|
|
||||||
+ if (limitCount == 0 || timeSpanSeconds == 0) {
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ TimeDuration throttleSpan = TimeDuration::FromSeconds(timeSpanSeconds);
|
|
||||||
+
|
|
||||||
+ if (mLocationChangeRateLimitSpanStart.IsNull() ||
|
|
||||||
+ ((TimeStamp::Now() - mLocationChangeRateLimitSpanStart) > throttleSpan)) {
|
|
||||||
+ // Initial call or timespan exceeded, reset counter and timespan.
|
|
||||||
+ mLocationChangeRateLimitSpanStart = TimeStamp::Now();
|
|
||||||
+ mLocationChangeRateLimitCount = 1;
|
|
||||||
+ return NS_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (mLocationChangeRateLimitCount >= limitCount) {
|
|
||||||
+ // Rate limit reached
|
|
||||||
+
|
|
||||||
+ Document* doc = GetDocument();
|
|
||||||
+ if (doc) {
|
|
||||||
+ nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,NS_LITERAL_CSTRING("DOM"), doc,
|
|
||||||
+ nsContentUtils::eDOM_PROPERTIES,
|
|
||||||
+ "LocChangeFloodingPrevented");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return NS_ERROR_DOM_SECURITY_ERR;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ mLocationChangeRateLimitCount++;
|
|
||||||
+ return NS_OK;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void BrowsingContext::ResetLocationChangeRateLimit() {
|
|
||||||
+ // Resetting the timestamp object will cause the check function to
|
|
||||||
+ // init again and reset the rate limit.
|
|
||||||
+ mLocationChangeRateLimitSpanStart = TimeStamp();
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
} // namespace dom
|
|
||||||
|
|
||||||
namespace ipc {
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 docshell/base/BrowsingContext.h
|
|
||||||
--- a/docshell/base/BrowsingContext.h 2020-07-21 06:49:37.000000000 +0800
|
|
||||||
+++ b/docshell/base/BrowsingContext.h 2021-01-06 10:22:57.954851198 +0800
|
|
||||||
@@ -652,6 +652,16 @@ class BrowsingContext : public nsILoadCo
|
|
||||||
|
|
||||||
bool CrossOriginIsolated();
|
|
||||||
|
|
||||||
+ // Checks if we reached the rate limit for calls to Location and History API.
|
|
||||||
+ // The rate limit is controlled by the
|
|
||||||
+ // "dom.navigation.locationChangeRateLimit" prefs.
|
|
||||||
+ // Rate limit applies per BrowsingContext.
|
|
||||||
+ // Returns NS_OK if we are below the rate limit and increments the counter.
|
|
||||||
+ // Returns NS_ERROR_DOM_SECURITY_ERR if limit is reached.
|
|
||||||
+ nsresult CheckLocationChangeRateLimit(CallerType aCallerType);
|
|
||||||
+
|
|
||||||
+ void ResetLocationChangeRateLimit();
|
|
||||||
+
|
|
||||||
protected:
|
|
||||||
virtual ~BrowsingContext();
|
|
||||||
BrowsingContext(WindowContext* aParentWindow, BrowsingContextGroup* aGroup,
|
|
||||||
@@ -932,6 +942,11 @@ class BrowsingContext : public nsILoadCo
|
|
||||||
|
|
||||||
RefPtr<SessionStorageManager> mSessionStorageManager;
|
|
||||||
RefPtr<ChildSHistory> mChildSessionHistory;
|
|
||||||
+
|
|
||||||
+ // Counter and time span for rate limiting Location and History API calls.
|
|
||||||
+ // Used by CheckLocationChangeRateLimit. Do not apply cross-process.
|
|
||||||
+ uint32_t mLocationChangeRateLimitCount;
|
|
||||||
+ mozilla::TimeStamp mLocationChangeRateLimitSpanStart;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 docshell/shistory/ChildSHistory.cpp
|
|
||||||
--- a/docshell/shistory/ChildSHistory.cpp 2020-07-21 06:49:37.000000000 +0800
|
|
||||||
+++ b/docshell/shistory/ChildSHistory.cpp 2021-01-06 10:22:58.058852764 +0800
|
|
||||||
@@ -105,7 +105,14 @@ void ChildSHistory::Go(int32_t aOffset,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-void ChildSHistory::AsyncGo(int32_t aOffset, bool aRequireUserInteraction) {
|
|
||||||
+void ChildSHistory::AsyncGo(int32_t aOffset, bool aRequireUserInteraction,
|
|
||||||
+ CallerType aCallerType, ErrorResult& aRv) {
|
|
||||||
+ nsresult rv = mBrowsingContext->CheckLocationChangeRateLimit(aCallerType);
|
|
||||||
+ if (NS_FAILED(rv)) {
|
|
||||||
+ aRv.Throw(rv);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (!CanGo(aOffset)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 docshell/shistory/ChildSHistory.h
|
|
||||||
--- a/docshell/shistory/ChildSHistory.h 2020-07-21 06:49:37.000000000 +0800
|
|
||||||
+++ b/docshell/shistory/ChildSHistory.h 2021-01-06 10:22:58.058852764 +0800
|
|
||||||
@@ -64,8 +64,8 @@ class ChildSHistory : public nsISupports
|
|
||||||
*/
|
|
||||||
bool CanGo(int32_t aOffset);
|
|
||||||
void Go(int32_t aOffset, bool aRequireUserInteraction, ErrorResult& aRv);
|
|
||||||
- void AsyncGo(int32_t aOffset, bool aRequireUserInteraction);
|
|
||||||
-
|
|
||||||
+ void AsyncGo(int32_t aOffset, bool aRequireUserInteraction,
|
|
||||||
+ CallerType aCallerType, ErrorResult& aRv);
|
|
||||||
void RemovePendingHistoryNavigations();
|
|
||||||
|
|
||||||
/**
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 dom/base/LocationBase.cpp
|
|
||||||
--- a/dom/base/LocationBase.cpp 2020-07-21 04:53:13.000000000 +0800
|
|
||||||
+++ b/dom/base/LocationBase.cpp 2021-01-06 10:22:46.030671698 +0800
|
|
||||||
@@ -116,6 +116,16 @@ void LocationBase::SetURI(nsIURI* aURI,
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ CallerType callerType = aSubjectPrincipal.IsSystemPrincipal()
|
|
||||||
+ ? CallerType::System
|
|
||||||
+ : CallerType::NonSystem;
|
|
||||||
+
|
|
||||||
+ nsresult rv = bc->CheckLocationChangeRateLimit(callerType);
|
|
||||||
+ if (NS_FAILED(rv)) {
|
|
||||||
+ aRv.Throw(rv);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
RefPtr<nsDocShellLoadState> loadState =
|
|
||||||
CheckURL(aURI, aSubjectPrincipal, aRv);
|
|
||||||
if (aRv.Failed()) {
|
|
||||||
@@ -141,7 +151,7 @@ void LocationBase::SetURI(nsIURI* aURI,
|
|
||||||
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE);
|
|
||||||
loadState->SetFirstParty(true);
|
|
||||||
|
|
||||||
- nsresult rv = bc->LoadURI(loadState);
|
|
||||||
+ rv = bc->LoadURI(loadState);
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
||||||
aRv.Throw(rv);
|
|
||||||
}
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 dom/base/nsHistory.cpp
|
|
||||||
--- a/dom/base/nsHistory.cpp 2020-07-21 06:49:37.000000000 +0800
|
|
||||||
+++ b/dom/base/nsHistory.cpp 2021-01-06 10:22:46.030671698 +0800
|
|
||||||
@@ -135,7 +135,7 @@ void nsHistory::GetState(JSContext* aCx,
|
|
||||||
aResult.setNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
-void nsHistory::Go(int32_t aDelta, ErrorResult& aRv) {
|
|
||||||
+void nsHistory::Go(int32_t aDelta, CallerType aCallerType, ErrorResult& aRv) {
|
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
|
||||||
if (!win || !win->HasActiveDocument()) {
|
|
||||||
return aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
@@ -157,15 +157,17 @@ void nsHistory::Go(int32_t aDelta, Error
|
|
||||||
|
|
||||||
// Ignore the return value from Go(), since returning errors from Go() can
|
|
||||||
// lead to exceptions and a possible leak of history length
|
|
||||||
+ // AsyncGo throws if we hit the location change rate limit.
|
|
||||||
if (StaticPrefs::dom_window_history_async()) {
|
|
||||||
- session_history->AsyncGo(aDelta, /* aRequireUserInteraction = */ false);
|
|
||||||
+ session_history->AsyncGo(aDelta, /* aRequireUserInteraction = */ false,
|
|
||||||
+ aCallerType, aRv);
|
|
||||||
} else {
|
|
||||||
session_history->Go(aDelta, /* aRequireUserInteraction = */ false,
|
|
||||||
IgnoreErrors());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-void nsHistory::Back(ErrorResult& aRv) {
|
|
||||||
+void nsHistory::Back(CallerType aCallerType, ErrorResult& aRv) {
|
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
|
||||||
if (!win || !win->HasActiveDocument()) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
@@ -181,13 +183,14 @@ void nsHistory::Back(ErrorResult& aRv) {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StaticPrefs::dom_window_history_async()) {
|
|
||||||
- sHistory->AsyncGo(-1, /* aRequireUserInteraction = */ false);
|
|
||||||
+ sHistory->AsyncGo(-1, /* aRequireUserInteraction = */ false, aCallerType,
|
|
||||||
+ aRv);
|
|
||||||
} else {
|
|
||||||
sHistory->Go(-1, /* aRequireUserInteraction = */ false, IgnoreErrors());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-void nsHistory::Forward(ErrorResult& aRv) {
|
|
||||||
+void nsHistory::Forward(CallerType aCallerType, ErrorResult& aRv) {
|
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
|
||||||
if (!win || !win->HasActiveDocument()) {
|
|
||||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
|
||||||
@@ -203,7 +206,8 @@ void nsHistory::Forward(ErrorResult& aRv
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StaticPrefs::dom_window_history_async()) {
|
|
||||||
- sHistory->AsyncGo(1, /* aRequireUserInteraction = */ false);
|
|
||||||
+ sHistory->AsyncGo(1, /* aRequireUserInteraction = */ false, aCallerType,
|
|
||||||
+ aRv);
|
|
||||||
} else {
|
|
||||||
sHistory->Go(1, /* aRequireUserInteraction = */ false, IgnoreErrors());
|
|
||||||
}
|
|
||||||
@@ -211,19 +215,20 @@ void nsHistory::Forward(ErrorResult& aRv
|
|
||||||
|
|
||||||
void nsHistory::PushState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
|
||||||
const nsAString& aTitle, const nsAString& aUrl,
|
|
||||||
- ErrorResult& aRv) {
|
|
||||||
- PushOrReplaceState(aCx, aData, aTitle, aUrl, aRv, false);
|
|
||||||
+ CallerType aCallerType, ErrorResult& aRv) {
|
|
||||||
+ PushOrReplaceState(aCx, aData, aTitle, aUrl, aCallerType, aRv, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsHistory::ReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
|
||||||
const nsAString& aTitle, const nsAString& aUrl,
|
|
||||||
- ErrorResult& aRv) {
|
|
||||||
- PushOrReplaceState(aCx, aData, aTitle, aUrl, aRv, true);
|
|
||||||
+ CallerType aCallerType, ErrorResult& aRv) {
|
|
||||||
+ PushOrReplaceState(aCx, aData, aTitle, aUrl, aCallerType, aRv, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsHistory::PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
|
||||||
const nsAString& aTitle,
|
|
||||||
- const nsAString& aUrl, ErrorResult& aRv,
|
|
||||||
+ const nsAString& aUrl,
|
|
||||||
+ CallerType aCallerType, ErrorResult& aRv,
|
|
||||||
bool aReplace) {
|
|
||||||
nsCOMPtr<nsPIDOMWindowInner> win(do_QueryReferent(mInnerWindow));
|
|
||||||
if (!win) {
|
|
||||||
@@ -238,6 +243,15 @@ void nsHistory::PushOrReplaceState(JSCon
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ BrowsingContext* bc = win->GetBrowsingContext();
|
|
||||||
+ if (bc) {
|
|
||||||
+ nsresult rv = bc->CheckLocationChangeRateLimit(aCallerType);
|
|
||||||
+ if (NS_FAILED(rv)) {
|
|
||||||
+ aRv.Throw(rv);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
// AddState might run scripts, so we need to hold a strong reference to the
|
|
||||||
// docShell here to keep it from going away.
|
|
||||||
nsCOMPtr<nsIDocShell> docShell = win->GetDocShell();
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 dom/base/nsHistory.h
|
|
||||||
--- a/dom/base/nsHistory.h 2020-07-21 04:53:13.000000000 +0800
|
|
||||||
+++ b/dom/base/nsHistory.h 2021-01-06 10:22:46.030671698 +0800
|
|
||||||
@@ -42,14 +42,17 @@ class nsHistory final : public nsISuppor
|
|
||||||
mozilla::ErrorResult& aRv);
|
|
||||||
void GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
|
|
||||||
mozilla::ErrorResult& aRv) const;
|
|
||||||
- void Go(int32_t aDelta, mozilla::ErrorResult& aRv);
|
|
||||||
- void Back(mozilla::ErrorResult& aRv);
|
|
||||||
- void Forward(mozilla::ErrorResult& aRv);
|
|
||||||
+ void Go(int32_t aDelta, mozilla::dom::CallerType aCallerType,
|
|
||||||
+ mozilla::ErrorResult& aRv);
|
|
||||||
+ void Back(mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aRv);
|
|
||||||
+ void Forward(mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aRv);
|
|
||||||
void PushState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
|
||||||
const nsAString& aTitle, const nsAString& aUrl,
|
|
||||||
+ mozilla::dom::CallerType aCallerType,
|
|
||||||
mozilla::ErrorResult& aRv);
|
|
||||||
void ReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
|
||||||
const nsAString& aTitle, const nsAString& aUrl,
|
|
||||||
+ mozilla::dom::CallerType aCallerType,
|
|
||||||
mozilla::ErrorResult& aRv);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
@@ -59,6 +62,7 @@ class nsHistory final : public nsISuppor
|
|
||||||
|
|
||||||
void PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
|
||||||
const nsAString& aTitle, const nsAString& aUrl,
|
|
||||||
+ mozilla::dom::CallerType aCallerType,
|
|
||||||
mozilla::ErrorResult& aRv, bool aReplace);
|
|
||||||
|
|
||||||
already_AddRefed<mozilla::dom::ChildSHistory> GetSessionHistory() const;
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 dom/chrome-webidl/BrowsingContext.webidl
|
|
||||||
--- a/dom/chrome-webidl/BrowsingContext.webidl 2020-07-21 06:49:37.000000000 +0800
|
|
||||||
+++ b/dom/chrome-webidl/BrowsingContext.webidl 2021-01-06 10:22:42.362616481 +0800
|
|
||||||
@@ -120,6 +120,9 @@ interface BrowsingContext {
|
|
||||||
* under the new browser element.
|
|
||||||
*/
|
|
||||||
attribute unsigned long long browserId;
|
|
||||||
+
|
|
||||||
+ // Resets the location change rate limit. Used for testing.
|
|
||||||
+ void resetLocationChangeRateLimit();
|
|
||||||
};
|
|
||||||
|
|
||||||
BrowsingContext includes LoadContextMixin;
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 dom/locales/en-US/chrome/dom/dom.properties
|
|
||||||
--- a/dom/locales/en-US/chrome/dom/dom.properties 2020-07-21 06:49:37.000000000 +0800
|
|
||||||
+++ b/dom/locales/en-US/chrome/dom/dom.properties 2021-01-06 10:22:42.418617324 +0800
|
|
||||||
@@ -393,3 +393,5 @@ UnknownProtocolNavigationPrevented=Preve
|
|
||||||
PostMessageSharedMemoryObjectToCrossOriginWarning=Cannot post message containing a shared memory object to a cross-origin window.
|
|
||||||
# LOCALIZATION NOTE: %S is the URL of the resource in question
|
|
||||||
UnusedLinkPreloadPending=The resource at “%S” preloaded with link preload was not used within a few seconds. Make sure all attributes of the preload tag are set correctly.
|
|
||||||
+# LOCALIZATION NOTE: Do not translate "Location" and "History".
|
|
||||||
+LocChangeFloodingPrevented=Too many calls to Location or History APIs within a short timeframe.
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 dom/webidl/History.webidl
|
|
||||||
--- a/dom/webidl/History.webidl 2020-07-21 04:53:19.000000000 +0800
|
|
||||||
+++ b/dom/webidl/History.webidl 2021-01-06 10:22:42.298615518 +0800
|
|
||||||
@@ -21,14 +21,14 @@ interface History {
|
|
||||||
attribute ScrollRestoration scrollRestoration;
|
|
||||||
[Throws]
|
|
||||||
readonly attribute any state;
|
|
||||||
- [Throws]
|
|
||||||
+ [Throws, NeedsCallerType]
|
|
||||||
void go(optional long delta = 0);
|
|
||||||
- [Throws]
|
|
||||||
+ [Throws, NeedsCallerType]
|
|
||||||
void back();
|
|
||||||
- [Throws]
|
|
||||||
+ [Throws, NeedsCallerType]
|
|
||||||
void forward();
|
|
||||||
- [Throws]
|
|
||||||
+ [Throws, NeedsCallerType]
|
|
||||||
void pushState(any data, DOMString title, optional DOMString? url = null);
|
|
||||||
- [Throws]
|
|
||||||
+ [Throws, NeedsCallerType]
|
|
||||||
void replaceState(any data, DOMString title, optional DOMString? url = null);
|
|
||||||
};
|
|
||||||
diff -r 32d03662a363 -r efcefed227f3 modules/libpref/init/StaticPrefList.yaml
|
|
||||||
--- a/modules/libpref/init/StaticPrefList.yaml 2021-01-06 10:25:09.272827991 +0800
|
|
||||||
+++ b/modules/libpref/init/StaticPrefList.yaml 2021-01-06 10:22:36.458527604 +0800
|
|
||||||
@@ -2181,6 +2181,19 @@
|
|
||||||
value: true
|
|
||||||
mirror: always
|
|
||||||
|
|
||||||
+# Limit of location change caused by content scripts in a time span per
|
|
||||||
+# BrowsingContext. This includes calls to History and Location APIs.
|
|
||||||
+- name: dom.navigation.locationChangeRateLimit.count
|
|
||||||
+ type: uint32_t
|
|
||||||
+ value: 200
|
|
||||||
+ mirror: always
|
|
||||||
+
|
|
||||||
+# Time span in seconds for location change rate limit.
|
|
||||||
+- name: dom.navigation.locationChangeRateLimit.timespan
|
|
||||||
+ type: uint32_t
|
|
||||||
+ value: 10
|
|
||||||
+ mirror: always
|
|
||||||
+
|
|
||||||
# Network Information API
|
|
||||||
- name: dom.netinfo.enabled
|
|
||||||
type: RelaxedAtomicBool
|
|
||||||
@ -1,118 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User pbz <pbz@mozilla.com>
|
|
||||||
# Date 1600689297 0
|
|
||||||
# Mon Sep 21 11:54:57 2020 +0000
|
|
||||||
# Node ID ff5164e4aec8cd7a86df0b5f97842fb1f6f765a6
|
|
||||||
# Parent efcefed227f304781326e7c8a52633559a79b6ad
|
|
||||||
Bug 1314912 - Added test for location change rate limit. r=smaug
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D90137
|
|
||||||
|
|
||||||
diff -r efcefed227f3 -r ff5164e4aec8 docshell/test/navigation/mochitest.ini
|
|
||||||
--- a/docshell/test/navigation/mochitest.ini Mon Sep 21 11:54:50 2020 +0000
|
|
||||||
+++ b/docshell/test/navigation/mochitest.ini Mon Sep 21 11:54:57 2020 +0000
|
|
||||||
@@ -97,3 +97,4 @@
|
|
||||||
[test_triggeringprincipal_parent_iframe_window_open.html]
|
|
||||||
[test_triggeringprincipal_iframe_iframe_window_open.html]
|
|
||||||
[test_contentpolicy_block_window.html]
|
|
||||||
+[test_rate_limit_location_change.html]
|
|
||||||
diff -r efcefed227f3 -r ff5164e4aec8 docshell/test/navigation/test_rate_limit_location_change.html
|
|
||||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
||||||
+++ b/docshell/test/navigation/test_rate_limit_location_change.html Mon Sep 21 11:54:57 2020 +0000
|
|
||||||
@@ -0,0 +1,96 @@
|
|
||||||
+<!DOCTYPE HTML>
|
|
||||||
+<html>
|
|
||||||
+<!--
|
|
||||||
+https://bugzilla.mozilla.org/show_bug.cgi?id=1314912
|
|
||||||
+-->
|
|
||||||
+<head>
|
|
||||||
+ <meta charset="utf-8">
|
|
||||||
+ <title>Test for Bug 1314912</title>
|
|
||||||
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
||||||
+ <script type="application/javascript">
|
|
||||||
+
|
|
||||||
+ /** Test for Bug 1314912 **/
|
|
||||||
+
|
|
||||||
+ const RATE_LIMIT_COUNT = 90;
|
|
||||||
+ const RATE_LIMIT_TIME_SPAN = 3;
|
|
||||||
+
|
|
||||||
+ async function setup() {
|
|
||||||
+ await SpecialPowers.pushPrefEnv({set: [
|
|
||||||
+ ["dom.navigation.locationChangeRateLimit.count", RATE_LIMIT_COUNT],
|
|
||||||
+ ["dom.navigation.locationChangeRateLimit.timespan", RATE_LIMIT_TIME_SPAN]]});
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ let inc = 0;
|
|
||||||
+
|
|
||||||
+ const rateLimitedFunctions = (win) => ({
|
|
||||||
+ "history.replaceState": () => win.history.replaceState(null, "test", `${win.location.href}#${inc++}`),
|
|
||||||
+ "history.pushState": () => win.history.pushState(null, "test", `${win.location.href}#${inc++}`),
|
|
||||||
+ "history.back": () => win.history.back(),
|
|
||||||
+ "history.forward": () => win.history.forward(),
|
|
||||||
+ "history.go": () => win.history.go(-1),
|
|
||||||
+ "location.hash": () => win.location.hash = inc++,
|
|
||||||
+ "location.host": () => win.location.host = win.location.host + "",
|
|
||||||
+ "location.hostname": () => win.location.hostname = win.location.hostname + "",
|
|
||||||
+ "location.pathname": () => win.location.pathname = win.location.pathname + "",
|
|
||||||
+ "location.port": () => win.location.port = win.location.port + "",
|
|
||||||
+ "location.protocol": () => win.location.protocol = win.location.protocol + "",
|
|
||||||
+ "location.search": () => win.location.search = win.location.search + "",
|
|
||||||
+ });
|
|
||||||
+
|
|
||||||
+ async function test() {
|
|
||||||
+ await setup();
|
|
||||||
+
|
|
||||||
+ // Open new window and wait for it to load
|
|
||||||
+ let win = window.open("blank.html");
|
|
||||||
+ await new Promise((resolve) => SimpleTest.waitForFocus(resolve, win))
|
|
||||||
+
|
|
||||||
+ // Execute the history and location functions
|
|
||||||
+ Object.entries(rateLimitedFunctions(win)).forEach(([name, fn]) => {
|
|
||||||
+ // Reset the rate limit for the next run.
|
|
||||||
+ info("Reset rate limit.");
|
|
||||||
+ SpecialPowers.wrap(win).browsingContext.resetLocationChangeRateLimit();
|
|
||||||
+
|
|
||||||
+ info(`Calling ${name} ${RATE_LIMIT_COUNT} times to reach the rate limit.`);
|
|
||||||
+ for(let i = 0; i< RATE_LIMIT_COUNT; i++) {
|
|
||||||
+ fn.call(this);
|
|
||||||
+ }
|
|
||||||
+ // Next calls should throw because we're above the rate limit
|
|
||||||
+ for(let i = 0; i < 5; i++) {
|
|
||||||
+ SimpleTest.doesThrow(() => fn.call(this), `Call #${RATE_LIMIT_COUNT + i + 1} to ${name} should throw.`);
|
|
||||||
+ }
|
|
||||||
+ })
|
|
||||||
+
|
|
||||||
+ // We didn't reset the rate limit after the last loop iteration above.
|
|
||||||
+ // Wait for the rate limit timer to expire.
|
|
||||||
+ SimpleTest.requestFlakyTimeout("Waiting to trigger rate limit reset.");
|
|
||||||
+ await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
||||||
+
|
|
||||||
+ // Calls should be allowed again.
|
|
||||||
+ Object.entries(rateLimitedFunctions(win)).forEach(([name, fn]) => {
|
|
||||||
+ let didThrow = false;
|
|
||||||
+ try {
|
|
||||||
+ fn.call(this);
|
|
||||||
+ } catch(error) {
|
|
||||||
+ didThrow = true;
|
|
||||||
+ }
|
|
||||||
+ is(didThrow, false, `Call to ${name} must not throw.`)
|
|
||||||
+ });
|
|
||||||
+
|
|
||||||
+ // Cleanup
|
|
||||||
+ win.close();
|
|
||||||
+ SpecialPowers.wrap(win).browsingContext.resetLocationChangeRateLimit();
|
|
||||||
+ SimpleTest.finish();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ </script>
|
|
||||||
+</head>
|
|
||||||
+<body onload="setTimeout(test, 0);">
|
|
||||||
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1314912">Mozilla Bug 1314912</a>
|
|
||||||
+<p id="display"></p>
|
|
||||||
+<div id="content" style="display: none">
|
|
||||||
+</div>
|
|
||||||
+<pre id="test">
|
|
||||||
+</pre>
|
|
||||||
+</body>
|
|
||||||
+</html>
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Makoto Kato <m_kato@ga2.so-net.ne.jp>
|
|
||||||
# Date 1601537039 0
|
|
||||||
# Thu Oct 01 07:23:59 2020 +0000
|
|
||||||
# Node ID 3b746525d6472490b44e55e4766078372e0380c3
|
|
||||||
# Parent e6b1234900b328782dd4f93b34222bf49b470ac2
|
|
||||||
Bug 1661617 - Use password hint for software keyboard. r=masayuki
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D91237
|
|
||||||
|
|
||||||
diff -r e6b1234900b3 -r 3b746525d647 dom/events/IMEStateManager.cpp
|
|
||||||
--- a/dom/events/IMEStateManager.cpp Thu Oct 08 05:39:33 2020 +0000
|
|
||||||
+++ b/dom/events/IMEStateManager.cpp Thu Oct 01 07:23:59 2020 +0000
|
|
||||||
@@ -1260,7 +1260,13 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aContent->IsHTMLElement(nsGkAtoms::input)) {
|
|
||||||
- HTMLInputElement::FromNode(aContent)->GetType(context.mHTMLInputType);
|
|
||||||
+ HTMLInputElement* inputElement = HTMLInputElement::FromNode(aContent);
|
|
||||||
+ if (inputElement->HasBeenTypePassword() && aState.IsEditable()) {
|
|
||||||
+ context.mHTMLInputType.AssignLiteral("password");
|
|
||||||
+ } else {
|
|
||||||
+ inputElement->GetType(context.mHTMLInputType);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
GetActionHint(*aContent, context.mActionHint);
|
|
||||||
} else if (aContent->IsHTMLElement(nsGkAtoms::textarea)) {
|
|
||||||
context.mHTMLInputType.Assign(nsGkAtoms::textarea->GetUTF16String());
|
|
||||||
@ -1,312 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Valentin Gosu <valentin.gosu@gmail.com>
|
|
||||||
# Date 1604045785 0
|
|
||||||
# Fri Oct 30 08:16:25 2020 +0000
|
|
||||||
# Node ID 0344d5a76b7db85d4f6d5f5f34649b9111eb6094
|
|
||||||
# Parent 3e57839bffd2ea7c3b53a9f7ccd75fd308afd801
|
|
||||||
Bug 1663571 - Resolve single label DNS queries using DnsQuery_A r=necko-reviewers,dragana
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D91117
|
|
||||||
|
|
||||||
diff -r 3e57839bffd2 -r 0344d5a76b7d modules/libpref/init/StaticPrefList.yaml
|
|
||||||
--- a/modules/libpref/init/StaticPrefList.yaml Fri Oct 30 10:19:14 2020 +0000
|
|
||||||
+++ b/modules/libpref/init/StaticPrefList.yaml Fri Oct 30 08:16:25 2020 +0000
|
|
||||||
@@ -7978,6 +7978,14 @@
|
|
||||||
value: 2000
|
|
||||||
mirror: always
|
|
||||||
|
|
||||||
+# When true on Windows DNS resolutions for single label domains
|
|
||||||
+# (domains that don't contain a dot) will be resolved using the DnsQuery
|
|
||||||
+# API instead of PR_GetAddrInfoByName
|
|
||||||
+- name: network.dns.dns_query_single_label
|
|
||||||
+ type: RelaxedAtomicBool
|
|
||||||
+ value: true
|
|
||||||
+ mirror: always
|
|
||||||
+
|
|
||||||
# Whether the SOCKS proxy should be in charge of DNS resolution.
|
|
||||||
- name: network.proxy.socks_remote_dns
|
|
||||||
type: bool
|
|
||||||
diff -r 3e57839bffd2 -r 0344d5a76b7d netwerk/dns/GetAddrInfo.cpp
|
|
||||||
--- a/netwerk/dns/GetAddrInfo.cpp Fri Oct 30 10:19:14 2020 +0000
|
|
||||||
+++ b/netwerk/dns/GetAddrInfo.cpp Fri Oct 30 08:16:25 2020 +0000
|
|
||||||
@@ -5,6 +5,18 @@
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "GetAddrInfo.h"
|
|
||||||
+
|
|
||||||
+#ifdef DNSQUERY_AVAILABLE
|
|
||||||
+// There is a bug in windns.h where the type of parameter ppQueryResultsSet for
|
|
||||||
+// DnsQuery_A is dependent on UNICODE being set. It should *always* be
|
|
||||||
+// PDNS_RECORDA, but if UNICODE is set it is PDNS_RECORDW. To get around this
|
|
||||||
+// we make sure that UNICODE is unset.
|
|
||||||
+# undef UNICODE
|
|
||||||
+# include <ws2tcpip.h>
|
|
||||||
+# undef GetAddrInfo
|
|
||||||
+# include <windns.h>
|
|
||||||
+#endif // DNSQUERY_AVAILABLE
|
|
||||||
+
|
|
||||||
#include "mozilla/ClearOnShutdown.h"
|
|
||||||
#include "mozilla/net/DNS.h"
|
|
||||||
#include "NativeDNSResolverOverrideParent.h"
|
|
||||||
@@ -19,17 +31,6 @@
|
|
||||||
#include "mozilla/Logging.h"
|
|
||||||
#include "mozilla/StaticPrefs_network.h"
|
|
||||||
|
|
||||||
-#ifdef DNSQUERY_AVAILABLE
|
|
||||||
-// There is a bug in windns.h where the type of parameter ppQueryResultsSet for
|
|
||||||
-// DnsQuery_A is dependent on UNICODE being set. It should *always* be
|
|
||||||
-// PDNS_RECORDA, but if UNICODE is set it is PDNS_RECORDW. To get around this
|
|
||||||
-// we make sure that UNICODE is unset.
|
|
||||||
-# undef UNICODE
|
|
||||||
-# include <ws2tcpip.h>
|
|
||||||
-# undef GetAddrInfo
|
|
||||||
-# include <windns.h>
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
namespace mozilla {
|
|
||||||
namespace net {
|
|
||||||
|
|
||||||
@@ -42,6 +43,11 @@
|
|
||||||
MOZ_LOG(gGetAddrInfoLog, LogLevel::Warning, ("[DNS]: " msg, ##__VA_ARGS__))
|
|
||||||
|
|
||||||
#ifdef DNSQUERY_AVAILABLE
|
|
||||||
+
|
|
||||||
+# define COMPUTER_NAME_BUFFER_SIZE 100
|
|
||||||
+static char sDNSComputerName[COMPUTER_NAME_BUFFER_SIZE];
|
|
||||||
+static char sNETBIOSComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
|
||||||
+
|
|
||||||
////////////////////////////
|
|
||||||
// WINDOWS IMPLEMENTATION //
|
|
||||||
////////////////////////////
|
|
||||||
@@ -56,45 +62,63 @@
|
|
||||||
// equal with the one already there. Gets the TTL value by calling
|
|
||||||
// to DnsQuery_A and iterating through the returned
|
|
||||||
// records to find the one with the smallest TTL value.
|
|
||||||
-static MOZ_ALWAYS_INLINE nsresult _GetMinTTLForRequestType_Windows(
|
|
||||||
- const char* aHost, uint16_t aRequestType, unsigned int* aResult) {
|
|
||||||
- MOZ_ASSERT(aHost);
|
|
||||||
- MOZ_ASSERT(aResult);
|
|
||||||
+static MOZ_ALWAYS_INLINE nsresult _CallDnsQuery_A_Windows(
|
|
||||||
+ const nsACString& aHost, uint16_t aAddressFamily, DWORD aFlags,
|
|
||||||
+ std::function<void(PDNS_RECORDA)> aCallback) {
|
|
||||||
+ NS_ConvertASCIItoUTF16 name(aHost);
|
|
||||||
+
|
|
||||||
+ auto callDnsQuery_A = [&](uint16_t reqFamily) {
|
|
||||||
+ PDNS_RECORDA dnsData = nullptr;
|
|
||||||
+ DNS_STATUS status = DnsQuery_A(aHost.BeginReading(), reqFamily, aFlags,
|
|
||||||
+ nullptr, &dnsData, nullptr);
|
|
||||||
+ if (status == DNS_INFO_NO_RECORDS || status == DNS_ERROR_RCODE_NAME_ERROR ||
|
|
||||||
+ !dnsData) {
|
|
||||||
+ LOG("No DNS records found for %s. status=%X. reqFamily = %X\n",
|
|
||||||
+ aHost.BeginReading(), status, reqFamily);
|
|
||||||
+ return NS_ERROR_FAILURE;
|
|
||||||
+ } else if (status != NOERROR) {
|
|
||||||
+ LOG_WARNING("DnsQuery_A failed with status %X.\n", status);
|
|
||||||
+ return NS_ERROR_UNEXPECTED;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- PDNS_RECORDA dnsData = nullptr;
|
|
||||||
- DNS_STATUS status = DnsQuery_A(
|
|
||||||
- aHost, aRequestType,
|
|
||||||
- (DNS_QUERY_STANDARD | DNS_QUERY_NO_NETBT | DNS_QUERY_NO_HOSTS_FILE |
|
|
||||||
- DNS_QUERY_NO_MULTICAST | DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE |
|
|
||||||
- DNS_QUERY_DONT_RESET_TTL_VALUES),
|
|
||||||
- nullptr, &dnsData, nullptr);
|
|
||||||
- if (status == DNS_INFO_NO_RECORDS || status == DNS_ERROR_RCODE_NAME_ERROR ||
|
|
||||||
- !dnsData) {
|
|
||||||
- LOG("No DNS records found for %s. status=%X. aRequestType = %X\n", aHost,
|
|
||||||
- status, aRequestType);
|
|
||||||
- return NS_ERROR_FAILURE;
|
|
||||||
- } else if (status != NOERROR) {
|
|
||||||
- LOG_WARNING("DnsQuery_A failed with status %X.\n", status);
|
|
||||||
- return NS_ERROR_UNEXPECTED;
|
|
||||||
+ for (PDNS_RECORDA curRecord = dnsData; curRecord;
|
|
||||||
+ curRecord = curRecord->pNext) {
|
|
||||||
+ // Only records in the answer section are important
|
|
||||||
+ if (curRecord->Flags.S.Section != DnsSectionAnswer) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ if (curRecord->wType != reqFamily) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ aCallback(curRecord);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ DnsFree(dnsData, DNS_FREE_TYPE::DnsFreeRecordList);
|
|
||||||
+ return NS_OK;
|
|
||||||
+ };
|
|
||||||
+
|
|
||||||
+ if (aAddressFamily == PR_AF_UNSPEC || aAddressFamily == PR_AF_INET) {
|
|
||||||
+ callDnsQuery_A(DNS_TYPE_A);
|
|
||||||
}
|
|
||||||
|
|
||||||
- for (PDNS_RECORDA curRecord = dnsData; curRecord;
|
|
||||||
- curRecord = curRecord->pNext) {
|
|
||||||
- // Only records in the answer section are important
|
|
||||||
- if (curRecord->Flags.S.Section != DnsSectionAnswer) {
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
+ if (aAddressFamily == PR_AF_UNSPEC || aAddressFamily == PR_AF_INET6) {
|
|
||||||
+ callDnsQuery_A(DNS_TYPE_AAAA);
|
|
||||||
+ }
|
|
||||||
+ return NS_OK;
|
|
||||||
+}
|
|
||||||
|
|
||||||
- if (curRecord->wType == aRequestType) {
|
|
||||||
- *aResult = std::min<unsigned int>(*aResult, curRecord->dwTtl);
|
|
||||||
- } else {
|
|
||||||
- LOG("Received unexpected record type %u in response for %s.\n",
|
|
||||||
- curRecord->wType, aHost);
|
|
||||||
- }
|
|
||||||
+bool recordTypeMatchesRequest(uint16_t wType, uint16_t aAddressFamily) {
|
|
||||||
+ if (aAddressFamily == PR_AF_UNSPEC) {
|
|
||||||
+ return wType == DNS_TYPE_A || wType == DNS_TYPE_AAAA;
|
|
||||||
}
|
|
||||||
-
|
|
||||||
- DnsFree(dnsData, DNS_FREE_TYPE::DnsFreeRecordList);
|
|
||||||
- return NS_OK;
|
|
||||||
+ if (aAddressFamily == PR_AF_INET) {
|
|
||||||
+ return wType == DNS_TYPE_A;
|
|
||||||
+ }
|
|
||||||
+ if (aAddressFamily == PR_AF_INET6) {
|
|
||||||
+ return wType == DNS_TYPE_AAAA;
|
|
||||||
+ }
|
|
||||||
+ return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static MOZ_ALWAYS_INLINE nsresult _GetTTLData_Windows(const nsACString& aHost,
|
|
||||||
@@ -110,13 +134,21 @@
|
|
||||||
// In order to avoid using ANY records which are not always implemented as a
|
|
||||||
// "Gimme what you have" request in hostname resolvers, we should send A
|
|
||||||
// and/or AAAA requests, based on the address family requested.
|
|
||||||
+ const DWORD ttlFlags =
|
|
||||||
+ (DNS_QUERY_STANDARD | DNS_QUERY_NO_NETBT | DNS_QUERY_NO_HOSTS_FILE |
|
|
||||||
+ DNS_QUERY_NO_MULTICAST | DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE |
|
|
||||||
+ DNS_QUERY_DONT_RESET_TTL_VALUES);
|
|
||||||
unsigned int ttl = (unsigned int)-1;
|
|
||||||
- if (aAddressFamily == PR_AF_UNSPEC || aAddressFamily == PR_AF_INET) {
|
|
||||||
- _GetMinTTLForRequestType_Windows(aHost.BeginReading(), DNS_TYPE_A, &ttl);
|
|
||||||
- }
|
|
||||||
- if (aAddressFamily == PR_AF_UNSPEC || aAddressFamily == PR_AF_INET6) {
|
|
||||||
- _GetMinTTLForRequestType_Windows(aHost.BeginReading(), DNS_TYPE_AAAA, &ttl);
|
|
||||||
- }
|
|
||||||
+ _CallDnsQuery_A_Windows(
|
|
||||||
+ aHost, aAddressFamily, ttlFlags,
|
|
||||||
+ [&ttl, &aHost, aAddressFamily](PDNS_RECORDA curRecord) {
|
|
||||||
+ if (recordTypeMatchesRequest(curRecord->wType, aAddressFamily)) {
|
|
||||||
+ ttl = std::min<unsigned int>(ttl, curRecord->dwTtl);
|
|
||||||
+ } else {
|
|
||||||
+ LOG("Received unexpected record type %u in response for %s.\n",
|
|
||||||
+ curRecord->wType, aHost.BeginReading());
|
|
||||||
+ }
|
|
||||||
+ });
|
|
||||||
|
|
||||||
if (ttl == (unsigned int)-1) {
|
|
||||||
LOG("No useable TTL found.");
|
|
||||||
@@ -126,6 +158,41 @@
|
|
||||||
*aResult = ttl;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+static MOZ_ALWAYS_INLINE nsresult
|
|
||||||
+_DNSQuery_A_SingleLabel(const nsACString& aCanonHost, uint16_t aAddressFamily,
|
|
||||||
+ uint16_t aFlags, AddrInfo** aAddrInfo) {
|
|
||||||
+ bool setCanonName = aFlags & nsHostResolver::RES_CANON_NAME;
|
|
||||||
+ nsAutoCString canonName;
|
|
||||||
+ const DWORD flags = (DNS_QUERY_STANDARD | DNS_QUERY_NO_MULTICAST |
|
|
||||||
+ DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE);
|
|
||||||
+ nsTArray<NetAddr> addresses;
|
|
||||||
+
|
|
||||||
+ _CallDnsQuery_A_Windows(
|
|
||||||
+ aCanonHost, aAddressFamily, flags, [&](PDNS_RECORDA curRecord) {
|
|
||||||
+ MOZ_DIAGNOSTIC_ASSERT(curRecord->wType == DNS_TYPE_A ||
|
|
||||||
+ curRecord->wType == DNS_TYPE_AAAA);
|
|
||||||
+ if (setCanonName) {
|
|
||||||
+ canonName.Assign(curRecord->pName);
|
|
||||||
+ }
|
|
||||||
+ NetAddr addr{};
|
|
||||||
+ addr.inet.family = AF_INET;
|
|
||||||
+ addr.inet.ip = curRecord->Data.A.IpAddress;
|
|
||||||
+ addresses.AppendElement(addr);
|
|
||||||
+ });
|
|
||||||
+
|
|
||||||
+ LOG("Query for: %s has %u results", aCanonHost.BeginReading(),
|
|
||||||
+ addresses.Length());
|
|
||||||
+ if (addresses.IsEmpty()) {
|
|
||||||
+ return NS_ERROR_UNKNOWN_HOST;
|
|
||||||
+ }
|
|
||||||
+ RefPtr<AddrInfo> ai(
|
|
||||||
+ new AddrInfo(aCanonHost, canonName, 0, std::move(addresses)));
|
|
||||||
+ ai.forget(aAddrInfo);
|
|
||||||
+
|
|
||||||
+ return NS_OK;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////
|
|
||||||
@@ -153,6 +220,24 @@
|
|
||||||
aAddressFamily = PR_AF_UNSPEC;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if defined(DNSQUERY_AVAILABLE)
|
|
||||||
+ if (StaticPrefs::network_dns_dns_query_single_label() &&
|
|
||||||
+ !aCanonHost.Contains('.') && aCanonHost != NS_LITERAL_CSTRING("localhost")) {
|
|
||||||
+ // For some reason we can't use DnsQuery_A to get the computer's IP.
|
|
||||||
+ if (!aCanonHost.Equals(nsDependentCString(sDNSComputerName),
|
|
||||||
+ nsCaseInsensitiveCStringComparator) &&
|
|
||||||
+ !aCanonHost.Equals(nsDependentCString(sNETBIOSComputerName),
|
|
||||||
+ nsCaseInsensitiveCStringComparator)) {
|
|
||||||
+ // This is a single label name resolve without a dot.
|
|
||||||
+ // We use DNSQuery_A for these.
|
|
||||||
+ LOG("Resolving %s using DnsQuery_A (computername: %s)\n",
|
|
||||||
+ aCanonHost.BeginReading(), sDNSComputerName);
|
|
||||||
+ return _DNSQuery_A_SingleLabel(aCanonHost, aAddressFamily, aFlags,
|
|
||||||
+ aAddrInfo);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
PRAddrInfo* prai =
|
|
||||||
PR_GetAddrInfoByName(aCanonHost.BeginReading(), aAddressFamily, prFlags);
|
|
||||||
|
|
||||||
@@ -184,6 +269,19 @@
|
|
||||||
//////////////////////////////////////
|
|
||||||
nsresult GetAddrInfoInit() {
|
|
||||||
LOG("Initializing GetAddrInfo.\n");
|
|
||||||
+
|
|
||||||
+#ifdef DNSQUERY_AVAILABLE
|
|
||||||
+ DWORD namesize = COMPUTER_NAME_BUFFER_SIZE;
|
|
||||||
+ if (!GetComputerNameEx(ComputerNameDnsHostname, sDNSComputerName,
|
|
||||||
+ &namesize)) {
|
|
||||||
+ sDNSComputerName[0] = 0;
|
|
||||||
+ }
|
|
||||||
+ namesize = MAX_COMPUTERNAME_LENGTH + 1;
|
|
||||||
+ if (!GetComputerNameEx(ComputerNameNetBIOS, sNETBIOSComputerName,
|
|
||||||
+ &namesize)) {
|
|
||||||
+ sNETBIOSComputerName[0] = 0;
|
|
||||||
+ }
|
|
||||||
+#endif
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -r 3e57839bffd2 -r 0344d5a76b7d netwerk/dns/moz.build
|
|
||||||
--- a/netwerk/dns/moz.build Fri Oct 30 10:19:14 2020 +0000
|
|
||||||
+++ b/netwerk/dns/moz.build Fri Oct 30 08:16:25 2020 +0000
|
|
||||||
@@ -54,6 +54,7 @@
|
|
||||||
]
|
|
||||||
|
|
||||||
SOURCES += [
|
|
||||||
+ 'GetAddrInfo.cpp', # Undefines UNICODE
|
|
||||||
'nsEffectiveTLDService.cpp', # Excluded from UNIFIED_SOURCES due to special build flags.
|
|
||||||
'nsHostResolver.cpp', # Redefines LOG
|
|
||||||
]
|
|
||||||
@@ -65,7 +66,6 @@
|
|
||||||
'DNSRequestChild.cpp',
|
|
||||||
'DNSRequestParent.cpp',
|
|
||||||
- 'GetAddrInfo.cpp',
|
|
||||||
'HTTPSSVC.cpp',
|
|
||||||
'IDNBlocklistUtils.cpp',
|
|
||||||
'NativeDNSResolverOverrideChild.cpp',
|
|
||||||
'NativeDNSResolverOverrideParent.cpp',
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Kaizer Soze <kaizersoze915@gmail.com>
|
|
||||||
# Date 1602665311 0
|
|
||||||
# Wed Oct 14 08:48:31 2020 +0000
|
|
||||||
# Node ID 5a4b06d86f52685f2a4b51538f9ac3a7d9be265b
|
|
||||||
# Parent 1547b1a7189503e22eaa2180fa9597a044b91ff8
|
|
||||||
Bug 1665820, r=emalysz
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D92589
|
|
||||||
|
|
||||||
diff -r 1547b1a71895 -r 5a4b06d86f52 browser/extensions/screenshots/selector/ui.js
|
|
||||||
--- a/browser/extensions/screenshots/selector/ui.js Wed Oct 14 09:17:27 2020 +0000
|
|
||||||
+++ b/browser/extensions/screenshots/selector/ui.js Wed Oct 14 08:48:31 2020 +0000
|
|
||||||
@@ -361,6 +361,7 @@
|
|
||||||
this.element.setAttribute("role", "dialog");
|
|
||||||
this.element.onload = watchFunction(() => {
|
|
||||||
msgsPromise.then(([cancelTitle, copyTitle, downloadTitle]) => {
|
|
||||||
+ assertIsBlankDocument(this.element.contentDocument);
|
|
||||||
this.document = this.element.contentDocument;
|
|
||||||
// eslint-disable-next-line no-unsanitized/property
|
|
||||||
this.document.documentElement.innerHTML = `
|
|
||||||
82
D110204-fscreen.patch
Normal file
82
D110204-fscreen.patch
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
diff -up firefox-102.2.0/widget/gtk/nsWindow.cpp.D110204-fscreen.diff firefox-102.2.0/widget/gtk/nsWindow.cpp
|
||||||
|
--- firefox-102.2.0/widget/gtk/nsWindow.cpp.D110204-fscreen.diff 2022-08-18 21:54:09.000000000 +0200
|
||||||
|
+++ firefox-102.2.0/widget/gtk/nsWindow.cpp 2022-09-02 15:55:18.023843940 +0200
|
||||||
|
@@ -96,6 +96,7 @@
|
||||||
|
#include "ScreenHelperGTK.h"
|
||||||
|
#include "SystemTimeConverter.h"
|
||||||
|
#include "WidgetUtilsGtk.h"
|
||||||
|
+#include "nsIBrowserHandler.h"
|
||||||
|
|
||||||
|
#ifdef ACCESSIBILITY
|
||||||
|
# include "mozilla/a11y/LocalAccessible.h"
|
||||||
|
@@ -169,7 +170,8 @@ const gint kEvents = GDK_TOUCHPAD_GESTUR
|
||||||
|
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
|
||||||
|
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||||
|
GDK_SMOOTH_SCROLL_MASK | GDK_TOUCH_MASK | GDK_SCROLL_MASK |
|
||||||
|
- GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK;
|
||||||
|
+ GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK |
|
||||||
|
+ GDK_FOCUS_CHANGE_MASK;
|
||||||
|
|
||||||
|
/* utility functions */
|
||||||
|
static bool is_mouse_in_window(GdkWindow* aWindow, gdouble aMouseX,
|
||||||
|
@@ -408,7 +410,8 @@ nsWindow::nsWindow()
|
||||||
|
mMovedAfterMoveToRect(false),
|
||||||
|
mResizedAfterMoveToRect(false),
|
||||||
|
mConfiguredClearColor(false),
|
||||||
|
- mGotNonBlankPaint(false) {
|
||||||
|
+ mGotNonBlankPaint(false),
|
||||||
|
+ mPendingFullscreen(false) {
|
||||||
|
mWindowType = eWindowType_child;
|
||||||
|
mSizeConstraints.mMaxSize = GetSafeWindowSize(mSizeConstraints.mMaxSize);
|
||||||
|
|
||||||
|
@@ -4814,6 +4817,19 @@ void nsWindow::OnWindowStateEvent(GtkWid
|
||||||
|
ClearTransparencyBitmap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Hack to ensure window switched to fullscreen - avoid to fail when starting
|
||||||
|
+ // in kiosk mode
|
||||||
|
+ if (mPendingFullscreen &&
|
||||||
|
+ !(aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) {
|
||||||
|
+ LOG(
|
||||||
|
+ " Window should be fullscreen, but it's not, retrying set to "
|
||||||
|
+ "fullscreen.\n");
|
||||||
|
+ MakeFullScreen(true);
|
||||||
|
+ } else {
|
||||||
|
+ LOG(" Window successfully switched to fullscreen, happy now\n");
|
||||||
|
+ mPendingFullscreen = false;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void nsWindow::OnDPIChanged() {
|
||||||
|
@@ -7042,6 +7058,19 @@ nsresult nsWindow::MakeFullScreen(bool a
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // if in kiosk, ensure the fullscreen is called
|
||||||
|
+ nsCOMPtr<nsIBrowserHandler> browserHandler =
|
||||||
|
+ do_GetService("@mozilla.org/browser/clh;1");
|
||||||
|
+ if (browserHandler) {
|
||||||
|
+ bool isKiosk;
|
||||||
|
+ browserHandler->GetKiosk(&isKiosk);
|
||||||
|
+ if (isKiosk) {
|
||||||
|
+ LOG(" is kiosk, ensure the window switch to fullscreen\n");
|
||||||
|
+ mPendingFullscreen = true;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ LOG(" Cannot find the browserHandler service.\n");
|
||||||
|
+ }
|
||||||
|
gtk_window_fullscreen(GTK_WINDOW(mShell));
|
||||||
|
} else {
|
||||||
|
mSizeMode = mLastSizeMode;
|
||||||
|
diff -up firefox-102.2.0/widget/gtk/nsWindow.h.D110204-fscreen.diff firefox-102.2.0/widget/gtk/nsWindow.h
|
||||||
|
--- firefox-102.2.0/widget/gtk/nsWindow.h.D110204-fscreen.diff 2022-08-18 21:53:52.000000000 +0200
|
||||||
|
+++ firefox-102.2.0/widget/gtk/nsWindow.h 2022-09-02 08:17:07.606010905 +0200
|
||||||
|
@@ -712,6 +712,7 @@ class nsWindow final : public nsBaseWidg
|
||||||
|
* move-to-rect callback we set mMovedAfterMoveToRect/mResizedAfterMoveToRect.
|
||||||
|
*/
|
||||||
|
bool mWaitingForMoveToRectCallback : 1;
|
||||||
|
+ bool mPendingFullscreen : 1;
|
||||||
|
bool mMovedAfterMoveToRect : 1;
|
||||||
|
bool mResizedAfterMoveToRect : 1;
|
||||||
|
|
||||||
25
D158770.patch
Normal file
25
D158770.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
diff --git a/parser/expat/lib/xmlparse.c b/parser/expat/lib/xmlparse.c
|
||||||
|
--- a/parser/expat/lib/xmlparse.c
|
||||||
|
+++ b/parser/expat/lib/xmlparse.c
|
||||||
|
@@ -5652,12 +5652,18 @@
|
||||||
|
else
|
||||||
|
#endif /* XML_DTD */
|
||||||
|
{
|
||||||
|
processor = contentProcessor;
|
||||||
|
/* see externalEntityContentProcessor vs contentProcessor */
|
||||||
|
- return doContent(parser, parentParser ? 1 : 0, encoding, s, end,
|
||||||
|
- nextPtr, (XML_Bool)!ps_finalBuffer);
|
||||||
|
+ result = doContent(parser, parser->m_parentParser ? 1 : 0,
|
||||||
|
+ parser->m_encoding, s, end, nextPtr,
|
||||||
|
+ (XML_Bool)! parser->m_parsingStatus.finalBuffer);
|
||||||
|
+ if (result == XML_ERROR_NONE) {
|
||||||
|
+ if (! storeRawNames(parser))
|
||||||
|
+ return XML_ERROR_NO_MEMORY;
|
||||||
|
+ }
|
||||||
|
+ return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static enum XML_Error PTRCALL
|
||||||
|
errorProcessor(XML_Parser parser,
|
||||||
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
|
|
||||||
# HG changeset patch
|
|
||||||
# User Alexandre Lissy <lissyx+mozillians@lissyx.dyndns.org>
|
|
||||||
# Date 1623246328 0
|
|
||||||
# Node ID ecb4011a0c76a1c7040054a44712e277f3dc24a1
|
|
||||||
# Parent 9ec189804055442e5cc98d69dd01b71e90ed0cb5
|
|
||||||
Bug 1715254 - Deny clone3 to force glibc fallback r=gcp
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D117297
|
|
||||||
|
|
||||||
diff --git a/security/sandbox/linux/SandboxFilter.cpp b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
--- a/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
+++ b/security/sandbox/linux/SandboxFilter.cpp
|
|
||||||
@@ -853,16 +853,19 @@ class SandboxPolicyCommon : public Sandb
|
|
||||||
// Yield
|
|
||||||
case __NR_sched_yield:
|
|
||||||
return Allow();
|
|
||||||
|
|
||||||
// Thread creation.
|
|
||||||
case __NR_clone:
|
|
||||||
return ClonePolicy(InvalidSyscall());
|
|
||||||
|
|
||||||
+ case __NR_clone3:
|
|
||||||
+ return Error(ENOSYS);
|
|
||||||
+
|
|
||||||
// More thread creation.
|
|
||||||
#ifdef __NR_set_robust_list
|
|
||||||
case __NR_set_robust_list:
|
|
||||||
return Allow();
|
|
||||||
#endif
|
|
||||||
#ifdef ANDROID
|
|
||||||
case __NR_set_tid_address:
|
|
||||||
return Allow();
|
|
||||||
@@ -1499,16 +1502,19 @@ class ContentSandboxPolicy : public Sand
|
|
||||||
// the child would inherit the seccomp-bpf policy and almost
|
|
||||||
// certainly die from an unexpected SIGSYS. We also can't have
|
|
||||||
// fork() crash, currently, because there are too many system
|
|
||||||
// libraries/plugins that try to run commands. But they can
|
|
||||||
// usually do something reasonable on error.
|
|
||||||
case __NR_clone:
|
|
||||||
return ClonePolicy(Error(EPERM));
|
|
||||||
|
|
||||||
+ case __NR_clone3:
|
|
||||||
+ return Error(ENOSYS);
|
|
||||||
+
|
|
||||||
# ifdef __NR_fadvise64
|
|
||||||
case __NR_fadvise64:
|
|
||||||
return Allow();
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef __NR_fadvise64_64
|
|
||||||
case __NR_fadvise64_64:
|
|
||||||
return Allow();
|
|
||||||
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
From 99c71d0db95b3626552a1375d5dfba22dc82ebfd Mon Sep 17 00:00:00 2001
|
|
||||||
From: lingsheng <lingsheng@huawei.com>
|
|
||||||
Date: Fri, 30 Apr 2021 17:11:51 +0800
|
|
||||||
Subject: [PATCH] Fix build with rust nightly
|
|
||||||
|
|
||||||
---
|
|
||||||
.cargo/config.in | 2 +-
|
|
||||||
Cargo.lock | 2 +-
|
|
||||||
Cargo.toml | 4 ++--
|
|
||||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/.cargo/config.in b/.cargo/config.in
|
|
||||||
index a40e667b5a..c95e6e016b 100644
|
|
||||||
--- a/.cargo/config.in
|
|
||||||
+++ b/.cargo/config.in
|
|
||||||
@@ -3,9 +3,9 @@
|
|
||||||
# Please do not edit.
|
|
||||||
|
|
||||||
[source."https://github.com/shravanrn/nix/"]
|
|
||||||
-branch = "r0.13.1"
|
|
||||||
git = "https://github.com/shravanrn/nix/"
|
|
||||||
replace-with = "vendored-sources"
|
|
||||||
+rev = "4af6c367603869a30fddb5ffb0aba2b9477ba92e"
|
|
||||||
|
|
||||||
[source."https://github.com/mozilla/rkv"]
|
|
||||||
git = "https://github.com/mozilla/rkv"
|
|
||||||
diff --git a/Cargo.lock b/Cargo.lock
|
|
||||||
index 0b61796d7d..e97e8d080b 100644
|
|
||||||
--- a/Cargo.lock
|
|
||||||
+++ b/Cargo.lock
|
|
||||||
@@ -3196,7 +3196,7 @@ dependencies = [
|
|
||||||
[[package]]
|
|
||||||
name = "nix"
|
|
||||||
version = "0.13.1"
|
|
||||||
-source = "git+https://github.com/shravanrn/nix/?branch=r0.13.1#4af6c367603869a30fddb5ffb0aba2b9477ba92e"
|
|
||||||
+source = "git+https://github.com/shravanrn/nix/?rev=4af6c367603869a30fddb5ffb0aba2b9477ba92e#4af6c367603869a30fddb5ffb0aba2b9477ba92e"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags",
|
|
||||||
"cc",
|
|
||||||
diff --git a/Cargo.toml b/Cargo.toml
|
|
||||||
index 0b7ec008b8..910a62ee57 100644
|
|
||||||
--- a/Cargo.toml
|
|
||||||
+++ b/Cargo.toml
|
|
||||||
@@ -67,8 +67,8 @@ panic = "abort"
|
|
||||||
libudev-sys = { path = "dom/webauthn/libudev-sys" }
|
|
||||||
packed_simd = { git = "https://github.com/hsivonen/packed_simd", rev="3541e3818fdc7c2a24f87e3459151a4ce955a67a" }
|
|
||||||
rlbox_lucet_sandbox = { git = "https://github.com/PLSysSec/rlbox_lucet_sandbox/", rev="d510da5999a744c563b0acd18056069d1698273f" }
|
|
||||||
-nix = { git = "https://github.com/shravanrn/nix/", branch = "r0.13.1", rev="4af6c367603869a30fddb5ffb0aba2b9477ba92e" }
|
|
||||||
-spirv_cross = { git = "https://github.com/kvark/spirv_cross", branch = "wgpu3", rev = "20191ad2f370afd6d247edcb9ff9da32d3bedb9c" }
|
|
||||||
+nix = { git = "https://github.com/shravanrn/nix/", rev="4af6c367603869a30fddb5ffb0aba2b9477ba92e" }
|
|
||||||
+spirv_cross = { git = "https://github.com/kvark/spirv_cross", branch = "wgpu3" }
|
|
||||||
# failure's backtrace feature might break our builds, see bug 1608157.
|
|
||||||
failure = { git = "https://github.com/badboy/failure", rev = "64af847bc5fdcb6d2438bec8a6030812a80519a5" }
|
|
||||||
failure_derive = { git = "https://github.com/badboy/failure", rev = "64af847bc5fdcb6d2438bec8a6030812a80519a5" }
|
|
||||||
--
|
|
||||||
2.23.0
|
|
||||||
|
|
||||||
@ -1,211 +0,0 @@
|
|||||||
|
|
||||||
# HG changeset patch
|
|
||||||
# User Emilio Cobos Álvarez <emilio@crisal.io>
|
|
||||||
# Date 1594925481 0
|
|
||||||
# Node ID da77d5528a0819c4e61a92f642542b55da81183e
|
|
||||||
# Parent 5e9a7815de712ddc8ab5bb784b644a03e5f2e6b4
|
|
||||||
Bug 1653339 - Teach style_derive's map_type_params about mapping self correctly. r=boris
|
|
||||||
|
|
||||||
Consider the following:
|
|
||||||
|
|
||||||
struct Complex<T> {
|
|
||||||
something: T,
|
|
||||||
#[compute(field_bound)]
|
|
||||||
something_else: Generic<Self, T>,
|
|
||||||
}
|
|
||||||
|
|
||||||
That will generate:
|
|
||||||
|
|
||||||
impl<T> ToComputedValue for Complex<T>
|
|
||||||
where
|
|
||||||
T: ToComputedValue,
|
|
||||||
Generic<Self, T>: ToComputedValue<ComputedValue = Generic<Self, <T as ToComputedValue>::ComputedValue>>,
|
|
||||||
{
|
|
||||||
// ...
|
|
||||||
}
|
|
||||||
|
|
||||||
That last clause is obviously incorrect. map_type_params correctly maps
|
|
||||||
the T, but it should know also about Self.
|
|
||||||
|
|
||||||
Ideally we could just do the same as for T and do:
|
|
||||||
|
|
||||||
<Self as ToComputedValue>::ComputedValue
|
|
||||||
|
|
||||||
But that doesn't quite work, because we are in that implementation of
|
|
||||||
the trait, and the compiler rightfully complains about we don't yet
|
|
||||||
knowing the computed type. So we need to pass it explicitly, which is
|
|
||||||
simple enough, if a bit annoying.
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D83816
|
|
||||||
|
|
||||||
diff --git a/servo/components/derive_common/cg.rs b/servo/components/derive_common/cg.rs
|
|
||||||
--- a/servo/components/derive_common/cg.rs
|
|
||||||
+++ b/servo/components/derive_common/cg.rs
|
|
||||||
@@ -149,79 +149,85 @@ pub fn fmap_trait_output(input: &DeriveI
|
|
||||||
colon2_token: Default::default(),
|
|
||||||
gt_token: Default::default(),
|
|
||||||
lt_token: Default::default(),
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
segment.into()
|
|
||||||
}
|
|
||||||
|
|
||||||
-pub fn map_type_params<F>(ty: &Type, params: &[&TypeParam], f: &mut F) -> Type
|
|
||||||
+pub fn map_type_params<F>(ty: &Type, params: &[&TypeParam], self_type: &Path, f: &mut F) -> Type
|
|
||||||
where
|
|
||||||
F: FnMut(&Ident) -> Type,
|
|
||||||
{
|
|
||||||
match *ty {
|
|
||||||
Type::Slice(ref inner) => Type::from(TypeSlice {
|
|
||||||
- elem: Box::new(map_type_params(&inner.elem, params, f)),
|
|
||||||
+ elem: Box::new(map_type_params(&inner.elem, params, self_type, f)),
|
|
||||||
..inner.clone()
|
|
||||||
}),
|
|
||||||
Type::Array(ref inner) => {
|
|
||||||
//ref ty, ref expr) => {
|
|
||||||
Type::from(TypeArray {
|
|
||||||
- elem: Box::new(map_type_params(&inner.elem, params, f)),
|
|
||||||
+ elem: Box::new(map_type_params(&inner.elem, params, self_type, f)),
|
|
||||||
..inner.clone()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
ref ty @ Type::Never(_) => ty.clone(),
|
|
||||||
Type::Tuple(ref inner) => Type::from(TypeTuple {
|
|
||||||
elems: inner
|
|
||||||
.elems
|
|
||||||
.iter()
|
|
||||||
- .map(|ty| map_type_params(&ty, params, f))
|
|
||||||
+ .map(|ty| map_type_params(&ty, params, self_type, f))
|
|
||||||
.collect(),
|
|
||||||
..inner.clone()
|
|
||||||
}),
|
|
||||||
Type::Path(TypePath {
|
|
||||||
qself: None,
|
|
||||||
ref path,
|
|
||||||
}) => {
|
|
||||||
if let Some(ident) = path_to_ident(path) {
|
|
||||||
if params.iter().any(|ref param| ¶m.ident == ident) {
|
|
||||||
return f(ident);
|
|
||||||
}
|
|
||||||
+ if ident == "Self" {
|
|
||||||
+ return Type::from(TypePath {
|
|
||||||
+ qself: None,
|
|
||||||
+ path: self_type.clone(),
|
|
||||||
+ });
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
Type::from(TypePath {
|
|
||||||
qself: None,
|
|
||||||
- path: map_type_params_in_path(path, params, f),
|
|
||||||
+ path: map_type_params_in_path(path, params, self_type, f),
|
|
||||||
})
|
|
||||||
},
|
|
||||||
Type::Path(TypePath {
|
|
||||||
ref qself,
|
|
||||||
ref path,
|
|
||||||
}) => Type::from(TypePath {
|
|
||||||
qself: qself.as_ref().map(|qself| QSelf {
|
|
||||||
- ty: Box::new(map_type_params(&qself.ty, params, f)),
|
|
||||||
+ ty: Box::new(map_type_params(&qself.ty, params, self_type, f)),
|
|
||||||
position: qself.position,
|
|
||||||
..qself.clone()
|
|
||||||
}),
|
|
||||||
- path: map_type_params_in_path(path, params, f),
|
|
||||||
+ path: map_type_params_in_path(path, params, self_type, f),
|
|
||||||
}),
|
|
||||||
Type::Paren(ref inner) => Type::from(TypeParen {
|
|
||||||
- elem: Box::new(map_type_params(&inner.elem, params, f)),
|
|
||||||
+ elem: Box::new(map_type_params(&inner.elem, params, self_type, f)),
|
|
||||||
..inner.clone()
|
|
||||||
}),
|
|
||||||
Type::Group(ref inner) => Type::from(TypeGroup {
|
|
||||||
- elem: Box::new(map_type_params(&inner.elem, params, f)),
|
|
||||||
+ elem: Box::new(map_type_params(&inner.elem, params, self_type, f)),
|
|
||||||
..inner.clone()
|
|
||||||
}),
|
|
||||||
ref ty => panic!("type {:?} cannot be mapped yet", ty),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-fn map_type_params_in_path<F>(path: &Path, params: &[&TypeParam], f: &mut F) -> Path
|
|
||||||
+fn map_type_params_in_path<F>(path: &Path, params: &[&TypeParam], self_type: &Path, f: &mut F) -> Path
|
|
||||||
where
|
|
||||||
F: FnMut(&Ident) -> Type,
|
|
||||||
{
|
|
||||||
Path {
|
|
||||||
leading_colon: path.leading_colon,
|
|
||||||
segments: path
|
|
||||||
.segments
|
|
||||||
.iter()
|
|
||||||
@@ -231,21 +237,21 @@ where
|
|
||||||
PathArguments::AngleBracketed(ref data) => {
|
|
||||||
PathArguments::AngleBracketed(AngleBracketedGenericArguments {
|
|
||||||
args: data
|
|
||||||
.args
|
|
||||||
.iter()
|
|
||||||
.map(|arg| match arg {
|
|
||||||
ty @ &GenericArgument::Lifetime(_) => ty.clone(),
|
|
||||||
&GenericArgument::Type(ref data) => {
|
|
||||||
- GenericArgument::Type(map_type_params(data, params, f))
|
|
||||||
+ GenericArgument::Type(map_type_params(data, params, self_type, f))
|
|
||||||
},
|
|
||||||
&GenericArgument::Binding(ref data) => {
|
|
||||||
GenericArgument::Binding(Binding {
|
|
||||||
- ty: map_type_params(&data.ty, params, f),
|
|
||||||
+ ty: map_type_params(&data.ty, params, self_type, f),
|
|
||||||
..data.clone()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
ref arg => panic!("arguments {:?} cannot be mapped yet", arg),
|
|
||||||
})
|
|
||||||
.collect(),
|
|
||||||
..data.clone()
|
|
||||||
})
|
|
||||||
diff --git a/servo/components/style_derive/to_computed_value.rs b/servo/components/style_derive/to_computed_value.rs
|
|
||||||
--- a/servo/components/style_derive/to_computed_value.rs
|
|
||||||
+++ b/servo/components/style_derive/to_computed_value.rs
|
|
||||||
@@ -42,22 +42,25 @@ pub fn derive_to_value(
|
|
||||||
BindStyle::Ref | BindStyle::RefMut => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
let params = input.generics.type_params().collect::<Vec<_>>();
|
|
||||||
for param in ¶ms {
|
|
||||||
cg::add_predicate(&mut where_clause, parse_quote!(#param: #trait_path));
|
|
||||||
}
|
|
||||||
|
|
||||||
+ let computed_value_type = cg::fmap_trait_output(&input, &trait_path, &output_type_name);
|
|
||||||
+
|
|
||||||
let mut add_field_bound = |binding: &BindingInfo| {
|
|
||||||
let ty = &binding.ast().ty;
|
|
||||||
|
|
||||||
let output_type = cg::map_type_params(
|
|
||||||
ty,
|
|
||||||
¶ms,
|
|
||||||
+ &computed_value_type,
|
|
||||||
&mut |ident| parse_quote!(<#ident as #trait_path>::#output_type_name),
|
|
||||||
);
|
|
||||||
|
|
||||||
cg::add_predicate(
|
|
||||||
&mut where_clause,
|
|
||||||
parse_quote!(
|
|
||||||
#ty: #trait_path<#output_type_name = #output_type>
|
|
||||||
),
|
|
||||||
@@ -137,17 +140,16 @@ pub fn derive_to_value(
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
(to_body, from_body)
|
|
||||||
};
|
|
||||||
|
|
||||||
input.generics.where_clause = where_clause;
|
|
||||||
let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
|
|
||||||
- let computed_value_type = cg::fmap_trait_output(&input, &trait_path, &output_type_name);
|
|
||||||
|
|
||||||
let impl_ = trait_impl(from_body, to_body);
|
|
||||||
|
|
||||||
quote! {
|
|
||||||
impl #impl_generics #trait_path for #name #ty_generics #where_clause {
|
|
||||||
type #output_type_name = #computed_value_type;
|
|
||||||
|
|
||||||
#impl_
|
|
||||||
|
|
||||||
File diff suppressed because one or more lines are too long
@ -1,74 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User Lars T Hansen <lhansen@mozilla.com>
|
|
||||||
# Date 1519822672 -3600
|
|
||||||
# Wed Feb 28 13:57:52 2018 +0100
|
|
||||||
# Node ID 672f0415217b202ae59a930769dffd9d6ba6b87c
|
|
||||||
# Parent 825fd04dacc6297d3a980ec4184079405950b35d
|
|
||||||
Bug 1375074 - Save and restore non-volatile x28 on ARM64 for generated unboxed object constructor.
|
|
||||||
|
|
||||||
diff --git a/js/src/jit-test/tests/bug1375074.js b/js/src/jit-test/tests/bug1375074.js
|
|
||||||
new file mode 100644
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/js/src/jit-test/tests/bug1375074.js
|
|
||||||
@@ -0,0 +1,18 @@
|
|
||||||
+// This forces the VM to start creating unboxed objects and thus stresses a
|
|
||||||
+// particular path into generated code for a specialized unboxed object
|
|
||||||
+// constructor.
|
|
||||||
+
|
|
||||||
+var K = 2000; // 2000 should be plenty
|
|
||||||
+var s = "[";
|
|
||||||
+var i;
|
|
||||||
+for ( i=0; i < K-1; i++ )
|
|
||||||
+ s = s + `{"i":${i}},`;
|
|
||||||
+s += `{"i":${i}}]`;
|
|
||||||
+var v = JSON.parse(s);
|
|
||||||
+
|
|
||||||
+assertEq(v.length == K, true);
|
|
||||||
+
|
|
||||||
+for ( i=0; i < K; i++) {
|
|
||||||
+ assertEq(v[i] instanceof Object, true);
|
|
||||||
+ assertEq(v[i].i, i);
|
|
||||||
+}
|
|
||||||
diff --git a/js/src/vm/UnboxedObject.cpp b/js/src/vm/UnboxedObject.cpp
|
|
||||||
--- a/js/src/vm/UnboxedObject.cpp
|
|
||||||
+++ b/js/src/vm/UnboxedObject.cpp
|
|
||||||
@@ -95,7 +95,15 @@ UnboxedLayout::makeConstructorCode(JSCon
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef JS_CODEGEN_ARM64
|
|
||||||
- // ARM64 communicates stack address via sp, but uses a pseudo-sp for addressing.
|
|
||||||
+ // ARM64 communicates stack address via sp, but uses a pseudo-sp (PSP) for
|
|
||||||
+ // addressing. The register we use for PSP may however also be used by
|
|
||||||
+ // calling code, and it is nonvolatile, so save it. Do this as a special
|
|
||||||
+ // case first because the generic save/restore code needs the PSP to be
|
|
||||||
+ // initialized already.
|
|
||||||
+ MOZ_ASSERT(PseudoStackPointer64.Is(masm.GetStackPointer64()));
|
|
||||||
+ masm.Str(PseudoStackPointer64, vixl::MemOperand(sp, -16, vixl::PreIndex));
|
|
||||||
+
|
|
||||||
+ // Initialize the PSP from the SP.
|
|
||||||
masm.initStackPtr();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -233,7 +241,22 @@ UnboxedLayout::makeConstructorCode(JSCon
|
|
||||||
masm.pop(ScratchDoubleReg);
|
|
||||||
masm.PopRegsInMask(savedNonVolatileRegisters);
|
|
||||||
|
|
||||||
+#ifdef JS_CODEGEN_ARM64
|
|
||||||
+ // Now restore the value that was in the PSP register on entry, and return.
|
|
||||||
+
|
|
||||||
+ // Obtain the correct SP from the PSP.
|
|
||||||
+ masm.Mov(sp, PseudoStackPointer64);
|
|
||||||
+
|
|
||||||
+ // Restore the saved value of the PSP register, this value is whatever the
|
|
||||||
+ // caller had saved in it, not any actual SP value, and it must not be
|
|
||||||
+ // overwritten subsequently.
|
|
||||||
+ masm.Ldr(PseudoStackPointer64, vixl::MemOperand(sp, 16, vixl::PostIndex));
|
|
||||||
+
|
|
||||||
+ // Perform a plain Ret(), as abiret() will move SP <- PSP and that is wrong.
|
|
||||||
+ masm.Ret(vixl::lr);
|
|
||||||
+#else
|
|
||||||
masm.abiret();
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
masm.bind(&failureStoreOther);
|
|
||||||
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
diff -up firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp.old firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp
|
|
||||||
--- firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp.old 2020-01-17 23:34:41.000000000 +0200
|
|
||||||
+++ firefox-72.0.2/js/src/wasm/WasmSignalHandlers.cpp 2020-02-02 08:07:54.670341986 +0200
|
|
||||||
@@ -249,7 +249,16 @@ using mozilla::DebugOnly;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS
|
|
||||||
-# include <sys/user.h>
|
|
||||||
+struct user_vfp {
|
|
||||||
+ unsigned long long fpregs[32];
|
|
||||||
+ unsigned long fpscr;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+struct user_vfp_exc {
|
|
||||||
+ unsigned long fpexc;
|
|
||||||
+ unsigned long fpinst;
|
|
||||||
+ unsigned long fpinst2;
|
|
||||||
+};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ANDROID)
|
|
||||||
57
build-big-endian-errors.patch
Normal file
57
build-big-endian-errors.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
diff -up firefox-102.0/third_party/libwebrtc/common_audio/wav_file.cc.big-endian-errors firefox-102.0/third_party/libwebrtc/common_audio/wav_file.cc
|
||||||
|
--- firefox-102.0/third_party/libwebrtc/common_audio/wav_file.cc.big-endian-errors 2022-08-17 13:19:53.056891028 +0200
|
||||||
|
+++ firefox-102.0/third_party/libwebrtc/common_audio/wav_file.cc 2022-08-17 13:19:57.251879556 +0200
|
||||||
|
@@ -89,9 +89,6 @@ void WavReader::Reset() {
|
||||||
|
|
||||||
|
size_t WavReader::ReadSamples(const size_t num_samples,
|
||||||
|
int16_t* const samples) {
|
||||||
|
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
|
||||||
|
-#error "Need to convert samples to big-endian when reading from WAV file"
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
size_t num_samples_left_to_read = num_samples;
|
||||||
|
size_t next_chunk_start = 0;
|
||||||
|
@@ -129,9 +126,6 @@ size_t WavReader::ReadSamples(const size
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t WavReader::ReadSamples(const size_t num_samples, float* const samples) {
|
||||||
|
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
|
||||||
|
-#error "Need to convert samples to big-endian when reading from WAV file"
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
size_t num_samples_left_to_read = num_samples;
|
||||||
|
size_t next_chunk_start = 0;
|
||||||
|
@@ -213,9 +207,6 @@ WavWriter::WavWriter(FileWrapper file,
|
||||||
|
}
|
||||||
|
|
||||||
|
void WavWriter::WriteSamples(const int16_t* samples, size_t num_samples) {
|
||||||
|
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
|
||||||
|
-#error "Need to convert samples to little-endian when writing to WAV file"
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
for (size_t i = 0; i < num_samples; i += kMaxChunksize) {
|
||||||
|
const size_t num_remaining_samples = num_samples - i;
|
||||||
|
@@ -243,9 +234,6 @@ void WavWriter::WriteSamples(const int16
|
||||||
|
}
|
||||||
|
|
||||||
|
void WavWriter::WriteSamples(const float* samples, size_t num_samples) {
|
||||||
|
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
|
||||||
|
-#error "Need to convert samples to little-endian when writing to WAV file"
|
||||||
|
-#endif
|
||||||
|
|
||||||
|
for (size_t i = 0; i < num_samples; i += kMaxChunksize) {
|
||||||
|
const size_t num_remaining_samples = num_samples - i;
|
||||||
|
diff -up firefox-102.0/third_party/libwebrtc/common_audio/wav_header.cc.big-endian-errors firefox-102.0/third_party/libwebrtc/common_audio/wav_header.cc
|
||||||
|
--- firefox-102.0/third_party/libwebrtc/common_audio/wav_header.cc.big-endian-errors 2022-08-17 13:18:04.688187393 +0200
|
||||||
|
+++ firefox-102.0/third_party/libwebrtc/common_audio/wav_header.cc 2022-08-17 13:18:22.451138816 +0200
|
||||||
|
@@ -26,10 +26,6 @@
|
||||||
|
namespace webrtc {
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
-#ifndef WEBRTC_ARCH_LITTLE_ENDIAN
|
||||||
|
-#error "Code not working properly for big endian platforms."
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
#pragma pack(2)
|
||||||
|
struct ChunkHeader {
|
||||||
|
uint32_t ID;
|
||||||
@ -1,13 +0,0 @@
|
|||||||
diff -up firefox-55.0.3/js/src/jit/ExecutableAllocator.h.wasm firefox-55.0.3/js/src/jit/ExecutableAllocator.h
|
|
||||||
--- firefox-55.0.3/js/src/jit/ExecutableAllocator.h.wasm 2017-09-05 11:32:12.235909468 +0200
|
|
||||||
+++ firefox-55.0.3/js/src/jit/ExecutableAllocator.h 2017-09-05 11:32:46.157916575 +0200
|
|
||||||
@@ -219,7 +219,7 @@ class ExecutableAllocator
|
|
||||||
|
|
||||||
static void poisonCode(JSRuntime* rt, JitPoisonRangeVector& ranges);
|
|
||||||
|
|
||||||
-#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) || defined(JS_SIMULATOR_ARM64)
|
|
||||||
+#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) || defined(JS_SIMULATOR_ARM64) || defined(JS_CODEGEN_NONE)
|
|
||||||
static void cacheFlush(void*, size_t)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
diff -up firefox-55.0.3/js/src/jit-test/tests/wasm/bench/wasm_box2d.wasm firefox-55.0.3/js/src/jit-test/tests/wasm/bench/wasm_box2d
|
|
||||||
@ -1,12 +1,12 @@
|
|||||||
diff -up firefox-65.0/toolkit/moz.configure.disable-elfhack firefox-65.0/toolkit/moz.configure
|
diff -up firefox-97.0/toolkit/moz.configure.disable-elfhack firefox-97.0/toolkit/moz.configure
|
||||||
--- firefox-65.0/toolkit/moz.configure.disable-elfhack 2019-01-28 14:16:48.530345132 +0100
|
--- firefox-97.0/toolkit/moz.configure.disable-elfhack 2022-02-08 09:58:47.518047952 +0100
|
||||||
+++ firefox-65.0/toolkit/moz.configure 2019-01-28 14:18:03.231029682 +0100
|
+++ firefox-97.0/toolkit/moz.configure 2022-02-08 10:17:49.552945956 +0100
|
||||||
@@ -1036,7 +1036,7 @@ with only_when('--enable-compile-environ
|
@@ -1273,7 +1273,7 @@ with only_when("--enable-compile-environ
|
||||||
help='{Enable|Disable} elf hacks')
|
help="{Enable|Disable} elf hacks",
|
||||||
|
)
|
||||||
|
|
||||||
set_config('USE_ELF_HACK',
|
- set_config("USE_ELF_HACK", depends_if("--enable-elf-hack")(lambda _: True))
|
||||||
- depends_if('--enable-elf-hack')(lambda _: True))
|
+ set_config("USE_ELF_HACK", depends_if("--enable-elf-hack")(lambda _: False))
|
||||||
+ depends_if('--enable-elf-hack')(lambda _: False))
|
|
||||||
|
|
||||||
|
|
||||||
@depends(check_build_environment)
|
@depends(build_environment)
|
||||||
|
|||||||
@ -1,12 +0,0 @@
|
|||||||
diff -up firefox-61.0/build/autoconf/icu.m4.icu firefox-61.0/build/autoconf/icu.m4
|
|
||||||
--- firefox-61.0/build/autoconf/icu.m4.icu 2018-06-20 09:03:17.957565445 +0200
|
|
||||||
+++ firefox-61.0/build/autoconf/icu.m4 2018-06-20 09:08:28.159403451 +0200
|
|
||||||
@@ -77,7 +77,7 @@ if test -n "$USE_ICU"; then
|
|
||||||
# TODO: the l is actually endian-dependent
|
|
||||||
# We could make this set as 'l' or 'b' for little or big, respectively,
|
|
||||||
# but we'd need to check in a big-endian version of the file.
|
|
||||||
- ICU_DATA_FILE="icudt${version}l.dat"
|
|
||||||
+ ICU_DATA_FILE="icudt${version}b.dat"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(MOZ_ICU_VERSION)
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
diff -up firefox-60.5.0/js/src/jit/AtomicOperations.h.jit-atomic-lucky firefox-60.5.0/js/src/jit/AtomicOperations.h
|
|
||||||
--- firefox-60.5.0/js/src/jit/AtomicOperations.h.jit-atomic-lucky 2019-01-22 10:20:27.993697161 +0100
|
|
||||||
+++ firefox-60.5.0/js/src/jit/AtomicOperations.h 2019-01-22 10:23:15.337873762 +0100
|
|
||||||
@@ -394,7 +394,7 @@ inline bool AtomicOperations::isLockfree
|
|
||||||
#elif defined(__s390__) || defined(__s390x__)
|
|
||||||
#include "jit/none/AtomicOperations-feeling-lucky.h"
|
|
||||||
#else
|
|
||||||
-#error "No AtomicOperations support provided for this platform"
|
|
||||||
+#include "jit/none/AtomicOperations-feeling-lucky.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // jit_AtomicOperations_h
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
diff -up firefox-55.0/js/src/jit/MIR.h.old firefox-55.0/js/src/jit/MIR.h
|
|
||||||
--- firefox-55.0/js/src/jit/MIR.h.old 2017-08-08 14:04:44.528460099 +0200
|
|
||||||
+++ firefox-55.0/js/src/jit/MIR.h 2017-08-08 14:05:11.045364831 +0200
|
|
||||||
@@ -12434,7 +12434,7 @@ class MNearbyInt
|
|
||||||
TRIVIAL_NEW_WRAPPERS
|
|
||||||
|
|
||||||
static bool HasAssemblerSupport(RoundingMode mode) {
|
|
||||||
- return Assembler::HasRoundInstruction(mode);
|
|
||||||
+ return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
RoundingMode roundingMode() const { return roundingMode_; }
|
|
||||||
diff -up firefox-55.0/js/src/jit/ExecutableAllocator.h.old firefox-55.0/js/src/jit/ExecutableAllocator.h
|
|
||||||
--- firefox-55.0/js/src/jit/ExecutableAllocator.h.old 2017-08-09 09:24:18.784983505 +0200
|
|
||||||
+++ firefox-55.0/js/src/jit/ExecutableAllocator.h 2017-08-09 09:28:01.471100075 +0200
|
|
||||||
@@ -307,6 +307,10 @@ class ExecutableAllocator
|
|
||||||
{
|
|
||||||
sync_instruction_memory((caddr_t)code, size);
|
|
||||||
}
|
|
||||||
+#else
|
|
||||||
+ static void cacheFlush(void*, size_t)
|
|
||||||
+ {
|
|
||||||
+ }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
|
||||||
diff -up firefox-55.0/js/src/wasm/WasmBuiltins.cpp.old firefox-55.0/js/src/wasm/WasmBuiltins.cpp
|
|
||||||
--- firefox-55.0/js/src/wasm/WasmBuiltins.cpp.old 2017-08-09 12:50:46.877450765 +0200
|
|
||||||
+++ firefox-55.0/js/src/wasm/WasmBuiltins.cpp 2017-08-09 12:50:59.725406974 +0200
|
|
||||||
@@ -881,7 +881,6 @@ wasm::EnsureBuiltinThunksInitialized()
|
|
||||||
MOZ_ASSERT(!masm.numSymbolicAccesses());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- ExecutableAllocator::cacheFlush(thunks->codeBase, thunks->codeSize);
|
|
||||||
if (!ExecutableAllocator::makeExecutable(thunks->codeBase, thunks->codeSize))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
diff -up firefox-55.0/js/src/wasm/WasmCode.cpp.old firefox-55.0/js/src/wasm/WasmCode.cpp
|
|
||||||
--- firefox-55.0/js/src/wasm/WasmCode.cpp.old 2017-08-09 12:50:37.205483731 +0200
|
|
||||||
+++ firefox-55.0/js/src/wasm/WasmCode.cpp 2017-08-09 12:51:10.365370708 +0200
|
|
||||||
@@ -287,8 +287,6 @@ CodeSegment::initialize(Tier tier,
|
|
||||||
if (!StaticallyLink(*this, linkData))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
- ExecutableAllocator::cacheFlush(bytes_.get(), RoundupCodeLength(codeLength));
|
|
||||||
-
|
|
||||||
// Reprotect the whole region to avoid having separate RW and RX mappings.
|
|
||||||
if (!ExecutableAllocator::makeExecutable(bytes_.get(), RoundupCodeLength(codeLength)))
|
|
||||||
return false;
|
|
||||||
diff -up firefox-55.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-55.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium
|
|
||||||
diff -up firefox-55.0/media/webrtc/trunk/Makefile.old firefox-55.0/media/webrtc/trunk/Makefile
|
|
||||||
49
build-remove-dav1d-from-wayland-dep.patch
Normal file
49
build-remove-dav1d-from-wayland-dep.patch
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
diff -up firefox-102.0/media/ffvpx/config_common.h.dav1d-remove firefox-102.0/media/ffvpx/config_common.h
|
||||||
|
--- firefox-102.0/media/ffvpx/config_common.h.dav1d-remove 2022-08-08 12:48:33.218128539 +0200
|
||||||
|
+++ firefox-102.0/media/ffvpx/config_common.h 2022-08-08 12:48:52.986003374 +0200
|
||||||
|
@@ -24,15 +24,11 @@
|
||||||
|
#undef CONFIG_VP8_VAAPI_HWACCEL
|
||||||
|
#undef CONFIG_VP9_VAAPI_HWACCEL
|
||||||
|
#undef CONFIG_AV1_VAAPI_HWACCEL
|
||||||
|
-#undef CONFIG_LIBDAV1D
|
||||||
|
-#undef CONFIG_AV1_DECODER
|
||||||
|
#define CONFIG_VAAPI 1
|
||||||
|
#define CONFIG_VAAPI_1 1
|
||||||
|
#define CONFIG_VP8_VAAPI_HWACCEL 1
|
||||||
|
#define CONFIG_VP9_VAAPI_HWACCEL 1
|
||||||
|
#define CONFIG_AV1_VAAPI_HWACCEL 1
|
||||||
|
-#define CONFIG_LIBDAV1D 1
|
||||||
|
-#define CONFIG_AV1_DECODER 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff -up firefox-102.0/media/ffvpx/libavcodec/moz.build.dav1d-remove firefox-102.0/media/ffvpx/libavcodec/moz.build
|
||||||
|
--- firefox-102.0/media/ffvpx/libavcodec/moz.build.dav1d-remove 2022-08-08 12:44:24.098710736 +0200
|
||||||
|
+++ firefox-102.0/media/ffvpx/libavcodec/moz.build 2022-08-08 12:46:42.635828719 +0200
|
||||||
|
@@ -104,17 +104,23 @@ if not CONFIG['MOZ_FFVPX_AUDIOONLY']:
|
||||||
|
]
|
||||||
|
if CONFIG['MOZ_WAYLAND']:
|
||||||
|
LOCAL_INCLUDES += ['/media/mozva']
|
||||||
|
+ if CONFIG['MOZ_DAV1D_ASM']:
|
||||||
|
+ SOURCES += [
|
||||||
|
+ 'libdav1d.c',
|
||||||
|
+ ]
|
||||||
|
SOURCES += [
|
||||||
|
'atsc_a53.c',
|
||||||
|
- 'libdav1d.c',
|
||||||
|
'vaapi_av1.c',
|
||||||
|
'vaapi_decode.c',
|
||||||
|
'vaapi_vp8.c',
|
||||||
|
'vaapi_vp9.c',
|
||||||
|
]
|
||||||
|
+ if CONFIG['MOZ_DAV1D_ASM']:
|
||||||
|
+ USE_LIBS += [
|
||||||
|
+ 'dav1d',
|
||||||
|
+ 'media_libdav1d_asm',
|
||||||
|
+ ]
|
||||||
|
USE_LIBS += [
|
||||||
|
- 'dav1d',
|
||||||
|
- 'media_libdav1d_asm',
|
||||||
|
'mozva'
|
||||||
|
]
|
||||||
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
diff -up firefox-55.0/build/moz.configure/rust.configure.rust-ppc64le firefox-55.0/build/moz.configure/rust.configure
|
|
||||||
--- firefox-55.0/build/moz.configure/rust.configure.rust-ppc64le 2017-07-31 18:20:49.000000000 +0200
|
|
||||||
+++ firefox-55.0/build/moz.configure/rust.configure 2017-08-02 10:19:03.254220003 +0200
|
|
||||||
@@ -151,6 +151,9 @@ def rust_triple_alias(host_or_target):
|
|
||||||
('sparc64', 'Linux'): 'sparc64-unknown-linux-gnu',
|
|
||||||
('x86', 'Linux'): 'i686-unknown-linux-gnu',
|
|
||||||
('x86_64', 'Linux'): 'x86_64-unknown-linux-gnu',
|
|
||||||
+ ('ppc64le', 'Linux'): 'powerpc64le-unknown-linux-gnu',
|
|
||||||
+ ('ppc64', 'Linux'): 'powerpc64-unknown-linux-gnu',
|
|
||||||
+ ('s390x', 'Linux'): 's390x-unknown-linux-gnu',
|
|
||||||
# OS X
|
|
||||||
('x86', 'OSX'): 'i686-apple-darwin',
|
|
||||||
('x86_64', 'OSX'): 'x86_64-apple-darwin',
|
|
||||||
@@ -174,8 +177,10 @@ def rust_triple_alias(host_or_target):
|
|
||||||
('sparc64', 'SunOS'): 'sparcv9-sun-solaris',
|
|
||||||
}.get((host_or_target.cpu, os_or_kernel), None)
|
|
||||||
|
|
||||||
+ if (rustc_target == 'powerpc64-unknown-linux-gnu' and host_or_target.endianness == 'little'):
|
|
||||||
+ rustc_target = 'powerpc64le-unknown-linux-gnu'
|
|
||||||
if rustc_target is None:
|
|
||||||
- die("Don't know how to translate {} for rustc".format(host_or_target.alias))
|
|
||||||
+ die("Don't know how to translate {} for rustc, cpu: {}, os: {}".format(target.alias, target.cpu, os_or_kernel))
|
|
||||||
|
|
||||||
# Check to see whether our rustc has a reasonably functional stdlib
|
|
||||||
# for our chosen target.
|
|
||||||
Binary file not shown.
28
disable-glean-sdk,psutil,zstandard.patch
Normal file
28
disable-glean-sdk,psutil,zstandard.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From cac2a2962d2461e5a8969bb08d02bacd545e52cf Mon Sep 17 00:00:00 2001
|
||||||
|
From: wk333 <13474090681@163.com>
|
||||||
|
Date: Mon, 27 Feb 2023 20:09:10 +0800
|
||||||
|
Subject: [PATCH 1/1] disable glean-sdk,psutil,zstandard
|
||||||
|
|
||||||
|
---
|
||||||
|
python/sites/mach.txt | 8 --------
|
||||||
|
1 file changed, 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/python/sites/mach.txt b/python/sites/mach.txt
|
||||||
|
index 6547ee5..cd66ba1 100644
|
||||||
|
--- a/python/sites/mach.txt
|
||||||
|
+++ b/python/sites/mach.txt
|
||||||
|
@@ -127,11 +127,3 @@ pth:tools/moztreedocs
|
||||||
|
pth:xpcom/ds/tools
|
||||||
|
pth:xpcom/geckoprocesstypes_generator
|
||||||
|
pth:xpcom/idl-parser
|
||||||
|
-# glean-sdk may not be installable if a wheel isn't available
|
||||||
|
-# and it has to be built from source.
|
||||||
|
-pypi-optional:glean-sdk==44.1.1:telemetry will not be collected
|
||||||
|
-# Mach gracefully handles the case where `psutil` is unavailable.
|
||||||
|
-# We aren't (yet) able to pin packages in automation, so we have to
|
||||||
|
-# support down to the oldest locally-installed version (5.4.2).
|
||||||
|
-pypi-optional:psutil>=5.4.2,<=5.8.0:telemetry will be missing some data
|
||||||
|
-pypi-optional:zstandard>=0.11.1,<=0.17.0:zstd archives will not be possible to extract
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
39
disable-openh264-download.patch
Normal file
39
disable-openh264-download.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
diff -up firefox-81.0/toolkit/modules/GMPInstallManager.jsm.old firefox-81.0/toolkit/modules/GMPInstallManager.jsm
|
||||||
|
--- firefox-81.0/toolkit/modules/GMPInstallManager.jsm.old 2020-09-25 10:39:04.769458703 +0200
|
||||||
|
+++ firefox-81.0/toolkit/modules/GMPInstallManager.jsm 2020-09-25 10:39:22.038504747 +0200
|
||||||
|
@@ -54,10 +54,6 @@ function getScopedLogger(prefix) {
|
||||||
|
|
||||||
|
const LOCAL_GMP_SOURCES = [
|
||||||
|
{
|
||||||
|
- id: "gmp-gmpopenh264",
|
||||||
|
- src: "chrome://global/content/gmp-sources/openh264.json",
|
||||||
|
- },
|
||||||
|
- {
|
||||||
|
id: "gmp-widevinecdm",
|
||||||
|
src: "chrome://global/content/gmp-sources/widevinecdm.json",
|
||||||
|
},
|
||||||
|
diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
|
||||||
|
--- a/toolkit/content/jar.mn
|
||||||
|
+++ b/toolkit/content/jar.mn
|
||||||
|
@@ -108,7 +108,6 @@ toolkit.jar:
|
||||||
|
#ifdef XP_MACOSX
|
||||||
|
content/global/macWindowMenu.js
|
||||||
|
#endif
|
||||||
|
- content/global/gmp-sources/openh264.json (gmp-sources/openh264.json)
|
||||||
|
content/global/gmp-sources/widevinecdm.json (gmp-sources/widevinecdm.json)
|
||||||
|
|
||||||
|
# Third party files
|
||||||
|
diff --git a/toolkit/modules/GMPInstallManager.jsm b/toolkit/modules/GMPInstallManager.jsm
|
||||||
|
--- a/toolkit/modules/GMPInstallManager.jsm
|
||||||
|
+++ b/toolkit/modules/GMPInstallManager.jsm
|
||||||
|
@@ -238,6 +234,9 @@ GMPInstallManager.prototype = {
|
||||||
|
* downloaderr, verifyerr or previouserrorencountered
|
||||||
|
*/
|
||||||
|
installAddon(gmpAddon) {
|
||||||
|
+ if (gmpAddon.isOpenH264) {
|
||||||
|
+ return Promise.reject({ type: "disabled" });
|
||||||
|
+ }
|
||||||
|
if (this._deferred) {
|
||||||
|
let log = getScopedLogger("GMPInstallManager.installAddon");
|
||||||
|
log.error("previous error encountered");
|
||||||
|
|
||||||
3
firefox-102.8.0esr.b2.processed-source.tar.xz
Normal file
3
firefox-102.8.0esr.b2.processed-source.tar.xz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d86efb1ebc211623acf3b6dde92501b76dd953eeb5188af3aaeda28db07f1652
|
||||||
|
size 486552868
|
||||||
Binary file not shown.
@ -1,12 +0,0 @@
|
|||||||
diff -up firefox-87.0/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc.old firefox-87.0/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc
|
|
||||||
--- firefox-87.0/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc.old 2021-03-25 19:07:12.920421009 +0100
|
|
||||||
+++ firefox-87.0/toolkit/crashreporter/breakpad-client/linux/handler/exception_handler.cc 2021-03-25 19:06:45.496596019 +0100
|
|
||||||
@@ -149,7 +149,7 @@ void InstallAlternateStackLocked() {
|
|
||||||
// SIGSTKSZ may be too small to prevent the signal handlers from overrunning
|
|
||||||
// the alternative stack. Ensure that the size of the alternative stack is
|
|
||||||
// large enough.
|
|
||||||
- static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ);
|
|
||||||
+ static const unsigned kSigStackSize = (16384 > SIGSTKSZ) ? 16384 : SIGSTKSZ;
|
|
||||||
|
|
||||||
// Only set an alternative stack if there isn't already one, or if the current
|
|
||||||
// one is too small.
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
diff --git a/dom/media/platforms/PDMFactory.cpp b/dom/media/platforms/PDMFactory.cpp
|
|
||||||
--- a/dom/media/platforms/PDMFactory.cpp
|
|
||||||
+++ b/dom/media/platforms/PDMFactory.cpp
|
|
||||||
@@ -21,16 +21,17 @@
|
|
||||||
#include "mozilla/GpuDecoderModule.h"
|
|
||||||
#include "mozilla/RemoteDecoderModule.h"
|
|
||||||
#include "mozilla/SharedThreadPool.h"
|
|
||||||
#include "mozilla/StaticPrefs_media.h"
|
|
||||||
#include "mozilla/StaticPtr.h"
|
|
||||||
#include "mozilla/SyncRunnable.h"
|
|
||||||
#include "mozilla/TaskQueue.h"
|
|
||||||
#include "mozilla/gfx/gfxVars.h"
|
|
||||||
+#include "gfxPlatformGtk.h"
|
|
||||||
|
|
||||||
#ifdef XP_WIN
|
|
||||||
# include "WMFDecoderModule.h"
|
|
||||||
# include "mozilla/WindowsVersion.h"
|
|
||||||
#endif
|
|
||||||
#ifdef MOZ_FFVPX
|
|
||||||
# include "FFVPXRuntimeLinker.h"
|
|
||||||
#endif
|
|
||||||
@@ -362,17 +363,18 @@ void PDMFactory::CreatePDMs() {
|
|
||||||
#endif
|
|
||||||
#ifdef MOZ_OMX
|
|
||||||
if (StaticPrefs::media_omx_enabled()) {
|
|
||||||
m = OmxDecoderModule::Create();
|
|
||||||
StartupPDM(m);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef MOZ_FFVPX
|
|
||||||
- if (StaticPrefs::media_ffvpx_enabled()) {
|
|
||||||
+ if (StaticPrefs::media_ffvpx_enabled() &&
|
|
||||||
+ !gfxPlatformGtk::GetPlatform()->UseWaylandHardwareVideoDecoding()) {
|
|
||||||
m = FFVPXRuntimeLinker::CreateDecoderModule();
|
|
||||||
StartupPDM(m);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef MOZ_FFMPEG
|
|
||||||
if (StaticPrefs::media_ffmpeg_enabled()) {
|
|
||||||
m = FFmpegRuntimeLinker::CreateDecoderModule();
|
|
||||||
mFFmpegFailedToLoad = !StartupPDM(m);
|
|
||||||
38
firefox-gcc-build.patch
Normal file
38
firefox-gcc-build.patch
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
--- firefox-80.0.1/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h 2020-08-31 10:04:19.000000000 -0400
|
||||||
|
+++ firefox-80.0.1/toolkit/crashreporter/google-breakpad/src/third_party/lss/linux_syscall_support.h 2020-09-12 07:24:35.298931628 -0400
|
||||||
|
@@ -1962,7 +1962,7 @@ struct kernel_statfs {
|
||||||
|
LSS_ENTRYPOINT \
|
||||||
|
"pop %%ebx" \
|
||||||
|
args \
|
||||||
|
- : "esp", "memory"); \
|
||||||
|
+ : "memory"); \
|
||||||
|
LSS_RETURN(type,__res)
|
||||||
|
#undef _syscall0
|
||||||
|
#define _syscall0(type,name) \
|
||||||
|
@@ -2019,7 +2019,7 @@ struct kernel_statfs {
|
||||||
|
: "i" (__NR_##name), "ri" ((long)(arg1)), \
|
||||||
|
"c" ((long)(arg2)), "d" ((long)(arg3)), \
|
||||||
|
"S" ((long)(arg4)), "D" ((long)(arg5)) \
|
||||||
|
- : "esp", "memory"); \
|
||||||
|
+ : "memory"); \
|
||||||
|
LSS_RETURN(type,__res); \
|
||||||
|
}
|
||||||
|
#undef _syscall6
|
||||||
|
@@ -2041,7 +2041,7 @@ struct kernel_statfs {
|
||||||
|
: "i" (__NR_##name), "0" ((long)(&__s)), \
|
||||||
|
"c" ((long)(arg2)), "d" ((long)(arg3)), \
|
||||||
|
"S" ((long)(arg4)), "D" ((long)(arg5)) \
|
||||||
|
- : "esp", "memory"); \
|
||||||
|
+ : "memory"); \
|
||||||
|
LSS_RETURN(type,__res); \
|
||||||
|
}
|
||||||
|
LSS_INLINE int LSS_NAME(clone)(int (*fn)(void *), void *child_stack,
|
||||||
|
@@ -2127,7 +2127,7 @@ struct kernel_statfs {
|
||||||
|
: "0"(-EINVAL), "i"(__NR_clone),
|
||||||
|
"m"(fn), "m"(child_stack), "m"(flags), "m"(arg),
|
||||||
|
"m"(parent_tidptr), "m"(newtls), "m"(child_tidptr)
|
||||||
|
- : "esp", "memory", "ecx", "edx", "esi", "edi");
|
||||||
|
+ : "memory", "ecx", "edx", "esi", "edi");
|
||||||
|
LSS_RETURN(int, __res);
|
||||||
|
}
|
||||||
|
|
||||||
@ -1,76 +0,0 @@
|
|||||||
From 0b5da0bc80e4cfc1167d100f224ba577554909b0 Mon Sep 17 00:00:00 2001
|
|
||||||
From: caodongxia <315816521@qq.com>
|
|
||||||
Date: Wed, 11 Aug 2021 09:31:37 +0800
|
|
||||||
Subject: [PATCH] fix
|
|
||||||
|
|
||||||
---
|
|
||||||
js/xpconnect/src/XPCJSContext.cpp | 10 +---------
|
|
||||||
security/sandbox/linux/launch/SandboxLaunch.cpp | 11 ++++++++---
|
|
||||||
2 files changed, 9 insertions(+), 12 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp
|
|
||||||
index 54461fb88c..9a998ac88d 100644
|
|
||||||
--- a/js/xpconnect/src/XPCJSContext.cpp
|
|
||||||
+++ b/js/xpconnect/src/XPCJSContext.cpp
|
|
||||||
@@ -81,14 +81,6 @@ using namespace xpc;
|
|
||||||
using namespace JS;
|
|
||||||
using mozilla::dom::AutoEntryScript;
|
|
||||||
|
|
||||||
-// The watchdog thread loop is pretty trivial, and should not require much stack
|
|
||||||
-// space to do its job. So only give it 32KiB or the platform minimum.
|
|
||||||
-#if !defined(PTHREAD_STACK_MIN)
|
|
||||||
-# define PTHREAD_STACK_MIN 0
|
|
||||||
-#endif
|
|
||||||
-static constexpr size_t kWatchdogStackSize =
|
|
||||||
- PTHREAD_STACK_MIN < 32 * 1024 ? 32 * 1024 : PTHREAD_STACK_MIN;
|
|
||||||
-
|
|
||||||
static void WatchdogMain(void* arg);
|
|
||||||
class Watchdog;
|
|
||||||
class WatchdogManager;
|
|
||||||
@@ -161,7 +153,7 @@ class Watchdog {
|
|
||||||
// watchdog, we need to join it on shutdown.
|
|
||||||
mThread = PR_CreateThread(PR_USER_THREAD, WatchdogMain, this,
|
|
||||||
PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
|
|
||||||
- PR_JOINABLE_THREAD, kWatchdogStackSize);
|
|
||||||
+ PR_JOINABLE_THREAD, 0);
|
|
||||||
if (!mThread) {
|
|
||||||
MOZ_CRASH("PR_CreateThread failed!");
|
|
||||||
}
|
|
||||||
diff --git a/security/sandbox/linux/launch/SandboxLaunch.cpp b/security/sandbox/linux/launch/SandboxLaunch.cpp
|
|
||||||
index 33d33a00c9..b70fa693d4 100644
|
|
||||||
--- a/security/sandbox/linux/launch/SandboxLaunch.cpp
|
|
||||||
+++ b/security/sandbox/linux/launch/SandboxLaunch.cpp
|
|
||||||
@@ -489,7 +489,7 @@ static int CloneCallee(void* aPtr) {
|
|
||||||
// we don't currently support sandboxing under valgrind.
|
|
||||||
MOZ_NEVER_INLINE MOZ_ASAN_BLACKLIST static pid_t DoClone(int aFlags,
|
|
||||||
jmp_buf* aCtx) {
|
|
||||||
- uint8_t miniStack[PTHREAD_STACK_MIN];
|
|
||||||
+ uint8_t miniStack[4096];
|
|
||||||
#ifdef __hppa__
|
|
||||||
void* stackPtr = miniStack;
|
|
||||||
#else
|
|
||||||
@@ -509,14 +509,19 @@ static pid_t ForkWithFlags(int aFlags) {
|
|
||||||
CLONE_PARENT_SETTID | CLONE_CHILD_SETTID |
|
|
||||||
CLONE_CHILD_CLEARTID;
|
|
||||||
MOZ_RELEASE_ASSERT((aFlags & kBadFlags) == 0);
|
|
||||||
+ // Block signals due to small stack in DoClone
|
|
||||||
+ sigset_t oldSigs;
|
|
||||||
+ BlockAllSignals(&oldSigs);
|
|
||||||
|
|
||||||
+ int ret = 0;
|
|
||||||
jmp_buf ctx;
|
|
||||||
if (setjmp(ctx) == 0) {
|
|
||||||
// In the parent and just called setjmp:
|
|
||||||
- return DoClone(aFlags | SIGCHLD, &ctx);
|
|
||||||
+ ret = DoClone(aFlags | SIGCHLD, &ctx);
|
|
||||||
}
|
|
||||||
+ RestoreSignals(&oldSigs);
|
|
||||||
// In the child and have longjmp'ed:
|
|
||||||
- return 0;
|
|
||||||
+ return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool WriteStringToFile(const char* aPath, const char* aStr,
|
|
||||||
--
|
|
||||||
2.27.0
|
|
||||||
|
|
||||||
3
firefox-langpacks-102.8.0esr-20230214.tar.xz
Normal file
3
firefox-langpacks-102.8.0esr-20230214.tar.xz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:64a9e52006911abf90d919b0e715fd64fde275bd0ecff75b5571eb76fa09f706
|
||||||
|
size 44675456
|
||||||
Binary file not shown.
@ -1,12 +0,0 @@
|
|||||||
diff -up firefox-75.0/intl/locale/LocaleService.cpp.locale-debug firefox-75.0/intl/locale/LocaleService.cpp
|
|
||||||
--- firefox-75.0/intl/locale/LocaleService.cpp.locale-debug 2020-04-06 22:42:20.196799809 +0200
|
|
||||||
+++ firefox-75.0/intl/locale/LocaleService.cpp 2020-04-06 22:43:02.522530317 +0200
|
|
||||||
@@ -372,8 +372,6 @@ LocaleService::GetDefaultLocale(nsACStri
|
|
||||||
// just use our hard-coded default below.
|
|
||||||
GetGREFileContents("update.locale", &locale);
|
|
||||||
locale.Trim(" \t\n\r");
|
|
||||||
- // This should never be empty.
|
|
||||||
- MOZ_ASSERT(!locale.IsEmpty());
|
|
||||||
if (CanonicalizeLanguageId(locale)) {
|
|
||||||
mDefaultLocale.Assign(locale);
|
|
||||||
}
|
|
||||||
@ -10,14 +10,19 @@ ac_add_options --enable-pulseaudio
|
|||||||
ac_add_options --enable-av1
|
ac_add_options --enable-av1
|
||||||
ac_add_options --without-system-icu
|
ac_add_options --without-system-icu
|
||||||
ac_add_options --enable-release
|
ac_add_options --enable-release
|
||||||
ac_add_options --update-channel=release
|
|
||||||
# Workaround for mozbz#1341234
|
|
||||||
ac_add_options BINDGEN_CFLAGS="$(pkg-config nspr pixman-1 --cflags)"
|
|
||||||
ac_add_options --allow-addon-sideload
|
ac_add_options --allow-addon-sideload
|
||||||
|
ac_add_options --with-system-jpeg
|
||||||
|
ac_add_options --enable-js-shell
|
||||||
|
ac_add_options --with-unsigned-addon-scopes=app,system
|
||||||
|
ac_add_options --without-sysroot
|
||||||
|
# investigate this one:
|
||||||
|
ac_add_options --without-wasm-sandboxed-libraries
|
||||||
|
ac_add_options --disable-crashreporter
|
||||||
export BUILD_OFFICIAL=1
|
export BUILD_OFFICIAL=1
|
||||||
export MOZILLA_OFFICIAL=1
|
export MOZILLA_OFFICIAL=1
|
||||||
export MOZ_TELEMETRY_REPORTING=1
|
export MOZ_TELEMETRY_REPORTING=1
|
||||||
|
export MOZ_UPDATE_CHANNEL=release
|
||||||
|
export MOZ_APP_REMOTINGNAME=firefox
|
||||||
mk_add_options BUILD_OFFICIAL=1
|
mk_add_options BUILD_OFFICIAL=1
|
||||||
mk_add_options MOZILLA_OFFICIAL=1
|
mk_add_options MOZILLA_OFFICIAL=1
|
||||||
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir
|
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir
|
||||||
|
|||||||
19
firefox-nss-addon-hack.patch
Normal file
19
firefox-nss-addon-hack.patch
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
diff -up firefox-84.0.2/security/certverifier/NSSCertDBTrustDomain.cpp.nss-hack firefox-84.0.2/security/certverifier/NSSCertDBTrustDomain.cpp
|
||||||
|
--- firefox-84.0.2/security/certverifier/NSSCertDBTrustDomain.cpp.nss-hack 2021-01-11 12:12:02.585514543 +0100
|
||||||
|
+++ firefox-84.0.2/security/certverifier/NSSCertDBTrustDomain.cpp 2021-01-11 12:47:50.345984582 +0100
|
||||||
|
@@ -1619,6 +1619,15 @@ SECStatus InitializeNSS(const nsACString
|
||||||
|
return srv;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* Sets the NSS_USE_ALG_IN_ANY_SIGNATURE bit.
|
||||||
|
+ * does not change NSS_USE_ALG_IN_CERT_SIGNATURE,
|
||||||
|
+ * so policy will still disable use of sha1 in
|
||||||
|
+ * certificate related signature processing. */
|
||||||
|
+ srv = NSS_SetAlgorithmPolicy(SEC_OID_SHA1, NSS_USE_ALG_IN_ANY_SIGNATURE, 0);
|
||||||
|
+ if (srv != SECSuccess) {
|
||||||
|
+ NS_WARNING("Unable to use SHA1 for Add-ons, expect broken/disabled Add-ons. See https://bugzilla.redhat.com/show_bug.cgi?id=1908018 for details.");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (nssDbConfig == NSSDBConfig::ReadWrite) {
|
||||||
|
UniquePK11SlotInfo slot(PK11_GetInternalKeySlot());
|
||||||
|
if (!slot) {
|
||||||
@ -1,12 +1,11 @@
|
|||||||
diff -up firefox-78.0/toolkit/moz.configure.nss-version firefox-78.0/toolkit/moz.configure
|
--- firefox-102.6.0/build/moz.configure/nss.configure.firefox-nss-version 2022-12-06 19:14:59.439978420 +0100
|
||||||
--- firefox-78.0/toolkit/moz.configure.nss-version 2020-06-30 08:47:09.657501414 +0200
|
+++ firefox-102.6.0/build/moz.configure/nss.configure 2022-12-06 19:18:23.299471634 +0100
|
||||||
+++ firefox-78.0/toolkit/moz.configure 2020-06-30 08:47:12.652510169 +0200
|
@@ -9,7 +9,7 @@ system_lib_option("--with-system-nss", h
|
||||||
@@ -2089,7 +2089,7 @@ option('--with-system-nss', help='Use sy
|
imply_option("--with-system-nspr", True, when="--with-system-nss")
|
||||||
|
|
||||||
imply_option('--with-system-nspr', True, when='--with-system-nss')
|
nss_pkg = pkg_check_modules(
|
||||||
|
- "NSS", "nss >= 3.79.2", when="--with-system-nss", config=False
|
||||||
-nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53.1', when='--with-system-nss', config=False)
|
+ "NSS", "nss >= 3.79", when="--with-system-nss", config=False
|
||||||
+nss_pkg = pkg_check_modules('NSS', 'nss >= 3.53.0', when='--with-system-nss', config=False)
|
)
|
||||||
|
|
||||||
set_config('MOZ_SYSTEM_NSS', True, when='--with-system-nss')
|
|
||||||
|
|
||||||
|
set_config("MOZ_SYSTEM_NSS", True, when="--with-system-nss")
|
||||||
|
|||||||
@ -2,7 +2,6 @@ pref("app.update.auto", false);
|
|||||||
pref("app.update.enabled", false);
|
pref("app.update.enabled", false);
|
||||||
pref("app.update.autoInstallEnabled", false);
|
pref("app.update.autoInstallEnabled", false);
|
||||||
pref("general.smoothScroll", true);
|
pref("general.smoothScroll", true);
|
||||||
pref("intl.locale.matchOS", true);
|
|
||||||
pref("intl.locale.requested", "");
|
pref("intl.locale.requested", "");
|
||||||
pref("toolkit.storage.synchronous", 0);
|
pref("toolkit.storage.synchronous", 0);
|
||||||
pref("toolkit.networkmanager.disable", false);
|
pref("toolkit.networkmanager.disable", false);
|
||||||
@ -15,21 +14,27 @@ pref("browser.shell.checkDefaultBrowser", false);
|
|||||||
pref("network.manage-offline-status", true);
|
pref("network.manage-offline-status", true);
|
||||||
pref("extensions.shownSelectionUI", true);
|
pref("extensions.shownSelectionUI", true);
|
||||||
pref("ui.SpellCheckerUnderlineStyle", 1);
|
pref("ui.SpellCheckerUnderlineStyle", 1);
|
||||||
pref("startup.homepage_override_url", "");
|
pref("startup.homepage_override_url", "https://openeuler.org/zh/");
|
||||||
|
pref("startup.homepage_welcome_url", "https://openeuler.org/zh/");
|
||||||
pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=https://openeuler.org/zh/");
|
pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=https://openeuler.org/zh/");
|
||||||
pref("browser.newtabpage.pinned", '[{"url":"https://openeuler.org/zh/","title":"Openeuler Project - Start Page"}]');
|
|
||||||
pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%");
|
pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%");
|
||||||
pref("media.gmp-gmpopenh264.provider.enabled",false);
|
pref("media.gmp-gmpopenh264.provider.enabled",false);
|
||||||
pref("media.gmp-gmpopenh264.autoupdate",false);
|
pref("media.gmp-gmpopenh264.autoupdate",false);
|
||||||
pref("media.gmp-gmpopenh264.enabled",false);
|
pref("media.gmp-gmpopenh264.enabled",false);
|
||||||
pref("media.gmp-gmpopenh264.enabled",false);
|
pref("media.gmp.decoder.enabled", true);
|
||||||
pref("plugins.notifyMissingFlash", false);
|
pref("plugins.notifyMissingFlash", false);
|
||||||
pref("layers.use-image-offscreen-surfaces", false);
|
/* See https://bugzilla.redhat.com/show_bug.cgi?id=1226489 */
|
||||||
|
pref("browser.display.use_system_colors", false);
|
||||||
/* Allow sending credetials to all https:// sites */
|
/* Allow sending credetials to all https:// sites */
|
||||||
pref("network.negotiate-auth.trusted-uris", "https://");
|
pref("network.negotiate-auth.trusted-uris", "https://");
|
||||||
|
pref("security.use_sqldb", false);
|
||||||
pref("spellchecker.dictionary_path","/usr/share/myspell");
|
pref("spellchecker.dictionary_path","/usr/share/myspell");
|
||||||
/* Disable DoH by default */
|
/* Disable DoH by default */
|
||||||
pref("network.trr.mode", 5);
|
pref("network.trr.mode", 5);
|
||||||
/* Enable per-user policy dir */
|
/* Enable per-user policy dir, see mozbz#1583466 */
|
||||||
pref("browser.policies.perUserDir", true);
|
pref("browser.policies.perUserDir", true);
|
||||||
pref("browser.gnome-search-provider.enabled",true);
|
pref("browser.gnome-search-provider.enabled",true);
|
||||||
|
/* Enable ffvpx playback for WebRTC */
|
||||||
|
pref("media.navigator.mediadatadecoder_vpx_enabled", true);
|
||||||
|
/* See https://bugzilla.redhat.com/show_bug.cgi?id=1672424 */
|
||||||
|
pref("storage.nfs_filesystem", true);
|
||||||
@ -1,834 +0,0 @@
|
|||||||
diff -up firefox-79.0/config/system-headers.mozbuild.firefox-pipewire-0-3 firefox-79.0/config/system-headers.mozbuild
|
|
||||||
--- firefox-79.0/config/system-headers.mozbuild.firefox-pipewire-0-3 2020-07-21 00:49:36.000000000 +0200
|
|
||||||
+++ firefox-79.0/config/system-headers.mozbuild 2020-07-28 10:06:59.485481599 +0200
|
|
||||||
@@ -314,6 +314,7 @@ system_headers = [
|
|
||||||
'Gestalt.h',
|
|
||||||
'getopt.h',
|
|
||||||
'gio/gio.h',
|
|
||||||
+ 'gio/gunixfdlist.h',
|
|
||||||
'glibconfig.h',
|
|
||||||
'glib.h',
|
|
||||||
'glib-object.h',
|
|
||||||
@@ -607,6 +608,7 @@ system_headers = [
|
|
||||||
'Pgenerr.h',
|
|
||||||
'PGenErr.h',
|
|
||||||
'Ph.h',
|
|
||||||
+ 'pipewire/pipewire.h',
|
|
||||||
'pixman.h',
|
|
||||||
'pk11func.h',
|
|
||||||
'pk11pqg.h',
|
|
||||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn
|
|
||||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn.firefox-pipewire-0-3 2020-07-20 22:53:33.000000000 +0200
|
|
||||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/BUILD.gn 2020-07-28 10:06:59.485481599 +0200
|
|
||||||
@@ -158,7 +158,7 @@ if (rtc_include_tests) {
|
|
||||||
if (is_linux) {
|
|
||||||
if (rtc_use_pipewire) {
|
|
||||||
pkg_config("pipewire") {
|
|
||||||
- packages = [ "libpipewire-0.2" ]
|
|
||||||
+ packages = [ "libpipewire-0.3" ]
|
|
||||||
|
|
||||||
defines = [ "WEBRTC_USE_PIPEWIRE" ]
|
|
||||||
}
|
|
||||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
|
|
||||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire-0-3 2020-07-28 10:06:59.486481593 +0200
|
|
||||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build 2020-07-28 10:11:51.231907101 +0200
|
|
||||||
@@ -174,6 +174,28 @@ if CONFIG["OS_TARGET"] == "Linux":
|
|
||||||
"/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc"
|
|
||||||
]
|
|
||||||
|
|
||||||
+# PipeWire specific files
|
|
||||||
+if CONFIG["OS_TARGET"] == "Linux":
|
|
||||||
+ DEFINES["WEBRTC_USE_PIPEWIRE"] = "1"
|
|
||||||
+
|
|
||||||
+ OS_LIBS += [
|
|
||||||
+ "rt",
|
|
||||||
+ "pipewire-0.3",
|
|
||||||
+ "glib-2.0",
|
|
||||||
+ "gio-2.0",
|
|
||||||
+ "gobject-2.0"
|
|
||||||
+ ]
|
|
||||||
+
|
|
||||||
+ CXXFLAGS += CONFIG['TK_CFLAGS']
|
|
||||||
+ CXXFLAGS += [ "-I/usr/include/pipewire-0.3" ]
|
|
||||||
+ CXXFLAGS += [ "-I/usr/include/spa-0.2" ]
|
|
||||||
+
|
|
||||||
+ UNIFIED_SOURCES += [
|
|
||||||
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc",
|
|
||||||
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc",
|
|
||||||
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc"
|
|
||||||
+ ]
|
|
||||||
+
|
|
||||||
if CONFIG["OS_TARGET"] == "Darwin":
|
|
||||||
|
|
||||||
DEFINES["CR_XCODE_VERSION"] = "0920"
|
|
||||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
|
|
||||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire-0-3 2020-07-20 22:54:16.000000000 +0200
|
|
||||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2020-07-28 10:06:59.486481593 +0200
|
|
||||||
@@ -141,7 +141,7 @@ class DesktopCaptureOptions {
|
|
||||||
bool disable_effects_ = true;
|
|
||||||
bool detect_updated_region_ = false;
|
|
||||||
#if defined(WEBRTC_USE_PIPEWIRE)
|
|
||||||
- bool allow_pipewire_ = false;
|
|
||||||
+ bool allow_pipewire_ = true;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc
|
|
||||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc.firefox-pipewire-0-3 2020-07-20 22:54:27.000000000 +0200
|
|
||||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.cc 2020-07-28 10:06:59.500481514 +0200
|
|
||||||
@@ -15,8 +15,11 @@
|
|
||||||
|
|
||||||
#include <spa/param/format-utils.h>
|
|
||||||
#include <spa/param/props.h>
|
|
||||||
-#include <spa/param/video/raw-utils.h>
|
|
||||||
-#include <spa/support/type-map.h>
|
|
||||||
+
|
|
||||||
+#include <linux/dma-buf.h>
|
|
||||||
+#include <sys/mman.h>
|
|
||||||
+#include <sys/ioctl.h>
|
|
||||||
+#include <sys/syscall.h>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <utility>
|
|
||||||
@@ -36,32 +39,37 @@ const char kSessionInterfaceName[] = "or
|
|
||||||
const char kRequestInterfaceName[] = "org.freedesktop.portal.Request";
|
|
||||||
const char kScreenCastInterfaceName[] = "org.freedesktop.portal.ScreenCast";
|
|
||||||
|
|
||||||
+
|
|
||||||
// static
|
|
||||||
-void BaseCapturerPipeWire::OnStateChanged(void* data,
|
|
||||||
- pw_remote_state old_state,
|
|
||||||
- pw_remote_state state,
|
|
||||||
- const char* error_message) {
|
|
||||||
- BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
|
|
||||||
- RTC_DCHECK(that);
|
|
||||||
+void BaseCapturerPipeWire::SyncDmaBuf(int fd, uint64_t start_or_end) {
|
|
||||||
+ struct dma_buf_sync sync = { 0 };
|
|
||||||
|
|
||||||
- switch (state) {
|
|
||||||
- case PW_REMOTE_STATE_ERROR:
|
|
||||||
- RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message;
|
|
||||||
- break;
|
|
||||||
- case PW_REMOTE_STATE_CONNECTED:
|
|
||||||
- RTC_LOG(LS_INFO) << "PipeWire remote state: connected.";
|
|
||||||
- that->CreateReceivingStream();
|
|
||||||
- break;
|
|
||||||
- case PW_REMOTE_STATE_CONNECTING:
|
|
||||||
- RTC_LOG(LS_INFO) << "PipeWire remote state: connecting.";
|
|
||||||
+ sync.flags = start_or_end | DMA_BUF_SYNC_READ;
|
|
||||||
+
|
|
||||||
+ while(true) {
|
|
||||||
+ int ret;
|
|
||||||
+ ret = ioctl (fd, DMA_BUF_IOCTL_SYNC, &sync);
|
|
||||||
+ if (ret == -1 && errno == EINTR) {
|
|
||||||
+ continue;
|
|
||||||
+ } else if (ret == -1) {
|
|
||||||
+ RTC_LOG(LS_ERROR) << "Failed to synchronize DMA buffer: " << g_strerror(errno);
|
|
||||||
break;
|
|
||||||
- case PW_REMOTE_STATE_UNCONNECTED:
|
|
||||||
- RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected.";
|
|
||||||
+ } else {
|
|
||||||
break;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
+void BaseCapturerPipeWire::OnCoreError(void *data,
|
|
||||||
+ uint32_t id,
|
|
||||||
+ int seq,
|
|
||||||
+ int res,
|
|
||||||
+ const char *message) {
|
|
||||||
+ RTC_LOG(LS_ERROR) << "core error: " << message;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// static
|
|
||||||
void BaseCapturerPipeWire::OnStreamStateChanged(void* data,
|
|
||||||
pw_stream_state old_state,
|
|
||||||
pw_stream_state state,
|
|
||||||
@@ -73,76 +81,54 @@ void BaseCapturerPipeWire::OnStreamState
|
|
||||||
case PW_STREAM_STATE_ERROR:
|
|
||||||
RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message;
|
|
||||||
break;
|
|
||||||
- case PW_STREAM_STATE_CONFIGURE:
|
|
||||||
- pw_stream_set_active(that->pw_stream_, true);
|
|
||||||
- break;
|
|
||||||
- case PW_STREAM_STATE_UNCONNECTED:
|
|
||||||
- case PW_STREAM_STATE_CONNECTING:
|
|
||||||
- case PW_STREAM_STATE_READY:
|
|
||||||
case PW_STREAM_STATE_PAUSED:
|
|
||||||
case PW_STREAM_STATE_STREAMING:
|
|
||||||
+ case PW_STREAM_STATE_UNCONNECTED:
|
|
||||||
+ case PW_STREAM_STATE_CONNECTING:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
-void BaseCapturerPipeWire::OnStreamFormatChanged(void* data,
|
|
||||||
- const struct spa_pod* format) {
|
|
||||||
+void BaseCapturerPipeWire::OnStreamParamChanged(void *data, uint32_t id,
|
|
||||||
+ const struct spa_pod *format) {
|
|
||||||
BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
|
|
||||||
RTC_DCHECK(that);
|
|
||||||
|
|
||||||
- RTC_LOG(LS_INFO) << "PipeWire stream format changed.";
|
|
||||||
+ RTC_LOG(LS_INFO) << "PipeWire stream param changed.";
|
|
||||||
|
|
||||||
- if (!format) {
|
|
||||||
- pw_stream_finish_format(that->pw_stream_, /*res=*/0, /*params=*/nullptr,
|
|
||||||
- /*n_params=*/0);
|
|
||||||
+ if (!format || id != SPA_PARAM_Format) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- that->spa_video_format_ = new spa_video_info_raw();
|
|
||||||
- spa_format_video_raw_parse(format, that->spa_video_format_,
|
|
||||||
- &that->pw_type_->format_video);
|
|
||||||
+ spa_format_video_raw_parse(format, &that->spa_video_format_);
|
|
||||||
|
|
||||||
- auto width = that->spa_video_format_->size.width;
|
|
||||||
- auto height = that->spa_video_format_->size.height;
|
|
||||||
+ auto width = that->spa_video_format_.size.width;
|
|
||||||
+ auto height = that->spa_video_format_.size.height;
|
|
||||||
auto stride = SPA_ROUND_UP_N(width * kBytesPerPixel, 4);
|
|
||||||
auto size = height * stride;
|
|
||||||
|
|
||||||
+ that->desktop_size_ = DesktopSize(width, height);
|
|
||||||
+
|
|
||||||
uint8_t buffer[1024] = {};
|
|
||||||
auto builder = spa_pod_builder{buffer, sizeof(buffer)};
|
|
||||||
|
|
||||||
// Setup buffers and meta header for new format.
|
|
||||||
- const struct spa_pod* params[2];
|
|
||||||
- params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
|
|
||||||
- &builder,
|
|
||||||
- // id to enumerate buffer requirements
|
|
||||||
- that->pw_core_type_->param.idBuffers,
|
|
||||||
- that->pw_core_type_->param_buffers.Buffers,
|
|
||||||
- // Size: specified as integer (i) and set to specified size
|
|
||||||
- ":", that->pw_core_type_->param_buffers.size, "i", size,
|
|
||||||
- // Stride: specified as integer (i) and set to specified stride
|
|
||||||
- ":", that->pw_core_type_->param_buffers.stride, "i", stride,
|
|
||||||
- // Buffers: specifies how many buffers we want to deal with, set as
|
|
||||||
- // integer (i) where preferred number is 8, then allowed number is defined
|
|
||||||
- // as range (r) from min and max values and it is undecided (u) to allow
|
|
||||||
- // negotiation
|
|
||||||
- ":", that->pw_core_type_->param_buffers.buffers, "iru", 8,
|
|
||||||
- SPA_POD_PROP_MIN_MAX(1, 32),
|
|
||||||
- // Align: memory alignment of the buffer, set as integer (i) to specified
|
|
||||||
- // value
|
|
||||||
- ":", that->pw_core_type_->param_buffers.align, "i", 16));
|
|
||||||
- params[1] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
|
|
||||||
- &builder,
|
|
||||||
- // id to enumerate supported metadata
|
|
||||||
- that->pw_core_type_->param.idMeta, that->pw_core_type_->param_meta.Meta,
|
|
||||||
- // Type: specified as id or enum (I)
|
|
||||||
- ":", that->pw_core_type_->param_meta.type, "I",
|
|
||||||
- that->pw_core_type_->meta.Header,
|
|
||||||
- // Size: size of the metadata, specified as integer (i)
|
|
||||||
- ":", that->pw_core_type_->param_meta.size, "i",
|
|
||||||
- sizeof(struct spa_meta_header)));
|
|
||||||
-
|
|
||||||
- pw_stream_finish_format(that->pw_stream_, /*res=*/0, params, /*n_params=*/2);
|
|
||||||
+ const struct spa_pod* params[3];
|
|
||||||
+ params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
|
||||||
+ SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
|
|
||||||
+ SPA_PARAM_BUFFERS_size, SPA_POD_Int(size),
|
|
||||||
+ SPA_PARAM_BUFFERS_stride, SPA_POD_Int(stride),
|
|
||||||
+ SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(8, 1, 32)));
|
|
||||||
+ params[1] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
|
||||||
+ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
|
|
||||||
+ SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
|
|
||||||
+ SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header))));
|
|
||||||
+ params[2] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
|
||||||
+ SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
|
|
||||||
+ SPA_PARAM_META_type, SPA_POD_Id (SPA_META_VideoCrop),
|
|
||||||
+ SPA_PARAM_META_size, SPA_POD_Int (sizeof(struct spa_meta_region))));
|
|
||||||
+ pw_stream_update_params(that->pw_stream_, params, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
@@ -150,15 +136,25 @@ void BaseCapturerPipeWire::OnStreamProce
|
|
||||||
BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
|
|
||||||
RTC_DCHECK(that);
|
|
||||||
|
|
||||||
- pw_buffer* buf = nullptr;
|
|
||||||
+ struct pw_buffer *next_buffer;
|
|
||||||
+ struct pw_buffer *buffer = nullptr;
|
|
||||||
+
|
|
||||||
+ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_);
|
|
||||||
+ while (next_buffer) {
|
|
||||||
+ buffer = next_buffer;
|
|
||||||
+ next_buffer = pw_stream_dequeue_buffer(that->pw_stream_);
|
|
||||||
+
|
|
||||||
+ if (next_buffer)
|
|
||||||
+ pw_stream_queue_buffer (that->pw_stream_, buffer);
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- if (!(buf = pw_stream_dequeue_buffer(that->pw_stream_))) {
|
|
||||||
+ if (!buffer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- that->HandleBuffer(buf);
|
|
||||||
+ that->HandleBuffer(buffer);
|
|
||||||
|
|
||||||
- pw_stream_queue_buffer(that->pw_stream_, buf);
|
|
||||||
+ pw_stream_queue_buffer(that->pw_stream_, buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseCapturerPipeWire::BaseCapturerPipeWire(CaptureSourceType source_type)
|
|
||||||
@@ -169,38 +165,22 @@ BaseCapturerPipeWire::~BaseCapturerPipeW
|
|
||||||
pw_thread_loop_stop(pw_main_loop_);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (pw_type_) {
|
|
||||||
- delete pw_type_;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (spa_video_format_) {
|
|
||||||
- delete spa_video_format_;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
if (pw_stream_) {
|
|
||||||
pw_stream_destroy(pw_stream_);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (pw_remote_) {
|
|
||||||
- pw_remote_destroy(pw_remote_);
|
|
||||||
+ if (pw_core_) {
|
|
||||||
+ pw_core_disconnect(pw_core_);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (pw_core_) {
|
|
||||||
- pw_core_destroy(pw_core_);
|
|
||||||
+ if (pw_context_) {
|
|
||||||
+ pw_context_destroy(pw_context_);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pw_main_loop_) {
|
|
||||||
pw_thread_loop_destroy(pw_main_loop_);
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (pw_loop_) {
|
|
||||||
- pw_loop_destroy(pw_loop_);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- if (current_frame_) {
|
|
||||||
- free(current_frame_);
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
if (start_request_signal_id_) {
|
|
||||||
g_dbus_connection_signal_unsubscribe(connection_, start_request_signal_id_);
|
|
||||||
}
|
|
||||||
@@ -250,27 +230,35 @@ void BaseCapturerPipeWire::InitPortal()
|
|
||||||
void BaseCapturerPipeWire::InitPipeWire() {
|
|
||||||
pw_init(/*argc=*/nullptr, /*argc=*/nullptr);
|
|
||||||
|
|
||||||
- pw_loop_ = pw_loop_new(/*properties=*/nullptr);
|
|
||||||
- pw_main_loop_ = pw_thread_loop_new(pw_loop_, "pipewire-main-loop");
|
|
||||||
-
|
|
||||||
- pw_core_ = pw_core_new(pw_loop_, /*properties=*/nullptr);
|
|
||||||
- pw_core_type_ = pw_core_get_type(pw_core_);
|
|
||||||
- pw_remote_ = pw_remote_new(pw_core_, nullptr, /*user_data_size=*/0);
|
|
||||||
+ pw_main_loop_ = pw_thread_loop_new("pipewire-main-loop", nullptr);
|
|
||||||
+ pw_context_ = pw_context_new(pw_thread_loop_get_loop(pw_main_loop_), nullptr, 0);
|
|
||||||
+ if (!pw_context_) {
|
|
||||||
+ RTC_LOG(LS_ERROR) << "Failed to create PipeWire context";
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- InitPipeWireTypes();
|
|
||||||
+ pw_core_ = pw_context_connect(pw_context_, nullptr, 0);
|
|
||||||
+ if (!pw_core_) {
|
|
||||||
+ RTC_LOG(LS_ERROR) << "Failed to connect PipeWire context";
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
// Initialize event handlers, remote end and stream-related.
|
|
||||||
- pw_remote_events_.version = PW_VERSION_REMOTE_EVENTS;
|
|
||||||
- pw_remote_events_.state_changed = &OnStateChanged;
|
|
||||||
+ pw_core_events_.version = PW_VERSION_CORE_EVENTS;
|
|
||||||
+ pw_core_events_.error = &OnCoreError;
|
|
||||||
|
|
||||||
pw_stream_events_.version = PW_VERSION_STREAM_EVENTS;
|
|
||||||
pw_stream_events_.state_changed = &OnStreamStateChanged;
|
|
||||||
- pw_stream_events_.format_changed = &OnStreamFormatChanged;
|
|
||||||
+ pw_stream_events_.param_changed = &OnStreamParamChanged;
|
|
||||||
pw_stream_events_.process = &OnStreamProcess;
|
|
||||||
|
|
||||||
- pw_remote_add_listener(pw_remote_, &spa_remote_listener_, &pw_remote_events_,
|
|
||||||
- this);
|
|
||||||
- pw_remote_connect_fd(pw_remote_, pw_fd_);
|
|
||||||
+ pw_core_add_listener(pw_core_, &spa_core_listener_, &pw_core_events_, this);
|
|
||||||
+
|
|
||||||
+ pw_stream_ = CreateReceivingStream();
|
|
||||||
+ if (!pw_stream_) {
|
|
||||||
+ RTC_LOG(LS_ERROR) << "Failed to create PipeWire stream";
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (pw_thread_loop_start(pw_main_loop_) < 0) {
|
|
||||||
RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop";
|
|
||||||
@@ -278,81 +266,132 @@ void BaseCapturerPipeWire::InitPipeWire(
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-void BaseCapturerPipeWire::InitPipeWireTypes() {
|
|
||||||
- spa_type_map* map = pw_core_type_->map;
|
|
||||||
- pw_type_ = new PipeWireType();
|
|
||||||
+pw_stream* BaseCapturerPipeWire::CreateReceivingStream() {
|
|
||||||
+ spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1};
|
|
||||||
+ spa_rectangle pwMaxScreenBounds = spa_rectangle{INT32_MAX, INT32_MAX};
|
|
||||||
|
|
||||||
- spa_type_media_type_map(map, &pw_type_->media_type);
|
|
||||||
- spa_type_media_subtype_map(map, &pw_type_->media_subtype);
|
|
||||||
- spa_type_format_video_map(map, &pw_type_->format_video);
|
|
||||||
- spa_type_video_format_map(map, &pw_type_->video_format);
|
|
||||||
-}
|
|
||||||
+ auto stream = pw_stream_new(pw_core_, "webrtc-pipewire-stream", nullptr);
|
|
||||||
|
|
||||||
-void BaseCapturerPipeWire::CreateReceivingStream() {
|
|
||||||
- spa_rectangle pwMinScreenBounds = spa_rectangle{1, 1};
|
|
||||||
- spa_rectangle pwScreenBounds =
|
|
||||||
- spa_rectangle{static_cast<uint32_t>(desktop_size_.width()),
|
|
||||||
- static_cast<uint32_t>(desktop_size_.height())};
|
|
||||||
-
|
|
||||||
- spa_fraction pwFrameRateMin = spa_fraction{0, 1};
|
|
||||||
- spa_fraction pwFrameRateMax = spa_fraction{60, 1};
|
|
||||||
-
|
|
||||||
- pw_properties* reuseProps = pw_properties_new("pipewire.client.reuse", "1",
|
|
||||||
- /*end of varargs*/ nullptr);
|
|
||||||
- pw_stream_ = pw_stream_new(pw_remote_, "webrtc-consume-stream", reuseProps);
|
|
||||||
+ if (!stream) {
|
|
||||||
+ RTC_LOG(LS_ERROR) << "Could not create receiving stream.";
|
|
||||||
+ return nullptr;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
uint8_t buffer[1024] = {};
|
|
||||||
- const spa_pod* params[1];
|
|
||||||
- spa_pod_builder builder = spa_pod_builder{buffer, sizeof(buffer)};
|
|
||||||
- params[0] = reinterpret_cast<spa_pod*>(spa_pod_builder_object(
|
|
||||||
- &builder,
|
|
||||||
- // id to enumerate formats
|
|
||||||
- pw_core_type_->param.idEnumFormat, pw_core_type_->spa_format, "I",
|
|
||||||
- pw_type_->media_type.video, "I", pw_type_->media_subtype.raw,
|
|
||||||
- // Video format: specified as id or enum (I), preferred format is BGRx,
|
|
||||||
- // then allowed formats are enumerated (e) and the format is undecided (u)
|
|
||||||
- // to allow negotiation
|
|
||||||
- ":", pw_type_->format_video.format, "Ieu", pw_type_->video_format.BGRx,
|
|
||||||
- SPA_POD_PROP_ENUM(2, pw_type_->video_format.RGBx,
|
|
||||||
- pw_type_->video_format.BGRx),
|
|
||||||
- // Video size: specified as rectangle (R), preferred size is specified as
|
|
||||||
- // first parameter, then allowed size is defined as range (r) from min and
|
|
||||||
- // max values and the format is undecided (u) to allow negotiation
|
|
||||||
- ":", pw_type_->format_video.size, "Rru", &pwScreenBounds, 2,
|
|
||||||
- &pwMinScreenBounds, &pwScreenBounds,
|
|
||||||
- // Frame rate: specified as fraction (F) and set to minimum frame rate
|
|
||||||
- // value
|
|
||||||
- ":", pw_type_->format_video.framerate, "F", &pwFrameRateMin,
|
|
||||||
- // Max frame rate: specified as fraction (F), preferred frame rate is set
|
|
||||||
- // to maximum value, then allowed frame rate is defined as range (r) from
|
|
||||||
- // min and max values and it is undecided (u) to allow negotiation
|
|
||||||
- ":", pw_type_->format_video.max_framerate, "Fru", &pwFrameRateMax, 2,
|
|
||||||
- &pwFrameRateMin, &pwFrameRateMax));
|
|
||||||
+ const spa_pod* params[2];
|
|
||||||
+ spa_pod_builder builder = SPA_POD_BUILDER_INIT(buffer, sizeof (buffer));
|
|
||||||
+
|
|
||||||
+ params[0] = reinterpret_cast<spa_pod *>(spa_pod_builder_add_object(&builder,
|
|
||||||
+ SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
|
|
||||||
+ SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
|
|
||||||
+ SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
|
|
||||||
+ SPA_FORMAT_VIDEO_format, SPA_POD_CHOICE_ENUM_Id(5, SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_RGBx, SPA_VIDEO_FORMAT_RGBA,
|
|
||||||
+ SPA_VIDEO_FORMAT_BGRx, SPA_VIDEO_FORMAT_BGRA),
|
|
||||||
+ SPA_FORMAT_VIDEO_size, SPA_POD_CHOICE_RANGE_Rectangle(&pwMinScreenBounds,
|
|
||||||
+ &pwMinScreenBounds,
|
|
||||||
+ &pwMaxScreenBounds),
|
|
||||||
+ 0));
|
|
||||||
+ pw_stream_add_listener(stream, &spa_stream_listener_, &pw_stream_events_, this);
|
|
||||||
|
|
||||||
- pw_stream_add_listener(pw_stream_, &spa_stream_listener_, &pw_stream_events_,
|
|
||||||
- this);
|
|
||||||
pw_stream_flags flags = static_cast<pw_stream_flags>(
|
|
||||||
- PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE |
|
|
||||||
- PW_STREAM_FLAG_MAP_BUFFERS);
|
|
||||||
- if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr,
|
|
||||||
- flags, params,
|
|
||||||
- /*n_params=*/1) != 0) {
|
|
||||||
+ PW_STREAM_FLAG_AUTOCONNECT | PW_STREAM_FLAG_INACTIVE);
|
|
||||||
+
|
|
||||||
+ if (pw_stream_connect(stream, PW_DIRECTION_INPUT, pw_stream_node_id_, PW_STREAM_FLAG_AUTOCONNECT, params, 1) != 0) {
|
|
||||||
RTC_LOG(LS_ERROR) << "Could not connect receiving stream.";
|
|
||||||
portal_init_failed_ = true;
|
|
||||||
- return;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseCapturerPipeWire::HandleBuffer(pw_buffer* buffer) {
|
|
||||||
+ struct spa_meta_region* video_crop;
|
|
||||||
spa_buffer* spaBuffer = buffer->buffer;
|
|
||||||
- void* src = nullptr;
|
|
||||||
+ uint8_t *map = nullptr;
|
|
||||||
+ uint8_t* src = nullptr;
|
|
||||||
+ uint8_t* dst = nullptr;
|
|
||||||
+
|
|
||||||
+ if (spaBuffer->datas[0].chunk->size == 0) {
|
|
||||||
+ map = nullptr;
|
|
||||||
+ src = nullptr;
|
|
||||||
+ } else if (spaBuffer->datas[0].type == SPA_DATA_MemFd) {
|
|
||||||
+ map = static_cast<uint8_t*>(mmap(
|
|
||||||
+ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
|
|
||||||
+ PROT_READ, MAP_PRIVATE, spaBuffer->datas[0].fd, 0));
|
|
||||||
+
|
|
||||||
+ if (map == MAP_FAILED) {
|
|
||||||
+ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
|
|
||||||
+ } else if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) {
|
|
||||||
+ int fd;
|
|
||||||
+ fd = spaBuffer->datas[0].fd;
|
|
||||||
+
|
|
||||||
+ map = static_cast<uint8_t*>(mmap(
|
|
||||||
+ nullptr, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset,
|
|
||||||
+ PROT_READ, MAP_PRIVATE, fd, 0));
|
|
||||||
+
|
|
||||||
+ if (map == MAP_FAILED) {
|
|
||||||
+ RTC_LOG(LS_ERROR) << "Failed to mmap the memory: " << std::strerror(errno);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- if (!(src = spaBuffer->datas[0].data)) {
|
|
||||||
+ SyncDmaBuf(fd, DMA_BUF_SYNC_START);
|
|
||||||
+
|
|
||||||
+ src = SPA_MEMBER(map, spaBuffer->datas[0].mapoffset, uint8_t);
|
|
||||||
+ } else if (spaBuffer->datas[0].type == SPA_DATA_MemPtr) {
|
|
||||||
+ map = nullptr;
|
|
||||||
+ src = static_cast<uint8_t*>(spaBuffer->datas[0].data);
|
|
||||||
+ } else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- uint32_t maxSize = spaBuffer->datas[0].maxsize;
|
|
||||||
- int32_t srcStride = spaBuffer->datas[0].chunk->stride;
|
|
||||||
+ if (!src) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ DesktopSize prev_crop_size = DesktopSize(0, 0);
|
|
||||||
+ if (video_crop_size_initialized_) {
|
|
||||||
+ prev_crop_size = video_crop_size_;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if ((video_crop = static_cast<struct spa_meta_region*>(
|
|
||||||
+ spa_buffer_find_meta_data(spaBuffer, SPA_META_VideoCrop, sizeof(*video_crop))))) {
|
|
||||||
+ RTC_DCHECK(video_crop->region.size.width <= desktop_size_.width() &&
|
|
||||||
+ video_crop->region.size.height <= desktop_size_.height());
|
|
||||||
+ if ((video_crop->region.size.width != desktop_size_.width() ||
|
|
||||||
+ video_crop->region.size.height != desktop_size_.height()) && video_crop->region.size.width && video_crop->region.size.height) {
|
|
||||||
+ video_crop_size_ = DesktopSize(video_crop->region.size.width, video_crop->region.size.height);
|
|
||||||
+ video_crop_size_initialized_ = true;
|
|
||||||
+ } else {
|
|
||||||
+ video_crop_size_initialized_ = false;
|
|
||||||
+ }
|
|
||||||
+ } else {
|
|
||||||
+ video_crop_size_initialized_ = false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ size_t frame_size;
|
|
||||||
+ if (video_crop_size_initialized_) {
|
|
||||||
+ frame_size =
|
|
||||||
+ video_crop_size_.width() * video_crop_size_.height() * kBytesPerPixel;
|
|
||||||
+ } else {
|
|
||||||
+ frame_size =
|
|
||||||
+ desktop_size_.width() * desktop_size_.height() * kBytesPerPixel;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!current_frame_ ||
|
|
||||||
+ (video_crop_size_initialized_ && !video_crop_size_.equals(prev_crop_size))) {
|
|
||||||
+ current_frame_ = std::make_unique<uint8_t[]>(frame_size);
|
|
||||||
+ }
|
|
||||||
+ RTC_DCHECK(current_frame_ != nullptr);
|
|
||||||
+
|
|
||||||
+ const int32_t dstStride = video_crop_size_initialized_
|
|
||||||
+ ? video_crop_size_.width() * kBytesPerPixel
|
|
||||||
+ : desktop_size_.width() * kBytesPerPixel;
|
|
||||||
+ const int32_t srcStride = spaBuffer->datas[0].chunk->stride;
|
|
||||||
+
|
|
||||||
if (srcStride != (desktop_size_.width() * kBytesPerPixel)) {
|
|
||||||
RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: "
|
|
||||||
<< srcStride
|
|
||||||
@@ -361,21 +400,40 @@ void BaseCapturerPipeWire::HandleBuffer(
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (!current_frame_) {
|
|
||||||
- current_frame_ = static_cast<uint8_t*>(malloc(maxSize));
|
|
||||||
+ dst = current_frame_.get();
|
|
||||||
+
|
|
||||||
+ // Adjust source content based on crop video position
|
|
||||||
+ if (video_crop_size_initialized_ &&
|
|
||||||
+ (video_crop->region.position.y + video_crop_size_.height() <= desktop_size_.height())) {
|
|
||||||
+ for (int i = 0; i < video_crop->region.position.y; ++i) {
|
|
||||||
+ src += srcStride;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ const int xOffset =
|
|
||||||
+ video_crop_size_initialized_ && (video_crop->region.position.x + video_crop_size_.width() <=
|
|
||||||
+ desktop_size_.width())
|
|
||||||
+ ? video_crop->region.position.x * kBytesPerPixel
|
|
||||||
+ : 0;
|
|
||||||
+ const int height = video_crop_size_initialized_ ? video_crop_size_.height() : desktop_size_.height();
|
|
||||||
+ for (int i = 0; i < height; ++i) {
|
|
||||||
+ // Adjust source content based on crop video position if needed
|
|
||||||
+ src += xOffset;
|
|
||||||
+ std::memcpy(dst, src, dstStride);
|
|
||||||
+ // If both sides decided to go with the RGBx format we need to convert it to
|
|
||||||
+ // BGRx to match color format expected by WebRTC.
|
|
||||||
+ if (spa_video_format_.format == SPA_VIDEO_FORMAT_RGBx ||
|
|
||||||
+ spa_video_format_.format == SPA_VIDEO_FORMAT_RGBA) {
|
|
||||||
+ ConvertRGBxToBGRx(dst, dstStride);
|
|
||||||
+ }
|
|
||||||
+ src += srcStride - xOffset;
|
|
||||||
+ dst += dstStride;
|
|
||||||
}
|
|
||||||
- RTC_DCHECK(current_frame_ != nullptr);
|
|
||||||
|
|
||||||
- // If both sides decided to go with the RGBx format we need to convert it to
|
|
||||||
- // BGRx to match color format expected by WebRTC.
|
|
||||||
- if (spa_video_format_->format == pw_type_->video_format.RGBx) {
|
|
||||||
- uint8_t* tempFrame = static_cast<uint8_t*>(malloc(maxSize));
|
|
||||||
- std::memcpy(tempFrame, src, maxSize);
|
|
||||||
- ConvertRGBxToBGRx(tempFrame, maxSize);
|
|
||||||
- std::memcpy(current_frame_, tempFrame, maxSize);
|
|
||||||
- free(tempFrame);
|
|
||||||
- } else {
|
|
||||||
- std::memcpy(current_frame_, src, maxSize);
|
|
||||||
+ if (map) {
|
|
||||||
+ if (spaBuffer->datas[0].type == SPA_DATA_DmaBuf) {
|
|
||||||
+ SyncDmaBuf(spaBuffer->datas[0].fd, DMA_BUF_SYNC_END);
|
|
||||||
+ }
|
|
||||||
+ munmap(map, spaBuffer->datas[0].maxsize + spaBuffer->datas[0].mapoffset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -725,10 +783,7 @@ void BaseCapturerPipeWire::OnStartReques
|
|
||||||
g_variant_get(variant, "(u@a{sv})", &stream_id, &options);
|
|
||||||
RTC_DCHECK(options != nullptr);
|
|
||||||
|
|
||||||
- g_variant_lookup(options, "size", "(ii)", &width, &height);
|
|
||||||
-
|
|
||||||
- that->desktop_size_.set(width, height);
|
|
||||||
-
|
|
||||||
+ that->pw_stream_node_id_ = stream_id;
|
|
||||||
g_variant_unref(options);
|
|
||||||
g_variant_unref(variant);
|
|
||||||
}
|
|
||||||
@@ -813,10 +868,15 @@ void BaseCapturerPipeWire::CaptureFrame(
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
- std::unique_ptr<DesktopFrame> result(new BasicDesktopFrame(desktop_size_));
|
|
||||||
+ DesktopSize frame_size = desktop_size_;
|
|
||||||
+ if (video_crop_size_initialized_) {
|
|
||||||
+ frame_size = video_crop_size_;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ std::unique_ptr<DesktopFrame> result(new BasicDesktopFrame(frame_size));
|
|
||||||
result->CopyPixelsFrom(
|
|
||||||
- current_frame_, (desktop_size_.width() * kBytesPerPixel),
|
|
||||||
- DesktopRect::MakeWH(desktop_size_.width(), desktop_size_.height()));
|
|
||||||
+ current_frame_.get(), (frame_size.width() * kBytesPerPixel),
|
|
||||||
+ DesktopRect::MakeWH(frame_size.width(), frame_size.height()));
|
|
||||||
if (!result) {
|
|
||||||
callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
|
|
||||||
return;
|
|
||||||
@@ -837,4 +897,22 @@ bool BaseCapturerPipeWire::SelectSource(
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
+// static
|
|
||||||
+std::unique_ptr<DesktopCapturer>
|
|
||||||
+BaseCapturerPipeWire::CreateRawScreenCapturer(
|
|
||||||
+ const DesktopCaptureOptions& options) {
|
|
||||||
+ std::unique_ptr<BaseCapturerPipeWire> capturer =
|
|
||||||
+ std::make_unique<BaseCapturerPipeWire>(BaseCapturerPipeWire::CaptureSourceType::kAny);
|
|
||||||
+ return std::move(capturer);}
|
|
||||||
+
|
|
||||||
+// static
|
|
||||||
+std::unique_ptr<DesktopCapturer>
|
|
||||||
+BaseCapturerPipeWire::CreateRawWindowCapturer(
|
|
||||||
+ const DesktopCaptureOptions& options) {
|
|
||||||
+
|
|
||||||
+ std::unique_ptr<BaseCapturerPipeWire> capturer =
|
|
||||||
+ std::make_unique<BaseCapturerPipeWire>(BaseCapturerPipeWire::CaptureSourceType::kAny);
|
|
||||||
+ return std::move(capturer);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
} // namespace webrtc
|
|
||||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h
|
|
||||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h.firefox-pipewire-0-3 2020-07-20 22:54:40.000000000 +0200
|
|
||||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/base_capturer_pipewire.h 2020-07-28 10:06:59.501481508 +0200
|
|
||||||
@@ -22,17 +22,13 @@
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
-class PipeWireType {
|
|
||||||
- public:
|
|
||||||
- spa_type_media_type media_type;
|
|
||||||
- spa_type_media_subtype media_subtype;
|
|
||||||
- spa_type_format_video format_video;
|
|
||||||
- spa_type_video_format video_format;
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
class BaseCapturerPipeWire : public DesktopCapturer {
|
|
||||||
public:
|
|
||||||
- enum CaptureSourceType { Screen = 1, Window };
|
|
||||||
+ enum CaptureSourceType : uint32_t {
|
|
||||||
+ kScreen = 0b01,
|
|
||||||
+ kWindow = 0b10,
|
|
||||||
+ kAny = 0b11
|
|
||||||
+ };
|
|
||||||
|
|
||||||
explicit BaseCapturerPipeWire(CaptureSourceType source_type);
|
|
||||||
~BaseCapturerPipeWire() override;
|
|
||||||
@@ -43,28 +39,32 @@ class BaseCapturerPipeWire : public Desk
|
|
||||||
bool GetSourceList(SourceList* sources) override;
|
|
||||||
bool SelectSource(SourceId id) override;
|
|
||||||
|
|
||||||
+ static std::unique_ptr<DesktopCapturer> CreateRawScreenCapturer(
|
|
||||||
+ const DesktopCaptureOptions& options);
|
|
||||||
+
|
|
||||||
+ static std::unique_ptr<DesktopCapturer> CreateRawWindowCapturer(
|
|
||||||
+ const DesktopCaptureOptions& options);
|
|
||||||
+
|
|
||||||
private:
|
|
||||||
// PipeWire types -->
|
|
||||||
+ pw_context* pw_context_ = nullptr;
|
|
||||||
pw_core* pw_core_ = nullptr;
|
|
||||||
- pw_type* pw_core_type_ = nullptr;
|
|
||||||
pw_stream* pw_stream_ = nullptr;
|
|
||||||
- pw_remote* pw_remote_ = nullptr;
|
|
||||||
- pw_loop* pw_loop_ = nullptr;
|
|
||||||
pw_thread_loop* pw_main_loop_ = nullptr;
|
|
||||||
- PipeWireType* pw_type_ = nullptr;
|
|
||||||
|
|
||||||
+ spa_hook spa_core_listener_ = {};
|
|
||||||
spa_hook spa_stream_listener_ = {};
|
|
||||||
- spa_hook spa_remote_listener_ = {};
|
|
||||||
|
|
||||||
+ pw_core_events pw_core_events_ = {};
|
|
||||||
pw_stream_events pw_stream_events_ = {};
|
|
||||||
- pw_remote_events pw_remote_events_ = {};
|
|
||||||
|
|
||||||
- spa_video_info_raw* spa_video_format_ = nullptr;
|
|
||||||
+ struct spa_video_info_raw spa_video_format_;
|
|
||||||
|
|
||||||
+ guint32 pw_stream_node_id_ = 0;
|
|
||||||
gint32 pw_fd_ = -1;
|
|
||||||
|
|
||||||
CaptureSourceType capture_source_type_ =
|
|
||||||
- BaseCapturerPipeWire::CaptureSourceType::Screen;
|
|
||||||
+ BaseCapturerPipeWire::CaptureSourceType::kAny;
|
|
||||||
|
|
||||||
// <-- end of PipeWire types
|
|
||||||
|
|
||||||
@@ -78,33 +78,37 @@ class BaseCapturerPipeWire : public Desk
|
|
||||||
guint sources_request_signal_id_ = 0;
|
|
||||||
guint start_request_signal_id_ = 0;
|
|
||||||
|
|
||||||
+ bool video_crop_size_initialized_ = false;
|
|
||||||
+ DesktopSize video_crop_size_;;
|
|
||||||
DesktopSize desktop_size_ = {};
|
|
||||||
DesktopCaptureOptions options_ = {};
|
|
||||||
|
|
||||||
- uint8_t* current_frame_ = nullptr;
|
|
||||||
+ std::unique_ptr<uint8_t[]> current_frame_;
|
|
||||||
Callback* callback_ = nullptr;
|
|
||||||
|
|
||||||
bool portal_init_failed_ = false;
|
|
||||||
|
|
||||||
void InitPortal();
|
|
||||||
void InitPipeWire();
|
|
||||||
- void InitPipeWireTypes();
|
|
||||||
|
|
||||||
- void CreateReceivingStream();
|
|
||||||
+ pw_stream* CreateReceivingStream();
|
|
||||||
void HandleBuffer(pw_buffer* buffer);
|
|
||||||
|
|
||||||
void ConvertRGBxToBGRx(uint8_t* frame, uint32_t size);
|
|
||||||
|
|
||||||
- static void OnStateChanged(void* data,
|
|
||||||
- pw_remote_state old_state,
|
|
||||||
- pw_remote_state state,
|
|
||||||
- const char* error);
|
|
||||||
+ static void SyncDmaBuf(int fd, uint64_t start_or_end);
|
|
||||||
+ static void OnCoreError(void *data,
|
|
||||||
+ uint32_t id,
|
|
||||||
+ int seq,
|
|
||||||
+ int res,
|
|
||||||
+ const char *message);
|
|
||||||
+ static void OnStreamParamChanged(void *data,
|
|
||||||
+ uint32_t id,
|
|
||||||
+ const struct spa_pod *format);
|
|
||||||
static void OnStreamStateChanged(void* data,
|
|
||||||
pw_stream_state old_state,
|
|
||||||
pw_stream_state state,
|
|
||||||
const char* error_message);
|
|
||||||
-
|
|
||||||
- static void OnStreamFormatChanged(void* data, const struct spa_pod* format);
|
|
||||||
static void OnStreamProcess(void* data);
|
|
||||||
static void OnNewBuffer(void* data, uint32_t id);
|
|
||||||
|
|
||||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc
|
|
||||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc.firefox-pipewire-0-3 2020-07-20 22:53:57.000000000 +0200
|
|
||||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/screen_capturer_pipewire.cc 2020-07-28 10:06:59.501481508 +0200
|
|
||||||
@@ -15,7 +15,7 @@
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
ScreenCapturerPipeWire::ScreenCapturerPipeWire()
|
|
||||||
- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Screen) {}
|
|
||||||
+ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kScreen) {}
|
|
||||||
ScreenCapturerPipeWire::~ScreenCapturerPipeWire() {}
|
|
||||||
|
|
||||||
// static
|
|
||||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc
|
|
||||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc.firefox-pipewire-0-3 2020-07-20 22:54:18.000000000 +0200
|
|
||||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/linux/window_capturer_pipewire.cc 2020-07-28 10:06:59.501481508 +0200
|
|
||||||
@@ -15,7 +15,7 @@
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
WindowCapturerPipeWire::WindowCapturerPipeWire()
|
|
||||||
- : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::Window) {}
|
|
||||||
+ : BaseCapturerPipeWire(BaseCapturerPipeWire::CaptureSourceType::kWindow) {}
|
|
||||||
WindowCapturerPipeWire::~WindowCapturerPipeWire() {}
|
|
||||||
|
|
||||||
// static
|
|
||||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
|
|
||||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire-0-3 2020-07-20 22:54:40.000000000 +0200
|
|
||||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc 2020-07-28 10:06:59.501481508 +0200
|
|
||||||
@@ -26,7 +26,7 @@ std::unique_ptr<DesktopCapturer> Desktop
|
|
||||||
const DesktopCaptureOptions& options) {
|
|
||||||
#if defined(WEBRTC_USE_PIPEWIRE)
|
|
||||||
if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
|
|
||||||
- return ScreenCapturerPipeWire::CreateRawScreenCapturer(options);
|
|
||||||
+ return BaseCapturerPipeWire::CreateRawScreenCapturer(options);
|
|
||||||
}
|
|
||||||
#endif // defined(WEBRTC_USE_PIPEWIRE)
|
|
||||||
|
|
||||||
diff -up firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-3 firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
|
|
||||||
--- firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire-0-3 2020-07-20 22:53:32.000000000 +0200
|
|
||||||
+++ firefox-79.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc 2020-07-28 10:06:59.501481508 +0200
|
|
||||||
@@ -26,7 +26,7 @@ std::unique_ptr<DesktopCapturer> Desktop
|
|
||||||
const DesktopCaptureOptions& options) {
|
|
||||||
#if defined(WEBRTC_USE_PIPEWIRE)
|
|
||||||
if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
|
|
||||||
- return WindowCapturerPipeWire::CreateRawWindowCapturer(options);
|
|
||||||
+ return BaseCapturerPipeWire::CreateRawWindowCapturer(options);
|
|
||||||
}
|
|
||||||
#endif // defined(WEBRTC_USE_PIPEWIRE)
|
|
||||||
|
|
||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 2.2 KiB |
14
firefox-tests-xpcshell-freeze.patch
Normal file
14
firefox-tests-xpcshell-freeze.patch
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
diff -up firefox-88.0/testing/xpcshell/runxpcshelltests.py.old firefox-88.0/testing/xpcshell/runxpcshelltests.py
|
||||||
|
--- firefox-88.0/testing/xpcshell/runxpcshelltests.py.old 2021-04-30 10:45:14.466616224 +0200
|
||||||
|
+++ firefox-88.0/testing/xpcshell/runxpcshelltests.py 2021-04-30 10:45:21.339525085 +0200
|
||||||
|
@@ -1382,8 +1382,8 @@ class XPCShellTests(object):
|
||||||
|
self.log.info("Process %s" % label)
|
||||||
|
self.log.info(msg)
|
||||||
|
|
||||||
|
- dumpOutput(proc.stdout, "stdout")
|
||||||
|
- dumpOutput(proc.stderr, "stderr")
|
||||||
|
+ #dumpOutput(proc.stdout, "stdout")
|
||||||
|
+ #dumpOutput(proc.stderr, "stderr")
|
||||||
|
self.nodeProc = {}
|
||||||
|
|
||||||
|
def startHttp3Server(self):
|
||||||
@ -1,14 +0,0 @@
|
|||||||
diff -up firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp.old firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
|
||||||
--- firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp.old 2020-05-13 14:28:26.556800474 +0200
|
|
||||||
+++ firefox-76.0.1/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp 2020-05-13 14:28:31.562768959 +0200
|
|
||||||
@@ -43,7 +43,7 @@ typedef int VAStatus;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Use some extra HW frames for potential rendering lags.
|
|
||||||
-#define EXTRA_HW_FRAMES 6
|
|
||||||
+#define EXTRA_HW_FRAMES 20
|
|
||||||
|
|
||||||
typedef mozilla::layers::Image Image;
|
|
||||||
typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage;
|
|
||||||
diff -up firefox-76.0.1/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-76.0.1/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium
|
|
||||||
diff -up firefox-76.0.1/media/webrtc/trunk/Makefile.old firefox-76.0.1/media/webrtc/trunk/Makefile
|
|
||||||
@ -1,235 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Version=1.0
|
|
||||||
Name=Firefox on Wayland
|
|
||||||
GenericName=Web Browser
|
|
||||||
Comment=Browse the Web
|
|
||||||
Exec=firefox-wayland --name firefox-wayland %u
|
|
||||||
Icon=firefox
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
|
|
||||||
StartupNotify=true
|
|
||||||
Categories=Network;WebBrowser;
|
|
||||||
Keywords=web;browser;internet;
|
|
||||||
Actions=new-window;new-private-window;profile-manager-window;
|
|
||||||
|
|
||||||
[Desktop Action new-window]
|
|
||||||
Name=Open a New Window
|
|
||||||
Name[ach]=Dirica manyen
|
|
||||||
Name[af]=Nuwe venster
|
|
||||||
Name[an]=Nueva finestra
|
|
||||||
Name[ar]=نافذة جديدة
|
|
||||||
Name[as]=নতুন উইন্ডো
|
|
||||||
Name[ast]=Ventana nueva
|
|
||||||
Name[az]=Yeni Pəncərə
|
|
||||||
Name[be]=Новае акно
|
|
||||||
Name[bg]=Нов прозорец
|
|
||||||
Name[bn_BD]=নতুন উইন্ডো (N)
|
|
||||||
Name[bn_IN]=নতুন উইন্ডো
|
|
||||||
Name[br]=Prenestr nevez
|
|
||||||
Name[brx]=गोदान उइन्ड'(N)
|
|
||||||
Name[bs]=Novi prozor
|
|
||||||
Name[ca]=Finestra nova
|
|
||||||
Name[cak]=K'ak'a' tzuwäch
|
|
||||||
Name[cs]=Nové okno
|
|
||||||
Name[cy]=Ffenestr Newydd
|
|
||||||
Name[da]=Nyt vindue
|
|
||||||
Name[de]=Neues Fenster
|
|
||||||
Name[dsb]=Nowe wokno
|
|
||||||
Name[el]=Νέο παράθυρο
|
|
||||||
Name[en_GB]=New Window
|
|
||||||
Name[en_US]=New Window
|
|
||||||
Name[en_ZA]=New Window
|
|
||||||
Name[eo]=Nova fenestro
|
|
||||||
Name[es_AR]=Nueva ventana
|
|
||||||
Name[es_CL]=Nueva ventana
|
|
||||||
Name[es_ES]=Nueva ventana
|
|
||||||
Name[es_MX]=Nueva ventana
|
|
||||||
Name[et]=Uus aken
|
|
||||||
Name[eu]=Leiho berria
|
|
||||||
Name[fa]=پنجره جدید
|
|
||||||
Name[ff]=Henorde Hesere
|
|
||||||
Name[fi]=Uusi ikkuna
|
|
||||||
Name[fr]=Nouvelle fenêtre
|
|
||||||
Name[fy_NL]=Nij finster
|
|
||||||
Name[ga_IE]=Fuinneog Nua
|
|
||||||
Name[gd]=Uinneag ùr
|
|
||||||
Name[gl]=Nova xanela
|
|
||||||
Name[gn]=Ovetã pyahu
|
|
||||||
Name[gu_IN]=નવી વિન્ડો
|
|
||||||
Name[he]=חלון חדש
|
|
||||||
Name[hi_IN]=नया विंडो
|
|
||||||
Name[hr]=Novi prozor
|
|
||||||
Name[hsb]=Nowe wokno
|
|
||||||
Name[hu]=Új ablak
|
|
||||||
Name[hy_AM]=Նոր Պատուհան
|
|
||||||
Name[id]=Jendela Baru
|
|
||||||
Name[is]=Nýr gluggi
|
|
||||||
Name[it]=Nuova finestra
|
|
||||||
Name[ja]=新しいウィンドウ
|
|
||||||
Name[ja_JP-mac]=新規ウインドウ
|
|
||||||
Name[ka]=ახალი ფანჯარა
|
|
||||||
Name[kk]=Жаңа терезе
|
|
||||||
Name[km]=បង្អួចថ្មី
|
|
||||||
Name[kn]=ಹೊಸ ಕಿಟಕಿ
|
|
||||||
Name[ko]=새 창
|
|
||||||
Name[kok]=नवें जनेल
|
|
||||||
Name[ks]=نئئ وِنڈو
|
|
||||||
Name[lij]=Neuvo barcon
|
|
||||||
Name[lo]=ຫນ້າຕ່າງໃຫມ່
|
|
||||||
Name[lt]=Naujas langas
|
|
||||||
Name[ltg]=Jauns lūgs
|
|
||||||
Name[lv]=Jauns logs
|
|
||||||
Name[mai]=नव विंडो
|
|
||||||
Name[mk]=Нов прозорец
|
|
||||||
Name[ml]=പുതിയ ജാലകം
|
|
||||||
Name[mr]=नवीन पटल
|
|
||||||
Name[ms]=Tetingkap Baru
|
|
||||||
Name[my]=ဝင်းဒိုးအသစ်
|
|
||||||
Name[nb_NO]=Nytt vindu
|
|
||||||
Name[ne_NP]=नयाँ सञ्झ्याल
|
|
||||||
Name[nl]=Nieuw venster
|
|
||||||
Name[nn_NO]=Nytt vindauge
|
|
||||||
Name[or]=ନୂତନ ୱିଣ୍ଡୋ
|
|
||||||
Name[pa_IN]=ਨਵੀਂ ਵਿੰਡੋ
|
|
||||||
Name[pl]=Nowe okno
|
|
||||||
Name[pt_BR]=Nova janela
|
|
||||||
Name[pt_PT]=Nova janela
|
|
||||||
Name[rm]=Nova fanestra
|
|
||||||
Name[ro]=Fereastră nouă
|
|
||||||
Name[ru]=Новое окно
|
|
||||||
Name[sat]=नावा विंडो (N)
|
|
||||||
Name[si]=නව කවුළුවක්
|
|
||||||
Name[sk]=Nové okno
|
|
||||||
Name[sl]=Novo okno
|
|
||||||
Name[son]=Zanfun taaga
|
|
||||||
Name[sq]=Dritare e Re
|
|
||||||
Name[sr]=Нови прозор
|
|
||||||
Name[sv_SE]=Nytt fönster
|
|
||||||
Name[ta]=புதிய சாளரம்
|
|
||||||
Name[te]=కొత్త విండో
|
|
||||||
Name[th]=หน้าต่างใหม่
|
|
||||||
Name[tr]=Yeni pencere
|
|
||||||
Name[tsz]=Eraatarakua jimpani
|
|
||||||
Name[uk]=Нове вікно
|
|
||||||
Name[ur]=نیا دریچہ
|
|
||||||
Name[uz]=Yangi oyna
|
|
||||||
Name[vi]=Cửa sổ mới
|
|
||||||
Name[wo]=Palanteer bu bees
|
|
||||||
Name[xh]=Ifestile entsha
|
|
||||||
Name[zh_CN]=新建窗口
|
|
||||||
Name[zh_TW]=開新視窗
|
|
||||||
Exec=firefox-wayland --name firefox-wayland --new-window %u
|
|
||||||
|
|
||||||
[Desktop Action new-private-window]
|
|
||||||
Name=Open a New Private Window
|
|
||||||
Name[ach]=Dirica manyen me mung
|
|
||||||
Name[af]=Nuwe privaatvenster
|
|
||||||
Name[an]=Nueva finestra privada
|
|
||||||
Name[ar]=نافذة خاصة جديدة
|
|
||||||
Name[as]=নতুন ব্যক্তিগত উইন্ডো
|
|
||||||
Name[ast]=Ventana privada nueva
|
|
||||||
Name[az]=Yeni Məxfi Pəncərə
|
|
||||||
Name[be]=Новае акно адасаблення
|
|
||||||
Name[bg]=Нов прозорец за поверително сърфиране
|
|
||||||
Name[bn_BD]=নতুন ব্যক্তিগত উইন্ডো
|
|
||||||
Name[bn_IN]=নতুন ব্যক্তিগত উইন্ডো
|
|
||||||
Name[br]=Prenestr merdeiñ prevez nevez
|
|
||||||
Name[brx]=गोदान प्राइभेट उइन्ड'
|
|
||||||
Name[bs]=Novi privatni prozor
|
|
||||||
Name[ca]=Finestra privada nova
|
|
||||||
Name[cak]=K'ak'a' ichinan tzuwäch
|
|
||||||
Name[cs]=Nové anonymní okno
|
|
||||||
Name[cy]=Ffenestr Breifat Newydd
|
|
||||||
Name[da]=Nyt privat vindue
|
|
||||||
Name[de]=Neues privates Fenster
|
|
||||||
Name[dsb]=Nowe priwatne wokno
|
|
||||||
Name[el]=Νέο παράθυρο ιδιωτικής περιήγησης
|
|
||||||
Name[en_GB]=New Private Window
|
|
||||||
Name[en_US]=New Private Window
|
|
||||||
Name[en_ZA]=New Private Window
|
|
||||||
Name[eo]=Nova privata fenestro
|
|
||||||
Name[es_AR]=Nueva ventana privada
|
|
||||||
Name[es_CL]=Nueva ventana privada
|
|
||||||
Name[es_ES]=Nueva ventana privada
|
|
||||||
Name[es_MX]=Nueva ventana privada
|
|
||||||
Name[et]=Uus privaatne aken
|
|
||||||
Name[eu]=Leiho pribatu berria
|
|
||||||
Name[fa]=پنجره ناشناس جدید
|
|
||||||
Name[ff]=Henorde Suturo Hesere
|
|
||||||
Name[fi]=Uusi yksityinen ikkuna
|
|
||||||
Name[fr]=Nouvelle fenêtre de navigation privée
|
|
||||||
Name[fy_NL]=Nij priveefinster
|
|
||||||
Name[ga_IE]=Fuinneog Nua Phríobháideach
|
|
||||||
Name[gd]=Uinneag phrìobhaideach ùr
|
|
||||||
Name[gl]=Nova xanela privada
|
|
||||||
Name[gn]=Ovetã ñemi pyahu
|
|
||||||
Name[gu_IN]=નવી ખાનગી વિન્ડો
|
|
||||||
Name[he]=חלון פרטי חדש
|
|
||||||
Name[hi_IN]=नयी निजी विंडो
|
|
||||||
Name[hr]=Novi privatni prozor
|
|
||||||
Name[hsb]=Nowe priwatne wokno
|
|
||||||
Name[hu]=Új privát ablak
|
|
||||||
Name[hy_AM]=Սկսել Գաղտնի դիտարկում
|
|
||||||
Name[id]=Jendela Mode Pribadi Baru
|
|
||||||
Name[is]=Nýr huliðsgluggi
|
|
||||||
Name[it]=Nuova finestra anonima
|
|
||||||
Name[ja]=新しいプライベートウィンドウ
|
|
||||||
Name[ja_JP-mac]=新規プライベートウインドウ
|
|
||||||
Name[ka]=ახალი პირადი ფანჯარა
|
|
||||||
Name[kk]=Жаңа жекелік терезе
|
|
||||||
Name[km]=បង្អួចឯកជនថ្មី
|
|
||||||
Name[kn]=ಹೊಸ ಖಾಸಗಿ ಕಿಟಕಿ
|
|
||||||
Name[ko]=새 사생활 보호 모드
|
|
||||||
Name[kok]=नवो खाजगी विंडो
|
|
||||||
Name[ks]=نْو پرایوٹ وینڈو&
|
|
||||||
Name[lij]=Neuvo barcon privou
|
|
||||||
Name[lo]=ເປີດຫນ້າຕ່າງສວນຕົວຂື້ນມາໃຫມ່
|
|
||||||
Name[lt]=Naujas privataus naršymo langas
|
|
||||||
Name[ltg]=Jauns privatais lūgs
|
|
||||||
Name[lv]=Jauns privātais logs
|
|
||||||
Name[mai]=नया निज विंडो (W)
|
|
||||||
Name[mk]=Нов приватен прозорец
|
|
||||||
Name[ml]=പുതിയ സ്വകാര്യ ജാലകം
|
|
||||||
Name[mr]=नवीन वैयक्तिक पटल
|
|
||||||
Name[ms]=Tetingkap Persendirian Baharu
|
|
||||||
Name[my]=New Private Window
|
|
||||||
Name[nb_NO]=Nytt privat vindu
|
|
||||||
Name[ne_NP]=नयाँ निजी सञ्झ्याल
|
|
||||||
Name[nl]=Nieuw privévenster
|
|
||||||
Name[nn_NO]=Nytt privat vindauge
|
|
||||||
Name[or]=ନୂତନ ବ୍ୟକ୍ତିଗତ ୱିଣ୍ଡୋ
|
|
||||||
Name[pa_IN]=ਨਵੀਂ ਪ੍ਰਾਈਵੇਟ ਵਿੰਡੋ
|
|
||||||
Name[pl]=Nowe okno prywatne
|
|
||||||
Name[pt_BR]=Nova janela privativa
|
|
||||||
Name[pt_PT]=Nova janela privada
|
|
||||||
Name[rm]=Nova fanestra privata
|
|
||||||
Name[ro]=Fereastră privată nouă
|
|
||||||
Name[ru]=Новое приватное окно
|
|
||||||
Name[sat]=नावा निजेराक् विंडो (W )
|
|
||||||
Name[si]=නව පුද්ගලික කවුළුව (W)
|
|
||||||
Name[sk]=Nové okno v režime Súkromné prehliadanie
|
|
||||||
Name[sl]=Novo zasebno okno
|
|
||||||
Name[son]=Sutura zanfun taaga
|
|
||||||
Name[sq]=Dritare e Re Private
|
|
||||||
Name[sr]=Нови приватан прозор
|
|
||||||
Name[sv_SE]=Nytt privat fönster
|
|
||||||
Name[ta]=புதிய தனிப்பட்ட சாளரம்
|
|
||||||
Name[te]=కొత్త ఆంతరంగిక విండో
|
|
||||||
Name[th]=หน้าต่างส่วนตัวใหม่
|
|
||||||
Name[tr]=Yeni gizli pencere
|
|
||||||
Name[tsz]=Juchiiti eraatarakua jimpani
|
|
||||||
Name[uk]=Приватне вікно
|
|
||||||
Name[ur]=نیا نجی دریچہ
|
|
||||||
Name[uz]=Yangi maxfiy oyna
|
|
||||||
Name[vi]=Cửa sổ riêng tư mới
|
|
||||||
Name[wo]=Panlanteeru biir bu bees
|
|
||||||
Name[xh]=Ifestile yangasese entsha
|
|
||||||
Name[zh_CN]=新建隐私浏览窗口
|
|
||||||
Name[zh_TW]=新增隱私視窗
|
|
||||||
Exec=firefox-wayland --private-window --name firefox-wayland %u
|
|
||||||
|
|
||||||
[Desktop Action profile-manager-window]
|
|
||||||
Name=Open the Profile Manager
|
|
||||||
Name[cs]=Správa profilů
|
|
||||||
Exec=firefox-wayland --name firefox-wayland --ProfileManager
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
#!/usr/bin/bash
|
|
||||||
#
|
|
||||||
# Run Firefox under Wayland
|
|
||||||
#
|
|
||||||
|
|
||||||
export MOZ_ENABLE_WAYLAND=1
|
|
||||||
exec /__PREFIX__/bin/firefox "$@"
|
|
||||||
@ -48,6 +48,6 @@
|
|||||||
<id>firefox.desktop</id>
|
<id>firefox.desktop</id>
|
||||||
</provides>
|
</provides>
|
||||||
<releases>
|
<releases>
|
||||||
<release version="__VERSION__"/>
|
<release version="__VERSION__" date="__DATE__"/>
|
||||||
</releases>
|
</releases>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Comment[nb]=Surf på nettet
|
|||||||
Comment[nl]=Verken het internet
|
Comment[nl]=Verken het internet
|
||||||
Comment[nn]=Surf på nettet
|
Comment[nn]=Surf på nettet
|
||||||
Comment[no]=Surf på nettet
|
Comment[no]=Surf på nettet
|
||||||
Comment[pl]=Przeglądanie stron WWW
|
Comment[pl]=Przeglądanie stron WWW
|
||||||
Comment[pt]=Navegue na Internet
|
Comment[pt]=Navegue na Internet
|
||||||
Comment[pt_BR]=Navegue na Internet
|
Comment[pt_BR]=Navegue na Internet
|
||||||
Comment[sk]=Prehliadanie internetu
|
Comment[sk]=Prehliadanie internetu
|
||||||
@ -271,4 +271,5 @@ Exec=firefox --private-window %u
|
|||||||
[Desktop Action profile-manager-window]
|
[Desktop Action profile-manager-window]
|
||||||
Name=Open the Profile Manager
|
Name=Open the Profile Manager
|
||||||
Name[cs]=Správa profilů
|
Name[cs]=Správa profilů
|
||||||
|
Name[de]=Profilverwaltung öffnen
|
||||||
Exec=firefox --ProfileManager
|
Exec=firefox --ProfileManager
|
||||||
|
|||||||
@ -65,14 +65,22 @@ MOZ_LANGPACKS_DIR="$MOZ_DIST_BIN/langpacks"
|
|||||||
MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
MOZ_EXTENSIONS_PROFILE_DIR="$HOME/.mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
|
||||||
MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE"
|
MOZ_PROGRAM="$MOZ_DIST_BIN/$MOZ_FIREFOX_FILE"
|
||||||
MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh"
|
MOZ_LAUNCHER="$MOZ_DIST_BIN/run-mozilla.sh"
|
||||||
|
GETENFORCE_FILE="/usr/sbin/getenforce"
|
||||||
|
|
||||||
##
|
##
|
||||||
## Enable Wayland backend?
|
## Enable Wayland backend?
|
||||||
##
|
##
|
||||||
if __DEFAULT_WAYLAND__ && ! [ $MOZ_DISABLE_WAYLAND ]; then
|
%DISABLE_WAYLAND_PLACEHOLDER%
|
||||||
|
|
||||||
|
if ! [ $MOZ_DISABLE_WAYLAND ] && [ "$WAYLAND_DISPLAY" ]; then
|
||||||
if [ "$XDG_CURRENT_DESKTOP" == "GNOME" ]; then
|
if [ "$XDG_CURRENT_DESKTOP" == "GNOME" ]; then
|
||||||
export MOZ_ENABLE_WAYLAND=1
|
export MOZ_ENABLE_WAYLAND=1
|
||||||
fi
|
fi
|
||||||
|
## Enable Wayland on KDE/Sway
|
||||||
|
##
|
||||||
|
if [ "$XDG_SESSION_TYPE" == "wayland" ]; then
|
||||||
|
export MOZ_ENABLE_WAYLAND=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##
|
##
|
||||||
@ -122,6 +130,8 @@ export MOZ_APP_LAUNCHER="/__PREFIX__/bin/firefox"
|
|||||||
FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft"
|
FONTCONFIG_PATH="/etc/fonts:${MOZILLA_FIVE_HOME}/res/Xft"
|
||||||
export FONTCONFIG_PATH
|
export FONTCONFIG_PATH
|
||||||
|
|
||||||
|
export MOZ_GMP_PATH=$MOZ_LIB_DIR/mozilla/plugins/gmp-gmpopenh264/system-installed
|
||||||
|
|
||||||
##
|
##
|
||||||
## In order to better support certain scripts (such as Indic and some CJK
|
## In order to better support certain scripts (such as Indic and some CJK
|
||||||
## scripts), openeuler builds its Firefox, with permission from the Mozilla
|
## scripts), openeuler builds its Firefox, with permission from the Mozilla
|
||||||
@ -179,6 +189,13 @@ if ! [ $MOZ_DISABLE_LANGPACKS ] || [ $MOZ_DISABLE_LANGPACKS -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# When Firefox is not running, restore SELinux labels for profile files
|
||||||
|
if [ $MOZILLA_DOWN -ne 0 ]; then
|
||||||
|
if [ -x $GETENFORCE_FILE ] && [ `getenforce` != "Disabled" ]; then
|
||||||
|
(restorecon -vr ~/.mozilla/firefox/* &)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Modify language pack configuration only when firefox is not running
|
# Modify language pack configuration only when firefox is not running
|
||||||
# and language packs are not disabled
|
# and language packs are not disabled
|
||||||
if [ $MOZILLA_DOWN -ne 0 ]; then
|
if [ $MOZILLA_DOWN -ne 0 ]; then
|
||||||
|
|||||||
1079
firefox.spec
1079
firefox.spec
File diff suppressed because it is too large
Load Diff
@ -1,22 +0,0 @@
|
|||||||
diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
|
|
||||||
index e87d59f..9b5413e 100644
|
|
||||||
--- a/build/moz.configure/init.configure
|
|
||||||
+++ b/build/moz.configure/init.configure
|
|
||||||
@@ -245,7 +245,7 @@ option(env='PYTHON3', nargs=1, help='Python 3 interpreter (3.6 or later)')
|
|
||||||
@imports('os')
|
|
||||||
@imports('sys')
|
|
||||||
@imports('subprocess')
|
|
||||||
-@imports('distutils.sysconfig')
|
|
||||||
+@imports(_from='distutils.sysconfig', _import='get_python_lib')
|
|
||||||
@imports(_from='mozbuild.configure.util', _import='LineIO')
|
|
||||||
@imports(_from='mozbuild.virtualenv', _import='VirtualenvManager')
|
|
||||||
@imports(_from='mozbuild.virtualenv', _import='verify_python_version')
|
|
||||||
@@ -376,7 +376,7 @@ def virtualenv_python3(env_python, build_env, mozconfig, help):
|
|
||||||
sys.exit(subprocess.call([python] + sys.argv))
|
|
||||||
|
|
||||||
# We are now in the virtualenv
|
|
||||||
- if not distutils.sysconfig.get_python_lib():
|
|
||||||
+ if not get_python_lib():
|
|
||||||
die('Could not determine python site packages directory')
|
|
||||||
|
|
||||||
str_version = '.'.join(str(v) for v in version)
|
|
||||||
1
google-loc-api-key
Normal file
1
google-loc-api-key
Normal file
@ -0,0 +1 @@
|
|||||||
|
AIzaSyB2h2OuRcUgy5N-5hsZqiPW6sH3n_rptiQ
|
||||||
33248
libwebrtc-screen-cast-sync.patch
Normal file
33248
libwebrtc-screen-cast-sync.patch
Normal file
File diff suppressed because it is too large
Load Diff
0
mochitest-python.tar.gz
Normal file
0
mochitest-python.tar.gz
Normal file
@ -1,7 +1,7 @@
|
|||||||
diff -up firefox-75.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-75.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
|
diff -up firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
|
||||||
--- firefox-75.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2020-04-03 21:34:41.000000000 +0200
|
--- firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2021-03-18 14:48:36.000000000 +0100
|
||||||
+++ firefox-75.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2020-04-06 22:40:02.760674871 +0200
|
+++ firefox-87.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2021-03-22 19:20:02.429310184 +0100
|
||||||
@@ -244,8 +244,20 @@ nsresult nsReadConfig::openAndEvaluateJS
|
@@ -249,8 +249,20 @@ nsresult nsReadConfig::openAndEvaluateJS
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
|
||||||
@ -12,7 +12,7 @@ diff -up firefox-75.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 fi
|
|||||||
+ getter_AddRefs(jsFile));
|
+ getter_AddRefs(jsFile));
|
||||||
+ NS_ENSURE_SUCCESS(rv, rv);
|
+ NS_ENSURE_SUCCESS(rv, rv);
|
||||||
+
|
+
|
||||||
+ rv = jsFile->AppendNative(NS_LITERAL_CSTRING("pref"));
|
+ rv = jsFile->AppendNative(nsLiteralCString("pref"));
|
||||||
+ NS_ENSURE_SUCCESS(rv, rv);
|
+ NS_ENSURE_SUCCESS(rv, rv);
|
||||||
+ rv = jsFile->AppendNative(nsDependentCString(aFileName));
|
+ rv = jsFile->AppendNative(nsDependentCString(aFileName));
|
||||||
+ NS_ENSURE_SUCCESS(rv, rv);
|
+ NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@ -23,10 +23,10 @@ diff -up firefox-75.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 fi
|
|||||||
} else {
|
} else {
|
||||||
nsAutoCString location("resource://gre/defaults/autoconfig/");
|
nsAutoCString location("resource://gre/defaults/autoconfig/");
|
||||||
location += aFileName;
|
location += aFileName;
|
||||||
diff -up firefox-75.0/modules/libpref/Preferences.cpp.1170092 firefox-75.0/modules/libpref/Preferences.cpp
|
diff -up firefox-87.0/modules/libpref/Preferences.cpp.1170092 firefox-87.0/modules/libpref/Preferences.cpp
|
||||||
--- firefox-75.0/modules/libpref/Preferences.cpp.1170092 2020-04-06 22:40:02.761674865 +0200
|
--- firefox-87.0/modules/libpref/Preferences.cpp.1170092 2021-03-18 14:48:54.000000000 +0100
|
||||||
+++ firefox-75.0/modules/libpref/Preferences.cpp 2020-04-06 22:40:57.675325227 +0200
|
+++ firefox-87.0/modules/libpref/Preferences.cpp 2021-03-22 19:20:02.429310184 +0100
|
||||||
@@ -4468,6 +4468,9 @@ nsresult Preferences::InitInitialObjects
|
@@ -4499,6 +4499,9 @@ nsresult Preferences::InitInitialObjects
|
||||||
//
|
//
|
||||||
// Thus, in the omni.jar case, we always load app-specific default
|
// Thus, in the omni.jar case, we always load app-specific default
|
||||||
// preferences from omni.jar, whether or not `$app == $gre`.
|
// preferences from omni.jar, whether or not `$app == $gre`.
|
||||||
@ -36,10 +36,10 @@ diff -up firefox-75.0/modules/libpref/Preferences.cpp.1170092 firefox-75.0/modul
|
|||||||
|
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
UniquePtr<nsZipFind> find;
|
UniquePtr<nsZipFind> find;
|
||||||
diff -up firefox-75.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-75.0/toolkit/xre/nsXREDirProvider.cpp
|
diff -up firefox-87.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-87.0/toolkit/xre/nsXREDirProvider.cpp
|
||||||
--- firefox-75.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2020-04-03 21:35:39.000000000 +0200
|
--- firefox-87.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2021-03-18 14:52:00.000000000 +0100
|
||||||
+++ firefox-75.0/toolkit/xre/nsXREDirProvider.cpp 2020-04-06 22:40:02.761674865 +0200
|
+++ firefox-87.0/toolkit/xre/nsXREDirProvider.cpp 2021-03-22 19:37:56.574480347 +0100
|
||||||
@@ -60,6 +60,7 @@
|
@@ -65,6 +65,7 @@
|
||||||
#endif
|
#endif
|
||||||
#ifdef XP_UNIX
|
#ifdef XP_UNIX
|
||||||
# include <ctype.h>
|
# include <ctype.h>
|
||||||
@ -47,14 +47,14 @@ diff -up firefox-75.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-75.0/tool
|
|||||||
#endif
|
#endif
|
||||||
#ifdef XP_IOS
|
#ifdef XP_IOS
|
||||||
# include "UIKitDirProvider.h"
|
# include "UIKitDirProvider.h"
|
||||||
@@ -533,6 +534,21 @@ nsXREDirProvider::GetFile(const char* aP
|
@@ -552,6 +553,21 @@ nsXREDirProvider::GetFile(const char* aP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+#if defined(XP_UNIX)
|
+#if defined(XP_UNIX)
|
||||||
+ if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
|
+ if (!strcmp(aProperty, NS_APP_PREFS_SYSTEM_CONFIG_DIR)) {
|
||||||
+ nsCString sysConfigDir = NS_LITERAL_CSTRING("/etc/");
|
+ nsCString sysConfigDir = nsLiteralCString("/etc/");
|
||||||
+ nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
+ nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
||||||
+ if (!appInfo)
|
+ if (!appInfo)
|
||||||
+ return NS_ERROR_NOT_AVAILABLE;
|
+ return NS_ERROR_NOT_AVAILABLE;
|
||||||
@ -69,27 +69,27 @@ diff -up firefox-75.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-75.0/tool
|
|||||||
if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
|
if (NS_FAILED(rv) || !file) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (ensureFilePermissions) {
|
if (ensureFilePermissions) {
|
||||||
@@ -845,6 +861,16 @@ nsresult nsXREDirProvider::GetFilesInter
|
@@ -874,6 +890,16 @@ nsresult nsXREDirProvider::GetFilesInter
|
||||||
|
}
|
||||||
LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
|
#endif
|
||||||
|
|
||||||
+ // Add /etc/<application>/pref/ directory if it exists
|
+ // Add /etc/<application>/pref/ directory if it exists
|
||||||
+ nsCOMPtr<nsIFile> systemPrefDir;
|
+ nsCOMPtr<nsIFile> systemPrefDir;
|
||||||
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
+ rv = NS_GetSpecialDirectory(NS_APP_PREFS_SYSTEM_CONFIG_DIR,
|
||||||
+ getter_AddRefs(systemPrefDir));
|
+ getter_AddRefs(systemPrefDir));
|
||||||
+ if (NS_SUCCEEDED(rv)) {
|
+ if (NS_SUCCEEDED(rv)) {
|
||||||
+ rv = systemPrefDir->AppendNative(NS_LITERAL_CSTRING("pref"));
|
+ rv = systemPrefDir->AppendNative(nsLiteralCString("pref"));
|
||||||
+ if (NS_SUCCEEDED(rv))
|
+ if (NS_SUCCEEDED(rv))
|
||||||
+ directories.AppendObject(systemPrefDir);
|
+ directories.AppendObject(systemPrefDir);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
|
rv = NS_NewArrayEnumerator(aResult, directories, NS_GET_IID(nsIFile));
|
||||||
} else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
|
} else if (!strcmp(aProperty, NS_APP_CHROME_DIR_LIST)) {
|
||||||
// NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
|
// NS_APP_CHROME_DIR_LIST is only used to get default (native) icons
|
||||||
diff -up firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h
|
diff -up firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h
|
||||||
--- firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2020-04-03 21:35:39.000000000 +0200
|
--- firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2021-03-18 14:51:58.000000000 +0100
|
||||||
+++ firefox-75.0/xpcom/io/nsAppDirectoryServiceDefs.h 2020-04-06 22:40:02.761674865 +0200
|
+++ firefox-87.0/xpcom/io/nsAppDirectoryServiceDefs.h 2021-03-22 19:20:02.430310213 +0100
|
||||||
@@ -60,6 +60,7 @@
|
@@ -59,6 +59,7 @@
|
||||||
#define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
|
#define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
|
||||||
#define NS_APP_PREFS_OVERRIDE_DIR \
|
#define NS_APP_PREFS_OVERRIDE_DIR \
|
||||||
"PrefDOverride" // Directory for per-profile defaults
|
"PrefDOverride" // Directory for per-profile defaults
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
diff -up firefox-68.0/widget/gtk/nsWindow.cpp.1196777 firefox-68.0/widget/gtk/nsWindow.cpp
|
|
||||||
--- firefox-68.0/widget/gtk/nsWindow.cpp.1196777 2019-07-02 11:47:06.864726826 +0200
|
|
||||||
+++ firefox-68.0/widget/gtk/nsWindow.cpp 2019-07-02 11:48:09.896544339 +0200
|
|
||||||
@@ -156,7 +156,8 @@ const gint kEvents =
|
|
||||||
#if GTK_CHECK_VERSION(3, 4, 0)
|
|
||||||
GDK_SMOOTH_SCROLL_MASK | GDK_TOUCH_MASK |
|
|
||||||
#endif
|
|
||||||
- GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK;
|
|
||||||
+ GDK_SCROLL_MASK | GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK |
|
|
||||||
+ GDK_FOCUS_CHANGE_MASK;
|
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(3, 22, 0)
|
|
||||||
typedef enum {
|
|
||||||
@ -1,496 +0,0 @@
|
|||||||
diff -up firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp.1337988 firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp
|
|
||||||
--- firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp.1337988 2017-09-14 22:15:56.000000000 +0200
|
|
||||||
+++ firefox-56.0/dom/plugins/base/nsJSNPRuntime.cpp 2017-09-25 10:34:11.205611698 +0200
|
|
||||||
@@ -1719,7 +1719,7 @@ NPObjWrapper_ObjectMoved(JSObject *obj,
|
|
||||||
auto entry =
|
|
||||||
static_cast<NPObjWrapperHashEntry*>(sNPObjWrappers->Search(npobj));
|
|
||||||
MOZ_ASSERT(entry && entry->mJSObj);
|
|
||||||
- MOZ_ASSERT(entry->mJSObj == old);
|
|
||||||
+ MOZ_ASSERT(entry->mJSObj.unbarrieredGetPtr() == old);
|
|
||||||
entry->mJSObj = obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -up firefox-56.0/js/ipc/JavaScriptShared.cpp.1337988 firefox-56.0/js/ipc/JavaScriptShared.cpp
|
|
||||||
--- firefox-56.0/js/ipc/JavaScriptShared.cpp.1337988 2017-07-31 18:20:47.000000000 +0200
|
|
||||||
+++ firefox-56.0/js/ipc/JavaScriptShared.cpp 2017-09-25 10:34:11.205611698 +0200
|
|
||||||
@@ -101,7 +101,7 @@ IdToObjectMap::has(const ObjectId& id, c
|
|
||||||
auto p = table_.lookup(id);
|
|
||||||
if (!p)
|
|
||||||
return false;
|
|
||||||
- return p->value() == obj;
|
|
||||||
+ return p->value().unbarrieredGet() == obj;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
diff -up firefox-56.0/js/public/RootingAPI.h.1337988 firefox-56.0/js/public/RootingAPI.h
|
|
||||||
--- firefox-56.0/js/public/RootingAPI.h.1337988 2017-07-31 18:20:47.000000000 +0200
|
|
||||||
+++ firefox-56.0/js/public/RootingAPI.h 2017-09-25 10:34:11.206611695 +0200
|
|
||||||
@@ -148,6 +148,10 @@ template<typename T>
|
|
||||||
struct PersistentRootedMarker;
|
|
||||||
} /* namespace gc */
|
|
||||||
|
|
||||||
+#define DECLARE_POINTER_COMPARISON_OPS(T) \
|
|
||||||
+ bool operator==(const T& other) const { return get() == other; } \
|
|
||||||
+ bool operator!=(const T& other) const { return get() != other; }
|
|
||||||
+
|
|
||||||
// Important: Return a reference so passing a Rooted<T>, etc. to
|
|
||||||
// something that takes a |const T&| is not a GC hazard.
|
|
||||||
#define DECLARE_POINTER_CONSTREF_OPS(T) \
|
|
||||||
@@ -237,8 +241,6 @@ class Heap : public js::HeapBase<T, Heap
|
|
||||||
static_assert(js::IsHeapConstructibleType<T>::value,
|
|
||||||
"Type T must be a public GC pointer type");
|
|
||||||
public:
|
|
||||||
- using ElementType = T;
|
|
||||||
-
|
|
||||||
Heap() {
|
|
||||||
static_assert(sizeof(T) == sizeof(Heap<T>),
|
|
||||||
"Heap<T> must be binary compatible with T.");
|
|
||||||
@@ -385,8 +387,6 @@ template <typename T>
|
|
||||||
class TenuredHeap : public js::HeapBase<T, TenuredHeap<T>>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
- using ElementType = T;
|
|
||||||
-
|
|
||||||
TenuredHeap() : bits(0) {
|
|
||||||
static_assert(sizeof(T) == sizeof(TenuredHeap<T>),
|
|
||||||
"TenuredHeap<T> must be binary compatible with T.");
|
|
||||||
@@ -394,6 +394,9 @@ class TenuredHeap : public js::HeapBase<
|
|
||||||
explicit TenuredHeap(T p) : bits(0) { setPtr(p); }
|
|
||||||
explicit TenuredHeap(const TenuredHeap<T>& p) : bits(0) { setPtr(p.getPtr()); }
|
|
||||||
|
|
||||||
+ bool operator==(const TenuredHeap<T>& other) { return bits == other.bits; }
|
|
||||||
+ bool operator!=(const TenuredHeap<T>& other) { return bits != other.bits; }
|
|
||||||
+
|
|
||||||
void setPtr(T newPtr) {
|
|
||||||
MOZ_ASSERT((reinterpret_cast<uintptr_t>(newPtr) & flagsMask) == 0);
|
|
||||||
if (newPtr)
|
|
||||||
@@ -470,8 +473,6 @@ class MOZ_NONHEAP_CLASS Handle : public
|
|
||||||
friend class JS::MutableHandle<T>;
|
|
||||||
|
|
||||||
public:
|
|
||||||
- using ElementType = T;
|
|
||||||
-
|
|
||||||
/* Creates a handle from a handle of a type convertible to T. */
|
|
||||||
template <typename S>
|
|
||||||
MOZ_IMPLICIT Handle(Handle<S> handle,
|
|
||||||
@@ -533,6 +534,7 @@ class MOZ_NONHEAP_CLASS Handle : public
|
|
||||||
MOZ_IMPLICIT Handle(MutableHandle<S>& root,
|
|
||||||
typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
|
|
||||||
|
|
||||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
|
||||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
|
||||||
DECLARE_NONPOINTER_ACCESSOR_METHODS(*ptr);
|
|
||||||
|
|
||||||
@@ -559,8 +561,6 @@ template <typename T>
|
|
||||||
class MOZ_STACK_CLASS MutableHandle : public js::MutableHandleBase<T, MutableHandle<T>>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
- using ElementType = T;
|
|
||||||
-
|
|
||||||
inline MOZ_IMPLICIT MutableHandle(Rooted<T>* root);
|
|
||||||
inline MOZ_IMPLICIT MutableHandle(PersistentRooted<T>* root);
|
|
||||||
|
|
||||||
@@ -589,6 +589,7 @@ class MOZ_STACK_CLASS MutableHandle : pu
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
|
||||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
|
||||||
DECLARE_NONPOINTER_ACCESSOR_METHODS(*ptr);
|
|
||||||
DECLARE_NONPOINTER_MUTABLE_ACCESSOR_METHODS(*ptr);
|
|
||||||
@@ -805,8 +806,6 @@ class MOZ_RAII Rooted : public js::Roote
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
- using ElementType = T;
|
|
||||||
-
|
|
||||||
template <typename RootingContext>
|
|
||||||
explicit Rooted(const RootingContext& cx)
|
|
||||||
: ptr(GCPolicy<T>::initial())
|
|
||||||
@@ -839,6 +838,7 @@ class MOZ_RAII Rooted : public js::Roote
|
|
||||||
ptr = mozilla::Move(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
|
||||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
|
||||||
DECLARE_POINTER_ASSIGN_OPS(Rooted, T);
|
|
||||||
DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr);
|
|
||||||
@@ -903,14 +903,13 @@ template <typename T>
|
|
||||||
class MOZ_RAII FakeRooted : public RootedBase<T, FakeRooted<T>>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
- using ElementType = T;
|
|
||||||
-
|
|
||||||
template <typename CX>
|
|
||||||
explicit FakeRooted(CX* cx) : ptr(JS::GCPolicy<T>::initial()) {}
|
|
||||||
|
|
||||||
template <typename CX>
|
|
||||||
FakeRooted(CX* cx, T initial) : ptr(initial) {}
|
|
||||||
|
|
||||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
|
||||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
|
||||||
DECLARE_POINTER_ASSIGN_OPS(FakeRooted, T);
|
|
||||||
DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr);
|
|
||||||
@@ -931,8 +930,6 @@ template <typename T>
|
|
||||||
class FakeMutableHandle : public js::MutableHandleBase<T, FakeMutableHandle<T>>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
- using ElementType = T;
|
|
||||||
-
|
|
||||||
MOZ_IMPLICIT FakeMutableHandle(T* t) {
|
|
||||||
ptr = t;
|
|
||||||
}
|
|
||||||
@@ -1124,8 +1121,6 @@ class PersistentRooted : public js::Root
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
- using ElementType = T;
|
|
||||||
-
|
|
||||||
PersistentRooted() : ptr(GCPolicy<T>::initial()) {}
|
|
||||||
|
|
||||||
explicit PersistentRooted(RootingContext* cx)
|
|
||||||
@@ -1203,6 +1198,7 @@ class PersistentRooted : public js::Root
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
|
||||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
|
||||||
DECLARE_POINTER_ASSIGN_OPS(PersistentRooted, T);
|
|
||||||
DECLARE_NONPOINTER_ACCESSOR_METHODS(ptr);
|
|
||||||
@@ -1234,8 +1230,6 @@ class JS_PUBLIC_API(ObjectPtr)
|
|
||||||
Heap<JSObject*> value;
|
|
||||||
|
|
||||||
public:
|
|
||||||
- using ElementType = JSObject*;
|
|
||||||
-
|
|
||||||
ObjectPtr() : value(nullptr) {}
|
|
||||||
|
|
||||||
explicit ObjectPtr(JSObject* obj) : value(obj) {}
|
|
||||||
@@ -1342,177 +1336,6 @@ Swap(JS::TenuredHeap<T>& aX, JS::Tenured
|
|
||||||
|
|
||||||
} /* namespace mozilla */
|
|
||||||
|
|
||||||
-namespace js {
|
|
||||||
-namespace detail {
|
|
||||||
-
|
|
||||||
-// DefineComparisonOps is a trait which selects which wrapper classes to define
|
|
||||||
-// operator== and operator!= for. It supplies a getter function to extract the
|
|
||||||
-// value to compare. This is used to avoid triggering the automatic read
|
|
||||||
-// barriers where appropriate.
|
|
||||||
-//
|
|
||||||
-// If DefineComparisonOps is not specialized for a particular wrapper you may
|
|
||||||
-// get errors such as 'invalid operands to binary expression' or 'no match for
|
|
||||||
-// operator==' when trying to compare against instances of the wrapper.
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps : mozilla::FalseType {};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<JS::Heap<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const JS::Heap<T>& v) { return v.unbarrieredGet(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<JS::TenuredHeap<T>> : mozilla::TrueType {
|
|
||||||
- static const T get(const JS::TenuredHeap<T>& v) { return v.unbarrieredGetPtr(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <>
|
|
||||||
-struct DefineComparisonOps<JS::ObjectPtr> : mozilla::TrueType {
|
|
||||||
- static const JSObject* get(const JS::ObjectPtr& v) { return v.unbarrieredGet(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<JS::Rooted<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const JS::Rooted<T>& v) { return v.get(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<JS::Handle<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const JS::Handle<T>& v) { return v.get(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<JS::MutableHandle<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const JS::MutableHandle<T>& v) { return v.get(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<JS::PersistentRooted<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const JS::PersistentRooted<T>& v) { return v.get(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<js::FakeRooted<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const js::FakeRooted<T>& v) { return v.get(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<js::FakeMutableHandle<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const js::FakeMutableHandle<T>& v) { return v.get(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-} /* namespace detail */
|
|
||||||
-} /* namespace js */
|
|
||||||
-
|
|
||||||
-// Overload operator== and operator!= for all types with the DefineComparisonOps
|
|
||||||
-// trait using the supplied getter.
|
|
||||||
-//
|
|
||||||
-// There are four cases:
|
|
||||||
-
|
|
||||||
-// Case 1: comparison between two wrapper objects.
|
|
||||||
-
|
|
||||||
-template <typename T, typename U>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
|
||||||
- js::detail::DefineComparisonOps<U>::value, bool>::Type
|
|
||||||
-operator==(const T& a, const U& b) {
|
|
||||||
- return js::detail::DefineComparisonOps<T>::get(a) == js::detail::DefineComparisonOps<U>::get(b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-template <typename T, typename U>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
|
||||||
- js::detail::DefineComparisonOps<U>::value, bool>::Type
|
|
||||||
-operator!=(const T& a, const U& b) {
|
|
||||||
- return !(a == b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-// Case 2: comparison between a wrapper object and its unwrapped element type.
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
|
|
||||||
-operator==(const T& a, const typename T::ElementType& b) {
|
|
||||||
- return js::detail::DefineComparisonOps<T>::get(a) == b;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
|
|
||||||
-operator!=(const T& a, const typename T::ElementType& b) {
|
|
||||||
- return !(a == b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
|
|
||||||
-operator==(const typename T::ElementType& a, const T& b) {
|
|
||||||
- return a == js::detail::DefineComparisonOps<T>::get(b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value, bool>::Type
|
|
||||||
-operator!=(const typename T::ElementType& a, const T& b) {
|
|
||||||
- return !(a == b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-// Case 3: For pointer wrappers, comparison between the wrapper and a const
|
|
||||||
-// element pointer.
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
|
||||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
|
||||||
-operator==(const typename mozilla::RemovePointer<typename T::ElementType>::Type* a, const T& b) {
|
|
||||||
- return a == js::detail::DefineComparisonOps<T>::get(b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
|
||||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
|
||||||
-operator!=(const typename mozilla::RemovePointer<typename T::ElementType>::Type* a, const T& b) {
|
|
||||||
- return !(a == b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
|
||||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
|
||||||
-operator==(const T& a, const typename mozilla::RemovePointer<typename T::ElementType>::Type* b) {
|
|
||||||
- return js::detail::DefineComparisonOps<T>::get(a) == b;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
|
||||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
|
||||||
-operator!=(const T& a, const typename mozilla::RemovePointer<typename T::ElementType>::Type* b) {
|
|
||||||
- return !(a == b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-// Case 4: For pointer wrappers, comparison between the wrapper and nullptr.
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
|
||||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
|
||||||
-operator==(std::nullptr_t a, const T& b) {
|
|
||||||
- return a == js::detail::DefineComparisonOps<T>::get(b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
|
||||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
|
||||||
-operator!=(std::nullptr_t a, const T& b) {
|
|
||||||
- return !(a == b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
|
||||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
|
||||||
-operator==(const T& a, std::nullptr_t b) {
|
|
||||||
- return js::detail::DefineComparisonOps<T>::get(a) == b;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-typename mozilla::EnableIf<js::detail::DefineComparisonOps<T>::value &&
|
|
||||||
- mozilla::IsPointer<typename T::ElementType>::value, bool>::Type
|
|
||||||
-operator!=(const T& a, std::nullptr_t b) {
|
|
||||||
- return !(a == b);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
#undef DELETE_ASSIGNMENT_OPS
|
|
||||||
|
|
||||||
#endif /* js_RootingAPI_h */
|
|
||||||
diff -up firefox-56.0/js/src/gc/Barrier.h.1337988 firefox-56.0/js/src/gc/Barrier.h
|
|
||||||
--- firefox-56.0/js/src/gc/Barrier.h.1337988 2017-09-14 22:16:01.000000000 +0200
|
|
||||||
+++ firefox-56.0/js/src/gc/Barrier.h 2017-09-25 10:34:11.206611695 +0200
|
|
||||||
@@ -353,8 +353,8 @@ class WriteBarrieredBase : public Barrie
|
|
||||||
explicit WriteBarrieredBase(const T& v) : BarrieredBase<T>(v) {}
|
|
||||||
|
|
||||||
public:
|
|
||||||
- using ElementType = T;
|
|
||||||
|
|
||||||
+ DECLARE_POINTER_COMPARISON_OPS(T);
|
|
||||||
DECLARE_POINTER_CONSTREF_OPS(T);
|
|
||||||
|
|
||||||
// Use this if the automatic coercion to T isn't working.
|
|
||||||
@@ -612,13 +612,14 @@ class ReadBarriered : public ReadBarrier
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
- const T& get() const {
|
|
||||||
- if (InternalBarrierMethods<T>::isMarkable(this->value))
|
|
||||||
- this->read();
|
|
||||||
+ const T get() const {
|
|
||||||
+ if (!InternalBarrierMethods<T>::isMarkable(this->value))
|
|
||||||
+ return JS::GCPolicy<T>::initial();
|
|
||||||
+ this->read();
|
|
||||||
return this->value;
|
|
||||||
}
|
|
||||||
|
|
||||||
- const T& unbarrieredGet() const {
|
|
||||||
+ const T unbarrieredGet() const {
|
|
||||||
return this->value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -626,9 +627,9 @@ class ReadBarriered : public ReadBarrier
|
|
||||||
return bool(this->value);
|
|
||||||
}
|
|
||||||
|
|
||||||
- operator const T&() const { return get(); }
|
|
||||||
+ operator const T() const { return get(); }
|
|
||||||
|
|
||||||
- const T& operator->() const { return get(); }
|
|
||||||
+ const T operator->() const { return get(); }
|
|
||||||
|
|
||||||
T* unsafeGet() { return &this->value; }
|
|
||||||
T const* unsafeGet() const { return &this->value; }
|
|
||||||
@@ -955,35 +956,6 @@ typedef ReadBarriered<WasmTableObject*>
|
|
||||||
|
|
||||||
typedef ReadBarriered<Value> ReadBarrieredValue;
|
|
||||||
|
|
||||||
-namespace detail {
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<PreBarriered<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const PreBarriered<T>& v) { return v.get(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<GCPtr<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const GCPtr<T>& v) { return v.get(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<HeapPtr<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const HeapPtr<T>& v) { return v.get(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <typename T>
|
|
||||||
-struct DefineComparisonOps<ReadBarriered<T>> : mozilla::TrueType {
|
|
||||||
- static const T& get(const ReadBarriered<T>& v) { return v.unbarrieredGet(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-template <>
|
|
||||||
-struct DefineComparisonOps<HeapSlot> : mozilla::TrueType {
|
|
||||||
- static const Value& get(const HeapSlot& v) { return v.get(); }
|
|
||||||
-};
|
|
||||||
-
|
|
||||||
-} /* namespace detail */
|
|
||||||
-
|
|
||||||
} /* namespace js */
|
|
||||||
|
|
||||||
#endif /* gc_Barrier_h */
|
|
||||||
diff -up firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp
|
|
||||||
--- firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp.1337988 2017-09-14 22:16:02.000000000 +0200
|
|
||||||
+++ firefox-56.0/js/src/jsapi-tests/testGCHeapPostBarriers.cpp 2017-09-25 10:34:11.206611695 +0200
|
|
||||||
@@ -5,7 +5,6 @@
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
-#include "mozilla/TypeTraits.h"
|
|
||||||
#include "mozilla/UniquePtr.h"
|
|
||||||
|
|
||||||
#include "js/RootingAPI.h"
|
|
||||||
diff -up firefox-56.0/js/src/vm/SharedMem.h.1337988 firefox-56.0/js/src/vm/SharedMem.h
|
|
||||||
--- firefox-56.0/js/src/vm/SharedMem.h.1337988 2017-06-15 22:52:29.000000000 +0200
|
|
||||||
+++ firefox-56.0/js/src/vm/SharedMem.h 2017-09-25 10:34:11.206611695 +0200
|
|
||||||
@@ -12,8 +12,8 @@
|
|
||||||
template<typename T>
|
|
||||||
class SharedMem
|
|
||||||
{
|
|
||||||
- // static_assert(mozilla::IsPointer<T>::value,
|
|
||||||
- // "SharedMem encapsulates pointer types");
|
|
||||||
+ static_assert(mozilla::IsPointer<T>::value,
|
|
||||||
+ "SharedMem encapsulates pointer types");
|
|
||||||
|
|
||||||
enum Sharedness {
|
|
||||||
IsUnshared,
|
|
||||||
diff -up firefox-56.0/js/xpconnect/src/XPCInlines.h.1337988 firefox-56.0/js/xpconnect/src/XPCInlines.h
|
|
||||||
--- firefox-56.0/js/xpconnect/src/XPCInlines.h.1337988 2017-09-14 22:16:03.000000000 +0200
|
|
||||||
+++ firefox-56.0/js/xpconnect/src/XPCInlines.h 2017-09-25 10:34:11.206611695 +0200
|
|
||||||
@@ -465,7 +465,7 @@ inline
|
|
||||||
void XPCWrappedNativeTearOff::JSObjectMoved(JSObject* obj, const JSObject* old)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!IsMarked());
|
|
||||||
- MOZ_ASSERT(mJSObject == old);
|
|
||||||
+ MOZ_ASSERT(mJSObject.unbarrieredGetPtr() == old);
|
|
||||||
mJSObject = obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -up firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp.1337988 firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp
|
|
||||||
--- firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp.1337988 2017-09-14 22:16:03.000000000 +0200
|
|
||||||
+++ firefox-56.0/js/xpconnect/src/XPCWrappedNative.cpp 2017-09-25 10:34:11.207611692 +0200
|
|
||||||
@@ -874,7 +874,7 @@ void
|
|
||||||
XPCWrappedNative::FlatJSObjectMoved(JSObject* obj, const JSObject* old)
|
|
||||||
{
|
|
||||||
JS::AutoAssertGCCallback inCallback;
|
|
||||||
- MOZ_ASSERT(mFlatJSObject == old);
|
|
||||||
+ MOZ_ASSERT(mFlatJSObject.unbarrieredGetPtr() == old);
|
|
||||||
|
|
||||||
nsWrapperCache* cache = nullptr;
|
|
||||||
CallQueryInterface(mIdentity, &cache);
|
|
||||||
diff -up firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp.1337988 firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp
|
|
||||||
--- firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp.1337988 2017-07-31 18:20:47.000000000 +0200
|
|
||||||
+++ firefox-56.0/js/xpconnect/src/XPCWrappedNativeProto.cpp 2017-09-25 10:34:11.207611692 +0200
|
|
||||||
@@ -101,7 +101,7 @@ XPCWrappedNativeProto::CallPostCreatePro
|
|
||||||
void
|
|
||||||
XPCWrappedNativeProto::JSProtoObjectFinalized(js::FreeOp* fop, JSObject* obj)
|
|
||||||
{
|
|
||||||
- MOZ_ASSERT(obj == mJSProtoObject, "huh?");
|
|
||||||
+ MOZ_ASSERT(obj == mJSProtoObject.unbarrieredGet(), "huh?");
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
// Check that this object has already been swept from the map.
|
|
||||||
@@ -117,7 +117,7 @@ XPCWrappedNativeProto::JSProtoObjectFina
|
|
||||||
void
|
|
||||||
XPCWrappedNativeProto::JSProtoObjectMoved(JSObject* obj, const JSObject* old)
|
|
||||||
{
|
|
||||||
- MOZ_ASSERT(mJSProtoObject == old);
|
|
||||||
+ MOZ_ASSERT(mJSProtoObject.unbarrieredGet() == old);
|
|
||||||
mJSProtoObject.init(obj); // Update without triggering barriers.
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
diff -up firefox-71.0/build/moz.configure/lto-pgo.configure.1516081 firefox-71.0/build/moz.configure/lto-pgo.configure
|
|
||||||
--- firefox-71.0/build/moz.configure/lto-pgo.configure.1516081 2019-11-26 01:02:19.000000000 +0100
|
|
||||||
+++ firefox-71.0/build/moz.configure/lto-pgo.configure 2019-11-26 11:04:10.993077232 +0100
|
|
||||||
@@ -71,7 +71,7 @@ set_config('PGO_PROFILE_PATH', pgo_profi
|
|
||||||
def pgo_flags(compiler, target, profdata):
|
|
||||||
if compiler.type == 'gcc':
|
|
||||||
return namespace(
|
|
||||||
- gen_cflags=['-fprofile-generate'],
|
|
||||||
+ gen_cflags=['-fprofile-generate', '-DMOZ_PROFILE_INSTRUMENTATION'],
|
|
||||||
gen_ldflags=['-fprofile-generate'],
|
|
||||||
use_cflags=['-fprofile-use', '-fprofile-correction',
|
|
||||||
'-Wcoverage-mismatch'],
|
|
||||||
@@ -92,7 +92,7 @@ def pgo_flags(compiler, target, profdata
|
|
||||||
gen_ldflags = ['-fprofile-generate']
|
|
||||||
|
|
||||||
return namespace(
|
|
||||||
- gen_cflags=[prefix + '-fprofile-generate'],
|
|
||||||
+ gen_cflags=[prefix + '-fprofile-generate', '-DMOZ_PROFILE_INSTRUMENTATION'],
|
|
||||||
gen_ldflags=gen_ldflags,
|
|
||||||
use_cflags=[prefix + '-fprofile-use=%s' % profdata,
|
|
||||||
# Some error messages about mismatched profile data
|
|
||||||
@ -1,16 +1,15 @@
|
|||||||
diff --git a/security/sandbox/linux/moz.build b/security/sandbox/linux/moz.build
|
diff -up firefox-84.0/security/sandbox/linux/moz.build.1516803 firefox-84.0/security/sandbox/linux/moz.build
|
||||||
--- a/security/sandbox/linux/moz.build
|
--- firefox-84.0/security/sandbox/linux/moz.build.1516803 2020-12-10 16:17:55.425139545 +0100
|
||||||
+++ b/security/sandbox/linux/moz.build
|
+++ firefox-84.0/security/sandbox/linux/moz.build 2020-12-10 16:29:21.945860841 +0100
|
||||||
@@ -99,9 +99,8 @@
|
@@ -114,9 +114,8 @@ if CONFIG["CC_TYPE"] in ("clang", "gcc")
|
||||||
# gcc lto likes to put the top level asm in syscall.cc in a different partition
|
# gcc lto likes to put the top level asm in syscall.cc in a different partition
|
||||||
# from the function using it which breaks the build. Work around that by
|
# from the function using it which breaks the build. Work around that by
|
||||||
# forcing there to be only one partition.
|
# forcing there to be only one partition.
|
||||||
-for f in CONFIG['OS_CXXFLAGS']:
|
-for f in CONFIG["OS_CXXFLAGS"]:
|
||||||
- if f.startswith('-flto') and CONFIG['CC_TYPE'] != 'clang':
|
- if f.startswith("-flto") and CONFIG["CC_TYPE"] != "clang":
|
||||||
- LDFLAGS += ['--param lto-partitions=1']
|
- LDFLAGS += ["--param lto-partitions=1"]
|
||||||
+if CONFIG['CC_TYPE'] != 'clang':
|
+if CONFIG['CC_TYPE'] != 'clang':
|
||||||
+ LDFLAGS += ['--param', 'lto-partitions=1']
|
+ LDFLAGS += ['--param', 'lto-partitions=1']
|
||||||
|
|
||||||
DEFINES['NS_NO_XPCOM'] = True
|
DEFINES["NS_NO_XPCOM"] = True
|
||||||
DisableStlWrapping()
|
DisableStlWrapping()
|
||||||
|
|
||||||
|
|||||||
@ -1,51 +0,0 @@
|
|||||||
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
|
||||||
--- a/widget/gtk/nsWindow.cpp
|
|
||||||
+++ b/widget/gtk/nsWindow.cpp
|
|
||||||
@@ -1155,6 +1155,28 @@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+bool IsPopupWithoutToplevelParent(nsMenuPopupFrame* aMenuPopupFrame) {
|
|
||||||
+ // Check if the popup is autocomplete (like tags autocomplete
|
|
||||||
+ // in the bookmark edit popup).
|
|
||||||
+ nsAtom* popupId = aMenuPopupFrame->GetContent()->GetID();
|
|
||||||
+ if (popupId && popupId->Equals(NS_LITERAL_STRING("PopupAutoComplete"))) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Check if the popup is in popupnotificationcontent (like choosing capture
|
|
||||||
+ // device when starting webrtc session).
|
|
||||||
+ nsIFrame* parentFrame = aMenuPopupFrame->GetParent();
|
|
||||||
+ if (!parentFrame) {
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ parentFrame = parentFrame->GetParent();
|
|
||||||
+ if (parentFrame && parentFrame->GetContent()->NodeName().EqualsLiteral(
|
|
||||||
+ "popupnotificationcontent")) {
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ return false;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
// Wayland keeps strong popup window hierarchy. We need to track active
|
|
||||||
// (visible) popup windows and make sure we hide popup on the same level
|
|
||||||
// before we open another one on that level. It means that every open
|
|
||||||
@@ -1211,10 +1233,14 @@
|
|
||||||
LOG(("...[%p] GetParentMenuWidget() = %p\n", (void*)this, parentWindow));
|
|
||||||
|
|
||||||
// If the popup is a regular menu but GetParentMenuWidget() returns
|
|
||||||
- // nullptr which means it's connected non-menu parent
|
|
||||||
- // (bookmark toolbar for instance).
|
|
||||||
+ // nullptr which means is not a submenu of any other menu.
|
|
||||||
// In this case use a parent given at nsWindow::Create().
|
|
||||||
- if (!parentWindow && !menuPopupFrame->IsContextMenu()) {
|
|
||||||
+ // But we have to avoid using mToplevelParentWindow in case the popup
|
|
||||||
+ // is in 'popupnotificationcontent' element or autocomplete popup,
|
|
||||||
+ // otherwise the popupnotification would disappear when for
|
|
||||||
+ // example opening a popup with microphone selection.
|
|
||||||
+ if (!parentWindow && !menuPopupFrame->IsContextMenu() &&
|
|
||||||
+ !IsPopupWithoutToplevelParent(menuPopupFrame)) {
|
|
||||||
parentWindow =
|
|
||||||
get_window_for_gtk_widget(GTK_WIDGET(mToplevelParentWindow));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk
|
|
||||||
--- a/config/makefiles/rust.mk
|
|
||||||
+++ b/config/makefiles/rust.mk
|
|
||||||
@@ -61,7 +61,11 @@
|
|
||||||
# Enable link-time optimization for release builds, but not when linking
|
|
||||||
# gkrust_gtest.
|
|
||||||
ifeq (,$(findstring gkrust_gtest,$(RUST_LIBRARY_FILE)))
|
|
||||||
+# Pass -Clto for older versions of rust, and CARGO_PROFILE_RELEASE_LTO=true
|
|
||||||
+# for newer ones that support it. Combining the latter with -Clto works, so
|
|
||||||
+# set both everywhere.
|
|
||||||
cargo_rustc_flags += -Clto
|
|
||||||
+export CARGO_PROFILE_RELEASE_LTO=true
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
changeset: 544864:a8603f131703
|
|
||||||
tag: tip
|
|
||||||
parent: 544861:161920b70ae4
|
|
||||||
user: Martin Stransky <stransky@redhat.com>
|
|
||||||
date: Fri Jul 31 13:39:48 2020 +0200
|
|
||||||
files: dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
|
||||||
description:
|
|
||||||
Bug 1645671 [Linux/VA-API] Create DMABufSurfaceWrapper directly at nsTAttay and disable DMABufSurfaceWrapper class copy and assignment constructors, r?jya
|
|
||||||
|
|
||||||
When DMABufSurfaceWrapper is added to nsTArray, a temporary local DMABufSurfaceWrapper object is created. When the temporary
|
|
||||||
object is deleted after the adding, associated dmabuf data is released which leads to rendering artifact during VA-API video playback.
|
|
||||||
|
|
||||||
As a fix in this patch we create DMABufSurfaceWrapper 'in-place' at nsTAttay.
|
|
||||||
We also disable DMABufSurfaceWrapper class copy and assignment constructors to avoid similar potential issues.
|
|
||||||
|
|
||||||
Differential Revision: https://phabricator.services.mozilla.com/D85152
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
|
||||||
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
|
||||||
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
|
||||||
@@ -777,17 +777,17 @@ MediaResult FFmpegVideoDecoder<LIBAV_VER
|
|
||||||
RESULT_DETAIL("Unable to get DMABufSurfaceYUV"));
|
|
||||||
}
|
|
||||||
|
|
||||||
# ifdef MOZ_LOGGING
|
|
||||||
static int uid = 0;
|
|
||||||
surface->SetUID(++uid);
|
|
||||||
FFMPEG_LOG("Created new DMABufSurface UID = %d", uid);
|
|
||||||
# endif
|
|
||||||
- mDMABufSurfaces.AppendElement(DMABufSurfaceWrapper(surface, mLib));
|
|
||||||
+ mDMABufSurfaces.EmplaceBack(surface, mLib);
|
|
||||||
surfaceWrapper = &(mDMABufSurfaces[mDMABufSurfaces.Length() - 1]);
|
|
||||||
} else {
|
|
||||||
surface = surfaceWrapper->GetDMABufSurface();
|
|
||||||
bool ret;
|
|
||||||
|
|
||||||
if (mVAAPIDeviceContext) {
|
|
||||||
ret = surface->UpdateYUVData(vaDesc);
|
|
||||||
} else {
|
|
||||||
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
|
||||||
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
|
||||||
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
|
|
||||||
@@ -70,16 +70,22 @@ class DMABufSurfaceWrapper final {
|
|
||||||
// Check if DMABufSurface is used by any gecko rendering process
|
|
||||||
// (WebRender or GL compositor) or by DMABUFSurfaceImage/VideoData.
|
|
||||||
bool IsUsed() const { return mSurface->IsGlobalRefSet(); }
|
|
||||||
|
|
||||||
RefPtr<DMABufSurfaceYUV> GetDMABufSurface() const {
|
|
||||||
return mSurface->GetAsDMABufSurfaceYUV();
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Don't allow DMABufSurfaceWrapper plain copy as it leads to
|
|
||||||
+ // enexpected DMABufSurface/HW buffer releases and we don't want to
|
|
||||||
+ // deep copy them.
|
|
||||||
+ DMABufSurfaceWrapper(const DMABufSurfaceWrapper&) = delete;
|
|
||||||
+ const DMABufSurfaceWrapper& operator=(DMABufSurfaceWrapper const&) = delete;
|
|
||||||
+
|
|
||||||
private:
|
|
||||||
const RefPtr<DMABufSurface> mSurface;
|
|
||||||
const FFmpegLibWrapper* mLib;
|
|
||||||
AVBufferRef* mAVHWFramesContext;
|
|
||||||
AVBufferRef* mHWAVBuffer;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
diff -up firefox-79.0/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp.mozilla-1656436 firefox-79.0/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
|
|
||||||
--- firefox-79.0/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp.mozilla-1656436 2020-08-04 13:31:49.476663242 +0200
|
|
||||||
+++ firefox-79.0/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp 2020-08-04 13:32:28.201448682 +0200
|
|
||||||
@@ -766,6 +766,11 @@ MediaResult FFmpegVideoDecoder<LIBAV_VER
|
|
||||||
mDMABufSurfaces.EmplaceBack(surface, mLib);
|
|
||||||
surfaceWrapper = &(mDMABufSurfaces[mDMABufSurfaces.Length() - 1]);
|
|
||||||
} else {
|
|
||||||
+ // Release VAAPI surface data before we reuse it.
|
|
||||||
+ if (mVAAPIDeviceContext) {
|
|
||||||
+ surfaceWrapper->ReleaseVAAPIData();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
surface = surfaceWrapper->GetDMABufSurface();
|
|
||||||
bool ret;
|
|
||||||
|
|
||||||
diff -up firefox-79.0/widget/gtk/DMABufSurface.cpp.mozilla-1656436 firefox-79.0/widget/gtk/DMABufSurface.cpp
|
|
||||||
--- firefox-79.0/widget/gtk/DMABufSurface.cpp.mozilla-1656436 2020-08-04 13:31:49.477663237 +0200
|
|
||||||
+++ firefox-79.0/widget/gtk/DMABufSurface.cpp 2020-08-04 13:33:07.666230023 +0200
|
|
||||||
@@ -744,7 +744,8 @@ bool DMABufSurfaceYUV::UpdateYUVData(con
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (mDmabufFds[0] >= 0) {
|
|
||||||
- ReleaseSurface();
|
|
||||||
+ NS_WARNING("DMABufSurfaceYUV is already created!");
|
|
||||||
+ return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mSurfaceFormat = gfx::SurfaceFormat::NV12;
|
|
||||||
14
mozilla-1669639.patch
Normal file
14
mozilla-1669639.patch
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
--- firefox-81.0.1/build/mach_initialize.py.old 2020-10-06 14:16:06.212974910 +0200
|
||||||
|
+++ firefox-81.0.1/build/mach_initialize.py 2020-10-06 14:19:03.313179557 +0200
|
||||||
|
@@ -507,7 +507,10 @@ class ImportHook(object):
|
||||||
|
# doesn't happen or because it doesn't matter).
|
||||||
|
if not os.path.exists(module.__file__[:-1]):
|
||||||
|
if os.path.exists(module.__file__):
|
||||||
|
- os.remove(module.__file__)
|
||||||
|
+ try:
|
||||||
|
+ os.remove(module.__file__)
|
||||||
|
+ except:
|
||||||
|
+ pass
|
||||||
|
del sys.modules[module.__name__]
|
||||||
|
module = self(name, globals, locals, fromlist, level)
|
||||||
|
|
||||||
68
mozilla-1670333.patch
Normal file
68
mozilla-1670333.patch
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
diff -up firefox-99.0/dom/media/mp4/MP4Demuxer.cpp.1670333 firefox-99.0/dom/media/mp4/MP4Demuxer.cpp
|
||||||
|
--- firefox-99.0/dom/media/mp4/MP4Demuxer.cpp.1670333 2022-03-31 01:24:44.000000000 +0200
|
||||||
|
+++ firefox-99.0/dom/media/mp4/MP4Demuxer.cpp 2022-04-04 09:58:35.606351546 +0200
|
||||||
|
@@ -31,6 +31,8 @@ mozilla::LogModule* GetDemuxerLog() { re
|
||||||
|
DDMOZ_LOG(gMediaDemuxerLog, mozilla::LogLevel::Debug, "::%s: " arg, \
|
||||||
|
__func__, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
+extern bool gUseKeyframeFromContainer;
|
||||||
|
+
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
DDLoggedTypeDeclNameAndBase(MP4TrackDemuxer, MediaTrackDemuxer);
|
||||||
|
@@ -394,6 +396,12 @@ already_AddRefed<MediaRawData> MP4TrackD
|
||||||
|
[[fallthrough]];
|
||||||
|
case H264::FrameType::OTHER: {
|
||||||
|
bool keyframe = type == H264::FrameType::I_FRAME;
|
||||||
|
+ if (gUseKeyframeFromContainer) {
|
||||||
|
+ if (sample->mKeyframe && sample->mKeyframe != keyframe) {
|
||||||
|
+ sample->mKeyframe = keyframe;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
if (sample->mKeyframe != keyframe) {
|
||||||
|
NS_WARNING(nsPrintfCString("Frame incorrectly marked as %skeyframe "
|
||||||
|
"@ pts:%" PRId64 " dur:%" PRId64
|
||||||
|
diff -up firefox-99.0/dom/media/platforms/PDMFactory.cpp.1670333 firefox-99.0/dom/media/platforms/PDMFactory.cpp
|
||||||
|
--- firefox-99.0/dom/media/platforms/PDMFactory.cpp.1670333 2022-03-31 01:24:44.000000000 +0200
|
||||||
|
+++ firefox-99.0/dom/media/platforms/PDMFactory.cpp 2022-04-04 10:09:57.383419125 +0200
|
||||||
|
@@ -58,6 +58,8 @@
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
+bool gUseKeyframeFromContainer = false;
|
||||||
|
+
|
||||||
|
namespace mozilla {
|
||||||
|
|
||||||
|
#define PDM_INIT_LOG(msg, ...) \
|
||||||
|
@@ -495,7 +497,7 @@ void PDMFactory::CreateRddPDMs() {
|
||||||
|
#ifdef MOZ_FFMPEG
|
||||||
|
if (StaticPrefs::media_ffmpeg_enabled() &&
|
||||||
|
StaticPrefs::media_rdd_ffmpeg_enabled() &&
|
||||||
|
- !CreateAndStartupPDM<FFmpegRuntimeLinker>()) {
|
||||||
|
+ !(mFFmpegUsed = CreateAndStartupPDM<FFmpegRuntimeLinker>())) {
|
||||||
|
mFailureFlags += GetFailureFlagBasedOnFFmpegStatus(
|
||||||
|
FFmpegRuntimeLinker::LinkStatusCode());
|
||||||
|
}
|
||||||
|
@@ -602,8 +604,9 @@ void PDMFactory::CreateDefaultPDMs() {
|
||||||
|
|
||||||
|
CreateAndStartupPDM<AgnosticDecoderModule>();
|
||||||
|
|
||||||
|
- if (StaticPrefs::media_gmp_decoder_enabled() &&
|
||||||
|
+ if (StaticPrefs::media_gmp_decoder_enabled() && !mFFmpegUsed &&
|
||||||
|
!CreateAndStartupPDM<GMPDecoderModule>()) {
|
||||||
|
+ gUseKeyframeFromContainer = true;
|
||||||
|
mFailureFlags += DecoderDoctorDiagnostics::Flags::GMPPDMFailedToStartup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff -up firefox-99.0/dom/media/platforms/PDMFactory.h.1670333 firefox-99.0/dom/media/platforms/PDMFactory.h
|
||||||
|
--- firefox-99.0/dom/media/platforms/PDMFactory.h.1670333 2022-03-31 01:24:44.000000000 +0200
|
||||||
|
+++ firefox-99.0/dom/media/platforms/PDMFactory.h 2022-04-04 09:58:35.606351546 +0200
|
||||||
|
@@ -121,6 +121,7 @@ class PDMFactory final {
|
||||||
|
RefPtr<PlatformDecoderModule> mNullPDM;
|
||||||
|
|
||||||
|
DecoderDoctorDiagnostics::FlagsSet mFailureFlags;
|
||||||
|
+ bool mFFmpegUsed = false;
|
||||||
|
|
||||||
|
friend class RemoteVideoDecoderParent;
|
||||||
|
static void EnsureInit();
|
||||||
17
mozilla-1775202.patch
Normal file
17
mozilla-1775202.patch
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
diff --git a/third_party/libwebrtc/moz.build b/third_party/libwebrtc/moz.build
|
||||||
|
index 8579f8bb3622..d9ca79d4fcb8 100644
|
||||||
|
--- a/third_party/libwebrtc/moz.build
|
||||||
|
+++ b/third_party/libwebrtc/moz.build
|
||||||
|
@@ -520,7 +520,10 @@ if CONFIG["CPU_ARCH"] == "ppc64" and CONFIG["OS_TARGET"] == "Linux":
|
||||||
|
"/third_party/libwebrtc/api/audio_codecs/isac/audio_decoder_isac_float_gn",
|
||||||
|
"/third_party/libwebrtc/api/audio_codecs/isac/audio_encoder_isac_float_gn",
|
||||||
|
"/third_party/libwebrtc/modules/audio_coding/isac_c_gn",
|
||||||
|
- "/third_party/libwebrtc/modules/audio_coding/isac_gn"
|
||||||
|
+ "/third_party/libwebrtc/modules/audio_coding/isac_gn",
|
||||||
|
+ "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_generic_gn",
|
||||||
|
+ "/third_party/libwebrtc/modules/desktop_capture/desktop_capture_gn",
|
||||||
|
+ "/third_party/libwebrtc/modules/desktop_capture/primitives_gn"
|
||||||
|
]
|
||||||
|
|
||||||
|
if CONFIG["CPU_ARCH"] == "x86" and CONFIG["OS_TARGET"] == "Linux":
|
||||||
|
|
||||||
30
mozilla-bmo1005535.patch
Normal file
30
mozilla-bmo1005535.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# HG changeset patch
|
||||||
|
# User Steve Singer <steve@ssinger.info>
|
||||||
|
# Date 1558451540 -7200
|
||||||
|
# Tue May 21 17:12:20 2019 +0200
|
||||||
|
# Node ID 433beec63e6b5f409683af20a0c1ab137cc7bfad
|
||||||
|
# Parent c0fdccc716e80a6d289c94f5d507ae141c62a3bf
|
||||||
|
Bug 1005535 - Get skia GPU building on big endian.
|
||||||
|
|
||||||
|
diff --git a/gfx/skia/skia/src/gpu/GrColor.h b/gfx/skia/skia/src/gpu/GrColor.h
|
||||||
|
--- a/gfx/skia/skia/src/gpu/GrColor.h
|
||||||
|
+++ b/gfx/skia/skia/src/gpu/GrColor.h
|
||||||
|
@@ -59,17 +59,17 @@ static inline GrColor GrColorPackRGBA(un
|
||||||
|
#define GrColorUnpackG(color) (((color) >> GrColor_SHIFT_G) & 0xFF)
|
||||||
|
#define GrColorUnpackB(color) (((color) >> GrColor_SHIFT_B) & 0xFF)
|
||||||
|
#define GrColorUnpackA(color) (((color) >> GrColor_SHIFT_A) & 0xFF)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since premultiplied means that alpha >= color, we construct a color with
|
||||||
|
* each component==255 and alpha == 0 to be "illegal"
|
||||||
|
*/
|
||||||
|
-#define GrColor_ILLEGAL (~(0xFF << GrColor_SHIFT_A))
|
||||||
|
+#define GrColor_ILLEGAL ((uint32_t)(~(0xFF << GrColor_SHIFT_A)))
|
||||||
|
|
||||||
|
/** Normalizes and coverts an uint8_t to a float. [0, 255] -> [0.0, 1.0] */
|
||||||
|
static inline float GrNormalizeByteToFloat(uint8_t value) {
|
||||||
|
static const float ONE_OVER_255 = 1.f / 255.f;
|
||||||
|
return value * ONE_OVER_255;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Used to pick vertex attribute types. */
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user