www/waterfox: add new (demo) port

PR:		222859
This commit is contained in:
Jan Beich 2017-11-27 13:25:12 +00:00
parent 871a6a8fdf
commit 957e43ec8a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=454949
46 changed files with 8094 additions and 0 deletions

View file

@ -2415,6 +2415,7 @@
SUBDIR += w3mir
SUBDIR += waccess
SUBDIR += wadcomblog
SUBDIR += waterfox
SUBDIR += web2ldap
SUBDIR += webalizer
SUBDIR += webbrowser

73
www/waterfox/Makefile Normal file
View file

@ -0,0 +1,73 @@
# $FreeBSD$
PORTNAME= waterfox
DISTVERSION= 56.0.s20171122
CATEGORIES= www ipv6
MAINTAINER= jbeich@FreeBSD.org
COMMENT= Distilled fork of Firefox ${MOZILLA_VER:R:R}
DEPRECATED= Temporary experiment
EXPIRATION_DATE=2017-12-12
BUILD_DEPENDS= nspr>=4.16:devel/nspr \
nss>=3.32.1:security/nss \
icu>=59.1,1:devel/icu \
libevent>=2.1.8:devel/libevent \
harfbuzz>=1.4.7:print/harfbuzz \
graphite2>=1.3.10:graphics/graphite2 \
png>=1.6.31:graphics/png \
libvorbis>=1.3.5,3:audio/libvorbis \
libvpx>=1.5.0:multimedia/libvpx \
sqlite3>=3.19.3:databases/sqlite3 \
${PYTHON_PKGNAMEPREFIX}sqlite3>0:databases/py-sqlite3 \
v4l_compat>0:multimedia/v4l_compat \
autoconf-2.13:devel/autoconf213 \
yasm:devel/yasm \
zip:archivers/zip
# soundtouch>=1.9.0:audio/soundtouch \
LIB_DEPENDS= libv4l2.so:multimedia/libv4l
USE_GITHUB= yes
GH_ACCOUNT= MrAlex94
GH_PROJECT= Waterfox
GH_TAGNAME= 224e688d8ddf
USE_GECKO= gecko
MOZ_PKGCONFIG_FILES= # empty
USE_MOZILLA= -soundtouch
MOZILLA_NAME= Waterfox
USE_GL= gl
WATERFOX_ICON= ${MOZILLA}.png
WATERFOX_ICON_SRC= ${PREFIX}/lib/${MOZILLA}/browser/chrome/icons/default/default256.png
WATERFOX_DESKTOP= ${MOZSRC}/taskcluster/docker/firefox-snap/firefox.desktop
MOZ_OPTIONS= --enable-application=browser \
--with-app-name=${MOZILLA} \
--with-app-basename=${MOZILLA_NAME} \
--with-distribution-id=org.${MOZILLA}project
OPTIONS_DEFAULT= BUNDLED_CAIRO
.include "${.CURDIR}/../../www/firefox/Makefile.options"
post-patch:
@${REINPLACE_CMD} -e 's/%u/%U/' -e '/X-MultipleArgs/d' \
-e 's/Firefox/${MOZILLA_NAME}/' \
${WATERFOX_DESKTOP}
@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
${WRKSRC}/browser/app/nsBrowserApp.cpp
pre-configure:
(cd ${WRKSRC} && ${LOCALBASE}/bin/autoconf-2.13)
(cd ${WRKSRC}/js/src/ && ${LOCALBASE}/bin/autoconf-2.13)
post-install:
${INSTALL_DATA} ${WATERFOX_DESKTOP} \
${STAGEDIR}${PREFIX}/share/applications/${MOZILLA}.desktop
${MKDIR} ${STAGEDIR}${PREFIX}/share/pixmaps
${LN} -sf ${WATERFOX_ICON_SRC} ${STAGEDIR}${PREFIX}/share/pixmaps/${WATERFOX_ICON}
.include <bsd.port.mk>

3
www/waterfox/distinfo Normal file
View file

@ -0,0 +1,3 @@
TIMESTAMP = 1511372895
SHA256 (MrAlex94-Waterfox-56.0.s20171122-224e688d8ddf_GH0.tar.gz) = f9d62e1f1d4379304e688dcd895bc1dded49fb7ed99d03419662db08ffc84a13
SIZE (MrAlex94-Waterfox-56.0.s20171122-224e688d8ddf_GH0.tar.gz) = 394181158

View file

@ -0,0 +1,12 @@
--- browser/app/nsBrowserApp.cpp.orig 2016-09-19 16:19:28 UTC
+++ browser/app/nsBrowserApp.cpp
@@ -324,6 +324,9 @@ int main(int argc, char* argv[], char* e
{
mozilla::TimeStamp start = mozilla::TimeStamp::Now();
+ setenv("MOZ_GMP_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
+ setenv("MOZ_PLUGIN_PATH", "%%LOCALBASE%%/lib/browser_plugins/symlinks/gecko", 0);
+
#ifdef HAS_DLL_BLOCKLIST
DllBlocklist_Initialize();

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,23 @@
Revert bug 1323303 to unbreak build on big-endian architectures.
diff --git toolkit/moz.configure toolkit/moz.configure
index 67fcbc39d075..c117fd11a358 100644
--- toolkit/moz.configure
+++ toolkit/moz.configure
@@ -1032,11 +1032,11 @@ add_old_configure_assignment('NECKO_PROTOCOLS', necko_protocols)
# ==============================================================
option('--disable-skia', help='Disable use of Skia')
-@depends('--disable-skia')
-def skia(value):
- if not value:
- die('--disable-skia is not supported anymore')
- else:
+@depends('--disable-skia', target)
+def skia(value, target):
+ if value.origin == 'default' and target.endianness == 'big':
+ return None
+ if value:
return True
set_config('MOZ_ENABLE_SKIA', skia)

View file

@ -0,0 +1,41 @@
commit 64bb4e051b50
Author: Martin Stransky <stransky@redhat.com>
Date: Tue Oct 17 09:50:18 2017 +0200
Bug 1186967 - ignore double-click on WM without _NET_WM_MOVERESIZE support, r=jhorak
MozReview-Commit-ID: 2Vs6i5leero
--HG--
extra : rebase_source : d8f2bbaf9ef9b2025478f029a68ee7e87e07de79
---
widget/gtk/nsWindow.cpp | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git widget/gtk/nsWindow.cpp widget/gtk/nsWindow.cpp
index eb2f0e5e95cd..955327297ac9 100644
--- widget/gtk/nsWindow.cpp
+++ widget/gtk/nsWindow.cpp
@@ -6444,6 +6444,22 @@ nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent,
return false;
}
+ if (mIsX11Display) {
+ // Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054
+ // To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE.
+ // See _should_perform_ewmh_drag() at gdkwindow-x11.c
+ GdkScreen* screen = gdk_window_get_screen(gdk_window);
+ GdkAtom atom = gdk_atom_intern("_NET_WM_MOVERESIZE", FALSE);
+ if (!gdk_x11_screen_supports_net_wm_hint(screen, atom)) {
+ static unsigned int lastTimeStamp = 0;
+ if (lastTimeStamp != aMouseEvent->mTime) {
+ lastTimeStamp = aMouseEvent->mTime;
+ } else {
+ return false;
+ }
+ }
+ }
+
// FIXME: It would be nice to have the widget position at the time
// of the event, but it's relatively unlikely that the widget has
// moved since the mousedown. (On the other hand, it's quite likely

View file

@ -0,0 +1,67 @@
diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
index 855214a..1e91d51 100644
--- build/moz.configure/init.configure
+++ build/moz.configure/init.configure
@@ -165,16 +165,17 @@ option(env='PYTHON', nargs=1, help='Python interpreter')
# ==============================================================
@depends('PYTHON', check_build_environment, mozconfig, '--help')
@imports('os')
@imports('sys')
@imports('subprocess')
@imports(_from='mozbuild.configure.util', _import='LineIO')
@imports(_from='mozbuild.virtualenv', _import='VirtualenvManager')
@imports(_from='mozbuild.virtualenv', _import='verify_python_version')
+@imports(_from='__builtin__', _import='KeyError')
@imports('distutils.sysconfig')
def virtualenv_python(env_python, build_env, mozconfig, help):
if help:
return
python = env_python[0] if env_python else None
# Ideally we'd rely on the mozconfig injection from mozconfig_options,
@@ -184,16 +185,22 @@ def virtualenv_python(env_python, build_env, mozconfig, help):
if 'PYTHON' in mozconfig['env']['added']:
python = mozconfig['env']['added']['PYTHON']
elif 'PYTHON' in mozconfig['env']['modified']:
python = mozconfig['env']['modified']['PYTHON'][1]
elif 'PYTHON' in mozconfig['vars']['added']:
python = mozconfig['vars']['added']['PYTHON']
elif 'PYTHON' in mozconfig['vars']['modified']:
python = mozconfig['vars']['modified']['PYTHON'][1]
+ for i in ('env', 'vars'):
+ for j in ('added', 'modified'):
+ try:
+ del mozconfig[i][j]['PYTHON']
+ except KeyError:
+ pass
with LineIO(lambda l: log.error(l)) as out:
verify_python_version(out)
topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir
if topobjdir.endswith('/js/src'):
topobjdir = topobjdir[:-7]
with LineIO(lambda l: log.info(l)) as out:
@@ -219,17 +226,20 @@ def virtualenv_python(env_python, build_env, mozconfig, help):
log.info('Creating Python environment')
manager.build(python)
python = normsep(manager.python_path)
if python != normsep(sys.executable):
log.info('Reexecuting in the virtualenv')
if env_python:
- del os.environ['PYTHON']
+ try:
+ del os.environ['PYTHON']
+ except KeyError:
+ pass
# One would prefer to use os.execl, but that's completely borked on
# Windows.
sys.exit(subprocess.call([python] + sys.argv))
# We are now in the virtualenv
if not distutils.sysconfig.get_python_lib():
die('Could not determine python site packages directory')

View file

@ -0,0 +1,117 @@
commit e215b167b9b9
Author: cku <cku@mozilla.com>
Date: Tue Oct 3 11:29:19 2017 +0800
Bug 1343147 - Do not double applying transform vector of the root frame in a glyph mask into the target context. r=mstange, a=ritu
When we generate the glyph mask for a transformed frame in
GenerateAndPushTextMask, the transform vector had been applied into aContext[1],
so we should find a way to prevent applying the vector again when painting the
glyph mask.
In bug 1299715, I tried to prevent double apply at [2], it caused two problems:
1. We only skip generating nsDisplayTransform, but we may still create a
nsDisplayPerspactive bellow. Since the parent of a nsDisplayPerspective must be
a nsDisplayTransform, which have been ignored, so we hit this assertion.
2. We skip all transform for all frames while painting the glyph mask, which is
not correct. We should only skip double applying transform vector of the root
frame.
This patch fixes both of these issues:
a. We will still create a nsDisplayTransform for the root frame if need. But
the transform matrix we apply into the target context will be an identity
matrix, so we fix #1 above.
b. In #a, we change the transform matrix to an identity matrix only for the root
frame of the glyph mask, so we fix #2.
[1]
https://hg.mozilla.org/mozilla-central/file/59e5ec5729db/layout/painting/nsDisplayList.cpp#l752
[2]
https://hg.mozilla.org/mozilla-central/file/ce2c129f0a87/layout/generic/nsFrame.cpp#l2806
MozReview-Commit-ID: 973lkQQxLB6
--HG--
extra : source : 84451d723686bc47b81c44ed2ddf6c61f3e35915
---
layout/generic/nsFrame.cpp | 13 +++++--------
layout/painting/nsDisplayList.cpp | 9 ++++++++-
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git layout/generic/nsFrame.cpp layout/generic/nsFrame.cpp
index 37f2e2801220..dbfd61b7e142 100644
--- layout/generic/nsFrame.cpp
+++ layout/generic/nsFrame.cpp
@@ -2803,14 +2803,11 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
buildingDisplayList.SetReferenceFrameAndCurrentOffset(outerReferenceFrame,
GetOffsetToCrossDoc(outerReferenceFrame));
- if (!aBuilder->IsForGenerateGlyphMask() &&
- !aBuilder->IsForPaintingSelectionBG()) {
- nsDisplayTransform *transformItem =
- new (aBuilder) nsDisplayTransform(aBuilder, this,
- &resultList, dirtyRect, 0,
- allowAsyncAnimation);
- resultList.AppendNewToTop(transformItem);
- }
+ nsDisplayTransform *transformItem =
+ new (aBuilder) nsDisplayTransform(aBuilder, this,
+ &resultList, dirtyRect, 0,
+ allowAsyncAnimation);
+ resultList.AppendNewToTop(transformItem);
if (hasPerspective) {
if (clipCapturedBy == ContainerItemType::ePerspective) {
diff --git layout/painting/nsDisplayList.cpp layout/painting/nsDisplayList.cpp
index 801e1ea2fb4d..6477bda52f01 100644
--- layout/painting/nsDisplayList.cpp
+++ layout/painting/nsDisplayList.cpp
@@ -7976,11 +7976,18 @@ already_AddRefed<Layer> nsDisplayTransform::BuildLayer(nsDisplayListBuilder *aBu
LayerManager *aManager,
const ContainerLayerParameters& aContainerParameters)
{
+ // While generating a glyph mask, the transform vector of the root frame had
+ // been applied into the target context, so stop applying it again here.
+ const bool shouldSkipTransform =
+ (aBuilder->RootReferenceFrame() == mFrame) &&
+ (aBuilder->IsForGenerateGlyphMask() || aBuilder->IsForPaintingSelectionBG());
+
/* For frames without transform, it would not be removed for
* backface hidden here. But, it would be removed by the init
* function of nsDisplayTransform.
*/
- const Matrix4x4& newTransformMatrix = GetTransformForRendering();
+ const Matrix4x4 newTransformMatrix =
+ shouldSkipTransform ? Matrix4x4(): GetTransformForRendering();
uint32_t flags = FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR;
RefPtr<ContainerLayer> container = aManager->GetLayerBuilder()->
diff --git dom/svg/crashtests/1343147.svg dom/svg/crashtests/1343147.svg
new file mode 100644
index 000000000000..d9c2611ca822
--- /dev/null
+++ dom/svg/crashtests/1343147.svg
@@ -0,0 +1,13 @@
+<svg xmlns="http://www.w3.org/2000/svg">
+<style>
+<![CDATA[
+ svg {
+ background-image: linear-gradient(lime, lime);
+ background-clip: text;
+ }
+ text { transform: skewy(30grad); }
+ g { perspective: 0; }
+]]>
+</style>
+ <g><text>hello</text></g>
+</svg>
diff --git dom/svg/crashtests/crashtests.list dom/svg/crashtests/crashtests.list
index 1727a206ec4f..57ab320161e2 100644
--- dom/svg/crashtests/crashtests.list
+++ dom/svg/crashtests/crashtests.list
@@ -90,4 +90,5 @@ load 1329849-5.svg
load 1329849-6.svg
load 1329093-1.html
load 1329093-2.html
+load 1343147.svg
load 1402798.html

View file

@ -0,0 +1,262 @@
commit e530ba4d4394
Author: Thomas Wisniewski <wisniewskit@gmail.com>
Date: Tue Jul 4 20:59:26 2017 -0400
Bug 1355576 - Add ability to clear all localStorage with the browsingData API; r=bsilverberg,janv
MozReview-Commit-ID: 4UUqg62yIo9
--HG--
extra : rebase_source : 9c6154bbe878fc3921d22027fdc90dbdaed05be9
---
browser/components/extensions/ext-browsingData.js | 10 +++
.../extensions/schemas/browsing_data.json | 1 -
.../extensions/test/browser/browser-common.ini | 1 +
.../browser_ext_browsingData_localStorage.js | 93 ++++++++++++++++++++++
.../test/xpcshell/test_ext_browsingData.js | 4 +-
dom/storage/LocalStorageManager.cpp | 3 +-
dom/storage/StorageObserver.cpp | 12 +++
.../extensions/schemas/browsing_data.json | 1 -
8 files changed, 120 insertions(+), 5 deletions(-)
diff --git browser/components/extensions/ext-browsingData.js browser/components/extensions/ext-browsingData.js
index fd59141dd15d..109ec9601487 100644
--- browser/components/extensions/ext-browsingData.js
+++ browser/components/extensions/ext-browsingData.js
@@ -83,6 +83,10 @@ const clearHistory = options => {
return sanitizer.items.history.clear(makeRange(options));
};
+const clearLocalStorage = async function(options) {
+ Services.obs.notifyObservers(null, "extension:purge-localStorage");
+};
+
const clearPasswords = async function(options) {
let loginManager = Services.logins;
let yieldCounter = 0;
@@ -152,6 +156,9 @@ const doRemoval = (options, dataToRemove, extension) => {
case "history":
removalPromises.push(clearHistory(options));
break;
+ case "localStorage":
+ removalPromises.push(clearLocalStorage(options));
+ break;
case "passwords":
removalPromises.push(clearPasswords(options));
break;
@@ -225,6 +232,9 @@ this.browsingData = class extends ExtensionAPI {
removeHistory(options) {
return doRemoval(options, {history: true});
},
+ removeLocalStorage(options) {
+ return doRemoval(options, {localStorage: true});
+ },
removePasswords(options) {
return doRemoval(options, {passwords: true});
},
diff --git browser/components/extensions/schemas/browsing_data.json browser/components/extensions/schemas/browsing_data.json
index a780f5640c8f..7755714eb898 100644
--- browser/components/extensions/schemas/browsing_data.json
+++ browser/components/extensions/schemas/browsing_data.json
@@ -341,7 +341,6 @@
"description": "Clears websites' local storage data.",
"type": "function",
"async": "callback",
- "unsupported": true,
"parameters": [
{
"$ref": "RemovalOptions",
diff --git browser/components/extensions/test/browser/browser-common.ini browser/components/extensions/test/browser/browser-common.ini
index 464b8ba18f37..e3f7700f3939 100644
--- browser/components/extensions/test/browser/browser-common.ini
+++ browser/components/extensions/test/browser/browser-common.ini
@@ -46,6 +46,7 @@ skip-if = (os == 'win' && !debug) # bug 1352668
[browser_ext_browserAction_theme_icons.js]
[browser_ext_browsingData_formData.js]
[browser_ext_browsingData_history.js]
+[browser_ext_browsingData_localStorage.js]
[browser_ext_browsingData_pluginData.js]
[browser_ext_browsingData_serviceWorkers.js]
[browser_ext_commands_execute_browser_action.js]
diff --git browser/components/extensions/test/browser/browser_ext_browsingData_localStorage.js browser/components/extensions/test/browser/browser_ext_browsingData_localStorage.js
new file mode 100644
index 000000000000..215f26d1fcb6
--- /dev/null
+++ browser/components/extensions/test/browser/browser_ext_browsingData_localStorage.js
@@ -0,0 +1,93 @@
+/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set sts=2 sw=2 et tw=80: */
+"use strict";
+
+add_task(async function testLocalStorage() {
+ async function background() {
+ function openTabs() {
+ let promise = new Promise(resolve => {
+ let tabURLs = [
+ "http://example.com/",
+ "http://example.net/",
+ ];
+
+ let tabs;
+ let waitingCount = tabURLs.length;
+
+ let listener = async msg => {
+ if (msg !== "content-script-ready" || --waitingCount) {
+ return;
+ }
+ browser.runtime.onMessage.removeListener(listener);
+ resolve(Promise.all(tabs));
+ };
+
+ browser.runtime.onMessage.addListener(listener);
+
+ tabs = tabURLs.map(url => {
+ return browser.tabs.create({url: url});
+ });
+ });
+
+ return promise;
+ }
+
+ function sendMessageToTabs(tabs, message) {
+ return Promise.all(
+ tabs.map(tab => { return browser.tabs.sendMessage(tab.id, message); }));
+ }
+
+ let tabs = await openTabs();
+
+ await sendMessageToTabs(tabs, "resetLocalStorage");
+ await sendMessageToTabs(tabs, "checkLocalStorageSet");
+ await browser.browsingData.removeLocalStorage({});
+ await sendMessageToTabs(tabs, "checkLocalStorageCleared");
+
+ await sendMessageToTabs(tabs, "resetLocalStorage");
+ await sendMessageToTabs(tabs, "checkLocalStorageSet");
+ await browser.browsingData.remove({}, {localStorage: true});
+ await sendMessageToTabs(tabs, "checkLocalStorageCleared");
+
+ browser.tabs.remove(tabs.map(tab => tab.id));
+
+ browser.test.notifyPass("done");
+ }
+
+ function contentScript() {
+ browser.runtime.onMessage.addListener(msg => {
+ if (msg === "resetLocalStorage") {
+ localStorage.clear();
+ localStorage.setItem("test", "test");
+ } else if (msg === "checkLocalStorageSet") {
+ browser.test.assertEq("test", localStorage.getItem("test"));
+ } else if (msg === "checkLocalStorageCleared") {
+ browser.test.assertEq(null, localStorage.getItem("test"));
+ }
+ });
+ browser.runtime.sendMessage("content-script-ready");
+ }
+
+ let extension = ExtensionTestUtils.loadExtension({
+ background,
+ manifest: {
+ "permissions": ["browsingData"],
+ "content_scripts": [{
+ "matches": [
+ "http://example.com/",
+ "http://example.net/",
+ ],
+ "js": ["content-script.js"],
+ "run_at": "document_start",
+ }],
+ },
+ files: {
+ "content-script.js": contentScript,
+ },
+ });
+
+ await extension.startup();
+ await extension.awaitFinish("done");
+ await extension.unload();
+});
+
diff --git browser/components/extensions/test/xpcshell/test_ext_browsingData.js browser/components/extensions/test/xpcshell/test_ext_browsingData.js
index 0c1c4874ca44..0b8972058e64 100644
--- browser/components/extensions/test/xpcshell/test_ext_browsingData.js
+++ browser/components/extensions/test/xpcshell/test_ext_browsingData.js
@@ -44,7 +44,7 @@ add_task(async function testInvalidArguments() {
add_task(async function testUnimplementedDataType() {
function background() {
- browser.browsingData.remove({}, {localStorage: true});
+ browser.browsingData.remove({}, {indexedDB: true});
browser.test.sendMessage("finished");
}
@@ -61,6 +61,6 @@ add_task(async function testUnimplementedDataType() {
await extension.unload();
});
- let warningObserved = messages.find(line => /Firefox does not support dataTypes: localStorage/.test(line));
+ let warningObserved = messages.find(line => /Firefox does not support dataTypes: indexedDB/.test(line));
ok(warningObserved, "Warning issued when calling remove with an unimplemented dataType.");
});
diff --git dom/storage/LocalStorageManager.cpp dom/storage/LocalStorageManager.cpp
index a161de2bc596..f366e7874a90 100644
--- dom/storage/LocalStorageManager.cpp
+++ dom/storage/LocalStorageManager.cpp
@@ -386,7 +386,8 @@ LocalStorageManager::Observe(const char* aTopic,
}
// Clear everything, caches + database
- if (!strcmp(aTopic, "cookie-cleared")) {
+ if (!strcmp(aTopic, "cookie-cleared") ||
+ !strcmp(aTopic, "extension:purge-localStorage-caches")) {
ClearCaches(LocalStorageCache::kUnloadComplete, pattern, EmptyCString());
return NS_OK;
}
diff --git dom/storage/StorageObserver.cpp dom/storage/StorageObserver.cpp
index e5b010f88c7b..48d484748209 100644
--- dom/storage/StorageObserver.cpp
+++ dom/storage/StorageObserver.cpp
@@ -66,6 +66,7 @@ StorageObserver::Init()
obs->AddObserver(sSelf, "browser:purge-domain-data", true);
obs->AddObserver(sSelf, "last-pb-context-exited", true);
obs->AddObserver(sSelf, "clear-origin-attributes-data", true);
+ obs->AddObserver(sSelf, "extension:purge-localStorage", true);
// Shutdown
obs->AddObserver(sSelf, "profile-after-change", true);
@@ -270,6 +271,23 @@ StorageObserver::Observe(nsISupports* aSubject,
Notify("session-only-cleared", NS_ConvertUTF8toUTF16(originSuffix),
originScope);
+
+ return NS_OK;
+ }
+
+ if (!strcmp(aTopic, "extension:purge-localStorage")) {
+ StorageDBChild* storageChild = StorageDBChild::GetOrCreate();
+ if (NS_WARN_IF(!storageChild)) {
+ return NS_ERROR_FAILURE;
+ }
+
+ storageChild->AsyncClearAll();
+
+ if (XRE_IsParentProcess()) {
+ storageChild->SendClearAll();
+ }
+
+ Notify("extension:purge-localStorage-caches");
return NS_OK;
}
diff --git mobile/android/components/extensions/schemas/browsing_data.json mobile/android/components/extensions/schemas/browsing_data.json
index 483a462d422c..1019c1a23953 100644
--- mobile/android/components/extensions/schemas/browsing_data.json
+++ mobile/android/components/extensions/schemas/browsing_data.json
@@ -345,7 +345,6 @@
"description": "Clears websites' local storage data.",
"type": "function",
"async": "callback",
- "unsupported": true,
"parameters": [
{
"$ref": "RemovalOptions",

View file

@ -0,0 +1,40 @@
commit 139967a109c1
Author: Jean-Yves Avenard <jyavenard@mozilla.com>
Date: Wed Oct 25 18:25:37 2017 +0200
Bug 1366201 - P5. Get around FFmpeg bug with corrupted data. r=gerald
According to FFmpeg documentation, the out parameter is "set to size of parsed buffer or zero if not yet finished. " however this is only the case if no error occurred; otherwise it is left untouched.
We want the invalid content to generate a decoding error, so we set size to inputSize to ensure decoding failed later.
MozReview-Commit-ID: FZeiZUdUtLG
---
dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
index 6acc8fef4dd8..fdee880c9e3b 100644
--- dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+++ dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
@@ -212,18 +212,18 @@ FFmpegVideoDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample, bool* aGotFrame,
#if LIBAVCODEC_VERSION_MAJOR >= 54
if (inputSize && mCodecParser && (mCodecID == AV_CODEC_ID_VP8
#if LIBAVCODEC_VERSION_MAJOR >= 55
|| mCodecID == AV_CODEC_ID_VP9
#endif
)) {
while (inputSize) {
- uint8_t* data;
- int size;
+ uint8_t* data = inputData;
+ int size = inputSize;
int len = mLib->av_parser_parse2(
mCodecParser, mCodecContext, &data, &size, inputData, inputSize,
aSample->mTime.ToMicroseconds(), aSample->mTimecode.ToMicroseconds(),
aSample->mOffset);
if (size_t(len) > inputSize) {
return NS_ERROR_DOM_MEDIA_DECODE_ERR;
}
inputData += len;

View file

@ -0,0 +1,929 @@
commit 2b68b38709b1
Author: Andrew McCreight <continuation@gmail.com>
Date: Tue Aug 22 14:24:11 2017 -0700
Bug 1377587, part 1 - Always act like __exposedProps__ is missing. r=krizsa
This patch gently removes support for __exposedProps__ by changing
ExposedPropertiesOnly::check() to always return false, while still
failing silently in deny for some kinds of access.
The tests that I changed all involve testing the behavior with
__exposedProps__. I adjusted them to expect it to fail, or to adjust
the error message they get when they fail. That seemed better than
deleting them entirely.
Note that test_bug1065185.html had a bug, so that it never executed
the first case. I fixed that, and then fixed up the test to work when
__exposedProps__ is not supported.
This also removes various bits of the test framework that use
__exposedProps__, but don't actually need to.
MozReview-Commit-ID: 8fvkAmITmXY
--HG--
extra : rebase_source : ef7e2c55adc12511f17f3865ebb46c343875f0b3
---
addon-sdk/source/lib/sdk/console/plain-text.js | 10 --
addon-sdk/source/lib/sdk/test/loader.js | 5 -
.../addons/e10s-content/lib/test-content-script.js | 6 +-
addon-sdk/source/test/test-content-script.js | 6 +-
devtools/server/tests/unit/test_objectgrips-17.js | 4 -
dom/base/nsDeprecatedOperationList.h | 1 -
dom/base/test/chrome/cpows_child.js | 12 +-
dom/locales/en-US/chrome/dom/dom.properties | 2 -
js/xpconnect/src/XPCJSRuntime.cpp | 1 -
js/xpconnect/src/xpcprivate.h | 1 -
js/xpconnect/tests/chrome/test_bug1065185.html | 6 +-
js/xpconnect/tests/chrome/test_cows.xul | 80 +++------
js/xpconnect/tests/chrome/test_exposeInDerived.xul | 13 +-
js/xpconnect/tests/unit/test_bug1082450.js | 20 +--
js/xpconnect/tests/unit/test_bug780370.js | 7 +-
js/xpconnect/tests/unit/test_bug813901.js | 2 +-
js/xpconnect/tests/unit/test_bug853709.js | 4 +-
js/xpconnect/tests/unit/test_bug854558.js | 2 +-
js/xpconnect/tests/unit/test_bug930091.js | 2 +-
js/xpconnect/wrappers/AccessCheck.cpp | 179 ---------------------
js/xpconnect/wrappers/AccessCheck.h | 11 +-
js/xpconnect/wrappers/ChromeObjectWrapper.h | 6 +-
js/xpconnect/wrappers/WrapperFactory.cpp | 4 +-
js/xpconnect/wrappers/XrayWrapper.cpp | 2 +-
testing/mochitest/tests/SimpleTest/ChromePowers.js | 9 --
.../specialpowers/content/MockPermissionPrompt.jsm | 12 --
.../components/addoncompat/RemoteAddonsParent.jsm | 2 +-
27 files changed, 74 insertions(+), 335 deletions(-)
diff --git addon-sdk/source/lib/sdk/console/plain-text.js addon-sdk/source/lib/sdk/console/plain-text.js
index 0e44cf106d52..07b8eb629e12 100644
--- addon-sdk/source/lib/sdk/console/plain-text.js
+++ addon-sdk/source/lib/sdk/console/plain-text.js
@@ -62,16 +62,6 @@ function PlainTextConsole(print, innerID) {
}
});
- // We defined the `__exposedProps__` in our console chrome object.
- //
- // Meanwhile we're investigating with the platform team if `__exposedProps__`
- // are needed, or are just a left-over.
-
- console.__exposedProps__ = Object.keys(ConsoleAPI.prototype).reduce(function(exposed, prop) {
- exposed[prop] = "r";
- return exposed;
- }, {});
-
Object.freeze(console);
return console;
};
diff --git addon-sdk/source/lib/sdk/test/loader.js addon-sdk/source/lib/sdk/test/loader.js
index 33ba2ca5a029..b555de63f02a 100644
--- addon-sdk/source/lib/sdk/test/loader.js
+++ addon-sdk/source/lib/sdk/test/loader.js
@@ -53,11 +53,6 @@ function HookedPlainTextConsole(hook, print, innerID) {
this.exception = hook.bind(null, "exception", innerID);
this.time = hook.bind(null, "time", innerID);
this.timeEnd = hook.bind(null, "timeEnd", innerID);
-
- this.__exposedProps__ = {
- log: "rw", info: "rw", warn: "rw", error: "rw", debug: "rw",
- exception: "rw", time: "rw", timeEnd: "rw"
- };
}
// Creates a custom loader instance whose console module is hooked in order
diff --git addon-sdk/source/test/addons/e10s-content/lib/test-content-script.js addon-sdk/source/test/addons/e10s-content/lib/test-content-script.js
index 477895e40481..3dccfec618d3 100644
--- addon-sdk/source/test/addons/e10s-content/lib/test-content-script.js
+++ addon-sdk/source/test/addons/e10s-content/lib/test-content-script.js
@@ -444,7 +444,7 @@ exports["test Highlight toString Behavior"] = createProxyTest("", function (help
let strToString = helper.rawWindow.Object.prototype.toString.call("");
assert.ok(/\[object String.*\]/.test(strToString), "strings are strings");
- let o = {__exposedProps__:{}};
+ let o = {};
let objToString = helper.rawWindow.Object.prototype.toString.call(o);
assert.ok(/\[object Object.*\]/.test(objToString), "objects are objects");
@@ -622,10 +622,6 @@ exports["test Functions"] = createProxyTest("", function (helper) {
helper.rawWindow.isEqual = function isEqual(a, b) {
return a == b;
};
- // bug 784116: workaround in order to allow proxy code to cache proxies on
- // these functions:
- helper.rawWindow.callFunction.__exposedProps__ = {__proxy: 'rw'};
- helper.rawWindow.isEqual.__exposedProps__ = {__proxy: 'rw'};
helper.createWorker(
'new ' + function ContentScriptScope() {
diff --git addon-sdk/source/test/test-content-script.js addon-sdk/source/test/test-content-script.js
index 709fb5a3aa91..a02e66f65eea 100644
--- addon-sdk/source/test/test-content-script.js
+++ addon-sdk/source/test/test-content-script.js
@@ -444,7 +444,7 @@ exports["test Highlight toString Behavior"] = createProxyTest("", function (help
let strToString = helper.rawWindow.Object.prototype.toString.call("");
assert.ok(/\[object String.*\]/.test(strToString), "strings are strings");
- let o = {__exposedProps__:{}};
+ let o = {};
let objToString = helper.rawWindow.Object.prototype.toString.call(o);
assert.ok(/\[object Object.*\]/.test(objToString), "objects are objects");
@@ -622,10 +622,6 @@ exports["test Functions"] = createProxyTest("", function (helper) {
helper.rawWindow.isEqual = function isEqual(a, b) {
return a == b;
};
- // bug 784116: workaround in order to allow proxy code to cache proxies on
- // these functions:
- helper.rawWindow.callFunction.__exposedProps__ = {__proxy: 'rw'};
- helper.rawWindow.isEqual.__exposedProps__ = {__proxy: 'rw'};
helper.createWorker(
'new ' + function ContentScriptScope() {
diff --git dom/base/nsDeprecatedOperationList.h dom/base/nsDeprecatedOperationList.h
index 2523187c63a7..adcf4d9d8202 100644
--- dom/base/nsDeprecatedOperationList.h
+++ dom/base/nsDeprecatedOperationList.h
@@ -21,7 +21,6 @@ DEPRECATED_OPERATION(NodeValue)
DEPRECATED_OPERATION(TextContent)
DEPRECATED_OPERATION(EnablePrivilege)
DEPRECATED_OPERATION(DOMExceptionCode)
-DEPRECATED_OPERATION(NoExposedProps)
DEPRECATED_OPERATION(MutationEvent)
DEPRECATED_OPERATION(Components)
DEPRECATED_OPERATION(PrefixedVisibilityAPI)
diff --git dom/base/test/chrome/cpows_child.js dom/base/test/chrome/cpows_child.js
index 6d240a7eaa51..fc7e3f2c9d0f 100644
--- dom/base/test/chrome/cpows_child.js
+++ dom/base/test/chrome/cpows_child.js
@@ -105,7 +105,13 @@ function parent_test(finish)
addMessageListener("cpows:from_parent", (msg) => {
let obj = msg.objects.obj;
- ok(obj.a == 1, "correct value from parent");
+ if (is_remote) {
+ ok(obj.a == undefined, "__exposedProps__ should not work");
+ } else {
+ // The same process test is not run as content, so the field can
+ // be accessed even though __exposedProps__ has been removed.
+ ok(obj.a == 1, "correct value from parent");
+ }
// Test that a CPOW reference to a function in the chrome process
// is callable from unprivileged content. Greasemonkey uses this
@@ -260,11 +266,11 @@ function lifetime_test(finish)
var obj = {"will_die": {"f": 1}};
let [result] = sendRpcMessage("cpows:lifetime_test_1", {}, {obj: obj});
ok(result == 10, "got sync result");
- ok(obj.wont_die.f == 2, "got reverse CPOW");
+ ok(obj.wont_die.f == undefined, "got reverse CPOW");
obj.will_die = null;
Components.utils.schedulePreciseGC(function() {
addMessageListener("cpows:lifetime_test_3", (msg) => {
- ok(obj.wont_die.f == 2, "reverse CPOW still works");
+ ok(obj.wont_die.f == undefined, "reverse CPOW still works");
finish();
});
sendRpcMessage("cpows:lifetime_test_2");
diff --git dom/locales/en-US/chrome/dom/dom.properties dom/locales/en-US/chrome/dom/dom.properties
index 5c94a580287a..ac9dbed58e08 100644
--- dom/locales/en-US/chrome/dom/dom.properties
+++ dom/locales/en-US/chrome/dom/dom.properties
@@ -154,8 +154,6 @@ MediaEMENoCapabilitiesDeprecatedWarning=Calling navigator.requestMediaKeySystemA
MediaEMENoCodecsDeprecatedWarning=Calling navigator.requestMediaKeySystemAccess() (at %S) passing a candidate MediaKeySystemConfiguration containing audioCapabilities or videoCapabilities without a contentType with a “codecs” string is deprecated and will soon become unsupported.
# LOCALIZATION NOTE: Do not translate "DOMException", "code" and "name"
DOMExceptionCodeWarning=Use of DOMExceptions code attribute is deprecated. Use name instead.
-# LOCALIZATION NOTE: Do not translate "__exposedProps__"
-NoExposedPropsWarning=Exposing chrome JS objects to content without __exposedProps__ is insecure and deprecated. See https://developer.mozilla.org/en/XPConnect_wrappers for more information.
# LOCALIZATION NOTE: Do not translate "Mutation Event" and "MutationObserver"
MutationEventWarning=Use of Mutation Events is deprecated. Use MutationObserver instead.
# LOCALIZATION NOTE: Do not translate "Components"
diff --git js/xpconnect/src/XPCJSRuntime.cpp js/xpconnect/src/XPCJSRuntime.cpp
index 455b9f8e963f..ff9aea0a41eb 100644
--- js/xpconnect/src/XPCJSRuntime.cpp
+++ js/xpconnect/src/XPCJSRuntime.cpp
@@ -93,7 +93,6 @@ const char* const XPCJSRuntime::mStrings[] = {
"item", // IDX_ITEM
"__proto__", // IDX_PROTO
"__iterator__", // IDX_ITERATOR
- "__exposedProps__", // IDX_EXPOSEDPROPS
"eval", // IDX_EVAL
"controllers", // IDX_CONTROLLERS
"Controllers", // IDX_CONTROLLERS_CLASS
diff --git js/xpconnect/src/xpcprivate.h js/xpconnect/src/xpcprivate.h
index fb7e43c22cd0..5d877f09d301 100644
--- js/xpconnect/src/xpcprivate.h
+++ js/xpconnect/src/xpcprivate.h
@@ -460,7 +460,6 @@ public:
IDX_ITEM ,
IDX_PROTO ,
IDX_ITERATOR ,
- IDX_EXPOSEDPROPS ,
IDX_EVAL ,
IDX_CONTROLLERS ,
IDX_CONTROLLERS_CLASS ,
diff --git js/xpconnect/tests/chrome/test_bug1065185.html js/xpconnect/tests/chrome/test_bug1065185.html
index cdd65326f9c8..7ea81fc8aa6f 100644
--- js/xpconnect/tests/chrome/test_bug1065185.html
+++ js/xpconnect/tests/chrome/test_bug1065185.html
@@ -25,11 +25,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1065185
var gLoadCount = 0;
function loaded() {
- switch(++gLoadCount) {
+ switch(gLoadCount++) {
case 0:
- doMonitor([]);
+ doMonitor([/access to property "a"/i]);
window[0].wrappedJSObject.probe = { a: 2, __exposedProps__: { 'a': 'r' } };
- is(window[0].eval('probe.a'), 2, "Accessed exposed prop");
+ is(window[0].eval('probe.a'), undefined, "Accessed exposed prop");
endMonitor();
break;
case 1:
diff --git js/xpconnect/tests/chrome/test_cows.xul js/xpconnect/tests/chrome/test_cows.xul
index 75c5250dd150..adfdd686540b 100644
--- js/xpconnect/tests/chrome/test_cows.xul
+++ js/xpconnect/tests/chrome/test_cows.xul
@@ -49,13 +49,6 @@ sandbox.getCOW = getCOW;
const TEST_API = ['is', 'isnot', 'ok', 'todo_is', 'todo_isnot', 'todo'];
TEST_API.forEach(function(name) { sandbox[name] = window[name]; });
-sandbox.alienObject = {
- __exposedProps__: {funProp: 'r'},
- funProp: function foo(x) {
- return x + 1;
- }
-};
-
sandbox.chromeGet = function (obj, prop) { return obj[prop]; };
function COWTests() {
@@ -74,17 +67,6 @@ function COWTests() {
// functions like assertIsWritable(myObj, 'someproperty') might
// be useful.
- function isProp(obj, propName, value, desc) {
- try {
- is(obj[propName], value, "getting " + propName + " on " + desc);
- ok(propName in obj,
- propName + " on " + desc + " should exist");
- ok(Object.hasOwnProperty.call(obj, propName),
- propName + " on " + desc + " should exist");
- } catch (e) {
- ok(false, "getting " + propName + " on " + desc + " threw " + e);
- }
- }
function isPropHidden(obj, propName, desc) {
try {
is(obj[propName], undefined,
@@ -103,7 +85,7 @@ function COWTests() {
var empty = {};
var nonempty = {foo: 42, bar: 33};
is(getCOW(empty).foo, undefined,
- "shouldn't throw when accessing exposed properties that doesn't exist");
+ "shouldn't throw when accessing exposed properties that don't exist");
PROPS_TO_TEST.forEach(function(name) {
isPropHidden(getCOW(nonempty), name, "object without exposedProps");
@@ -135,18 +117,12 @@ function COWTests() {
var strict = { __exposedProps__: { foo: "r" }, foo: "foo property" };
var strictCOWr = getCOW(strict);
PROPS_TO_TEST.forEach(function(name) {
- if (name == "foo") {
- isProp(strictCOWr, name, "foo property",
- "object with exposed 'foo'");
- }
- else {
- isPropHidden(strictCOW, name, "object with exposed 'foo'");
- }
+ isPropHidden(strictCOW, name, "object with exposed 'foo'");
});
- is(getNames(strictCOWr).length, 1,
- "object with exposedProps only enumerate exposed props");
- is(getNames(strictCOWr)[0], "foo",
- "object with exposedProps only enumerate exposed props");
+ is(getNames(strictCOWr).length, 0,
+ "exposed props does not enumerate anything");
+ is(getNames(strictCOWr)[0], undefined,
+ "exposed props does not enumerate anything");
// Test writable property
var writable = getCOW({ __exposedProps__: {foo: 'w'}});
@@ -154,25 +130,18 @@ function COWTests() {
ok(!("foo" in writable),
"non-existing write-only property shouldn't exist");
writable.foo = 5;
- is(chromeGet(writable, "foo"), 5, "writing to a write-only exposed prop works");
- todo("foo" in writable,
- "existing write-only property should exist");
- } catch (e) {
- ok(false, "writing to a write-only exposed prop shouldn't throw " + e);
- }
- try {
- writable.foo;
- todo(false, "reading from a write-only exposed prop should throw");
+ ok(false, "writing to a write-only exposed prop should throw");
} catch (e) {
- todo(/Permission denied/.test(e),
- "reading from a write-only exposed prop should throw");
+ ok(/Permission denied/.test(e),
+ "writing to a write-only exposed prop should throw the right error");
}
+ is(writable.foo, undefined,
+ "reading from a write-only exposed prop should return undefined");
try {
delete writable.foo;
- is(chromeGet(writable, "foo"), undefined,
- "deleting a write-only exposed prop works");
+ ok(false, "deleting a write-only exposed prop should throw");
} catch (e) {
- ok(false, "deleting a write-only exposed prop shouldn't throw " + e);
+ ok(true, "deleting a write-only exposed prop should throw " + e);
}
// Test readable property
@@ -180,8 +149,8 @@ function COWTests() {
foo: 5,
bar: 6 };
try {
- isProp(getCOW(readable), "foo", 5,
- "reading from a readable exposed prop works");
+ isPropHidden(getCOW(readable), "foo", undefined,
+ "reading from a readable exposed prop shouldn't work");
} catch (e) {
ok(false, "reading from a readable exposed prop shouldn't throw " + e);
}
@@ -202,8 +171,7 @@ function COWTests() {
try {
var props = getNames(getCOW(readable));
- is(props.length, 1, "COW w/ one exposed prop should enumerate once");
- is(props[0], 'foo', "COW w/ one exposed prop should enumerate it");
+ is(props.length, 0, "COW w/ one exposed prop should not enumerate");
} catch (e) {
ok(false, "COW w/ a readable prop should not raise exc " +
"on enumeration: " + e);
@@ -215,21 +183,17 @@ function COWTests() {
ok(!("foo" in readwrite),
"non-existing readwrite property shouldn't exist");
readwrite.foo = 5;
- is(readwrite.foo, 5, "writing to a readwrite exposed prop looks like it worked");
- is(chromeGet(readwrite, "foo"), 5, "writing to a readwrite exposed prop works");
- ok("foo" in readwrite,
- "existing readwrite property should exist");
+ ok(false, "writing to a readwrite exposed prop should throw");
} catch (e) {
- ok(false, "writing to a readwrite exposed prop shouldn't throw " + e);
+ ok(/Permission denied/.test(e),
+ "writing to a readwrite exposed prop should throw the right error");
}
try {
delete readwrite.foo;
- is(readwrite.foo, undefined, "deleting readwrite prop looks like it worked");
- ok(!("foo" in readwrite), "deleting readwrite prop looks like it really worked");
- is(chromeGet(readwrite, "foo"), undefined,
- "deleting a readwrite exposed prop works");
+ ok(false, "deleting a readwrite prop should throw");
} catch (e) {
- ok(false, "deleting a readwrite exposed prop shouldn't throw " + e);
+ ok(/Permission denied/.test(e),
+ "deleting a readwrite exposed prop should throw the right error");
}
// Readables and functions
diff --git js/xpconnect/tests/chrome/test_exposeInDerived.xul js/xpconnect/tests/chrome/test_exposeInDerived.xul
index 2ed3bb91e7fd..7e6c24e56db1 100644
--- js/xpconnect/tests/chrome/test_exposeInDerived.xul
+++ js/xpconnect/tests/chrome/test_exposeInDerived.xul
@@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=804630
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
- /** Test to make sure that COWed objects can expose properties from their prototypes. **/
+ /** Test to make sure that COWed objects can't expose properties from their prototypes. **/
const Cu = Components.utils;
// Set up the sandbox.
@@ -25,7 +25,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=804630
sb.ok = ok;
sb.is = is;
- // Make a chrome object that exposes objects off its prototype.
+ // Make a chrome object that tries to expose objects off its prototype.
sb.proto = { read: 42, readWrite: 32, __exposedProps__: {} };
sb.obj = { __exposedProps__: { read: 'r', readWrite: 'rw' } };
sb.obj.__proto__ = sb.proto;
@@ -36,10 +36,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=804630
'try { proto.readWrite = 12; wrote = true; } catch(e) {} ' +
' ok(!wrote, "Should not write proto property");', sb);
- // Make sure we can access the exposed properties via the derived object.
- Cu.evalInSandbox('is(obj.read, 42, "obj.read accessible");', sb);
- Cu.evalInSandbox('is(obj.readWrite, 32, "obj.readWrite is readable");', sb);
- Cu.evalInSandbox('obj.readWrite = 8; is(obj.readWrite, 8, "obj.readWrite is writable");', sb);
+ // Make sure we can't access the exposed properties via the derived object.
+ Cu.evalInSandbox('is(obj.read, undefined, "obj.read inaccessible");', sb);
+ Cu.evalInSandbox('is(obj.readWrite, undefined, "obj.readWrite is not readable");', sb);
+ Cu.evalInSandbox('try { obj.readWrite = 8; ok(false, "obj.readWrite is not writable"); } catch (e) {};',
+ sb);
]]>
</script>
diff --git js/xpconnect/tests/unit/test_bug1082450.js js/xpconnect/tests/unit/test_bug1082450.js
index 07f45f06beef..5880fcbcd4e6 100644
--- js/xpconnect/tests/unit/test_bug1082450.js
+++ js/xpconnect/tests/unit/test_bug1082450.js
@@ -5,9 +5,9 @@ function run_test() {
function checkThrows(str, rgxp) {
try {
sb.eval(str);
- do_check_true(false);
+ do_check_true(false, "eval should have thrown");
} catch (e) {
- do_check_true(rgxp.test(e));
+ do_check_true(rgxp.test(e), "error message should match");
}
}
@@ -29,12 +29,12 @@ function run_test() {
chromeCallableValueProp: 'r' }
};
- do_check_eq(sb.eval('exposed.simpleValueProp'), 42);
- do_check_eq(sb.eval('exposed.objectValueProp.val'), 42);
- checkThrows('exposed.getterProp;', /privileged accessor/i);
- checkThrows('exposed.setterProp = 42;', /privileged accessor/i);
- checkThrows('exposed.getterSetterProp;', /privileged accessor/i);
- checkThrows('exposed.getterSetterProp = 42;', /privileged accessor/i);
- do_check_eq(sb.eval('exposed.contentCallableValueProp()'), 42);
- checkThrows('exposed.chromeCallableValueProp();', /privileged or cross-origin callable/i);
+ do_check_eq(sb.eval('exposed.simpleValueProp'), undefined);
+ do_check_eq(sb.eval('exposed.objectValueProp'), undefined);
+ do_check_eq(sb.eval('exposed.getterProp;'), undefined);
+ do_check_eq(sb.eval('exposed.getterSetterProp;'), undefined);
+ checkThrows('exposed.setterProp = 42;', /Permission denied/i);
+ checkThrows('exposed.getterSetterProp = 42;', /Permission denied/i);
+ do_check_eq(sb.eval('exposed.contentCallableValueProp'), undefined);
+ checkThrows('exposed.chromeCallableValueProp();', /is not a function/i);
}
diff --git js/xpconnect/tests/unit/test_bug780370.js js/xpconnect/tests/unit/test_bug780370.js
index 40d6f9748015..7ae757f0cd01 100644
--- js/xpconnect/tests/unit/test_bug780370.js
+++ js/xpconnect/tests/unit/test_bug780370.js
@@ -14,10 +14,5 @@ function run_test()
var sb = Cu.Sandbox("http://www.example.com");
sb.obj = { foo: 42, __exposedProps__: { hasOwnProperty: 'r' } };
do_check_eq(Cu.evalInSandbox('typeof obj.foo', sb), 'undefined', "COW works as expected");
- try {
- Cu.evalInSandbox('obj.hasOwnProperty', sb);
- do_check_true(false);
- } catch (e) {
- do_check_true(/privileged or cross-origin callable/i.test(e));
- }
+ do_check_eq(Cu.evalInSandbox('obj.hasOwnProperty', sb), undefined);
}
diff --git js/xpconnect/tests/unit/test_bug813901.js js/xpconnect/tests/unit/test_bug813901.js
index 42f981581b51..2efc6539e879 100644
--- js/xpconnect/tests/unit/test_bug813901.js
+++ js/xpconnect/tests/unit/test_bug813901.js
@@ -21,5 +21,5 @@ function run_test() {
checkThrows('obj.foo = 3;', sb, /denied/);
Cu.evalInSandbox("var p = {__exposedProps__: {foo: 'rw'}};", sb);
sb.obj.__proto__ = sb.p;
- checkThrows('obj.foo = 4;', sb, /__exposedProps__/);
+ checkThrows('obj.foo = 4;', sb, /denied/);
}
diff --git js/xpconnect/tests/unit/test_bug853709.js js/xpconnect/tests/unit/test_bug853709.js
index c7e51757dc63..1667d2241f93 100644
--- js/xpconnect/tests/unit/test_bug853709.js
+++ js/xpconnect/tests/unit/test_bug853709.js
@@ -8,7 +8,7 @@ function setupChromeSandbox() {
function checkDefineThrows(sb, obj, prop, desc) {
var result = Cu.evalInSandbox('(function() { try { Object.defineProperty(' + obj + ', "' + prop + '", ' + desc.toSource() + '); return "nothrow"; } catch (e) { return e.toString(); }})();', sb);
do_check_neq(result, 'nothrow');
- do_check_true(!!/denied/.exec(result));
+ do_check_true(!!/denied|prohibited/.exec(result));
do_check_true(result.indexOf(prop) != -1); // Make sure the prop name is in the error message.
}
@@ -19,7 +19,7 @@ function run_test() {
contentSB.chromeObj = chromeSB.chromeObj;
contentSB.chromeArr = chromeSB.chromeArr;
- do_check_eq(Cu.evalInSandbox('chromeObj.a', contentSB), 2);
+ do_check_eq(Cu.evalInSandbox('chromeObj.a', contentSB), undefined);
try {
Cu.evalInSandbox('chromeArr[1]', contentSB);
do_check_true(false);
diff --git js/xpconnect/tests/unit/test_bug854558.js js/xpconnect/tests/unit/test_bug854558.js
index d60d23a5baf8..574194dc3f52 100644
--- js/xpconnect/tests/unit/test_bug854558.js
+++ js/xpconnect/tests/unit/test_bug854558.js
@@ -7,5 +7,5 @@ function run_test() {
contentSB.foo = chromeSB.foo;
do_check_eq(Cu.evalInSandbox('foo.a', contentSB), undefined, "Default deny with no __exposedProps__");
Cu.evalInSandbox('this.foo.__exposedProps__ = {a: "r"}', chromeSB);
- do_check_eq(Cu.evalInSandbox('foo.a', contentSB), 2, "works with __exposedProps__");
+ do_check_eq(Cu.evalInSandbox('foo.a', contentSB), undefined, "Still not allowed with __exposedProps__");
}
diff --git js/xpconnect/tests/unit/test_bug930091.js js/xpconnect/tests/unit/test_bug930091.js
index aa11d5db2640..ecb2a60aed11 100644
--- js/xpconnect/tests/unit/test_bug930091.js
+++ js/xpconnect/tests/unit/test_bug930091.js
@@ -5,7 +5,7 @@ function checkThrows(fn) {
fn();
ok(false, "Should have thrown");
} catch (e) {
- do_check_true(/denied|insecure/.test(e));
+ do_check_true(/denied|insecure|prohibited/.test(e));
}
}
diff --git js/xpconnect/wrappers/AccessCheck.cpp js/xpconnect/wrappers/AccessCheck.cpp
index 07599ce7906a..b730310731e2 100644
--- js/xpconnect/wrappers/AccessCheck.cpp
+++ js/xpconnect/wrappers/AccessCheck.cpp
@@ -252,20 +252,6 @@ AccessCheck::checkPassToPrivilegedCode(JSContext* cx, HandleObject wrapper, Hand
return true;
}
- // COWs are fine to pass to chrome if and only if they have __exposedProps__,
- // since presumably content should never have a reason to pass an opaque
- // object back to chrome.
- if (AccessCheck::isChrome(js::UncheckedUnwrap(wrapper)) && WrapperFactory::IsCOW(obj)) {
- RootedObject target(cx, js::UncheckedUnwrap(obj));
- JSAutoCompartment ac(cx, target);
- RootedId id(cx, GetJSIDByIndex(cx, XPCJSContext::IDX_EXPOSEDPROPS));
- bool found = false;
- if (!JS_HasPropertyById(cx, target, id, &found))
- return false;
- if (found)
- return true;
- }
-
// Same-origin wrappers are fine.
if (AccessCheck::wrapperSubsumes(obj))
return true;
@@ -323,171 +309,6 @@ AccessCheck::reportCrossOriginDenial(JSContext* cx, JS::HandleId id,
MOZ_ALWAYS_TRUE(rv.MaybeSetPendingException(cx));
}
-enum Access { READ = (1<<0), WRITE = (1<<1), NO_ACCESS = 0 };
-
-static void
-EnterAndThrowASCII(JSContext* cx, JSObject* wrapper, const char* msg)
-{
- JSAutoCompartment ac(cx, wrapper);
- JS_ReportErrorASCII(cx, "%s", msg);
-}
-
-bool
-ExposedPropertiesOnly::check(JSContext* cx, HandleObject wrapper, HandleId id, Wrapper::Action act)
-{
- RootedObject wrappedObject(cx, Wrapper::wrappedObject(wrapper));
-
- if (act == Wrapper::CALL)
- return false;
-
- // For the case of getting a property descriptor, we allow if either GET or SET
- // is allowed, and rely on FilteringWrapper to filter out any disallowed accessors.
- if (act == Wrapper::GET_PROPERTY_DESCRIPTOR) {
- return check(cx, wrapper, id, Wrapper::GET) ||
- check(cx, wrapper, id, Wrapper::SET);
- }
-
- RootedId exposedPropsId(cx, GetJSIDByIndex(cx, XPCJSContext::IDX_EXPOSEDPROPS));
-
- // We need to enter the wrappee's compartment to look at __exposedProps__,
- // but we want to be in the wrapper's compartment if we call Deny().
- //
- // Unfortunately, |cx| can be in either compartment when we call ::check. :-(
- JSAutoCompartment ac(cx, wrappedObject);
-
- bool found = false;
- if (!JS_HasPropertyById(cx, wrappedObject, exposedPropsId, &found))
- return false;
-
- // If no __exposedProps__ existed, deny access.
- if (!found) {
- // Previously we automatically granted access to indexed properties and
- // .length for Array COWs. We're not doing that anymore, so make sure to
- // let people know what's going on.
- bool isArray;
- if (!JS_IsArrayObject(cx, wrappedObject, &isArray))
- return false;
- if (!isArray)
- isArray = JS_IsTypedArrayObject(wrappedObject);
- bool isIndexedAccessOnArray = isArray && JSID_IS_INT(id) && JSID_TO_INT(id) >= 0;
- bool isLengthAccessOnArray = isArray && JSID_IS_STRING(id) &&
- JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(id), "length");
- if (isIndexedAccessOnArray || isLengthAccessOnArray) {
- JSAutoCompartment ac2(cx, wrapper);
- ReportWrapperDenial(cx, id, WrapperDenialForCOW,
- "Access to elements and length of privileged Array not permitted");
- }
-
- return false;
- }
-
- if (id == JSID_VOID)
- return true;
-
- Rooted<PropertyDescriptor> desc(cx);
- if (!JS_GetPropertyDescriptorById(cx, wrappedObject, exposedPropsId, &desc))
- return false;
-
- if (!desc.object())
- return false;
-
- if (desc.hasGetterOrSetter()) {
- EnterAndThrowASCII(cx, wrapper, "__exposedProps__ must be a value property");
- return false;
- }
-
- RootedValue exposedProps(cx, desc.value());
- if (exposedProps.isNullOrUndefined())
- return false;
-
- if (!exposedProps.isObject()) {
- EnterAndThrowASCII(cx, wrapper, "__exposedProps__ must be undefined, null, or an Object");
- return false;
- }
-
- RootedObject hallpass(cx, &exposedProps.toObject());
-
- if (!AccessCheck::subsumes(js::UncheckedUnwrap(hallpass), wrappedObject)) {
- EnterAndThrowASCII(cx, wrapper, "Invalid __exposedProps__");
- return false;
- }
-
- Access access = NO_ACCESS;
-
- if (!JS_GetPropertyDescriptorById(cx, hallpass, id, &desc)) {
- return false; // Error
- }
- if (!desc.object() || !desc.enumerable())
- return false;
-
- if (!desc.value().isString()) {
- EnterAndThrowASCII(cx, wrapper, "property must be a string");
- return false;
- }
-
- JSFlatString* flat = JS_FlattenString(cx, desc.value().toString());
- if (!flat)
- return false;
-
- size_t length = JS_GetStringLength(JS_FORGET_STRING_FLATNESS(flat));
-
- for (size_t i = 0; i < length; ++i) {
- char16_t ch = JS_GetFlatStringCharAt(flat, i);
- switch (ch) {
- case 'r':
- if (access & READ) {
- EnterAndThrowASCII(cx, wrapper, "duplicate 'readable' property flag");
- return false;
- }
- access = Access(access | READ);
- break;
-
- case 'w':
- if (access & WRITE) {
- EnterAndThrowASCII(cx, wrapper, "duplicate 'writable' property flag");
- return false;
- }
- access = Access(access | WRITE);
- break;
-
- default:
- EnterAndThrowASCII(cx, wrapper, "properties can only be readable or read and writable");
- return false;
- }
- }
-
- if (access == NO_ACCESS) {
- EnterAndThrowASCII(cx, wrapper, "specified properties must have a permission bit set");
- return false;
- }
-
- if ((act == Wrapper::SET && !(access & WRITE)) ||
- (act != Wrapper::SET && !(access & READ))) {
- return false;
- }
-
- // Inspect the property on the underlying object to check for red flags.
- if (!JS_GetPropertyDescriptorById(cx, wrappedObject, id, &desc))
- return false;
-
- // Reject accessor properties.
- if (desc.hasGetterOrSetter()) {
- EnterAndThrowASCII(cx, wrapper, "Exposing privileged accessor properties is prohibited");
- return false;
- }
-
- // Reject privileged or cross-origin callables.
- if (desc.value().isObject()) {
- RootedObject maybeCallable(cx, js::UncheckedUnwrap(&desc.value().toObject()));
- if (JS::IsCallable(maybeCallable) && !AccessCheck::subsumes(wrapper, maybeCallable)) {
- EnterAndThrowASCII(cx, wrapper, "Exposing privileged or cross-origin callable is prohibited");
- return false;
- }
- }
-
- return true;
-}
-
bool
ExposedPropertiesOnly::deny(JSContext* cx, js::Wrapper::Action act, HandleId id,
bool mayThrow)
diff --git js/xpconnect/wrappers/AccessCheck.h js/xpconnect/wrappers/AccessCheck.h
index 678dce3e0b81..c4873760ab7a 100644
--- js/xpconnect/wrappers/AccessCheck.h
+++ js/xpconnect/wrappers/AccessCheck.h
@@ -104,10 +104,15 @@ struct CrossOriginAccessiblePropertiesOnly : public Policy {
}
};
-// This policy only permits access to properties if they appear in the
-// objects exposed properties list.
+// This class used to support permitting access to properties if they
+// appeared in an access list on the object, but now it acts like an
+// Opaque wrapper, with the exception that it fails silently for GET,
+// ENUMERATE, and GET_PROPERTY_DESCRIPTOR. This is done for backwards
+// compatibility. See bug 1397513.
struct ExposedPropertiesOnly : public Policy {
- static bool check(JSContext* cx, JS::HandleObject wrapper, JS::HandleId id, js::Wrapper::Action act);
+ static bool check(JSContext* cx, JS::HandleObject wrapper, JS::HandleId id, js::Wrapper::Action act) {
+ return false;
+ }
static bool deny(JSContext* cx, js::Wrapper::Action act, JS::HandleId id,
bool mayThrow);
diff --git js/xpconnect/wrappers/ChromeObjectWrapper.h js/xpconnect/wrappers/ChromeObjectWrapper.h
index 8b273e470814..c17feed10b9a 100644
--- js/xpconnect/wrappers/ChromeObjectWrapper.h
+++ js/xpconnect/wrappers/ChromeObjectWrapper.h
@@ -16,9 +16,9 @@ namespace xpc {
struct ExposedPropertiesOnly;
// When a vanilla chrome JS object is exposed to content, we use a wrapper that
-// supports __exposedProps__ for legacy reasons. For extra security, we override
-// the traps that allow content to pass an object to chrome, and perform extra
-// security checks on them.
+// fails silently on GET, ENUMERATE, and GET_PROPERTY_DESCRIPTOR for legacy
+// reasons. For extra security, we override the traps that allow content to pass
+// an object to chrome, and perform extra security checks on them.
#define ChromeObjectWrapperBase \
FilteringWrapper<js::CrossCompartmentSecurityWrapper, ExposedPropertiesOnly>
diff --git js/xpconnect/wrappers/WrapperFactory.cpp js/xpconnect/wrappers/WrapperFactory.cpp
index 6296f69fbea4..760d2c9afda8 100644
--- js/xpconnect/wrappers/WrapperFactory.cpp
+++ js/xpconnect/wrappers/WrapperFactory.cpp
@@ -514,8 +514,8 @@ WrapperFactory::Rewrap(JSContext* cx, HandleObject existing, HandleObject obj)
wrapper = &FilteringWrapper<CrossCompartmentSecurityWrapper, OpaqueWithCall>::singleton;
}
- // For Vanilla JSObjects exposed from chrome to content, we use a wrapper
- // that supports __exposedProps__. We'd like to get rid of these eventually,
+ // For vanilla JSObjects exposed from chrome to content, we use a wrapper
+ // that fails silently in a few cases. We'd like to get rid of this eventually,
// but in their current form they don't cause much trouble.
else if (IdentifyStandardInstance(obj) == JSProto_Object) {
wrapper = &ChromeObjectWrapper::singleton;
diff --git js/xpconnect/wrappers/XrayWrapper.cpp js/xpconnect/wrappers/XrayWrapper.cpp
index 44dd7cb47146..28e29ea13d93 100644
--- js/xpconnect/wrappers/XrayWrapper.cpp
+++ js/xpconnect/wrappers/XrayWrapper.cpp
@@ -291,7 +291,7 @@ ReportWrapperDenial(JSContext* cx, HandleId id, WrapperDenialType type, const ch
MOZ_ASSERT(type == WrapperDenialForCOW);
errorMessage.emplace("Security wrapper denied access to property %s on privileged "
"Javascript object. Support for exposing privileged objects "
- "to untrusted content via __exposedProps__ is being gradually "
+ "to untrusted content via __exposedProps__ has been "
"removed - use WebIDL bindings or Components.utils.cloneInto "
"instead. Note that only the first denied property access from a "
"given global object will be reported.",
diff --git testing/mochitest/tests/SimpleTest/ChromePowers.js testing/mochitest/tests/SimpleTest/ChromePowers.js
index 97de578157c0..7fbf66e2fd00 100644
--- testing/mochitest/tests/SimpleTest/ChromePowers.js
+++ testing/mochitest/tests/SimpleTest/ChromePowers.js
@@ -104,15 +104,6 @@ ChromePowers.prototype.executeAfterFlushingMessageQueue = function(aCallback) {
aCallback();
};
-// Expose everything but internal APIs (starting with underscores) to
-// web content. We cannot use Object.keys to view SpecialPowers.prototype since
-// we are using the functions from SpecialPowersAPI.prototype
-ChromePowers.prototype.__exposedProps__ = {};
-for (var i in ChromePowers.prototype) {
- if (i.charAt(0) != "_")
- ChromePowers.prototype.__exposedProps__[i] = "r";
-}
-
if ((window.parent !== null) &&
(window.parent !== undefined) &&
(window.parent.wrappedJSObject.SpecialPowers) &&
diff --git testing/specialpowers/content/MockPermissionPrompt.jsm testing/specialpowers/content/MockPermissionPrompt.jsm
index 71d0f5d2768a..1d86cc00e360 100644
--- testing/specialpowers/content/MockPermissionPrompt.jsm
+++ testing/specialpowers/content/MockPermissionPrompt.jsm
@@ -83,15 +83,3 @@ MockPermissionPromptInstance.prototype = {
request.allow();
}
};
-
-// Expose everything to content. We call reset() here so that all of the relevant
-// lazy expandos get added.
-MockPermissionPrompt.reset();
-function exposeAll(obj) {
- var props = {};
- for (var prop in obj)
- props[prop] = "rw";
- obj.__exposedProps__ = props;
-}
-exposeAll(MockPermissionPrompt);
-exposeAll(MockPermissionPromptInstance.prototype);
diff --git toolkit/components/addoncompat/RemoteAddonsParent.jsm toolkit/components/addoncompat/RemoteAddonsParent.jsm
index 1adbc0397729..d640c47d31f8 100644
--- toolkit/components/addoncompat/RemoteAddonsParent.jsm
+++ toolkit/components/addoncompat/RemoteAddonsParent.jsm
@@ -735,7 +735,7 @@ var SandboxParent = {
if (rest.length) {
// Do a shallow copy of the options object into the child
// process. This way we don't have to access it through a Chrome
- // object wrapper, which would require __exposedProps__.
+ // object wrapper, which would not let us access any properties.
//
// The only object property here is sandboxPrototype. We assume
// it's a child process object (since that's what Greasemonkey
commit f89c72edb79e
Author: Andrew McCreight <continuation@gmail.com>
Date: Thu Sep 7 11:17:16 2017 -0700
Bug 1377587, part 2 - Rename ExposedPropertiesOnly to OpaqueWithSilentFailing. r=krizsa
This class doesn't have anything to do with __exposedProps__ any more,
so give it a more descriptive name. We'd still like to remove it
entirely eventually.
MozReview-Commit-ID: 87KCpG6f8rI
--HG--
extra : rebase_source : 98a51a6af0fc8446dbcd8efa083d6c79286279d3
---
js/xpconnect/wrappers/AccessCheck.cpp | 4 ++--
js/xpconnect/wrappers/AccessCheck.h | 2 +-
js/xpconnect/wrappers/ChromeObjectWrapper.h | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git js/xpconnect/wrappers/AccessCheck.cpp js/xpconnect/wrappers/AccessCheck.cpp
index b730310731e2..620f1f678f51 100644
--- js/xpconnect/wrappers/AccessCheck.cpp
+++ js/xpconnect/wrappers/AccessCheck.cpp
@@ -310,8 +310,8 @@ AccessCheck::reportCrossOriginDenial(JSContext* cx, JS::HandleId id,
}
bool
-ExposedPropertiesOnly::deny(JSContext* cx, js::Wrapper::Action act, HandleId id,
- bool mayThrow)
+OpaqueWithSilentFailing::deny(JSContext* cx, js::Wrapper::Action act, HandleId id,
+ bool mayThrow)
{
// Fail silently for GET, ENUMERATE, and GET_PROPERTY_DESCRIPTOR.
if (act == js::Wrapper::GET || act == js::Wrapper::ENUMERATE ||
diff --git js/xpconnect/wrappers/AccessCheck.h js/xpconnect/wrappers/AccessCheck.h
index c4873760ab7a..6783258f8d94 100644
--- js/xpconnect/wrappers/AccessCheck.h
+++ js/xpconnect/wrappers/AccessCheck.h
@@ -109,7 +109,7 @@ struct CrossOriginAccessiblePropertiesOnly : public Policy {
// Opaque wrapper, with the exception that it fails silently for GET,
// ENUMERATE, and GET_PROPERTY_DESCRIPTOR. This is done for backwards
// compatibility. See bug 1397513.
-struct ExposedPropertiesOnly : public Policy {
+struct OpaqueWithSilentFailing : public Policy {
static bool check(JSContext* cx, JS::HandleObject wrapper, JS::HandleId id, js::Wrapper::Action act) {
return false;
}
diff --git js/xpconnect/wrappers/ChromeObjectWrapper.h js/xpconnect/wrappers/ChromeObjectWrapper.h
index c17feed10b9a..da4870237501 100644
--- js/xpconnect/wrappers/ChromeObjectWrapper.h
+++ js/xpconnect/wrappers/ChromeObjectWrapper.h
@@ -13,14 +13,14 @@
namespace xpc {
-struct ExposedPropertiesOnly;
+struct OpaqueWithSilentFailing;
// When a vanilla chrome JS object is exposed to content, we use a wrapper that
// fails silently on GET, ENUMERATE, and GET_PROPERTY_DESCRIPTOR for legacy
// reasons. For extra security, we override the traps that allow content to pass
// an object to chrome, and perform extra security checks on them.
#define ChromeObjectWrapperBase \
- FilteringWrapper<js::CrossCompartmentSecurityWrapper, ExposedPropertiesOnly>
+ FilteringWrapper<js::CrossCompartmentSecurityWrapper, OpaqueWithSilentFailing>
class ChromeObjectWrapper : public ChromeObjectWrapperBase
{

View file

@ -0,0 +1,362 @@
commit 256e249566d8
Author: Christoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Date: Fri Aug 4 14:11:17 2017 +0200
Bug 1381761 - Treating 'data:' documents as unique, opaque origins should still inherit the CSP. r=smaug,dveditz
---
caps/moz.build | 1 +
caps/nsScriptSecurityManager.cpp | 96 +++++++++++++++++++++++++---------------
2 files changed, 62 insertions(+), 35 deletions(-)
diff --git caps/moz.build caps/moz.build
index 46331e93f097..af369e3268e0 100644
--- caps/moz.build
+++ caps/moz.build
@@ -56,6 +56,7 @@ LOCAL_INCLUDES += [
'/docshell/base',
'/dom/base',
'/js/xpconnect/src',
+ '/netwerk/base',
]
if CONFIG['ENABLE_TESTS']:
diff --git caps/nsScriptSecurityManager.cpp caps/nsScriptSecurityManager.cpp
index a930b324a6a2..90695ebd126f 100644
--- caps/nsScriptSecurityManager.cpp
+++ caps/nsScriptSecurityManager.cpp
@@ -45,6 +45,7 @@
#include "nsIWindowWatcher.h"
#include "nsIConsoleService.h"
#include "nsIObserverService.h"
+#include "nsIOService.h"
#include "nsIContent.h"
#include "nsDOMJSUtils.h"
#include "nsAboutProtocolUtils.h"
@@ -265,6 +266,61 @@ nsScriptSecurityManager::GetChannelResultPrincipalIfNotSandboxed(nsIChannel* aCh
/*aIgnoreSandboxing*/ true);
}
+static void
+InheritAndSetCSPOnPrincipalIfNeeded(nsIChannel* aChannel, nsIPrincipal* aPrincipal)
+{
+ // loading a data: URI into an iframe, or loading frame[srcdoc] need
+ // to inherit the CSP (see Bug 1073952, 1381761).
+ MOZ_ASSERT(aChannel && aPrincipal, "need a valid channel and principal");
+ if (!aChannel) {
+ return;
+ }
+
+ nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
+ if (!loadInfo ||
+ loadInfo->GetExternalContentPolicyType() != nsIContentPolicy::TYPE_SUBDOCUMENT) {
+ return;
+ }
+
+ nsCOMPtr<nsIURI> uri;
+ nsresult rv = aChannel->GetURI(getter_AddRefs(uri));
+ NS_ENSURE_SUCCESS_VOID(rv);
+ nsAutoCString URISpec;
+ rv = uri->GetSpec(URISpec);
+ NS_ENSURE_SUCCESS_VOID(rv);
+
+ bool isSrcDoc = URISpec.EqualsLiteral("about:srcdoc");
+ bool isData = (NS_SUCCEEDED(uri->SchemeIs("data", &isData)) && isData);
+
+ if (!isSrcDoc && !isData) {
+ return;
+ }
+
+ nsCOMPtr<nsIPrincipal> principalToInherit = loadInfo->PrincipalToInherit();
+ if (!principalToInherit) {
+ principalToInherit = loadInfo->TriggeringPrincipal();
+ }
+ nsCOMPtr<nsIContentSecurityPolicy> originalCSP;
+ principalToInherit->GetCsp(getter_AddRefs(originalCSP));
+ if (!originalCSP) {
+ return;
+ }
+
+ // if the principalToInherit had a CSP, add it to the before
+ // created NullPrincipal (unless it already has one)
+ MOZ_ASSERT(aPrincipal->GetIsNullPrincipal(),
+ "inheriting the CSP only valid for NullPrincipal");
+ nsCOMPtr<nsIContentSecurityPolicy> nullPrincipalCSP;
+ aPrincipal->GetCsp(getter_AddRefs(nullPrincipalCSP));
+ if (nullPrincipalCSP) {
+ MOZ_ASSERT(nullPrincipalCSP == originalCSP,
+ "There should be no other CSP here.");
+ // CSPs are equal, no need to set it again.
+ return;
+ }
+ aPrincipal->SetCsp(originalCSP);
+}
+
nsresult
nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
nsIPrincipal** aPrincipal,
@@ -295,40 +351,7 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
if (!aIgnoreSandboxing && loadInfo->GetLoadingSandboxed()) {
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(loadInfo->GetSandboxedLoadingPrincipal(aPrincipal)));
MOZ_ASSERT(*aPrincipal);
- // if the new NullPrincipal (above) loads an iframe[srcdoc], we
- // need to inherit an existing CSP to avoid bypasses (bug 1073952).
- // We continue inheriting for nested frames with e.g., data: URLs.
- if (loadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_SUBDOCUMENT) {
- nsCOMPtr<nsIURI> uri;
- aChannel->GetURI(getter_AddRefs(uri));
- nsAutoCString URISpec;
- uri->GetSpec(URISpec);
- bool isData = (NS_SUCCEEDED(uri->SchemeIs("data", &isData)) && isData);
- if (URISpec.EqualsLiteral("about:srcdoc") || isData) {
- nsCOMPtr<nsIPrincipal> principalToInherit = loadInfo->PrincipalToInherit();
- if (!principalToInherit) {
- principalToInherit = loadInfo->TriggeringPrincipal();
- }
- nsCOMPtr<nsIContentSecurityPolicy> originalCSP;
- principalToInherit->GetCsp(getter_AddRefs(originalCSP));
- if (originalCSP) {
- // if the principalToInherit had a CSP,
- // add it to the newly created NullPrincipal
- // (unless it already has one)
- nsCOMPtr<nsIContentSecurityPolicy> nullPrincipalCSP;
- (*aPrincipal)->GetCsp(getter_AddRefs(nullPrincipalCSP));
- if (nullPrincipalCSP) {
- MOZ_ASSERT(nullPrincipalCSP == originalCSP,
- "There should be no other CSP here.");
- // CSPs are equal, no need to set it again.
- return NS_OK;
- } else {
- nsresult rv = (*aPrincipal)->SetCsp(originalCSP);
- NS_ENSURE_SUCCESS(rv, rv);
- }
- }
- }
- }
+ InheritAndSetCSPOnPrincipalIfNeeded(aChannel, *aPrincipal);
return NS_OK;
}
@@ -376,7 +399,10 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
}
}
}
- return GetChannelURIPrincipal(aChannel, aPrincipal);
+ nsresult rv = GetChannelURIPrincipal(aChannel, aPrincipal);
+ NS_ENSURE_SUCCESS(rv, rv);
+ InheritAndSetCSPOnPrincipalIfNeeded(aChannel, *aPrincipal);
+ return NS_OK;
}
/* The principal of the URI that this channel is loading. This is never
commit 9427f1bbd826
Author: Christoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Date: Fri Aug 4 14:10:21 2017 +0200
Bug 1381761 - Convert test browser_911547.js to comply with new data: URI inheritance model. r=dveditz
---
.../components/sessionstore/test/browser_911547.js | 47 ++++++++++++++++------
.../sessionstore/test/browser_911547_sample.html | 6 +--
2 files changed, 37 insertions(+), 16 deletions(-)
diff --git browser/components/sessionstore/test/browser_911547.js browser/components/sessionstore/test/browser_911547.js
index f0da70ed8f8c..cb95ddad7f2a 100644
--- browser/components/sessionstore/test/browser_911547.js
+++ browser/components/sessionstore/test/browser_911547.js
@@ -1,11 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
-// This tests that session restore component does restore the right content
-// security policy with the document.
-// The policy being tested disallows inline scripts
+// This test is two fold:
+// a) if security.data_uri.unique_opaque_origin == false, then
+// this tests that session restore component does restore the right
+// content security policy with the document. (The policy being
+// tested disallows inline scripts).
+// b) if security.data_uri.unique_opaque_origin == true, then
+// this tests that data: URIs do not inherit the CSP from
+// it's enclosing context.
add_task(async function test() {
+ let dataURIPref = Services.prefs.getBoolPref("security.data_uri.unique_opaque_origin");
// create a tab that has a CSP
let testURL = "http://mochi.test:8888/browser/browser/components/sessionstore/test/browser_911547_sample.html";
let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, testURL);
@@ -16,23 +22,33 @@ add_task(async function test() {
// this is a baseline to ensure CSP is active
// attempt to inject and run a script via inline (pre-restore, allowed)
- await injectInlineScript(browser, `document.getElementById("test_id").value = "fail";`);
+ await injectInlineScript(browser, `document.getElementById("test_id1").value = "id1_modified";`);
let loadedPromise = promiseBrowserLoaded(browser);
await ContentTask.spawn(browser, null, function() {
- is(content.document.getElementById("test_id").value, "ok",
+ is(content.document.getElementById("test_id1").value, "id1_initial",
"CSP should block the inline script that modifies test_id");
- // attempt to click a link to a data: URI (will inherit the CSP of the
- // origin document) and navigate to the data URI in the link.
+
+ // (a) if security.data_uri.unique_opaque_origin == false:
+ // attempt to click a link to a data: URI (will inherit the CSP of
+ // the origin document) and navigate to the data URI in the link.
+ // (b) if security.data_uri.unique_opaque_origin == true:
+ // attempt to click a link to a data: URI (will *not* inherit the CSP of
+ // the origin document) and navigate to the data URI in the link.
content.document.getElementById("test_data_link").click();
});
await loadedPromise;
- await ContentTask.spawn(browser, null, function() {
- is(content.document.getElementById("test_id2").value, "ok",
- "CSP should block the script loaded by the clicked data URI");
+ await ContentTask.spawn(browser, {dataURIPref}, function( {dataURIPref}) { // eslint-disable-line
+ if (dataURIPref) {
+ is(content.document.getElementById("test_id2").value, "id2_modified",
+ "data: URI should *not* inherit the CSP of the enclosing context");
+ } else {
+ is(content.document.getElementById("test_id2").value, "id2_initial",
+ "CSP should block the script loaded by the clicked data URI");
+ }
});
// close the tab
@@ -43,9 +59,14 @@ add_task(async function test() {
await promiseTabRestored(tab);
browser = tab.linkedBrowser;
- await ContentTask.spawn(browser, null, function() {
- is(content.document.getElementById("test_id2").value, "ok",
- "CSP should block the script loaded by the clicked data URI after restore");
+ await ContentTask.spawn(browser, {dataURIPref}, function({dataURIPref}) { // eslint-disable-line
+ if (dataURIPref) {
+ is(content.document.getElementById("test_id2").value, "id2_modified",
+ "data: URI should *not* inherit the CSP of the enclosing context");
+ } else {
+ is(content.document.getElementById("test_id2").value, "id2_initial",
+ "CSP should block the script loaded by the clicked data URI after restore");
+ }
});
// clean up
diff --git browser/components/sessionstore/test/browser_911547_sample.html browser/components/sessionstore/test/browser_911547_sample.html
index ccc2011593d4..73cb99ee41f1 100644
--- browser/components/sessionstore/test/browser_911547_sample.html
+++ browser/components/sessionstore/test/browser_911547_sample.html
@@ -8,12 +8,12 @@
<!--
this element gets modified by an injected script;
- that script should be blocked by CSP.
+ that script should be blocked by CSP if security.data_uri.unique_opaque_origin == false;
Inline scripts can modify it, but not data uris.
-->
- <input type="text" id="test_id" value="ok">
+ <input type="text" id="test_id1" value="id1_initial">
- <a id="test_data_link" href="data:text/html;charset=utf-8,<input type='text' id='test_id2' value='ok'/> <script>document.getElementById('test_id2').value = 'fail';</script>">Test Link</a>
+ <a id="test_data_link" href="data:text/html;charset=utf-8,<input type='text' id='test_id2' value='id2_initial'/> <script>document.getElementById('test_id2').value = 'id2_modified';</script>">Test Link</a>
</body>
</html>
commit 8b999864f0bb
Author: Christoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Date: Fri Aug 4 14:10:38 2017 +0200
Bug 1381761 - Test data: URIs inherit the CSP even if treated as unique, opaque origins. r=dveditz
---
.../test/csp/file_data_csp_inheritance.html | 21 +++++++++++++
dom/security/test/csp/mochitest.ini | 2 ++
.../test/csp/test_data_csp_inheritance.html | 34 ++++++++++++++++++++++
3 files changed, 57 insertions(+)
diff --git dom/security/test/csp/file_data_csp_inheritance.html dom/security/test/csp/file_data_csp_inheritance.html
new file mode 100644
index 000000000000..299c30255aa6
--- /dev/null
+++ dom/security/test/csp/file_data_csp_inheritance.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1381761 - Treating 'data:' documents as unique, opaque origins should still inherit the CSP</title>
+ <meta charset="utf-8">
+ <meta http-equiv="Content-Security-Policy" content= "img-src 'none'"/>
+</head>
+<body>
+<iframe id="dataFrame" src="data:text/html,<body>should inherit csp</body>"></iframe>
+
+<script type="application/javascript">
+ // get the csp in JSON notation from the principal
+ var frame = document.getElementById("dataFrame");
+ var principal = SpecialPowers.wrap(frame.contentDocument).nodePrincipal;
+ var cspJSON = principal.cspJSON;
+ var result = principal.cspJSON ? "dataInheritsCSP" : "dataDoesNotInheritCSP";
+ window.parent.postMessage({result}, "*");
+</script>
+
+</body>
+</html>
diff --git dom/security/test/csp/mochitest.ini dom/security/test/csp/mochitest.ini
index ba391ad59799..09f80b2969d7 100644
--- dom/security/test/csp/mochitest.ini
+++ dom/security/test/csp/mochitest.ini
@@ -217,6 +217,7 @@ support-files =
file_ignore_xfo.html^headers^
file_ro_ignore_xfo.html
file_ro_ignore_xfo.html^headers^
+ file_data_csp_inheritance.html
file_report_font_cache-1.html
file_report_font_cache-2.html
file_report_font_cache-2.html^headers^
@@ -308,4 +309,5 @@ tags = mcb
[test_websocket_self.html]
skip-if = toolkit == 'android'
[test_ignore_xfo.html]
+[test_data_csp_inheritance.html]
[test_data_csp_merge.html]
diff --git dom/security/test/csp/test_data_csp_inheritance.html dom/security/test/csp/test_data_csp_inheritance.html
new file mode 100644
index 000000000000..3afc4f7c02bc
--- /dev/null
+++ dom/security/test/csp/test_data_csp_inheritance.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1381761 - Treating 'data:' documents as unique, opaque origins should still inherit the CSP</title>
+ <!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<iframe style="width:100%;" id="testframe"></iframe>
+
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+/* Description of the test:
+ * We load an iframe using a meta CSP which includes another iframe
+ * using a data: URI. We make sure the CSP gets inherited into
+ * the data: URI iframe.
+ */
+
+window.addEventListener("message", receiveMessage);
+function receiveMessage(event) {
+ window.removeEventListener("message", receiveMessage);
+ is(event.data.result, "dataInheritsCSP",
+ "data: URI iframe inherits CSP from including context");
+ SimpleTest.finish();
+}
+
+document.getElementById("testframe").src = "file_data_csp_inheritance.html";
+
+</script>
+</body>
+</html>

View file

@ -0,0 +1,218 @@
commit 485ed2f2b015
Author: Jan de Mooij <jdemooij@mozilla.com>
Date: Mon Sep 18 15:08:44 2017 +0200
Bug 1384121 part 1 - Don't sweep ObjectGroups under IC helper functions. r=bhackett
---
js/src/jit/IonCacheIRCompiler.cpp | 4 ++--
js/src/vm/ObjectGroup.h | 2 ++
js/src/vm/TypeInference-inl.h | 29 ++++++++++++++++++++++-------
js/src/vm/UnboxedObject.cpp | 2 +-
4 files changed, 27 insertions(+), 10 deletions(-)
diff --git js/src/jit/IonCacheIRCompiler.cpp js/src/jit/IonCacheIRCompiler.cpp
index b11aed7966b6..bbfbdae57b12 100644
--- js/src/jit/IonCacheIRCompiler.cpp
+++ js/src/jit/IonCacheIRCompiler.cpp
@@ -1324,9 +1324,9 @@ IonCacheIRCompiler::emitCallStringSplitResult()
static bool
GroupHasPropertyTypes(ObjectGroup* group, jsid* id, Value* v)
{
- if (group->unknownProperties())
+ if (group->unknownPropertiesDontCheckGeneration())
return true;
- HeapTypeSet* propTypes = group->maybeGetProperty(*id);
+ HeapTypeSet* propTypes = group->maybeGetPropertyDontCheckGeneration(*id);
if (!propTypes)
return true;
if (!propTypes->nonConstantProperty())
diff --git js/src/vm/ObjectGroup.h js/src/vm/ObjectGroup.h
index 237b5a152576..0eba71ee084f 100644
--- js/src/vm/ObjectGroup.h
+++ js/src/vm/ObjectGroup.h
@@ -390,6 +390,7 @@ class ObjectGroup : public gc::TenuredCell
/* Get a property only if it already exists. */
MOZ_ALWAYS_INLINE HeapTypeSet* maybeGetProperty(jsid id);
+ MOZ_ALWAYS_INLINE HeapTypeSet* maybeGetPropertyDontCheckGeneration(jsid id);
/*
* Iterate through the group's properties. getPropertyCount overapproximates
@@ -471,6 +472,7 @@ class ObjectGroup : public gc::TenuredCell
}
inline uint32_t basePropertyCount();
+ inline uint32_t basePropertyCountDontCheckGeneration();
private:
inline void setBasePropertyCount(uint32_t count);
diff --git js/src/vm/TypeInference-inl.h js/src/vm/TypeInference-inl.h
index f7cd3459ef19..f2b0b9a52fbc 100644
--- js/src/vm/TypeInference-inl.h
+++ js/src/vm/TypeInference-inl.h
@@ -369,10 +369,10 @@ TypeMonitorCall(JSContext* cx, const js::CallArgs& args, bool constructing)
MOZ_ALWAYS_INLINE bool
TrackPropertyTypes(JSObject* obj, jsid id)
{
- if (obj->hasLazyGroup() || obj->group()->unknownProperties())
+ if (obj->hasLazyGroup() || obj->group()->unknownPropertiesDontCheckGeneration())
return false;
- if (obj->isSingleton() && !obj->group()->maybeGetProperty(id))
+ if (obj->isSingleton() && !obj->group()->maybeGetPropertyDontCheckGeneration(id))
return false;
return true;
@@ -410,7 +410,7 @@ HasTrackedPropertyType(JSObject* obj, jsid id, TypeSet::Type type)
MOZ_ASSERT(id == IdToTypeId(id));
MOZ_ASSERT(TrackPropertyTypes(obj, id));
- if (HeapTypeSet* types = obj->group()->maybeGetProperty(id)) {
+ if (HeapTypeSet* types = obj->group()->maybeGetPropertyDontCheckGeneration(id)) {
if (!types->hasType(type))
return false;
// Non-constant properties are only relevant for singleton objects.
@@ -1074,10 +1074,18 @@ TypeSet::getObjectClass(unsigned i) const
// ObjectGroup
/////////////////////////////////////////////////////////////////////
+inline uint32_t
+ObjectGroup::basePropertyCountDontCheckGeneration()
+{
+ uint32_t flags = flagsDontCheckGeneration();
+ return (flags & OBJECT_FLAG_PROPERTY_COUNT_MASK) >> OBJECT_FLAG_PROPERTY_COUNT_SHIFT;
+}
+
inline uint32_t
ObjectGroup::basePropertyCount()
{
- return (flags() & OBJECT_FLAG_PROPERTY_COUNT_MASK) >> OBJECT_FLAG_PROPERTY_COUNT_SHIFT;
+ maybeSweep(nullptr);
+ return basePropertyCountDontCheckGeneration();
}
inline void
@@ -1134,14 +1142,14 @@ ObjectGroup::getProperty(JSContext* cx, JSObject* obj, jsid id)
}
MOZ_ALWAYS_INLINE HeapTypeSet*
-ObjectGroup::maybeGetProperty(jsid id)
+ObjectGroup::maybeGetPropertyDontCheckGeneration(jsid id)
{
MOZ_ASSERT(JSID_IS_VOID(id) || JSID_IS_EMPTY(id) || JSID_IS_STRING(id) || JSID_IS_SYMBOL(id));
MOZ_ASSERT_IF(!JSID_IS_EMPTY(id), id == IdToTypeId(id));
- MOZ_ASSERT(!unknownProperties());
+ MOZ_ASSERT(!unknownPropertiesDontCheckGeneration());
Property* prop = TypeHashSet::Lookup<jsid, Property, Property>
- (propertySet, basePropertyCount(), id);
+ (propertySet, basePropertyCountDontCheckGeneration(), id);
if (!prop)
return nullptr;
@@ -1150,6 +1158,13 @@ ObjectGroup::maybeGetProperty(jsid id)
return &prop->types;
}
+MOZ_ALWAYS_INLINE HeapTypeSet*
+ObjectGroup::maybeGetProperty(jsid id)
+{
+ maybeSweep(nullptr);
+ return maybeGetPropertyDontCheckGeneration(id);
+}
+
inline unsigned
ObjectGroup::getPropertyCount()
{
diff --git js/src/vm/UnboxedObject.cpp js/src/vm/UnboxedObject.cpp
index c155b7dc47c9..4e007489a67e 100644
--- js/src/vm/UnboxedObject.cpp
+++ js/src/vm/UnboxedObject.cpp
@@ -363,7 +363,7 @@ UnboxedPlainObject::ensureExpando(JSContext* cx, Handle<UnboxedPlainObject*> obj
bool
UnboxedPlainObject::containsUnboxedOrExpandoProperty(JSContext* cx, jsid id) const
{
- if (layout().lookup(id))
+ if (layoutDontCheckGeneration().lookup(id))
return true;
if (maybeExpando() && maybeExpando()->containsShapeOrElement(cx, id))
commit e240cf665f74
Author: Jan de Mooij <jdemooij@mozilla.com>
Date: Wed Sep 20 12:13:54 2017 +0200
Bug 1384121 part 2 - Add asserts to catch similar bugs and fix some false positives. r=nbp
---
js/src/jit/Bailouts.cpp | 4 ----
js/src/jit/JSJitFrameIter.cpp | 2 ++
js/src/jit/VMFunctions.cpp | 1 -
js/src/jit/arm/Trampoline-arm.cpp | 9 ++++++---
js/src/jit/arm64/Trampoline-arm64.cpp | 9 ++++++---
js/src/jit/mips32/Trampoline-mips32.cpp | 9 ++++++---
js/src/jit/mips64/Trampoline-mips64.cpp | 9 ++++++---
js/src/jit/x64/Trampoline-x64.cpp | 9 ++++++---
js/src/jit/x86/Trampoline-x86.cpp | 9 ++++++---
js/src/vm/ObjectGroup-inl.h | 1 +
js/src/vm/Stack.cpp | 2 ++
js/src/vm/TypeInference.cpp | 3 +++
12 files changed, 44 insertions(+), 23 deletions(-)
diff --git js/src/jit/JSJitFrameIter.cpp js/src/jit/JSJitFrameIter.cpp
index 3774b327d21c..ae76bc2abaf0 100644
--- js/src/jit/JitFrameIterator.cpp
+++ js/src/jit/JitFrameIterator.cpp
@@ -25,6 +25,8 @@ JSJitFrameIter::JSJitFrameIter(const JitActivation* activation)
current_ = activation_->bailoutData()->fp();
frameSize_ = activation_->bailoutData()->topFrameSize();
type_ = JitFrame_Bailout;
+ } else {
+ MOZ_ASSERT(!TlsContext.get()->inUnsafeCallWithABI);
}
}
diff --git js/src/vm/ObjectGroup-inl.h js/src/vm/ObjectGroup-inl.h
index 7e023ecbad8e..d7caa63d8725 100644
--- js/src/vm/ObjectGroup-inl.h
+++ js/src/vm/ObjectGroup-inl.h
@@ -16,6 +16,7 @@ ObjectGroup::needsSweep()
{
// Note: this can be called off thread during compacting GCs, in which case
// nothing will be running on the active thread.
+ MOZ_ASSERT(!TlsContext.get()->inUnsafeCallWithABI);
return generation() != zoneFromAnyThread()->types.generation;
}
diff --git js/src/vm/Stack.cpp js/src/vm/Stack.cpp
index d3c0038db5ca..0406195abd56 100644
--- js/src/vm/Stack.cpp
+++ js/src/vm/Stack.cpp
@@ -605,6 +605,8 @@ FrameIter::popInterpreterFrame()
void
FrameIter::settleOnActivation()
{
+ MOZ_ASSERT(!data_.cx_->inUnsafeCallWithABI);
+
while (true) {
if (data_.activations_.done()) {
data_.state_ = DONE;
diff --git js/src/vm/TypeInference.cpp js/src/vm/TypeInference.cpp
index f0562a4355f8..eba18e34397e 100644
--- js/src/vm/TypeInference.cpp
+++ js/src/vm/TypeInference.cpp
@@ -4428,6 +4428,8 @@ ObjectGroup::sweep(AutoClearTypeInferenceStateOnOOM* oom)
/* static */ void
JSScript::maybeSweepTypes(AutoClearTypeInferenceStateOnOOM* oom)
{
+ MOZ_ASSERT(!TlsContext.get()->inUnsafeCallWithABI);
+
if (!types_ || typesGeneration() == zone()->types.generation)
return;
@@ -4611,6 +4613,7 @@ AutoClearTypeInferenceStateOnOOM::AutoClearTypeInferenceStateOnOOM(Zone* zone)
: zone(zone), oom(false)
{
MOZ_RELEASE_ASSERT(CurrentThreadCanAccessZone(zone));
+ MOZ_ASSERT(!TlsContext.get()->inUnsafeCallWithABI);
zone->types.setSweepingTypes(true);
}

View file

@ -0,0 +1,796 @@
diff --git widget/gtk/nsLookAndFeel.cpp widget/gtk/nsLookAndFeel.cpp
index 6bb3e27c6653..f4c35d82200a 100644
--- widget/gtk/nsLookAndFeel.cpp
+++ widget/gtk/nsLookAndFeel.cpp
@@ -29,11 +29,9 @@
#include "mozilla/gfx/2D.h"
-#if MOZ_WIDGET_GTK != 2
#include <cairo-gobject.h>
#include "WidgetStyleCache.h"
#include "prenv.h"
-#endif
using mozilla::LookAndFeel;
@@ -49,9 +47,6 @@ using mozilla::LookAndFeel;
nsLookAndFeel::nsLookAndFeel()
: nsXPLookAndFeel(),
-#if (MOZ_WIDGET_GTK == 2)
- mStyle(nullptr),
-#endif
mDefaultFontCached(false), mButtonFontCached(false),
mFieldFontCached(false), mMenuFontCached(false),
mInitialized(false)
@@ -66,12 +61,8 @@ nsLookAndFeel::NativeInit()
nsLookAndFeel::~nsLookAndFeel()
{
-#if (MOZ_WIDGET_GTK == 2)
- g_object_unref(mStyle);
-#endif
}
-#if MOZ_WIDGET_GTK != 2
// Modifies color |*aDest| as if a pattern of color |aSource| was painted with
// CAIRO_OPERATOR_OVER to a surface with color |*aDest|.
static void
@@ -228,42 +219,19 @@ GetBorderColors(GtkStyleContext* aContext,
*aDarkColor = GDK_RGBA_TO_NS_RGBA(darkColor);
return ret;
}
-#endif
nsresult
nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
{
EnsureInit();
-#if (MOZ_WIDGET_GTK == 3)
GdkRGBA gdk_color;
-#endif
nsresult res = NS_OK;
switch (aID) {
// These colors don't seem to be used for anything anymore in Mozilla
// (except here at least TextSelectBackground and TextSelectForeground)
// The CSS2 colors below are used.
-#if (MOZ_WIDGET_GTK == 2)
- case eColorID_WindowBackground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_NORMAL]);
- break;
- case eColorID_WindowForeground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_NORMAL]);
- break;
- case eColorID_WidgetBackground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_WidgetForeground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_NORMAL]);
- break;
- case eColorID_WidgetSelectBackground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_SELECTED]);
- break;
- case eColorID_WidgetSelectForeground:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_SELECTED]);
- break;
-#else
case eColorID_WindowBackground:
case eColorID_WidgetBackground:
case eColorID_TextBackground:
@@ -303,35 +271,12 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
case eColorID__moz_html_cellhighlighttext:
aColor = sTextSelectedText;
break;
-#endif
case eColorID_Widget3DHighlight:
aColor = NS_RGB(0xa0,0xa0,0xa0);
break;
case eColorID_Widget3DShadow:
aColor = NS_RGB(0x40,0x40,0x40);
break;
-#if (MOZ_WIDGET_GTK == 2)
- case eColorID_TextBackground:
- // not used?
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_NORMAL]);
- break;
- case eColorID_TextForeground:
- // not used?
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_NORMAL]);
- break;
- case eColorID_TextSelectBackground:
- case eColorID_IMESelectedRawTextBackground:
- case eColorID_IMESelectedConvertedTextBackground:
- // still used
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_SELECTED]);
- break;
- case eColorID_TextSelectForeground:
- case eColorID_IMESelectedRawTextForeground:
- case eColorID_IMESelectedConvertedTextForeground:
- // still used
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_SELECTED]);
- break;
-#endif
case eColorID_IMERawInputBackground:
case eColorID_IMEConvertedTextBackground:
aColor = NS_TRANSPARENT;
@@ -352,53 +297,6 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
aColor = NS_RGB(0xff, 0, 0);
break;
-#if (MOZ_WIDGET_GTK == 2)
- // css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
- case eColorID_activeborder:
- // active window border
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_activecaption:
- // active window caption background
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_appworkspace:
- // MDI background color
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_background:
- // desktop background
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_captiontext:
- // text in active window caption, size box, and scrollbar arrow box (!)
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_NORMAL]);
- break;
- case eColorID_graytext:
- // disabled text in windows, menus, etc.
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_INSENSITIVE]);
- break;
- case eColorID_highlight:
- // background of selected item
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_SELECTED]);
- break;
- case eColorID_highlighttext:
- // text of selected item
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_SELECTED]);
- break;
- case eColorID_inactiveborder:
- // inactive window border
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID_inactivecaption:
- // inactive window caption
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_INSENSITIVE]);
- break;
- case eColorID_inactivecaptiontext:
- // text in inactive window caption
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_INSENSITIVE]);
- break;
-#else
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
case eColorID_activeborder: {
// active window border
@@ -433,7 +331,6 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
ReleaseStyleContext(style);
break;
}
-#endif
case eColorID_infobackground:
// tooltip background color
aColor = sInfoBackground;
@@ -452,11 +349,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
break;
case eColorID_scrollbar:
// scrollbar gray area
-#if (MOZ_WIDGET_GTK == 2)
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_ACTIVE]);
-#else
aColor = sMozScrollbar;
-#endif
break;
case eColorID_threedlightshadow:
@@ -465,11 +358,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
case eColorID_threedface:
case eColorID_buttonface:
// 3-D face color
-#if (MOZ_WIDGET_GTK == 3)
aColor = sMozWindowBackground;
-#else
- aColor = sButtonBackground;
-#endif
break;
case eColorID_buttontext:
@@ -491,56 +380,6 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
aColor = sFrameInnerDarkBorder;
break;
-#if (MOZ_WIDGET_GTK == 2)
- case eColorID_threeddarkshadow:
- // 3-D shadow outer edge color
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->black);
- break;
-
- case eColorID_window:
- case eColorID_windowframe:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
-
- case eColorID_windowtext:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_NORMAL]);
- break;
-
- case eColorID__moz_eventreerow:
- case eColorID__moz_field:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_NORMAL]);
- break;
- case eColorID__moz_fieldtext:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_NORMAL]);
- break;
- case eColorID__moz_dialog:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_NORMAL]);
- break;
- case eColorID__moz_dialogtext:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_NORMAL]);
- break;
- case eColorID__moz_dragtargetzone:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_SELECTED]);
- break;
- case eColorID__moz_buttondefault:
- // default button border color
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->black);
- break;
- case eColorID__moz_buttonhoverface:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->bg[GTK_STATE_PRELIGHT]);
- break;
- case eColorID__moz_buttonhovertext:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->fg[GTK_STATE_PRELIGHT]);
- break;
- case eColorID__moz_cellhighlight:
- case eColorID__moz_html_cellhighlight:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->base[GTK_STATE_ACTIVE]);
- break;
- case eColorID__moz_cellhighlighttext:
- case eColorID__moz_html_cellhighlighttext:
- aColor = GDK_COLOR_TO_NS_RGB(mStyle->text[GTK_STATE_ACTIVE]);
- break;
-#else
case eColorID_threeddarkshadow:
// Hardcode to black
aColor = NS_RGB(0x00,0x00,0x00);
@@ -574,7 +413,6 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
case eColorID__moz_buttonhovertext:
aColor = sButtonHoverText;
break;
-#endif
case eColorID__moz_menuhover:
aColor = sMenuHover;
break;
@@ -590,11 +428,6 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
case eColorID__moz_comboboxtext:
aColor = sComboBoxText;
break;
-#if (MOZ_WIDGET_GTK == 2)
- case eColorID__moz_combobox:
- aColor = sComboBoxBackground;
- break;
-#endif
case eColorID__moz_menubartext:
aColor = sMenuBarText;
break;
@@ -602,11 +435,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
aColor = sMenuBarHoverText;
break;
case eColorID__moz_gtk_info_bar_text:
-#if (MOZ_WIDGET_GTK == 3)
aColor = sInfoBarText;
-#else
- aColor = sInfoText;
-#endif
break;
default:
/* default color is BLACK */
@@ -618,27 +447,6 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
return res;
}
-#if (MOZ_WIDGET_GTK == 2)
-static void darken_gdk_color(GdkColor *src, GdkColor *dest)
-{
- gdouble red;
- gdouble green;
- gdouble blue;
-
- red = (gdouble) src->red / 65535.0;
- green = (gdouble) src->green / 65535.0;
- blue = (gdouble) src->blue / 65535.0;
-
- red *= 0.93;
- green *= 0.93;
- blue *= 0.93;
-
- dest->red = red * 65535.0;
- dest->green = green * 65535.0;
- dest->blue = blue * 65535.0;
-}
-#endif
-
static int32_t CheckWidgetStyle(GtkWidget* aWidget, const char* aStyle, int32_t aResult) {
gboolean value = FALSE;
gtk_widget_style_get(aWidget, aStyle, &value, nullptr);
@@ -826,14 +634,8 @@ nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
res = NS_ERROR_NOT_IMPLEMENTED;
break;
case eIntID_TouchEnabled:
-#if MOZ_WIDGET_GTK == 3
aResult = mozilla::widget::WidgetUtils::IsTouchDeviceSupportPresent();
break;
-#else
- aResult = 0;
- res = NS_ERROR_NOT_IMPLEMENTED;
-#endif
- break;
case eIntID_MacGraphiteTheme:
aResult = 0;
res = NS_ERROR_NOT_IMPLEMENTED;
@@ -905,24 +707,20 @@ nsLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
}
static void
-GetSystemFontInfo(GtkWidget *aWidget,
+GetSystemFontInfo(GtkStyleContext *aStyle,
nsString *aFontName,
gfxFontStyle *aFontStyle)
{
- GtkSettings *settings = gtk_widget_get_settings(aWidget);
-
aFontStyle->style = NS_FONT_STYLE_NORMAL;
- gchar *fontname;
- g_object_get(settings, "gtk-font-name", &fontname, nullptr);
-
+ // As in
+ // https://git.gnome.org/browse/gtk+/tree/gtk/gtkwidget.c?h=3.22.19#n10333
PangoFontDescription *desc;
- desc = pango_font_description_from_string(fontname);
+ gtk_style_context_get(aStyle, gtk_style_context_get_state(aStyle),
+ "font", &desc, nullptr);
aFontStyle->systemFont = true;
- g_free(fontname);
-
NS_NAMED_LITERAL_STRING(quote, "\"");
NS_ConvertUTF8toUTF16 family(pango_font_description_get_family(desc));
*aFontName = quote + family + quote;
@@ -953,96 +751,28 @@ GetSystemFontInfo(GtkWidget *aWidget,
pango_font_description_free(desc);
}
-static void
-GetSystemFontInfo(LookAndFeel::FontID aID,
- nsString *aFontName,
- gfxFontStyle *aFontStyle)
-{
- if (aID == LookAndFeel::eFont_Widget) {
- GtkWidget *label = gtk_label_new("M");
- GtkWidget *parent = gtk_fixed_new();
- GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
-
- gtk_container_add(GTK_CONTAINER(parent), label);
- gtk_container_add(GTK_CONTAINER(window), parent);
-
- gtk_widget_ensure_style(label);
- GetSystemFontInfo(label, aFontName, aFontStyle);
- gtk_widget_destroy(window); // no unref, windows are different
-
- } else if (aID == LookAndFeel::eFont_Button) {
- GtkWidget *label = gtk_label_new("M");
- GtkWidget *parent = gtk_fixed_new();
- GtkWidget *button = gtk_button_new();
- GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
-
- gtk_container_add(GTK_CONTAINER(button), label);
- gtk_container_add(GTK_CONTAINER(parent), button);
- gtk_container_add(GTK_CONTAINER(window), parent);
-
- gtk_widget_ensure_style(label);
- GetSystemFontInfo(label, aFontName, aFontStyle);
- gtk_widget_destroy(window); // no unref, windows are different
-
- } else if (aID == LookAndFeel::eFont_Field) {
- GtkWidget *entry = gtk_entry_new();
- GtkWidget *parent = gtk_fixed_new();
- GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
-
- gtk_container_add(GTK_CONTAINER(parent), entry);
- gtk_container_add(GTK_CONTAINER(window), parent);
-
- gtk_widget_ensure_style(entry);
- GetSystemFontInfo(entry, aFontName, aFontStyle);
- gtk_widget_destroy(window); // no unref, windows are different
-
- } else {
- MOZ_ASSERT(aID == LookAndFeel::eFont_Menu, "unexpected font ID");
- GtkWidget *accel_label = gtk_accel_label_new("M");
- GtkWidget *menuitem = gtk_menu_item_new();
- GtkWidget *menu = gtk_menu_new();
- g_object_ref_sink(menu);
-
- gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
- gtk_menu_shell_append((GtkMenuShell *)GTK_MENU(menu), menuitem);
-
- gtk_widget_ensure_style(accel_label);
- GetSystemFontInfo(accel_label, aFontName, aFontStyle);
- g_object_unref(menu);
- }
-}
-
bool
nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName,
gfxFontStyle& aFontStyle,
float aDevPixPerCSSPixel)
{
- nsString *cachedFontName = nullptr;
- gfxFontStyle *cachedFontStyle = nullptr;
- bool *isCached = nullptr;
-
switch (aID) {
case eFont_Menu: // css2
case eFont_PullDownMenu: // css3
- cachedFontName = &mMenuFontName;
- cachedFontStyle = &mMenuFontStyle;
- isCached = &mMenuFontCached;
- aID = eFont_Menu;
- break;
+ aFontName = mMenuFontName;
+ aFontStyle = mMenuFontStyle;
+ return true;
case eFont_Field: // css3
case eFont_List: // css3
- cachedFontName = &mFieldFontName;
- cachedFontStyle = &mFieldFontStyle;
- isCached = &mFieldFontCached;
- aID = eFont_Field;
- break;
+ aFontName = mFieldFontName;
+ aFontStyle = mFieldFontStyle;
+ return true;
case eFont_Button: // css3
- cachedFontName = &mButtonFontName;
- cachedFontStyle = &mButtonFontStyle;
- isCached = &mButtonFontCached;
- break;
+ aFontName = mButtonFontName;
+ aFontStyle = mButtonFontStyle;
+ return true;
case eFont_Caption: // css2
case eFont_Icon: // css2
@@ -1057,21 +787,11 @@ nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName,
case eFont_Dialog: // css3
case eFont_Tooltips: // moz
case eFont_Widget: // moz
- cachedFontName = &mDefaultFontName;
- cachedFontStyle = &mDefaultFontStyle;
- isCached = &mDefaultFontCached;
- aID = eFont_Widget;
- break;
- }
-
- if (!*isCached) {
- GetSystemFontInfo(aID, cachedFontName, cachedFontStyle);
- *isCached = true;
+ default:
+ aFontName = mDefaultFontName;
+ aFontStyle = mDefaultFontStyle;
+ return true;
}
-
- aFontName = *cachedFontName;
- aFontStyle = *cachedFontStyle;
- return true;
}
void
@@ -1087,70 +807,6 @@ nsLookAndFeel::EnsureInit()
// gtk does non threadsafe refcounting
MOZ_ASSERT(NS_IsMainThread());
-#if (MOZ_WIDGET_GTK == 2)
- NS_ASSERTION(!mStyle, "already initialized");
- // GtkInvisibles come with a refcount that is not floating
- // (since their initialization code calls g_object_ref_sink) and
- // their destroy code releases that reference (which means they
- // have to be explicitly destroyed, since calling unref enough
- // to cause destruction would lead to *another* unref).
- // However, this combination means that it's actually still ok
- // to use the normal pattern, which is to g_object_ref_sink
- // after construction, and then destroy *and* unref when we're
- // done. (Though we could skip the g_object_ref_sink and the
- // corresponding g_object_unref, but that's particular to
- // GtkInvisibles and GtkWindows.)
- GtkWidget *widget = gtk_invisible_new();
- g_object_ref_sink(widget); // effectively g_object_ref (see above)
-
- gtk_widget_ensure_style(widget);
- mStyle = gtk_style_copy(gtk_widget_get_style(widget));
-
- gtk_widget_destroy(widget);
- g_object_unref(widget);
-
- // tooltip foreground and background
- GtkStyle *style = gtk_rc_get_style_by_paths(gtk_settings_get_default(),
- "gtk-tooltips", "GtkWindow",
- GTK_TYPE_WINDOW);
- if (style) {
- sInfoBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]);
- sInfoText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
- }
-
- // menu foreground & menu background
- GtkWidget *accel_label = gtk_accel_label_new("M");
- GtkWidget *menuitem = gtk_menu_item_new();
- GtkWidget *menu = gtk_menu_new();
-
- g_object_ref_sink(menu);
-
- gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
-
- gtk_widget_set_style(accel_label, nullptr);
- gtk_widget_set_style(menu, nullptr);
- gtk_widget_realize(menu);
- gtk_widget_realize(accel_label);
-
- style = gtk_widget_get_style(accel_label);
- if (style) {
- sMenuText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
- }
-
- style = gtk_widget_get_style(menu);
- if (style) {
- sMenuBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]);
- }
-
- style = gtk_widget_get_style(menuitem);
- if (style) {
- sMenuHover = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_PRELIGHT]);
- sMenuHoverText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_PRELIGHT]);
- }
-
- g_object_unref(menu);
-#else
GdkRGBA color;
GtkStyleContext *style;
@@ -1195,6 +851,12 @@ nsLookAndFeel::EnsureInit()
}
}
+ // The label is not added to a parent widget, but shared for constructing
+ // different style contexts. The node hierarchy is constructed only on
+ // the label style context.
+ GtkWidget *labelWidget = gtk_label_new("M");
+ g_object_ref_sink(labelWidget);
+
// Scrollbar colors
style = ClaimStyleContext(MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
@@ -1208,6 +870,13 @@ nsLookAndFeel::EnsureInit()
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
ReleaseStyleContext(style);
+ style = ClaimStyleContext(MOZ_GTK_WINDOW_CONTAINER);
+ {
+ GtkStyleContext* labelStyle = CreateStyleForWidget(labelWidget, style);
+ GetSystemFontInfo(labelStyle, &mDefaultFontName, &mDefaultFontStyle);
+ g_object_unref(labelStyle);
+ }
+ ReleaseStyleContext(style);
// tooltip foreground and background
style = ClaimStyleContext(MOZ_GTK_TOOLTIP);
@@ -1224,6 +893,9 @@ nsLookAndFeel::EnsureInit()
{
GtkStyleContext* accelStyle =
CreateStyleForWidget(gtk_accel_label_new("M"), style);
+
+ GetSystemFontInfo(accelStyle, &mMenuFontName, &mMenuFontStyle);
+
gtk_style_context_get_color(accelStyle, GTK_STATE_FLAG_NORMAL, &color);
sMenuText = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_get_color(accelStyle, GTK_STATE_FLAG_INSENSITIVE, &color);
@@ -1243,17 +915,8 @@ nsLookAndFeel::EnsureInit()
gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color);
ReleaseStyleContext(style);
-#endif
- // button styles
GtkWidget *parent = gtk_fixed_new();
- GtkWidget *button = gtk_button_new();
- GtkWidget *label = gtk_label_new("M");
-#if (MOZ_WIDGET_GTK == 2)
- GtkWidget *combobox = gtk_combo_box_new();
- GtkWidget *comboboxLabel = gtk_label_new("M");
- gtk_container_add(GTK_CONTAINER(combobox), comboboxLabel);
-#endif
GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
GtkWidget *treeView = gtk_tree_view_new();
GtkWidget *linkButton = gtk_link_button_new("http://example.com/");
@@ -1262,94 +925,14 @@ nsLookAndFeel::EnsureInit()
GtkWidget *entry = gtk_entry_new();
GtkWidget *textView = gtk_text_view_new();
- gtk_container_add(GTK_CONTAINER(button), label);
- gtk_container_add(GTK_CONTAINER(parent), button);
gtk_container_add(GTK_CONTAINER(parent), treeView);
gtk_container_add(GTK_CONTAINER(parent), linkButton);
-#if (MOZ_WIDGET_GTK == 2)
- gtk_container_add(GTK_CONTAINER(parent), combobox);
-#endif
gtk_container_add(GTK_CONTAINER(parent), menuBar);
gtk_menu_shell_append(GTK_MENU_SHELL(menuBar), menuBarItem);
gtk_container_add(GTK_CONTAINER(window), parent);
gtk_container_add(GTK_CONTAINER(parent), entry);
gtk_container_add(GTK_CONTAINER(parent), textView);
-#if (MOZ_WIDGET_GTK == 2)
- gtk_widget_set_style(button, nullptr);
- gtk_widget_set_style(label, nullptr);
- gtk_widget_set_style(treeView, nullptr);
- gtk_widget_set_style(linkButton, nullptr);
- gtk_widget_set_style(combobox, nullptr);
- gtk_widget_set_style(comboboxLabel, nullptr);
- gtk_widget_set_style(menuBar, nullptr);
- gtk_widget_set_style(entry, nullptr);
-
- gtk_widget_realize(button);
- gtk_widget_realize(label);
- gtk_widget_realize(treeView);
- gtk_widget_realize(linkButton);
- gtk_widget_realize(combobox);
- gtk_widget_realize(comboboxLabel);
- gtk_widget_realize(menuBar);
- gtk_widget_realize(entry);
-
- style = gtk_widget_get_style(label);
- if (style) {
- sButtonText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
- }
-
- style = gtk_widget_get_style(comboboxLabel);
- if (style) {
- sComboBoxText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
- }
- style = gtk_widget_get_style(combobox);
- if (style) {
- sComboBoxBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]);
- }
-
- style = gtk_widget_get_style(menuBar);
- if (style) {
- sMenuBarText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
- sMenuBarHoverText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_SELECTED]);
- }
-
- // GTK's guide to fancy odd row background colors:
- // 1) Check if a theme explicitly defines an odd row color
- // 2) If not, check if it defines an even row color, and darken it
- // slightly by a hardcoded value (gtkstyle.c)
- // 3) If neither are defined, take the base background color and
- // darken that by a hardcoded value
- colorValuePtr = nullptr;
- gtk_widget_style_get(treeView,
- "odd-row-color", &colorValuePtr,
- nullptr);
-
- if (colorValuePtr) {
- colorValue = *colorValuePtr;
- } else {
- gtk_widget_style_get(treeView,
- "even-row-color", &colorValuePtr,
- nullptr);
- if (colorValuePtr)
- darken_gdk_color(colorValuePtr, &colorValue);
- else
- darken_gdk_color(&treeView->style->base[GTK_STATE_NORMAL], &colorValue);
- }
-
- sOddCellBackground = GDK_COLOR_TO_NS_RGB(colorValue);
- if (colorValuePtr)
- gdk_color_free(colorValuePtr);
-
- style = gtk_widget_get_style(button);
- if (style) {
- sButtonBackground = GDK_COLOR_TO_NS_RGB(style->bg[GTK_STATE_NORMAL]);
- sFrameOuterLightBorder =
- GDK_COLOR_TO_NS_RGB(style->light[GTK_STATE_NORMAL]);
- sFrameInnerDarkBorder =
- GDK_COLOR_TO_NS_RGB(style->dark[GTK_STATE_NORMAL]);
- }
-#else
// Text colors
GdkRGBA bgColor;
// If the text window background is translucent, then the background of
@@ -1381,8 +964,10 @@ nsLookAndFeel::EnsureInit()
// Button text color
style = ClaimStyleContext(MOZ_GTK_BUTTON);
{
- GtkStyleContext* labelStyle =
- CreateStyleForWidget(gtk_label_new("M"), style);
+ GtkStyleContext* labelStyle = CreateStyleForWidget(labelWidget, style);
+
+ GetSystemFontInfo(labelStyle, &mButtonFontName, &mButtonFontStyle);
+
gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_NORMAL, &color);
sButtonText = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_PRELIGHT, &color);
@@ -1446,7 +1031,6 @@ nsLookAndFeel::EnsureInit()
gtk_style_context_add_class(style, GTK_STYLE_CLASS_INFO);
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
sInfoBarText = GDK_RGBA_TO_NS_RGBA(color);
-#endif
// Some themes have a unified menu bar, and support window dragging on it
gboolean supports_menubar_drag = FALSE;
GParamSpec *param_spec =
@@ -1493,7 +1074,11 @@ nsLookAndFeel::EnsureInit()
"cursor-aspect-ratio", &sCaretRatio,
nullptr);
+ GetSystemFontInfo(gtk_widget_get_style_context(entry),
+ &mFieldFontName, &mFieldFontStyle);
+
gtk_widget_destroy(window);
+ g_object_unref(labelWidget);
}
// virtual
@@ -1515,11 +1100,6 @@ nsLookAndFeel::RefreshImpl()
mFieldFontCached = false;
mMenuFontCached = false;
-#if (MOZ_WIDGET_GTK == 2)
- g_object_unref(mStyle);
- mStyle = nullptr;
-#endif
-
mInitialized = false;
}
diff --git widget/gtk/nsLookAndFeel.h widget/gtk/nsLookAndFeel.h
index 9a4015e95415..38cd51c056d6 100644
--- widget/gtk/nsLookAndFeel.h
+++ widget/gtk/nsLookAndFeel.h
@@ -33,9 +33,6 @@ public:
virtual bool GetEchoPasswordImpl();
protected:
-#if (MOZ_WIDGET_GTK == 2)
- struct _GtkStyle *mStyle;
-#endif
// Cached fonts
bool mDefaultFontCached;
@@ -63,7 +60,6 @@ protected:
nscolor sMenuHoverText;
nscolor sButtonText;
nscolor sButtonHoverText;
- nscolor sButtonBackground;
nscolor sFrameOuterLightBorder;
nscolor sFrameInnerDarkBorder;
nscolor sOddCellBackground;
@@ -77,9 +73,7 @@ protected:
nscolor sTextSelectedText;
nscolor sTextSelectedBackground;
nscolor sMozScrollbar;
-#if (MOZ_WIDGET_GTK == 3)
nscolor sInfoBarText;
-#endif
char16_t sInvisibleCharacter;
float sCaretRatio;
bool sMenuSupportsDrag;

View file

@ -0,0 +1,89 @@
commit efbe3a9af876
Author: Manish Goregaokar <manishearth@gmail.com>
Date: Wed Aug 2 11:24:35 2017 -0700
Bug 1386887 - Clean up FFI lifetimes to work on nightly; r=emilio
MozReview-Commit-ID: 5WAIVd6p2du
---
layout/style/ServoBindingList.h | 4 ++--
layout/style/ServoBindingTypes.h | 2 ++
layout/style/ServoBindings.h | 4 ++--
layout/style/ServoBindings.toml | 4 +++-
4 files changed, 9 insertions(+), 5 deletions(-)
diff --git layout/style/ServoBindingList.h layout/style/ServoBindingList.h
index 6c669ebb3d3e..87ade14ea4de 100644
--- layout/style/ServoBindingList.h
+++ layout/style/ServoBindingList.h
@@ -379,10 +379,10 @@ SERVO_BINDING_FUNC(Servo_DeclarationBlock_HasCSSWideKeyword, bool,
nsCSSPropertyID property)
// Compose animation value for a given property.
// |base_values| is nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>.
-// We use void* to avoid exposing nsRefPtrHashtable in FFI.
+// We use RawServoAnimationValueTableBorrowed to avoid exposing nsRefPtrHashtable in FFI.
SERVO_BINDING_FUNC(Servo_AnimationCompose, void,
RawServoAnimationValueMapBorrowedMut animation_values,
- void* base_values,
+ RawServoAnimationValueTableBorrowed base_values,
nsCSSPropertyID property,
RawGeckoAnimationPropertySegmentBorrowed animation_segment,
RawGeckoAnimationPropertySegmentBorrowed last_segment,
diff --git layout/style/ServoBindingTypes.h layout/style/ServoBindingTypes.h
index aaf4fc27e1b9..69be15ee9f51 100644
--- layout/style/ServoBindingTypes.h
+++ layout/style/ServoBindingTypes.h
@@ -54,6 +54,8 @@ class nsXBLBinding;
using mozilla::dom::StyleChildrenIterator;
using mozilla::ServoElementSnapshot;
+typedef void* RawServoAnimationValueTableBorrowed;
+
typedef nsINode RawGeckoNode;
typedef mozilla::dom::Element RawGeckoElement;
typedef nsIDocument RawGeckoDocument;
diff --git layout/style/ServoBindings.h layout/style/ServoBindings.h
index 493ca63f932b..c6ced6d1fedb 100644
--- layout/style/ServoBindings.h
+++ layout/style/ServoBindings.h
@@ -268,9 +268,9 @@ double Gecko_GetPositionInSegment(
// Get servo's AnimationValue for |aProperty| from the cached base style
// |aBaseStyles|.
// |aBaseStyles| is nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>.
-// We use void* to avoid exposing nsRefPtrHashtable in FFI.
+// We use RawServoAnimationValueTableBorrowed to avoid exposing nsRefPtrHashtable in FFI.
RawServoAnimationValueBorrowedOrNull Gecko_AnimationGetBaseStyle(
- void* aBaseStyles,
+ RawServoAnimationValueTableBorrowed aBaseStyles,
nsCSSPropertyID aProperty);
void Gecko_StyleTransition_SetUnsupportedProperty(
mozilla::StyleTransition* aTransition,
diff --git layout/style/ServoBindings.toml layout/style/ServoBindings.toml
index 11e372541235..3c3902beea80 100644
--- layout/style/ServoBindings.toml
+++ layout/style/ServoBindings.toml
@@ -357,6 +357,7 @@ raw-lines = [
"pub type ServoStyleContextBorrowed<'a> = &'a ::properties::ComputedValues;",
"pub type ServoStyleContextBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>;",
"pub type ServoComputedDataBorrowed<'a> = &'a ServoComputedData;",
+ "pub type RawServoAnimationValueTableBorrowed<'a> = &'a ();"
]
whitelist-functions = ["Servo_.*", "Gecko_.*"]
structs-types = [
@@ -389,7 +390,7 @@ structs-types = [
"RawGeckoPresContext",
"RawGeckoPresContextOwned",
"RawGeckoStyleAnimationList",
- "RawGeckoStyleChildrenIteratorBorrowedMut",
+ "RawGeckoStyleChildrenIterator",
"RawGeckoServoStyleRuleList",
"RawGeckoURLExtraData",
"RawGeckoXBLBinding",
@@ -526,6 +527,7 @@ servo-borrow-types = [
"RawGeckoFontFaceRuleList",
"RawGeckoServoStyleRuleList",
"RawGeckoServoAnimationValueList",
+ "RawGeckoStyleChildrenIterator",
]
fixups = [
# hack for gecko-owned string

View file

@ -0,0 +1,14 @@
https://github.com/kinetiknz/cubeb/commit/16f9ccc064f2
--- media/libcubeb/src/cubeb_jack.cpp.orig 2017-07-07 05:37:16 UTC
+++ media/libcubeb/src/cubeb_jack.cpp
@@ -8,7 +8,9 @@
*/
#define _DEFAULT_SOURCE
#define _BSD_SOURCE
+#ifndef __FreeBSD__
#define _POSIX_SOURCE
+#endif
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>

View file

@ -0,0 +1,42 @@
commit a1341ccf6d63
Author: Christoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Date: Sun Aug 6 11:37:09 2017 +0200
Bug 1387811 - Follow up for Test within Bug 1381761: CSP JSON is never null, hence it's better to check actual contents of JSON for testing. r=dveditz
---
dom/security/test/csp/file_data_csp_inheritance.html | 6 ++++--
dom/security/test/csp/test_data_csp_inheritance.html | 4 +++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git dom/security/test/csp/file_data_csp_inheritance.html dom/security/test/csp/file_data_csp_inheritance.html
index 299c30255aa6..cbb4865343db 100644
--- dom/security/test/csp/file_data_csp_inheritance.html
+++ dom/security/test/csp/file_data_csp_inheritance.html
@@ -13,8 +13,10 @@
var frame = document.getElementById("dataFrame");
var principal = SpecialPowers.wrap(frame.contentDocument).nodePrincipal;
var cspJSON = principal.cspJSON;
- var result = principal.cspJSON ? "dataInheritsCSP" : "dataDoesNotInheritCSP";
- window.parent.postMessage({result}, "*");
+ var cspOBJ = JSON.parse(principal.cspJSON);
+ // make sure we got >>one<< policy
+ var policies = cspOBJ["csp-policies"];
+ window.parent.postMessage({result: policies.length}, "*");
</script>
</body>
diff --git dom/security/test/csp/test_data_csp_inheritance.html dom/security/test/csp/test_data_csp_inheritance.html
index 3afc4f7c02bc..bde2f5617e65 100644
--- dom/security/test/csp/test_data_csp_inheritance.html
+++ dom/security/test/csp/test_data_csp_inheritance.html
@@ -22,7 +22,9 @@ SimpleTest.waitForExplicitFinish();
window.addEventListener("message", receiveMessage);
function receiveMessage(event) {
window.removeEventListener("message", receiveMessage);
- is(event.data.result, "dataInheritsCSP",
+ // toplevel CSP should apply to data: URI iframe hence resulting
+ // in 1 applied policy.
+ is(event.data.result, 1,
"data: URI iframe inherits CSP from including context");
SimpleTest.finish();
}

View file

@ -0,0 +1,14 @@
Unbreak pingsender build on Tier3 archs
--- toolkit/crashreporter/google-breakpad/src/third_party/curl/curlbuild.h
+++ toolkit/crashreporter/google-breakpad/src/third_party/curl/curlbuild.h
@@ -154,8 +154,7 @@
#endif
/* The size of `long', as computed by sizeof. */
-#if defined(_M_X64) || (defined(__x86_64__) && !defined(__ILP32__)) || \
- defined(__aarch64__) || (defined(__mips__) && _MIPS_SIM == _ABI64)
+#if defined(_M_X64) || defined(__LP64__)
#define CURL_SIZEOF_LONG 8
#else
#define CURL_SIZEOF_LONG 4

View file

@ -0,0 +1,144 @@
commit d20c7d929c84
Author: Ethan <ettseng@mozilla.com>
Date: Fri Sep 1 17:29:44 2017 +0800
Bug 1393283 - Use the last ESR version as the spoofed Firefox version. r=tihuang, r=mcmanus
---
.../test/browser/browser_navigator.js | 2 +-
netwerk/protocol/http/nsHttpHandler.cpp | 16 +++----
.../resistfingerprinting/nsRFPService.cpp | 56 ++++++++++++++++++++++
.../components/resistfingerprinting/nsRFPService.h | 3 ++
4 files changed, 66 insertions(+), 11 deletions(-)
diff --git browser/components/resistfingerprinting/test/browser/browser_navigator.js browser/components/resistfingerprinting/test/browser/browser_navigator.js
index 25c393d8bb2a..9f52e34a9451 100644
--- browser/components/resistfingerprinting/test/browser/browser_navigator.js
+++ browser/components/resistfingerprinting/test/browser/browser_navigator.js
@@ -91,7 +91,7 @@ add_task(async function setup() {
let appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
let appVersion = parseInt(appInfo.version);
- let spoofedVersion = appVersion - (appVersion % 10);
+ let spoofedVersion = appVersion - ((appVersion - 3) % 7);
spoofedUserAgent = `Mozilla/5.0 (${SPOOFED_OSCPU}; rv:${spoofedVersion}.0) Gecko/20100101 Firefox/${spoofedVersion}.0`;
});
diff --git netwerk/protocol/http/nsHttpHandler.cpp netwerk/protocol/http/nsHttpHandler.cpp
index 31d0f8832732..b957d835b52f 100644
--- netwerk/protocol/http/nsHttpHandler.cpp
+++ netwerk/protocol/http/nsHttpHandler.cpp
@@ -461,16 +461,12 @@ nsHttpHandler::Init()
mAppVersion.AssignLiteral(MOZ_APP_UA_VERSION);
}
- // Generating the spoofed userAgent for fingerprinting resistance.
- // The browser version will be rounded down to a multiple of 10.
- // By doing so, the anonymity group will cover more versions instead of one
- // version.
- uint32_t spoofedVersion = mAppVersion.ToInteger(&rv);
- if (NS_SUCCEEDED(rv)) {
- spoofedVersion = spoofedVersion - (spoofedVersion % 10);
- mSpoofedUserAgent.Assign(nsPrintfCString(
- "Mozilla/5.0 (%s; rv:%d.0) Gecko/%s Firefox/%d.0",
- SPOOFED_OSCPU, spoofedVersion, LEGACY_BUILD_ID, spoofedVersion));
+ // Generating the spoofed User Agent for fingerprinting resistance.
+ rv = nsRFPService::GetSpoofedUserAgent(mSpoofedUserAgent);
+ if (NS_FAILED(rv)) {
+ // Empty mSpoofedUserAgent to make sure the unsuccessful spoofed UA string
+ // will not be used anywhere.
+ mSpoofedUserAgent.Truncate();
}
mSessionStartTime = NowInSeconds();
diff --git toolkit/components/resistfingerprinting/nsRFPService.cpp toolkit/components/resistfingerprinting/nsRFPService.cpp
index 94554200c3b8..96a2940c04a0 100644
--- toolkit/components/resistfingerprinting/nsRFPService.cpp
+++ toolkit/components/resistfingerprinting/nsRFPService.cpp
@@ -18,10 +18,13 @@
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsXULAppAPI.h"
+#include "nsPrintfCString.h"
#include "nsIObserverService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
+#include "nsIXULAppInfo.h"
+#include "nsIXULRuntime.h"
#include "nsJSUtils.h"
#include "prenv.h"
@@ -162,6 +165,59 @@ nsRFPService::GetSpoofedPresentedFrames(double aTime, uint32_t aWidth, uint32_t
return NSToIntFloor(time * sVideoFramesPerSec * ((100 - boundedDroppedRatio) / 100.0));
}
+/* static */
+nsresult
+nsRFPService::GetSpoofedUserAgent(nsACString &userAgent)
+{
+ // This function generates the spoofed value of User Agent.
+ // We spoof the values of the platform and Firefox version, which could be
+ // used as fingerprinting sources to identify individuals.
+ // Reference of the format of User Agent:
+ // https://developer.mozilla.org/en-US/docs/Web/API/NavigatorID/userAgent
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent
+
+ nsresult rv;
+ nsCOMPtr<nsIXULAppInfo> appInfo =
+ do_GetService("@mozilla.org/xre/app-info;1", &rv);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsAutoCString appVersion;
+ rv = appInfo->GetVersion(appVersion);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // The browser version will be spoofed as the last ESR version.
+ // By doing so, the anonymity group will cover more versions instead of one
+ // version.
+ uint32_t firefoxVersion = appVersion.ToInteger(&rv);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // Starting from Firefox 10, Firefox ESR was released once every seven
+ // Firefox releases, e.g. Firefox 10, 17, 24, 31, and so on.
+ // We infer the last and closest ESR version based on this rule.
+ nsCOMPtr<nsIXULRuntime> runtime =
+ do_GetService("@mozilla.org/xre/runtime;1", &rv);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsAutoCString updateChannel;
+ rv = runtime->GetDefaultUpdateChannel(updateChannel);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // If we are running in Firefox ESR, determine whether the formula of ESR
+ // version has changed. Once changed, we must update the formula in this
+ // function.
+ if (updateChannel.Equals("esr")) {
+ MOZ_ASSERT(((firefoxVersion % 7) == 3),
+ "Please udpate ESR version formula in nsRFPService.cpp");
+ }
+
+ uint32_t spoofedVersion = firefoxVersion - ((firefoxVersion - 3) % 7);
+ userAgent.Assign(nsPrintfCString(
+ "Mozilla/5.0 (%s; rv:%d.0) Gecko/%s Firefox/%d.0",
+ SPOOFED_OSCPU, spoofedVersion, LEGACY_BUILD_ID, spoofedVersion));
+
+ return rv;
+}
+
nsresult
nsRFPService::Init()
{
diff --git toolkit/components/resistfingerprinting/nsRFPService.h toolkit/components/resistfingerprinting/nsRFPService.h
index cf1f688bb992..bad80383883b 100644
--- toolkit/components/resistfingerprinting/nsRFPService.h
+++ toolkit/components/resistfingerprinting/nsRFPService.h
@@ -49,6 +49,9 @@ public:
static uint32_t GetSpoofedDroppedFrames(double aTime, uint32_t aWidth, uint32_t aHeight);
static uint32_t GetSpoofedPresentedFrames(double aTime, uint32_t aWidth, uint32_t aHeight);
+ // This method generates the spoofed value of User Agent.
+ static nsresult GetSpoofedUserAgent(nsACString &userAgent);
+
private:
nsresult Init();

View file

@ -0,0 +1,27 @@
commit d0ed05261f20
Author: jason laster <jlaster@mozilla.com>
Date: Wed Sep 20 10:52:54 2017 -0400
Bug 1401573 - Fix PoE, Link, and linux issue. r=nchevobbe
MozReview-Commit-ID: 35TA6bhW1Wr
---
devtools/client/debugger/new/debugger.js | 68 +++++++++++++++++-----
devtools/client/debugger/new/panel.js | 27 ++++++++-
.../new/test/mochitest/browser_dbg-expressions.js | 2 +-
3 files changed, 79 insertions(+), 18 deletions(-)
diff --git devtools/client/debugger/new/debugger.js devtools/client/debugger/new/debugger.js
index f52a3e380ab6..c1213180cb13 100644
--- devtools/client/debugger/new/debugger.js
+++ devtools/client/debugger/new/debugger.js
@@ -29493,7 +29493,8 @@ return /******/ (function(modules) { // webpackBootstr
}
function getKeyForOS(os, action) {
- return KEYS[os][action];
+ var osActions = KEYS[os] || KEYS.Linux;
+ return osActions[action];
}
function formatKey(action) {

View file

@ -0,0 +1,181 @@
commit 44b4458e2d21
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Mon Sep 25 18:25:29 2017 +0200
Bug 1402442 - Properly remove display: contents pseudo-frames. r=mats, a=ritu
MozReview-Commit-ID: 4pjVLQfv3YR
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
--HG--
extra : source : faa69ac1c14b79838cc0aac842b470a110542ebd
extra : amend_source : 3a76e0123bf3f7d10295000cc44fd8bdddf700df
---
layout/base/nsCSSFrameConstructor.cpp | 26 +++++++++++++++-------
testing/web-platform/meta/MANIFEST.json | 25 +++++++++++++++++++++
...dynamic-generated-content-fieldset-001.html.ini | 4 ++++
...dynamic-generated-content-fieldset-001-ref.html | 16 +++++++++++++
...nts-dynamic-generated-content-fieldset-001.html | 26 ++++++++++++++++++++++
5 files changed, 89 insertions(+), 8 deletions(-)
diff --git layout/base/nsCSSFrameConstructor.cpp layout/base/nsCSSFrameConstructor.cpp
index 99b1211b399b..4fce3fb381a7 100644
--- layout/base/nsCSSFrameConstructor.cpp
+++ layout/base/nsCSSFrameConstructor.cpp
@@ -1698,6 +1698,17 @@ nsCSSFrameConstructor::NotifyDestroyingFrame(nsIFrame* aFrame)
nsFrameManager::NotifyDestroyingFrame(aFrame);
}
+static bool
+HasGeneratedContent(const nsIContent* aChild)
+{
+ if (!aChild->MayHaveAnonymousChildren()) {
+ return false;
+ }
+
+ return nsLayoutUtils::GetBeforeFrame(aChild) ||
+ nsLayoutUtils::GetAfterFrame(aChild);
+}
+
struct nsGenConInitializer {
nsAutoPtr<nsGenConNode> mNode;
nsGenConList* mList;
@@ -8642,16 +8653,15 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aCo
MOZ_ASSERT(!childFrame || !GetDisplayContentsStyleFor(aChild),
"display:contents nodes shouldn't have a frame");
if (!childFrame && GetDisplayContentsStyleFor(aChild)) {
- nsIContent* ancestor = aContainer;
- MOZ_ASSERT(ancestor, "display: contents on the root?");
- while (!ancestor->GetPrimaryFrame()) {
- // FIXME(emilio): Should this use the flattened tree parent instead?
- ancestor = ancestor->GetParent();
- MOZ_ASSERT(ancestor, "we can't have a display: contents subtree root!");
- }
+ if (HasGeneratedContent(aChild)) {
+ nsIContent* ancestor = aContainer;
+ MOZ_ASSERT(ancestor, "display: contents on the root?");
+ while (!ancestor->GetPrimaryFrame()) {
+ // FIXME(emilio): Should this use the flattened tree parent instead?
+ ancestor = ancestor->GetParent();
+ MOZ_ASSERT(ancestor, "we can't have a display: contents subtree root!");
+ }
- nsIFrame* ancestorFrame = ancestor->GetPrimaryFrame();
- if (ancestorFrame->GetProperty(nsIFrame::GenConProperty())) {
*aDidReconstruct = true;
LAYOUT_PHASE_TEMP_EXIT();
diff --git testing/web-platform/meta/MANIFEST.json testing/web-platform/meta/MANIFEST.json
index 5f05321c5a70..8aed4a4b5078 100644
--- testing/web-platform/meta/MANIFEST.json
+++ testing/web-platform/meta/MANIFEST.json
@@ -102975,6 +102975,18 @@
{}
]
],
+ "css/css-display-3/display-contents-dynamic-generated-content-fieldset-001.html": [
+ [
+ "/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001.html",
+ [
+ [
+ "/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001-ref.html",
+ "=="
+ ]
+ ],
+ {}
+ ]
+ ],
"css/css-display-3/display-contents-dynamic-inline-flex-001-inline.html": [
[
"/css/css-display-3/display-contents-dynamic-inline-flex-001-inline.html",
@@ -227658,6 +227670,11 @@
{}
]
],
+ "css/css-display-3/display-contents-dynamic-generated-content-fieldset-001-ref.html": [
+ [
+ {}
+ ]
+ ],
"css/css-display-3/display-contents-flex-001-ref.html": [
[
{}
@@ -502880,6 +502897,14 @@
"a2d7c9368ed8c01ca06c36646666270e85aee070",
"reftest"
],
+ "css/css-display-3/display-contents-dynamic-generated-content-fieldset-001-ref.html": [
+ "30ec5c8ddacfbfef8434c37ca7a0a766f2bbc89a",
+ "support"
+ ],
+ "css/css-display-3/display-contents-dynamic-generated-content-fieldset-001.html": [
+ "984bebb3c3b8661aedef4a229848dfa818bb1f4a",
+ "reftest"
+ ],
"css/css-display-3/display-contents-dynamic-inline-flex-001-inline.html": [
"40fb07e8ada1530e6835ff2d4e49c5571ffb0baa",
"reftest"
diff --git testing/web-platform/meta/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001.html.ini testing/web-platform/meta/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001.html.ini
new file mode 100644
index 000000000000..63c7442a2362
--- /dev/null
+++ testing/web-platform/meta/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001.html.ini
@@ -0,0 +1,4 @@
+[display-contents-dynamic-generated-content-fieldset-001.html]
+ type: reftest
+ expected:
+ if not stylo: FAIL
diff --git testing/web-platform/tests/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001-ref.html testing/web-platform/tests/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001-ref.html
new file mode 100644
index 000000000000..651bc19b83e9
--- /dev/null
+++ testing/web-platform/tests/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001-ref.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Reftest Reference</title>
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<style>
+div {
+ display: contents;
+ border: 10px solid red;
+}
+</style>
+<p>
+ Test passes if there is no red text and no red border.
+</p>
+<fieldset>
+ <div></div>
+</fieldset>
diff --git testing/web-platform/tests/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001.html testing/web-platform/tests/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001.html
new file mode 100644
index 000000000000..8f8a0ba47971
--- /dev/null
+++ testing/web-platform/tests/css/css-display-3/display-contents-dynamic-generated-content-fieldset-001.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Test: Dynamic changes to display: contents generated content in fieldsets.</title>
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<link rel="help" href="https://drafts.csswg.org/css-display-3/#valdef-display-contents">
+<link rel="match" href="display-contents-dynamic-generated-content-fieldset-001-ref.html">
+<style>
+.after::after {
+ content: "FAIL";
+ color: red;
+}
+div {
+ display: contents;
+ border: 10px solid red;
+}
+</style>
+<p>
+ Test passes if there is no red text and no red border.
+</p>
+<fieldset>
+ <div class="after"></div>
+</fieldset>
+<script>
+document.body.offsetHeight;
+document.querySelector("div").classList.remove("after");
+</script>

View file

@ -0,0 +1,51 @@
commit 6149574dc0f9
Author: Gabriele Svelto <gsvelto@mozilla.com>
Date: Tue Sep 26 09:35:03 2017 +0200
Bug 1402966 - Search for libcurl in more paths to support various *BSDs. r=Dexter, a=sledru
MozReview-Commit-ID: J4ykuSVEa0y
--HG--
extra : source : 4741b93cfdf29517ff8eae863825fdc2ab5bd7bd
---
.../telemetry/pingsender/pingsender_unix_common.cpp | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git toolkit/components/telemetry/pingsender/pingsender_unix_common.cpp toolkit/components/telemetry/pingsender/pingsender_unix_common.cpp
index ae20f4114193..7817e93e3d1f 100644
--- toolkit/components/telemetry/pingsender/pingsender_unix_common.cpp
+++ toolkit/components/telemetry/pingsender/pingsender_unix_common.cpp
@@ -88,10 +88,19 @@ CurlWrapper::Init()
"/usr/lib/i386-linux-gnu", // Debian 32-bit x86
"/usr/lib/x86_64-linux-gnu", // Debian 64-bit x86
#endif // XP_LINUX
+#if !defined(XP_MACOSX) && !defined(XP_LINUX) // Various BSDs
+ "/usr/local/lib", // FreeBSD, OpenBSD
+ "/usr/pkg/lib", // NetBSD
+#endif // !defined(XP_MACOSX) && !defined(XP_LINUX)
};
const char* libcurlNames[] = {
-#ifdef XP_LINUX
+#if defined(XP_MACOSX)
+ // macOS
+ "libcurl.dylib",
+ "libcurl.4.dylib",
+ "libcurl.3.dylib",
+#else // Linux, *BSD, ...
"libcurl.so",
"libcurl.so.4",
// Debian gives libcurl a different name when it is built against GnuTLS
@@ -100,11 +109,6 @@ CurlWrapper::Init()
// Older versions in case we find nothing better
"libcurl.so.3",
"libcurl-gnutls.so.3", // See above for Debian
-#elif defined(XP_MACOSX)
- // macOS
- "libcurl.dylib",
- "libcurl.4.dylib",
- "libcurl.3.dylib",
#endif
};

View file

@ -0,0 +1,299 @@
commit 5647dde295f4
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Wed Oct 4 11:36:20 2017 +0200
Bug 1404324 - Use the placeholder state to remove out-of-flows that aren't real descendants of the destruction root. r=bz, a=ritu
Using the style of the frame can mess things up when we reparent them due to
::first-line before removing them.
MozReview-Commit-ID: 3Dt0wF2XRAH
--HG--
extra : source : 5a034cdb513208dd19adf0babf30ee734968a78f
extra : histedit_source : 4cd958939c5a76e013695e931d721454268a0dc7%2C96bdeda302c567493c7db5105f306595d25332e1
---
layout/base/nsCSSFrameConstructor.cpp | 8 +++---
layout/base/nsLayoutUtils.cpp | 46 +++------------------------------
layout/generic/nsPlaceholderFrame.cpp | 27 ++++++++++++++++---
layout/generic/nsPlaceholderFrame.h | 21 ++++++++-------
layout/style/crashtests/1404324-1.html | 12 +++++++++
layout/style/crashtests/1404324-2.html | 10 +++++++
layout/style/crashtests/1404324-3.html | 14 ++++++++++
layout/style/crashtests/crashtests.list | 3 +++
8 files changed, 83 insertions(+), 58 deletions(-)
diff --git layout/base/nsCSSFrameConstructor.cpp layout/base/nsCSSFrameConstructor.cpp
index c840416fd6a7..99b1211b399b 100644
--- layout/base/nsCSSFrameConstructor.cpp
+++ layout/base/nsCSSFrameConstructor.cpp
@@ -1260,8 +1260,10 @@ nsFrameConstructorState::GetOutOfFlowFrameItems(nsIFrame* aNewFrame,
if (disp->mTopLayer != NS_STYLE_TOP_LAYER_NONE) {
*aPlaceholderType = PLACEHOLDER_FOR_TOPLAYER;
if (disp->mPosition == NS_STYLE_POSITION_FIXED) {
+ *aPlaceholderType |= PLACEHOLDER_FOR_FIXEDPOS;
return &mTopLayerFixedItems;
}
+ *aPlaceholderType |= PLACEHOLDER_FOR_ABSPOS;
return &mTopLayerAbsoluteItems;
}
if (disp->mPosition == NS_STYLE_POSITION_ABSOLUTE) {
@@ -1303,11 +1305,11 @@ nsFrameConstructorState::ConstructBackdropFrameFor(nsIContent* aContent,
nsAbsoluteItems* frameItems = GetOutOfFlowFrameItems(backdropFrame,
true, true, false,
&placeholderType);
- MOZ_ASSERT(placeholderType == PLACEHOLDER_FOR_TOPLAYER);
+ MOZ_ASSERT(placeholderType & PLACEHOLDER_FOR_TOPLAYER);
nsIFrame* placeholder = nsCSSFrameConstructor::
CreatePlaceholderFrameFor(mPresShell, aContent, backdropFrame,
- frame, nullptr, PLACEHOLDER_FOR_TOPLAYER);
+ frame, nullptr, placeholderType);
nsFrameList temp(placeholder, placeholder);
frame->SetInitialChildList(nsIFrame::kBackdropList, temp);
@@ -1361,7 +1363,7 @@ nsFrameConstructorState::AddChild(nsIFrame* aNewFrame,
// Add the placeholder frame to the flow
aFrameItems.AddChild(placeholderFrame);
- if (placeholderType == PLACEHOLDER_FOR_TOPLAYER) {
+ if (placeholderType & PLACEHOLDER_FOR_TOPLAYER) {
ConstructBackdropFrameFor(aContent, aNewFrame);
}
}
diff --git layout/base/nsLayoutUtils.cpp layout/base/nsLayoutUtils.cpp
index cb010c0a1a80..94ead9830c25 100644
--- layout/base/nsLayoutUtils.cpp
+++ layout/base/nsLayoutUtils.cpp
@@ -1525,6 +1525,8 @@ nsLayoutUtils::GetChildListNameFor(nsIFrame* aChildFrame)
{
nsIFrame::ChildListID id = nsIFrame::kPrincipalList;
+ MOZ_DIAGNOSTIC_ASSERT(!(aChildFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW));
+
if (aChildFrame->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER) {
nsIFrame* pif = aChildFrame->GetPrevInFlow();
if (pif->GetParent() == aChildFrame->GetParent()) {
@@ -1533,35 +1535,6 @@ nsLayoutUtils::GetChildListNameFor(nsIFrame* aChildFrame)
else {
id = nsIFrame::kOverflowContainersList;
}
- }
- // See if the frame is moved out of the flow
- else if (aChildFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
- // Look at the style information to tell
- const nsStyleDisplay* disp = aChildFrame->StyleDisplay();
-
- if (NS_STYLE_POSITION_ABSOLUTE == disp->mPosition) {
- id = nsIFrame::kAbsoluteList;
- } else if (NS_STYLE_POSITION_FIXED == disp->mPosition) {
- if (nsLayoutUtils::IsReallyFixedPos(aChildFrame)) {
- id = nsIFrame::kFixedList;
- } else {
- id = nsIFrame::kAbsoluteList;
- }
-#ifdef MOZ_XUL
- } else if (StyleDisplay::MozPopup == disp->mDisplay) {
- // Out-of-flows that are DISPLAY_POPUP must be kids of the root popup set
-#ifdef DEBUG
- nsIFrame* parent = aChildFrame->GetParent();
- NS_ASSERTION(parent && parent->IsPopupSetFrame(), "Unexpected parent");
-#endif // DEBUG
-
- id = nsIFrame::kPopupList;
-#endif // MOZ_XUL
- } else {
- NS_ASSERTION(aChildFrame->IsFloating(), "not a floated frame");
- id = nsIFrame::kFloatList;
- }
-
} else {
LayoutFrameType childType = aChildFrame->Type();
if (LayoutFrameType::MenuPopup == childType) {
@@ -1596,19 +1569,8 @@ nsLayoutUtils::GetChildListNameFor(nsIFrame* aChildFrame)
nsContainerFrame* parent = aChildFrame->GetParent();
bool found = parent->GetChildList(id).ContainsFrame(aChildFrame);
if (!found) {
- if (!(aChildFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
- found = parent->GetChildList(nsIFrame::kOverflowList)
- .ContainsFrame(aChildFrame);
- }
- else if (aChildFrame->IsFloating()) {
- found = parent->GetChildList(nsIFrame::kOverflowOutOfFlowList)
- .ContainsFrame(aChildFrame);
- if (!found) {
- found = parent->GetChildList(nsIFrame::kPushedFloatsList)
- .ContainsFrame(aChildFrame);
- }
- }
- // else it's positioned and should have been on the 'id' child list.
+ found = parent->GetChildList(nsIFrame::kOverflowList)
+ .ContainsFrame(aChildFrame);
NS_POSTCONDITION(found, "not in child list");
}
#endif
diff --git layout/generic/nsPlaceholderFrame.cpp layout/generic/nsPlaceholderFrame.cpp
index 7da2582ae526..4b2e1bf84b36 100644
--- layout/generic/nsPlaceholderFrame.cpp
+++ layout/generic/nsPlaceholderFrame.cpp
@@ -25,9 +25,9 @@ using namespace mozilla::gfx;
nsIFrame*
NS_NewPlaceholderFrame(nsIPresShell* aPresShell, nsStyleContext* aContext,
- nsFrameState aTypeBit)
+ nsFrameState aTypeBits)
{
- return new (aPresShell) nsPlaceholderFrame(aContext, aTypeBit);
+ return new (aPresShell) nsPlaceholderFrame(aContext, aTypeBits);
}
NS_IMPL_FRAMEARENA_HELPERS(nsPlaceholderFrame)
@@ -155,6 +155,26 @@ nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
+static nsIFrame::ChildListID
+ChildListIDForOutOfFlow(nsFrameState aPlaceholderState, nsIFrame* aChild)
+{
+ if (aPlaceholderState & PLACEHOLDER_FOR_FLOAT) {
+ return nsIFrame::kFloatList;
+ }
+ if (aPlaceholderState & PLACEHOLDER_FOR_POPUP) {
+ return nsIFrame::kPopupList;
+ }
+ if (aPlaceholderState & PLACEHOLDER_FOR_FIXEDPOS) {
+ return nsLayoutUtils::IsReallyFixedPos(aChild)
+ ? nsIFrame::kFixedList : nsIFrame::kAbsoluteList;
+ }
+ if (aPlaceholderState & PLACEHOLDER_FOR_ABSPOS) {
+ return nsIFrame::kAbsoluteList;
+ }
+ MOZ_DIAGNOSTIC_ASSERT(false, "unknown list");
+ return nsIFrame::kFloatList;
+}
+
void
nsPlaceholderFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
@@ -162,12 +182,13 @@ nsPlaceholderFrame::DestroyFrom(nsIFrame* aDestructRoot)
if (oof) {
mOutOfFlowFrame = nullptr;
oof->DeleteProperty(nsIFrame::PlaceholderFrameProperty());
+
// If aDestructRoot is not an ancestor of the out-of-flow frame,
// then call RemoveFrame on it here.
// Also destroy it here if it's a popup frame. (Bug 96291)
if ((GetStateBits() & PLACEHOLDER_FOR_POPUP) ||
!nsLayoutUtils::IsProperAncestorFrame(aDestructRoot, oof)) {
- ChildListID listId = nsLayoutUtils::GetChildListNameFor(oof);
+ ChildListID listId = ChildListIDForOutOfFlow(GetStateBits(), oof);
nsFrameManager* fm = PresContext()->GetPresShell()->FrameManager();
fm->RemoveFrame(listId, oof);
}
diff --git layout/generic/nsPlaceholderFrame.h layout/generic/nsPlaceholderFrame.h
index e270c76cdd31..2af9b4ccbc93 100644
--- layout/generic/nsPlaceholderFrame.h
+++ layout/generic/nsPlaceholderFrame.h
@@ -40,7 +40,7 @@
nsIFrame* NS_NewPlaceholderFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext,
- nsFrameState aTypeBit);
+ nsFrameState aTypeBits);
#define PLACEHOLDER_TYPE_MASK (PLACEHOLDER_FOR_FLOAT | \
PLACEHOLDER_FOR_ABSPOS | \
@@ -65,18 +65,19 @@ public:
*/
friend nsIFrame* NS_NewPlaceholderFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext,
- nsFrameState aTypeBit);
- nsPlaceholderFrame(nsStyleContext* aContext, nsFrameState aTypeBit)
+ nsFrameState aTypeBits);
+ nsPlaceholderFrame(nsStyleContext* aContext, nsFrameState aTypeBits)
: nsFrame(aContext, kClassID)
, mOutOfFlowFrame(nullptr)
{
- NS_PRECONDITION(aTypeBit == PLACEHOLDER_FOR_FLOAT ||
- aTypeBit == PLACEHOLDER_FOR_ABSPOS ||
- aTypeBit == PLACEHOLDER_FOR_FIXEDPOS ||
- aTypeBit == PLACEHOLDER_FOR_POPUP ||
- aTypeBit == PLACEHOLDER_FOR_TOPLAYER,
- "Unexpected type bit");
- AddStateBits(aTypeBit);
+ MOZ_ASSERT(aTypeBits == PLACEHOLDER_FOR_FLOAT ||
+ aTypeBits == PLACEHOLDER_FOR_ABSPOS ||
+ aTypeBits == PLACEHOLDER_FOR_FIXEDPOS ||
+ aTypeBits == PLACEHOLDER_FOR_POPUP ||
+ aTypeBits == (PLACEHOLDER_FOR_TOPLAYER | PLACEHOLDER_FOR_ABSPOS) ||
+ aTypeBits == (PLACEHOLDER_FOR_TOPLAYER | PLACEHOLDER_FOR_FIXEDPOS),
+ "Unexpected type bit");
+ AddStateBits(aTypeBits);
}
// Get/Set the associated out of flow frame
diff --git layout/style/crashtests/1404324-1.html layout/style/crashtests/1404324-1.html
new file mode 100644
index 000000000000..574a5437cb1b
--- /dev/null
+++ layout/style/crashtests/1404324-1.html
@@ -0,0 +1,12 @@
+<style></style>
+<script>
+document.documentElement.className = 'c1'
+o1 = document.createElement('form')
+o2 = document.createElement('e')
+o1.className = 'c2'
+document.documentElement.appendChild(o1)
+document.documentElement.appendChild(o2)
+document.styleSheets[0].insertRule('.c1:first-line, .c2 { position:fixed', 0);
+document.documentElement.getBoundingClientRect()
+document.styleSheets[0].cssRules[0].style.position = 'relative'
+</script>
diff --git layout/style/crashtests/1404324-2.html layout/style/crashtests/1404324-2.html
new file mode 100644
index 000000000000..797347d5c058
--- /dev/null
+++ layout/style/crashtests/1404324-2.html
@@ -0,0 +1,10 @@
+<style>
+ del, *::first-line {
+ position: absolute;
+ }
+</style>
+<del></del>
+<script>
+ document.documentElement.offsetTop;
+ document.styleSheets[0].cssRules[0].style.position = 'sticky'
+</script>
diff --git layout/style/crashtests/1404324-3.html layout/style/crashtests/1404324-3.html
new file mode 100644
index 000000000000..3b06f12a2bf6
--- /dev/null
+++ layout/style/crashtests/1404324-3.html
@@ -0,0 +1,14 @@
+<style>
+del {
+ position: absolute;
+}
+
+body::first-line {
+ color: red;
+}
+</style>
+<del></del>
+<script>
+ document.documentElement.offsetTop;
+ document.styleSheets[0].cssRules[0].style.position = 'sticky'
+</script>
diff --git layout/style/crashtests/crashtests.list layout/style/crashtests/crashtests.list
index be9a46c52bfa..5eaba6935ee2 100644
--- layout/style/crashtests/crashtests.list
+++ layout/style/crashtests/crashtests.list
@@ -238,3 +238,6 @@ load 1403615.html
load 1387481-1.html
load 1387499.html
load 1391577.html
+asserts-if(stylo,1) load 1404324-1.html # bug 1405605
+load 1404324-2.html
+load 1404324-3.html

View file

@ -0,0 +1,170 @@
commit 2c8bf0ecbc5d
Author: Andrea Marchesini <amarchesini@mozilla.com>
Date: Wed Oct 4 14:18:19 2017 +0200
Bug 1404910 - WebSocket should consider the corrent top-level window principal. r=smaug, a=ritu
--HG--
extra : source : c543c0a50db700883b57c052710c97b5ef731e1f
---
dom/base/WebSocket.cpp | 15 ++++---
dom/base/test/iframe_webSocket_sandbox.html | 65 +++++++++++++++++++++++++++++
dom/base/test/mochitest.ini | 3 ++
dom/base/test/test_webSocket_sandbox.html | 34 +++++++++++++++
4 files changed, 109 insertions(+), 8 deletions(-)
diff --git dom/base/WebSocket.cpp dom/base/WebSocket.cpp
index dc2c1c70107b..982c67cd2abd 100644
--- dom/base/WebSocket.cpp
+++ dom/base/WebSocket.cpp
@@ -1666,18 +1666,17 @@ WebSocketImpl::Init(JSContext* aCx,
nsCOMPtr<nsPIDOMWindowInner> innerWindow;
while (true) {
- if (principal) {
- bool isNullPrincipal = true;
- isNullPrincipal = principal->GetIsNullPrincipal();
- if (isNullPrincipal || nsContentUtils::IsSystemPrincipal(principal)) {
- break;
- }
+ if (principal && !principal->GetIsNullPrincipal()) {
+ break;
}
if (!innerWindow) {
innerWindow = do_QueryInterface(globalObject);
- if (NS_WARN_IF(!innerWindow)) {
- return NS_ERROR_DOM_SECURITY_ERR;
+ if (!innerWindow) {
+ // If we are in a XPConnect sandbox or in a JS component,
+ // innerWindow will be null. There is nothing on top of this to be
+ // considered.
+ break;
}
}
diff --git dom/base/test/iframe_webSocket_sandbox.html dom/base/test/iframe_webSocket_sandbox.html
new file mode 100644
index 000000000000..d889a79b05da
--- /dev/null
+++ dom/base/test/iframe_webSocket_sandbox.html
@@ -0,0 +1,65 @@
+<html><body>
+<iframe id="frame" sandbox="allow-scripts allow-popups"></iframe>
+<script type="application/javascript;version=1.8">
+onmessage = function(e) {
+ parent.postMessage(e.data, '*');
+}
+
+var ifr = document.getElementById('frame');
+
+if (location.search == '?nested') {
+ var url = new URL(location);
+ url.search = "";
+ ifr.src = url.href;
+} else if (location.search == '?popup') {
+ var url = new URL(location);
+ url.search = "?opener";
+
+ ifr.srcdoc = "<html><script>" +
+ "window.open('" + url.href + "', 'foobar');" +
+ "onmessage = function(e) { " +
+ " parent.postMessage(e.data, '*'); " +
+ "}" +
+ "</scr" + "ipt></html>";
+} else if (location.search == '?opener') {
+ try{
+ var socket = new WebSocket('ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic');
+ socket.onerror = function(e) {
+ opener.postMessage('WS onerror', '*');
+ close();
+ };
+ socket.onopen = function(event) {
+ opener.postMessage('WS onopen', '*');
+ close();
+ };
+ } catch(e) {
+ if (e.name == 'SecurityError') {
+ opener.postMessage('WS Throws!', '*');
+ } else {
+ opener.postMessage('WS Throws something else!', '*');
+ }
+ close();
+ }
+} else {
+ ifr.srcdoc = `
+ <html><script>
+ try{
+ var socket = new WebSocket('ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic');
+ socket.onerror = function(e) {
+ parent.postMessage('WS onerror', '*');
+ };
+ socket.onopen = function(event) {
+ parent.postMessage('WS onopen', '*');
+ };
+ } catch(e) {
+ if (e.name == 'SecurityError') {
+ parent.postMessage('WS Throws!', '*');
+ } else {
+ parent.postMessage('WS Throws something else!', '*');
+ }
+ }
+ </scr`+`ipt>
+ </html>`;
+}
+</script>
+</body></html>
diff --git dom/base/test/mochitest.ini dom/base/test/mochitest.ini
index 670dd5ae0a06..5d59fe1ea7b8 100644
--- dom/base/test/mochitest.ini
+++ dom/base/test/mochitest.ini
@@ -804,6 +804,9 @@ skip-if = toolkit == 'android'
skip-if = toolkit == 'android'
[test_websocket_permessage_deflate.html]
skip-if = toolkit == 'android'
+[test_webSocket_sandbox.html]
+skip-if = toolkit == 'android'
+support-files = iframe_webSocket_sandbox.html
[test_websocket1.html]
skip-if = toolkit == 'android'
[test_websocket2.html]
diff --git dom/base/test/test_webSocket_sandbox.html dom/base/test/test_webSocket_sandbox.html
new file mode 100644
index 000000000000..b343fa784f39
--- /dev/null
+++ dom/base/test/test_webSocket_sandbox.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1252751</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div id="container"></div>
+<iframe id="frame"></iframe>
+<script type="application/javascript;version=1.8">
+var urls = [ "https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html",
+ "https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html?nested",
+ "https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html?popup" ];
+
+onmessage = function(e) {
+ is(e.data, "WS Throws!", "ws://URI cannot be used by a https iframe");
+ runTest();
+}
+
+function runTest() {
+ if (!urls.length) {
+ SimpleTest.finish();
+ return;
+ }
+
+ document.getElementById("frame").src = urls.shift();
+}
+
+SimpleTest.waitForExplicitFinish();
+runTest();
+</script>
+</body>
+</html>

View file

@ -0,0 +1,34 @@
commit 53a3958e0a76
Author: Valentin Gosu <valentin.gosu@gmail.com>
Date: Sat Oct 28 00:15:01 2017 +0200
Bug 1408990 - Only add the entry to the performance object if the loading document's principal is the same as the triggering principal. r=bz, r=dragana, a=lizzard
MozReview-Commit-ID: 7o8XKHioP1p
--HG--
extra : rebase_source : 33d4044b4901cee460cc69a0bae1fe0e84dab2aa
extra : source : ff9e841ff8544053f184d2e425500d5dd13ee14d
---
netwerk/protocol/http/HttpBaseChannel.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git netwerk/protocol/http/HttpBaseChannel.cpp netwerk/protocol/http/HttpBaseChannel.cpp
index 8a5c4d8d9f45..16e59241e2fc 100644
--- netwerk/protocol/http/HttpBaseChannel.cpp
+++ netwerk/protocol/http/HttpBaseChannel.cpp
@@ -4088,6 +4088,14 @@ HttpBaseChannel::GetPerformance()
return nullptr;
}
+ // We only add to the document's performance object if it has the same
+ // principal as the one triggering the load. This is to prevent navigations
+ // triggered _by_ the iframe from showing up in the parent document's
+ // performance entries if they have different origins.
+ if (!mLoadInfo->TriggeringPrincipal()->Equals(loadingDocument->NodePrincipal())) {
+ return nullptr;
+ }
+
nsCOMPtr<nsPIDOMWindowInner> innerWindow = loadingDocument->GetInnerWindow();
if (!innerWindow) {
return nullptr;

View file

@ -0,0 +1,27 @@
Bug 1409680 - Extend --disable-debug-symbols to Rust code.
This reduces disk I/O and memory usage during build that already lacks
debugging symbols from C++ code, allowing to use more jobs on 32bit hosts.
--disable-debug-symbols build on FreeBSD 10.3 i386 (8 cores) host:
Max RSS before: libxul - 612 Mb, libgkrust - 1908 Mb
Max RSS after: libxul - 444 Mb, libgkrust - 1471 Mb
Binary before: libxul - 203 Mb, libgkrust - 732 Mb
Binary after: libxul - 123 Mb, libgkrust - 301 Mb
--- config/rules.mk.orig 2017-09-14 20:15:53 UTC
+++ config/rules.mk
@@ -906,11 +906,13 @@ ifdef MOZ_USING_SCCACHE
sccache_wrap := RUSTC_WRAPPER='$(CCACHE)'
endif
+ifdef MOZ_DEBUG_SYMBOLS
# XXX hack to work around dsymutil failing on cross-OSX builds (bug 1380381)
ifeq ($(HOST_OS_ARCH)-$(OS_ARCH),Linux-Darwin)
default_rustflags += -C debuginfo=1
else
default_rustflags += -C debuginfo=2
+endif
endif
# We use the + prefix to pass down the jobserver fds to cargo, but we

View file

@ -0,0 +1,83 @@
diff --git dom/media/flac/FlacDecoder.cpp dom/media/flac/FlacDecoder.cpp
index 53fc3c9937f7..b23771ab80fa 100644
--- dom/media/flac/FlacDecoder.cpp
+++ dom/media/flac/FlacDecoder.cpp
@@ -7,6 +7,7 @@
#include "FlacDecoder.h"
#include "MediaContainerType.h"
#include "MediaPrefs.h"
+#include "PDMFactory.h"
namespace mozilla {
@@ -15,6 +16,10 @@ FlacDecoder::IsEnabled()
{
#ifdef MOZ_FFVPX
return MediaPrefs::FlacEnabled();
+#elif defined(MOZ_FFMPEG)
+ RefPtr<PDMFactory> platform = new PDMFactory();
+ return MediaPrefs::FlacEnabled() && platform->SupportsMimeType(NS_LITERAL_CSTRING("audio/flac"),
+ /* DecoderDoctorDiagnostics* */ nullptr);
#else
// Until bug 1295886 is fixed.
return false;
diff --git media/ffvpx/README_MOZILLA media/ffvpx/README_MOZILLA
index 5d3a6037efe0..43144b726a92 100644
--- media/ffvpx/README_MOZILLA
+++ media/ffvpx/README_MOZILLA
@@ -17,14 +17,6 @@ configuration files were generated as follow using the configure script:
config*:
replace: /HAVE_(MALLOC_H|ARC4RANDOM|LOCALTIME_R|MEMALIGN|POSIX_MEMALIGN)/d
-config_darwin32.h:
-add to configure command: --disable-asm --disable-yasm --cc='clang -m32'
-
-config_unix32.h:
-add to configure command: --disable-asm --disable-yasm --cc='clang -m32'
-replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0/ and s/HAVE_MEMALIGN 1/HAVE_MEMALIGN 0/ and s/HAVE_POSIX_MEMALIGN 1/HAVE_POSIX_MEMALIGN 0/
-
-
config_unix64.h/config_unix64.asm:
replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0
diff --git media/ffvpx/config.h media/ffvpx/config.h
index dab01e05cd65..26ebe529bd98 100644
--- media/ffvpx/config.h
+++ media/ffvpx/config.h
@@ -27,17 +27,9 @@
#define HAVE_LIBC_MSVCRT 0
#endif
#elif defined(XP_DARWIN)
-#if defined(HAVE_64BIT_BUILD)
#include "config_darwin64.h"
-#else
-#include "config_darwin32.h"
-#endif
#elif defined(XP_UNIX)
-#if defined(HAVE_64BIT_BUILD)
#include "config_unix64.h"
-#else
-#include "config_unix32.h"
-#endif
#endif
#include "config_common.h"
#endif // MOZ_FFVPX_CONFIG_H
diff --git old-configure.in old-configure.in
index b8ce71278548..410be683c2f6 100644
--- old-configure.in
+++ old-configure.in
@@ -3279,11 +3279,11 @@ dnl = FFmpeg's ffvpx configuration
dnl ========================================================
MOZ_FFVPX=
-case "$CPU_ARCH" in
- x86)
+case "$OS_ARCH:$CPU_ARCH" in
+ WINNT:x86)
MOZ_FFVPX=1
;;
- x86_64)
+ *:x86_64)
MOZ_FFVPX=1
;;
esac

View file

@ -0,0 +1,108 @@
Always build libyuv x86 optimizations with Clang.
diff --git media/libyuv/libyuv/include/libyuv/compare_row.h media/libyuv/libyuv/include/libyuv/compare_row.h
index 7abc2d4aef8f..542df1ef504b 100644
--- media/libyuv/libyuv/include/libyuv/compare_row.h
+++ media/libyuv/libyuv/include/libyuv/compare_row.h
@@ -19,7 +19,7 @@ extern "C" {
#endif
#if defined(__pnacl__) || defined(__CLR_VER) || \
- (defined(__i386__) && !defined(__SSE2__))
+ (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
#define LIBYUV_DISABLE_X86
#endif
// MemorySanitizer does not support assembly code yet. http://crbug.com/344505
diff --git media/libyuv/libyuv/include/libyuv/planar_functions.h media/libyuv/libyuv/include/libyuv/planar_functions.h
index 040839c211b1..5f6a8034d209 100644
--- media/libyuv/libyuv/include/libyuv/planar_functions.h
+++ media/libyuv/libyuv/include/libyuv/planar_functions.h
@@ -720,7 +720,7 @@ int I420Interpolate(const uint8* src0_y,
int interpolation);
#if defined(__pnacl__) || defined(__CLR_VER) || \
- (defined(__i386__) && !defined(__SSE2__))
+ (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
#define LIBYUV_DISABLE_X86
#endif
// MemorySanitizer does not support assembly code yet. http://crbug.com/344505
diff --git media/libyuv/libyuv/include/libyuv/rotate_row.h media/libyuv/libyuv/include/libyuv/rotate_row.h
index 2c51584eee8b..8e60a713c4cf 100644
--- media/libyuv/libyuv/include/libyuv/rotate_row.h
+++ media/libyuv/libyuv/include/libyuv/rotate_row.h
@@ -19,7 +19,7 @@ extern "C" {
#endif
#if defined(__pnacl__) || defined(__CLR_VER) || \
- (defined(__i386__) && !defined(__SSE2__))
+ (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
#define LIBYUV_DISABLE_X86
#endif
// MemorySanitizer does not support assembly code yet. http://crbug.com/344505
diff --git media/libyuv/libyuv/include/libyuv/row.h media/libyuv/libyuv/include/libyuv/row.h
index f74bd9f7d17a..b8f674ba124d 100644
--- media/libyuv/libyuv/include/libyuv/row.h
+++ media/libyuv/libyuv/include/libyuv/row.h
@@ -31,7 +31,7 @@ extern "C" {
var = 0
#if defined(__pnacl__) || defined(__CLR_VER) || \
- (defined(__i386__) && !defined(__SSE2__))
+ (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
#define LIBYUV_DISABLE_X86
#endif
// MemorySanitizer does not support assembly code yet. http://crbug.com/344505
diff --git media/libyuv/libyuv/include/libyuv/scale_row.h media/libyuv/libyuv/include/libyuv/scale_row.h
index edb46cc8c647..2b2c7a0700ef 100644
--- media/libyuv/libyuv/include/libyuv/scale_row.h
+++ media/libyuv/libyuv/include/libyuv/scale_row.h
@@ -20,7 +20,7 @@ extern "C" {
#endif
#if defined(__pnacl__) || defined(__CLR_VER) || \
- (defined(__i386__) && !defined(__SSE2__))
+ (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
#define LIBYUV_DISABLE_X86
#endif
// MemorySanitizer does not support assembly code yet. http://crbug.com/344505
diff --git media/libyuv/libyuv/linux.mk media/libyuv/libyuv/linux.mk
index 923345ae4d12..9e555e303913 100644
--- media/libyuv/libyuv/linux.mk
+++ media/libyuv/libyuv/linux.mk
@@ -80,4 +80,4 @@ cpuid: util/cpuid.c libyuv.a
$(CC) $(CFLAGS) -o $@ util/cpuid.c libyuv.a
clean:
- /bin/rm -f source/*.o *.ii *.s libyuv.a convert cpuid psnr
+ /bin/rm -f source/*.o *.ii *.s libyuv.a yuvconvert cpuid psnr
diff --git media/libyuv/libyuv/source/row_gcc.cc media/libyuv/libyuv/source/row_gcc.cc
index 8735070b619d..9df8c6a627db 100644
--- media/libyuv/libyuv/source/row_gcc.cc
+++ media/libyuv/libyuv/source/row_gcc.cc
@@ -5479,7 +5479,7 @@ void HalfFloatRow_SSE2(const uint16* src, uint16* dst, float scale, int width) {
: "+r"(src), // %0
"+r"(dst), // %1
"+r"(width) // %2
- : "x"(scale * kScaleBias) // %3
+ : "mx"(scale * kScaleBias) // %3
: "memory", "cc",
"xmm2", "xmm3", "xmm4", "xmm5"
);
@@ -5515,7 +5515,7 @@ void HalfFloatRow_AVX2(const uint16* src, uint16* dst, float scale, int width) {
: "+r"(src), // %0
"+r"(dst), // %1
"+r"(width) // %2
- : "x"(scale * kScaleBias) // %3
+ : "mx"(scale * kScaleBias) // %3
: "memory", "cc",
"xmm2", "xmm3", "xmm4", "xmm5"
);
@@ -5548,7 +5548,7 @@ void HalfFloatRow_F16C(const uint16* src, uint16* dst, float scale, int width) {
: "+r"(src), // %0
"+r"(dst), // %1
"+r"(width) // %2
- : "x"(scale) // %3
+ : "mx"(scale) // %3
: "memory", "cc",
"xmm2", "xmm3", "xmm4"
);

View file

@ -0,0 +1,12 @@
Don't build static JS lib to make sure DTrace probes are picked up.
--- js/src/build/moz.build.orig 2017-04-16 18:00:50 UTC
+++ js/src/build/moz.build
@@ -71,7 +71,3 @@ if CONFIG['OS_ARCH'] == 'SunOS':
]
OS_LIBS += CONFIG['REALTIME_LIBS']
-
-NO_EXPAND_LIBS = True
-
-DIST_INSTALL = True

View file

@ -0,0 +1,171 @@
commit 8024d93
Author: Henrik Gulbrandsen <henrik@gulbra.net>
Date: Fri Jan 4 13:49:22 2013 +0100
Bug 826985 - Support more video formats for WebRTC via libv4l2 on Linux.
---
config/system-headers | 1 +
old-configure.in | 7 +++++++
media/webrtc/signaling/test/Makefile.in | 1 +
.../modules/video_capture/linux/device_info_linux.cc | 17 +++++++++++++++++
.../modules/video_capture/linux/video_capture_linux.cc | 16 +++++++++++++++-
.../webrtc/modules/video_capture/video_capture.gypi | 11 +++++++++++
toolkit/library/Makefile.in | 1 +
6 files changed, 52 insertions(+), 1 deletion(-)
diff --git config/system-headers config/system-headers
index 55e4cd1..76567b3 100644
--- config/system-headers
+++ config/system-headers
@@ -624,6 +624,7 @@ libgnome/libgnome.h
libgnomeui/gnome-icon-lookup.h
libgnomeui/gnome-icon-theme.h
libgnomeui/gnome-ui-init.h
+libv4l2.h
limits.h
link.h
#ifdef ANDROID
diff --git old-configure.in configure.in
index 55e4cd1..76567b3 100644
--- old-configure.in
+++ old-configure.in
@@ -5309,6 +5309,9 @@ if test -n "$MOZ_WEBRTC"; then
MOZ_VP8_ENCODER=1
MOZ_VP8_ERROR_CONCEALMENT=1
+ dnl with libv4l2 we can support more cameras
+ PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2)
+
dnl enable once Signaling lands
MOZ_WEBRTC_SIGNALING=1
AC_DEFINE(MOZ_WEBRTC_SIGNALING)
diff --git build/gyp.mozbuild build/gyp.mozbuild
index b483cd1..f1dd1f0 100644
--- build/gyp.mozbuild
+++ build/gyp.mozbuild
@@ -11,6 +11,7 @@ gyp_vars = {
'have_ethtool_cmd_speed_hi': 1 if CONFIG['MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI'] else 0,
'include_alsa_audio': 1 if CONFIG['MOZ_ALSA'] else 0,
'include_pulse_audio': 1 if CONFIG['MOZ_PULSEAUDIO'] else 0,
+ 'use_libv4l2': 1 if CONFIG['MOZ_LIBV4L2_LIBS'] else 0,
# basic stuff for everything
'include_internal_video_render': 0,
'clang_use_chrome_plugins': 0,
diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
index 239a292..bab496c 100644
--- media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
+++ media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc
@@ -25,6 +25,9 @@
#else
#include <linux/videodev2.h>
#endif
+#ifdef HAVE_LIBV4L2
+#include <libv4l2.h>
+#endif
#include "webrtc/system_wrappers/interface/ref_count.h"
#include "webrtc/system_wrappers/interface/trace.h"
@@ -34,6 +37,15 @@
#define BUF_LEN ( 1024 * ( EVENT_SIZE + 16 ) )
#endif
+#ifdef HAVE_LIBV4L2
+#define open v4l2_open
+#define close v4l2_close
+#define dup v4l2_dup
+#define ioctl v4l2_ioctl
+#define mmap v4l2_mmap
+#define munmap v4l2_munmap
+#endif
+
namespace webrtc
{
namespace videocapturemodule
@@ -274,6 +286,11 @@ int32_t DeviceInfoLinux::GetDeviceName(
memset(deviceNameUTF8, 0, deviceNameLength);
memcpy(cameraName, cap.card, sizeof(cap.card));
+ if (cameraName[0] == '\0')
+ {
+ sprintf(cameraName, "Camera at /dev/video%d", deviceNumber);
+ }
+
if (deviceNameLength >= strlen(cameraName))
{
memcpy(deviceNameUTF8, cameraName, strlen(cameraName));
diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc
index 12df1b3..e9863ba 100644
--- media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc
+++ media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc
@@ -25,6 +25,9 @@
#else
#include <linux/videodev2.h>
#endif
+#ifdef HAVE_LIBV4L2
+#include <libv4l2.h>
+#endif
#include <new>
@@ -32,6 +35,15 @@
#include "webrtc/modules/video_capture/linux/video_capture_linux.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
#include "webrtc/system_wrappers/include/trace.h"
+
+#ifdef HAVE_LIBV4L2
+#define open v4l2_open
+#define close v4l2_close
+#define dup v4l2_dup
+#define ioctl v4l2_ioctl
+#define mmap v4l2_mmap
+#define munmap v4l2_munmap
+#endif
namespace webrtc {
namespace videocapturemodule {
diff --git media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi
index d46b5aa..e452223 100644
--- media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi
+++ media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi
@@ -7,6 +7,9 @@
# be found in the AUTHORS file in the root of the source tree.
{
+ 'variables': {
+ 'use_libv4l2%': 0,
+ },
'targets': [
{
'target_name': 'video_capture_module',
@@ -76,6 +76,19 @@
'linux/video_capture_linux.cc',
'linux/video_capture_linux.h',
],
+ 'conditions': [
+ ['use_libv4l2==1', {
+ 'defines': [
+ 'HAVE_LIBV4L2',
+ ],
+ 'cflags_mozilla': [
+ '$(MOZ_LIBV4L2_CFLAGS)',
+ ],
+ 'libraries': [
+ '-lv4l2',
+ ],
+ }],
+ ],
}],
['OS=="mac"', {
'sources': [
diff --git toolkit/library/moz.build toolkit/library/moz.build
index 9c16ffa..1db3794 100644
--- toolkit/library/moz.build
+++ toolkit/library/moz.build
@@ -163,6 +163,7 @@ if CONFIG['OS_ARCH'] == 'Linux' and CONF
]
OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
+OS_LIBS += CONFIG['MOZ_LIBV4L2_LIBS']
OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
OS_LIBS += CONFIG['MOZ_APP_EXTRA_LIBS']

View file

@ -0,0 +1,271 @@
# Allow building against system-wide graphite2/harfbuzz.
diff --git config/Makefile.in config/Makefile.in
index e2e11dc0e27e..a6206bb0ff30 100644
--- config/Makefile.in
+++ config/Makefile.in
@@ -41,6 +41,8 @@ export:: $(export-preqs)
$(PYTHON) -m mozbuild.action.preprocessor $(DEFINES) $(ACDEFINES) \
-DMOZ_TREE_CAIRO=$(MOZ_TREE_CAIRO) \
-DMOZ_TREE_PIXMAN=$(MOZ_TREE_PIXMAN) \
+ -DMOZ_SYSTEM_GRAPHITE2=$(MOZ_SYSTEM_GRAPHITE2) \
+ -DMOZ_SYSTEM_HARFBUZZ=$(MOZ_SYSTEM_HARFBUZZ) \
-DMOZ_SYSTEM_HUNSPELL=$(MOZ_SYSTEM_HUNSPELL) \
-DMOZ_SYSTEM_BZ2=$(MOZ_SYSTEM_BZ2) \
-DMOZ_SYSTEM_ZLIB=$(MOZ_SYSTEM_ZLIB) \
diff --git config/system-headers config/system-headers
index a0c53c651a3e..5ee7f71f9634 100644
--- config/system-headers
+++ config/system-headers
@@ -1269,6 +1269,15 @@ libsn/sn-launcher.h
libsn/sn-monitor.h
libsn/sn-util.h
#endif
+#if MOZ_SYSTEM_GRAPHITE2==1
+graphite2/Font.h
+graphite2/Segment.h
+#endif
+#if MOZ_SYSTEM_HARFBUZZ==1
+harfbuzz/hb-glib.h
+harfbuzz/hb-ot.h
+harfbuzz/hb.h
+#endif
#if MOZ_SYSTEM_HUNSPELL==1
hunspell.hxx
#endif
diff --git dom/base/moz.build dom/base/moz.build
index 8e19020315ae..2fcdbb6f7b42 100644
--- dom/base/moz.build
+++ dom/base/moz.build
@@ -464,6 +464,9 @@ if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
if CONFIG['MOZ_X11']:
CXXFLAGS += CONFIG['TK_CFLAGS']
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
GENERATED_FILES += [
'PropertyUseCounterMap.inc',
'UseCounterList.h',
diff --git gfx/graphite2/moz-gr-update.sh gfx/graphite2/moz-gr-update.sh
index faaab1b17971..04eff5f09882 100644
--- gfx/graphite2/moz-gr-update.sh
+++ gfx/graphite2/moz-gr-update.sh
@@ -1,6 +1,7 @@
#!/bin/bash
# Script used to update the Graphite2 library in the mozilla source tree
+# and bump version for --with-system-graphite2
# This script lives in gfx/graphite2, along with the library source,
# but must be run from the top level of the mozilla-central tree.
@@ -37,12 +38,16 @@ echo "See" $0 "for update procedure." >> gfx/graphite2/README.mozilla
#find gfx/graphite2/ -name "*.cpp" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
#find gfx/graphite2/ -name "*.h" -exec perl -p -i -e "s/<cstdio>/<stdio.h>/;s/Windows.h/windows.h/;" {} \;
+# chase version for --with-system-graphite2
+perl -p -i -e "s/[0-9]+\,[0-9]+\,[0-9]+/$RELEASE/ and tr/./,/ \
+ if /GR2_VERSION_REQUIRE/" old-configure.in
+
# summarize what's been touched
echo Updated to $RELEASE.
echo Here is what changed in the gfx/graphite2 directory:
echo
-hg stat gfx/graphite2
+hg stat old-configure.in gfx/graphite2
echo
echo If gfx/graphite2/src/files.mk has changed, please make corresponding
diff --git gfx/harfbuzz/README-mozilla gfx/harfbuzz/README-mozilla
index 22c76a7df020..a01490bd49ee 100644
--- gfx/harfbuzz/README-mozilla
+++ gfx/harfbuzz/README-mozilla
@@ -19,3 +19,8 @@ the mozilla tree.
If the collection of source files changes, manual updates to moz.build may be
needed, as we don't use the upstream makefiles.
+
+The in-tree copy may be omitted during build by --with-system-harfbuzz.
+Make sure to keep pkg-config version check within toolkit/moz.configure in sync
+with checkout version or increment latest tag by one if it's not based
+on upstream release.
diff --git gfx/moz.build gfx/moz.build
index 771f652e837a..3b358d84e384 100644
--- gfx/moz.build
+++ gfx/moz.build
@@ -10,6 +10,12 @@ with Files('**'):
if CONFIG['MOZ_TREE_CAIRO']:
DIRS += ['cairo']
+if not CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+ DIRS += ['graphite2/src' ]
+
+if not CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ DIRS += ['harfbuzz/src']
+
DIRS += [
'2d',
'ycbcr',
@@ -18,8 +24,6 @@ DIRS += [
'qcms',
'gl',
'layers',
- 'graphite2/src',
- 'harfbuzz/src',
'ots/src',
'thebes',
'ipc',
diff --git gfx/skia/generate_mozbuild.py gfx/skia/generate_mozbuild.py
index e06ae3457a47..93faa61594a3 100755
--- gfx/skia/generate_mozbuild.py
+++ gfx/skia/generate_mozbuild.py
@@ -143,6 +143,9 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
'-Wno-unused-private-field',
]
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'):
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
diff --git gfx/skia/moz.build gfx/skia/moz.build
index 2118677ca3a8..e4978b413784 100644
--- gfx/skia/moz.build
+++ gfx/skia/moz.build
@@ -753,6 +753,9 @@ if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
'-Wno-unused-private-field',
]
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android'):
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
diff --git gfx/thebes/moz.build gfx/thebes/moz.build
index 56f1b9fe3f4b..0ac1100b0df3 100644
--- gfx/thebes/moz.build
+++ gfx/thebes/moz.build
@@ -269,7 +269,13 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
-DEFINES['GRAPHITE2_STATIC'] = True
+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+ CXXFLAGS += CONFIG['MOZ_GRAPHITE2_CFLAGS']
+else:
+ DEFINES['GRAPHITE2_STATIC'] = True
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
if CONFIG['CLANG_CXX']:
# Suppress warnings from Skia header files.
diff --git intl/unicharutil/util/moz.build intl/unicharutil/util/moz.build
index cb1233c56d7e..06fb1f9f174b 100644
--- intl/unicharutil/util/moz.build
+++ intl/unicharutil/util/moz.build
@@ -29,4 +29,7 @@ if CONFIG['ENABLE_INTL_API']:
'ICUUtils.cpp',
]
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
FINAL_LIBRARY = 'xul'
diff --git netwerk/dns/moz.build netwerk/dns/moz.build
index 79c26e3e7001..c4d93bc5f7dc 100644
--- netwerk/dns/moz.build
+++ netwerk/dns/moz.build
@@ -69,6 +69,9 @@ LOCAL_INCLUDES += [
'/netwerk/base',
]
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ CXXFLAGS += CONFIG['MOZ_HARFBUZZ_CFLAGS']
+
if CONFIG['ENABLE_INTL_API']:
DEFINES['IDNA2008'] = True
USE_LIBS += ['icu']
diff --git old-configure.in old-configure.in
index 95a58b634593..b614eef85c89 100644
--- old-configure.in
+++ old-configure.in
@@ -4888,6 +4888,27 @@ dnl ========================================================
AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
dnl ========================================================
+dnl Check for graphite2
+dnl ========================================================
+if test -n "$MOZ_SYSTEM_GRAPHITE2"; then
+ dnl graphite2.pc has bogus version, check manually
+ _SAVE_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $MOZ_GRAPHITE2_CFLAGS"
+ AC_TRY_COMPILE([ #include <graphite2/Font.h>
+ #define GR2_VERSION_REQUIRE(major,minor,bugfix) \
+ ( GR2_VERSION_MAJOR * 10000 + GR2_VERSION_MINOR \
+ * 100 + GR2_VERSION_BUGFIX >= \
+ (major) * 10000 + (minor) * 100 + (bugfix) )
+ ], [
+ #if !GR2_VERSION_REQUIRE(1,3,10)
+ #error "Insufficient graphite2 version."
+ #endif
+ ], [],
+ [AC_MSG_ERROR([--with-system-graphite2 requested but no working libgraphite2 found])])
+ CFLAGS=$_SAVE_CFLAGS
+fi
+
+dnl ========================================================
dnl Check for pixman and cairo
dnl ========================================================
diff --git toolkit/library/moz.build toolkit/library/moz.build
index 24f940e1ed7e..079a575adec3 100644
--- toolkit/library/moz.build
+++ toolkit/library/moz.build
@@ -224,6 +224,12 @@ if CONFIG['MOZ_SYSTEM_JPEG']:
if CONFIG['MOZ_SYSTEM_PNG']:
OS_LIBS += CONFIG['MOZ_PNG_LIBS']
+if CONFIG['MOZ_SYSTEM_GRAPHITE2']:
+ OS_LIBS += CONFIG['MOZ_GRAPHITE2_LIBS']
+
+if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
+ OS_LIBS += CONFIG['MOZ_HARFBUZZ_LIBS']
+
if CONFIG['MOZ_SYSTEM_HUNSPELL']:
OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
diff --git toolkit/moz.configure toolkit/moz.configure
index 9297e4d6f501..d8e273887e4b 100644
--- toolkit/moz.configure
+++ toolkit/moz.configure
@@ -356,6 +356,26 @@ add_old_configure_assignment('FT2_LIBS',
add_old_configure_assignment('FT2_CFLAGS',
delayed_getattr(ft2_info, 'cflags'))
+# Graphite2
+# ==============================================================
+option('--with-system-graphite2',
+ help="Use system graphite2 (located with pkgconfig)")
+
+system_graphite2 = pkg_check_modules('MOZ_GRAPHITE2', 'graphite2',
+ when='--with-system-graphite2')
+
+set_config('MOZ_SYSTEM_GRAPHITE2', depends_if(system_graphite2)(lambda _: True))
+
+# HarfBuzz
+# ==============================================================
+option('--with-system-harfbuzz',
+ help="Use system harfbuzz (located with pkgconfig)")
+
+system_harfbuzz = pkg_check_modules('MOZ_HARFBUZZ', 'harfbuzz >= 1.4.7',
+ when='--with-system-harfbuzz')
+
+set_config('MOZ_SYSTEM_HARFBUZZ', depends_if(system_harfbuzz)(lambda _: True))
+
# Apple platform decoder support
# ==============================================================
@depends(toolkit)

View file

@ -0,0 +1,17 @@
--- extensions/spellcheck/hunspell/glue/mozHunspell.cpp~
+++ extensions/spellcheck/hunspell/glue/mozHunspell.cpp
@@ -392,6 +392,14 @@ mozHunspell::LoadDictionaryList(bool aNo
}
}
+ // load system hunspell dictionaries
+ nsCOMPtr<nsIFile> hunDir;
+ NS_NewNativeLocalFile(NS_LITERAL_CSTRING("%%LOCALBASE%%/share/hunspell"),
+ true, getter_AddRefs(hunDir));
+ if (hunDir) {
+ LoadDictionariesFromDir(hunDir);
+ }
+
// find dictionaries from extensions requiring restart
nsCOMPtr<nsISimpleEnumerator> dictDirs;
rv = dirSvc->Get(DICTIONARY_SEARCH_DIRECTORY_LIST,

View file

@ -0,0 +1,11 @@
--- build/pgo/profileserver.py.orig 2011-02-24 21:49:47.000000000 +0100
+++ build/pgo/profileserver.py 2011-02-24 21:50:30.000000000 +0100
@@ -59,7 +59,7 @@ if __name__ == '__main__':
env["MOZ_JAR_LOG_FILE"] = os.path.abspath(jarlog)
print "jarlog: %s" % env["MOZ_JAR_LOG_FILE"]
- cmdargs = ["http://localhost:%d/index.html" % PORT]
+ cmdargs = ["http://127.0.0.1:%d/index.html" % PORT]
runner = FirefoxRunner(profile=profile,
binary=build.get_binary_path(where="staged-package"),
cmdargs=cmdargs,

View file

@ -0,0 +1,17 @@
--- config/baseconfig.mk~
+++ config/baseconfig.mk
@@ -2,10 +2,10 @@
# directly in python/mozbuild/mozbuild/base.py for gmake validation.
# We thus use INCLUDED_AUTOCONF_MK to enable/disable some parts depending
# whether a normal build is happening or whether the check is running.
-includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
+includedir := $(includedir)/%%MOZILLA%%
+idldir = $(datadir)/idl/%%MOZILLA%%
+installdir = $(libdir)/%%MOZILLA%%
+sdkdir = $(libdir)/%%MOZILLA%%
ifeq (.,$(DEPTH))
DIST = dist
else

View file

@ -0,0 +1,21 @@
# Accept API keys from environment like before bug 1294585
--- build/moz.configure/keyfiles.configure
+++ build/moz.configure/keyfiles.configure
@@ -18,6 +18,7 @@ def keyfile(desc, help=None, callback=lambda x: x):
@checking('for the %s key' % desc, lambda x: x and x is not no_key)
@imports(_from='__builtin__', _import='open')
@imports(_from='__builtin__', _import='IOError')
+ @imports(_from='os', _import='environ')
def keyfile(value):
if value:
try:
@@ -28,7 +29,7 @@ def keyfile(desc, help=None, callback=lambda x: x):
raise FatalCheckError("'%s' is empty." % value[0])
except IOError as e:
raise FatalCheckError("'%s': %s." % (value[0], e.strerror))
- return no_key
+ return environ.get('MOZ_%s_KEY' % desc.upper().replace(' ', '_')) or no_key
return keyfile

View file

@ -0,0 +1,383 @@
# Partially revert bug 791305 to allow building with system IJG jpeg library
diff --git old-configure.in configure.in
index f0aeb5d..1c01010 100644
--- old-configure.in
+++ old-configure.in
@@ -4027,11 +4027,7 @@ if test "$MOZ_SYSTEM_JPEG" = 1; then
#include <jpeglib.h> ],
[ #if JPEG_LIB_VERSION < $MOZJPEG
#error "Insufficient JPEG library version ($MOZJPEG required)."
- #endif
- #ifndef JCS_EXTENSIONS
- #error "libjpeg-turbo JCS_EXTENSIONS required"
- #endif
- ],
+ #endif ],
MOZ_SYSTEM_JPEG=1,
AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
fi
diff --git image/decoders/nsJPEGDecoder.cpp image/decoders/nsJPEGDecoder.cpp
index 8fa8200..1d2a259 100644
--- image/decoders/nsJPEGDecoder.cpp
+++ image/decoders/nsJPEGDecoder.cpp
@@ -21,13 +21,28 @@
extern "C" {
#include "iccjpeg.h"
-}
+#ifdef JCS_EXTENSIONS
#if MOZ_BIG_ENDIAN
#define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_XRGB
#else
#define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_BGRX
#endif
+#else
+/* Colorspace conversion (copied from jpegint.h) */
+struct jpeg_color_deconverter {
+ JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
+ JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows));
+};
+
+METHODDEF(void)
+ycc_rgb_convert_argb (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows);
+#endif
+}
static void cmyk_convert_rgb(JSAMPROW row, JDIMENSION width);
@@ -367,6 +382,7 @@ nsJPEGDecoder::WriteInternal(const char*
case JCS_GRAYSCALE:
case JCS_RGB:
case JCS_YCbCr:
+#ifdef JCS_EXTENSIONS
// if we're not color managing we can decode directly to
// MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB
if (mCMSMode != eCMSMode_All) {
@@ -375,6 +391,9 @@ nsJPEGDecoder::WriteInternal(const char*
} else {
mInfo.out_color_space = JCS_RGB;
}
+#else
+ mInfo.out_color_space = JCS_RGB;
+#endif
break;
case JCS_CMYK:
case JCS_YCCK:
@@ -448,6 +467,16 @@ nsJPEGDecoder::WriteInternal(const char*
return; // I/O suspension
}
+#ifndef JCS_EXTENSIONS
+ /* Force to use our YCbCr to Packed RGB converter when possible */
+ if (!mTransform && (mCMSMode != eCMSMode_All) &&
+ mInfo.jpeg_color_space == JCS_YCbCr && mInfo.out_color_space == JCS_RGB) {
+ /* Special case for the most common case: transform from YCbCr direct into packed ARGB */
+ mInfo.out_color_components = 4; /* Packed ARGB pixels are always 4 bytes...*/
+ mInfo.cconvert->color_convert = ycc_rgb_convert_argb;
+ }
+#endif
+
// If this is a progressive JPEG ...
mState = mInfo.buffered_image ?
JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL;
@@ -605,7 +633,11 @@ nsJPEGDecoder::OutputScanlines(bool* sus
uint32_t* imageRow = ((uint32_t*)mImageData) +
(mInfo.output_scanline * mInfo.output_width);
+#ifdef JCS_EXTENSIONS
if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) {
+#else
+ if (mInfo.cconvert->color_convert == ycc_rgb_convert_argb) {
+#endif
// Special case: scanline will be directly converted into packed ARGB
if (jpeg_read_scanlines(&mInfo, (JSAMPARRAY)&imageRow, 1) != 1) {
*suspend = true; // suspend
@@ -920,6 +952,282 @@ term_source (j_decompress_ptr jd)
} // namespace mozilla
+#ifndef JCS_EXTENSIONS
+/**************** YCbCr -> Cairo's RGB24/ARGB32 conversion: most common case **************/
+
+/*
+ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
+ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
+ * The conversion equations to be implemented are therefore
+ * R = Y + 1.40200 * Cr
+ * G = Y - 0.34414 * Cb - 0.71414 * Cr
+ * B = Y + 1.77200 * Cb
+ * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
+ * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
+ *
+ * To avoid floating-point arithmetic, we represent the fractional constants
+ * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
+ * the products by 2^16, with appropriate rounding, to get the correct answer.
+ * Notice that Y, being an integral input, does not contribute any fraction
+ * so it need not participate in the rounding.
+ *
+ * For even more speed, we avoid doing any multiplications in the inner loop
+ * by precalculating the constants times Cb and Cr for all possible values.
+ * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
+ * for 12-bit samples it is still acceptable. It's not very reasonable for
+ * 16-bit samples, but if you want lossless storage you shouldn't be changing
+ * colorspace anyway.
+ * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
+ * values for the G calculation are left scaled up, since we must add them
+ * together before rounding.
+ */
+
+#define SCALEBITS 16 /* speediest right-shift on some machines */
+
+/* Use static tables for color processing. */
+/* Four tables, each 256 entries of 4 bytes totals 4K which is not bad... */
+
+const int Cr_r_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
+ -0xb3, -0xb2, -0xb1, -0xaf, -0xae, -0xac,
+ -0xab, -0xaa, -0xa8, -0xa7, -0xa5, -0xa4,
+ -0xa3, -0xa1, -0xa0, -0x9e, -0x9d, -0x9c,
+ -0x9a, -0x99, -0x97, -0x96, -0x95, -0x93,
+ -0x92, -0x90, -0x8f, -0x8e, -0x8c, -0x8b,
+ -0x89, -0x88, -0x87, -0x85, -0x84, -0x82,
+ -0x81, -0x80, -0x7e, -0x7d, -0x7b, -0x7a,
+ -0x79, -0x77, -0x76, -0x74, -0x73, -0x72,
+ -0x70, -0x6f, -0x6d, -0x6c, -0x6b, -0x69,
+ -0x68, -0x66, -0x65, -0x64, -0x62, -0x61,
+ -0x5f, -0x5e, -0x5d, -0x5b, -0x5a, -0x58,
+ -0x57, -0x56, -0x54, -0x53, -0x51, -0x50,
+ -0x4f, -0x4d, -0x4c, -0x4a, -0x49, -0x48,
+ -0x46, -0x45, -0x43, -0x42, -0x40, -0x3f,
+ -0x3e, -0x3c, -0x3b, -0x39, -0x38, -0x37,
+ -0x35, -0x34, -0x32, -0x31, -0x30, -0x2e,
+ -0x2d, -0x2b, -0x2a, -0x29, -0x27, -0x26,
+ -0x24, -0x23, -0x22, -0x20, -0x1f, -0x1d,
+ -0x1c, -0x1b, -0x19, -0x18, -0x16, -0x15,
+ -0x14, -0x12, -0x11, -0x0f, -0x0e, -0x0d,
+ -0x0b, -0x0a, -0x08, -0x07, -0x06, -0x04,
+ -0x03, -0x01, 0x00, 0x01, 0x03, 0x04,
+ 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0d,
+ 0x0e, 0x0f, 0x11, 0x12, 0x14, 0x15,
+ 0x16, 0x18, 0x19, 0x1b, 0x1c, 0x1d,
+ 0x1f, 0x20, 0x22, 0x23, 0x24, 0x26,
+ 0x27, 0x29, 0x2a, 0x2b, 0x2d, 0x2e,
+ 0x30, 0x31, 0x32, 0x34, 0x35, 0x37,
+ 0x38, 0x39, 0x3b, 0x3c, 0x3e, 0x3f,
+ 0x40, 0x42, 0x43, 0x45, 0x46, 0x48,
+ 0x49, 0x4a, 0x4c, 0x4d, 0x4f, 0x50,
+ 0x51, 0x53, 0x54, 0x56, 0x57, 0x58,
+ 0x5a, 0x5b, 0x5d, 0x5e, 0x5f, 0x61,
+ 0x62, 0x64, 0x65, 0x66, 0x68, 0x69,
+ 0x6b, 0x6c, 0x6d, 0x6f, 0x70, 0x72,
+ 0x73, 0x74, 0x76, 0x77, 0x79, 0x7a,
+ 0x7b, 0x7d, 0x7e, 0x80, 0x81, 0x82,
+ 0x84, 0x85, 0x87, 0x88, 0x89, 0x8b,
+ 0x8c, 0x8e, 0x8f, 0x90, 0x92, 0x93,
+ 0x95, 0x96, 0x97, 0x99, 0x9a, 0x9c,
+ 0x9d, 0x9e, 0xa0, 0xa1, 0xa3, 0xa4,
+ 0xa5, 0xa7, 0xa8, 0xaa, 0xab, 0xac,
+ 0xae, 0xaf, 0xb1, 0xb2,
+ };
+
+const int Cb_b_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
+ -0xe3, -0xe1, -0xdf, -0xde, -0xdc, -0xda,
+ -0xd8, -0xd6, -0xd5, -0xd3, -0xd1, -0xcf,
+ -0xce, -0xcc, -0xca, -0xc8, -0xc6, -0xc5,
+ -0xc3, -0xc1, -0xbf, -0xbe, -0xbc, -0xba,
+ -0xb8, -0xb7, -0xb5, -0xb3, -0xb1, -0xaf,
+ -0xae, -0xac, -0xaa, -0xa8, -0xa7, -0xa5,
+ -0xa3, -0xa1, -0x9f, -0x9e, -0x9c, -0x9a,
+ -0x98, -0x97, -0x95, -0x93, -0x91, -0x90,
+ -0x8e, -0x8c, -0x8a, -0x88, -0x87, -0x85,
+ -0x83, -0x81, -0x80, -0x7e, -0x7c, -0x7a,
+ -0x78, -0x77, -0x75, -0x73, -0x71, -0x70,
+ -0x6e, -0x6c, -0x6a, -0x69, -0x67, -0x65,
+ -0x63, -0x61, -0x60, -0x5e, -0x5c, -0x5a,
+ -0x59, -0x57, -0x55, -0x53, -0x52, -0x50,
+ -0x4e, -0x4c, -0x4a, -0x49, -0x47, -0x45,
+ -0x43, -0x42, -0x40, -0x3e, -0x3c, -0x3a,
+ -0x39, -0x37, -0x35, -0x33, -0x32, -0x30,
+ -0x2e, -0x2c, -0x2b, -0x29, -0x27, -0x25,
+ -0x23, -0x22, -0x20, -0x1e, -0x1c, -0x1b,
+ -0x19, -0x17, -0x15, -0x13, -0x12, -0x10,
+ -0x0e, -0x0c, -0x0b, -0x09, -0x07, -0x05,
+ -0x04, -0x02, 0x00, 0x02, 0x04, 0x05,
+ 0x07, 0x09, 0x0b, 0x0c, 0x0e, 0x10,
+ 0x12, 0x13, 0x15, 0x17, 0x19, 0x1b,
+ 0x1c, 0x1e, 0x20, 0x22, 0x23, 0x25,
+ 0x27, 0x29, 0x2b, 0x2c, 0x2e, 0x30,
+ 0x32, 0x33, 0x35, 0x37, 0x39, 0x3a,
+ 0x3c, 0x3e, 0x40, 0x42, 0x43, 0x45,
+ 0x47, 0x49, 0x4a, 0x4c, 0x4e, 0x50,
+ 0x52, 0x53, 0x55, 0x57, 0x59, 0x5a,
+ 0x5c, 0x5e, 0x60, 0x61, 0x63, 0x65,
+ 0x67, 0x69, 0x6a, 0x6c, 0x6e, 0x70,
+ 0x71, 0x73, 0x75, 0x77, 0x78, 0x7a,
+ 0x7c, 0x7e, 0x80, 0x81, 0x83, 0x85,
+ 0x87, 0x88, 0x8a, 0x8c, 0x8e, 0x90,
+ 0x91, 0x93, 0x95, 0x97, 0x98, 0x9a,
+ 0x9c, 0x9e, 0x9f, 0xa1, 0xa3, 0xa5,
+ 0xa7, 0xa8, 0xaa, 0xac, 0xae, 0xaf,
+ 0xb1, 0xb3, 0xb5, 0xb7, 0xb8, 0xba,
+ 0xbc, 0xbe, 0xbf, 0xc1, 0xc3, 0xc5,
+ 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xcf,
+ 0xd1, 0xd3, 0xd5, 0xd6, 0xd8, 0xda,
+ 0xdc, 0xde, 0xdf, 0xe1,
+ };
+
+const int Cr_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
+ 0x5b6900, 0x5ab22e, 0x59fb5c, 0x59448a, 0x588db8, 0x57d6e6,
+ 0x572014, 0x566942, 0x55b270, 0x54fb9e, 0x5444cc, 0x538dfa,
+ 0x52d728, 0x522056, 0x516984, 0x50b2b2, 0x4ffbe0, 0x4f450e,
+ 0x4e8e3c, 0x4dd76a, 0x4d2098, 0x4c69c6, 0x4bb2f4, 0x4afc22,
+ 0x4a4550, 0x498e7e, 0x48d7ac, 0x4820da, 0x476a08, 0x46b336,
+ 0x45fc64, 0x454592, 0x448ec0, 0x43d7ee, 0x43211c, 0x426a4a,
+ 0x41b378, 0x40fca6, 0x4045d4, 0x3f8f02, 0x3ed830, 0x3e215e,
+ 0x3d6a8c, 0x3cb3ba, 0x3bfce8, 0x3b4616, 0x3a8f44, 0x39d872,
+ 0x3921a0, 0x386ace, 0x37b3fc, 0x36fd2a, 0x364658, 0x358f86,
+ 0x34d8b4, 0x3421e2, 0x336b10, 0x32b43e, 0x31fd6c, 0x31469a,
+ 0x308fc8, 0x2fd8f6, 0x2f2224, 0x2e6b52, 0x2db480, 0x2cfdae,
+ 0x2c46dc, 0x2b900a, 0x2ad938, 0x2a2266, 0x296b94, 0x28b4c2,
+ 0x27fdf0, 0x27471e, 0x26904c, 0x25d97a, 0x2522a8, 0x246bd6,
+ 0x23b504, 0x22fe32, 0x224760, 0x21908e, 0x20d9bc, 0x2022ea,
+ 0x1f6c18, 0x1eb546, 0x1dfe74, 0x1d47a2, 0x1c90d0, 0x1bd9fe,
+ 0x1b232c, 0x1a6c5a, 0x19b588, 0x18feb6, 0x1847e4, 0x179112,
+ 0x16da40, 0x16236e, 0x156c9c, 0x14b5ca, 0x13fef8, 0x134826,
+ 0x129154, 0x11da82, 0x1123b0, 0x106cde, 0x0fb60c, 0x0eff3a,
+ 0x0e4868, 0x0d9196, 0x0cdac4, 0x0c23f2, 0x0b6d20, 0x0ab64e,
+ 0x09ff7c, 0x0948aa, 0x0891d8, 0x07db06, 0x072434, 0x066d62,
+ 0x05b690, 0x04ffbe, 0x0448ec, 0x03921a, 0x02db48, 0x022476,
+ 0x016da4, 0x00b6d2, 0x000000, -0x00b6d2, -0x016da4, -0x022476,
+ -0x02db48, -0x03921a, -0x0448ec, -0x04ffbe, -0x05b690, -0x066d62,
+ -0x072434, -0x07db06, -0x0891d8, -0x0948aa, -0x09ff7c, -0x0ab64e,
+ -0x0b6d20, -0x0c23f2, -0x0cdac4, -0x0d9196, -0x0e4868, -0x0eff3a,
+ -0x0fb60c, -0x106cde, -0x1123b0, -0x11da82, -0x129154, -0x134826,
+ -0x13fef8, -0x14b5ca, -0x156c9c, -0x16236e, -0x16da40, -0x179112,
+ -0x1847e4, -0x18feb6, -0x19b588, -0x1a6c5a, -0x1b232c, -0x1bd9fe,
+ -0x1c90d0, -0x1d47a2, -0x1dfe74, -0x1eb546, -0x1f6c18, -0x2022ea,
+ -0x20d9bc, -0x21908e, -0x224760, -0x22fe32, -0x23b504, -0x246bd6,
+ -0x2522a8, -0x25d97a, -0x26904c, -0x27471e, -0x27fdf0, -0x28b4c2,
+ -0x296b94, -0x2a2266, -0x2ad938, -0x2b900a, -0x2c46dc, -0x2cfdae,
+ -0x2db480, -0x2e6b52, -0x2f2224, -0x2fd8f6, -0x308fc8, -0x31469a,
+ -0x31fd6c, -0x32b43e, -0x336b10, -0x3421e2, -0x34d8b4, -0x358f86,
+ -0x364658, -0x36fd2a, -0x37b3fc, -0x386ace, -0x3921a0, -0x39d872,
+ -0x3a8f44, -0x3b4616, -0x3bfce8, -0x3cb3ba, -0x3d6a8c, -0x3e215e,
+ -0x3ed830, -0x3f8f02, -0x4045d4, -0x40fca6, -0x41b378, -0x426a4a,
+ -0x43211c, -0x43d7ee, -0x448ec0, -0x454592, -0x45fc64, -0x46b336,
+ -0x476a08, -0x4820da, -0x48d7ac, -0x498e7e, -0x4a4550, -0x4afc22,
+ -0x4bb2f4, -0x4c69c6, -0x4d2098, -0x4dd76a, -0x4e8e3c, -0x4f450e,
+ -0x4ffbe0, -0x50b2b2, -0x516984, -0x522056, -0x52d728, -0x538dfa,
+ -0x5444cc, -0x54fb9e, -0x55b270, -0x566942, -0x572014, -0x57d6e6,
+ -0x588db8, -0x59448a, -0x59fb5c, -0x5ab22e,
+ };
+
+const int Cb_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
+ 0x2c8d00, 0x2c34e6, 0x2bdccc, 0x2b84b2, 0x2b2c98, 0x2ad47e,
+ 0x2a7c64, 0x2a244a, 0x29cc30, 0x297416, 0x291bfc, 0x28c3e2,
+ 0x286bc8, 0x2813ae, 0x27bb94, 0x27637a, 0x270b60, 0x26b346,
+ 0x265b2c, 0x260312, 0x25aaf8, 0x2552de, 0x24fac4, 0x24a2aa,
+ 0x244a90, 0x23f276, 0x239a5c, 0x234242, 0x22ea28, 0x22920e,
+ 0x2239f4, 0x21e1da, 0x2189c0, 0x2131a6, 0x20d98c, 0x208172,
+ 0x202958, 0x1fd13e, 0x1f7924, 0x1f210a, 0x1ec8f0, 0x1e70d6,
+ 0x1e18bc, 0x1dc0a2, 0x1d6888, 0x1d106e, 0x1cb854, 0x1c603a,
+ 0x1c0820, 0x1bb006, 0x1b57ec, 0x1affd2, 0x1aa7b8, 0x1a4f9e,
+ 0x19f784, 0x199f6a, 0x194750, 0x18ef36, 0x18971c, 0x183f02,
+ 0x17e6e8, 0x178ece, 0x1736b4, 0x16de9a, 0x168680, 0x162e66,
+ 0x15d64c, 0x157e32, 0x152618, 0x14cdfe, 0x1475e4, 0x141dca,
+ 0x13c5b0, 0x136d96, 0x13157c, 0x12bd62, 0x126548, 0x120d2e,
+ 0x11b514, 0x115cfa, 0x1104e0, 0x10acc6, 0x1054ac, 0x0ffc92,
+ 0x0fa478, 0x0f4c5e, 0x0ef444, 0x0e9c2a, 0x0e4410, 0x0debf6,
+ 0x0d93dc, 0x0d3bc2, 0x0ce3a8, 0x0c8b8e, 0x0c3374, 0x0bdb5a,
+ 0x0b8340, 0x0b2b26, 0x0ad30c, 0x0a7af2, 0x0a22d8, 0x09cabe,
+ 0x0972a4, 0x091a8a, 0x08c270, 0x086a56, 0x08123c, 0x07ba22,
+ 0x076208, 0x0709ee, 0x06b1d4, 0x0659ba, 0x0601a0, 0x05a986,
+ 0x05516c, 0x04f952, 0x04a138, 0x04491e, 0x03f104, 0x0398ea,
+ 0x0340d0, 0x02e8b6, 0x02909c, 0x023882, 0x01e068, 0x01884e,
+ 0x013034, 0x00d81a, 0x008000, 0x0027e6, -0x003034, -0x00884e,
+ -0x00e068, -0x013882, -0x01909c, -0x01e8b6, -0x0240d0, -0x0298ea,
+ -0x02f104, -0x03491e, -0x03a138, -0x03f952, -0x04516c, -0x04a986,
+ -0x0501a0, -0x0559ba, -0x05b1d4, -0x0609ee, -0x066208, -0x06ba22,
+ -0x07123c, -0x076a56, -0x07c270, -0x081a8a, -0x0872a4, -0x08cabe,
+ -0x0922d8, -0x097af2, -0x09d30c, -0x0a2b26, -0x0a8340, -0x0adb5a,
+ -0x0b3374, -0x0b8b8e, -0x0be3a8, -0x0c3bc2, -0x0c93dc, -0x0cebf6,
+ -0x0d4410, -0x0d9c2a, -0x0df444, -0x0e4c5e, -0x0ea478, -0x0efc92,
+ -0x0f54ac, -0x0facc6, -0x1004e0, -0x105cfa, -0x10b514, -0x110d2e,
+ -0x116548, -0x11bd62, -0x12157c, -0x126d96, -0x12c5b0, -0x131dca,
+ -0x1375e4, -0x13cdfe, -0x142618, -0x147e32, -0x14d64c, -0x152e66,
+ -0x158680, -0x15de9a, -0x1636b4, -0x168ece, -0x16e6e8, -0x173f02,
+ -0x17971c, -0x17ef36, -0x184750, -0x189f6a, -0x18f784, -0x194f9e,
+ -0x19a7b8, -0x19ffd2, -0x1a57ec, -0x1ab006, -0x1b0820, -0x1b603a,
+ -0x1bb854, -0x1c106e, -0x1c6888, -0x1cc0a2, -0x1d18bc, -0x1d70d6,
+ -0x1dc8f0, -0x1e210a, -0x1e7924, -0x1ed13e, -0x1f2958, -0x1f8172,
+ -0x1fd98c, -0x2031a6, -0x2089c0, -0x20e1da, -0x2139f4, -0x21920e,
+ -0x21ea28, -0x224242, -0x229a5c, -0x22f276, -0x234a90, -0x23a2aa,
+ -0x23fac4, -0x2452de, -0x24aaf8, -0x250312, -0x255b2c, -0x25b346,
+ -0x260b60, -0x26637a, -0x26bb94, -0x2713ae, -0x276bc8, -0x27c3e2,
+ -0x281bfc, -0x287416, -0x28cc30, -0x29244a, -0x297c64, -0x29d47e,
+ -0x2a2c98, -0x2a84b2, -0x2adccc, -0x2b34e6,
+ };
+
+
+/* We assume that right shift corresponds to signed division by 2 with
+ * rounding towards minus infinity. This is correct for typical "arithmetic
+ * shift" instructions that shift in copies of the sign bit. But some
+ * C compilers implement >> with an unsigned shift. For these machines you
+ * must define RIGHT_SHIFT_IS_UNSIGNED.
+ * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
+ * It is only applied with constant shift counts. SHIFT_TEMPS must be
+ * included in the variables of any routine using RIGHT_SHIFT.
+ */
+
+#ifdef RIGHT_SHIFT_IS_UNSIGNED
+#define SHIFT_TEMPS INT32 shift_temp;
+#define RIGHT_SHIFT(x,shft) \
+ ((shift_temp = (x)) < 0 ? \
+ (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
+ (shift_temp >> (shft)))
+#else
+#define SHIFT_TEMPS
+#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
+#endif
+
+
+METHODDEF(void)
+ycc_rgb_convert_argb (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows)
+{
+ JDIMENSION num_cols = cinfo->output_width;
+ JSAMPLE * range_limit = cinfo->sample_range_limit;
+
+ SHIFT_TEMPS
+
+ /* This is used if we don't have SSE2 */
+
+ while (--num_rows >= 0) {
+ JSAMPROW inptr0 = input_buf[0][input_row];
+ JSAMPROW inptr1 = input_buf[1][input_row];
+ JSAMPROW inptr2 = input_buf[2][input_row];
+ input_row++;
+ uint32_t *outptr = (uint32_t *) *output_buf++;
+ for (JDIMENSION col = 0; col < num_cols; col++) {
+ int y = GETJSAMPLE(inptr0[col]);
+ int cb = GETJSAMPLE(inptr1[col]);
+ int cr = GETJSAMPLE(inptr2[col]);
+ JSAMPLE * range_limit_y = range_limit + y;
+ /* Range-limiting is essential due to noise introduced by DCT losses. */
+ outptr[col] = 0xFF000000 |
+ ( range_limit_y[Cr_r_tab[cr]] << 16 ) |
+ ( range_limit_y[((int) RIGHT_SHIFT(Cb_g_tab[cb] + Cr_g_tab[cr], SCALEBITS))] << 8 ) |
+ ( range_limit_y[Cb_b_tab[cb]] );
+ }
+ }
+}
+#endif
+
+
///*************** Inverted CMYK -> RGB conversion *************************
/// Input is (Inverted) CMYK stored as 4 bytes per pixel.
/// Output is RGB stored as 3 bytes per pixel.

View file

@ -0,0 +1,13 @@
# Let ports handle default sample type
--- old-configure.in~
+++ old-configure.in
@@ -5144,7 +5144,7 @@ dnl Use integers over floats for audio o
dnl (regarless of the CPU architecture, because audio
dnl backends for those platforms don't support floats. We also
dnl use integers on ARM with other OS, because it's more efficient.
-if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
+if test -n "$MOZ_INTEGER_SAMPLES"; then
MOZ_SAMPLE_TYPE_S16=1
AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
AC_SUBST(MOZ_SAMPLE_TYPE_S16)

View file

@ -0,0 +1,53 @@
commit 4cbdfa028752
Author: Manish Goregaokar <manishsmail@gmail.com>
Date: Tue Aug 1 12:57:42 2017 -0500
servo: Merge #17934 - Remove doc comment on statement (from Manishearth:doc-comment); r=canaltinova
rustc warns about these now
Source-Repo: https://github.com/servo/servo
Source-Revision: b49311c65a083a9b8eb03741bf7ea980b64f1e03
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 6b3c7d7f4ffeb9e271c52d418cda42cac5dd378d
---
servo/components/style/values/specified/image.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git servo/components/style/values/specified/image.rs servo/components/style/values/specified/image.rs
index 37ed00ccf443..687c6f17d432 100644
--- servo/components/style/values/specified/image.rs
+++ servo/components/style/values/specified/image.rs
@@ -686,14 +686,14 @@ impl LineDirection {
input.try(|i| {
let to_ident = i.try(|i| i.expect_ident_matching("to"));
match *compat_mode {
- /// `to` keyword is mandatory in modern syntax.
+ // `to` keyword is mandatory in modern syntax.
CompatMode::Modern => to_ident?,
// Fall back to Modern compatibility mode in case there is a `to` keyword.
// According to Gecko, `-moz-linear-gradient(to ...)` should serialize like
// `linear-gradient(to ...)`.
CompatMode::Moz if to_ident.is_ok() => *compat_mode = CompatMode::Modern,
- /// There is no `to` keyword in webkit prefixed syntax. If it's consumed,
- /// parsing should throw an error.
+ // There is no `to` keyword in webkit prefixed syntax. If it's consumed,
+ // parsing should throw an error.
CompatMode::WebKit if to_ident.is_ok() => {
return Err(SelectorParseError::UnexpectedIdent("to".into()).into())
},
diff --git servo/components/style/properties/gecko.mako.rs servo/components/style/properties/gecko.mako.rs
index 37ed00ccf443..687c6f17d432 100644
--- servo/components/style/properties/gecko.mako.rs
+++ servo/components/style/properties/gecko.mako.rs
@@ -2081,7 +2081,7 @@ fn static_assert() {
return (parent_size, parent_unconstrained_size)
}
- /// XXXManishearth this should also handle text zoom
+ // XXXManishearth this should also handle text zoom
let min = Au(parent.gecko.mScriptMinSize);
let scale = (parent.gecko.mScriptSizeMultiplier as f32).powi(delta as i32);

View file

@ -0,0 +1,110 @@
commit 9f5c1f2e4b5b
Author: Manish Goregaokar <manishsmail@gmail.com>
Date: Thu Aug 3 16:27:12 2017 -0500
servo: Merge #17969 - Update stylo code to work on nightly (from Manishearth:rustup); r=emilio
r=emilio https://bugzilla.mozilla.org/show_bug.cgi?id=1386887
Source-Repo: https://github.com/servo/servo
Source-Revision: 7cee7d7fcc4194e410fa8a308a77d37ac452778a
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : d9c874ebcfa1e64c86265d0ed2e5cff65d9133be
---
servo/components/style/gecko/generated/bindings.rs | 12 +++++++++---
servo/components/style/gecko/wrapper.rs | 7 ++++++-
servo/ports/geckolib/glue.rs | 3 ++-
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git servo/components/style/gecko/generated/bindings.rs servo/components/style/gecko/generated/bindings.rs
index e46bdfe1e1ea..b6703ab95bf7 100644
--- servo/components/style/gecko/generated/bindings.rs
+++ servo/components/style/gecko/generated/bindings.rs
@@ -8,6 +8,7 @@ type nsAString_internal = nsAString;
pub type ServoStyleContextBorrowed<'a> = &'a ::properties::ComputedValues;
pub type ServoStyleContextBorrowedOrNull<'a> = Option<&'a ::properties::ComputedValues>;
pub type ServoComputedDataBorrowed<'a> = &'a ServoComputedData;
+pub type RawServoAnimationValueTableBorrowed<'a> = &'a ();
use gecko_bindings::structs::mozilla::css::GridTemplateAreasValue;
use gecko_bindings::structs::mozilla::css::ErrorReporter;
use gecko_bindings::structs::mozilla::css::ImageValue;
@@ -37,7 +38,7 @@ use gecko_bindings::structs::RawServoStyleRule;
use gecko_bindings::structs::RawGeckoPresContext;
use gecko_bindings::structs::RawGeckoPresContextOwned;
use gecko_bindings::structs::RawGeckoStyleAnimationList;
-use gecko_bindings::structs::RawGeckoStyleChildrenIteratorBorrowedMut;
+use gecko_bindings::structs::RawGeckoStyleChildrenIterator;
use gecko_bindings::structs::RawGeckoServoStyleRuleList;
use gecko_bindings::structs::RawGeckoURLExtraData;
use gecko_bindings::structs::RawGeckoXBLBinding;
@@ -320,6 +321,10 @@ pub type RawGeckoServoAnimationValueListBorrowed<'a> = &'a RawGeckoServoAnimatio
pub type RawGeckoServoAnimationValueListBorrowedOrNull<'a> = Option<&'a RawGeckoServoAnimationValueList>;
pub type RawGeckoServoAnimationValueListBorrowedMut<'a> = &'a mut RawGeckoServoAnimationValueList;
pub type RawGeckoServoAnimationValueListBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoServoAnimationValueList>;
+pub type RawGeckoStyleChildrenIteratorBorrowed<'a> = &'a RawGeckoStyleChildrenIterator;
+pub type RawGeckoStyleChildrenIteratorBorrowedOrNull<'a> = Option<&'a RawGeckoStyleChildrenIterator>;
+pub type RawGeckoStyleChildrenIteratorBorrowedMut<'a> = &'a mut RawGeckoStyleChildrenIterator;
+pub type RawGeckoStyleChildrenIteratorBorrowedMutOrNull<'a> = Option<&'a mut RawGeckoStyleChildrenIterator>;
pub type ServoCssRulesStrong = ::gecko_bindings::sugar::ownership::Strong<ServoCssRules>;
pub type ServoCssRulesBorrowed<'a> = &'a ServoCssRules;
pub type ServoCssRulesBorrowedOrNull<'a> = Option<&'a ServoCssRules>;
@@ -840,7 +845,7 @@ extern "C" {
}
extern "C" {
pub fn Gecko_AnimationGetBaseStyle(aBaseStyles:
- *mut ::std::os::raw::c_void,
+ RawServoAnimationValueTableBorrowed,
aProperty: nsCSSPropertyID)
-> RawServoAnimationValueBorrowedOrNull;
}
@@ -2602,7 +2607,8 @@ extern "C" {
extern "C" {
pub fn Servo_AnimationCompose(animation_values:
RawServoAnimationValueMapBorrowedMut,
- base_values: *mut ::std::os::raw::c_void,
+ base_values:
+ RawServoAnimationValueTableBorrowed,
property: nsCSSPropertyID,
animation_segment:
RawGeckoAnimationPropertySegmentBorrowed,
diff --git servo/components/style/gecko/wrapper.rs servo/components/style/gecko/wrapper.rs
index dae898692313..6d62f54951cc 100644
--- servo/components/style/gecko/wrapper.rs
+++ servo/components/style/gecko/wrapper.rs
@@ -387,7 +387,12 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> {
curr
},
GeckoChildrenIterator::GeckoIterator(ref mut it) => unsafe {
- Gecko_GetNextStyleChild(it).map(GeckoNode)
+ // We do this unsafe lengthening of the lifetime here because
+ // structs::StyleChildrenIterator is actually StyleChildrenIterator<'a>,
+ // however we can't express this easily with bindgen, and it would
+ // introduce functions with two input lifetimes into bindgen,
+ // which would be out of scope for elision.
+ Gecko_GetNextStyleChild(&mut * (it as *mut _)).map(GeckoNode)
}
}
}
diff --git servo/ports/geckolib/glue.rs servo/ports/geckolib/glue.rs
index 367d24ff87b2..e69959f3710b 100644
--- servo/ports/geckolib/glue.rs
+++ servo/ports/geckolib/glue.rs
@@ -59,6 +59,7 @@ use style::gecko_bindings::bindings::RawGeckoServoStyleRuleListBorrowedMut;
use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed;
use style::gecko_bindings::bindings::RawServoAnimationValueMapBorrowedMut;
use style::gecko_bindings::bindings::RawServoAnimationValueStrong;
+use style::gecko_bindings::bindings::RawServoAnimationValueTableBorrowed;
use style::gecko_bindings::bindings::RawServoStyleRuleBorrowed;
use style::gecko_bindings::bindings::ServoStyleContextBorrowedOrNull;
use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
@@ -374,7 +375,7 @@ pub extern "C" fn Servo_AnimationValues_ComputeDistance(from: RawServoAnimationV
#[no_mangle]
pub extern "C" fn Servo_AnimationCompose(raw_value_map: RawServoAnimationValueMapBorrowedMut,
- base_values: *mut ::std::os::raw::c_void,
+ base_values: RawServoAnimationValueTableBorrowed,
css_property: nsCSSPropertyID,
segment: RawGeckoAnimationPropertySegmentBorrowed,
last_segment: RawGeckoAnimationPropertySegmentBorrowed,

View file

@ -0,0 +1,763 @@
commit ea9c8db790e4
Author: Simon Sapin <simon.sapin@exyr.org>
Date: Tue Aug 15 07:31:04 2017 -0500
servo: Merge #18046 - Upgrade to rustc 1.21.0-nightly (13d94d5fa 2017-08-10) (from servo:rustup); r=emilio
Source-Repo: https://github.com/servo/servo
Source-Revision: 7d9b82b9efa7b10a2e34d93df5ac535d99518f7a
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : e1b3d113c3edaea3c4c07f8b206f2e02922e3caf
---
servo/Cargo.lock | 6 +++---
servo/components/devtools/lib.rs | 2 +-
servo/components/layout/animation.rs | 2 +-
servo/components/layout/construct.rs | 6 +++---
servo/components/layout/display_list_builder.rs | 2 +-
servo/components/layout/flex.rs | 6 +++---
servo/components/layout/inline.rs | 4 ++--
servo/components/layout/sequential.rs | 2 +-
servo/components/layout/table_cell.rs | 2 +-
servo/components/layout/text.rs | 2 +-
servo/components/net/cookie_storage.rs | 2 +-
servo/components/profile/heartbeats.rs | 4 ++--
servo/components/script/dom/bindings/js.rs | 4 ++--
servo/components/script/dom/cssstyledeclaration.rs | 8 ++++----
servo/components/script/dom/cssstylerule.rs | 2 +-
servo/components/script/dom/document.rs | 12 ++++++------
servo/components/script/dom/medialist.rs | 4 ++--
servo/components/script/dom/range.rs | 4 ++--
.../script/dom/servoparser/async_html.rs | 4 ++--
servo/components/script/dom/url.rs | 4 ++--
servo/components/script/dom/vrdisplay.rs | 2 +-
.../components/script/dom/webglrenderingcontext.rs | 2 +-
servo/components/script/dom/xmlhttprequest.rs | 2 +-
servo/components/script/lib.rs | 1 -
.../script_plugins/unrooted_must_root.rs | 22 +++++++++++++++-------
servo/components/selectors/matching.rs | 2 +-
servo/components/selectors/parser.rs | 2 +-
.../style/invalidation/element/invalidator.rs | 2 +-
servo/components/style/matching.rs | 2 +-
.../components/style/properties/properties.mako.rs | 2 +-
servo/components/style/style_adjuster.rs | 2 +-
servo/components/style/style_resolver.rs | 2 +-
servo/components/style/stylesheets/rule_list.rs | 2 +-
servo/components/style/stylesheets/rule_parser.rs | 2 +-
.../components/style/stylesheets/rules_iterator.rs | 2 +-
servo/components/style/values/animated/color.rs | 2 +-
servo/components/style/values/computed/border.rs | 2 +-
servo/components/webdriver_server/lib.rs | 2 +-
servo/rust-commit-hash | 2 +-
servo/tests/unit/style/stylist.rs | 13 -------------
40 files changed, 73 insertions(+), 79 deletions(-)
diff --git servo/Cargo.lock servo/Cargo.lock
index 50dd6e1a785a..2aa7bd8ea3dd 100644
--- servo/Cargo.lock
+++ servo/Cargo.lock
@@ -3577,7 +3577,7 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"error-chain 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "xcb 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "xcb 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -3592,7 +3592,7 @@ dependencies = [
[[package]]
name = "xcb"
-version = "0.7.6"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3918,7 +3918,7 @@ dependencies = [
"checksum x11 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db27c597c187da52194a4b8232e7d869503911aab9ff726fefb76d7a830f78ed"
"checksum x11-clipboard 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "731230b8edcbb9d99247105e4c9ec0a538594d50ad68d2afa8662195f9db2973"
"checksum x11-dl 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "326c500cdc166fd7c70dd8c8a829cd5c0ce7be5a5d98c25817de2b9bdc67faf8"
-"checksum xcb 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "63e3a849b73e4e1905e4f4d48f1750429bc86ea9f473632ab382a6f69ecb6b33"
+"checksum xcb 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "7cede38417fcdf2f0a9d8abf1cea1c1b066320a8a316e9583a0d717c334fafb2"
"checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61"
"checksum xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12ea8eda4b1eb72f02d148402e23832d56a33f55d8c1b2d5bcdde91d79d47cb1"
"checksum xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7ec6c39eaa68382c8e31e35239402c0a9489d4141a8ceb0c716099a0b515b562"
diff --git servo/components/devtools/lib.rs servo/components/devtools/lib.rs
index d5a2764a7102..6a25696eaed7 100644
--- servo/components/devtools/lib.rs
+++ servo/components/devtools/lib.rs
@@ -306,7 +306,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
columnNumber: console_message.columnNumber,
},
};
- for mut stream in &mut *console_actor.streams.borrow_mut() {
+ for stream in &mut *console_actor.streams.borrow_mut() {
stream.write_json_packet(&msg);
}
}
diff --git servo/components/layout/animation.rs servo/components/layout/animation.rs
index e4a2782c1271..ebbba82fcc6a 100644
--- servo/components/layout/animation.rs
+++ servo/components/layout/animation.rs
@@ -39,7 +39,7 @@ pub fn update_animation_state(constellation_chan: &IpcSender<ConstellationMsg>,
// run.
if let Some(ref mut animations) = running_animations.get_mut(node) {
// TODO: This being linear is probably not optimal.
- for mut anim in animations.iter_mut() {
+ for anim in animations.iter_mut() {
if let Animation::Keyframes(_, ref anim_name, ref mut anim_state) = *anim {
if *name == *anim_name {
debug!("update_animation_state: Found other animation {}", name);
diff --git servo/components/layout/construct.rs servo/components/layout/construct.rs
index c863219941e4..7ef391b42183 100644
--- servo/components/layout/construct.rs
+++ servo/components/layout/construct.rs
@@ -1921,7 +1921,7 @@ impl Legalizer {
/// true for anonymous block children of flex flows.
fn try_to_add_child(&mut self, context: &SharedStyleContext, parent: &mut FlowRef, child: &mut FlowRef)
-> bool {
- let mut parent = self.stack.last_mut().unwrap_or(parent);
+ let parent = self.stack.last_mut().unwrap_or(parent);
let (parent_class, child_class) = (parent.class(), child.class());
match (parent_class, child_class) {
(FlowClass::TableWrapper, FlowClass::Table) |
@@ -1962,7 +1962,7 @@ impl Legalizer {
} else {
IS_BLOCK_FLEX_ITEM
};
- let mut block = FlowRef::deref_mut(&mut block_wrapper).as_mut_block();
+ let block = FlowRef::deref_mut(&mut block_wrapper).as_mut_block();
block.base.flags.insert(MARGINS_CANNOT_COLLAPSE);
block.fragment.flags.insert(flag);
}
@@ -1979,7 +1979,7 @@ impl Legalizer {
} else {
IS_BLOCK_FLEX_ITEM
};
- let mut block = FlowRef::deref_mut(child).as_mut_block();
+ let block = FlowRef::deref_mut(child).as_mut_block();
block.base.flags.insert(MARGINS_CANNOT_COLLAPSE);
block.fragment.flags.insert(flag);
}
diff --git servo/components/layout/display_list_builder.rs servo/components/layout/display_list_builder.rs
index f8b26899b57d..783574afd2a3 100644
--- servo/components/layout/display_list_builder.rs
+++ servo/components/layout/display_list_builder.rs
@@ -2718,7 +2718,7 @@ impl InlineFlowDisplayListBuilding for InlineFlow {
self.base.scroll_root_id = Some(state.current_scroll_root_id);
self.base.clip = state.clip_stack.last().cloned().unwrap_or_else(max_rect);
- for mut fragment in self.fragments.fragments.iter_mut() {
+ for fragment in self.fragments.fragments.iter_mut() {
let previous_containing_block_scroll_root_id = state.containing_block_scroll_root_id;
if establishes_containing_block_for_absolute(fragment.style.get_box().position) {
state.containing_block_scroll_root_id = state.current_scroll_root_id;
diff --git servo/components/layout/flex.rs servo/components/layout/flex.rs
index 353c939f58b9..d79580f8cd0d 100644
--- servo/components/layout/flex.rs
+++ servo/components/layout/flex.rs
@@ -415,7 +415,7 @@ impl FlexFlow {
let items = &mut self.items[start..];
let mut children = self.block_flow.base.children.random_access_mut();
- for mut item in items {
+ for item in items {
let kid = children.get(item.index);
item.init_sizes(kid, container_size, self.main_mode);
let outer_main_size = item.outer_main_size(kid, self.main_mode);
@@ -607,7 +607,7 @@ impl FlexFlow {
let mut children = self.block_flow.base.children.random_access_mut();
for item in items.iter_mut() {
- let mut block = children.get(item.index).as_mut_block();
+ let block = children.get(item.index).as_mut_block();
block.base.block_container_writing_mode = container_mode;
block.base.block_container_inline_size = inline_size;
@@ -659,7 +659,7 @@ impl FlexFlow {
let mut children = self.block_flow.base.children.random_access_mut();
for item in &mut self.items {
- let mut base = flow::mut_base(children.get(item.index));
+ let base = flow::mut_base(children.get(item.index));
if !self.main_reverse {
base.position.start.b = cur_b;
cur_b = cur_b + base.position.size.block;
diff --git servo/components/layout/inline.rs servo/components/layout/inline.rs
index d5813d9bea22..10e091c3c66d 100644
--- servo/components/layout/inline.rs
+++ servo/components/layout/inline.rs
@@ -435,7 +435,7 @@ impl LineBreaker {
return
}
let last_fragment_index = self.pending_line.range.end() - FragmentIndex(1);
- let mut fragment = &mut self.new_fragments[last_fragment_index.get() as usize];
+ let fragment = &mut self.new_fragments[last_fragment_index.get() as usize];
let old_fragment_inline_size = fragment.border_box.size.inline;
@@ -1047,7 +1047,7 @@ impl InlineFlow {
let space_per_expansion_opportunity = slack_inline_size / expansion_opportunities as i32;
for fragment_index in line.range.each_index() {
let fragment = fragments.get_mut(fragment_index.to_usize());
- let mut scanned_text_fragment_info = match fragment.specific {
+ let scanned_text_fragment_info = match fragment.specific {
SpecificFragmentInfo::ScannedText(ref mut info) if !info.range.is_empty() => info,
_ => continue
};
diff --git servo/components/layout/sequential.rs servo/components/layout/sequential.rs
index f6f8ce429e4f..4986ebb6c852 100644
--- servo/components/layout/sequential.rs
+++ servo/components/layout/sequential.rs
@@ -133,7 +133,7 @@ pub fn store_overflow(layout_context: &LayoutContext, flow: &mut Flow) {
return;
}
- for mut kid in flow::mut_base(flow).child_iter_mut() {
+ for kid in flow::mut_base(flow).child_iter_mut() {
store_overflow(layout_context, kid);
}
diff --git servo/components/layout/table_cell.rs servo/components/layout/table_cell.rs
index 7ef02e28db65..fd807989b463 100644
--- servo/components/layout/table_cell.rs
+++ servo/components/layout/table_cell.rs
@@ -136,7 +136,7 @@ impl TableCellFlow {
}
for kid in flow::mut_base(self).children.iter_mut() {
- let mut kid_base = flow::mut_base(kid);
+ let kid_base = flow::mut_base(kid);
if !kid_base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
kid_base.position.start.b += offset
}
diff --git servo/components/layout/text.rs servo/components/layout/text.rs
index 6e1c7b2a43a1..9a207a2bb84e 100644
--- servo/components/layout/text.rs
+++ servo/components/layout/text.rs
@@ -460,7 +460,7 @@ fn split_first_fragment_at_newline_if_necessary(fragments: &mut LinkedList<Fragm
}
let new_fragment = {
- let mut first_fragment = fragments.front_mut().unwrap();
+ let first_fragment = fragments.front_mut().unwrap();
let string_before;
let selection_before;
{
diff --git servo/components/net/cookie_storage.rs servo/components/net/cookie_storage.rs
index f255f57b56d2..b3147ef4dd32 100644
--- servo/components/net/cookie_storage.rs
+++ servo/components/net/cookie_storage.rs
@@ -103,7 +103,7 @@ impl CookieStorage {
// Step 12
let domain = reg_host(&cookie.cookie.domain().as_ref().unwrap_or(&""));
- let mut cookies = self.cookies_map.entry(domain).or_insert(vec![]);
+ let cookies = self.cookies_map.entry(domain).or_insert(vec![]);
if cookies.len() == self.max_per_host {
let old_len = cookies.len();
diff --git servo/components/profile/heartbeats.rs servo/components/profile/heartbeats.rs
index 4661dad61836..0d474fe3a111 100644
--- servo/components/profile/heartbeats.rs
+++ servo/components/profile/heartbeats.rs
@@ -33,7 +33,7 @@ pub fn cleanup() {
)
);
if let Some(mut hbs) = hbs_opt_box {
- for (_, mut v) in hbs.iter_mut() {
+ for (_, v) in hbs.iter_mut() {
// log any remaining heartbeat records before dropping
log_heartbeat_records(v);
}
@@ -65,7 +65,7 @@ pub fn maybe_heartbeat(category: &ProfilerCategory,
if !(*hbs_ptr).contains_key(category) {
maybe_create_heartbeat(&mut (*hbs_ptr), category.clone());
}
- if let Some(mut h) = (*hbs_ptr).get_mut(category) {
+ if let Some(h) = (*hbs_ptr).get_mut(category) {
(*h).heartbeat(0, 1, start_time, end_time, start_energy, end_energy);
}
}
diff --git servo/components/script/dom/bindings/js.rs servo/components/script/dom/bindings/js.rs
index 975ddeda13b0..abfd9f47eff1 100644
--- servo/components/script/dom/bindings/js.rs
+++ servo/components/script/dom/bindings/js.rs
@@ -469,7 +469,7 @@ impl RootCollection {
/// Start tracking a stack-based root
unsafe fn root(&self, untracked_reflector: *const Reflector) {
debug_assert!(thread_state::get().is_script());
- let mut roots = &mut *self.roots.get();
+ let roots = &mut *self.roots.get();
roots.push(untracked_reflector);
assert!(!(*untracked_reflector).get_jsobject().is_null())
}
@@ -479,7 +479,7 @@ impl RootCollection {
assert!(!tracked_reflector.is_null());
assert!(!(*tracked_reflector).get_jsobject().is_null());
debug_assert!(thread_state::get().is_script());
- let mut roots = &mut *self.roots.get();
+ let roots = &mut *self.roots.get();
match roots.iter().rposition(|r| *r == tracked_reflector) {
Some(idx) => {
roots.remove(idx);
diff --git servo/components/script/dom/cssstyledeclaration.rs servo/components/script/dom/cssstyledeclaration.rs
index 0732c9af9e45..ddf085b34913 100644
--- servo/components/script/dom/cssstyledeclaration.rs
+++ servo/components/script/dom/cssstyledeclaration.rs
@@ -238,7 +238,7 @@ impl CSSStyleDeclaration {
return Err(Error::NoModificationAllowed);
}
- self.owner.mutate_associated_block(|ref mut pdb, mut changed| {
+ self.owner.mutate_associated_block(|pdb, changed| {
if value.is_empty() {
// Step 3
*changed = pdb.remove_property(&id);
@@ -360,7 +360,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
_ => return Ok(()),
};
- self.owner.mutate_associated_block(|ref mut pdb, mut changed| {
+ self.owner.mutate_associated_block(|pdb, changed| {
// Step 5 & 6
*changed = pdb.set_importance(&id, importance);
});
@@ -388,7 +388,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
};
let mut string = String::new();
- self.owner.mutate_associated_block(|mut pdb, mut changed| {
+ self.owner.mutate_associated_block(|pdb, changed| {
pdb.property_value_to_css(&id, &mut string).unwrap();
*changed = pdb.remove_property(&id);
});
@@ -438,7 +438,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
}
let quirks_mode = window.Document().quirks_mode();
- self.owner.mutate_associated_block(|mut pdb, mut _changed| {
+ self.owner.mutate_associated_block(|pdb, _changed| {
// Step 3
*pdb = parse_style_attribute(&value,
&self.owner.base_url(),
diff --git servo/components/script/dom/cssstylerule.rs servo/components/script/dom/cssstylerule.rs
index ea121ef900a9..12e9cdcc8694 100644
--- servo/components/script/dom/cssstylerule.rs
+++ servo/components/script/dom/cssstylerule.rs
@@ -99,7 +99,7 @@ impl CSSStyleRuleMethods for CSSStyleRule {
if let Ok(mut s) = SelectorList::parse(&parser, &mut css_parser) {
// This mirrors what we do in CSSStyleOwner::mutate_associated_block.
let mut guard = self.cssrule.shared_lock().write();
- let mut stylerule = self.stylerule.write_with(&mut guard);
+ let stylerule = self.stylerule.write_with(&mut guard);
mem::swap(&mut stylerule.selectors, &mut s);
// It seems like we will want to avoid having to invalidate all
// stylesheets eventually!
diff --git servo/components/script/dom/document.rs servo/components/script/dom/document.rs
index 90ea06fbe7b4..71bb02eaa364 100644
--- servo/components/script/dom/document.rs
+++ servo/components/script/dom/document.rs
@@ -633,7 +633,7 @@ impl Document {
// reset_form_owner_for_listeners -> reset_form_owner -> GetElementById
{
let mut id_map = self.id_map.borrow_mut();
- let mut elements = id_map.entry(id.clone()).or_insert(Vec::new());
+ let elements = id_map.entry(id.clone()).or_insert(Vec::new());
elements.insert_pre_order(element, root.r().upcast::<Node>());
}
self.reset_form_owner_for_listeners(&id);
@@ -642,7 +642,7 @@ impl Document {
pub fn register_form_id_listener<T: ?Sized + FormControl>(&self, id: DOMString, listener: &T) {
let mut map = self.form_id_listener_map.borrow_mut();
let listener = listener.to_element();
- let mut set = map.entry(Atom::from(id)).or_insert(HashSet::new());
+ let set = map.entry(Atom::from(id)).or_insert(HashSet::new());
set.insert(JS::from_ref(listener));
}
@@ -1572,7 +1572,7 @@ impl Document {
/// https://html.spec.whatwg.org/multipage/#dom-window-cancelanimationframe
pub fn cancel_animation_frame(&self, ident: u32) {
let mut list = self.animation_frame_list.borrow_mut();
- if let Some(mut pair) = list.iter_mut().find(|pair| pair.0 == ident) {
+ if let Some(pair) = list.iter_mut().find(|pair| pair.0 == ident) {
pair.1 = None;
}
}
@@ -2399,7 +2399,7 @@ impl Document {
if entry.snapshot.is_none() {
entry.snapshot = Some(Snapshot::new(el.html_element_in_html_document()));
}
- let mut snapshot = entry.snapshot.as_mut().unwrap();
+ let snapshot = entry.snapshot.as_mut().unwrap();
if snapshot.state.is_none() {
snapshot.state = Some(el.state());
}
@@ -2426,7 +2426,7 @@ impl Document {
entry.hint.insert(RESTYLE_SELF);
}
- let mut snapshot = entry.snapshot.as_mut().unwrap();
+ let snapshot = entry.snapshot.as_mut().unwrap();
if attr.local_name() == &local_name!("id") {
snapshot.id_changed = true;
} else if attr.local_name() == &local_name!("class") {
@@ -4028,7 +4028,7 @@ impl PendingInOrderScriptVec {
fn loaded(&self, element: &HTMLScriptElement, result: ScriptResult) {
let mut scripts = self.scripts.borrow_mut();
- let mut entry = scripts.iter_mut().find(|entry| &*entry.element == element).unwrap();
+ let entry = scripts.iter_mut().find(|entry| &*entry.element == element).unwrap();
entry.loaded(result);
}
diff --git servo/components/script/dom/medialist.rs servo/components/script/dom/medialist.rs
index 0064d0445095..ae20f5aa0422 100644
--- servo/components/script/dom/medialist.rs
+++ servo/components/script/dom/medialist.rs
@@ -63,7 +63,7 @@ impl MediaListMethods for MediaList {
// https://drafts.csswg.org/cssom/#dom-medialist-mediatext
fn SetMediaText(&self, value: DOMString) {
let mut guard = self.shared_lock().write();
- let mut media_queries = self.media_queries.write_with(&mut guard);
+ let media_queries = self.media_queries.write_with(&mut guard);
// Step 2
if value.is_empty() {
// Step 1
@@ -154,7 +154,7 @@ impl MediaListMethods for MediaList {
// Step 3
let m_serialized = m.unwrap().to_css_string();
let mut guard = self.shared_lock().write();
- let mut media_list = self.media_queries.write_with(&mut guard);
+ let media_list = self.media_queries.write_with(&mut guard);
let new_vec = media_list.media_queries.drain(..)
.filter(|q| m_serialized != q.to_css_string())
.collect();
diff --git servo/components/script/dom/range.rs servo/components/script/dom/range.rs
index fa849a0fc1a2..1e65caedc9dd 100644
--- servo/components/script/dom/range.rs
+++ servo/components/script/dom/range.rs
@@ -1049,7 +1049,7 @@ impl WeakRangeVec {
let offset = context.index();
let parent = context.parent;
unsafe {
- let mut ranges = &mut *self.cell.get();
+ let ranges = &mut *self.cell.get();
ranges.update(|entry| {
let range = entry.root().unwrap();
@@ -1076,7 +1076,7 @@ impl WeakRangeVec {
}
unsafe {
- let mut ranges = &mut *self.cell.get();
+ let ranges = &mut *self.cell.get();
ranges.update(|entry| {
let range = entry.root().unwrap();
diff --git servo/components/script/dom/servoparser/async_html.rs servo/components/script/dom/servoparser/async_html.rs
index 59411fda1c73..70d2008f49f6 100644
--- servo/components/script/dom/servoparser/async_html.rs
+++ servo/components/script/dom/servoparser/async_html.rs
@@ -568,7 +568,7 @@ impl TreeSink for Sink {
}
let node = self.new_parse_node();
{
- let mut data = self.get_parse_node_data_mut(&target.id);
+ let data = self.get_parse_node_data_mut(&target.id);
data.contents = Some(node.clone());
}
self.send_op(ParseOperation::GetTemplateContents { target: target.id, contents: node.id });
@@ -596,7 +596,7 @@ impl TreeSink for Sink {
let mut node = self.new_parse_node();
node.qual_name = Some(name.clone());
{
- let mut node_data = self.get_parse_node_data_mut(&node.id);
+ let node_data = self.get_parse_node_data_mut(&node.id);
node_data.is_integration_point = html_attrs.iter()
.any(|attr| {
let attr_value = &String::from(attr.value.clone());
diff --git servo/components/script/dom/url.rs servo/components/script/dom/url.rs
index a02a735638fc..41de4dcc0c72 100644
--- servo/components/script/dom/url.rs
+++ servo/components/script/dom/url.rs
@@ -96,8 +96,8 @@ impl URL {
// https://w3c.github.io/FileAPI/#dfn-createObjectURL
pub fn CreateObjectURL(global: &GlobalScope, blob: &Blob) -> DOMString {
- /// XXX: Second field is an unicode-serialized Origin, it is a temporary workaround
- /// and should not be trusted. See issue https://github.com/servo/servo/issues/11722
+ // XXX: Second field is an unicode-serialized Origin, it is a temporary workaround
+ // and should not be trusted. See issue https://github.com/servo/servo/issues/11722
let origin = get_blob_origin(&global.get_url());
let id = blob.get_blob_url_id();
diff --git servo/components/script/dom/vrdisplay.rs servo/components/script/dom/vrdisplay.rs
index 3f73a577fad7..54f06fb928f2 100644
--- servo/components/script/dom/vrdisplay.rs
+++ servo/components/script/dom/vrdisplay.rs
@@ -268,7 +268,7 @@ impl VRDisplayMethods for VRDisplay {
fn CancelAnimationFrame(&self, handle: u32) {
if self.presenting.get() {
let mut list = self.raf_callback_list.borrow_mut();
- if let Some(mut pair) = list.iter_mut().find(|pair| pair.0 == handle) {
+ if let Some(pair) = list.iter_mut().find(|pair| pair.0 == handle) {
pair.1 = None;
}
} else {
diff --git servo/components/script/dom/webglrenderingcontext.rs servo/components/script/dom/webglrenderingcontext.rs
index 73d4ddba1b90..62c92b42785c 100644
--- servo/components/script/dom/webglrenderingcontext.rs
+++ servo/components/script/dom/webglrenderingcontext.rs
@@ -2434,7 +2434,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
typedarray!(in(cx) let mut pixels_data: ArrayBufferView = pixels);
- let (array_type, mut data) = match { pixels_data.as_mut() } {
+ let (array_type, data) = match { pixels_data.as_mut() } {
Ok(data) => (data.get_array_type(), data.as_mut_slice()),
Err(_) => return Err(Error::Type("Not an ArrayBufferView".to_owned())),
};
diff --git servo/components/script/dom/xmlhttprequest.rs servo/components/script/dom/xmlhttprequest.rs
index 6ed2dda1851f..e6652d79d706 100644
--- servo/components/script/dom/xmlhttprequest.rs
+++ servo/components/script/dom/xmlhttprequest.rs
@@ -627,7 +627,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
if !content_type_set {
let ct = request.headers.get_mut::<ContentType>();
- if let Some(mut ct) = ct {
+ if let Some(ct) = ct {
if let Some(encoding) = encoding {
for param in &mut (ct.0).2 {
if param.0 == MimeAttr::Charset {
diff --git servo/components/script/lib.rs servo/components/script/lib.rs
index e1a1ab592cb7..5824d6f2e490 100644
--- servo/components/script/lib.rs
+++ servo/components/script/lib.rs
@@ -9,7 +9,6 @@
#![feature(mpsc_select)]
#![feature(nonzero)]
#![feature(on_unimplemented)]
-#![feature(option_entry)]
#![feature(plugin)]
#![feature(proc_macro)]
#![feature(stmt_expr_attributes)]
diff --git servo/components/script_plugins/unrooted_must_root.rs servo/components/script_plugins/unrooted_must_root.rs
index 5dbd2b1a3bdd..f3f5e60ab62a 100644
--- servo/components/script_plugins/unrooted_must_root.rs
+++ servo/components/script_plugins/unrooted_must_root.rs
@@ -182,7 +182,7 @@ impl<'a, 'b, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'b, 'tcx> {
}
match expr.node {
- /// Trait casts from #[must_root] types are not allowed
+ // Trait casts from #[must_root] types are not allowed
hir::ExprCast(ref subexpr, _) => require_rooted(cx, self.in_new_function, &*subexpr),
// This catches assignments... the main point of this would be to catch mutable
// references to `JS<T>`.
@@ -206,13 +206,21 @@ impl<'a, 'b, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'b, 'tcx> {
fn visit_pat(&mut self, pat: &'tcx hir::Pat) {
let cx = self.cx;
- if let hir::PatKind::Binding(hir::BindingMode::BindByValue(_), _, _, _) = pat.node {
- let ty = cx.tables.pat_ty(pat);
- if is_unrooted_ty(cx, ty, self.in_new_function) {
- cx.span_lint(UNROOTED_MUST_ROOT,
- pat.span,
- &format!("Expression of type {:?} must be rooted", ty))
+ // We want to detect pattern bindings that move a value onto the stack.
+ // When "default binding modes" https://github.com/rust-lang/rust/issues/42640
+ // are implemented, the `Unannotated` case could cause false-positives.
+ // These should be fixable by adding an explicit `ref`.
+ match pat.node {
+ hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, _, _) |
+ hir::PatKind::Binding(hir::BindingAnnotation::Mutable, _, _, _) => {
+ let ty = cx.tables.pat_ty(pat);
+ if is_unrooted_ty(cx, ty, self.in_new_function) {
+ cx.span_lint(UNROOTED_MUST_ROOT,
+ pat.span,
+ &format!("Expression of type {:?} must be rooted", ty))
+ }
}
+ _ => {}
}
visit::walk_pat(self, pat);
diff --git servo/components/selectors/matching.rs servo/components/selectors/matching.rs
index 7bd9814d26fb..8f6b2fa6aa54 100644
--- servo/components/selectors/matching.rs
+++ servo/components/selectors/matching.rs
@@ -458,7 +458,7 @@ where
/// Matches a complex selector.
pub fn matches_complex_selector<E, F>(mut iter: SelectorIter<E::Impl>,
element: &E,
- mut context: &mut LocalMatchingContext<E::Impl>,
+ context: &mut LocalMatchingContext<E::Impl>,
flags_setter: &mut F)
-> bool
where E: Element,
diff --git servo/components/selectors/parser.rs servo/components/selectors/parser.rs
index 490399ce38ce..6b2c1f2b4e86 100644
--- servo/components/selectors/parser.rs
+++ servo/components/selectors/parser.rs
@@ -1464,7 +1464,7 @@ fn parse_negation<'i, 't, P, E, Impl>(parser: &P,
fn parse_compound_selector<'i, 't, P, E, Impl>(
parser: &P,
input: &mut CssParser<'i, 't>,
- mut builder: &mut SelectorBuilder<Impl>)
+ builder: &mut SelectorBuilder<Impl>)
-> Result<bool, ParseError<'i, SelectorParseError<'i, E>>>
where P: Parser<'i, Impl=Impl, Error=E>, Impl: SelectorImpl
{
diff --git servo/components/style/invalidation/element/invalidator.rs servo/components/style/invalidation/element/invalidator.rs
index 848c5cd13dc8..b8510ba3169b 100644
--- servo/components/style/invalidation/element/invalidator.rs
+++ servo/components/style/invalidation/element/invalidator.rs
@@ -154,7 +154,7 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
trace!(" > visitedness change, force subtree restyle");
// We can't just return here because there may also be attribute
// changes as well that imply additional hints.
- let mut data = self.data.as_mut().unwrap();
+ let data = self.data.as_mut().unwrap();
data.restyle.hint.insert(RestyleHint::restyle_subtree());
}
diff --git servo/components/style/matching.rs servo/components/style/matching.rs
index b62bc54bf768..f58d7cd123e6 100644
--- servo/components/style/matching.rs
+++ servo/components/style/matching.rs
@@ -440,7 +440,7 @@ pub trait MatchMethods : TElement {
fn finish_restyle(
&self,
context: &mut StyleContext<Self>,
- mut data: &mut ElementData,
+ data: &mut ElementData,
mut new_styles: ElementStyles,
important_rules_changed: bool,
) -> ChildCascadeRequirement {
diff --git servo/components/style/properties/properties.mako.rs servo/components/style/properties/properties.mako.rs
index d98e173db5ba..81ff00fb6d5e 100644
--- servo/components/style/properties/properties.mako.rs
+++ servo/components/style/properties/properties.mako.rs
@@ -3364,7 +3364,7 @@ pub fn modify_border_style_for_inline_sides(style: &mut Arc<ComputedValues>,
return;
}
}
- let mut style = Arc::make_mut(style);
+ let style = Arc::make_mut(style);
let border = Arc::make_mut(&mut style.border);
match side {
PhysicalSide::Left => {
diff --git servo/components/style/style_adjuster.rs servo/components/style/style_adjuster.rs
index 366641ebe0bc..6e51fa74072a 100644
--- servo/components/style/style_adjuster.rs
+++ servo/components/style/style_adjuster.rs
@@ -269,7 +269,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
if overflow_x != original_overflow_x ||
overflow_y != original_overflow_y {
- let mut box_style = self.style.mutate_box();
+ let box_style = self.style.mutate_box();
box_style.set_overflow_x(overflow_x);
box_style.set_overflow_y(overflow_y);
}
diff --git servo/components/style/style_resolver.rs servo/components/style/style_resolver.rs
index cf512c4fbdd2..3fc1d57cc8f7 100644
--- servo/components/style/style_resolver.rs
+++ servo/components/style/style_resolver.rs
@@ -247,7 +247,7 @@ where
Some(&*primary_style.style)
};
- for (i, mut inputs) in pseudo_array.iter_mut().enumerate() {
+ for (i, inputs) in pseudo_array.iter_mut().enumerate() {
if let Some(inputs) = inputs.take() {
let pseudo = PseudoElement::from_eager_index(i);
pseudo_styles.set(
diff --git servo/components/style/stylesheets/rule_list.rs servo/components/style/stylesheets/rule_list.rs
index 82e78015400d..14b3dc5e7696 100644
--- servo/components/style/stylesheets/rule_list.rs
+++ servo/components/style/stylesheets/rule_list.rs
@@ -150,7 +150,7 @@ impl CssRulesHelpers for RawOffsetArc<Locked<CssRules>> {
{
let mut write_guard = lock.write();
- let mut rules = self.write_with(&mut write_guard);
+ let rules = self.write_with(&mut write_guard);
// Step 5
// Computes the maximum allowed parser state at a given index.
let rev_state = rules.0.get(index).map_or(State::Body, CssRule::rule_state);
diff --git servo/components/style/stylesheets/rule_parser.rs servo/components/style/stylesheets/rule_parser.rs
index 007d7e11026e..f0d224e498a7 100644
--- servo/components/style/stylesheets/rule_parser.rs
+++ servo/components/style/stylesheets/rule_parser.rs
@@ -209,7 +209,7 @@ impl<'a, 'i> AtRuleParser<'i> for TopLevelRuleParser<'a> {
let id = register_namespace(&url)
.map_err(|()| StyleParseError::UnspecifiedError)?;
- let mut namespaces = self.namespaces.as_mut().unwrap();
+ let namespaces = self.namespaces.as_mut().unwrap();
let opt_prefix = if let Ok(prefix) = prefix_result {
let prefix = Prefix::from(prefix.as_ref());
diff --git servo/components/style/stylesheets/rules_iterator.rs servo/components/style/stylesheets/rules_iterator.rs
index 95a3ab8b3885..65e1b637ae52 100644
--- servo/components/style/stylesheets/rules_iterator.rs
+++ servo/components/style/stylesheets/rules_iterator.rs
@@ -70,7 +70,7 @@ impl<'a, 'b, C> Iterator for RulesIterator<'a, 'b, C>
let rule;
let sub_iter = {
- let mut nested_iter = self.stack.last_mut().unwrap();
+ let nested_iter = self.stack.last_mut().unwrap();
rule = match nested_iter.next() {
Some(r) => r,
None => {
diff --git servo/components/webdriver_server/lib.rs servo/components/webdriver_server/lib.rs
index bd2f667f9892..28a4885f0d41 100644
--- servo/components/webdriver_server/lib.rs
+++ servo/components/webdriver_server/lib.rs
@@ -702,7 +702,7 @@ impl Handler {
fn handle_set_timeouts(&mut self,
parameters: &TimeoutsParameters)
-> WebDriverResult<WebDriverResponse> {
- let mut session = self.session
+ let session = self.session
.as_mut()
.ok_or(WebDriverError::new(ErrorStatus::SessionNotCreated, ""))?;
diff --git servo/rust-commit-hash servo/rust-commit-hash
index d4f08fe97644..a08d23cd1a71 100644
--- servo/rust-commit-hash
+++ servo/rust-commit-hash
@@ -1 +1 @@
-599be0d18f4c6ddf36366d2a5a2ca6dc65886896
+13d94d5fa8129a34f5c77a1bcd76983f5aed2434
diff --git servo/tests/unit/style/stylist.rs servo/tests/unit/style/stylist.rs
index da9a9478957a..52067b501788 100644
--- servo/tests/unit/style/stylist.rs
+++ servo/tests/unit/style/stylist.rs
@@ -51,19 +51,6 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
}).collect(), shared_lock)
}
-fn get_mock_map(selectors: &[&str]) -> (SelectorMap<Rule>, SharedRwLock) {
- let mut map = SelectorMap::<Rule>::new();
- let (selector_rules, shared_lock) = get_mock_rules(selectors);
-
- for rules in selector_rules.into_iter() {
- for rule in rules.into_iter() {
- map.insert(rule, QuirksMode::NoQuirks)
- }
- }
-
- (map, shared_lock)
-}
-
fn parse_selectors(selectors: &[&str]) -> Vec<Selector<SelectorImpl>> {
selectors.iter()
.map(|x| SelectorParser::parse_author_origin_no_namespace(x).unwrap().0

View file

@ -0,0 +1,232 @@
commit f0acf27d189d
Author: Simon Sapin <simon.sapin@exyr.org>
Date: Thu Aug 17 11:05:32 2017 -0500
servo: Merge #18126 - geckolib: Fix some warnings (treated as error) new in Rust Nigthly (from servo:glow-fox); r=emilio
Source-Repo: https://github.com/servo/servo
Source-Revision: cc86ca2bcdec5e89ee5279085ea38db63ef41af9
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 0586dbc81f1411c89821605a6dae4ebd0af8f0d5
---
servo/components/style/gecko/conversions.rs | 2 +-
servo/components/style/gecko/wrapper.rs | 2 +-
.../style/gecko_bindings/sugar/ns_t_array.rs | 4 ++--
servo/components/style/properties/gecko.mako.rs | 18 +++++++++---------
servo/components/style/style_adjuster.rs | 4 ++--
servo/ports/geckolib/glue.rs | 12 ++++++------
6 files changed, 21 insertions(+), 21 deletions(-)
diff --git servo/components/style/gecko/conversions.rs servo/components/style/gecko/conversions.rs
index 8f3fb6bf2d0f..51015997c5c1 100644
--- servo/components/style/gecko/conversions.rs
+++ servo/components/style/gecko/conversions.rs
@@ -348,7 +348,7 @@ impl nsStyleImage {
// NB: stops are guaranteed to be none in the gecko side by
// default.
- let mut gecko_stop = unsafe {
+ let gecko_stop = unsafe {
&mut (*gecko_gradient).mStops[index]
};
let mut coord = nsStyleCoord::null();
diff --git servo/components/style/gecko/wrapper.rs servo/components/style/gecko/wrapper.rs
index 034dd94590e2..c402ddaf15bd 100644
--- servo/components/style/gecko/wrapper.rs
+++ servo/components/style/gecko/wrapper.rs
@@ -424,7 +424,7 @@ impl<'lb> GeckoXBLBinding<'lb> {
}
}
- fn each_xbl_stylist<F>(self, mut f: &mut F)
+ fn each_xbl_stylist<F>(self, f: &mut F)
where
F: FnMut(&Stylist),
{
diff --git servo/components/style/gecko_bindings/sugar/ns_t_array.rs servo/components/style/gecko_bindings/sugar/ns_t_array.rs
index 6bc389702f54..068e10ddea1b 100644
--- servo/components/style/gecko_bindings/sugar/ns_t_array.rs
+++ servo/components/style/gecko_bindings/sugar/ns_t_array.rs
@@ -90,7 +90,7 @@ impl<T> nsTArray<T> {
// this can leak
debug_assert!(len >= self.len() as u32);
self.ensure_capacity(len as usize);
- let mut header = self.header_mut();
+ let header = self.header_mut();
header.mLength = len;
}
@@ -99,7 +99,7 @@ impl<T> nsTArray<T> {
/// This will not leak since it only works on POD types (and thus doesn't assert)
pub unsafe fn set_len_pod(&mut self, len: u32) where T: Copy {
self.ensure_capacity(len as usize);
- let mut header = unsafe { self.header_mut() };
+ let header = unsafe { self.header_mut() };
header.mLength = len;
}
}
diff --git servo/components/style/properties/gecko.mako.rs servo/components/style/properties/gecko.mako.rs
index 9a2ab2135fc5..bc41ef139af5 100644
--- servo/components/style/properties/gecko.mako.rs
+++ servo/components/style/properties/gecko.mako.rs
@@ -4136,14 +4136,14 @@ fn static_assert() {
fn init_shadow(filter: &mut nsStyleFilter) -> &mut nsCSSShadowArray {
unsafe {
let ref mut union = filter.__bindgen_anon_1;
- let mut shadow_array: &mut *mut nsCSSShadowArray = union.mDropShadow.as_mut();
+ let shadow_array: &mut *mut nsCSSShadowArray = union.mDropShadow.as_mut();
*shadow_array = Gecko_NewCSSShadowArray(1);
&mut **shadow_array
}
}
- let mut gecko_shadow = init_shadow(gecko_filter);
+ let gecko_shadow = init_shadow(gecko_filter);
gecko_shadow.mArray[0].set_from_simple_shadow(shadow);
},
Url(ref url) => {
@@ -4665,14 +4665,14 @@ fn static_assert() {
unsafe {
// We have to be very careful to avoid a copy here!
let ref mut union = ${ident}.__bindgen_anon_1;
- let mut shape: &mut *mut StyleBasicShape = union.mBasicShape.as_mut();
+ let shape: &mut *mut StyleBasicShape = union.mBasicShape.as_mut();
*shape = Gecko_NewBasicShape(ty);
&mut **shape
}
}
match servo_shape {
BasicShape::Inset(inset) => {
- let mut shape = init_shape(${ident}, StyleBasicShapeType::Inset);
+ let shape = init_shape(${ident}, StyleBasicShapeType::Inset);
unsafe { shape.mCoordinates.set_len(4) };
// set_len() can't call constructors, so the coordinates
@@ -4694,7 +4694,7 @@ fn static_assert() {
set_corners_from_radius(inset.round, &mut shape.mRadius);
}
BasicShape::Circle(circ) => {
- let mut shape = init_shape(${ident}, StyleBasicShapeType::Circle);
+ let shape = init_shape(${ident}, StyleBasicShapeType::Circle);
unsafe { shape.mCoordinates.set_len(1) };
shape.mCoordinates[0].leaky_set_null();
circ.radius.to_gecko_style_coord(&mut shape.mCoordinates[0]);
@@ -4702,7 +4702,7 @@ fn static_assert() {
shape.mPosition = circ.position.into();
}
BasicShape::Ellipse(el) => {
- let mut shape = init_shape(${ident}, StyleBasicShapeType::Ellipse);
+ let shape = init_shape(${ident}, StyleBasicShapeType::Ellipse);
unsafe { shape.mCoordinates.set_len(2) };
shape.mCoordinates[0].leaky_set_null();
el.semiaxis_x.to_gecko_style_coord(&mut shape.mCoordinates[0]);
@@ -4712,7 +4712,7 @@ fn static_assert() {
shape.mPosition = el.position.into();
}
BasicShape::Polygon(poly) => {
- let mut shape = init_shape(${ident}, StyleBasicShapeType::Polygon);
+ let shape = init_shape(${ident}, StyleBasicShapeType::Polygon);
unsafe {
shape.mCoordinates.set_len(poly.coordinates.len() as u32 * 2);
}
@@ -4797,7 +4797,7 @@ clip-path
bindings::Gecko_nsStyleSVG_SetDashArrayLength(&mut self.gecko, v.len() as u32);
}
- for (mut gecko, servo) in self.gecko.mStrokeDasharray.iter_mut().zip(v) {
+ for (gecko, servo) in self.gecko.mStrokeDasharray.iter_mut().zip(v) {
match servo {
Either::First(number) => gecko.set_value(CoordDataValue::Factor(number)),
Either::Second(lop) => gecko.set(lop),
@@ -4885,7 +4885,7 @@ clip-path
}
self.gecko.mContextPropsBits = 0;
- for (mut gecko, servo) in self.gecko.mContextProps.iter_mut().zip(v) {
+ for (gecko, servo) in self.gecko.mContextProps.iter_mut().zip(v) {
if servo.0 == atom!("fill") {
self.gecko.mContextPropsBits |= structs::NS_STYLE_CONTEXT_PROPERTY_FILL as u8;
} else if servo.0 == atom!("stroke") {
diff --git servo/components/style/style_adjuster.rs servo/components/style/style_adjuster.rs
index 03b15916b237..366641ebe0bc 100644
--- servo/components/style/style_adjuster.rs
+++ servo/components/style/style_adjuster.rs
@@ -167,7 +167,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
// When 'contain: paint', update overflow from 'visible' to 'clip'.
if self.style.get_box().clone_contain().contains(contain::PAINT) {
if self.style.get_box().clone_overflow_x() == overflow::visible {
- let mut box_style = self.style.mutate_box();
+ let box_style = self.style.mutate_box();
box_style.set_overflow_x(overflow::_moz_hidden_unscrollable);
box_style.set_overflow_y(overflow::_moz_hidden_unscrollable);
}
@@ -182,7 +182,7 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
use properties::longhands::font_style::computed_value::T as font_style;
use properties::longhands::font_weight::computed_value::T as font_weight;
if self.style.get_font().clone__moz_math_variant() != moz_math_variant::none {
- let mut font_style = self.style.mutate_font();
+ let font_style = self.style.mutate_font();
// Sadly we don't have a nice name for the computed value
// of "font-weight: normal".
font_style.set_font_weight(font_weight::normal());
diff --git servo/ports/geckolib/glue.rs servo/ports/geckolib/glue.rs
index 977728286fc3..fa09bee29553 100644
--- servo/ports/geckolib/glue.rs
+++ servo/ports/geckolib/glue.rs
@@ -815,7 +815,7 @@ pub extern "C" fn Servo_StyleSet_AppendStyleSheet(
) {
let global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
- let mut data = &mut *data;
+ let data = &mut *data;
let guard = global_style_data.shared_lock.read();
data.stylesheets.append_stylesheet(
&data.stylist,
@@ -867,7 +867,7 @@ pub extern "C" fn Servo_StyleSet_PrependStyleSheet(
) {
let global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
- let mut data = &mut *data;
+ let data = &mut *data;
let guard = global_style_data.shared_lock.read();
data.stylesheets.prepend_stylesheet(
&data.stylist,
@@ -885,7 +885,7 @@ pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(
) {
let global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
- let mut data = &mut *data;
+ let data = &mut *data;
let guard = global_style_data.shared_lock.read();
data.stylesheets.insert_stylesheet_before(
&data.stylist,
@@ -903,7 +903,7 @@ pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(
) {
let global_style_data = &*GLOBAL_STYLE_DATA;
let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
- let mut data = &mut *data;
+ let data = &mut *data;
let guard = global_style_data.shared_lock.read();
data.stylesheets.remove_stylesheet(
&data.stylist,
@@ -1274,7 +1274,7 @@ pub extern "C" fn Servo_StyleRule_GetSpecificityAtIndex(
specificity: *mut u64
) {
read_locked_arc(rule, |rule: &StyleRule| {
- let mut specificity = unsafe { specificity.as_mut().unwrap() };
+ let specificity = unsafe { specificity.as_mut().unwrap() };
let index = index as usize;
if index >= rule.selectors.0.len() {
*specificity = 0;
@@ -2775,7 +2775,7 @@ pub extern "C" fn Servo_NoteExplicitHints(element: RawGeckoElementBorrowed,
pub extern "C" fn Servo_TakeChangeHint(element: RawGeckoElementBorrowed,
was_restyled: *mut bool) -> nsChangeHint
{
- let mut was_restyled = unsafe { was_restyled.as_mut().unwrap() };
+ let was_restyled = unsafe { was_restyled.as_mut().unwrap() };
let element = GeckoElement(element);
let damage = match element.mutate_data() {

View file

@ -0,0 +1,15 @@
--- third_party/python/futures/concurrent/futures/process.py.orig 2017-04-11 04:15:19 UTC
+++ third_party/python/futures/concurrent/futures/process.py
@@ -247,7 +247,11 @@ def _check_system_limits():
_system_limits_checked = True
try:
import os
- nsems_max = os.sysconf("SC_SEM_NSEMS_MAX")
+ if sys.platform.startswith('freebsd'):
+ # sem(4) confuses sysconf(3) on FreeBSD < 11.1
+ nsems_max = -1
+ else:
+ nsems_max = os.sysconf("SC_SEM_NSEMS_MAX")
except (AttributeError, ValueError):
# sysconf not available or setting not available
return

View file

@ -0,0 +1,502 @@
# Allow more config/external/ libs built against system-wide version.
diff --git build/moz.configure/old.configure build/moz.configure/old.configure
index d0fe7accffe6..c46bdd023225 100644
--- build/moz.configure/old.configure
+++ build/moz.configure/old.configure
@@ -288,7 +288,12 @@ def old_configure_options(*options):
'--with-system-libvpx',
'--with-system-nspr',
'--with-system-nss',
+ '--with-system-ogg',
'--with-system-png',
+ '--with-system-soundtouch',
+ '--with-system-theora',
+ '--with-system-tremor',
+ '--with-system-vorbis',
'--with-system-zlib',
'--with-thumb',
'--with-thumb-interwork',
diff --git config/Makefile.in config/Makefile.in
index a6206bb0ff30..f20987c61754 100644
--- config/Makefile.in
+++ config/Makefile.in
@@ -51,6 +51,11 @@ export:: $(export-preqs)
-DMOZ_SYSTEM_LIBEVENT=$(MOZ_SYSTEM_LIBEVENT) \
-DMOZ_SYSTEM_LIBVPX=$(MOZ_SYSTEM_LIBVPX) \
-DMOZ_SYSTEM_ICU=$(MOZ_SYSTEM_ICU) \
+ -DMOZ_SYSTEM_OGG=$(MOZ_SYSTEM_OGG) \
+ -DMOZ_SYSTEM_THEORA=$(MOZ_SYSTEM_THEORA) \
+ -DMOZ_SYSTEM_VORBIS=$(MOZ_SYSTEM_VORBIS) \
+ -DMOZ_SYSTEM_TREMOR=$(MOZ_SYSTEM_TREMOR) \
+ -DMOZ_SYSTEM_SOUNDTOUCH=$(MOZ_SYSTEM_SOUNDTOUCH) \
$(srcdir)/system-headers $(srcdir)/stl-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers
$(INSTALL) system_wrappers $(DIST)
diff --git config/external/moz.build config/external/moz.build
index 029ff8504795..2c3a40caa1ba 100644
--- config/external/moz.build
+++ config/external/moz.build
@@ -21,12 +21,21 @@ if CONFIG['MOZ_UPDATER']:
external_dirs += ['modules/brotli']
external_dirs += ['modules/woff2']
-if CONFIG['MOZ_VORBIS']:
+if not CONFIG['MOZ_SYSTEM_OGG']:
+ external_dirs += ['media/libogg']
+
+if CONFIG['MOZ_VORBIS'] and not CONFIG['MOZ_SYSTEM_VORBIS']:
external_dirs += ['media/libvorbis']
-if CONFIG['MOZ_TREMOR']:
+if CONFIG['MOZ_TREMOR'] and not CONFIG['MOZ_SYSTEM_TREMOR']:
external_dirs += ['media/libtremor']
+if not CONFIG['MOZ_SYSTEM_THEORA']:
+ external_dirs += ['media/libtheora']
+
+if not CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
+ external_dirs += ['media/libsoundtouch']
+
if CONFIG['MOZ_WEBM_ENCODER']:
external_dirs += ['media/libmkv']
@@ -52,12 +61,9 @@ external_dirs += [
'media/kiss_fft',
'media/libcubeb',
'media/libnestegg',
- 'media/libogg',
'media/libopus',
- 'media/libtheora',
'media/libspeex_resampler',
'media/libstagefright',
- 'media/libsoundtouch',
'media/psshparser'
]
diff --git config/system-headers config/system-headers
index 5ee7f71f9634..13178ac3b3ab 100644
--- config/system-headers
+++ config/system-headers
@@ -1348,3 +1348,17 @@ unicode/utypes.h
libutil.h
unwind.h
fenv.h
+#if MOZ_SYSTEM_OGG==1
+ogg/ogg.h
+ogg/os_types.h
+#endif
+#if MOZ_SYSTEM_THEORA==1
+theora/theoradec.h
+#endif
+#if MOZ_SYSTEM_VORBIS==1
+vorbis/codec.h
+vorbis/vorbisenc.h
+#endif
+#if MOZ_SYSTEM_TREMOR==1
+tremor/ivorbiscodec.h
+#endif
diff --git dom/media/AudioStream.cpp dom/media/AudioStream.cpp
index 93ecda4319af..ff674c64ea07 100644
--- dom/media/AudioStream.cpp
+++ dom/media/AudioStream.cpp
@@ -115,7 +115,9 @@ AudioStream::AudioStream(DataSource& aSource)
: mMonitor("AudioStream")
, mChannels(0)
, mOutChannels(0)
+#ifndef MOZ_SYSTEM_SOUNDTOUCH
, mTimeStretcher(nullptr)
+#endif
, mDumpFile(nullptr)
, mState(INITIALIZED)
, mDataSource(aSource)
@@ -135,9 +137,11 @@ AudioStream::~AudioStream()
if (mDumpFile) {
fclose(mDumpFile);
}
+#ifndef MOZ_SYSTEM_SOUNDTOUCH
if (mTimeStretcher) {
soundtouch::destroySoundTouchObj(mTimeStretcher);
}
+#endif
#if defined(XP_WIN)
if (XRE_IsContentProcess()) {
audio::AudioNotificationReceiver::Unregister(this);
@@ -151,7 +155,11 @@ nsresult AudioStream::EnsureTimeStretcherInitializedUnlocked()
{
mMonitor.AssertCurrentThreadOwns();
if (!mTimeStretcher) {
+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+ mTimeStretcher = new soundtouch::SoundTouch();
+#else
mTimeStretcher = soundtouch::createSoundTouchObj();
+#endif
mTimeStretcher->setSampleRate(mAudioClock.GetInputRate());
mTimeStretcher->setChannels(mOutChannels);
mTimeStretcher->setPitch(1.0);
diff --git dom/media/AudioStream.h dom/media/AudioStream.h
index 7dc1f60f95cc..67d402a4117f 100644
--- dom/media/AudioStream.h
+++ dom/media/AudioStream.h
@@ -16,7 +16,11 @@
#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h"
#include "CubebUtils.h"
+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+#include "soundtouch/SoundTouch.h"
+#else
#include "soundtouch/SoundTouchFactory.h"
+#endif
namespace mozilla {
@@ -287,7 +291,11 @@ private:
uint32_t mChannels;
uint32_t mOutChannels;
AudioClock mAudioClock;
+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+ nsAutoPtr<soundtouch::SoundTouch> mTimeStretcher;
+#else
soundtouch::SoundTouch* mTimeStretcher;
+#endif
// Output file for dumping audio
FILE* mDumpFile;
diff --git dom/media/moz.build dom/media/moz.build
index 86b051c58d33..fb6186dce78b 100644
--- dom/media/moz.build
+++ dom/media/moz.build
@@ -308,6 +308,21 @@ if CONFIG['MOZ_WEBRTC']:
DEFINES['MOZILLA_INTERNAL_API'] = True
+if CONFIG['MOZ_SYSTEM_OGG']:
+ CXXFLAGS += CONFIG['MOZ_OGG_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_THEORA']:
+ CXXFLAGS += CONFIG['MOZ_THEORA_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_VORBIS']:
+ CXXFLAGS += CONFIG['MOZ_VORBIS_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_TREMOR']:
+ CXXFLAGS += CONFIG['MOZ_TREMOR_CFLAGS']
+
+if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
+ CXXFLAGS += CONFIG['MOZ_SOUNDTOUCH_CFLAGS']
+
if CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['WEBRTC_WIN'] = True
else:
diff --git dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
index 078f6ea5ef60..c600db067539 100644
--- dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
+++ dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
@@ -11,9 +11,13 @@
#include "prmem.h"
#include "prlink.h"
+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+#include "nsXPCOMPrivate.h" // for XUL_DLL
+#else
// We use a known symbol located in lgpllibs to determine its location.
// soundtouch happens to be always included in lgpllibs
#include "soundtouch/SoundTouch.h"
+#endif
namespace mozilla {
@@ -50,6 +54,12 @@ FFVPXRuntimeLinker::Init()
sLinkStatus = LinkStatus_FAILED;
+#ifdef MOZ_SYSTEM_SOUNDTOUCH
+ // We retrieve the path of the XUL library as this is where mozavcodec and
+ // mozavutil libs are located.
+ char* path =
+ PR_GetLibraryFilePathname(XUL_DLL, (PRFuncPtr)&FFVPXRuntimeLinker::Init);
+#else
// We retrieve the path of the lgpllibs library as this is where mozavcodec
// and mozavutil libs are located.
char* lgpllibsname = PR_GetLibraryName(nullptr, "lgpllibs");
@@ -60,6 +70,7 @@ FFVPXRuntimeLinker::Init()
PR_GetLibraryFilePathname(lgpllibsname,
(PRFuncPtr)&soundtouch::SoundTouch::getVersionId);
PR_FreeLibraryName(lgpllibsname);
+#endif
if (!path) {
return false;
}
diff --git media/libogg/README_MOZILLA media/libogg/README_MOZILLA
index 6213fdc7770c..ada799916a17 100644
--- media/libogg/README_MOZILLA
+++ media/libogg/README_MOZILLA
@@ -6,3 +6,6 @@ package downloaded from xiph.org and copied using the update.sh script.
The int-types.patch address a bug that config_types.h generated from
Linux platform can't be used on OpenSolaris directly see Mozilla bug
449754
+
+The in-tree copy may be omitted during build by --with-system-ogg.
+Keep version in old-configure.in in sync on updates.
diff --git media/libsoundtouch/README_MOZILLA media/libsoundtouch/README_MOZILLA
index dc0dbe8f6886..ea73b55e3e39 100644
--- media/libsoundtouch/README_MOZILLA
+++ media/libsoundtouch/README_MOZILLA
@@ -6,3 +6,5 @@ The whole library is not used, only the relevant files are imported in the tree,
using the script `update.sh`. Some changes have been made to the files, using
the patch `moz-libsoundtouch.patch`. We also use a custom soundtouch_config.h.
+The in-tree copy may be omitted during build by --with-system-soundtouch.
+Keep version in old-configure.in in sync on updates.
diff --git media/libsoundtouch/src/soundtouch_perms.h media/libsoundtouch/src/soundtouch_perms.h
index 0af2fe618311..10973564e7a4 100644
--- media/libsoundtouch/src/soundtouch_perms.h
+++ media/libsoundtouch/src/soundtouch_perms.h
@@ -12,7 +12,9 @@
#pragma GCC visibility push(default)
#include "SoundTouch.h"
+#ifndef MOZ_SYSTEM_SOUNDTOUCH
#include "SoundTouchFactory.h"
+#endif
#pragma GCC visibility pop
#endif // MOZILLA_SOUNDTOUCH_PERMS_H
diff --git media/libtheora/README_MOZILLA media/libtheora/README_MOZILLA
index d48dbfa6f63d..6f30f250220e 100644
--- media/libtheora/README_MOZILLA
+++ media/libtheora/README_MOZILLA
@@ -3,3 +3,6 @@ using the update.sh script. The changes made were those applied by update.sh,
the addition/update of Makefile.in files for the Mozilla build system.
The subversion revision used was r17578.
+
+The in-tree copy may be omitted during build by --with-system-theora.
+Keep version in old-configure.in in sync on updates.
diff --git media/libtheora/moz.build media/libtheora/moz.build
index c7f85eebff95..aae7b814adb5 100644
--- media/libtheora/moz.build
+++ media/libtheora/moz.build
@@ -21,6 +21,9 @@ FINAL_LIBRARY = 'gkmedias'
# The encoder is currently not included.
DEFINES['THEORA_DISABLE_ENCODE'] = True
+if CONFIG['MOZ_SYSTEM_OGG']:
+ CFLAGS += CONFIG['MOZ_OGG_CFLAGS']
+
# Suppress warnings in third-party code.
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
CFLAGS += ['-Wno-type-limits']
diff --git media/libtremor/README_MOZILLA media/libtremor/README_MOZILLA
index ee67b53a05c5..81c971773d55 100644
--- media/libtremor/README_MOZILLA
+++ media/libtremor/README_MOZILLA
@@ -5,3 +5,6 @@ Makefile.in files for the Mozilla build system.
The upstream release used was http://svn.xiph.org/trunk/Tremor/
The subversion revision used was r17547.
+
+The in-tree copy may be omitted during build by --with-system-tremor.
+Keep version in old-configure.in in sync on updates.
diff --git media/libtremor/moz.build media/libtremor/moz.build
index 83afc8e37c64..71ef159da3d7 100644
--- media/libtremor/moz.build
+++ media/libtremor/moz.build
@@ -9,3 +9,5 @@ with Files('*'):
DIRS += ['include/tremor', 'lib']
+if CONFIG['MOZ_SYSTEM_OGG']:
+ CFLAGS += CONFIG['MOZ_OGG_CFLAGS']
diff --git media/libvorbis/README_MOZILLA media/libvorbis/README_MOZILLA
index 1211ac074b33..eb31084aed25 100644
--- media/libvorbis/README_MOZILLA
+++ media/libvorbis/README_MOZILLA
@@ -8,3 +8,6 @@ https://svn.xiph.org/tags/vorbis/libvorbis-1.3.5@19464
Some files are renamed during the copy to prevent clashes with object
file names with other Mozilla libraries.
+
+The in-tree copy may be omitted during build by --with-system-vorbis.
+Keep version in old-configure.in in sync on updates.
diff --git media/libvorbis/moz.build media/libvorbis/moz.build
index adf393782cc9..923b76231107 100644
--- media/libvorbis/moz.build
+++ media/libvorbis/moz.build
@@ -56,3 +56,6 @@ FINAL_LIBRARY = 'gkmedias'
# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
CFLAGS += ['-Wno-uninitialized']
+
+if CONFIG['MOZ_SYSTEM_OGG']:
+ CFLAGS += CONFIG['MOZ_OGG_CFLAGS']
diff --git old-configure.in old-configure.in
index b614eef85c89..85f9099dba4d 100644
--- old-configure.in
+++ old-configure.in
@@ -2941,6 +2941,111 @@ if test -n "$MOZ_OMX_PLUGIN"; then
fi
fi
+dnl ========================================================
+dnl Check for libogg
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-ogg,
+[ --with-system-ogg Use system libogg (located with pkgconfig)],
+MOZ_SYSTEM_OGG=1,
+MOZ_SYSTEM_OGG=)
+
+if test -n "$MOZ_SYSTEM_OGG"; then
+ PKG_CHECK_MODULES(MOZ_OGG, ogg >= 1.3.0)
+
+ _SAVE_LIBS=$LIBS
+ LIBS="$LIBS $MOZ_OGG_LIBS"
+ AC_CHECK_FUNC(ogg_set_mem_functions, [],
+ [AC_DEFINE(MOZ_OGG_NO_MEM_REPORTING)])
+ LIBS=$_SAVE_LIBS
+fi
+
+AC_SUBST(MOZ_SYSTEM_OGG)
+
+dnl ========================================================
+dnl Check for libvorbis
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-vorbis,
+[ --with-system-vorbis Use system libvorbis (located with pkgconfig)],
+MOZ_SYSTEM_VORBIS=1,
+MOZ_SYSTEM_VORBIS=)
+
+if test -n "$MOZ_SYSTEM_VORBIS"; then
+ PKG_CHECK_MODULES(MOZ_VORBIS, vorbis vorbisenc >= 1.3.5)
+fi
+
+AC_SUBST(MOZ_SYSTEM_VORBIS)
+
+dnl ========================================================
+dnl Check for integer-only libvorbis aka tremor
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-tremor,
+[ --with-system-tremor Use system libtremor (located with pkgconfig)],
+MOZ_SYSTEM_TREMOR=1,
+MOZ_SYSTEM_TREMOR=)
+
+if test -n "$MOZ_SYSTEM_TREMOR"; then
+ PKG_CHECK_MODULES(MOZ_TREMOR, vorbisidec >= 1.2.1)
+fi
+
+AC_SUBST(MOZ_SYSTEM_TREMOR)
+
+dnl ========================================================
+dnl Check for libtheora
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-theora,
+[ --with-system-theora Use system libtheora (located with pkgconfig)],
+MOZ_SYSTEM_THEORA=1,
+MOZ_SYSTEM_THEORA=)
+
+if test -n "$MOZ_SYSTEM_THEORA"; then
+ PKG_CHECK_MODULES(MOZ_THEORA, theora >= 1.2)
+fi
+
+AC_SUBST(MOZ_SYSTEM_THEORA)
+
+dnl ========================================================
+dnl Check for libSoundTouch
+dnl ========================================================
+
+MOZ_ARG_WITH_BOOL(system-soundtouch,
+[ --with-system-soundtouch Use system libSoundTouch (located with pkgconfig)],
+MOZ_SYSTEM_SOUNDTOUCH=1,
+MOZ_SYSTEM_SOUNDTOUCH=)
+
+if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
+ PKG_CHECK_MODULES(MOZ_SOUNDTOUCH, soundtouch >= 1.9.0)
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ _SAVE_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $MOZ_SOUNDTOUCH_CFLAGS"
+ AC_CACHE_CHECK(for soundtouch sample type,
+ ac_cv_soundtouch_sample_type,
+ [AC_TRY_COMPILE([#include <SoundTouch.h>
+ #ifndef SOUNDTOUCH_INTEGER_SAMPLES
+ #error soundtouch expects float samples
+ #endif],
+ [],
+ [ac_cv_soundtouch_sample_type=short],
+ [ac_cv_soundtouch_sample_type=float])])
+ CXXFLAGS=$_SAVE_CXXFLAGS
+ AC_LANG_RESTORE
+
+ if test \( -n "$MOZ_SAMPLE_TYPE_S16" -a "$ac_cv_soundtouch_sample_type" != short \) \
+ -o \( -n "$MOZ_SAMPLE_TYPE_FLOAT32" -a "$ac_cv_soundtouch_sample_type" != float \) ; then
+ AC_MSG_ERROR([SoundTouch library is built with incompatible sample type. Either rebuild the library with/without --enable-integer-samples, chase default Mozilla sample type or remove --with-system-soundtouch.])
+ fi
+fi
+
+if test -n "$MOZ_SYSTEM_SOUNDTOUCH"; then
+ AC_DEFINE(MOZ_SYSTEM_SOUNDTOUCH)
+fi
+AC_SUBST(MOZ_SYSTEM_SOUNDTOUCH)
+
dnl system libvpx Support
dnl ========================================================
MOZ_ARG_WITH_BOOL(system-libvpx,
diff --git toolkit/library/moz.build toolkit/library/moz.build
index 079a575adec3..514d901195de 100644
--- toolkit/library/moz.build
+++ toolkit/library/moz.build
@@ -237,6 +237,21 @@ if CONFIG['MOZ_SYSTEM_HARFBUZZ']:
if CONFIG['MOZ_SYSTEM_HUNSPELL']:
OS_LIBS += CONFIG['MOZ_HUNSPELL_LIBS']
+if CONFIG['MOZ_SYSTEM_OGG']:
+ OS_LIBS += CONFIG['MOZ_OGG_LIBS']
+
+if CONFIG['MOZ_SYSTEM_THEORA']:
+ OS_LIBS += CONFIG['MOZ_THEORA_LIBS']
+
+if CONFIG['MOZ_SYSTEM_VORBIS']:
+ OS_LIBS += CONFIG['MOZ_VORBIS_LIBS']
+
+if CONFIG['MOZ_SYSTEM_TREMOR']:
+ OS_LIBS += CONFIG['MOZ_TREMOR_LIBS']
+
+if CONFIG['MOZ_SYSTEM_SOUNDTOUCH']:
+ OS_LIBS += CONFIG['MOZ_SOUNDTOUCH_LIBS']
+
if CONFIG['MOZ_SYSTEM_LIBEVENT']:
OS_LIBS += CONFIG['MOZ_LIBEVENT_LIBS']
diff --git xpcom/build/XPCOMInit.cpp xpcom/build/XPCOMInit.cpp
index c083ab4bc4f3..62b917043a2c 100644
--- xpcom/build/XPCOMInit.cpp
+++ xpcom/build/XPCOMInit.cpp
@@ -154,7 +154,9 @@ extern nsresult nsStringInputStreamConstructor(nsISupports*, REFNSIID, void**);
#include "mozilla/ipc/GeckoChildProcessHost.h"
+#ifndef MOZ_OGG_NO_MEM_REPORTING
#include "ogg/ogg.h"
+#endif
#if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
#if defined(HAVE_STDINT_H)
// mozilla-config.h defines HAVE_STDINT_H, and then it's defined *again* in
@@ -664,11 +666,13 @@ NS_InitXPCOM2(nsIServiceManager** aResult,
// this oddness.
mozilla::SetICUMemoryFunctions();
+#ifndef MOZ_OGG_NO_MEM_REPORTING
// Do the same for libogg.
ogg_set_mem_functions(OggReporter::CountingMalloc,
OggReporter::CountingCalloc,
OggReporter::CountingRealloc,
OggReporter::CountingFree);
+#endif
#if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
// And for VPX.

24
www/waterfox/pkg-descr Normal file
View file

@ -0,0 +1,24 @@
The Waterfox source code is a specialised modification of the Mozilla
platform, designed for privacy and user choice in mind. You should be
able to install it and compile Waterfox without any issues. Other
modifications and patches that are more upstream have been implemented
as well to fix any compatibility/security issues that Mozilla may lag
behind in implementing (usually due to not being high priority). High
request features removed by Mozilla but wanted by users are retained
(if they aren't removed due to security).
Features:
o Disabled Encrypted Media Extensions (EME)
o Disabled Web Runtime (deprecated as of 2015)
o Removed Pocket
o Removed Telemetry
o Removed data collection
o Removed startup profiling
o Allow running of all 64-Bit NPAPI plugins
o Allow running of unsigned extensions
o Removal of Sponsored Tiles on New Tab Page
o Addition of Duplicate Tab option (toggle with browser.tabs.duplicateTab)
o Locale selector in about:preferences > General
WWW: https://www.waterfoxproject.org/

34
www/waterfox/pkg-message Normal file
View file

@ -0,0 +1,34 @@
======================================================================
Some features available on other platforms are not implemented:
- Native audio (OSS backend is incomplete, doesn't support WebRTC)
- Encrypted Media Extensions (requires Widevine CDM binary)
- Process sandboxing (requires Capsicum backend)
- Reduced memory usage (requires mozjemalloc)
- Performance profiling (requires GeckoProfiler)
- Gamepad API (requires libusbhid backend)
- WebVR (requires open source runtime)
- U2F Security Keys (requires libusbhid backend)
======================================================================
To select non-default audio backend open about:config page and create
media.cubeb.backend preference. Supported values are: alsa, jack,
pulse, pulse-rust, oss, sndio. Currently used backend can be inspected
on about:support page.
======================================================================
smb:// issues (Gvfs/GIO option):
Network group, machine, and share browsing does not work correctly.
sftp:// (Gvfs/GIO option):
Only sftp access using public key authentication works. To easily
setup public key authentication to "remote_host":
ssh-keygen
cat ~/.ssh/id_rsa.pub | ssh remote_host "cat >> .ssh/authorized_keys"
The SSH server on remote_host must allow pub key authentication.
======================================================================