Merge mozilla-central to autoland. a=merge CLOSED TREE

This commit is contained in:
Tiberius Oros 2018-01-18 00:28:57 +02:00
Родитель e32fe8c45c 92e228aa49
Коммит 0f3b1d6ace
212 изменённых файлов: 1623 добавлений и 1604 удалений

Просмотреть файл

@ -4430,6 +4430,9 @@
<certItem issuerName="MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQDExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMw==">
<serialNumber>AwBGo0Zmp6KRryAguuMvXATI</serialNumber>
</certItem>
<certItem issuerName="MHIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJUWDEQMA4GA1UEBxMHSG91c3RvbjEVMBMGA1UEChMMY1BhbmVsLCBJbmMuMS0wKwYDVQQDEyRjUGFuZWwsIEluYy4gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHk=">
<serialNumber>AJk3QFH13eHUHHVnsvwS0Vo=</serialNumber>
</certItem>
<certItem issuerName="MG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3Q=">
<serialNumber>U3t2Vk8pfxTcaUPpIq0seQ==</serialNumber>
</certItem>

Просмотреть файл

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.0.258
Current extension version is: 2.0.274
Taken from upstream commit: 5a52ee0a
Taken from upstream commit: f774abc8

Просмотреть файл

@ -105,7 +105,7 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isNodeJS = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
__w_pdfjs_require__(9);
@ -897,9 +897,6 @@ function isArrayBuffer(v) {
function isSpace(ch) {
return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
}
function isNodeJS() {
return typeof process === 'object' && process + '' === '[object process]';
}
function createPromiseCapability() {
var capability = {};
capability.promise = new Promise(function (resolve, reject) {
@ -1370,7 +1367,6 @@ exports.isEmptyObj = isEmptyObj;
exports.isNum = isNum;
exports.isString = isString;
exports.isSpace = isSpace;
exports.isNodeJS = isNodeJS;
exports.isSameOrigin = isSameOrigin;
exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
exports.isLittleEndian = isLittleEndian;
@ -1936,7 +1932,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
if (worker.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
let apiVersion = '2.0.258';
let apiVersion = '2.0.274';
source.disableRange = (0, _dom_utils.getDefaultSetting)('disableRange');
source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch');
source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream');
@ -3230,8 +3226,8 @@ var InternalRenderTask = function InternalRenderTaskClosure() {
}();
var version, build;
{
exports.version = version = '2.0.258';
exports.build = build = '5a52ee0a';
exports.version = version = '2.0.274';
exports.build = build = 'f774abc8';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -4605,6 +4601,12 @@ var _util = __w_pdfjs_require__(0);
var _dom_utils = __w_pdfjs_require__(1);
var _is_node = __w_pdfjs_require__(18);
var _is_node2 = _interopRequireDefault(_is_node);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var SVGGraphics = function () {
throw new Error('Not implemented: SVGGraphics');
};
@ -4618,8 +4620,8 @@ exports.SVGGraphics = SVGGraphics;
"use strict";
var pdfjsVersion = '2.0.258';
var pdfjsBuild = '5a52ee0a';
var pdfjsVersion = '2.0.274';
var pdfjsBuild = 'f774abc8';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(12);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);
@ -7741,8 +7743,8 @@ if (!_global_scope2.default.PDFJS) {
}
var PDFJS = _global_scope2.default.PDFJS;
{
PDFJS.version = '2.0.258';
PDFJS.build = '5a52ee0a';
PDFJS.version = '2.0.274';
PDFJS.build = 'f774abc8';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -10684,6 +10686,17 @@ var WebGLUtils = function WebGLUtilsClosure() {
}();
exports.WebGLContext = WebGLContext;
/***/ }),
/* 18 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
module.exports = function isNodeJS() {
return typeof process === 'object' && process + '' === '[object process]';
};
/***/ })
/******/ ]);
});

Просмотреть файл

@ -105,7 +105,7 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isNodeJS = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined;
__w_pdfjs_require__(20);
@ -897,9 +897,6 @@ function isArrayBuffer(v) {
function isSpace(ch) {
return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
}
function isNodeJS() {
return typeof process === 'object' && process + '' === '[object process]';
}
function createPromiseCapability() {
var capability = {};
capability.promise = new Promise(function (resolve, reject) {
@ -1370,7 +1367,6 @@ exports.isEmptyObj = isEmptyObj;
exports.isNum = isNum;
exports.isString = isString;
exports.isSpace = isSpace;
exports.isNodeJS = isNodeJS;
exports.isSameOrigin = isSameOrigin;
exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
exports.isLittleEndian = isLittleEndian;
@ -2805,16 +2801,7 @@ var ColorSpace = function ColorSpaceClosure() {
throw new _util.FormatError(`Unknown colorspace name: ${name}`);
}
};
ColorSpace.parseToIR = function (cs, xref, res, pdfFunctionFactory) {
if ((0, _primitives.isName)(cs)) {
var colorSpaces = res.get('ColorSpace');
if ((0, _primitives.isDict)(colorSpaces)) {
var refcs = colorSpaces.get(cs.name);
if (refcs) {
cs = refcs;
}
}
}
ColorSpace.parseToIR = function (cs, xref, res = null, pdfFunctionFactory) {
cs = xref.fetchIfRef(cs);
if ((0, _primitives.isName)(cs)) {
switch (cs.name) {
@ -2830,6 +2817,19 @@ var ColorSpace = function ColorSpaceClosure() {
case 'Pattern':
return ['PatternCS', null];
default:
if ((0, _primitives.isDict)(res)) {
let colorSpaces = res.get('ColorSpace');
if ((0, _primitives.isDict)(colorSpaces)) {
let resCS = colorSpaces.get(cs.name);
if (resCS) {
if ((0, _primitives.isName)(resCS)) {
return ColorSpace.parseToIR(resCS, xref, res, pdfFunctionFactory);
}
cs = resCS;
break;
}
}
}
throw new _util.FormatError(`unrecognized colorspace ${cs.name}`);
}
}
@ -20784,8 +20784,8 @@ exports.PostScriptCompiler = PostScriptCompiler;
"use strict";
var pdfjsVersion = '2.0.258';
var pdfjsBuild = '5a52ee0a';
var pdfjsVersion = '2.0.274';
var pdfjsBuild = 'f774abc8';
var pdfjsCoreWorker = __w_pdfjs_require__(19);
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;
@ -20805,8 +20805,14 @@ var _util = __w_pdfjs_require__(0);
var _pdf_manager = __w_pdfjs_require__(23);
var _is_node = __w_pdfjs_require__(44);
var _is_node2 = _interopRequireDefault(_is_node);
var _primitives = __w_pdfjs_require__(1);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var WorkerTask = function WorkerTaskClosure() {
function WorkerTask(name) {
this.name = name;
@ -20980,7 +20986,7 @@ var WorkerMessageHandler = {
var cancelXHRs = null;
var WorkerTasks = [];
let apiVersion = docParams.apiVersion;
let workerVersion = '2.0.258';
let workerVersion = '2.0.274';
if (apiVersion !== null && apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
}
@ -21357,7 +21363,7 @@ var WorkerMessageHandler = {
function isMessagePort(maybePort) {
return typeof maybePort.postMessage === 'function' && 'onmessage' in maybePort;
}
if (typeof window === 'undefined' && !(0, _util.isNodeJS)() && typeof self !== 'undefined' && isMessagePort(self)) {
if (typeof window === 'undefined' && !(0, _is_node2.default)() && typeof self !== 'undefined' && isMessagePort(self)) {
WorkerMessageHandler.initializeFromPort(self);
}
exports.WorkerTask = WorkerTask;
@ -29023,6 +29029,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
xref: this.xref,
res: resources,
image,
isInline: inline,
pdfFunctionFactory: this.pdfFunctionFactory
});
imgData = imageObj.createImageData(true);
@ -29059,6 +29066,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
xref: this.xref,
res: resources,
image,
isInline: inline,
nativeDecoder: nativeImageDecoder,
pdfFunctionFactory: this.pdfFunctionFactory
}).then(imageObj => {
@ -40305,7 +40313,7 @@ var PDFImage = function PDFImageClosure() {
}
return dest;
}
function PDFImage({ xref, res, image, smask = null, mask = null, isMask = false, pdfFunctionFactory }) {
function PDFImage({ xref, res, image, isInline = false, smask = null, mask = null, isMask = false, pdfFunctionFactory }) {
this.image = image;
var dict = image.dict;
if (dict.has('Filter')) {
@ -40359,7 +40367,8 @@ var PDFImage = function PDFImageClosure() {
throw new Error(`JPX images with ${this.numComps} ` + 'color components not supported.');
}
}
this.colorSpace = _colorspace.ColorSpace.parse(colorSpace, xref, res, pdfFunctionFactory);
let resources = isInline ? res : null;
this.colorSpace = _colorspace.ColorSpace.parse(colorSpace, xref, resources, pdfFunctionFactory);
this.numComps = this.colorSpace.numComps;
}
this.decode = dict.getArray('Decode', 'D');
@ -40381,6 +40390,7 @@ var PDFImage = function PDFImageClosure() {
xref,
res,
image: smask,
isInline,
pdfFunctionFactory
});
} else if (mask) {
@ -40394,6 +40404,7 @@ var PDFImage = function PDFImageClosure() {
xref,
res,
image: mask,
isInline,
isMask: true,
pdfFunctionFactory
});
@ -40403,7 +40414,7 @@ var PDFImage = function PDFImageClosure() {
}
}
}
PDFImage.buildImage = function ({ handler, xref, res, image, nativeDecoder = null, pdfFunctionFactory }) {
PDFImage.buildImage = function ({ handler, xref, res, image, isInline = false, nativeDecoder = null, pdfFunctionFactory }) {
var imagePromise = handleImageData(image, nativeDecoder);
var smaskPromise;
var maskPromise;
@ -40432,6 +40443,7 @@ var PDFImage = function PDFImageClosure() {
xref,
res,
image: imageData,
isInline,
smask: smaskData,
mask: maskData,
pdfFunctionFactory
@ -40763,6 +40775,17 @@ var PDFImage = function PDFImageClosure() {
}();
exports.PDFImage = PDFImage;
/***/ }),
/* 44 */
/***/ (function(module, exports, __w_pdfjs_require__) {
"use strict";
module.exports = function isNodeJS() {
return typeof process === 'object' && process + '' === '[object process]';
};
/***/ })
/******/ ]);
});

Просмотреть файл

@ -4481,6 +4481,9 @@ class PDFHistory {
}
let destination = state.destination;
this._updateInternalState(destination, state.uid, true);
if (this._uid > this._maxUid) {
this._maxUid = this._uid;
}
if (destination.rotation !== undefined) {
this.initialRotation = destination.rotation;
}
@ -4685,6 +4688,9 @@ class PDFHistory {
}
let destination = state.destination;
this._updateInternalState(destination, state.uid, true);
if (this._uid > this._maxUid) {
this._maxUid = this._uid;
}
if ((0, _ui_utils.isValidRotation)(destination.rotation)) {
this.linkService.rotation = destination.rotation;
}
@ -4704,7 +4710,7 @@ class PDFHistory {
_boundEvents.updateViewarea = this._updateViewarea.bind(this);
_boundEvents.popState = this._popState.bind(this);
_boundEvents.pageHide = evt => {
if (!this._destination) {
if (!this._destination || this._destination.temporary) {
this._tryPushCurrentPosition();
}
};

Просмотреть файл

@ -16,6 +16,7 @@ allprojects {
topobjdir = gradle.mozconfig.topobjdir
compileSdkVersion = tryInt(mozconfig.substs.ANDROID_COMPILE_SDK_VERSION)
buildToolsVersion = tryInt(mozconfig.substs.ANDROID_BUILD_TOOLS_VERSION)
targetSdkVersion = tryInt(mozconfig.substs.ANDROID_TARGET_SDK)
minSdkVersion = tryInt(mozconfig.substs.MOZ_ANDROID_MIN_SDK_VERSION)
manifestPlaceholders = [
@ -51,7 +52,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.android.tools.build:gradle:2.3.3'
// Provided in tree.
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.7.3'
}

Просмотреть файл

@ -70,18 +70,28 @@ redistributed publicly.)
Archiving the Gradle executable is straight-forward, but archiving a
local Maven repository is not. Therefore a special Task Cluster
Docker image and toolchain job exist for producing the required
archives. The Docker image definition is rooted in
``taskcluster/docker/android-build``. The Task Cluster toolchain job
is named `android-gradle-dependencies`. The job runs in a container
based on the custom Docker image and spawns a Sonatype Nexus proxying
Maven repository process in the background. The job builds Firefox
for Android using Gradle and the in-tree Gradle configuration rooted
at ``build.gradle``. The spawned proxying Maven repository downloads
external dependencies and collects them. After the Gradle build
completes, the job archives the Gradle version used to build, and the
downloaded Maven repository, and exposes them as Task Cluster
artifacts.
Docker image and job exist for producing the required archives. The
Docker image definition is rooted in
``taskcluster/docker/android-build``. The Task Cluster job
definition is in
``testing/taskcluster/tasks/builds/android_api_16_gradle_dependencies.yml``.
The job runs in a container based on the custom Docker image and
spawns a Sonatype Nexus proxying Maven repository process in the
background. The job builds Firefox for Android using Gradle and the
in-tree Gradle configuration rooted at ``build.gradle``. The spawned
proxying Maven repository downloads external dependencies and collects
them. After the Gradle build completes, the job archives the Gradle
version used to build, and the downloaded Maven repository, and
exposes them as Task Cluster artifacts.
Here is `an example try job fetching these dependencies
<https://treeherder.mozilla.org/#/jobs?repo=try&revision=75bc98935147&selectedJob=17793653>`_.
The resulting task produced a `Gradle archive
<https://queue.taskcluster.net/v1/task/CeYMgAP3Q-KF8h37nMhJjg/runs/0/artifacts/public%2Fbuild%2Fgradle.tar.xz>`_
and a `Maven repository archive
<https://queue.taskcluster.net/v1/task/CeYMgAP3Q-KF8h37nMhJjg/runs/0/artifacts/public%2Fbuild%2Fjcentral.tar.xz>`_.
These archives were then uploaded (manually) to Mozilla automation
using tooltool for consumption in Gradle builds.
To update the version of Gradle in the archive produced, update
``gradle/wrapper/gradle-wrapper.properties``. Be sure to also update
@ -90,18 +100,12 @@ the SHA256 checksum to prevent poisoning the build machines!
To update the versions of Gradle dependencies used, update
``dependencies`` sections in the in-tree Gradle configuration rooted
at ``build.gradle``. Once you are confident your changes build
locally, push a fresh build to try. The `android-gradle-dependencies`
toolchain should run automatically, fetching your new dependencies and
wiring them into the appropriate try build jobs.
locally, push a fresh try build with an invocation like::
To update the version of Sonatype Nexus, update `NEXUS_VERSION` in the
`android-build` Docker image.
$ hg push-to-try -m "try: -b o -p android-api-16-gradle-dependencies"
To modify the Sonatype Nexus configuration, typically to proxy a new
remote Maven repository, modify
`taskcluster/scripts/misc/android-gradle-dependencies/nexus.xml`.
There is also a toolchain job that fetches the Android SDK and related
packages. To update the versions of packaged fetched, modify
`python/mozboot/mozboot/android-packages.txt` and update the various
in-tree versions accordingly.
Then `upload your archives to tooltool
<https://wiki.mozilla.org/ReleaseEngineering/Applications/Tooltool#How_To_Upload_To_Tooltool>`_,
update the in-tree manifests in
``mobile/android/config/tooltool-manifests``, and push a fresh try
build.

Просмотреть файл

@ -21,11 +21,11 @@ const TEST_VIOLATION = "http://example.com/browser/devtools/client/webconsole/"
"new-console-output/test/mochitest/test-cspro.html";
const CSP_VIOLATION_MSG =
"Content Security Policy: The page\u2019s settings blocked the loading of a resource " +
"at http://some.example.com/cspro.png (\u201cimg-src http://example.com\u201d).";
"at http://some.example.com/cspro.png (\u201cimg-src\u201d).";
const CSP_REPORT_MSG =
"Content Security Policy: The page\u2019s settings observed the loading of a " +
"resource at http://some.example.com/cspro.js " +
"(\u201cscript-src http://example.com\u201d). A CSP report is being sent.";
"(\u201cscript-src\u201d). A CSP report is being sent.";
add_task(async function () {
let hud = await openNewTabAndConsole(TEST_URI);

Просмотреть файл

@ -23,11 +23,11 @@ const TEST_VIOLATION = "http://example.com/browser/devtools/client/" +
const CSP_VIOLATION_MSG = "Content Security Policy: The page\u2019s settings " +
"blocked the loading of a resource at " +
"http://some.example.com/test.png " +
"(\u201cimg-src http://example.com\u201d).";
"(\u201cimg-src\u201d).";
const CSP_REPORT_MSG = "Content Security Policy: The page\u2019s settings " +
"observed the loading of a resource at " +
"http://some.example.com/test_bug_1010953_cspro.js " +
"(\u201cscript-src http://example.com\u201d). A CSP report is " +
"(\u201cscript-src\u201d). A CSP report is " +
"being sent.";
add_task(function* () {

Просмотреть файл

@ -13,8 +13,7 @@ const TEST_VIOLATION = "https://example.com/browser/devtools/client/" +
"webconsole/test/test_bug_1247459_violation.html";
const CSP_VIOLATION_MSG = "Content Security Policy: The page\u2019s settings " +
"blocked the loading of a resource at " +
"http://some.example.com/test.png (\u201cimg-src " +
"https://example.com\u201d).";
"http://some.example.com/test.png (\u201cimg-src\u201d).";
add_task(function* () {
let { browser } = yield loadTab(TEST_URI);

Просмотреть файл

@ -12,8 +12,7 @@ const TEST_VIOLATION = "https://example.com/browser/devtools/client/" +
"webconsole/test/test_bug_770099_violation.html";
const CSP_VIOLATION_MSG = "Content Security Policy: The page\u2019s settings " +
"blocked the loading of a resource at " +
"http://some.example.com/test.png (\u201cdefault-src " +
"https://example.com\u201d).";
"http://some.example.com/test.png (\u201cdefault-src\u201d).";
add_task(function* () {
let { browser } = yield loadTab(TEST_URI);

Просмотреть файл

@ -687,7 +687,7 @@ Selection::GetTableSelectionType(nsIDOMRange* aDOMRange,
nsIContent* child = range->GetChildAtStartOffset();
// Not a single selected node
if (!child || child != range->GetChildAtEndOffset()) {
if (!child || child->GetNextSibling() != range->GetChildAtEndOffset()) {
return NS_OK;
}

Просмотреть файл

@ -4,6 +4,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <string>
#include <unordered_set>
#include "nsCOMPtr.h"
#include "nsContentPolicyUtils.h"
#include "nsContentUtils.h"
@ -64,6 +67,29 @@ GetCspContextLog()
static const uint32_t CSP_CACHE_URI_CUTOFF_SIZE = 512;
#ifdef DEBUG
/**
* This function is only used for verification purposes within
* GatherSecurityPolicyViolationEventData.
*/
static bool
ValidateDirectiveName(const nsAString& aDirective)
{
static const auto directives = [] () {
std::unordered_set<std::string> directives;
constexpr size_t dirLen = sizeof(CSPStrDirectives) / sizeof(CSPStrDirectives[0]);
for (size_t i = 0; i < dirLen; ++i) {
directives.insert(CSPStrDirectives[i]);
}
return directives;
} ();
nsAutoString directive(aDirective);
auto itr = directives.find(NS_ConvertUTF16toUTF8(directive).get());
return itr != directives.end();
}
#endif // DEBUG
/**
* Creates a key for use in the ShouldLoad cache.
* Looks like: <uri>!<nsIContentPolicy::LOAD_TYPE>
@ -869,6 +895,8 @@ nsCSPContext::GatherSecurityPolicyViolationEventData(
{
NS_ENSURE_ARG_MAX(aViolatedPolicyIndex, mPolicies.Length() - 1);
MOZ_ASSERT(ValidateDirectiveName(aViolatedDirective), "Invalid directive name");
nsresult rv;
// document-uri
@ -900,12 +928,15 @@ nsCSPContext::GatherSecurityPolicyViolationEventData(
aViolationEventInit.mBlockedURI = NS_ConvertUTF8toUTF16(reportBlockedURI);
}
// violated-directive
aViolationEventInit.mViolatedDirective = aViolatedDirective;
// effective-directive
// The name of the policy directive that was violated.
aViolationEventInit.mEffectiveDirective = aViolatedDirective;
// violated-directive
// In CSP2, the policy directive that was violated, as it appears in the policy.
// In CSP3, the same as effective-directive.
aViolationEventInit.mViolatedDirective = aViolatedDirective;
// original-policy
nsAutoString originalPolicy;
rv = this->GetPolicyString(aViolatedPolicyIndex, originalPolicy);
@ -1216,18 +1247,21 @@ class CSPReportSenderRunnable final : public Runnable
{
MOZ_ASSERT(NS_IsMainThread());
nsresult rv;
// 0) prepare violation data
mozilla::dom::SecurityPolicyViolationEventInit init;
mCSPContext->GatherSecurityPolicyViolationEventData(
rv = mCSPContext->GatherSecurityPolicyViolationEventData(
mBlockedContentSource, mOriginalURI,
mViolatedDirective, mViolatedPolicyIndex,
mSourceFile, mScriptSample, mLineNum,
init);
NS_ENSURE_SUCCESS(rv, rv);
// 1) notify observers
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
NS_ASSERTION(observerService, "needs observer service");
nsresult rv = observerService->NotifyObservers(mObserverSubject,
rv = observerService->NotifyObservers(mObserverSubject,
CSP_VIOLATION_TOPIC,
mViolatedDirective.get());
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -1246,6 +1246,12 @@ bool nsCSPDirective::equals(CSPDirective aDirective) const
return (mDirective == aDirective);
}
void
nsCSPDirective::getDirName(nsAString& outStr) const
{
outStr.AppendASCII(CSP_CSPDirectiveToString(mDirective));
}
/* =============== nsCSPChildSrcDirective ============= */
nsCSPChildSrcDirective::nsCSPChildSrcDirective(CSPDirective aDirective)
@ -1331,6 +1337,13 @@ nsBlockAllMixedContentDirective::toString(nsAString& outStr) const
nsIContentSecurityPolicy::BLOCK_ALL_MIXED_CONTENT));
}
void
nsBlockAllMixedContentDirective::getDirName(nsAString& outStr) const
{
outStr.AppendASCII(CSP_CSPDirectiveToString(
nsIContentSecurityPolicy::BLOCK_ALL_MIXED_CONTENT));
}
/* =============== nsUpgradeInsecureDirective ============= */
nsUpgradeInsecureDirective::nsUpgradeInsecureDirective(CSPDirective aDirective)
@ -1349,6 +1362,13 @@ nsUpgradeInsecureDirective::toString(nsAString& outStr) const
nsIContentSecurityPolicy::UPGRADE_IF_INSECURE_DIRECTIVE));
}
void
nsUpgradeInsecureDirective::getDirName(nsAString& outStr) const
{
outStr.AppendASCII(CSP_CSPDirectiveToString(
nsIContentSecurityPolicy::UPGRADE_IF_INSECURE_DIRECTIVE));
}
/* ===== nsRequireSRIForDirective ========================= */
nsRequireSRIForDirective::nsRequireSRIForDirective(CSPDirective aDirective)
@ -1400,6 +1420,13 @@ nsRequireSRIForDirective::allows(enum CSPKeyword aKeyword, const nsAString& aHas
return (aKeyword != CSP_REQUIRE_SRI_FOR);
}
void
nsRequireSRIForDirective::getDirName(nsAString& outStr) const
{
outStr.AppendASCII(CSP_CSPDirectiveToString(
nsIContentSecurityPolicy::REQUIRE_SRI_FOR));
}
/* ===== nsCSPPolicy ========================= */
nsCSPPolicy::nsCSPPolicy()
@ -1453,7 +1480,7 @@ nsCSPPolicy::permits(CSPDirective aDir,
if (mDirectives[i]->equals(aDir)) {
if (!mDirectives[i]->permits(aUri, aNonce, aWasRedirected, mReportOnly,
mUpgradeInsecDir, aParserCreated)) {
mDirectives[i]->toString(outViolatedDirective);
mDirectives[i]->getDirName(outViolatedDirective);
return false;
}
return true;
@ -1468,7 +1495,7 @@ nsCSPPolicy::permits(CSPDirective aDir,
if (!aSpecific && defaultDir) {
if (!defaultDir->permits(aUri, aNonce, aWasRedirected, mReportOnly,
mUpgradeInsecDir, aParserCreated)) {
defaultDir->toString(outViolatedDirective);
defaultDir->getDirName(outViolatedDirective);
return false;
}
return true;
@ -1595,7 +1622,7 @@ nsCSPPolicy::getDirectiveStringForContentType(nsContentPolicyType aContentType,
nsCSPDirective* defaultDir = nullptr;
for (uint32_t i = 0; i < mDirectives.Length(); i++) {
if (mDirectives[i]->restrictsContentType(aContentType)) {
mDirectives[i]->toString(outDirective);
mDirectives[i]->getDirName(outDirective);
return;
}
if (mDirectives[i]->isDefaultDirective()) {
@ -1605,7 +1632,7 @@ nsCSPPolicy::getDirectiveStringForContentType(nsContentPolicyType aContentType,
// if we haven't found a matching directive yet,
// the contentType must be restricted by the default directive
if (defaultDir) {
defaultDir->toString(outDirective);
defaultDir->getDirName(outDirective);
return;
}
NS_ASSERTION(false, "Can not query directive string for contentType!");

Просмотреть файл

@ -471,6 +471,8 @@ class nsCSPDirective {
bool visitSrcs(nsCSPSrcVisitor* aVisitor) const;
virtual void getDirName(nsAString& outStr) const;
protected:
CSPDirective mDirective;
nsTArray<nsCSPBaseSrc*> mSrcs;
@ -549,6 +551,8 @@ class nsBlockAllMixedContentDirective : public nsCSPDirective {
void addSrcs(const nsTArray<nsCSPBaseSrc*>& aSrcs) override
{ MOZ_ASSERT(false, "block-all-mixed-content does not hold any srcs"); }
void getDirName(nsAString& outStr) const override;
};
/* =============== nsUpgradeInsecureDirective === */
@ -602,6 +606,8 @@ class nsUpgradeInsecureDirective : public nsCSPDirective {
void addSrcs(const nsTArray<nsCSPBaseSrc*>& aSrcs) override
{ MOZ_ASSERT(false, "upgrade-insecure-requests does not hold any srcs"); }
void getDirName(nsAString& outStr) const override;
};
/* ===== nsRequireSRIForDirective ========================= */
@ -619,6 +625,7 @@ class nsRequireSRIForDirective : public nsCSPDirective {
bool restrictsContentType(nsContentPolicyType aType) const override;
bool allows(enum CSPKeyword aKeyword, const nsAString& aHashOrNonce,
bool aParserCreated) const override;
void getDirName(nsAString& outStr) const override;
private:
nsTArray<nsContentPolicyType> mTypes;

Просмотреть файл

@ -23,7 +23,7 @@ function checkResults(reportObj) {
// we can not test for the whole referrer since it includes platform specific information
is(cspReport["referrer"], document.location.toString(), "Incorrect referrer");
is(cspReport["blocked-uri"], document.location.toString(), "Incorrect blocked-uri");
is(cspReport["violated-directive"], "frame-ancestors 'none'", "Incorrect violated-directive");
is(cspReport["violated-directive"], "frame-ancestors", "Incorrect violated-directive");
is(cspReport["original-policy"], "frame-ancestors 'none'; report-uri http://mochi.test:8888/foo.sjs", "Incorrect original-policy");
testResults.reportFired = true;
}

Просмотреть файл

@ -50,7 +50,7 @@ window.checkResults = function(reportObj) {
is(cspReport["blocked-uri"], "self", "Incorrect blocked-uri");
is(cspReport["violated-directive"], "default-src 'none'", "Incorrect violated-directive");
is(cspReport["violated-directive"], "default-src", "Incorrect violated-directive");
is(cspReport["original-policy"], "default-src 'none'; report-uri http://mochi.test:8888/foo.sjs",
"Incorrect original-policy");

Просмотреть файл

@ -50,7 +50,7 @@ function checkResults(reportStr) {
"http://mochi.test:8888/tests/dom/security/test/csp/test_report_for_import.html",
"Incorrect referrer");
is(cspReport["violated-directive"],
"style-src http://mochi.test:8888",
"style-src",
"Incorrect violated-directive");
is(cspReport["original-policy"],
"style-src http://mochi.test:8888; report-uri " +

Просмотреть файл

@ -11,7 +11,7 @@ SpecialPowers.pushPrefEnv({
});
document.addEventListener("securitypolicyviolation", (e) => {
SimpleTest.is(e.blockedURI, "http://mochi.test:8888/foo/bar.jpg", "blockedURI");
SimpleTest.todo_is(e.violatedDirective, "img-src", "violatedDirective")
SimpleTest.is(e.violatedDirective, "img-src", "violatedDirective")
SimpleTest.is(e.originalPolicy, "img-src 'none'", "originalPolicy");
SimpleTest.finish();
});

Просмотреть файл

@ -1566,15 +1566,14 @@ public:
#ifdef MOZ_WIDGET_GTK
static already_AddRefed<ScaledFont>
CreateScaledFontForFontconfigFont(cairo_scaled_font_t* aScaledFont, FcPattern* aPattern,
const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize,
bool aNeedsOblique = false);
const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize);
#endif
#ifdef XP_DARWIN
static already_AddRefed<ScaledFont>
CreateScaledFontForMacFont(CGFontRef aCGFont, const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize,
const Color& aFontSmoothingBackgroundColor, bool aUseFontSmoothing = true,
bool aApplySyntheticBold = false, bool aNeedsOblique = false);
bool aApplySyntheticBold = false);
#endif
/**
@ -1740,7 +1739,6 @@ public:
Float aSize,
bool aUseEmbeddedBitmap,
bool aForceGDIMode,
bool aNeedsOblique,
IDWriteRenderingParams *aParams,
Float aGamma,
Float aContrast);

Просмотреть файл

@ -653,10 +653,9 @@ Factory::CreateScaledFontWithCairo(const NativeFont& aNativeFont,
#ifdef MOZ_WIDGET_GTK
already_AddRefed<ScaledFont>
Factory::CreateScaledFontForFontconfigFont(cairo_scaled_font_t* aScaledFont, FcPattern* aPattern,
const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize,
bool aNeedsOblique)
const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize)
{
return MakeAndAddRef<ScaledFontFontconfig>(aScaledFont, aPattern, aUnscaledFont, aSize, aNeedsOblique);
return MakeAndAddRef<ScaledFontFontconfig>(aScaledFont, aPattern, aUnscaledFont, aSize);
}
#endif
@ -667,13 +666,12 @@ Factory::CreateScaledFontForMacFont(CGFontRef aCGFont,
Float aSize,
const Color& aFontSmoothingBackgroundColor,
bool aUseFontSmoothing,
bool aApplySyntheticBold,
bool aNeedsOblique)
bool aApplySyntheticBold)
{
return MakeAndAddRef<ScaledFontMac>(
aCGFont, aUnscaledFont, aSize, false,
aFontSmoothingBackgroundColor, aUseFontSmoothing,
aApplySyntheticBold, aNeedsOblique);
aApplySyntheticBold);
}
#endif
@ -952,13 +950,12 @@ Factory::CreateScaledFontForDWriteFont(IDWriteFontFace* aFontFace,
float aSize,
bool aUseEmbeddedBitmap,
bool aForceGDIMode,
bool aNeedsOblique,
IDWriteRenderingParams* aParams,
Float aGamma,
Float aContrast)
{
return MakeAndAddRef<ScaledFontDWrite>(aFontFace, aUnscaledFont, aSize,
aUseEmbeddedBitmap, aForceGDIMode, aNeedsOblique,
aUseEmbeddedBitmap, aForceGDIMode,
aParams, aGamma, aContrast,
aStyle);
}

Просмотреть файл

@ -110,7 +110,6 @@ ScaledFontDWrite::ScaledFontDWrite(IDWriteFontFace *aFontFace,
Float aSize,
bool aUseEmbeddedBitmap,
bool aForceGDIMode,
bool aNeedsOblique,
IDWriteRenderingParams* aParams,
Float aGamma,
Float aContrast,
@ -119,7 +118,6 @@ ScaledFontDWrite::ScaledFontDWrite(IDWriteFontFace *aFontFace,
, mFontFace(aFontFace)
, mUseEmbeddedBitmap(aUseEmbeddedBitmap)
, mForceGDIMode(aForceGDIMode)
, mNeedsOblique(aNeedsOblique)
, mParams(aParams)
, mGamma(aGamma)
, mContrast(aContrast)
@ -406,9 +404,6 @@ ScaledFontDWrite::GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutO
if (ForceGDIMode()) {
options.flags |= wr::FontInstanceFlags::FORCE_GDI;
}
if (mNeedsOblique) {
options.flags |= wr::FontInstanceFlags::SYNTHETIC_ITALICS;
}
options.bg_color = wr::ToColorU(Color());
*aOutOptions = Some(options);
return true;
@ -432,7 +427,6 @@ UnscaledFontDWrite::CreateScaledFont(Float aGlyphSize,
new ScaledFontDWrite(mFontFace, this, aGlyphSize,
instanceData->mUseEmbeddedBitmap,
instanceData->mForceGDIMode,
false,
nullptr,
instanceData->mGamma,
instanceData->mContrast);

Просмотреть файл

@ -30,7 +30,6 @@ public:
, mFontFace(aFont)
, mUseEmbeddedBitmap(false)
, mForceGDIMode(false)
, mNeedsOblique(false)
, mGamma(2.2f)
, mContrast(1.0f)
{}
@ -40,7 +39,6 @@ public:
Float aSize,
bool aUseEmbeddedBitmap,
bool aForceGDIMode,
bool aNeedsOblique,
IDWriteRenderingParams *aParams,
Float aGamma,
Float aContrast,
@ -76,7 +74,6 @@ public:
RefPtr<IDWriteFontFace> mFontFace;
bool mUseEmbeddedBitmap;
bool mForceGDIMode;
bool mNeedsOblique;
// DrawTargetD2D1 requires the IDWriteRenderingParams,
// but we also separately need to store the gamma and contrast
// since Skia needs to be able to access these without having

Просмотреть файл

@ -25,11 +25,9 @@ namespace gfx {
ScaledFontFontconfig::ScaledFontFontconfig(cairo_scaled_font_t* aScaledFont,
FcPattern* aPattern,
const RefPtr<UnscaledFont>& aUnscaledFont,
Float aSize,
bool aNeedsOblique)
Float aSize)
: ScaledFontBase(aUnscaledFont, aSize)
, mPattern(aPattern)
, mNeedsOblique(aNeedsOblique)
{
SetCairoScaledFont(aScaledFont);
FcPatternReference(aPattern);
@ -250,10 +248,6 @@ ScaledFontFontconfig::GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* a
platformOptions.lcd_filter = wr::FontLCDFilter::Legacy;
platformOptions.hinting = wr::FontHinting::Normal;
if (mNeedsOblique) {
options.flags |= wr::FontInstanceFlags::SYNTHETIC_ITALICS;
}
FcBool autohint;
if (FcPatternGetBool(mPattern, FC_AUTOHINT, 0, &autohint) == FcResultMatch && autohint) {
options.flags |= wr::FontInstanceFlags::FORCE_AUTOHINT;

Просмотреть файл

@ -22,8 +22,7 @@ class ScaledFontFontconfig : public ScaledFontBase
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontFontconfig, override)
ScaledFontFontconfig(cairo_scaled_font_t* aScaledFont, FcPattern* aPattern,
const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize,
bool aNeedsOblique = false);
const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize);
~ScaledFontFontconfig();
FontType GetType() const override { return FontType::FONTCONFIG; }
@ -76,7 +75,6 @@ private:
NativeFontResource* aNativeFontResource = nullptr);
FcPattern* mPattern;
bool mNeedsOblique;
};
}

Просмотреть файл

@ -111,14 +111,12 @@ ScaledFontMac::ScaledFontMac(CGFontRef aFont,
bool aOwnsFont,
const Color &aFontSmoothingBackgroundColor,
bool aUseFontSmoothing,
bool aApplySyntheticBold,
bool aNeedsOblique)
bool aApplySyntheticBold)
: ScaledFontBase(aUnscaledFont, aSize)
, mFont(aFont)
, mFontSmoothingBackgroundColor(aFontSmoothingBackgroundColor)
, mUseFontSmoothing(aUseFontSmoothing)
, mApplySyntheticBold(aApplySyntheticBold)
, mNeedsOblique(aNeedsOblique)
{
if (!sSymbolLookupDone) {
CTFontDrawGlyphsPtr =
@ -420,9 +418,6 @@ ScaledFontMac::GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutOpti
if (mApplySyntheticBold) {
options.flags |= wr::FontInstanceFlags::SYNTHETIC_BOLD;
}
if (mNeedsOblique) {
options.flags |= wr::FontInstanceFlags::SYNTHETIC_ITALICS;
}
options.bg_color = wr::ToColorU(mFontSmoothingBackgroundColor);
*aOutOptions = Some(options);
return true;

Просмотреть файл

@ -29,8 +29,7 @@ public:
bool aOwnsFont = false,
const Color &aFontSmoothingBackgroundColor = Color(),
bool aUseFontSmoothing = true,
bool aApplySyntheticBold = false,
bool aNeedsOblique = false);
bool aApplySyntheticBold = false);
~ScaledFontMac();
FontType GetType() const override { return FontType::MAC; }
@ -60,7 +59,6 @@ private:
Color mFontSmoothingBackgroundColor;
bool mUseFontSmoothing;
bool mApplySyntheticBold;
bool mNeedsOblique;
typedef void (CTFontDrawGlyphsFuncT)(CTFontRef,
const CGGlyph[], const CGPoint[],

Просмотреть файл

@ -45,7 +45,7 @@ struct LayerManagerData {
static already_AddRefed<Compositor> CreateTestCompositor(LayersBackend backend, widget::CompositorWidget* widget)
{
gfxPrefs::GetSingleton();
gfxPlatform::GetPlatform();
RefPtr<Compositor> compositor;

Просмотреть файл

@ -54,7 +54,10 @@ CreateTextureWithBackend(LayersBackend& aLayersBackend,
static void
GetPlatformBackends(nsTArray<LayersBackend>& aBackends)
{
gfxPlatform::GetPlatform()->GetCompositorBackends(
gfxPlatform* platform = gfxPlatform::GetPlatform();
MOZ_ASSERT(platform);
platform->GetCompositorBackends(
gfxConfig::IsEnabled(Feature::HW_COMPOSITING), aBackends);
if (aBackends.IsEmpty()) {

Просмотреть файл

@ -686,7 +686,6 @@ gfxDWriteFont::GetScaledFont(mozilla::gfx::DrawTarget *aTarget)
GetAdjustedSize(),
useEmbeddedBitmap,
forceGDI,
IsSyntheticOblique(),
params,
params->GetGamma(),
params->GetEnhancedContrast());

Просмотреть файл

@ -1308,8 +1308,7 @@ gfxFontconfigFont::GetScaledFont(mozilla::gfx::DrawTarget *aTarget)
Factory::CreateScaledFontForFontconfigFont(GetCairoScaledFont(),
GetPattern(),
GetUnscaledFont(),
GetAdjustedSize(),
IsSyntheticOblique());
GetAdjustedSize());
}
RefPtr<ScaledFont> scaledFont(mAzureScaledFont);

Просмотреть файл

@ -1839,8 +1839,8 @@ gfxFont::DrawGlyphs(const gfxShapedText* aShapedText,
&aShapedText->GetCharacterGlyphs()[aOffset];
if (S == SpacingT::HasSpacing) {
float space = aBuffer.mRunParams.spacing[0].mBefore;
inlineCoord += aBuffer.mRunParams.isRTL ? - space : space;
float space = aBuffer.mRunParams.spacing[0].mBefore * aBuffer.mFontParams.advanceDirection;
inlineCoord += space;
}
// Allocate buffer space for the run, assuming all simple glyphs.
@ -1851,9 +1851,9 @@ gfxFont::DrawGlyphs(const gfxShapedText* aShapedText,
for (uint32_t i = 0; i < aCount; ++i, ++glyphData) {
if (glyphData->IsSimpleGlyph()) {
float advance = glyphData->GetSimpleAdvance();
float advance = glyphData->GetSimpleAdvance() * aBuffer.mFontParams.advanceDirection;
if (aBuffer.mRunParams.isRTL) {
inlineCoord -= advance;
inlineCoord += advance;
}
DrawOneGlyph<FC>(glyphData->GetSimpleGlyph(), *aPt, aBuffer,
&emittedGlyphs);
@ -1869,9 +1869,9 @@ gfxFont::DrawGlyphs(const gfxShapedText* aShapedText,
aShapedText->GetDetailedGlyphs(aOffset + i);
MOZ_ASSERT(details, "missing DetailedGlyph!");
for (uint32_t j = 0; j < glyphCount; ++j, ++details) {
float advance = details->mAdvance;
float advance = details->mAdvance * aBuffer.mFontParams.advanceDirection;
if (aBuffer.mRunParams.isRTL) {
inlineCoord -= advance;
inlineCoord += advance;
}
if (glyphData->IsMissing()) {
if (!DrawMissingGlyph(aBuffer.mRunParams,
@ -1896,7 +1896,8 @@ gfxFont::DrawGlyphs(const gfxShapedText* aShapedText,
if (i + 1 < aCount) {
space += aBuffer.mRunParams.spacing[i + 1].mBefore;
}
inlineCoord += aBuffer.mRunParams.isRTL ? -space : space;
space *= aBuffer.mFontParams.advanceDirection;
inlineCoord += space;
}
}
@ -2014,7 +2015,7 @@ gfxFont::DrawMissingGlyph(const TextRunDrawParams& aRunParams,
// of the drawTarget's transform, we need to undo
// this before drawing the hexbox. (Bug 983985)
gfxContextMatrixAutoSaveRestore matrixRestore;
if (aFontParams.needsOblique && !aFontParams.isVerticalFont && !textDrawer) {
if (aFontParams.needsOblique && !textDrawer) {
matrixRestore.SetContext(aRunParams.context);
gfx::Matrix mat =
aRunParams.context->CurrentMatrix().
@ -2108,36 +2109,85 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
fontParams.haveColorGlyphs = GetFontEntry()->TryGetColorGlyphs();
fontParams.contextPaint = aRunParams.runContextPaint;
fontParams.isVerticalFont =
aOrientation == gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
bool sideways = false;
if (textDrawer) {
fontParams.isVerticalFont = aRunParams.isVerticalRun;
} else {
fontParams.isVerticalFont =
aOrientation == gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
}
gfxContextMatrixAutoSaveRestore matrixRestore;
layout::TextDrawTarget::AutoRestoreWRGlyphFlags glyphFlagsRestore;
// Save the current baseline offset for restoring later, in case it is modified.
float& baseline = fontParams.isVerticalFont ? aPt->x : aPt->y;
float origBaseline = baseline;
// The point may be advanced in local-space, while the resulting point on return
// must be advanced in transformed space. So save the original point so we can
// properly transform the advance later.
gfx::Point origPt = *aPt;
if (aRunParams.isVerticalRun && !fontParams.isVerticalFont) {
// Default to advancing along the +X direction (-X if RTL).
fontParams.advanceDirection = aRunParams.isRTL ? -1.0f : 1.0f;
// Default to offsetting baseline downward along the +Y direction.
float baselineDir = 1.0f;
// The direction of sideways rotation, if applicable.
// -1 for rotating left/counter-clockwise
// 1 for rotating right/clockwise
// 0 for no rotation
float sidewaysDir =
(aOrientation == gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT ?
-1.0f :
(aOrientation == gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT ?
1.0f : 0.0f));
// If we're rendering a sideways run, we need to push a rotation transform to the context.
if (sidewaysDir != 0.0f) {
if (textDrawer) {
textDrawer->FoundUnsupportedFeature();
return;
}
// For WebRender, we can't use a DrawTarget transform and must instead use flags
// that locally transform the glyph, without affecting the glyph origin. The glyph
// origins must thus be offset in the transformed directions (instead of local-space
// directions). Modify the advance and baseline directions to account for the
// indicated transform.
sideways = true;
matrixRestore.SetContext(aRunParams.context);
gfxPoint p(aPt->x * aRunParams.devPerApp,
aPt->y * aRunParams.devPerApp);
const Metrics& metrics = GetMetrics(eHorizontal);
// Get a matrix we can use to draw the (horizontally-shaped) textrun
// with 90-degree CW rotation.
const gfxFloat
rotation = (aOrientation ==
gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT)
? -M_PI / 2.0 : M_PI / 2.0;
gfxMatrix mat =
aRunParams.context->CurrentMatrixDouble().
PreTranslate(p). // translate origin for rotation
PreRotate(rotation). // turn 90deg CCW (sideways-left) or CW (*-right)
PreTranslate(-p); // undo the translation
// The default text orientation is down being +Y and right being +X.
// Rotating 90 degrees left/CCW makes down be +X and right be -Y.
// Rotating 90 degrees right/CW makes down be -X and right be +Y.
// Thus the advance direction (moving right) is just sidewaysDir,
// i.e. negative along Y axis if rotated left and positive if
// rotated right.
fontParams.advanceDirection *= sidewaysDir;
// The baseline direction (moving down) is negated relative to the
// advance direction for sideways transforms.
baselineDir *= -sidewaysDir;
glyphFlagsRestore.Save(textDrawer);
// Set the transform flags accordingly. Both sideways rotations transpose X and Y,
// while left rotation flips the resulting Y axis, and right rotation flips the
// resulting X axis.
textDrawer->SetWRGlyphFlags(textDrawer->GetWRGlyphFlags() |
wr::FontInstanceFlags::TRANSPOSE |
(aOrientation ==
gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT ?
wr::FontInstanceFlags::FLIP_Y :
wr::FontInstanceFlags::FLIP_X));
} else {
// For non-WebRender targets, just push a rotation transform.
matrixRestore.SetContext(aRunParams.context);
gfxPoint p(aPt->x * aRunParams.devPerApp,
aPt->y * aRunParams.devPerApp);
// Get a matrix we can use to draw the (horizontally-shaped) textrun
// with 90-degree CW rotation.
const gfxFloat rotation = sidewaysDir * M_PI / 2.0f;
gfxMatrix mat =
aRunParams.context->CurrentMatrixDouble().
PreTranslate(p). // translate origin for rotation
PreRotate(rotation). // turn 90deg CCW (sideways-left) or CW (*-right)
PreTranslate(-p); // undo the translation
aRunParams.context->SetMatrixDouble(mat);
}
// If we're drawing rotated horizontal text for an element styled
// text-orientation:mixed, the dominant baseline will be vertical-
@ -2149,28 +2199,33 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
// those if available.
// [1] See http://www.microsoft.com/typography/otspec/base.htm
if (aTextRun->UseCenterBaseline()) {
gfxPoint baseAdj(0, (metrics.emAscent - metrics.emDescent) / 2);
mat.PreTranslate(baseAdj);
const Metrics& metrics = GetMetrics(eHorizontal);
float baseAdj = (metrics.emAscent - metrics.emDescent) / 2;
baseline += baseAdj * aTextRun->GetAppUnitsPerDevUnit() * baselineDir;
}
aRunParams.context->SetMatrixDouble(mat);
}
if (fontParams.needsOblique && !fontParams.isVerticalFont && !textDrawer) {
// Adjust matrix for synthetic-oblique, except if we're doing vertical-
// upright text, in which case this will be handled for each glyph
// individually in DrawOneGlyph.
if (!matrixRestore.HasMatrix()) {
matrixRestore.SetContext(aRunParams.context);
if (fontParams.needsOblique) {
if (textDrawer) {
glyphFlagsRestore.Save(textDrawer);
textDrawer->SetWRGlyphFlags(textDrawer->GetWRGlyphFlags() |
wr::FontInstanceFlags::SYNTHETIC_ITALICS);
} else if (!fontParams.isVerticalFont) {
// Adjust matrix for synthetic-oblique, except if we're doing vertical-
// upright text, in which case this will be handled for each glyph
// individually in DrawOneGlyph.
if (!matrixRestore.HasMatrix()) {
matrixRestore.SetContext(aRunParams.context);
}
gfx::Point p(aPt->x * aRunParams.devPerApp,
aPt->y * aRunParams.devPerApp);
gfx::Matrix mat =
aRunParams.context->CurrentMatrix().
PreTranslate(p).
PreMultiply(gfx::Matrix(1, 0, -OBLIQUE_SKEW_FACTOR, 1, 0, 0)).
PreTranslate(-p);
aRunParams.context->SetMatrix(mat);
}
gfx::Point p(aPt->x * aRunParams.devPerApp,
aPt->y * aRunParams.devPerApp);
gfx::Matrix mat =
aRunParams.context->CurrentMatrix().
PreTranslate(p).
PreMultiply(gfx::Matrix(1, 0, -OBLIQUE_SKEW_FACTOR, 1, 0, 0)).
PreTranslate(-p);
aRunParams.context->SetMatrix(mat);
}
RefPtr<SVGContextPaint> contextPaint;
@ -2212,11 +2267,9 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
fontParams.drawOptions.mAntialiasMode = Get2DAAMode(mAntialiasOption);
float& baseline = fontParams.isVerticalFont ? aPt->x : aPt->y;
float origBaseline = baseline;
if (mStyle.baselineOffset != 0.0) {
baseline +=
mStyle.baselineOffset * aTextRun->GetAppUnitsPerDevUnit();
mStyle.baselineOffset * aTextRun->GetAppUnitsPerDevUnit() * baselineDir;
}
bool emittedGlyphs;
@ -2228,7 +2281,7 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
GlyphBufferAzure buffer(aRunParams, fontParams);
if (fontParams.haveSVGGlyphs || fontParams.haveColorGlyphs ||
fontParams.extraStrikes ||
(fontParams.needsOblique && fontParams.isVerticalFont)) {
(fontParams.needsOblique && fontParams.isVerticalFont && !textDrawer)) {
if (aRunParams.spacing) {
emittedGlyphs =
DrawGlyphs<FontComplexityT::ComplexFont,
@ -2268,15 +2321,13 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
aRunParams.dt->SetTransform(oldMat);
aRunParams.dt->SetPermitSubpixelAA(oldSubpixelAA);
if (sideways) {
// adjust updated aPt to account for the transform we were using
if (sidewaysDir != 0.0f && !textDrawer) {
// Adjust updated aPt to account for the transform we were using.
// The advance happened horizontally in local-space, but the transformed
// sideways advance is actually vertical, with sign depending on the
// direction of rotation.
float advance = aPt->x - origPt.x;
if (aOrientation ==
gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT) {
*aPt = gfx::Point(origPt.x, origPt.y - advance);
} else {
*aPt = gfx::Point(origPt.x, origPt.y + advance);
}
*aPt = gfx::Point(origPt.x, origPt.y + advance * sidewaysDir);
}
}

Просмотреть файл

@ -2347,6 +2347,7 @@ struct MOZ_STACK_CLASS FontDrawParams {
mozilla::gfx::Float synBoldOnePixelOffset;
int32_t extraStrikes;
mozilla::gfx::DrawOptions drawOptions;
gfxFloat advanceDirection;
bool isVerticalFont;
bool haveSVGGlyphs;
bool haveColorGlyphs;

Просмотреть файл

@ -509,8 +509,7 @@ gfxMacFont::GetScaledFont(DrawTarget *aTarget)
GetAdjustedSize(),
Color::FromABGR(mFontSmoothingBackgroundColor),
!mStyle.useGrayscaleAntialiasing,
IsSyntheticBold(),
IsSyntheticOblique());
IsSyntheticBold());
if (!mAzureScaledFont) {
return nullptr;
}

Просмотреть файл

@ -51,11 +51,29 @@ struct FontInstanceFlags {
return *this;
}
FontInstanceFlags operator|(uint32_t aBits) {
FontInstanceFlags flags = { bits | aBits };
return flags;
}
FontInstanceFlags& operator&=(uint32_t aBits) {
bits &= aBits;
return *this;
}
FontInstanceFlags operator&(uint32_t aBits) {
FontInstanceFlags flags = { bits & aBits };
return flags;
}
enum : uint32_t {
SYNTHETIC_ITALICS = 1 << 0,
SYNTHETIC_BOLD = 1 << 1,
EMBEDDED_BITMAPS = 1 << 2,
SUBPIXEL_BGR = 1 << 3,
TRANSPOSE = 1 << 4,
FLIP_X = 1 << 5,
FLIP_Y = 1 << 6,
FORCE_GDI = 1 << 16,

Просмотреть файл

@ -1,4 +1,3 @@
org.gradle.parallel=true
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2560M
android.enableAapt2=false

4
gradle/wrapper/gradle-wrapper.properties поставляемый
Просмотреть файл

@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionSha256Sum=5c07b3bac2209fbc98fb1fdf6fd831f72429cdf8c503807404eae03d8c8099e5
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
distributionSha256Sum=ed7e9c8bb41bd10d4c9339c95b2f8b122f5bf13188bd90504a26e0f00b123b0d

Просмотреть файл

@ -90,7 +90,10 @@ class DirReaderLinux {
private:
const int fd_;
unsigned char buf_[512];
union {
linux_dirent dirent_;
unsigned char buf_[512];
};
size_t offset_, size_;
DISALLOW_COPY_AND_ASSIGN(DirReaderLinux);

Просмотреть файл

@ -64,11 +64,16 @@ enum class TraceKind
RegExpShared = 0x4F
};
const static uintptr_t OutOfLineTraceKindMask = 0x07;
static_assert(uintptr_t(JS::TraceKind::BaseShape) & OutOfLineTraceKindMask, "mask bits are set");
static_assert(uintptr_t(JS::TraceKind::JitCode) & OutOfLineTraceKindMask, "mask bits are set");
static_assert(uintptr_t(JS::TraceKind::LazyScript) & OutOfLineTraceKindMask, "mask bits are set");
static_assert(uintptr_t(JS::TraceKind::Scope) & OutOfLineTraceKindMask, "mask bits are set");
static_assert(uintptr_t(JS::TraceKind::RegExpShared) & OutOfLineTraceKindMask, "mask bits are set");
#define ASSERT_TRACE_KIND(tk) \
static_assert((uintptr_t(tk) & OutOfLineTraceKindMask) == OutOfLineTraceKindMask, \
"mask bits are set")
ASSERT_TRACE_KIND(JS::TraceKind::BaseShape);
ASSERT_TRACE_KIND(JS::TraceKind::JitCode);
ASSERT_TRACE_KIND(JS::TraceKind::LazyScript);
ASSERT_TRACE_KIND(JS::TraceKind::Scope);
ASSERT_TRACE_KIND(JS::TraceKind::RegExpShared);
#undef ASSERT_TRACE_KIND
// When this header is imported inside SpiderMonkey, the class definitions are
// available and we can query those definitions to find the correct kind

Просмотреть файл

@ -0,0 +1,2 @@
gczeal(18);
gcslice(3);

Просмотреть файл

@ -0,0 +1,12 @@
enableGeckoProfiling();
class base {}
class derived extends base {
testElem() {
super[ruin()];
}
}
let instance = new derived();
try {
instance.testElem();
} catch { /* don't crash */ }

Просмотреть файл

@ -9820,6 +9820,11 @@ IonBuilder::jsop_getelem_super()
MDefinition* receiver = current->pop();
MDefinition* id = current->pop();
#if defined(JS_CODEGEN_X86)
if (instrumentedProfiling())
return abort(AbortReason::Disable, "profiling functions with GETELEM_SUPER is disabled on x86");
#endif
auto* ins = MGetPropSuperCache::New(alloc(), obj, receiver, id);
current->add(ins);
current->push(ins);

Просмотреть файл

@ -7496,7 +7496,7 @@ GCRuntime::collect(bool nonincrementalByAPI, SliceBudget budget, JS::gcreason::R
gcstats::AutoPhase ap(rt->gc.stats(), gcstats::PhaseKind::TRACE_HEAP);
CheckHeapAfterGC(rt);
}
if (rt->hasZealMode(ZealMode::CheckGrayMarking)) {
if (rt->hasZealMode(ZealMode::CheckGrayMarking) && !isIncrementalGCInProgress()) {
MOZ_RELEASE_ASSERT(CheckGrayMarkingState(rt));
}
#endif

Просмотреть файл

@ -91,6 +91,41 @@ public:
void FoundUnsupportedFeature() { mHasUnsupportedFeatures = true; }
bool HasUnsupportedFeatures() { return mHasUnsupportedFeatures; }
wr::FontInstanceFlags GetWRGlyphFlags() const { return mWRGlyphFlags; }
void SetWRGlyphFlags(wr::FontInstanceFlags aFlags) { mWRGlyphFlags = aFlags; }
class AutoRestoreWRGlyphFlags
{
public:
~AutoRestoreWRGlyphFlags()
{
if (mTarget) {
mTarget->SetWRGlyphFlags(mFlags);
}
}
void Save(TextDrawTarget* aTarget)
{
// This allows for recursive saves, in case the flags need to be modified
// under multiple conditions (i.e. transforms and synthetic italics),
// since the flags will be restored to the first saved value in the
// destructor on scope exit.
if (!mTarget) {
// Only record the first save with the original flags that will be restored.
mTarget = aTarget;
mFlags = aTarget->GetWRGlyphFlags();
} else {
// Ensure that this is actually a recursive save to the same target
MOZ_ASSERT(mTarget == aTarget,
"Recursive save of WR glyph flags to different TextDrawTargets");
}
}
private:
TextDrawTarget* mTarget = nullptr;
wr::FontInstanceFlags mFlags = {0};
};
// This overload just stores the glyphs/font/color.
void
FillGlyphs(ScaledFont* aFont,
@ -134,7 +169,7 @@ public:
wr::GlyphOptions glyphOptions;
glyphOptions.render_mode = wr::ToFontRenderMode(aOptions.mAntialiasMode, GetPermitSubpixelAA());
glyphOptions.flags = 0;
glyphOptions.flags = mWRGlyphFlags;
mManager->WrBridge()->PushGlyphs(mBuilder, glyphs, aFont,
color, mSc, mBoundsRect, mClipRect,
@ -287,6 +322,8 @@ private:
wr::LayerRect mClipRect;
bool mBackfaceVisible;
wr::FontInstanceFlags mWRGlyphFlags = {0};
// The rest of this is dummy implementations of DrawTarget's API
public:
DrawTargetType GetType() const override {

Просмотреть файл

@ -306,13 +306,13 @@ void UpdateASR(nsDisplayItem* aItem,
*
* The basic algorithm is:
*
* For-each item i in the new list:
* For-each item in the new list:
* If the item has a matching item in the old list:
* Remove items from the start of the old list up until we reach an item that also exists in the new list (leaving the matched item in place):
* Remove items from the bottom of the old list until we reach the matching item:
* Add valid items to the merged list, destroy invalid items.
* Add i into the merged list.
* If the start of the old list matches i, remove and destroy it, otherwise mark the old version of i as used.
* Add all remaining valid items from the old list into the merged list, skipping over (and destroying) any that are marked as used.
* Destroy the matching item from the old list.
* Add the item from the new list into the merged list.
* Add all remaining valid items from the old list into the merged list.
*
* If any item has a child display list, then we recurse into the merge
* algorithm once we match up the new/old versions (if present).
@ -320,7 +320,7 @@ void UpdateASR(nsDisplayItem* aItem,
* Example 1:
*
* Old List: A,B,C,D
* Modified List: A,D
* New List: A,D
* Invalidations: C,D
*
* We first match the A items, and add the new one to the merged list.
@ -330,23 +330,10 @@ void UpdateASR(nsDisplayItem* aItem,
*
* Merged List: A,B,D
*
* Example 2 (layout/reftests/retained-dl-zindex-1.html):
* Example 2:
*
* Old List: A, B
* Modified List: B, A
* Invalidations: A
*
* In this example A has been explicitly moved to the back.
*
* We match the B items, but don't copy A since it's invalid, and then add the
* new B into the merged list. We then add A, and we're done.
*
* Merged List: B, A
*
* Example 3:
*
* Old List: A, B
* Modified List: B, A
* New List, B, A
* Invalidations: -
*
* This can happen because a prior merge might have changed the ordering
@ -356,28 +343,6 @@ void UpdateASR(nsDisplayItem* aItem,
* and then add the new B into the merged list. We then add A, and we're done.
*
* Merged List: B, A
*
* Example 4 (layout/reftests/retained-dl-zindex-2.html):
*
* Element A has two elements covering it (B and C), that don't intersect each
* other. We then move C to the back.
*
* The correct initial ordering has B and C after A, in any order.
*
* Old List: A, B, C
* Modified List: C, A
* Invalidations: C
*
* We match the C items, but don't add anything from the old list because A is present
* in both lists. We add C to the merged list, and mark the old version of C as reused.
*
* We then match A, add the new version the merged list and delete the old version.
*
* We then process the remainder of the old list, B is added (since it is valid,
* and hasn't been mark as reused), C is destroyed since it's marked as reused and
* is already present in the merged list.
*
* Merged List: C, A, B
*/
void
RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
@ -442,49 +407,39 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
// The new item has a matching counterpart in the old list that we haven't yet reached,
// so copy all valid items from the old list into the merged list until we get to the
// matched item.
nsDisplayItem* old = nullptr;
while ((old = aOldList->GetBottom()) && old != oldItem) {
if (IsAnyAncestorModified(old->FrameForInvalidation())) {
// The old item is invalid, discard it.
oldListLookup.Remove({ old->Frame(), old->GetPerFrameKey() });
aOldList->RemoveBottom();
old->Destroy(&mBuilder);
} else if (newListLookup.Get({ old->Frame(), old->GetPerFrameKey() })) {
// This old item is also in the new list, but we haven't got to it yet.
// Stop now, and we'll deal with it when we get to the new entry.
break;
} else {
// Recurse into the child list (without a matching new list) to
// ensure that we find and remove any invalidated items.
if (old->GetChildren()) {
nsDisplayList empty;
Maybe<const ActiveScrolledRoot*> containerASRForChildren;
MergeDisplayLists(&empty, old->GetChildren(),
old->GetChildren(), containerASRForChildren);
UpdateASR(old, containerASRForChildren);
old->UpdateBounds(&mBuilder);
if (!oldItem->IsReused()) {
nsDisplayItem* old = nullptr;
while ((old = aOldList->RemoveBottom()) && !IsSameItem(newItem, old)) {
if (IsAnyAncestorModified(old->FrameForInvalidation())) {
// The old item is invalid, discard it.
oldListLookup.Remove({ old->Frame(), old->GetPerFrameKey() });
old->Destroy(&mBuilder);
} else if (newListLookup.Get({ old->Frame(), old->GetPerFrameKey() })) {
// The old item is also in the new list, but we haven't got to it yet.
// Mark that we've found it, and we'll deal with it when we get to the new
// entry.
old->SetReused(true);
} else {
// Recurse into the child list (without a matching new list) to
// ensure that we find and remove any invalidated items.
if (old->GetChildren()) {
nsDisplayList empty;
Maybe<const ActiveScrolledRoot*> containerASRForChildren;
MergeDisplayLists(&empty, old->GetChildren(),
old->GetChildren(), containerASRForChildren);
UpdateASR(old, containerASRForChildren);
old->UpdateBounds(&mBuilder);
}
ReuseItem(old);
}
aOldList->RemoveBottom();
ReuseItem(old);
}
}
bool destroy = false;
if (old == oldItem) {
// If we advanced the old list until the matching item then we can pop
// the matching item off the old list and make sure we clean it up.
aOldList->RemoveBottom();
destroy = true;
} else {
// If we didn't get to the matching item, then mark the old item
// as being reused (since we're adding the new version to the new
// list now) so that we don't add it twice at the end.
oldItem->SetReused(true);
MOZ_ASSERT(old && IsSameItem(newItem, old));
MOZ_ASSERT(old == oldItem);
}
// Recursively merge any child lists, destroy the old item and add
// the new one to the list.
if (!destroy &&
oldItem->GetType() == DisplayItemType::TYPE_LAYER_EVENT_REGIONS &&
if (oldItem->GetType() == DisplayItemType::TYPE_LAYER_EVENT_REGIONS &&
!IsAnyAncestorModified(oldItem->FrameForInvalidation())) {
// Event regions items don't have anything interesting other than
// the lists of regions and frames, so we have no need to use the
@ -504,9 +459,7 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
newItem->UpdateBounds(&mBuilder);
}
if (destroy) {
oldItem->Destroy(&mBuilder);
}
oldItem->Destroy(&mBuilder);
UseItem(newItem);
}
} else {
@ -518,8 +471,7 @@ RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
// Reuse the remaining valid items from the old display list.
while (nsDisplayItem* old = aOldList->RemoveBottom()) {
if (!IsAnyAncestorModified(old->FrameForInvalidation()) &&
!old->IsReused()) {
if (!IsAnyAncestorModified(old->FrameForInvalidation())) {
if (old->GetChildren()) {
// We are calling MergeDisplayLists() to ensure that the display items
// with modified or deleted children will be correctly handled.

Просмотреть файл

@ -8,8 +8,6 @@ skip-if(!retainedDisplayList) == retained-dl-scroll-out-of-view-1.html retained-
skip-if(!retainedDisplayList) == retained-dl-displayport-1.html retained-dl-displayport-1-ref.html
skip-if(!retainedDisplayList) == retained-dl-prerender-transform-1.html retained-dl-prerender-transform-1-ref.html
== retained-dl-wrap-list.html retained-dl-wrap-list-ref.html
== retained-dl-zindex-1.html retained-dl-zindex-1-ref.html
== retained-dl-zindex-2.html retained-dl-zindex-2-ref.html
fuzzy(1,235200) == 1413073.html 1413073-ref.html
== 1416291.html 1416291-ref.html
== 1417601-1.html 1417601-1-ref.html

Просмотреть файл

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 200px;
height: 200px;
position:relative;
will-change: transform;
}
#one {
top:120px;
background-color:blue;
}
#two {
top: -200px;
left: 100px;
background-color:green;
z-index: -1;
}
</style>
</head>
<body>
<div id="one"></div>
<div id="two"></div>
</body>
</html>

Просмотреть файл

@ -1,35 +0,0 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<style>
div {
width: 200px;
height: 200px;
position:relative;
will-change: transform;
}
#one {
top:120px;
background-color:blue;
}
#two {
top: -200px;
left: 100px;
background-color:green;
z-index: 1;
}
</style>
</head>
<body>
<div id="one"></div>
<div id="two"></div>
</body>
<script>
function doTest() {
document.getElementById("two").style.zIndex = -1;
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</html>

Просмотреть файл

@ -1,33 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 200px;
height: 200px;
position:relative;
will-change:transform;
}
#one {
top:120px;
background-color:blue;
}
#two {
top: -200px;
left: 100px;
background-color:green;
}
#three {
top: -180px;
left: 100px;
background-color:red;
z-index: -1;
}
</style>
</head>
<body>
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
</body>
</html>

Просмотреть файл

@ -1,41 +0,0 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<style>
div {
width: 200px;
height: 200px;
position:relative;
will-change:transform;
}
#one {
top:120px;
background-color:blue;
}
#two {
top: -200px;
left: 100px;
background-color:green;
}
#three {
top: -180px;
left: 100px;
background-color:red;
z-index: 1;
}
</style>
</head>
<body>
<div id="one"></div>
<div id="two"></div>
<div id="three"></div>
</body>
<script>
function doTest() {
document.getElementById("three").style.zIndex = -1;
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</html>

Просмотреть файл

@ -111,7 +111,7 @@ fuzzy-if(winWidget,110,1200) css-writing-modes-3/table-column-order-slr-007.xht
fuzzy-if(OSX||winWidget,110,1200) css-writing-modes-3/table-column-order-srl-006.xht
fuzzy-if(OSX||winWidget,75,404) css-writing-modes-3/text-align-v??-0??.xht
fuzzy-if(OSX||winWidget,215,780) css-writing-modes-3/text-baseline-???-00?.xht
fuzzy-if(OSX,15,16) fails-if(webrender) css-writing-modes-3/text-combine-upright-decorations-001.html
fuzzy-if(OSX,15,16) css-writing-modes-3/text-combine-upright-decorations-001.html
fuzzy-if(OSX||winWidget,255,480) css-writing-modes-3/text-indent-v??-0??.xht
fuzzy-if(OSX||winWidget,226,960) css-writing-modes-3/text-orientation-016.xht
fuzzy-if(OSX||winWidget,223,720) css-writing-modes-3/vertical-alignment-*.xht

Просмотреть файл

@ -1073,7 +1073,7 @@ fuzzy-if(OSX||winWidget,215,780) == css-writing-modes-3/text-baseline-vlr-007.xh
fuzzy-if(OSX||winWidget,215,780) == css-writing-modes-3/text-baseline-vrl-002.xht css-writing-modes-3/text-baseline-vrl-002-ref.xht
fuzzy-if(OSX||winWidget,215,780) == css-writing-modes-3/text-baseline-vrl-004.xht css-writing-modes-3/text-baseline-vrl-002-ref.xht
fuzzy-if(OSX||winWidget,215,780) == css-writing-modes-3/text-baseline-vrl-006.xht css-writing-modes-3/text-baseline-vrl-006-ref.xht
fuzzy-if(OSX,15,16) fails-if(webrender) == css-writing-modes-3/text-combine-upright-decorations-001.html css-writing-modes-3/reference/text-combine-upright-decorations-001.html
fuzzy-if(OSX,15,16) == css-writing-modes-3/text-combine-upright-decorations-001.html css-writing-modes-3/reference/text-combine-upright-decorations-001.html
== css-writing-modes-3/text-combine-upright-inherit-all-001.html css-writing-modes-3/reference/text-combine-upright-inherit-all-001.html
== css-writing-modes-3/text-combine-upright-inherit-all-002.html css-writing-modes-3/reference/text-combine-upright-inherit-all-002.html
== css-writing-modes-3/text-combine-upright-layout-rules-001.html css-writing-modes-3/reference/text-combine-upright-layout-rules-001-ref.html

Просмотреть файл

@ -5,14 +5,13 @@ apply plugin: 'checkstyle'
apply plugin: 'com.getkeepsafe.dexcount'
apply plugin: 'findbugs'
apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
dexcount {
format = "tree"
}
android {
compileSdkVersion project.ext.compileSdkVersion
buildToolsVersion project.ext.buildToolsVersion
defaultConfig {
targetSdkVersion project.ext.targetSdkVersion
@ -85,13 +84,35 @@ android {
// want to develop significant new user interface pieces in-tree that don't ship (even in the
// Nightly channel) while under development. A new "skin" flavour allows us to develop such
// pieces in Gradle without changing the mainline configuration.
project.configureProductFlavors.delegate = it
project.configureProductFlavors()
flavorDimensions "audience", "geckoBinaries", "minApi", "skin"
flavorDimensions "audience", "skin"
productFlavors {
// For API 21+ - with pre-dexing, this will be faster for local development.
local {
dimension "audience"
// For pre-dexing, setting `minSdkVersion 21` allows the Android gradle plugin to
// pre-DEX each module and produce an APK that can be tested on
// Android Lollipop without time consuming DEX merging processes.
minSdkVersion 21
dexOptions {
preDexLibraries true
}
}
// For API < 21 - does not support pre-dexing because local development
// is slow in that case.
localOld {
dimension "audience"
}
// Automation builds. We use "official" rather than "automation" to drive these builds down
// the list of configurations that Android Studio offers, thereby making it _not_ the
// default. This avoids a common issue with "omni.ja" not being packed into the default APK
// built and deployed by Android Studio.
official {
dimension "audience"
}
// Since Firefox 57, the mobile user interface has followed the Photon design.
// Before Firefox 57, the user interface followed the Australis design.
photon {
@ -123,8 +144,6 @@ android {
exclude 'org/mozilla/gecko/GeckoMediaPlayer.java'
exclude 'org/mozilla/gecko/GeckoPresentationDisplay.java'
exclude 'org/mozilla/gecko/MediaPlayerManager.java'
exclude 'org/mozilla/gecko/PresentationMediaPlayerManager.java'
exclude 'org/mozilla/gecko/RemotePresentationService.java'
}
if (mozconfig.substs.MOZ_INSTALL_TRACKING) {
@ -143,10 +162,13 @@ android {
exclude 'org/mozilla/gecko/gcm/**/*.java'
exclude 'org/mozilla/gecko/push/**/*.java'
}
srcDir "${project.buildDir}/generated/source/preprocessed_code" // See syncPreprocessedCode.
}
res {
srcDir "${topsrcdir}/${mozconfig.substs.MOZ_BRANDING_DIRECTORY}/res"
srcDir "${project.buildDir}/generated/source/preprocessed_resources" // See syncPreprocessedResources.
srcDir "${topsrcdir}/mobile/android/services/src/main/res"
if (mozconfig.substs.MOZ_CRASHREPORTER) {
srcDir "${topsrcdir}/mobile/android/base/crashreporter/res"
@ -160,6 +182,18 @@ android {
}
}
// Every configuration needs the stub manifest at
// src/main/AndroidManifest.xml and the generated manifest. We can't
// use the main sourceSet without losing the stub, so we cover all the
// configurations by enumerating the buildTypes here.
debug {
manifest.srcFile "${project.buildDir}/generated/source/preprocessed_manifest/AndroidManifest.xml"
}
release {
manifest.srcFile "${project.buildDir}/generated/source/preprocessed_manifest/AndroidManifest.xml"
}
test {
java {
// Bug 1229149 tracks pushing this into a :services Gradle project.
@ -193,9 +227,6 @@ android {
}
testOptions {
// For Robolectric: see https://github.com/robolectric/robolectric/issues/3333#issuecomment-324300418.
unitTests.includeAndroidResources true
unitTests.all {
// We'd like to use (Runtime.runtime.availableProcessors()/2), but
// we have tests that start test servers and the bound ports
@ -206,50 +237,72 @@ android {
}
dependencies {
implementation "com.android.support:support-v4:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
implementation "com.android.support:appcompat-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
implementation "com.android.support:cardview-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
implementation "com.android.support:recyclerview-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
implementation "com.android.support:design:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
implementation "com.android.support:customtabs:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
implementation "com.android.support:palette-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:support-v4:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:appcompat-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:cardview-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:recyclerview-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:design:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:customtabs:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
if (mozconfig.substs.MOZ_NATIVE_DEVICES) {
implementation "com.android.support:mediarouter-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
implementation "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
implementation "com.google.android.gms:play-services-base:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
implementation "com.google.android.gms:play-services-cast:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
compile "com.android.support:mediarouter-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
compile "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
compile "com.google.android.gms:play-services-base:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
compile "com.google.android.gms:play-services-cast:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
}
if (mozconfig.substs.MOZ_INSTALL_TRACKING) {
implementation "com.google.android.gms:play-services-analytics:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
implementation "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
compile "com.google.android.gms:play-services-analytics:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
compile "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
}
if (mozconfig.substs.MOZ_ANDROID_GCM) {
implementation "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
implementation "com.google.android.gms:play-services-base:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
implementation "com.google.android.gms:play-services-gcm:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
implementation "com.google.android.gms:play-services-measurement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
compile "com.google.android.gms:play-services-basement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
compile "com.google.android.gms:play-services-base:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
compile "com.google.android.gms:play-services-gcm:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
compile "com.google.android.gms:play-services-measurement:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
}
// Include LeakCanary in local builds, but not in official builds. Mach
// builds target the official audience, so LeakCanary will not be included
// in any Mach build.
localImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
officialImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
// Include LeakCanary in most gradle based builds. LeakCanary adds about 5k methods, so we disable
// it for the (non-proguarded, non-predex) localOld builds to allow space for other libraries.
// Gradle based tests include the no-op version. Mach based builds only include the no-op version
// of this library.
// It doesn't seem like there is a non-trivial way to be conditional on 'localOld', so instead we explicitly
// define a version of leakcanary for every flavor:
localCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
localOldCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
officialCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
officialCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
implementation project(path: ':geckoview')
implementation project(path: ':thirdparty')
// With a simple "compile", Gradle will always build these libraries in their default configuration
// (i.e. release), so we need to explicitly forward our own build configuration here (bug 1385695).
//
// Official builds compile a hacked up app:Official..Debug, but need the
// release versions of the dependencies, in order to not have debugging
// information. It's not yet possible to specify just officialDebug, so we
// hack around it here.
if (mozconfig.substs.MOZILLA_OFFICIAL) {
debugCompile project(path: ':geckoview', configuration: "release")
} else {
debugCompile project(path: ':geckoview', configuration: "debug")
}
releaseCompile project(path: ':geckoview', configuration: "release")
testImplementation 'junit:junit:4.12'
testImplementation 'org.robolectric:robolectric:3.5.1'
testImplementation 'org.simpleframework:simple-http:6.0.1'
testImplementation 'org.mockito:mockito-core:1.10.19'
if (mozconfig.substs.MOZILLA_OFFICIAL) {
debugCompile project(path: ':thirdparty', configuration: "release")
} else {
debugCompile project(path: ':thirdparty', configuration: "debug")
}
releaseCompile project(path: ':thirdparty', configuration: "release")
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:3.1.2'
testCompile 'org.simpleframework:simple-http:6.0.1'
testCompile 'org.mockito:mockito-core:1.10.19'
// Including the Robotium JAR directly can cause issues with dexing.
androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.5.4'
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.5.4'
}
// TODO: (bug 1261486): This impl is not robust -
@ -264,6 +317,11 @@ task checkstyle(type: Checkstyle) {
classpath = files()
}
task syncPreprocessedCode(type: Sync, dependsOn: rootProject.generateCodeAndResources) {
into("${project.buildDir}/generated/source/preprocessed_code")
from("${topobjdir}/mobile/android/base/generated/preprocessed")
}
// The localization system uses the moz.build preprocessor to interpolate a .dtd
// file of XML entity definitions into an XML file of elements referencing those
// entities. (Each locale produces its own .dtd file, backstopped by the en-US
@ -279,80 +337,49 @@ class ExpandXMLEntitiesFilter extends FilterReader {
}
}
task syncPreprocessedResources(type: Sync, dependsOn: rootProject.generateCodeAndResources) {
into("${project.buildDir}/generated/source/preprocessed_resources")
from("${topobjdir}/mobile/android/base/res")
filesMatching('**/strings.xml') {
filter(ExpandXMLEntitiesFilter)
}
}
// It's not easy -- see the backout in Bug 1242213 -- to change the <manifest>
// package for Fennec. Gradle has grown a mechanism to achieve what we want for
// Fennec, however, with applicationId. To use the same manifest as moz.build,
// we replace the package with org.mozilla.gecko (the eventual package) here.
task rewriteManifestPackage(type: Copy, dependsOn: rootProject.generateCodeAndResources) {
into("${project.buildDir}/generated/source/preprocessed_manifest")
from("${topobjdir}/mobile/android/base/AndroidManifest.xml")
filter { it.replaceFirst(/package=".*?"/, 'package="org.mozilla.gecko"') }
}
apply from: "${topsrcdir}/mobile/android/gradle/with_gecko_binaries.gradle"
android.applicationVariants.all { variant ->
def syncPreprocessedJava = task("syncPreprocessedJavaFor${variant.name.capitalize()}", type: Sync) {
into("${project.buildDir}/moz.build/src/${variant.name}/java")
from("${topobjdir}/mobile/android/base/generated/preprocessed")
exclude('**/*.mkdir.done')
}
// This is an Android-Gradle plugin 3+-ism. Culted from reading the source,
// searching for "registerJavaGeneratingTask", and finding
// https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin/commit/2f2b91476fb1c6647791e2c6fe531a47615a1e85.
// The added directory doesn't appear in the paths listed by the
// `sourceSets` task, for reasons unknown.
variant.registerJavaGeneratingTask(syncPreprocessedJava, syncPreprocessedJava.destinationDir)
def syncPreprocessedRes = task("syncPreprocessedResFor${variant.name.capitalize()}", type: Sync) {
into("${project.buildDir}/moz.build/src/${variant.name}/res")
from("${topobjdir}/mobile/android/base/res")
filesMatching('**/strings.xml') {
filter(ExpandXMLEntitiesFilter)
}
exclude('**/*.mkdir.done')
}
// This is an Android-Gradle plugin 3+-ism. Determined by reading the
// source. The added directory doesn't appear in the paths listed by the
// `sourceSets` task, for reasons unknown.
variant.registerGeneratedResFolders(project.files(syncPreprocessedRes.destinationDir).builtBy(syncPreprocessedRes))
// It's not easy -- see the backout in Bug 1242213 -- to change the
// <manifest> package for Fennec. Gradle has grown a mechanism to achieve
// what we want for Fennec, however, with applicationId. To use the same
// manifest as moz.build, we replace the package with org.mozilla.gecko (the
// eventual package) here.
def rewriteManifestPackage = task("rewriteManifestPackageFor${variant.name.capitalize()}", type: Copy, dependsOn: rootProject.generateCodeAndResources) {
into("${project.buildDir}/moz.build/src/${variant.name}")
from("${topobjdir}/mobile/android/base/AndroidManifest.xml")
filter { it.replaceFirst(/package=".*?"/, 'package="org.mozilla.gecko"') }
exclude('**/*.mkdir.done')
}
// Every configuration needs the stub manifest at
// src/main/AndroidManifest.xml and the generated manifest. We can't use
// the main sourceSet without losing the stub, so we cover all the
// configurations here.
android.sourceSets."${variant.name}".manifest.srcFile "${rewriteManifestPackage.destinationDir}/AndroidManifest.xml"
variant.preBuild.dependsOn rewriteManifestPackage
variant.preBuild.dependsOn syncPreprocessedCode
variant.preBuild.dependsOn syncPreprocessedResources
// Official automation builds don't include Gecko binaries, since those binaries are not
// produced until after build time (at package time). official Therefore, automation builds
// include the Gecko binaries into the APK at package time. The "withGeckoBinaries" variant of
// the :geckoview project also does this. (It does what it says on the tin!) For notes on this
// approach, see mobile/android/gradle/with_gecko_binaries.gradle.
// Local (read, not 'official') builds want to reflect developer changes to
// AndroidManifest.xml.in, strings.xml, and preprocessed Java code. To do
// this, the Gradle build calls out to the moz.build system, which can be
// re-entrant. Official builds are driven by the moz.build system and
// should never be re-entrant in this way.
if (!((variant.productFlavors*.name).contains('official'))) {
syncPreprocessedJava.dependsOn rootProject.generateCodeAndResources
syncPreprocessedRes.dependsOn rootProject.generateCodeAndResources
rewriteManifestPackage.dependsOn rootProject.generateCodeAndResources
}
// Like 'local' or 'localOld'.
def audienceDimension = variant.productFlavors[0].name
// When driven from moz.build via |mach build|, Gradle does not require or
// use Gecko binaries. It's only |mach package| that packs the Gecko
// binaries into the resulting APK. The "withoutGeckoBinaries" variants
// handle this. When driven from Android Studio or Gradle, the
// "withGeckoBinaries" variants handle packing the Gecko binaries into the
// resulting APK (for on-device deployment). They also update the Omnijars
// as necessary, smoothing out the edit-compile-test development cycle.
// They do what they say on the tin!
if ((variant.productFlavors*.name).contains('withGeckoBinaries')) {
// :app uses :geckoview:release and handles it's own Gecko binary inclusion,
// even though this would be most naturally done in the :geckoview project.
if (!audienceDimension.equals('official')) {
configureVariantWithGeckoBinaries(variant)
}
}
android.applicationVariants.all { variant ->
configureApplicationVariantWithJNIWrappers(variant, "Fennec")
configureVariantWithJNIWrappers(variant, "Fennec")
}
if (gradle.startParameter.taskNames.any { it.endsWith('UnitTest') }) {
@ -389,7 +416,7 @@ android.applicationVariants.all { variant ->
reports {
html.enabled = true // HTML reports for humans.
html.destination = file("$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.html")
html.destination = "$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.html"
xml.enabled = false
}
}
@ -413,7 +440,7 @@ android.applicationVariants.all { variant ->
reports {
xml.enabled = true // XML reports for machines.
xml.destination = file("$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.xml")
xml.destination = "$project.buildDir/reports/findbugs/findbugs-${variant.name}-output.xml"
html.enabled = false
}
}
@ -439,7 +466,8 @@ android.applicationVariants.all { variant ->
variant.outputs.each { output ->
output.processManifest.doLast {
[file("${manifestOutputDirectory}/AndroidManifest.xml"),
[output.processManifest.manifestOutputFile,
output.processManifest.instantRunManifestOutputFile,
].each({ File manifestOutFile ->
if (manifestOutFile.exists()) {
def contents = manifestOutFile.getText('UTF-8')

Просмотреть файл

@ -38,6 +38,7 @@
<issue id="ResourceAsColor" severity="warning" />
<issue id="ResourceType" severity="warning" />
<issue id="ValidFragment" severity="warning" />
<issue id="WrongConstant" severity="warning" />
<!-- New Android-Gradle lint integration regressed this check. -->
<issue id="MissingRegistered" severity="warning" />
@ -50,6 +51,7 @@
<ignore path="**/mobile/android/base/java/org/mozilla/gecko/dlc/DownloadContentTelemetry.java"/>
<ignore path="**/mobile/android/base/java/org/mozilla/gecko/preferences/LocaleListPreference.java"/>
<ignore path="**/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java"/>
<ignore path="**/mobile/android/base/java/org/mozilla/gecko/db/PerProfileDatabaseProvider.java"/>
<ignore path="**/mobile/android/base/java/org/mozilla/gecko/PrintHelper.java"/>
<ignore path="**/mobile/android/base/java/org/mozilla/gecko/animation/PropertyAnimator.java"/>
<ignore path="**/mobile/android/base/java/org/mozilla/gecko/RemotePresentationService.java"/>

Просмотреть файл

@ -5,5 +5,5 @@
android:viewportHeight="12.0">
<path
android:fillColor="@color/activity_stream_icon"
android:pathData="M4.97,0.151l-2.819,6.5A0.25,0.25,0,0,0,2.381,7H4.029a0.25,0.25,0,0,1,0.225,0.359L2,12,9.4,5.437A0.25,0.25,0,0,0,9.234,5H6.791a0.25,0.25,0,0,1,-0.19,-0.412L10.15,0.412A0.25,0.25,0,0,0,9.959,0H5.2A0.25,0.25,0,0,0,4.97,0.151Z"/>
android:pathData="M4.97.151l-2.819,6.5A.25.25,0,0,0,2.381,7H4.029a.25.25,0,0,1,.225.359L2,12,9.4,5.437A.25.25,0,0,0,9.234,5H6.791a.25.25,0,0,1-.19-.412L10.15.412A.25.25,0,0,0,9.959,0H5.2A.25.25,0,0,0,4.97.151Z"/>
</vector>

Просмотреть файл

@ -40,7 +40,7 @@
android:id="@+id/custom_tabs_action_bar_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:lines="1"
android:textColor="?android:textColorPrimary"
android:textSize="14sp"
tools:text="Mozilla.org"/>
@ -49,6 +49,7 @@
android:id="@+id/custom_tabs_action_bar_url"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="1"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="10sp"

Просмотреть файл

@ -15,6 +15,15 @@
<item name="windowNoTitle">true</item>
</style>
<style name="GeckoDialogBase" parent="@android:style/Theme.Holo.Light.Dialog">
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
<style name="GeckoTitleDialogBase" parent="@android:style/Theme.Holo.Light.Dialog" />
<!--
Activity based themes for API 11+. This theme completely replaces
GeckoAppBase from res/values/themes.xml on API 11+ devices.

Просмотреть файл

@ -0,0 +1,15 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.NoActionBar">
<item name="android:windowBackground">@color/toolbar_grey</item>
<item name="android:colorBackground">@color/toolbar_grey</item>
</style>
<style name="SettingsTheme" parent="@android:style/Theme.Holo.Light"/>
</resources>

Просмотреть файл

@ -0,0 +1,19 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources>
<style name="TextAppearance.EmptyView.Title" parent="@android:style/TextAppearance.Small">
<item name="android:textColor">@color/text_and_tabs_tray_grey</item>
<item name="android:textSize">20sp</item>
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="TextAppearance.EmptyView.Message" parent="@android:style/TextAppearance.Small">
<item name="android:textColor">@color/placeholder_grey</item>
<item name="android:textSize">16sp</item>
<item name="android:lineSpacingExtra">4sp</item>
</style>
</resources>

Просмотреть файл

@ -3,8 +3,7 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources
xmlns:tools="http://schemas.android.com/tools">
<resources>
<!--
Base application theme. This could be overridden by GeckoBaseTheme
@ -16,6 +15,13 @@
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="GeckoDialogBase" parent="@android:style/Theme.Dialog">
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="GeckoTitleDialogBase" parent="@android:style/Theme.Dialog" />
<style name="Gecko.Preferences">
<item name="windowActionBar">true</item>
<item name="windowNoTitle">false</item>
@ -67,6 +73,10 @@
<item name="actionBarTheme">@style/GeckoActionBar</item>
</style>
<style name="Gecko.Dialog" parent="GeckoDialogBase"/>
<style name="Gecko.TitleDialog" parent="GeckoTitleDialogBase"/>
<!--
Activity based themes, dependent on API level. This theme is replaced
by GeckoAppBase from res/values-vXX/themes.xml on newer devices.
@ -116,8 +126,7 @@
</style>
<!-- Bookmark full-page dialog theme -->
<style name="Bookmark" parent="Theme.AppCompat.Light.DialogWhenLarge"
tools:ignore="UnusedResources" />
<style name="Bookmark" parent="Theme.AppCompat.Light.DialogWhenLarge"/>
<style name="Bookmark.Gecko" parent="Gecko">
<item name="toolbarStyle">@style/BookmarkToolbarStyle</item>
<item name="colorAccent">@color/fennec_ui_accent</item>

Просмотреть файл

@ -4,8 +4,7 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Only overriden styles for Honeycomb/Ice cream sandwich are specified here.
@ -27,6 +26,9 @@
<style name="Widget.BaseTextView" parent="android:style/Widget.Holo.Light.TextView" />
<style name="Widget.ProgressBar.Horizontal" parent="android:style/Widget.Holo.ProgressBar.Horizontal" />
<!--
Application styles. All customizations that are not specific
to a particular API level can go here.
@ -45,6 +47,18 @@
<!-- ActionBar -->
<style name="ActionBar" parent="android:style/Widget.Holo.ActionBar" />
<!-- TabsLayout ActionBar -->
<style name="ActionBar.TabsLayout">
<item name="android:visibility">gone</item>
</style>
<!-- DropDown List View -->
<style name="DropDownListView" parent="@android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">@drawable/action_bar_button</item>
<item name="android:divider">@color/toolbar_divider_grey</item>
<item name="android:dividerHeight">@dimen/page_row_divider_height</item>
</style>
<!-- Spinner DropDown Item -->
<style name="Widget.DropDownItem.Spinner" parent="@android:style/Widget.Holo.Light.DropDownItem.Spinner">
<item name="android:textColor">#FF000000</item>
@ -94,8 +108,7 @@
<style name="TabInput.TabWidget" parent="android:style/Widget.Holo.Light.TabWidget" />
<style name="TabInput.Tab" parent="android:style/Widget.Holo.Light.Tab"
tools:ignore="UnusedResources">
<style name="TabInput.Tab" parent="android:style/Widget.Holo.Light.Tab">
<item name="android:minHeight">@dimen/menu_item_row_height</item>
<item name="android:textAllCaps">true</item>
</style>

Просмотреть файл

@ -14,6 +14,14 @@
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="TextAppearance.FirstrunTextLight">
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="TextAppearance.FirstrunTextRegular">
<item name="android:fontFamily">sans-serif</item>
</style>
<style name="TextAppearance.UrlBar.Title" parent="TextAppearance.Small">
<item name="android:textSize">16sp</item>
</style>

Просмотреть файл

@ -25,6 +25,8 @@
<style name="Widget.BaseTextView" parent="android:style/Widget.TextView"/>
<style name="Widget.ProgressBar.Horizontal" parent="android:style/Widget.ProgressBar.Horizontal"/>
<!--
Application styles. All customizations that are not specific
to a particular API level can go here.
@ -63,6 +65,10 @@
<item name="android:listSelector">@drawable/action_bar_button</item>
</style>
<style name="Widget.Home.HomeList">
<item name="android:scrollbarStyle">outsideOverlay</item>
</style>
<style name="Widget.ListItem">
<item name="android:minHeight">?android:attr/listPreferredItemHeight</item>
<item name="android:textAppearance">?android:attr/textAppearanceLargeInverse</item>
@ -210,6 +216,12 @@
<item name="android:scaleType">centerCrop</item>
</style>
<style name="Widget.TopSitesGridItemPin">
<item name="android:minWidth">30dip</item>
<item name="android:minHeight">30dip</item>
<item name="android:padding">0dip</item>
</style>
<style name="Widget.TopSitesGridItemTitle">
<item name="android:textColor">@color/top_sites_grid_item_title</item>
<item name="android:textSize">12sp</item>
@ -283,8 +295,7 @@
<!--
We are overriding the snackbar message style to guarantee a consistent style across Android versions (bug 1217416).
-->
<style name="TextAppearance.Design.Snackbar.Message" parent="android:TextAppearance" tools:override="true"
tools:ignore="UnusedResources">
<style name="TextAppearance.Design.Snackbar.Message" parent="android:TextAppearance" tools:override="true">
<item name="android:textSize">@dimen/design_snackbar_text_size</item>
<item name="android:textColor">@android:color/white</item>
</style>
@ -359,8 +370,7 @@
<item name="android:textColor">?android:attr/textColorTertiary</item>
</style>
<style name="TextAppearance.Micro.Inverse"
tools:ignore="UnusedResources">
<style name="TextAppearance.Micro.Inverse">
<item name="android:textColor">?android:attr/textColorTertiaryInverse</item>
<item name="android:textColorHint">?android:attr/textColorHintInverse</item>
<item name="android:textColorHighlight">@color/text_color_highlight_inverse</item>
@ -390,8 +400,7 @@
<item name="android:textSize">14sp</item>
</style>
<style name="TextAppearance.Widget.Home"
tools:ignore="UnusedResources" />
<style name="TextAppearance.Widget.Home" />
<style name="TextAppearance.Widget.Home.Header" parent="TextAppearance.Small">
<item name="android:textColor">@color/disabled_grey</item>
@ -427,8 +436,7 @@
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="TextAppearance.DoorHanger.Small"
tools:ignore="UnusedResources">
<style name="TextAppearance.DoorHanger.Small">
<item name="android:textSize">14sp</item>
</style>
@ -519,21 +527,30 @@
<item name="android:layout_marginRight">6dp</item>
</style>
<style name="Widget.RemoteTabsItemView" parent="Widget.TwoLinePageRow"/>
<style name="Widget.RemoteTabsClientView" parent="Widget.TwoLinePageRow">
<item name="android:background">@color/about_page_header_grey</item>
</style>
<style name="Widget.RemoteTabsListView" parent="Widget.HomeListView">
<item name="android:childDivider">@color/toolbar_divider_grey</item>
</style>
<style name="Widget.HistoryListView" parent="Widget.HomeListView">
<item name="android:childDivider">@color/toolbar_divider_grey</item>
<item name="android:drawSelectorOnTop">true</item>
</style>
<!-- TabsLayout Row -->
<style name="TabLayoutItemTextAppearance"
tools:ignore="UnusedResources">
<style name="TabLayoutItemTextAppearance">
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">middle</item>
</style>
<!-- TabsLayout RemoteTabs Row Url -->
<style name="TabLayoutItemTextAppearance.Url"
tools:ignore="UnusedResources">
<style name="TabLayoutItemTextAppearance.Url">
<item name="android:textColor">#FFA4A7A9</item>
</style>
@ -562,8 +579,8 @@
</style>
<style name="PopupAnimation">
<item name="android:windowEnterAnimation">@anim/popup_show</item>
<item name="android:windowExitAnimation">@anim/popup_hide</item>
<item name="@android:windowEnterAnimation">@anim/popup_show</item>
<item name="@android:windowExitAnimation">@anim/popup_hide</item>
</style>
<style name="ToastBase">
@ -720,8 +737,7 @@
<item name="android:background">@drawable/tab_indicator_background</item>
</style>
<style name="TabInput.Tab"
tools:ignore="UnusedResources">
<style name="TabInput.Tab">
<item name="android:background">@drawable/tabs_strip_indicator</item>
<item name="android:gravity">center</item>
<item name="android:minHeight">@dimen/menu_item_row_height</item>
@ -782,8 +798,7 @@
<item name="android:layout_marginBottom">8dp</item>
</style>
<style name="RemoteTabsPanelItem.TextAppearance.Linkified"
tools:ignore="UnusedResources">
<style name="RemoteTabsPanelItem.TextAppearance.Linkified">
<item name="android:clickable">true</item>
<item name="android:focusable">true</item>
<item name="android:textColor">#0092DB</item>
@ -805,6 +820,8 @@
<item name="textAllCaps">false</item>
</style>
<style name="TabQueueActivity" parent="android:style/Theme.NoDisplay" />
<style name="ActivityStreamContextMenuText">
<item name="android:textSize">16sp</item>
</style>
@ -814,8 +831,7 @@
<item name="android:listDivider">@drawable/as_contextmenu_divider</item>
</style>
<style name="ActivityStreamButton" parent="Widget.AppCompat.Button.Colored"
tools:ignore="UnusedResources">
<style name="ActivityStreamButton" parent="Widget.AppCompat.Button.Colored">
<item name="colorButtonNormal">@color/link_blue</item>
<item name="android:textColor">@android:color/white</item>
</style>

Просмотреть файл

@ -3,7 +3,6 @@
package org.mozilla.gecko;
import android.content.ContentProvider;
import android.content.ContentProviderClient;
import android.content.ContentValues;
import android.database.Cursor;
@ -16,6 +15,7 @@ import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.db.BrowserContract.PageMetadata;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.db.BrowserProvider;
import org.mozilla.gecko.db.LocalBrowserDB;
import org.robolectric.shadows.ShadowContentResolver;
@ -27,8 +27,11 @@ public class GlobalPageMetadataTest {
public void testQueueing() throws Exception {
BrowserDB db = new LocalBrowserDB("default");
final ContentProvider provider = DelegatingTestContentProvider.createDelegatingBrowserProvider();
BrowserProvider provider = new BrowserProvider();
try {
provider.onCreate();
ShadowContentResolver.registerProvider(BrowserContract.AUTHORITY, new DelegatingTestContentProvider(provider));
ShadowContentResolver cr = new ShadowContentResolver();
ContentProviderClient pageMetadataClient = cr.acquireContentProviderClient(PageMetadata.CONTENT_URI);
@ -61,8 +64,11 @@ public class GlobalPageMetadataTest {
// Start listening for events.
GlobalPageMetadata.getInstance().init();
final ContentProvider provider = DelegatingTestContentProvider.createDelegatingBrowserProvider();
BrowserProvider provider = new BrowserProvider();
try {
provider.onCreate();
ShadowContentResolver.registerProvider(BrowserContract.AUTHORITY, new DelegatingTestContentProvider(provider));
ShadowContentResolver cr = new ShadowContentResolver();
ContentProviderClient historyClient = cr.acquireContentProviderClient(BrowserContract.History.CONTENT_URI);
ContentProviderClient pageMetadataClient = cr.acquireContentProviderClient(PageMetadata.CONTENT_URI);
@ -165,4 +171,4 @@ public class GlobalPageMetadataTest {
cursor.close();
}
}
}
}

Просмотреть файл

@ -3,21 +3,29 @@
package org.mozilla.gecko.icons.loader;
import android.content.ContentProvider;
import android.graphics.Bitmap;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.background.db.DelegatingTestContentProvider;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.db.BrowserProvider;
import org.mozilla.gecko.icons.IconDescriptor;
import org.mozilla.gecko.icons.IconRequest;
import org.mozilla.gecko.icons.IconResponse;
import org.mozilla.gecko.icons.Icons;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.shadows.ShadowContentResolver;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@ -38,7 +46,9 @@ public class TestLegacyLoader {
// We need to ensure we close our db connection properly.
// This is the only test in this class that actually accesses a database. If that changes,
// move BrowserProvider registration into a @Before method, and provider.shutdown into @After.
final ContentProvider provider = DelegatingTestContentProvider.createDelegatingBrowserProvider();
final BrowserProvider provider = new BrowserProvider();
provider.onCreate();
ShadowContentResolver.registerProvider(BrowserContract.AUTHORITY, new DelegatingTestContentProvider(provider));
try {
final IconRequest request = Icons.with(RuntimeEnvironment.application)
.pageUrl(TEST_PAGE_URL)
@ -51,8 +61,8 @@ public class TestLegacyLoader {
verify(loader).loadBitmapFromDatabase(request);
Assert.assertNull(response);
// Close any open db connections.
} finally {
// Close any open db connections.
provider.shutdown();
}
}

Просмотреть файл

@ -28,7 +28,6 @@ public class TestLookupIconUrl {
@Before
public void setUp() {
MemoryStorage.get().evictAll();
DiskStorage.get(RuntimeEnvironment.application).evictAll();
}
@Test

Просмотреть файл

@ -190,7 +190,7 @@ public class TestPushManager {
public void testStartupBeforeConfiguration() throws Exception {
verify(gcmTokenClient, never()).getToken(anyString(), anyBoolean());
manager.startup(System.currentTimeMillis());
verify(gcmTokenClient, times(1)).getToken(AppConstants.MOZ_ANDROID_GCM_SENDERIDS, false);
verify(gcmTokenClient, times(1)).getToken(AppConstants.MOZ_ANDROID_GCM_SENDERID, false);
}
@Test

Просмотреть файл

@ -12,17 +12,13 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mozilla.gecko.background.testhelpers.TestRunner;
import org.mozilla.gecko.util.NetworkUtils.ConnectionSubType;
import org.mozilla.gecko.util.NetworkUtils.ConnectionType;
import org.mozilla.gecko.util.NetworkUtils.NetworkStatus;
import org.mozilla.gecko.util.NetworkUtils.*;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.shadow.api.Shadow;
import org.robolectric.internal.ShadowExtractor;
import org.robolectric.shadows.ShadowConnectivityManager;
import org.robolectric.shadows.ShadowNetworkInfo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
@RunWith(TestRunner.class)
public class NetworkUtilsTest {
@ -35,7 +31,7 @@ public class NetworkUtilsTest {
// Not using Shadows.shadowOf(connectivityManager) because of Robolectric bug when using API23+
// See: https://github.com/robolectric/robolectric/issues/1862
shadowConnectivityManager = (ShadowConnectivityManager) Shadow.extract(connectivityManager);
shadowConnectivityManager = (ShadowConnectivityManager) ShadowExtractor.extract(connectivityManager);
}
@Test
@ -186,4 +182,4 @@ public class NetworkUtilsTest {
);
assertEquals(NetworkStatus.UP, NetworkUtils.getNetworkStatus(connectivityManager));
}
}
}

Просмотреть файл

@ -1,3 +1,3 @@
sdk=23
sdk=21
constants=org.mozilla.gecko.BuildConfig
packageName=org.mozilla.gecko

Просмотреть файл

@ -1,7 +1,6 @@
#filter substitution
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="@ANDROID_PACKAGE_NAME@"
android:installLocation="internalOnly"
android:versionCode="@ANDROID_VERSION_CODE@"
@ -43,13 +42,11 @@
<meta-data android:name="android.max_aspect" android:value="2.1"/>
#ifdef MOZ_ANDROID_GOOGLE_PLAY_SERVICES
#ifdef MOZ_NATIVE_DEVICES
<!-- This resources comes from Google Play Services. Required for casting support. -->
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
#endif
#ifdef MOZ_NATIVE_DEVICES
<service android:name="org.mozilla.gecko.RemotePresentationService" android:exported="false"/>
#endif
<!-- This activity handles all incoming Intents and dispatches them to other activities. -->
@ -136,7 +133,7 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter tools:ignore="AppLinkUrlError">
<intent-filter>
<action android:name="android.intent.action.WEB_SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
@ -162,7 +159,7 @@
android:resource="@integer/assist_launch_icon_res"/>
<!-- For XPI installs from websites and the download manager. -->
<intent-filter tools:ignore="AppLinkUrlError">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
@ -172,7 +169,7 @@
</intent-filter>
<!-- For XPI installs from file: URLs. -->
<intent-filter tools:ignore="AppLinkUrlError">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="" />

Просмотреть файл

@ -114,15 +114,11 @@ public class AppConstants {
false;
//#endif
public static final String MOZ_ANDROID_GCM_SENDERIDS =
//#ifdef MOZ_MMA_GCM_SENDERID
"@MOZ_ANDROID_GCM_SENDERID@,@MOZ_MMA_GCM_SENDERID@";
//#else
public static final String MOZ_ANDROID_GCM_SENDERID =
//#ifdef MOZ_ANDROID_GCM_SENDERID
"@MOZ_ANDROID_GCM_SENDERID@";
//#else
null;
//#endif
//#endif
public static final String MOZ_CHILD_PROCESS_NAME = "@MOZ_CHILD_PROCESS_NAME@";

Просмотреть файл

@ -27,8 +27,6 @@ GARBAGE_DIRS += classes db jars res sync services generated
gradle_dir := $(topobjdir)/gradle/build/mobile/android
ifndef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
# The bootclasspath is functionally identical to the classpath, but allows the
# classes given to redefine classes in core packages, such as java.lang.
# android.jar is here as it provides Android's definition of the Java Standard
@ -54,15 +52,12 @@ JAVA_CLASSPATH += \
$(ANDROID_PALETTE_V7_AAR_LIB) \
$(NULL)
ifdef MOZ_ANDROID_GOOGLE_PLAY_SERVICES
# If native devices are enabled, add Google Play Services and some of the v7
# compat libraries.
ifdef MOZ_NATIVE_DEVICES
JAVA_CLASSPATH += \
$(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
$(ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB) \
$(NULL)
endif
ifdef MOZ_NATIVE_DEVICES
JAVA_CLASSPATH += \
$(ANDROID_PLAY_SERVICES_CAST_AAR_LIB) \
$(ANDROID_MEDIAROUTER_V7_AAR_LIB) \
$(ANDROID_MEDIAROUTER_V7_AAR_INTERNAL_LIB) \
@ -85,7 +80,7 @@ ifdef MOZ_INSTALL_TRACKING
$(NULL)
endif
# MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_ANDROID_GOOGLE_PLAY_SERVICES,
# MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_NATIVE_DEVICES,
# which take care of the Play Services requirements in JAVA_CLASSPATH.
# Based on the import of
# `com.google.android.gms.ads.identifier.AdvertisingIdClient` in
@ -112,13 +107,6 @@ java_bundled_libs := \
$(ANDROID_PALETTE_V7_AAR_LIB) \
$(NULL)
ifdef MOZ_ANDROID_GOOGLE_PLAY_SERVICES
java_bundled_libs += \
$(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
$(ANDROID_PLAY_SERVICES_BASEMENT_AAR_LIB) \
$(NULL)
endif
ifdef MOZ_NATIVE_DEVICES
java_bundled_libs += \
$(ANDROID_PLAY_SERVICES_BASE_AAR_LIB) \
@ -145,7 +133,7 @@ ifdef MOZ_INSTALL_TRACKING
$(NULL)
endif
# MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_ANDROID_GOOGLE_PLAY_SERVICES,
# MOZ_ANDROID_MMA requires MOZ_ANDROID_GCM and MOZ_NATIVE_DEVICES,
# which take care of the Play Services requirements in
# java_bundled_libs. See the note above.
@ -155,6 +143,7 @@ uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
java_bundled_libs := $(call uniq,$(java_bundled_libs))
java_bundled_libs := $(subst $(NULL) ,:,$(strip $(java_bundled_libs)))
ifndef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
GECKOVIEW_JARS = \
constants.jar \
gecko-R.jar \
@ -186,6 +175,16 @@ ifdef MOZ_ANDROID_MLS_STUMBLER
FENNEC_JARS += ../stumbler/stumbler.jar
endif
else # MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
GECKOVIEW_JARS := $(gradle_dir)/geckoview/intermediates/bundles/debug/classes.jar
FENNEC_JARS := $(gradle_dir)/app/intermediates/packaged/officialPhoton/debug/classes.jar
$(GECKOVIEW_JARS): .gradle.deps
$(FENNEC_JARS): .gradle.deps
endif # MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
geckoview_jars_classpath := $(subst $(NULL) ,:,$(strip $(GECKOVIEW_JARS)))
# All the jars we're compiling from source. (not to be confused with
@ -233,8 +232,6 @@ endif # MOZ_INSTALL_TRACKING
library_jars := $(subst $(NULL) ,:,$(strip $(library_jars)))
endif # MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
ifdef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
define gradle_command
$(1): $(2)
@ -247,7 +244,7 @@ $(eval $(call gradle_command,.gradle.deps,.aapt.deps FORCE))
classes.dex: .gradle.deps
$(REPORT_BUILD)
cp $(gradle_dir)/app/intermediates/transforms/dexMerger/officialWithoutGeckoBinariesNoMinApiPhoton/debug/0/classes.dex classes.dex
cp $(gradle_dir)/app/intermediates/transforms/dex/officialPhoton/debug/folders/1000/1f/main/classes.dex $@
GeneratedJNIWrappers.cpp GeneratedJNIWrappers.h GeneratedJNINatives.h : .gradle.deps
$(REPORT_BUILD)
@ -255,7 +252,7 @@ GeneratedJNIWrappers.cpp GeneratedJNIWrappers.h GeneratedJNINatives.h : .gradle.
FennecJNIWrappers.cpp FennecJNIWrappers.h FennecJNINatives.h: .gradle.deps
$(REPORT_BUILD)
else # MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
else
classes.dex: .proguard.deps
$(REPORT_BUILD)
$(DX) --dex --output=classes.dex --force-jumbo jars-proguarded
@ -494,7 +491,7 @@ $(eval $(call gradle_command,.gradle.nodeps,AndroidManifest.xml $(constants_PP_J
.aapt.nodeps: .gradle.nodeps FORCE
@$(TOUCH) $@
cp $(GRADLE_ANDROID_APP_APK) gecko-nodeps.ap_
cp $(gradle_dir)/app/intermediates/transforms/dexMerger/officialWithoutGeckoBinariesNoMinApiPhoton/debug/0/classes.dex classes.dex
cp $(gradle_dir)/app/intermediates/transforms/dex/officialPhoton/debug/folders/1000/1f/main/classes.dex classes.dex
else
# .aapt.nodeps: AndroidManifest.xml FORCE
$(eval $(call aapt_command,.aapt.nodeps,AndroidManifest.xml FORCE,gecko-nodeps.ap_,gecko-nodeps/,gecko-nodeps/))
@ -560,7 +557,6 @@ endif
# @BuildFlag annotation in Java). For example, add a "MOZ_FOO \" line to this
# list to support @BuildFlag(MOZ_FOO).
BINDING_BUILD_FLAGS = \
MOZ_NATIVE_DEVICES \
$(NULL)
# Preprocess a JNI binding file using the build flags defined above.

Просмотреть файл

@ -46,9 +46,7 @@ import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
// Registered: This activity is only registered in the manifest if MOZ_CRASHREPORTER is set.
// CutPasteId: This lint is not worth fixing. To fix it, cache all the findViewById results.
@SuppressLint("Registered,CutPasteId")
@SuppressLint("Registered") // This activity is only registered in the manifest if MOZ_CRASHREPORTER is set
public class CrashReporter extends AppCompatActivity
{
private static final String LOGTAG = "GeckoCrashReporter";

Просмотреть файл

@ -20,13 +20,11 @@ import android.view.WindowManager;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.annotation.BuildFlag;
import org.mozilla.gecko.annotation.WrapForJNI;
/**
* A MediaPlayerManager with API 17+ Presentation support.
*/
@BuildFlag("MOZ_NATIVE_DEVICES")
@TargetApi(17)
public class PresentationMediaPlayerManager extends MediaPlayerManager {

Просмотреть файл

@ -5,7 +5,6 @@
package org.mozilla.gecko.activitystream;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
@ -217,7 +216,8 @@ public class ActivityStreamTelemetry {
break;
// While we also have a "blank" type, it is not used by Activity Stream.
case BrowserContract.TopSites.TYPE_BLANK:
throw new IllegalStateException("Unknown top site type :" + (int) topSite.getType());
default:
throw new IllegalStateException("Unknown top site type: " + topSite.getType());
}
return this;

Просмотреть файл

@ -226,5 +226,4 @@ public class Highlight implements WebpageRowModel {
// The Highlights cursor automatically notifies of data changes, so nothing needs to be done here.
@Override
public void onStateCommitted() {}
}
public void onStateCommitted() {}}

Просмотреть файл

@ -34,6 +34,7 @@ import org.mozilla.gecko.R;
import org.mozilla.gecko.SiteIdentity;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.toolbar.SecurityModeUtil;
import org.mozilla.gecko.toolbar.CustomTabsSecurityPopup;
import org.mozilla.gecko.util.ColorUtil;
/**

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.customtabs;
package org.mozilla.gecko.toolbar;
import android.content.ClipData;
import android.content.ClipboardManager;

Просмотреть файл

@ -42,6 +42,8 @@ import java.util.Arrays;
*
* * {@link AbstractPerProfileDatabaseProvider} provides a simple abstraction for
* querying databases that are stored in the user's profile directory.
* * {@link PerProfileDatabaseProvider} is a simple version that only allows a
* single ContentProvider to access each per-profile database.
* * {@link SharedBrowserDatabaseProvider} is an example of a per-profile provider
* that allows for multiple providers to safely work with the same databases.
*/
@ -132,7 +134,7 @@ public abstract class AbstractTransactionalProvider extends ContentProvider {
* If we're not in a batch, but we are in a write transaction,
* end it.
*
* @see AbstractTransactionalProvider#markWriteSuccessful(SQLiteDatabase)
* @see PerProfileDatabaseProvider#markWriteSuccessful(SQLiteDatabase)
*/
protected void endWrite(final SQLiteDatabase db) {
if (isInBatch()) {

Просмотреть файл

@ -306,11 +306,7 @@ public class LocalBrowserDB extends BrowserDB {
bookmarkValue.put(Bookmarks.FAVICON_ID, faviconID);
faviconValues.add(iconValue);
}
} catch (IllegalAccessException e) {
Log.wtf(LOGTAG, "Reflection failure.", e);
} catch (IllegalArgumentException e) {
Log.wtf(LOGTAG, "Reflection failure.", e);
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException | IllegalArgumentException | NoSuchFieldException e) {
Log.wtf(LOGTAG, "Reflection failure.", e);
}
}
@ -506,13 +502,7 @@ public class LocalBrowserDB extends BrowserDB {
faviconField.setAccessible(true);
return faviconField.getInt(null);
} catch (IllegalAccessException e) {
// We'll end up here for any default bookmark that doesn't have a favicon in
// resources/raw/ (i.e., about:firefox). When this happens, the Favicons service will
// fall back to the default branding icon for about pages. Non-about pages should always
// specify an icon; otherwise, the placeholder globe favicon will be used.
Log.d(LOGTAG, "No raw favicon resource found for " + name);
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException | NoSuchFieldException e) {
// We'll end up here for any default bookmark that doesn't have a favicon in
// resources/raw/ (i.e., about:firefox). When this happens, the Favicons service will
// fall back to the default branding icon for about pages. Non-about pages should always

Просмотреть файл

@ -0,0 +1,55 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.db;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.db.PerProfileDatabases.DatabaseHelperFactory;
import android.content.Context;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Abstract class containing methods needed to make a SQLite-based content
* provider with a database helper of type T, where one database helper is
* held per profile.
*/
public abstract class PerProfileDatabaseProvider<T extends SQLiteOpenHelper> extends AbstractPerProfileDatabaseProvider {
private PerProfileDatabases<T> databases;
@Override
protected PerProfileDatabases<T> getDatabases() {
return databases;
}
protected abstract String getDatabaseName();
/**
* Creates and returns an instance of the appropriate DB helper.
*
* @param context to use to create the database helper
* @param databasePath path to the DB file
* @return instance of the database helper
*/
protected abstract T createDatabaseHelper(Context context, String databasePath);
@Override
public boolean onCreate() {
synchronized (this) {
databases = new PerProfileDatabases<T>(
getContext(), getDatabaseName(), new DatabaseHelperFactory<T>() {
@Override
public T makeDatabaseHelper(Context context, String databasePath) {
final T helper = createDatabaseHelper(context, databasePath);
if (Versions.feature16Plus) {
helper.setWriteAheadLoggingEnabled(true);
}
return helper;
}
});
}
return true;
}
}

Просмотреть файл

@ -5,7 +5,6 @@
package org.mozilla.gecko.dlc;
import android.annotation.SuppressLint;
import android.content.Context;
import android.support.annotation.IntDef;
import android.util.Log;
@ -101,7 +100,7 @@ public abstract class BaseAction {
} else if (content.isHyphenationDictionary()) {
destinationDirectory = new File(context.getApplicationInfo().dataDir, "hyphenation");
} else {
throw new UnrecoverableDownloadContentException("Can't determine destination for kind: " + (String) content.getKind());
throw new UnrecoverableDownloadContentException("Can't determine destination for kind: " + content.getKind());
}
if (!destinationDirectory.exists() && !destinationDirectory.mkdirs()) {

Просмотреть файл

@ -5,7 +5,6 @@
package org.mozilla.gecko.dlc;
import android.annotation.SuppressLint;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@ -107,7 +106,7 @@ public class DownloadAction extends BaseAction {
}
if (!content.isAssetArchive()) {
Log.e(LOGTAG, "Downloaded content is not of type 'asset-archive': " + (String) content.getType());
Log.e(LOGTAG, "Downloaded content is not of type 'asset-archive': " + content.getType());
temporaryFile.delete();
DownloadContentTelemetry.eventDownloadFailure(content, DownloadContentTelemetry.ERROR_LOGIC);
continue;

Просмотреть файл

@ -0,0 +1,68 @@
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko.home;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ExpandableListView;
/**
* <code>HomeExpandableListView</code> is a custom extension of
* <code>ExpandableListView<code>, that packs a <code>HomeContextMenuInfo</code>
* when any of its rows is long pressed.
* <p>
* This is the <code>ExpandableListView</code> equivalent of
* <code>HomeListView</code>.
*/
public class HomeExpandableListView extends ExpandableListView
implements OnItemLongClickListener {
// ContextMenuInfo associated with the currently long pressed list item.
private HomeContextMenuInfo mContextMenuInfo;
// ContextMenuInfo factory.
private HomeContextMenuInfo.ExpandableFactory mContextMenuInfoFactory;
public HomeExpandableListView(Context context) {
this(context, null);
}
public HomeExpandableListView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public HomeExpandableListView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setOnItemLongClickListener(this);
}
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (mContextMenuInfoFactory == null) {
return false;
}
// HomeExpandableListView items can correspond to groups and children.
// The factory can determine whether to add context menu for either,
// both, or none by unpacking the given position.
mContextMenuInfo = mContextMenuInfoFactory.makeInfoForAdapter(view, position, id, getExpandableListAdapter());
return showContextMenuForChild(HomeExpandableListView.this);
}
@Override
public ContextMenuInfo getContextMenuInfo() {
return mContextMenuInfo;
}
public void setContextMenuInfoFactory(final HomeContextMenuInfo.ExpandableFactory factory) {
mContextMenuInfoFactory = factory;
}
}

Просмотреть файл

@ -25,6 +25,7 @@ import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.fxa.FirefoxAccounts;
import org.mozilla.gecko.preferences.GeckoPreferences;
import org.mozilla.gecko.push.PushManager;
import org.mozilla.gecko.switchboard.SwitchBoard;
import org.mozilla.gecko.util.ContextUtils;
@ -74,6 +75,7 @@ public class MmaDelegate {
// we gather the information here then pass to mmaHelper.init()
// Note that generateUserAttribute always return a non null HashMap.
final Map<String, Object> attributes = gatherUserAttributes(activity);
mmaHelper.setGcmSenderId(PushManager.getSenderIds());
final String deviceId = getDeviceId(activity);
mmaHelper.setDeviceId(deviceId);
PrefsHelper.setPref(GeckoPreferences.PREFS_MMA_DEVICE_ID, deviceId);
@ -159,6 +161,10 @@ public class MmaDelegate {
}
}
public static String getMmaSenderId() {
return mmaHelper.getMmaSenderId();
}
private static String getDeviceId(Activity activity) {
if (SwitchBoard.isInExperiment(activity, Experiments.LEANPLUM_DEBUG)) {
return DEBUG_LEANPLUM_DEVICE_ID;

Просмотреть файл

@ -20,6 +20,8 @@ public interface MmaInterface {
void init(Activity Activity, Map<String, ?> attributes);
void setGcmSenderId(String senderIds);
void setCustomIcon(@DrawableRes int iconResId);
void start(Context context);
@ -32,5 +34,7 @@ public interface MmaInterface {
@CheckResult boolean handleGcmMessage(Context context, String from, Bundle bundle);
String getMmaSenderId();
void setDeviceId(@NonNull String deviceId);
}

Просмотреть файл

@ -46,8 +46,6 @@ public class MmaLeanplumImp implements MmaInterface {
Leanplum.setAppIdForDevelopmentMode(MmaConstants.MOZ_LEANPLUM_SDK_CLIENTID, MmaConstants.MOZ_LEANPLUM_SDK_KEY);
}
LeanplumPushService.setGcmSenderId(AppConstants.MOZ_ANDROID_GCM_SENDERIDS);
if (attributes != null) {
Leanplum.start(activity, attributes);
} else {
@ -71,6 +69,11 @@ public class MmaLeanplumImp implements MmaInterface {
});
}
@Override
public void setGcmSenderId(String senderIds) {
LeanplumPushService.setGcmSenderId(senderIds);
}
@Override
public void setCustomIcon(@DrawableRes final int iconResId) {
LeanplumPushService.setCustomizer(new LeanplumPushNotificationCustomizer() {
@ -114,6 +117,11 @@ public class MmaLeanplumImp implements MmaInterface {
return false;
}
@Override
public String getMmaSenderId() {
return MmaConstants.MOZ_MMA_SENDER_ID;
}
@Override
public void setDeviceId(@NonNull String deviceId) {
Leanplum.setDeviceId(deviceId);

Просмотреть файл

@ -21,6 +21,11 @@ public class MmaStubImp implements MmaInterface {
}
@Override
public void setGcmSenderId(String senderIds) {
}
@Override
public void setCustomIcon(@DrawableRes int iconResId) {
@ -51,6 +56,11 @@ public class MmaStubImp implements MmaInterface {
return false;
}
@Override
public String getMmaSenderId() {
return "";
}
@Override
public void setDeviceId(@NonNull String deviceId) {

Просмотреть файл

@ -57,6 +57,15 @@ public class PushManager {
this.pushClientFactory = pushClientFactory;
}
public static String getSenderIds() {
final String mmaSenderId = MmaDelegate.getMmaSenderId();
if (mmaSenderId != null && mmaSenderId.length() > 0) {
return AppConstants.MOZ_ANDROID_GCM_SENDERID + "," + mmaSenderId;
} else {
return AppConstants.MOZ_ANDROID_GCM_SENDERID;
}
}
public PushRegistration registrationForSubscription(String chid) {
// chids are globally unique, so we're not concerned about finding a chid associated to
// any particular profile.
@ -244,7 +253,7 @@ public class PushManager {
}
protected @NonNull PushRegistration advanceRegistration(final PushRegistration registration, final @NonNull String profileName, final long now) throws AutopushClientException, PushClient.LocalException, GcmTokenClient.NeedsGooglePlayServicesException, IOException {
final Fetched gcmToken = gcmClient.getToken(AppConstants.MOZ_ANDROID_GCM_SENDERIDS, registration.debug);
final Fetched gcmToken = gcmClient.getToken(getSenderIds(), registration.debug);
final PushClient pushClient = pushClientFactory.getPushClient(registration.autopushEndpoint, registration.debug);
@ -296,7 +305,7 @@ public class PushManager {
public void startup(long now) {
try {
Log.i(LOG_TAG, "Startup: requesting GCM token.");
gcmClient.getToken(AppConstants.MOZ_ANDROID_GCM_SENDERIDS, false); // For side-effects.
gcmClient.getToken(getSenderIds(), false); // For side-effects.
} catch (GcmTokenClient.NeedsGooglePlayServicesException e) {
// Requires user intervention. At App startup, we don't want to address this. In
// response to user activity, we do want to try to have the user address this.

Просмотреть файл

@ -294,14 +294,12 @@ public class UpdateService extends IntentService {
public void run() {
showPermissionNotification();
sendCheckUpdateResult(CheckUpdateResult.NOT_AVAILABLE);
}
})
}})
.run(new Runnable() {
@Override
public void run() {
startDownload(info, flags);
}
});
}});
}
private void startDownload(UpdateInfo info, int flags) {

Просмотреть файл

@ -101,8 +101,4 @@ final class UnusedResourcesUtil {
public static final int[] USED_IN_PAGE_ACTION = {
R.drawable.add_to_homescreen
};
public static final int[] USED_IN_LEANPLUM_EXPANDABLE_LIST_ACTIVITY = {
R.style.Widget_ExpandableListView,
};
}

Просмотреть файл

@ -565,6 +565,7 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
'db/LocalURLMetadata.java',
'db/LoginsProvider.java',
'db/PasswordsProvider.java',
'db/PerProfileDatabaseProvider.java',
'db/PerProfileDatabases.java',
'db/RemoteClient.java',
'db/RemoteTab.java',
@ -662,6 +663,7 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
'home/HomeConfigLoader.java',
'home/HomeConfigPrefsBackend.java',
'home/HomeContextMenuInfo.java',
'home/HomeExpandableListView.java',
'home/HomeFragment.java',
'home/HomeListView.java',
'home/HomePager.java',
@ -1160,7 +1162,7 @@ gbjar.extra_jars += [CONFIG['ANDROID_DESIGN_AAR_LIB']]
gbjar.extra_jars += [CONFIG['ANDROID_RECYCLERVIEW_V7_AAR_LIB']]
gbjar.extra_jars += [CONFIG['ANDROID_CUSTOMTABS_AAR_LIB']]
gbjar.javac_flags += ['-Xlint:all,-deprecation,-fallthrough,-cast', '-J-Xmx512m', '-J-Xms128m']
gbjar.javac_flags += ['-Xlint:all,-deprecation,-fallthrough', '-J-Xmx512m', '-J-Xms128m']
# gecko-thirdparty is a good place to put small independent libraries
gtjar = add_java_jar('gecko-thirdparty')

Просмотреть файл

@ -1,12 +0,0 @@
. "$topsrcdir/build/mozconfig.artifact.automation"
. "$topsrcdir/mobile/android/config/mozconfigs/common"
. "$topsrcdir/mobile/android/config/mozconfigs/android-api-16/nightly"
ac_add_options --without-google-play-services
unset MOZ_ANDROID_MMA
unset MOZ_ANDROID_POCKET
. "$topsrcdir/mobile/android/config/mozconfigs/common.override"

Просмотреть файл

@ -1,101 +0,0 @@
.. -*- Mode: rst; fill-column: 80; -*-
=================================
The Fennec Gradle configuration
=================================
The Fennec Gradle configuration has three major facets:
1. separation into Gradle projects;
2. Android-Gradle build configurations using `flavorDimensions`;
3. integration into the larger `moz.build` build system.
Separation into Gradle projects
===============================
The Fennec source code is separated into multiple Gradle projects. Right now,
there are only a few: `:app`, `:geckoview`, `:thirdparty`, etc. Over time, pieces
of the Fennec source code will be extracted into separate, more-or-less
stand-alone Gradle projects (e.g., `:services`, `:stumbler`, `:media`) and use
modern techniques such as dependency injection to configure themselves at
runtime.
The `:omnijar` project is special and exists only to support integration with
Android Studio.
The details of the Gradle projects are reflected in the root `settings.gradle`
and the `**/build.gradle` files throughout the tree.
Android-Gradle build configurations
===================================
The Fennec `:app` project uses the Android-Gradle build plugin
`flavorDimensions` feature set to support many different configurations. The
Gradle integration must support many often conflicting requirements; the flavor
dimensions chosen support these requirements.
Version 3.0+ of the Android-Gradle build plugin improves support for "variant
dependencies". This makes it easier for a consuming application (for us,
`:app`) to use the appropriate configuration of consumed libraries (for us,
`:geckoview`). This allows us to simplify the logic around packaging the Gecko
libraries and Omnijar.
The details of the Android-Gradle build configurations are reflected
`**/build.gradle` files throughout the tree, in the
`mobile/android/gradle/*.gradle` files, and in the configuration baked into
`mobile/android/gradle.configure`.
The notable flavor dimensions are:
audience
--------
The `audience` flavor dimension determines who the build is for. "local"
audiences are developers: they should get extra logging and as much support for
building Fennec as possible. In particular, "local" audiences get support for
modifying the Android manifest and regenerating the pre-processed `strings.xml`
files while building with Gradle from within Android Studio.
"official" audiences are end users: they should get Mozilla's official branding
and have security-sensitive developer features disabled. The "official"
audience corresponds roughly to the `MOZILLA_OFFICIAL=1` build setting.
**Builds shipped to the Google Play Store are always for "official" audiences.**
geckoBinaries
-------------
For deep historical reasons, Mozilla's build system has multiple stages, the
most important of which are the build stage and the package stage. During the
build stage, the Gecko compiled libraries (e.g., `libxul.so`) and the Omnijar
have not yet been built. These libraries are only available during the package
stage. Gradle builds always want to include the Gecko libraries and the
Omnijar.
To accommodate the different stages, the build stage always invokes
"withoutGeckoBinaries" Gradle configurations. These configurations don't expect
or use the Gecko libraries or Omnijar. At the moment, the package stage also
invokes "withoutGeckoBinaries", but in the future, the package stage will invoke
"withGeckoBinaries" Gradle configurations to simplify the packaging of libraries
and the omnijar.
**Local developers almost always want to build "withGeckoBinaries", so that the
APK files produced can be run on device.**
minApi
------
At various times in the past, Fennec has supported APK splits, producing APKs
that support only specific Android versions. While this is not used at this
time, there are certain developer options (i.e., options that should only apply
to "local" audiences) that *also* depend on the target Android version. This
flavor dimension allows to opt in to those options, improving the speed of
development.
Integration into the larger `moz.build` build system
====================================================
The details of the Gradle integration into the larger `moz.build` system are
mostly captured in configuration baked into `mobile/android/gradle.configure`.
This configuration is reflected in the Android-specific `mach android *`
commands defined in `mobile/android/mach_commands.py`.

Просмотреть файл

@ -20,7 +20,6 @@ Contents:
defaultdomains
shutdown
push
gradle
Indices and tables
==================

Просмотреть файл

@ -202,7 +202,7 @@ To test this locally, add lines like:
export MOZ_ANDROID_MMA=1
ac_add_options --with-leanplum-sdk-keyfile=/path/to/leanplum-sdk-developer.token
MOZ_ANDROID_MMA depends on MOZ_ANDROID_GOOGLE_PLAY_SERVICES and MOZ_ANDROID_GCM.
MOZ_ANDROID_MMA depends on MOZ_NATIVE_DEVICES and MOZ_ANDROID_GCM.
Since Leanplum requires Google Play Services library, those flags are a proxy for it, and enable respectively.
We want to enable MOZ_ANDROID_MMA in Nightly, but only for

Просмотреть файл

@ -2,8 +2,6 @@ buildDir "${topobjdir}/gradle/build/mobile/android/geckoview"
apply plugin: 'com.android.library'
apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
// This converts MOZ_APP_VERSION into an integer
// version code.
//
@ -40,8 +38,12 @@ def computeVersionCode() {
android {
compileSdkVersion project.ext.compileSdkVersion
buildToolsVersion project.ext.buildToolsVersion
defaultConfig {
defaultPublishConfig 'release'
publishNonDefault true
targetSdkVersion project.ext.targetSdkVersion
minSdkVersion project.ext.minSdkVersion
manifestPlaceholders = project.ext.manifestPlaceholders
@ -101,8 +103,14 @@ android {
buildConfigField 'boolean', 'MOZILLA_OFFICIAL', mozconfig.substs.MOZILLA_OFFICIAL ? 'true' : 'false';
}
project.configureProductFlavors.delegate = it
project.configureProductFlavors()
buildTypes {
withGeckoBinaries {
initWith release
}
withoutGeckoBinaries { // For clarity and consistency throughout the tree.
initWith release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
@ -146,16 +154,21 @@ android {
}
dependencies {
implementation "com.android.support:support-v4:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
implementation "com.android.support:palette-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:support-v4:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
compile "com.android.support:palette-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
}
apply from: "${topsrcdir}/mobile/android/gradle/with_gecko_binaries.gradle"
android.libraryVariants.all { variant ->
// See the notes in mobile/android/app/build.gradle for details on including
// Gecko binaries and the Omnijar.
if ((variant.productFlavors*.name).contains('withGeckoBinaries')) {
// Like 'debug', 'release', or 'withGeckoBinaries'.
def buildType = variant.buildType.name
// It would be most natural for :geckoview to always include the Gecko
// binaries, but that's difficult; see the notes in
// mobile/android/gradle/with_gecko_binaries.gradle. Instead :app uses
// :geckoview:release and handles it's own Gecko binary inclusion.
if (buildType.equals('withGeckoBinaries')) {
configureVariantWithGeckoBinaries(variant)
}
@ -189,12 +202,12 @@ android.libraryVariants.all { variant ->
options.addStringOption('noqualifier', 'java.lang');
}
def javadocJar = task("javadocJar${name.capitalize()}", type: Jar, dependsOn: javadoc) {
task "javadocJar${name.capitalize()}"(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
def sourcesJar = task("sourcesJar${name.capitalize()}", type: Jar) {
task "sourcesJar${name.capitalize()}"(type: Jar) {
classifier 'sources'
description = "Generate Javadoc for build variant $name"
destinationDir = new File(destinationDir, variant.baseName)
@ -203,7 +216,7 @@ android.libraryVariants.all { variant ->
}
android.libraryVariants.all { variant ->
configureLibraryVariantWithJNIWrappers(variant, "Generated")
configureVariantWithJNIWrappers(variant, "Generated")
}
apply plugin: 'maven'
@ -232,7 +245,7 @@ afterEvaluate {
// The bundle tasks are only present when the particular configuration is
// being built, so this task might not exist. (This is due to the way the
// Android Gradle plugin defines things during configuration.)
def bundleWithGeckoBinaries = tasks.findByName('bundleOfficialWithGeckoBinariesNoMinApiRelease')
def bundleWithGeckoBinaries = tasks.findByName('bundleWithGeckoBinaries')
if (!bundleWithGeckoBinaries) {
return
}
@ -246,10 +259,10 @@ afterEvaluate {
artifacts {
// Instead of default (release) configuration, publish one with Gecko binaries.
archives bundleOfficialWithGeckoBinariesNoMinApiRelease
archives bundleWithGeckoBinaries
// Javadoc and sources for developer ergononomics.
archives javadocJarOfficialWithGeckoBinariesNoMinApiRelease
archives sourcesJarOfficialWithGeckoBinariesNoMinApiRelease
archives javadocJarWithGeckoBinaries
archives sourcesJarWithGeckoBinaries
}
}

Просмотреть файл

@ -64,7 +64,7 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
private final int mPlayerId;
private boolean mExoplayerSuspended = false;
private enum MediaDecoderPlayState {
private enum MediaDecoderPlayState{
PLAY_STATE_PREPARING,
PLAY_STATE_PAUSED,
PLAY_STATE_PLAYING

Просмотреть файл

@ -2,10 +2,9 @@ buildDir "${topobjdir}/gradle/build/mobile/android/geckoview_example"
apply plugin: 'com.android.application'
apply from: "${topsrcdir}/mobile/android/gradle/product_flavors.gradle"
android {
compileSdkVersion project.ext.compileSdkVersion
buildToolsVersion project.ext.buildToolsVersion
defaultConfig {
targetSdkVersion project.ext.targetSdkVersion
@ -18,27 +17,52 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
// This is extremely frustrating, but the only way to do it automation for
// now. Without this, we only get a "debugAndroidTest" configuration; we
// have no "withoutGeckoBinariesAndroidTest" configuration.
testBuildType "withoutGeckoBinaries"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
withGeckoBinaries { // For consistency with :geckoview project in Task Cluster invocations.
initWith debug
}
withoutGeckoBinaries { // Logical negation of withGeckoBinaries.
initWith debug
}
}
project.configureProductFlavors.delegate = it
project.configureProductFlavors()
}
dependencies {
testImplementation 'junit:junit:4.12'
testCompile 'junit:junit:4.12'
implementation 'com.android.support:support-annotations:23.4.0'
compile 'com.android.support:support-annotations:23.4.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
// Not defining this library again results in test-app assuming 23.1.1, and the following errors:
// "Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.4.0) and test app (23.1.1) differ."
androidTestImplementation 'com.android.support:support-annotations:23.4.0'
androidTestCompile 'com.android.support:support-annotations:23.4.0'
implementation project(path: ':geckoview')
debugCompile project(path: ':geckoview', configuration: "debug")
releaseCompile project(path: ':geckoview', configuration: "release")
withGeckoBinariesCompile project(path: ':geckoview', configuration: "withGeckoBinaries")
withoutGeckoBinariesCompile project(path: ':geckoview', configuration: "withoutGeckoBinaries")
}
apply from: "${topsrcdir}/mobile/android/gradle/with_gecko_binaries.gradle"
android.applicationVariants.all { variant ->
// Like 'debug', 'release', or 'withoutGeckoBinaries'.
def buildType = variant.buildType.name
// It would be most natural for :geckoview to always include the Gecko
// binaries, but that's difficult; see the notes in
// mobile/android/gradle/with_gecko_binaries.gradle. Instead we handle our
// own Gecko binary inclusion.
if (!buildType.equals('withoutGeckoBinaries')) {
configureVariantWithGeckoBinaries(variant)
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше