Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2015-07-21 17:03:34 +02:00
Родитель 02bd667b13 b76ca95f3f
Коммит 54fdc8b0ee
166 изменённых файлов: 5119 добавлений и 1312 удалений

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

@ -191,6 +191,82 @@ let OutputGenerator = {
});
},
/**
* Adds math roles to the output, for a MathML accessible.
* @param {Array} aOutput Output array.
* @param {nsIAccessible} aAccessible current accessible object.
* @param {String} aRoleStr aAccessible's role string.
*/
_addMathRoles: function _addMathRoles(aOutput, aAccessible, aRoleStr) {
// First, determine the actual role to use (e.g. mathmlfraction).
let roleStr = aRoleStr;
switch(aAccessible.role) {
case Roles.MATHML_CELL:
case Roles.MATHML_ENCLOSED:
case Roles.MATHML_LABELED_ROW:
case Roles.MATHML_ROOT:
case Roles.MATHML_SQUARE_ROOT:
case Roles.MATHML_TABLE:
case Roles.MATHML_TABLE_ROW:
// Use the default role string.
break;
case Roles.MATHML_MULTISCRIPTS:
case Roles.MATHML_OVER:
case Roles.MATHML_SUB:
case Roles.MATHML_SUB_SUP:
case Roles.MATHML_SUP:
case Roles.MATHML_UNDER:
case Roles.MATHML_UNDER_OVER:
// For scripted accessibles, use the string 'mathmlscripted'.
roleStr = 'mathmlscripted';
break;
case Roles.MATHML_FRACTION:
// From a semantic point of view, the only important point is to
// distinguish between fractions that have a bar and those that do not.
// Per the MathML 3 spec, the latter happens iff the linethickness
// attribute is of the form [zero-float][optional-unit]. In that case,
// we use the string 'mathmlfractionwithoutbar'.
let linethickness = Utils.getAttributes(aAccessible).linethickness;
if (linethickness) {
let numberMatch = linethickness.match(/^(?:\d|\.)+/);
if (numberMatch && !parseFloat(numberMatch[0])) {
roleStr += 'withoutbar';
}
}
break;
default:
// Otherwise, do not output the actual role.
roleStr = null;
break;
}
// Get the math role based on the position in the parent accessible
// (e.g. numerator for the first child of a mathmlfraction).
let mathRole = Utils.getMathRole(aAccessible);
if (mathRole) {
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'push' : 'unshift']
({string: this._getOutputName(mathRole)});
}
if (roleStr) {
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'push' : 'unshift']
({string: this._getOutputName(roleStr)});
}
},
/**
* Adds MathML menclose notations to the output.
* @param {Array} aOutput Output array.
* @param {nsIAccessible} aAccessible current accessible object.
*/
_addMencloseNotations: function _addMencloseNotations(aOutput, aAccessible) {
let notations = Utils.getAttributes(aAccessible).notation || 'longdiv';
aOutput[this.outputOrder === OUTPUT_DESC_FIRST ? 'push' : 'unshift'].apply(
aOutput, [for (notation of notations.split(' '))
{string: this._getOutputName('notation-' + notation)}
]
);
},
/**
* Adds an entry type attribute to the description if available.
* @param {Array} aOutput Output array.
@ -212,7 +288,7 @@ let OutputGenerator = {
_addState: function _addState(aOutput, aState, aRoleStr) {}, // jshint ignore:line
_addRole: function _addRole(aOutput, aRoleStr) {}, // jshint ignore:line
_addRole: function _addRole(aOutput, aAccessible, aRoleStr) {}, // jshint ignore:line
get outputOrder() {
if (!this._utteranceOrder) {
@ -301,7 +377,67 @@ let OutputGenerator = {
'dialog': INCLUDE_DESC | INCLUDE_NAME,
'chrome window': IGNORE_EXPLICIT_NAME,
'app root': IGNORE_EXPLICIT_NAME,
'statusbar': NAME_FROM_SUBTREE_RULE },
'statusbar': NAME_FROM_SUBTREE_RULE,
'mathml table': INCLUDE_DESC | INCLUDE_NAME,
'mathml labeled row': NAME_FROM_SUBTREE_RULE,
'mathml table row': NAME_FROM_SUBTREE_RULE,
'mathml cell': INCLUDE_DESC | INCLUDE_NAME,
'mathml fraction': INCLUDE_DESC,
'mathml square root': INCLUDE_DESC,
'mathml root': INCLUDE_DESC,
'mathml enclosed': INCLUDE_DESC,
'mathml sub': INCLUDE_DESC,
'mathml sup': INCLUDE_DESC,
'mathml sub sup': INCLUDE_DESC,
'mathml under': INCLUDE_DESC,
'mathml over': INCLUDE_DESC,
'mathml under over': INCLUDE_DESC,
'mathml multiscripts': INCLUDE_DESC,
'mathml identifier': INCLUDE_DESC,
'mathml number': INCLUDE_DESC,
'mathml operator': INCLUDE_DESC,
'mathml text': INCLUDE_DESC,
'mathml string literal': INCLUDE_DESC,
'mathml row': INCLUDE_DESC,
'mathml style': INCLUDE_DESC,
'mathml error': INCLUDE_DESC },
mathmlRolesSet: new Set([
Roles.MATHML_MATH,
Roles.MATHML_IDENTIFIER,
Roles.MATHML_NUMBER,
Roles.MATHML_OPERATOR,
Roles.MATHML_TEXT,
Roles.MATHML_STRING_LITERAL,
Roles.MATHML_GLYPH,
Roles.MATHML_ROW,
Roles.MATHML_FRACTION,
Roles.MATHML_SQUARE_ROOT,
Roles.MATHML_ROOT,
Roles.MATHML_FENCED,
Roles.MATHML_ENCLOSED,
Roles.MATHML_STYLE,
Roles.MATHML_SUB,
Roles.MATHML_SUP,
Roles.MATHML_SUB_SUP,
Roles.MATHML_UNDER,
Roles.MATHML_OVER,
Roles.MATHML_UNDER_OVER,
Roles.MATHML_MULTISCRIPTS,
Roles.MATHML_TABLE,
Roles.LABELED_ROW,
Roles.MATHML_TABLE_ROW,
Roles.MATHML_CELL,
Roles.MATHML_ACTION,
Roles.MATHML_ERROR,
Roles.MATHML_STACK,
Roles.MATHML_LONG_DIVISION,
Roles.MATHML_STACK_GROUP,
Roles.MATHML_STACK_ROW,
Roles.MATHML_STACK_CARRIES,
Roles.MATHML_STACK_CARRY,
Roles.MATHML_STACK_LINE
]),
objectOutputFunctions: {
_generateBaseOutput:
@ -311,7 +447,7 @@ let OutputGenerator = {
if (aFlags & INCLUDE_DESC) {
this._addState(output, aState, aRoleStr);
this._addType(output, aAccessible, aRoleStr);
this._addRole(output, aRoleStr);
this._addRole(output, aAccessible, aRoleStr);
}
if (aFlags & INCLUDE_VALUE && aAccessible.value.trim()) {
@ -348,7 +484,7 @@ let OutputGenerator = {
aAccessible.groupPosition({}, itemof, itemno);
let output = [];
this._addState(output, aState);
this._addRole(output, aRoleStr);
this._addRole(output, aAccessible, aRoleStr);
output.push({
string: 'objItemOfN',
args: [itemno.value, itemof.value]
@ -374,7 +510,7 @@ let OutputGenerator = {
if (table.isProbablyForLayout()) {
return output;
}
this._addRole(output, aRoleStr);
this._addRole(output, aAccessible, aRoleStr);
output.push.call(output, {
string: this._getOutputName('tblColumnInfo'),
count: table.columnCount
@ -394,6 +530,23 @@ let OutputGenerator = {
this._addName(output, aAccessible, aFlags);
this._addLandmark(output, aAccessible);
return output;
},
// Use the table output functions for MathML tabular elements.
mathmltable: function mathmltable() {
return this.objectOutputFunctions.table.apply(this, arguments);
},
mathmlcell: function mathmlcell() {
return this.objectOutputFunctions.cell.apply(this, arguments);
},
mathmlenclosed: function mathmlenclosed(aAccessible, aRoleStr, aState,
aFlags, aContext) {
let output = this.objectOutputFunctions.defaultFunc.
apply(this, [aAccessible, aRoleStr, aState, aFlags, aContext]);
this._addMencloseNotations(output, aAccessible);
return output;
}
}
};
@ -597,8 +750,12 @@ this.UtteranceGenerator = { // jshint ignore:line
return aContext.newAncestry;
},
_addRole: function _addRole(aOutput, aRoleStr) {
aOutput.push({string: this._getOutputName(aRoleStr)});
_addRole: function _addRole(aOutput, aAccessible, aRoleStr) {
if (this.mathmlRolesSet.has(aAccessible.role)) {
this._addMathRoles(aOutput, aAccessible, aRoleStr);
} else {
aOutput.push({string: this._getOutputName(aRoleStr)});
}
},
_addState: function _addState(aOutput, aState, aRoleStr) {
@ -657,7 +814,7 @@ this.UtteranceGenerator = { // jshint ignore:line
_getListUtterance:
function _getListUtterance(aAccessible, aRoleStr, aFlags, aItemCount) {
let utterance = [];
this._addRole(utterance, aRoleStr);
this._addRole(utterance, aAccessible, aRoleStr);
utterance.push({
string: this._getOutputName('listItemsCount'),
count: aItemCount
@ -805,8 +962,12 @@ this.BrailleGenerator = { // jshint ignore:line
return OutputGenerator._getOutputName(aName) + 'Abbr';
},
_addRole: function _addRole(aBraille, aRoleStr) {
aBraille.push({string: this._getOutputName(aRoleStr)});
_addRole: function _addRole(aBraille, aAccessible, aRoleStr) {
if (this.mathmlRolesSet.has(aAccessible.role)) {
this._addMathRoles(aBraille, aAccessible, aRoleStr);
} else {
aBraille.push({string: this._getOutputName(aRoleStr)});
}
},
_addState: function _addState(aBraille, aState, aRoleStr) {

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

@ -102,7 +102,8 @@ var gSimpleTraversalRoles =
Roles.COLUMNHEADER,
Roles.ROWHEADER,
Roles.STATUSBAR,
Roles.SWITCH];
Roles.SWITCH,
Roles.MATHML_MATH];
var gSimpleMatchFunc = function gSimpleMatchFunc(aAccessible) {
// An object is simple, if it either has a single child lineage,

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

@ -415,21 +415,41 @@ this.Utils = { // jshint ignore:line
},
getLandmarkName: function getLandmarkName(aAccessible) {
const landmarks = [
return this.matchRoles(aAccessible, [
'banner',
'complementary',
'contentinfo',
'main',
'navigation',
'search'
];
]);
},
getMathRole: function getMathRole(aAccessible) {
return this.matchRoles(aAccessible, [
'base',
'close-fence',
'denominator',
'numerator',
'open-fence',
'overscript',
'presubscript',
'presuperscript',
'root-index',
'subscript',
'superscript',
'underscript'
]);
},
matchRoles: function matchRoles(aAccessible, aRoles) {
let roles = this.getAttributes(aAccessible)['xml-roles'];
if (!roles) {
return;
}
// Looking up a role that would match a landmark.
return this.matchAttributeValue(roles, landmarks);
// Looking up a role that would match any in the provided roles.
return this.matchAttributeValue(roles, aRoles);
},
getEmbeddedControl: function getEmbeddedControl(aLabel) {
@ -884,8 +904,12 @@ PivotContext.prototype = {
if (!aAccessible) {
return null;
}
if ([Roles.CELL, Roles.COLUMNHEADER, Roles.ROWHEADER].indexOf(
aAccessible.role) < 0) {
if ([
Roles.CELL,
Roles.COLUMNHEADER,
Roles.ROWHEADER,
Roles.MATHML_CELL
].indexOf(aAccessible.role) < 0) {
return null;
}
try {
@ -950,7 +974,9 @@ PivotContext.prototype = {
cellInfo.current.columnHeaderCells))];
}
cellInfo.rowHeaders = [];
if (cellInfo.rowChanged && cellInfo.current.role === Roles.CELL) {
if (cellInfo.rowChanged &&
(cellInfo.current.role === Roles.CELL ||
cellInfo.current.role === Roles.MATHML_CELL)) {
cellInfo.rowHeaders = [headers for (headers of getHeaders( // jshint ignore:line
cellInfo.current.rowHeaderCells))];
}

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

@ -18,6 +18,7 @@ skip-if = buildapp == 'mulet'
[test_hints.html]
[test_landmarks.html]
[test_live_regions.html]
[test_output_mathml.html]
[test_output.html]
[test_quicknav_modes.html]
[test_tables.html]

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

@ -145,5 +145,11 @@
<div aria-label="Last sync: 30min ago" id="statusbar-2" role="status"></div>
<span id="switch-1" role="switch" aria-checked="false" aria-label="Light switch"></span>
<p>This is a MathML formula <math id="math-1" display="block">
<mfrac>
<mrow><mi>x</mi><mo>+</mo><mn>1</mn></mrow>
<msqrt><mn>3</mn><mo>/</mo><mn>4</mn></msqrt>
</mfrac>
</math> with some text after.</p>
</body>
</html>

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

@ -0,0 +1,305 @@
<html>
<head>
<title>[AccessFu] MathML Accessibility Support</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="output.js"></script>
<script type="application/javascript">
function doTest() {
// Test the following accOrElmOrID.
var tests = [{
accOrElmOrID: "math-1",
expectedUtterance: [
[{"string":"open-fence"},"(","x",",","y",{"string":"close-fence"},")"],
["(",{"string":"open-fence"},"x",",","y",")",{"string":"close-fence"}]
],
expectedBraille: [
[{"string":"open-fenceAbbr"},"(","x",",","y",{"string":"close-fenceAbbr"},")"],
["(",{"string":"open-fenceAbbr"},"x",",","y",")",{"string":"close-fenceAbbr"}]
]
}, {
accOrElmOrID: "mfrac-1",
expectedUtterance: [
[{"string":"mathmlfraction"},{"string":"numerator"},"a",{"string":"denominator"},"b"],
["a",{"string":"numerator"},"b",{"string":"denominator"},{"string":"mathmlfraction"}]
],
expectedBraille: [
[{"string":"mathmlfractionAbbr"},{"string":"numeratorAbbr"},"a",{"string":"denominatorAbbr"},"b"],
["a",{"string":"numeratorAbbr"},"b",{"string":"denominatorAbbr"},{"string":"mathmlfractionAbbr"}]
]
}, {
accOrElmOrID: "mfrac-2",
expectedUtterance: [
[{"string":"mathmlfractionwithoutbar"},{"string":"numerator"},"a",{"string":"denominator"},"b"],
["a",{"string":"numerator"},"b",{"string":"denominator"},{"string":"mathmlfractionwithoutbar"}]
],
expectedBraille: [
[{"string":"mathmlfractionwithoutbarAbbr"},{"string":"numeratorAbbr"},"a",{"string":"denominatorAbbr"},"b"],
["a",{"string":"numeratorAbbr"},"b",{"string":"denominatorAbbr"},{"string":"mathmlfractionwithoutbarAbbr"}]
]
}, {
accOrElmOrID: "msub-1",
expectedUtterance: [
[{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"subscript"},"b"],
["a",{"string":"base"},"b",{"string":"subscript"},{"string":"mathmlscripted"}]
],
expectedBraille: [
[{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"subscriptAbbr"},"b"],
["a",{"string":"baseAbbr"},"b",{"string":"subscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
]
}, {
accOrElmOrID: "msup-1",
expectedUtterance: [
[{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"superscript"},"b"],
["a",{"string":"base"},"b",{"string":"superscript"},{"string":"mathmlscripted"}]
],
expectedBraille: [
[{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"superscriptAbbr"},"b"],
["a",{"string":"baseAbbr"},"b",{"string":"superscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
]
}, {
accOrElmOrID: "msubsup-1",
expectedUtterance: [
[{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"subscript"},"b",{"string":"superscript"},"c"],
["a",{"string":"base"},"b",{"string":"subscript"},"c",{"string":"superscript"},{"string":"mathmlscripted"}]
],
expectedBraille: [
[{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"subscriptAbbr"},"b",{"string":"superscriptAbbr"},"c"],
["a",{"string":"baseAbbr"},"b",{"string":"subscriptAbbr"},"c",{"string":"superscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
]
}, {
accOrElmOrID: "mmultiscripts-1",
expectedUtterance: [
[{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"subscript"},"b",{"string":"superscript"},"c",{"string":"superscript"},"d",{"string":"presubscript"},"e",{"string":"presubscript"},"f",{"string":"presuperscript"},"g"],
["a",{"string":"base"},"b",{"string":"subscript"},"c",{"string":"superscript"},"d",{"string":"superscript"},"e",{"string":"presubscript"},"f",{"string":"presubscript"},"g",{"string":"presuperscript"},{"string":"mathmlscripted"}]
],
expectedBraille: [
[{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"subscriptAbbr"},"b",{"string":"superscriptAbbr"},"c",{"string":"superscriptAbbr"},"d",{"string":"presubscriptAbbr"},"e",{"string":"presubscriptAbbr"},"f",{"string":"presuperscriptAbbr"},"g"],
["a",{"string":"baseAbbr"},"b",{"string":"subscriptAbbr"},"c",{"string":"superscriptAbbr"},"d",{"string":"superscriptAbbr"},"e",{"string":"presubscriptAbbr"},"f",{"string":"presubscriptAbbr"},"g",{"string":"presuperscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
]
}, {
accOrElmOrID: "munder-1",
expectedUtterance: [
[{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"underscript"},"b"],
["a",{"string":"base"},"b",{"string":"underscript"},{"string":"mathmlscripted"}]
],
expectedBraille: [
[{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"underscriptAbbr"},"b"],
["a",{"string":"baseAbbr"},"b",{"string":"underscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
]
}, {
accOrElmOrID: "mover-1",
expectedUtterance: [
[{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"overscript"},"b"],
["a",{"string":"base"},"b",{"string":"overscript"},{"string":"mathmlscripted"}]
],
expectedBraille: [
[{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"overscriptAbbr"},"b"],
["a",{"string":"baseAbbr"},"b",{"string":"overscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
]
}, {
accOrElmOrID: "munderover-1",
expectedUtterance: [
[{"string":"mathmlscripted"},{"string":"base"},"a",{"string":"underscript"},"b",{"string":"overscript"},"c"],
["a",{"string":"base"},"b",{"string":"underscript"},"c",{"string":"overscript"},{"string":"mathmlscripted"}]
],
expectedBraille: [
[{"string":"mathmlscriptedAbbr"},{"string":"baseAbbr"},"a",{"string":"underscriptAbbr"},"b",{"string":"overscriptAbbr"},"c"],
["a",{"string":"baseAbbr"},"b",{"string":"underscriptAbbr"},"c",{"string":"overscriptAbbr"},{"string":"mathmlscriptedAbbr"}]
]
}, {
accOrElmOrID: "mroot-1",
expectedUtterance: [
[{"string":"mathmlroot"},{"string":"base"},"a",{"string":"root-index"},"b"],
["a",{"string":"base"},"b",{"string":"root-index"},{"string":"mathmlroot"}]
],
expectedBraille: [
[{"string":"mathmlrootAbbr"},{"string":"baseAbbr"},"a",{"string":"root-indexAbbr"},"b"],
["a",{"string":"baseAbbr"},"b",{"string":"root-indexAbbr"},{"string":"mathmlrootAbbr"}]
]
}, {
accOrElmOrID: "mtable-1",
expectedUtterance: [
[{"string":"mathmltable"},{"string":"tblColumnInfo","count":3},{"string":"tblRowInfo","count":2},{"string":"columnInfo","args":[1]},{"string":"rowInfo","args":[1]},"a",{"string":"columnInfo","args":[2]},{"string":"rowInfo","args":[1]},"b",{"string":"columnInfo","args":[3]},{"string":"rowInfo","args":[1]},"c",{"string":"columnInfo","args":[1]},{"string":"rowInfo","args":[2]},"d",{"string":"columnInfo","args":[2]},{"string":"rowInfo","args":[2]},"e",{"string":"columnInfo","args":[3]},{"string":"rowInfo","args":[2]},"f"],
["a",{"string":"columnInfo","args":[1]},{"string":"rowInfo","args":[1]},"b",{"string":"columnInfo","args":[2]},{"string":"rowInfo","args":[1]},"c",{"string":"columnInfo","args":[3]},{"string":"rowInfo","args":[1]},"d",{"string":"columnInfo","args":[1]},{"string":"rowInfo","args":[2]},"e",{"string":"columnInfo","args":[2]},{"string":"rowInfo","args":[2]},"f",{"string":"columnInfo","args":[3]},{"string":"rowInfo","args":[2]},{"string":"mathmltable"},{"string":"tblColumnInfo","count":3},{"string":"tblRowInfo","count":2}]
],
expectedBraille: [
[{"string":"mathmltableAbbr"},{"string":"tblColumnInfoAbbr","count":3},{"string":"tblRowInfoAbbr","count":2},{"string":"cellInfoAbbr","args":[1,1]},"a",{"string":"cellInfoAbbr","args":[2,1]},"b",{"string":"cellInfoAbbr","args":[3,1]},"c",{"string":"cellInfoAbbr","args":[1,2]},"d",{"string":"cellInfoAbbr","args":[2,2]},"e",{"string":"cellInfoAbbr","args":[3,2]},"f"],
["a",{"string":"cellInfoAbbr","args":[1,1]},"b",{"string":"cellInfoAbbr","args":[2,1]},"c",{"string":"cellInfoAbbr","args":[3,1]},"d",{"string":"cellInfoAbbr","args":[1,2]},"e",{"string":"cellInfoAbbr","args":[2,2]},"f",{"string":"cellInfoAbbr","args":[3,2]},{"string":"mathmltableAbbr"},{"string":"tblColumnInfoAbbr","count":3},{"string":"tblRowInfoAbbr","count":2}]
]
}, {
accOrElmOrID: "menclose-1",
expectedUtterance: [
[{"string":"mathmlenclosed"},{"string":"notation-longdiv"},"a"],
["a",{"string":"notation-longdiv"},{"string":"mathmlenclosed"}]
],
expectedBraille: [
[{"string":"mathmlenclosedAbbr"},{"string":"notation-longdivAbbr"},"a"],
["a",{"string":"notation-longdivAbbr"},{"string":"mathmlenclosedAbbr"}]
]
}, {
accOrElmOrID: "menclose-2",
expectedUtterance: [
[{"string":"mathmlenclosed"},{"string":"notation-circle"},"a"],
["a",{"string":"notation-circle"},{"string":"mathmlenclosed"}]
],
expectedBraille: [
[{"string":"mathmlenclosedAbbr"},{"string":"notation-circleAbbr"},"a"],
["a",{"string":"notation-circleAbbr"},{"string":"mathmlenclosedAbbr"}]
]
}, {
accOrElmOrID: "menclose-3",
expectedUtterance: [
[{"string":"mathmlenclosed"},{"string":"notation-left"},{"string":"notation-top"},{"string":"notation-bottom"},"a"],
["a",{"string":"notation-left"},{"string":"notation-top"},{"string":"notation-bottom"},{"string":"mathmlenclosed"}]
],
expectedBraille: [
[{"string":"mathmlenclosedAbbr"},{"string":"notation-leftAbbr"},{"string":"notation-topAbbr"},{"string":"notation-bottomAbbr"},"a"],
["a",{"string":"notation-leftAbbr"},{"string":"notation-topAbbr"},{"string":"notation-bottomAbbr"},{"string":"mathmlenclosedAbbr"}]
]
}];
// Test all possible utterance order preference values.
tests.forEach(function run(test) {
var outputOrderValues = [0, 1];
outputOrderValues.forEach(function testOutputOrder(outputOrder) {
SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, outputOrder);
testOutput(test.expectedUtterance[outputOrder], test.accOrElmOrID,
test.oldAccOrElmOrID, 1);
testOutput(test.expectedBraille[outputOrder], test.accOrElmOrID,
test.oldAccOrElmOrID, 0);
});
});
// If there was an original utterance order preference, revert to it.
SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<div id="root">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1163374"
title="[AccessFu] MathML Accessibility Support">
Mozilla Bug 1163374
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test"></pre>
<math id="math-1"><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo>)</mo></math>
<math>
<mfrac id="mfrac-1">
<mi>a</mi>
<mi>b</mi>
</mfrac>
</math>
<math>
<mfrac id="mfrac-2" linethickness="0px">
<mi>a</mi>
<mi>b</mi>
</mfrac>
</math>
<math>
<msub id="msub-1">
<mi>a</mi>
<mi>b</mi>
</msub>
</math>
<math>
<msup id="msup-1">
<mi>a</mi>
<mi>b</mi>
</msup>
</math>
<math>
<msubsup id="msubsup-1">
<mi>a</mi>
<mi>b</mi>
<mi>c</mi>
</msubsup>
</math>
<math>
<mmultiscripts id="mmultiscripts-1">
<mi>a</mi>
<mi>b</mi>
<mi>c</mi>
<none/>
<mi>d</mi>
<mprescripts/>
<mi>e</mi>
<none/>
<mi>f</mi>
<mi>g</mi>
</mmultiscripts>
</math>
<math>
<munder id="munder-1">
<mi>a</mi>
<mi>b</mi>
</munder>
</math>
<math>
<mover id="mover-1">
<mi>a</mi>
<mi>b</mi>
</mover>
</math>
<math>
<munderover id="munderover-1">
<mi>a</mi>
<mi>b</mi>
<mi>c</mi>
</munderover>
</math>
<math>
<mroot id="mroot-1">
<mi>a</mi>
<mi>b</mi>
</mroot>
</math>
<math>
<mtable id="mtable-1">
<mtr>
<mtd><mi>a</mi></mtd>
<mtd><mi>b</mi></mtd>
<mtd><mi>c</mi></mtd>
</mtr>
<mtr>
<mtd><mi>d</mi></mtd>
<mtd><mi>e</mi></mtd>
<mtd><mi>f</mi></mtd>
</mtr>
</mtable>
</math>
<math>
<menclose id="menclose-1"><mi>a</mi></menclose>
</math>
<math>
<menclose id="menclose-2" notation="circle"><mi>a</mi></menclose>
</math>
<math>
<menclose id="menclose-3" notation="left top bottom"><mi>a</mi></menclose>
</math>
</div>
</body>
</html>

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

@ -124,7 +124,8 @@
'5 8', 'gridcell4', 'Just an innocuous separator',
'Dirty Words', 'Meaning', 'Mud', 'Wet Dirt',
'Dirt', 'Messy Stuff', 'statusbar-1', 'statusbar-2',
'switch-1']);
'switch-1', 'This is a MathML formula ', 'math-1',
'with some text after.']);
gQueue.invoke();
}

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

@ -15,15 +15,15 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4fe0507781f3ed56c8ae5e66dd9489165d1ff68e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="805cf546729ba742bf23febda52970fcb35c0e8f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="cacd27c973f6c84d13a67adaf5d6fce4ae898e9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="62682dcee5368fe43284efa4e90f22cb1c88b79e"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

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

@ -15,15 +15,15 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4fe0507781f3ed56c8ae5e66dd9489165d1ff68e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="805cf546729ba742bf23febda52970fcb35c0e8f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="cacd27c973f6c84d13a67adaf5d6fce4ae898e9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="62682dcee5368fe43284efa4e90f22cb1c88b79e"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

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

@ -19,8 +19,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4fe0507781f3ed56c8ae5e66dd9489165d1ff68e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="805cf546729ba742bf23febda52970fcb35c0e8f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="8bc59310552179f9a8bc6cdd0188e2475df52fb7"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="9d0e5057ee5404a31ec1bf76131cb11336a7c3b6"/>

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

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4fe0507781f3ed56c8ae5e66dd9489165d1ff68e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="805cf546729ba742bf23febda52970fcb35c0e8f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="cacd27c973f6c84d13a67adaf5d6fce4ae898e9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="62682dcee5368fe43284efa4e90f22cb1c88b79e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

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

@ -15,15 +15,15 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4fe0507781f3ed56c8ae5e66dd9489165d1ff68e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="805cf546729ba742bf23febda52970fcb35c0e8f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="cacd27c973f6c84d13a67adaf5d6fce4ae898e9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="62682dcee5368fe43284efa4e90f22cb1c88b79e"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>

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

@ -15,15 +15,15 @@
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4fe0507781f3ed56c8ae5e66dd9489165d1ff68e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="805cf546729ba742bf23febda52970fcb35c0e8f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="cacd27c973f6c84d13a67adaf5d6fce4ae898e9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="62682dcee5368fe43284efa4e90f22cb1c88b79e"/>
<!-- Stock Android things -->
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>

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

@ -19,8 +19,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4fe0507781f3ed56c8ae5e66dd9489165d1ff68e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="805cf546729ba742bf23febda52970fcb35c0e8f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="8bc59310552179f9a8bc6cdd0188e2475df52fb7"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="9d0e5057ee5404a31ec1bf76131cb11336a7c3b6"/>

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

@ -15,15 +15,15 @@
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4fe0507781f3ed56c8ae5e66dd9489165d1ff68e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="805cf546729ba742bf23febda52970fcb35c0e8f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="cacd27c973f6c84d13a67adaf5d6fce4ae898e9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="62682dcee5368fe43284efa4e90f22cb1c88b79e"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>

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

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "4fe0507781f3ed56c8ae5e66dd9489165d1ff68e",
"git_revision": "805cf546729ba742bf23febda52970fcb35c0e8f",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "59fc14fbf1eb5d1985442274ba4f414097156479",
"revision": "669a688b25adf51474f17cc6febdf2a4ba626b93",
"repo_path": "integration/gaia-central"
}

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

@ -17,10 +17,10 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4fe0507781f3ed56c8ae5e66dd9489165d1ff68e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="805cf546729ba742bf23febda52970fcb35c0e8f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="cacd27c973f6c84d13a67adaf5d6fce4ae898e9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="62682dcee5368fe43284efa4e90f22cb1c88b79e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

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

@ -15,15 +15,15 @@
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4fe0507781f3ed56c8ae5e66dd9489165d1ff68e"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="805cf546729ba742bf23febda52970fcb35c0e8f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="c490ae41c67f892232599f4ef049467a922b613e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="cacd27c973f6c84d13a67adaf5d6fce4ae898e9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="62682dcee5368fe43284efa4e90f22cb1c88b79e"/>
<!-- Stock Android things -->
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>

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

@ -5610,11 +5610,24 @@ function handleLinkClick(event, href, linkNode) {
catch (e) { }
}
// first get document wide referrer policy, then
// get referrer attribute from clicked link and parse it and
// allow per element referrer to overrule the document wide referrer if enabled
let referrerPolicy = doc.referrerPolicy;
if (Services.prefs.getBoolPref("network.http.enablePerElementReferrer") &&
linkNode) {
let referrerAttrValue = Services.netUtils.parseAttributePolicyString(linkNode.
getAttribute("referrer"));
if (referrerAttrValue != Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT) {
referrerPolicy = referrerAttrValue;
}
}
urlSecurityCheck(href, doc.nodePrincipal);
let params = { charset: doc.characterSet,
allowMixedContent: persistAllowMixedContentInChildTab,
referrerURI: referrerURI,
referrerPolicy: doc.referrerPolicy,
referrerPolicy: referrerPolicy,
noReferrer: BrowserUtils.linkHasNoReferrer(linkNode) };
openLinkIn(href, where, params);
event.preventDefault();

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

@ -105,6 +105,17 @@ let handleContentContextMenu = function (event) {
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
// get referrer attribute from clicked link and parse it
// if per element referrer is enabled, the element referrer overrules
// the document wide referrer
if (Services.prefs.getBoolPref("network.http.enablePerElementReferrer")) {
let referrerAttrValue = Services.netUtils.parseAttributePolicyString(event.target.
getAttribute("referrer"));
if (referrerAttrValue !== Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT) {
referrerPolicy = referrerAttrValue;
}
}
let disableSetDesktopBg = null;
// Media related cache info parent needs for saving
let contentType = null;
@ -351,10 +362,23 @@ let ClickEventHandler = {
let [href, node] = this._hrefAndLinkNodeForClickEvent(event);
// get referrer attribute from clicked link and parse it
// if per element referrer is enabled, the element referrer overrules
// the document wide referrer
let referrerPolicy = ownerDoc.referrerPolicy;
if (Services.prefs.getBoolPref("network.http.enablePerElementReferrer") &&
node) {
let referrerAttrValue = Services.netUtils.parseAttributePolicyString(node.
getAttribute("referrer"));
if (referrerAttrValue !== Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT) {
referrerPolicy = referrerAttrValue;
}
}
let json = { button: event.button, shiftKey: event.shiftKey,
ctrlKey: event.ctrlKey, metaKey: event.metaKey,
altKey: event.altKey, href: null, title: null,
bookmark: false, referrerPolicy: ownerDoc.referrerPolicy };
bookmark: false, referrerPolicy: referrerPolicy };
if (href) {
try {

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

@ -295,7 +295,6 @@ skip-if = true # browser_drag.js is disabled, as it needs to be updated for the
[browser_favicon_change.js]
[browser_favicon_change_not_in_document.js]
[browser_findbarClose.js]
[browser_focusnavigation.js]
[browser_fullscreen-window-open.js]
skip-if = buildapp == 'mulet' || e10s || os == "linux" # Bug 933103 - mochitest's EventUtils.synthesizeMouse functions not e10s friendly. Linux: Intermittent failures - bug 941575.
[browser_fxa_migrate.js]

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

@ -1,53 +0,0 @@
/*
* This test checks that focus navigation iterates over the browser elements and content page.
*/
function doTab(expectedTarget)
{
let focusEventPromise = BrowserTestUtils.waitForEvent(expectedTarget, "focus", true);
EventUtils.synthesizeKey("VK_TAB", { });
return focusEventPromise;
}
add_task(function* () {
let testPage = "data:text/html,<html id='html1'><body id='body1'>Some Text<input id='input1'></body></html>";
yield BrowserTestUtils.openNewForegroundTab(gBrowser, testPage);
gURLBar.focus();
// Move focus to the searchbar
EventUtils.synthesizeKey("VK_TAB", { });
is(document.activeElement, document.getElementById("searchbar").textbox.inputField, "searchbar focused");
// Set the selection to a specific location, so that focus navigation would
// normally start from there.
yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* (arg) {
let selection = content.document.getSelection();
selection.modify("move", "right", "character");
});
// Move focus to the root element of the document
yield doTab(gBrowser.selectedBrowser);
is(document.activeElement, gBrowser.selectedBrowser, "browser focused");
let focusedId = yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* (arg) {
return content.document.activeElement.id;
});
is(focusedId, "html1", "html focused");
// Move focus to the button in the document
EventUtils.synthesizeKey("VK_TAB", { });
is(document.activeElement, gBrowser.selectedBrowser, "browser still focused");
focusedId = yield ContentTask.spawn(gBrowser.selectedBrowser, { }, function* (arg) {
return content.document.activeElement.id;
});
is(focusedId, "input1", "input focused");
// Move focus and loop back to the tabbar
yield doTab(document);
is(document.activeElement.localName, "tab", "tab focused");
gBrowser.removeCurrentTab();
});

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

@ -180,6 +180,11 @@ bool isIgnoredPathForImplicitCtor(const Decl *decl) {
begin->compare_lower(StringRef("graphite2")) == 0) {
return true;
}
if (begin->compare_lower(StringRef("chromium")) == 0) {
// Ignore security/sandbox/chromium but not ipc/chromium.
++begin;
return begin != end && begin->compare_lower(StringRef("sandbox")) == 0;
}
}
return false;
}

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

@ -77,6 +77,7 @@
#include "IHistory.h"
#include "nsViewSourceHandler.h"
#include "nsWhitespaceTokenizer.h"
#include "nsICookieService.h"
// we want to explore making the document own the load group
// so we can associate the document URI with the load group.
@ -207,10 +208,6 @@
#endif
#include "mozIThirdPartyUtil.h"
// Values for the network.cookie.cookieBehavior pref are documented in
// nsCookieService.cpp
#define COOKIE_BEHAVIOR_ACCEPT 0 // Allow all cookies.
#define COOKIE_BEHAVIOR_REJECT_FOREIGN 1 // Reject all third-party cookies.
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
@ -13509,6 +13506,16 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
nsCOMPtr<nsIURI> referer = refererDoc->GetDocumentURI();
uint32_t refererPolicy = refererDoc->GetReferrerPolicy();
// get referrer attribute from clicked link and parse it
// if per element referrer is enabled, the element referrer overrules
// the document wide referrer
if (IsElementAnchor(aContent)) {
net::ReferrerPolicy refPolEnum = aContent->AsElement()->GetReferrerPolicy();
if (refPolEnum != net::RP_Unset) {
refererPolicy = refPolEnum;
}
}
// referer could be null here in some odd cases, but that's ok,
// we'll just load the link w/o sending a referer in those cases.
@ -14068,8 +14075,8 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNavigate,
NS_ENSURE_SUCCESS(result, result);
if (isThirdPartyURI &&
(Preferences::GetInt("network.cookie.cookieBehavior",
COOKIE_BEHAVIOR_ACCEPT) ==
COOKIE_BEHAVIOR_REJECT_FOREIGN)) {
nsICookieService::BEHAVIOR_ACCEPT) ==
nsICookieService::BEHAVIOR_REJECT_FOREIGN)) {
return NS_OK;
}
}

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

@ -20,46 +20,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AnimationTimeline)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
namespace {
struct AddAnimationParams {
AnimationTimeline::AnimationSequence& mSequence;
#ifdef DEBUG
// This is only used for a pointer-equality assertion
AnimationTimeline* mTimeline;
#endif
};
} // namespace
static PLDHashOperator
AppendAnimationToSequence(nsRefPtrHashKey<dom::Animation>* aKey,
void* aParams)
{
Animation* animation = aKey->GetKey();
AddAnimationParams* params = static_cast<AddAnimationParams*>(aParams);
MOZ_ASSERT(animation->IsRelevant(),
"Animations registered with a timeline should be relevant");
MOZ_ASSERT(animation->GetTimeline() == params->mTimeline,
"Animation should refer to this timeline");
// Bug 1174575: Until we implement a suitable PseudoElement interface we
// don't have anything to return for the |target| attribute of
// KeyframeEffect(ReadOnly) objects that refer to pseudo-elements.
// Rather than return some half-baked version of these objects (e.g.
// we a null effect attribute) we simply don't provide access to animations
// whose effect refers to a pseudo-element until we can support them properly.
Element* target;
nsCSSPseudoElements::Type pseudoType;
animation->GetEffect()->GetTarget(target, pseudoType);
if (pseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement) {
return PL_DHASH_NEXT;
}
params->mSequence.AppendElement(animation);
return PL_DHASH_NEXT;
}
void
AnimationTimeline::GetAnimations(AnimationSequence& aAnimations)
{
@ -71,12 +31,28 @@ AnimationTimeline::GetAnimations(AnimationSequence& aAnimations)
}
}
#ifdef DEBUG
AddAnimationParams params{ aAnimations, this };
#else
AddAnimationParams params{ aAnimations };
#endif
mAnimations.EnumerateEntries(AppendAnimationToSequence, &params);
for (auto iter = mAnimations.Iter(); !iter.Done(); iter.Next()) {
Animation* animation = iter.Get()->GetKey();
MOZ_ASSERT(animation->IsRelevant(),
"Animations registered with a timeline should be relevant");
MOZ_ASSERT(animation->GetTimeline() == this,
"Animation should refer to this timeline");
// Bug 1174575: Until we implement a suitable PseudoElement interface we
// don't have anything to return for the |target| attribute of
// KeyframeEffect(ReadOnly) objects that refer to pseudo-elements.
// Rather than return some half-baked version of these objects (e.g.
// we a null effect attribute) we simply don't provide access to animations
// whose effect refers to a pseudo-element until we can support them
// properly.
Element* target;
nsCSSPseudoElements::Type pseudoType;
animation->GetEffect()->GetTarget(target, pseudoType);
if (pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
aAnimations.AppendElement(animation);
}
}
// Sort animations by priority
aAnimations.Sort(AnimationPtrComparator<nsRefPtr<Animation>>());

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

@ -48,60 +48,56 @@ PendingAnimationTracker::IsWaiting(const dom::Animation& aAnimation,
return aSet.Contains(const_cast<dom::Animation*>(&aAnimation));
}
PLDHashOperator
TriggerAnimationAtTime(nsRefPtrHashKey<dom::Animation>* aKey,
void* aReadyTime)
{
dom::Animation* animation = aKey->GetKey();
dom::AnimationTimeline* timeline = animation->GetTimeline();
// If the animation does not have a timeline, just drop it from the map.
// The animation will detect that it is not being tracked and will trigger
// itself on the next tick where it has a timeline.
if (!timeline) {
return PL_DHASH_REMOVE;
}
// When the timeline's refresh driver is under test control, its values
// have no correspondance to wallclock times so we shouldn't try to convert
// aReadyTime (which is a wallclock time) to a timeline value. Instead, the
// animation will be started/paused when the refresh driver is next
// advanced since this will trigger a call to TriggerPendingAnimationsNow.
if (!timeline->TracksWallclockTime()) {
return PL_DHASH_NEXT;
}
Nullable<TimeDuration> readyTime =
timeline->ToTimelineTime(*static_cast<const TimeStamp*>(aReadyTime));
animation->TriggerOnNextTick(readyTime);
return PL_DHASH_REMOVE;
}
void
PendingAnimationTracker::TriggerPendingAnimationsOnNextTick(const TimeStamp&
aReadyTime)
{
mPlayPendingSet.EnumerateEntries(TriggerAnimationAtTime,
const_cast<TimeStamp*>(&aReadyTime));
mPausePendingSet.EnumerateEntries(TriggerAnimationAtTime,
const_cast<TimeStamp*>(&aReadyTime));
}
auto triggerAnimationsAtReadyTime = [aReadyTime](AnimationSet& aAnimationSet)
{
for (auto iter = aAnimationSet.Iter(); !iter.Done(); iter.Next()) {
dom::Animation* animation = iter.Get()->GetKey();
dom::AnimationTimeline* timeline = animation->GetTimeline();
PLDHashOperator
TriggerAnimationNow(nsRefPtrHashKey<dom::Animation>* aKey, void*)
{
aKey->GetKey()->TriggerNow();
return PL_DHASH_NEXT;
// If the animation does not have a timeline, just drop it from the map.
// The animation will detect that it is not being tracked and will trigger
// itself on the next tick where it has a timeline.
if (!timeline) {
iter.Remove();
}
// When the timeline's refresh driver is under test control, its values
// have no correspondance to wallclock times so we shouldn't try to
// convert aReadyTime (which is a wallclock time) to a timeline value.
// Instead, the animation will be started/paused when the refresh driver
// is next advanced since this will trigger a call to
// TriggerPendingAnimationsNow.
if (!timeline->TracksWallclockTime()) {
continue;
}
Nullable<TimeDuration> readyTime = timeline->ToTimelineTime(aReadyTime);
animation->TriggerOnNextTick(readyTime);
iter.Remove();
}
};
triggerAnimationsAtReadyTime(mPlayPendingSet);
triggerAnimationsAtReadyTime(mPausePendingSet);
}
void
PendingAnimationTracker::TriggerPendingAnimationsNow()
{
mPlayPendingSet.EnumerateEntries(TriggerAnimationNow, nullptr);
mPlayPendingSet.Clear();
mPausePendingSet.EnumerateEntries(TriggerAnimationNow, nullptr);
mPausePendingSet.Clear();
auto triggerAndClearAnimations = [](AnimationSet& aAnimationSet) {
for (auto iter = aAnimationSet.Iter(); !iter.Done(); iter.Next()) {
iter.Get()->GetKey()->TriggerNow();
}
aAnimationSet.Clear();
};
triggerAndClearAnimations(mPlayPendingSet);
triggerAndClearAnimations(mPausePendingSet);
}
void

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

@ -62,3 +62,4 @@ support-files = document-timeline/file_document-timeline.html
skip-if = buildapp == 'mulet'
[mozilla/test_deferred_start.html]
support-files = mozilla/file_deferred_start.html
skip-if = (toolkit == 'gonk' && debug)

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

@ -140,6 +140,7 @@
#include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/VRDevice.h"
#include "nsComputedDOMStyle.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -3485,3 +3486,16 @@ Element::FontSizeInflation()
return 1.0;
}
net::ReferrerPolicy
Element::GetReferrerPolicy()
{
if (Preferences::GetBool("network.http.enablePerElementReferrer", false) &&
IsHTMLElement()) {
const nsAttrValue* referrerValue = GetParsedAttr(nsGkAtoms::referrer);
if (referrerValue && referrerValue->Type() == nsAttrValue::eEnum) {
return net::ReferrerPolicy(referrerValue->GetEnumValue());
}
}
return net::RP_Unset;
}

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

@ -1060,6 +1060,8 @@ public:
*/
float FontSizeInflation();
net::ReferrerPolicy GetReferrerPolicy();
protected:
/*
* Named-bools for use with SetAttrAndNotify to make call sites easier to

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

@ -2983,20 +2983,20 @@ nsFocusManager::GetNextTabbableContent(nsIPresShell* aPresShell,
return NS_OK;
}
// If this is a remote child browser, call NavigateDocument to have
// the child process continue the navigation. Return a special error
// code to have the caller return early. If the child ends up not
// being focusable in some way, the child process will call back
// into document navigation again by calling MoveFocus.
TabParent* remote = TabParent::GetFrom(currentContent);
if (remote) {
remote->NavigateByKey(aForward, aForDocumentNavigation);
return NS_SUCCESS_DOM_NO_OPERATION;
}
// Next, for document navigation, check if this a non-remote child document.
bool checkSubDocument = true;
if (aForDocumentNavigation) {
// If this is a remote child browser, call NavigateDocument to have
// the child process continue the navigation. Return a special error
// code to have the caller return early. If the child ends up not
// being focusable in some way, the child process will call back
// into document navigation again by calling MoveFocus.
TabParent* remote = TabParent::GetFrom(currentContent);
if (remote) {
remote->NavigateDocument(aForward);
return NS_SUCCESS_DOM_NO_OPERATION;
}
// Next, check if this a non-remote child document.
nsIContent* docRoot = GetRootForChildDocument(currentContent);
if (docRoot) {
// If GetRootForChildDocument returned something then call

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

@ -937,30 +937,26 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
}
// get document wide referrer policy
mozilla::net::ReferrerPolicy referrerPolicy = aDocument->GetReferrerPolicy();
bool referrerAttributeEnabled = Preferences::GetBool("network.http.enablePerElementReferrer", false);
// if referrer attributes are enabled in preferences, load img referrer attribute
nsresult rv;
if (referrerAttributeEnabled) {
mozilla::net::ReferrerPolicy imgReferrerPolicy = GetImageReferrerPolicy();
// if the image does not provide a referrer attribute, ignore this
if (imgReferrerPolicy != mozilla::net::RP_Unset) {
referrerPolicy = imgReferrerPolicy;
}
// if the image does not provide a referrer attribute, ignore this
net::ReferrerPolicy referrerPolicy = aDocument->GetReferrerPolicy();
net::ReferrerPolicy imgReferrerPolicy = GetImageReferrerPolicy();
if (imgReferrerPolicy != net::RP_Unset) {
referrerPolicy = imgReferrerPolicy;
}
// Not blocked. Do the load.
nsRefPtr<imgRequestProxy>& req = PrepareNextRequest(aImageLoadType);
nsCOMPtr<nsIContent> content =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
rv = nsContentUtils::LoadImage(aNewURI, aDocument,
aDocument->NodePrincipal(),
aDocument->GetDocumentURI(),
referrerPolicy,
this, loadFlags,
content->LocalName(),
getter_AddRefs(req),
policyType);
nsresult rv = nsContentUtils::LoadImage(aNewURI, aDocument,
aDocument->NodePrincipal(),
aDocument->GetDocumentURI(),
referrerPolicy,
this, loadFlags,
content->LocalName(),
getter_AddRefs(req),
policyType);
// Tell the document to forget about the image preload, if any, for
// this URI, now that we might have another imgRequestProxy for it.

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

@ -240,6 +240,8 @@ support-files =
file_audioLoop.html
file_webaudioLoop.html
file_webaudioLoop2.html
referrer_helper.js
referrer_testserver.sjs
[test_anonymousContent_api.html]
[test_anonymousContent_append_after_reflow.html]
@ -672,6 +674,8 @@ support-files = referrerHelper.js
[test_bug1165501.html]
support-files = referrerHelper.js
[test_img_referrer.html]
[test_anchor_area_referrer.html]
[test_anchor_area_referrer_changing.html]
[test_caretPositionFromPoint.html]
[test_classList.html]
# This test fails on the Mac for some reason

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

@ -0,0 +1,98 @@
/*
* common functionality for iframe, anchor, and area referrer attribute tests
*/
const GET_RESULT = sjs + 'action=get-test-results';
const RESET_STATE = sjs + 'action=resetState';
SimpleTest.waitForExplicitFinish();
var advance = function() { tests.next(); };
/**
* Listen for notifications from the child.
* These are sent in case of error, or when the loads we await have completed.
*/
window.addEventListener("message", function(event) {
if (event.data == "childLoadComplete") {
// all loads happen, continue the test.
advance();
}
});
/**
* helper to perform an XHR
* to do checkIndividualResults and resetState
*/
function doXHR(aUrl, onSuccess, onFail) {
var xhr = new XMLHttpRequest();
xhr.responseType = "json";
xhr.onload = function () {
onSuccess(xhr);
};
xhr.onerror = function () {
onFail(xhr);
};
xhr.open('GET', aUrl, true);
xhr.send(null);
}
/**
* Grabs the results via XHR and passes to checker.
*/
function checkIndividualResults(aTestname, aExpectedReferrer, aName) {
var onload = xhr => {
var results = xhr.response;
info(JSON.stringify(xhr.response));
ok(aName in results, aName + " tests have to be performed.");
is(results[aName].policy, aExpectedReferrer, aTestname + ' --- ' + results[aName].policy + ' (' + results[aName].referrer + ')');
advance();
};
var onerror = xhr => {
ok(false, "Can't get results from the counter server.");
SimpleTest.finish();
};
doXHR(GET_RESULT, onload, onerror);
}
function resetState() {
doXHR(RESET_STATE,
advance,
function(xhr) {
ok(false, "error in reset state");
SimpleTest.finish();
});
}
/**
* testing if anchor and area referrer attributes are honoured (1174913)
*/
var tests = (function() {
// enable referrer attribute
yield SpecialPowers.pushPrefEnv({"set": [['network.http.enablePerElementReferrer', true]]}, advance);
var iframe = document.getElementById("testframe");
for (var j = 0; j < testCases.length; j++) {
var actions = testCases[j].ACTION;
var tests = testCases[j].TESTS;
for (var k = 0; k < actions.length; k++) {
var actionString = actions[k];
for (var i = 0; i < tests.length; i++) {
yield resetState();
var searchParams = new URLSearchParams();
searchParams.append(ACTION, actionString);
searchParams.append(NAME, tests[i].NAME);
for (var l of PARAMS) {
if (tests[i][l]) {
searchParams.append(window[l], tests[i][l]);
}
}
yield iframe.src = sjs + searchParams.toString();
yield checkIndividualResults(tests[i].DESC, tests[i].RESULT, tests[i].NAME);
};
};
};
// complete. Be sure to yield so we don't call this twice.
yield SimpleTest.finish();
})();

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

@ -0,0 +1,180 @@
/*
* Test server for iframe, anchor, and area referrer attributes.
* https://bugzilla.mozilla.org/show_bug.cgi?id=1175736
*/
Components.utils.importGlobalProperties(["URLSearchParams"]);
const BASE_URL = 'example.com/tests/dom/base/test/referrer_testserver.sjs';
const SHARED_KEY = 'referrer_testserver.sjs';
const ATTRIBUTE_POLICY = 'attributePolicy';
const NEW_ATTRIBUTE_POLICY = 'newAttributePolicy';
const NAME = 'name';
const META_POLICY = 'metaPolicy';
const REL = 'rel';
function createTestUrl(aPolicy, aAction, aName, aType) {
return 'http://' + BASE_URL + '?' +
'action=' + aAction + '&' +
'policy=' + aPolicy + '&' +
'name=' + aName + '&' +
'type=' + aType;
}
function buildAnchorString(aMetaPolicy, aReferrerPolicy, aName, aRelString){
if (aReferrerPolicy) {
return `<a href="${createTestUrl(aReferrerPolicy, 'test', aName, 'link')}" referrer="${aReferrerPolicy}" id="link" ${aRelString}>${aReferrerPolicy}</a>`;
}
return `<a href="${createTestUrl(aMetaPolicy, 'test', aName, 'link')}" id="link" ${aRelString}>link</a>`;
}
function buildAreaString(aMetaPolicy, aReferrerPolicy, aName, aRelString){
var result = `<img src="file_mozfiledataurl_img.jpg" alt="image" usemap="#imageMap">`;
result += `<map name="imageMap">`;
if (aReferrerPolicy) {
result += `<area shape="circle" coords="1,1,1" href="${createTestUrl(aReferrerPolicy, 'test', aName, 'link')}" alt="theArea" referrer="${aReferrerPolicy}" id="link" ${aRelString}>`;
} else {
result += `<area shape="circle" coords="1,1,1" href="${createTestUrl(aMetaPolicy, 'test', aName, 'link')}" alt="theArea" id="link" ${aRelString}>`;
}
result += `</map>`;
return result;
}
// test page using anchor or area referrer attribute
function createAETestPageUsingRefferer(aMetaPolicy, aAttributePolicy, aNewAttributePolicy, aName, aRel, aStringBuilder, aChangingMethod) {
var metaString = '';
if (aMetaPolicy) {
metaString = '<head><meta name="referrer" content="' + aMetaPolicy + '"></head>';
}
var changeString = '';
if (aChangingMethod === 'setAttribute') {
changeString = `document.getElementById("link").setAttribute("referrer", "${aNewAttributePolicy}")`;
} else if (aChangingMethod === 'property') {
changeString = `document.getElementById("link").referrer = "${aNewAttributePolicy}"`;
}
var relString = '';
if (aRel) {
relString = `rel="noreferrer"`;
}
var elementString = aStringBuilder(aMetaPolicy, aAttributePolicy, aName, relString);
return `<!DOCTYPE HTML>
<html>
${metaString}
<body>
${elementString}
<script>
window.addEventListener("load", function() {
${changeString}
document.getElementById("link").click();
}.bind(window), false);
</script>
</body>
</html>`;
}
function handleRequest(request, response) {
var params = new URLSearchParams(request.queryString);
var action = params.get('action');
response.setHeader('Cache-Control', 'no-cache', false);
response.setHeader('Content-Type', 'text/html; charset=utf-8', false);
if (action === 'resetState') {
setSharedState(SHARED_KEY, "{}");
response.write("");
return;
}
if (action === 'get-test-results') {
// ?action=get-result
response.setHeader('Cache-Control', 'no-cache', false);
response.setHeader('Content-Type', 'text/plain', false);
response.write(getSharedState(SHARED_KEY));
return;
}
if (action === 'redirect') {
response.write('<script>parent.postMessage("childLoadComplete", "http://mochi.test:8888");</script>');
return;
}
if (action === 'test') {
// ?action=test&policy=origin&name=name
var policy = params.get('policy');
var name = params.get('name');
var type = params.get('type');
var result = getSharedState(SHARED_KEY);
result = result ? JSON.parse(result) : {};
var referrerLevel = "none";
var test = {}
if (request.hasHeader('Referer')) {
var referrer = request.getHeader("Referer");
if (referrer.indexOf("referrer_testserver") > 0) {
referrerLevel = "full";
} else if (referrer.indexOf("http://mochi.test:8888") == 0) {
referrerLevel = "origin";
} else {
// this is never supposed to happen
referrerLevel = "other-origin";
}
test.referrer = referrer;
} else {
test.referrer = '';
}
test.policy = referrerLevel;
test.expected = policy;
result[name] = test;
setSharedState(SHARED_KEY, JSON.stringify(result));
if (type === "link") {
// forward link click to redirect URL to finish test
var loc = "http://" + BASE_URL + "?action=redirect";
response.setStatusLine('1.1', 302, 'Found');
response.setHeader('Location', loc, false);
}
return;
}
// parse test arguments and start test
var attributePolicy = params.get(ATTRIBUTE_POLICY) || '';
var newAttributePolicy = params.get(NEW_ATTRIBUTE_POLICY) || '';
var metaPolicy = params.get(META_POLICY) || '';
var rel = params.get(REL) || '';
var name = params.get(NAME);
// anchor & area
var _getPage = createAETestPageUsingRefferer.bind(null, metaPolicy, attributePolicy, newAttributePolicy, name, rel);
var _getAnchorPage = _getPage.bind(null, buildAnchorString);
var _getAreaPage = _getPage.bind(null, buildAreaString);
// aMetaPolicy, aAttributePolicy, aNewAttributePolicy, aName, aChangingMethod, aStringBuilder
if (action === 'generate-anchor-policy-test') {
response.write(_getAnchorPage());
return;
}
if (action === 'generate-anchor-changing-policy-test-set-attribute') {
response.write(_getAnchorPage('setAttribute'));
return;
}
if (action === 'generate-anchor-changing-policy-test-property') {
response.write(_getAnchorPage('property'));
return;
}
if (action === 'generate-area-policy-test') {
response.write(_getAreaPage());
return;
}
if (action === 'generate-area-changing-policy-test-set-attribute') {
response.write(_getAreaPage('setAttribute'));
return;
}
if (action === 'generate-area-changing-policy-test-property') {
response.write(_getAreaPage('property'));
return;
}
response.write("I don't know action " + action);
return;
}

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

@ -0,0 +1,116 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test anchor and area policy attribute for Bug 1174913</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<!--
Testing that anchor and area referrer attributes are honoured correctly
* anchor tag with referrer attribute (generate-anchor-policy-test)
* regression tests that meta referrer is still working even if attribute referrers are enabled (generate-anchor-policy-test)
https://bugzilla.mozilla.org/show_bug.cgi?id=1174913
-->
<script type="application/javascript;version=1.8">
const sjs = "/tests/dom/base/test/referrer_testserver.sjs?";
const ATTRIBUTE_POLICY = 'attributePolicy';
const NEW_ATTRIBUTE_POLICY = 'newAttributePolicy';
const NAME = 'name';
const META_POLICY = 'metaPolicy';
const DESC = 'description';
const RESULT = 'result';
const ACTION = 'action';
const TESTS = 'tests';
const REL = 'rel';
const PARAMS = ["ATTRIBUTE_POLICY", "NEW_ATTRIBUTE_POLICY", "META_POLICY", "REL"];
const testCases = [
{ACTION: ["generate-anchor-policy-test", "generate-area-policy-test"],
TESTS: [
{ATTRIBUTE_POLICY: 'unsafe-url',
NAME: 'unsafe-url-with-origin-in-meta',
META_POLICY: 'origin',
DESC: "unsafe-url (anchor) with origin in meta",
RESULT: 'full'},
{ATTRIBUTE_POLICY: 'origin',
NAME: 'origin-with-unsafe-url-in-meta',
META_POLICY: 'unsafe-url',
DESC: "origin (anchor) with unsafe-url in meta",
RESULT: 'origin'},
{ATTRIBUTE_POLICY: 'no-referrer',
NAME: 'no-referrer-with-origin-in-meta',
META_POLICY: 'origin',
DESC: "no-referrer (anchor) with origin in meta",
RESULT: 'none'},
{NAME: 'no-referrer-in-meta',
META_POLICY: 'no-referrer',
DESC: "no-referrer in meta",
RESULT: 'none'},
{ATTRIBUTE_POLICY: 'origin',
NAME: 'origin-with-no-meta',
META_POLICY: '',
DESC: "origin (anchor) with no meta",
RESULT: 'origin'},
// setting rel=noreferrer -> we expect no referrer
{ATTRIBUTE_POLICY: 'unsafe-url',
NAME: 'unsafe-url-with-origin-in-meta-rel',
META_POLICY: 'origin',
DESC: "unsafe-url (anchor) with origin in meta and rel=noreferrer",
RESULT: 'none',
REL: 'noreferrer'},
{ATTRIBUTE_POLICY: 'origin',
NAME: 'origin-with-unsafe-url-in-meta-rel',
META_POLICY: 'unsafe-url',
DESC: "origin (anchor) with unsafe-url in meta and rel=noreferrer",
RESULT: 'none',
REL: 'noreferrer'},
{ATTRIBUTE_POLICY: 'origin',
NAME: 'origin-with-no-meta-rel',
META_POLICY: '',
DESC: "origin (anchor) with no meta and rel=noreferrer",
RESULT: 'none',
REL: 'noreferrer'},
// setting invalid refer values -> we expect either full referrer (default)
// or whatever is specified in the meta referrer policy
{ATTRIBUTE_POLICY: 'origin-when-cross-origin',
NAME: 'origin-when-cross-origin-with-no-meta',
META_POLICY: '',
DESC: "origin-when-cross-origin (anchor) with no meta",
RESULT: 'full'},
{ATTRIBUTE_POLICY: 'default',
NAME: 'default-with-no-meta',
META_POLICY: '',
DESC: "default (anchor) with no meta",
RESULT: 'full'},
{ATTRIBUTE_POLICY: 'something',
NAME: 'something-with-no-meta',
META_POLICY: '',
DESC: "something (anchor) with no meta",
RESULT: 'full'},
{ATTRIBUTE_POLICY: 'origin-when-cross-origin',
NAME: 'origin-when-cross-origin-with-no-referrer-in-meta',
META_POLICY: 'no-referrer',
DESC: "origin-when-cross-origin (anchor) with no-referrer in meta",
RESULT: 'none'},
{ATTRIBUTE_POLICY: 'origin-when-cross-origin',
NAME: 'origin-when-cross-origin-with-unsafe-url-in-meta',
META_POLICY: 'unsafe-url',
DESC: "origin-when-cross-origin (anchor) with unsafe-url in meta",
RESULT: 'full'},
{ATTRIBUTE_POLICY: 'origin-when-cross-origin',
NAME: 'origin-when-cross-origin-with-origin-in-meta',
META_POLICY: 'origin',
DESC: "origin-when-cross-origin (anchor) with origin in meta",
RESULT: 'origin'}]}
];
</script>
<script type="application/javascript;version=1.7" src="/tests/dom/base/test/referrer_helper.js"></script>
</head>
<body onload="tests.next();">
<iframe id="testframe"></iframe>
</body>
</html>

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

@ -0,0 +1,75 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test anchor and area policy attribute for Bug 1174913</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<!--
Testing that anchor and area referrer attributes are honoured correctly
This test is split due to errors on b2g
* testing setAttribute and .referrer (generate-anchor-changing-test)
https://bugzilla.mozilla.org/show_bug.cgi?id=1174913
-->
<script type="application/javascript;version=1.8">
const sjs = "/tests/dom/base/test/referrer_testserver.sjs?";
const ATTRIBUTE_POLICY = 'attributePolicy';
const NEW_ATTRIBUTE_POLICY = 'newAttributePolicy';
const NAME = 'name';
const META_POLICY = 'metaPolicy';
const DESC = 'description';
const RESULT = 'result';
const ACTION = 'action';
const TESTS = 'tests';
const REL = 'rel';
const PARAMS = ["ATTRIBUTE_POLICY", "NEW_ATTRIBUTE_POLICY", "META_POLICY", "REL"];
const testCases = [
{ACTION: ["generate-anchor-changing-policy-test-set-attribute", "generate-area-changing-policy-test-set-attribute"],
TESTS: [
{ATTRIBUTE_POLICY: 'unsafe-url',
NEW_ATTRIBUTE_POLICY: 'no-referrer',
NAME: 'no-referrer-unsafe-url-with-origin-in-meta',
META_POLICY: 'origin',
DESC: "no-referrer (anchor, orginally unsafe-url) with origin in meta",
RESULT: 'none'},
{ATTRIBUTE_POLICY: 'origin',
NEW_ATTRIBUTE_POLICY: 'unsafe-url',
NAME: 'unsafe-url-origin-with-no-referrer-in-meta',
META_POLICY: 'no-referrer',
DESC: "unsafe-url (anchor, orginally origin) with no-referrer in meta",
RESULT: 'full'},
{ATTRIBUTE_POLICY: 'origin',
NEW_ATTRIBUTE_POLICY: 'unsafe-url',
NAME: 'unsafe-url-origin-with-no-referrer-in-meta-rel',
META_POLICY: 'no-referrer',
DESC: "unsafe-url (anchor, orginally origin) with no-referrer in meta and rel=noreferrer",
RESULT: 'none',
REL: 'noreferrer'}]},
{ACTION: ["generate-anchor-changing-policy-test-property", "generate-area-changing-policy-test-property"],
TESTS: [
{ATTRIBUTE_POLICY: 'no-referrer',
NEW_ATTRIBUTE_POLICY: 'unsafe-url',
NAME: 'unsafe-url-no-referrer-with-origin-in-meta',
META_POLICY: 'origin',
DESC: "unsafe-url (anchor, orginally no-referrer) with origin in meta",
RESULT: 'full'},
{ATTRIBUTE_POLICY: 'no-referrer',
NEW_ATTRIBUTE_POLICY: 'unsafe-url',
NAME: 'unsafe-url-no-referrer-with-origin-in-meta-rel',
META_POLICY: 'origin',
DESC: "unsafe-url (anchor, orginally no-referrer) with origin in meta and rel=noreferrer",
RESULT: 'none',
REL: 'noreferrer'}]}
];
</script>
<script type="application/javascript;version=1.7" src="/tests/dom/base/test/referrer_helper.js"></script>
</head>
<body onload="tests.next();">
<iframe id="testframe"></iframe>
</body>
</html>

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

@ -8,6 +8,7 @@
#include "BluetoothDaemonConnector.h"
#include <fcntl.h>
#include <sys/un.h>
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h"
BEGIN_BLUETOOTH_NAMESPACE
@ -15,10 +16,14 @@ BEGIN_BLUETOOTH_NAMESPACE
BluetoothDaemonConnector::BluetoothDaemonConnector(
const nsACString& aSocketName)
: mSocketName(aSocketName)
{ }
{
MOZ_COUNT_CTOR_INHERITED(BluetoothDaemonConnector, UnixSocketConnector);
}
BluetoothDaemonConnector::~BluetoothDaemonConnector()
{ }
{
MOZ_COUNT_CTOR_INHERITED(BluetoothDaemonConnector, UnixSocketConnector);
}
nsresult
BluetoothDaemonConnector::CreateSocket(int& aFd) const

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

@ -13,6 +13,7 @@
#include "mozilla/ipc/UnixSocketWatcher.h"
#include "mozilla/FileUtils.h"
#include "mozilla/RefPtr.h"
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsXULAppAPI.h"
using namespace mozilla::ipc;
@ -78,11 +79,15 @@ public:
, mConsumer(aConsumer)
, mShuttingDownOnIOThread(false)
, mConnectionStatus(SOCKET_IS_DISCONNECTED)
{ }
{
MOZ_COUNT_CTOR_INHERITED(DroidSocketImpl, DataSocketIO);
}
~DroidSocketImpl()
{
MOZ_ASSERT(IsConsumerThread());
MOZ_COUNT_DTOR_INHERITED(DroidSocketImpl, DataSocketIO);
}
void Send(UnixSocketIOBuffer* aBuffer)
@ -109,7 +114,7 @@ public:
BluetoothSocket* GetBluetoothSocket()
{
return mConsumer.get();
return mConsumer;
}
DataSocket* GetDataSocket()
@ -118,11 +123,11 @@ public:
}
/**
* Consumer pointer. Non-thread safe RefPtr, so should only be manipulated
* Consumer pointer. Non-thread-safe pointer, so should only be manipulated
* directly from consumer thread. All non-consumer-thread accesses should
* happen with mImpl as container.
*/
RefPtr<BluetoothSocket> mConsumer;
BluetoothSocket* mConsumer;
// Methods for |DataSocket|
//
@ -582,10 +587,17 @@ BluetoothSocket::BluetoothSocket(BluetoothSocketObserver* aObserver)
{
MOZ_ASSERT(aObserver);
MOZ_COUNT_CTOR_INHERITED(BluetoothSocket, DataSocket);
EnsureBluetoothSocketHalLoad();
mDeviceAddress.AssignLiteral(BLUETOOTH_ADDRESS_NONE);
}
BluetoothSocket::~BluetoothSocket()
{
MOZ_COUNT_DTOR_INHERITED(BluetoothSocket, DataSocket);
}
class ConnectSocketResultHandler final : public BluetoothSocketResultHandler
{
public:

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

@ -22,6 +22,7 @@ class BluetoothSocket final : public mozilla::ipc::DataSocket
{
public:
BluetoothSocket(BluetoothSocketObserver* aObserver);
~BluetoothSocket();
nsresult Connect(const nsAString& aDeviceAddress,
const BluetoothUuid& aServiceUuid,

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

@ -9,6 +9,7 @@
#include "BluetoothSocketObserver.h"
#include "BluetoothUnixSocketConnector.h"
#include "mozilla/RefPtr.h"
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsXULAppAPI.h"
using namespace mozilla::ipc;
@ -93,11 +94,11 @@ private:
void FireSocketError();
/**
* Consumer pointer. Non-thread safe RefPtr, so should only be manipulated
* Consumer pointer. Non-thread-safe pointer, so should only be manipulated
* directly from consumer thread. All non-consumer-thread accesses should
* happen with mIO as container.
*/
RefPtr<BluetoothSocket> mConsumer;
BluetoothSocket* mConsumer;
/**
* Connector object used to create the connection we are currently using.
@ -146,12 +147,16 @@ BluetoothSocket::BluetoothSocketIO::BluetoothSocketIO(
{
MOZ_ASSERT(mConsumer);
MOZ_ASSERT(mConnector);
MOZ_COUNT_CTOR_INHERITED(BluetoothSocketIO, DataSocketIO);
}
BluetoothSocket::BluetoothSocketIO::~BluetoothSocketIO()
{
MOZ_ASSERT(IsConsumerThread());
MOZ_ASSERT(IsShutdownOnConsumerThread());
MOZ_COUNT_DTOR_INHERITED(BluetoothSocketIO, DataSocketIO);
}
void
@ -178,7 +183,7 @@ BluetoothSocket::BluetoothSocketIO::GetSocketAddr(nsAString& aAddrStr) const
BluetoothSocket*
BluetoothSocket::BluetoothSocketIO::GetBluetoothSocket()
{
return mConsumer.get();
return mConsumer;
}
DataSocket*
@ -562,11 +567,15 @@ BluetoothSocket::BluetoothSocket(BluetoothSocketObserver* aObserver)
, mIO(nullptr)
{
MOZ_ASSERT(aObserver);
MOZ_COUNT_CTOR_INHERITED(BluetoothSocket, DataSocket);
}
BluetoothSocket::~BluetoothSocket()
{
MOZ_ASSERT(!mIO);
MOZ_COUNT_DTOR_INHERITED(BluetoothSocket, DataSocket);
}
nsresult

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

@ -30,6 +30,7 @@
#include <stdlib.h>
#include <sys/socket.h>
#include <unistd.h>
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h" // For NS_IsMainThread.
using namespace mozilla::ipc;
@ -52,10 +53,14 @@ BluetoothUnixSocketConnector::BluetoothUnixSocketConnector(
, mChannel(aChannel)
, mAuth(aAuth)
, mEncrypt(aEncrypt)
{ }
{
MOZ_COUNT_CTOR_INHERITED(BluetoothUnixSocketConnector, UnixSocketConnector);
}
BluetoothUnixSocketConnector::~BluetoothUnixSocketConnector()
{ }
{
MOZ_COUNT_DTOR_INHERITED(BluetoothUnixSocketConnector, UnixSocketConnector);
}
nsresult
BluetoothUnixSocketConnector::CreateSocket(int& aFd) const

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

@ -123,6 +123,14 @@ public:
{
SetHTMLAttr(nsGkAtoms::rel, aValue, rv);
}
void SetReferrer(const nsAString& aValue, mozilla::ErrorResult& rv)
{
SetHTMLAttr(nsGkAtoms::referrer, aValue, rv);
}
void GetReferrer(nsAString& aReferrer)
{
GetHTMLAttr(nsGkAtoms::referrer, aReferrer);
}
nsDOMTokenList* RelList();
void GetHreflang(DOMString& aValue)
{

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

@ -128,6 +128,15 @@ public:
}
nsDOMTokenList* RelList();
void SetReferrer(const nsAString& aValue, mozilla::ErrorResult& rv)
{
SetHTMLAttr(nsGkAtoms::referrer, aValue, rv);
}
void GetReferrer(nsAString& aReferrer)
{
GetHTMLAttr(nsGkAtoms::referrer, aReferrer);
}
// The Link::GetOrigin is OK for us
using Link::GetProtocol;

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

@ -195,10 +195,10 @@ public:
}
void GetReferrer(nsAString& aReferrer)
{
GetEnumAttr(nsGkAtoms::referrer, nullptr, aReferrer);
GetHTMLAttr(nsGkAtoms::referrer, aReferrer);
}
mozilla::net::ReferrerPolicy
net::ReferrerPolicy
GetImageReferrerPolicy() override
{
return GetReferrerPolicy();

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

@ -105,8 +105,6 @@
#include "mozilla/dom/HTMLBodyElement.h"
#include "imgIContainer.h"
#include "mozilla/net/ReferrerPolicy.h"
using namespace mozilla;
using namespace mozilla::dom;

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

@ -233,17 +233,6 @@ public:
mScrollgrab = aValue;
}
mozilla::net::ReferrerPolicy
GetReferrerPolicy()
{
nsAutoString aPolicyString;
GetEnumAttr(nsGkAtoms::referrer, nullptr, aPolicyString);
if (aPolicyString.IsEmpty()) {
return mozilla::net::RP_Unset;
}
return mozilla::net::ReferrerPolicyFromString(aPolicyString);
}
/**
* Determine whether an attribute is an event (onclick, etc.)
* @param aName the attribute

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

@ -9616,27 +9616,16 @@ UpdateRefcountFunction::WillCommit()
"DatabaseConnection::UpdateRefcountFunction::WillCommit",
js::ProfileEntry::Category::STORAGE);
struct Helper final
{
static PLDHashOperator
Update(const uint64_t& aKey, FileInfoEntry* aValue, void* aUserArg)
{
MOZ_ASSERT(aValue);
auto* function = static_cast<DatabaseUpdateFunction*>(aUserArg);
MOZ_ASSERT(function);
if (aValue->mDelta && !function->Update(aKey, aValue->mDelta)) {
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}
};
DatabaseUpdateFunction function(this);
for (auto iter = mFileInfoEntries.ConstIter(); !iter.Done(); iter.Next()) {
auto key = iter.Key();
FileInfoEntry* value = iter.Data();
MOZ_ASSERT(value);
mFileInfoEntries.EnumerateRead(Helper::Update, &function);
if (value->mDelta && !function.Update(key, value->mDelta)) {
break;
}
}
nsresult rv = function.ErrorCode();
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -9662,22 +9651,15 @@ UpdateRefcountFunction::DidCommit()
"DatabaseConnection::UpdateRefcountFunction::DidCommit",
js::ProfileEntry::Category::STORAGE);
struct Helper final
{
static PLDHashOperator
Update(const uint64_t& aKey, FileInfoEntry* aValue, void* /* aUserArg */)
{
MOZ_ASSERT(aValue);
for (auto iter = mFileInfoEntries.ConstIter(); !iter.Done(); iter.Next()) {
auto value = iter.Data();
if (aValue->mDelta) {
aValue->mFileInfo->UpdateDBRefs(aValue->mDelta);
}
MOZ_ASSERT(value);
return PL_DHASH_NEXT;
if (value->mDelta) {
value->mFileInfo->UpdateDBRefs(value->mDelta);
}
};
mFileInfoEntries.EnumerateRead(Helper::Update, nullptr);
}
if (NS_FAILED(RemoveJournals(mJournalsToRemoveAfterCommit))) {
NS_WARNING("RemoveJournals failed!");
@ -9733,20 +9715,11 @@ UpdateRefcountFunction::RollbackSavepoint()
MOZ_ASSERT(!IsOnBackgroundThread());
MOZ_ASSERT(mInSavepoint);
struct Helper
{
static PLDHashOperator
Rollback(const uint64_t& aKey, FileInfoEntry* aValue, void* /* aUserArg */)
{
MOZ_ASSERT(!IsOnBackgroundThread());
MOZ_ASSERT(aValue);
aValue->mDelta -= aValue->mSavepointDelta;
return PL_DHASH_NEXT;
}
};
mSavepointEntriesIndex.EnumerateRead(Helper::Rollback, nullptr);
for (auto iter = mSavepointEntriesIndex.ConstIter();
!iter.Done(); iter.Next()) {
auto value = iter.Data();
value->mDelta -= value->mSavepointDelta;
}
mInSavepoint = false;
mSavepointEntriesIndex.Clear();
@ -10815,31 +10788,6 @@ ConnectionPool::NoteFinishedTransaction(uint64_t aTransactionId)
{
AssertIsOnOwningThread();
struct Helper
{
static PLDHashOperator
MaybeScheduleTransaction(nsPtrHashKey<TransactionInfo>* aKey,
void* aClosure)
{
AssertIsOnBackgroundThread();
TransactionInfo* transactionInfo = aKey->GetKey();
MOZ_ASSERT(transactionInfo);
TransactionInfo* finishedInfo = static_cast<TransactionInfo*>(aClosure);
MOZ_ASSERT(finishedInfo);
MOZ_ASSERT(transactionInfo->mBlockedOn.Contains(finishedInfo));
transactionInfo->mBlockedOn.RemoveEntry(finishedInfo);
if (!transactionInfo->mBlockedOn.Count()) {
transactionInfo->Schedule();
}
return PL_DHASH_NEXT;
}
};
PROFILER_LABEL("IndexedDB",
"ConnectionPool::NoteFinishedTransaction",
js::ProfileEntry::Category::STORAGE);
@ -10894,8 +10842,18 @@ ConnectionPool::NoteFinishedTransaction(uint64_t aTransactionId)
blockInfo->mLastBlockingWrites.RemoveElement(transactionInfo);
}
transactionInfo->mBlocking.EnumerateEntries(Helper::MaybeScheduleTransaction,
transactionInfo);
for (auto iter = transactionInfo->mBlocking.Iter();
!iter.Done();
iter.Next()) {
TransactionInfo* blockedInfo = iter.Get()->GetKey();
MOZ_ASSERT(blockedInfo);
MOZ_ASSERT(blockedInfo->mBlockedOn.Contains(transactionInfo));
blockedInfo->mBlockedOn.RemoveEntry(transactionInfo);
if (!blockedInfo->mBlockedOn.Count()) {
blockedInfo->Schedule();
}
}
if (transactionInfo->mIsWriteTransaction) {
MOZ_ASSERT(dbInfo->mWriteTransactionCount);
@ -11731,38 +11689,13 @@ FullObjectStoreMetadata::HasLiveIndexes() const
{
AssertIsOnBackgroundThread();
class MOZ_STACK_CLASS Helper final
{
public:
static bool
HasLiveIndexes(const FullObjectStoreMetadata* aMetadata)
{
AssertIsOnBackgroundThread();
MOZ_ASSERT(aMetadata);
bool hasLiveIndexes = false;
aMetadata->mIndexes.EnumerateRead(&Enumerate, &hasLiveIndexes);
return hasLiveIndexes;
for (auto iter = mIndexes.ConstIter(); !iter.Done(); iter.Next()) {
if (!iter.Data()->mDeleted) {
return true;
}
}
private:
static PLDHashOperator
Enumerate(const uint64_t& aKey, FullIndexMetadata* aValue, void* aClosure)
{
auto* result = static_cast<bool*>(aClosure);
MOZ_ASSERT(result);
if (!aValue->mDeleted) {
*result = true;
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}
};
return Helper::HasLiveIndexes(this);
return false;
}
already_AddRefed<FullDatabaseMetadata>
@ -11770,79 +11703,6 @@ FullDatabaseMetadata::Duplicate() const
{
AssertIsOnBackgroundThread();
class MOZ_STACK_CLASS IndexClosure final
{
FullObjectStoreMetadata& mNew;
public:
explicit IndexClosure(FullObjectStoreMetadata& aNew)
: mNew(aNew)
{ }
static PLDHashOperator
Copy(const uint64_t& aKey, FullIndexMetadata* aValue, void* aClosure)
{
MOZ_ASSERT(aKey);
MOZ_ASSERT(aValue);
MOZ_ASSERT(aClosure);
auto* closure = static_cast<IndexClosure*>(aClosure);
nsRefPtr<FullIndexMetadata> newMetadata = new FullIndexMetadata();
newMetadata->mCommonMetadata = aValue->mCommonMetadata;
if (NS_WARN_IF(!closure->mNew.mIndexes.Put(aKey, newMetadata,
fallible))) {
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}
};
class MOZ_STACK_CLASS ObjectStoreClosure final
{
FullDatabaseMetadata& mNew;
public:
explicit ObjectStoreClosure(FullDatabaseMetadata& aNew)
: mNew(aNew)
{ }
static PLDHashOperator
Copy(const uint64_t& aKey, FullObjectStoreMetadata* aValue, void* aClosure)
{
MOZ_ASSERT(aKey);
MOZ_ASSERT(aValue);
MOZ_ASSERT(aClosure);
auto* objClosure = static_cast<ObjectStoreClosure*>(aClosure);
nsRefPtr<FullObjectStoreMetadata> newMetadata =
new FullObjectStoreMetadata();
newMetadata->mCommonMetadata = aValue->mCommonMetadata;
newMetadata->mNextAutoIncrementId = aValue->mNextAutoIncrementId;
newMetadata->mComittedAutoIncrementId = aValue->mComittedAutoIncrementId;
IndexClosure idxClosure(*newMetadata);
aValue->mIndexes.EnumerateRead(IndexClosure::Copy, &idxClosure);
if (NS_WARN_IF(aValue->mIndexes.Count() !=
newMetadata->mIndexes.Count())) {
return PL_DHASH_STOP;
}
if (NS_WARN_IF(!objClosure->mNew.mObjectStores.Put(aKey, newMetadata,
fallible))) {
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}
};
// FullDatabaseMetadata contains two hash tables of pointers that we need to
// duplicate so we can't just use the copy constructor.
nsRefPtr<FullDatabaseMetadata> newMetadata =
@ -11853,14 +11713,41 @@ FullDatabaseMetadata::Duplicate() const
newMetadata->mNextObjectStoreId = mNextObjectStoreId;
newMetadata->mNextIndexId = mNextIndexId;
ObjectStoreClosure closure(*newMetadata);
mObjectStores.EnumerateRead(ObjectStoreClosure::Copy, &closure);
for (auto iter = mObjectStores.ConstIter(); !iter.Done(); iter.Next()) {
auto key = iter.Key();
auto value = iter.Data();
if (NS_WARN_IF(mObjectStores.Count() !=
newMetadata->mObjectStores.Count())) {
return nullptr;
nsRefPtr<FullObjectStoreMetadata> newOSMetadata =
new FullObjectStoreMetadata();
newOSMetadata->mCommonMetadata = value->mCommonMetadata;
newOSMetadata->mNextAutoIncrementId = value->mNextAutoIncrementId;
newOSMetadata->mComittedAutoIncrementId = value->mComittedAutoIncrementId;
for (auto iter = value->mIndexes.ConstIter(); !iter.Done(); iter.Next()) {
auto key = iter.Key();
auto value = iter.Data();
nsRefPtr<FullIndexMetadata> newIndexMetadata = new FullIndexMetadata();
newIndexMetadata->mCommonMetadata = value->mCommonMetadata;
if (NS_WARN_IF(!newOSMetadata->mIndexes.Put(key, newIndexMetadata,
fallible))) {
return nullptr;
}
}
MOZ_ASSERT(value->mIndexes.Count() == newOSMetadata->mIndexes.Count());
if (NS_WARN_IF(!newMetadata->mObjectStores.Put(key, newOSMetadata,
fallible))) {
return nullptr;
}
}
MOZ_ASSERT(mObjectStores.Count() == newMetadata->mObjectStores.Count());
return newMetadata.forget();
}
@ -12357,10 +12244,11 @@ Database::Invalidate()
return false;
}
aTable.EnumerateEntries(Collect, &transactions);
if (NS_WARN_IF(transactions.Length() != count)) {
return false;
for (auto iter = aTable.Iter(); !iter.Done(); iter.Next()) {
if (NS_WARN_IF(!transactions.AppendElement(iter.Get()->GetKey(),
fallible))) {
return false;
}
}
if (count) {
@ -12376,23 +12264,6 @@ Database::Invalidate()
return true;
}
private:
static PLDHashOperator
Collect(nsPtrHashKey<TransactionBase>* aEntry, void* aUserData)
{
AssertIsOnBackgroundThread();
MOZ_ASSERT(aUserData);
auto* array =
static_cast<FallibleTArray<nsRefPtr<TransactionBase>>*>(aUserData);
if (NS_WARN_IF(!array->AppendElement(aEntry->GetKey(), fallible))) {
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}
};
if (mInvalidated) {
@ -12629,39 +12500,6 @@ Database::AllocPBackgroundIDBTransactionParent(
{
AssertIsOnBackgroundThread();
class MOZ_STACK_CLASS Closure final
{
const nsString& mName;
FallibleTArray<nsRefPtr<FullObjectStoreMetadata>>& mObjectStores;
public:
Closure(const nsString& aName,
FallibleTArray<nsRefPtr<FullObjectStoreMetadata>>& aObjectStores)
: mName(aName)
, mObjectStores(aObjectStores)
{ }
static PLDHashOperator
Find(const uint64_t& aKey,
FullObjectStoreMetadata* aValue,
void* aClosure)
{
MOZ_ASSERT(aKey);
MOZ_ASSERT(aValue);
MOZ_ASSERT(aClosure);
auto* closure = static_cast<Closure*>(aClosure);
if (closure->mName == aValue->mCommonMetadata.name() &&
!aValue->mDeleted) {
MOZ_ALWAYS_TRUE(closure->mObjectStores.AppendElement(aValue, fallible));
return PL_DHASH_STOP;
}
return PL_DHASH_NEXT;
}
};
// Once a database is closed it must not try to open new transactions.
if (NS_WARN_IF(mClosed)) {
if (!mInvalidated) {
@ -12715,13 +12553,16 @@ Database::AllocPBackgroundIDBTransactionParent(
}
}
const uint32_t oldLength = fallibleObjectStores.Length();
for (auto iter = objectStores.ConstIter(); !iter.Done(); iter.Next()) {
auto value = iter.Data();
MOZ_ASSERT(iter.Key());
Closure closure(name, fallibleObjectStores);
objectStores.EnumerateRead(Closure::Find, &closure);
if (NS_WARN_IF((oldLength + 1) != fallibleObjectStores.Length())) {
return nullptr;
if (name == value->mCommonMetadata.name() && !value->mDeleted) {
if (NS_WARN_IF(!fallibleObjectStores.AppendElement(value, fallible))) {
return nullptr;
}
break;
}
}
}

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

@ -432,27 +432,12 @@ IDBDatabase::RefreshSpec(bool aMayDelete)
{
AssertIsOnOwningThread();
class MOZ_STACK_CLASS Helper final
{
public:
static PLDHashOperator
RefreshTransactionsSpec(nsPtrHashKey<IDBTransaction>* aTransaction,
void* aClosure)
{
MOZ_ASSERT(aTransaction);
aTransaction->GetKey()->AssertIsOnOwningThread();
MOZ_ASSERT(aClosure);
bool mayDelete = *static_cast<bool*>(aClosure);
nsRefPtr<IDBTransaction> transaction = aTransaction->GetKey();
transaction->RefreshSpec(mayDelete);
return PL_DHASH_NEXT;
}
};
mTransactions.EnumerateEntries(Helper::RefreshTransactionsSpec, &aMayDelete);
for (auto iter = mTransactions.Iter(); !iter.Done(); iter.Next()) {
nsRefPtr<IDBTransaction> transaction = iter.Get()->GetKey();
MOZ_ASSERT(transaction);
transaction->AssertIsOnOwningThread();
transaction->RefreshSpec(aMayDelete);
}
}
nsPIDOMWindow*
@ -916,7 +901,19 @@ IDBDatabase::AbortTransactions(bool aShouldWarn)
StrongTransactionArray transactionsToAbort;
transactionsToAbort.SetCapacity(transactionTable.Count());
transactionTable.EnumerateEntries(Collect, &transactionsToAbort);
for (auto iter = transactionTable.Iter(); !iter.Done(); iter.Next()) {
IDBTransaction* transaction = iter.Get()->GetKey();
MOZ_ASSERT(transaction);
transaction->AssertIsOnOwningThread();
// Transactions that are already done can simply be ignored. Otherwise
// there is a race here and it's possible that the transaction has not
// been successfully committed yet so we will warn the user.
if (!transaction->IsDone()) {
transactionsToAbort.AppendElement(transaction);
}
}
MOZ_ASSERT(transactionsToAbort.Length() <= transactionTable.Count());
if (transactionsToAbort.IsEmpty()) {
@ -968,29 +965,6 @@ IDBDatabase::AbortTransactions(bool aShouldWarn)
aDatabase->LogWarning(kWarningMessage, filename, lineNo);
}
}
private:
static PLDHashOperator
Collect(nsPtrHashKey<IDBTransaction>* aTransactionKey, void* aClosure)
{
MOZ_ASSERT(aTransactionKey);
MOZ_ASSERT(aClosure);
IDBTransaction* transaction = aTransactionKey->GetKey();
MOZ_ASSERT(transaction);
transaction->AssertIsOnOwningThread();
// Transactions that are already done can simply be ignored. Otherwise
// there is a race here and it's possible that the transaction has not
// been successfully committed yet so we will warn the user.
if (!transaction->IsDone()) {
auto* array = static_cast<StrongTransactionArray*>(aClosure);
array->AppendElement(transaction);
}
return PL_DHASH_NEXT;
}
};
Helper::AbortTransactions(this, aShouldWarn);
@ -1254,27 +1228,6 @@ IDBDatabase::ExpireFileActors(bool aExpireAll)
return PL_DHASH_NEXT;
}
static PLDHashOperator
MaybeExpireReceivedBlobs(nsISupportsHashKey* aKey,
void* aClosure)
{
MOZ_ASSERT(aKey);
MOZ_ASSERT(!aClosure);
nsISupports* key = aKey->GetKey();
MOZ_ASSERT(key);
nsCOMPtr<nsIWeakReference> weakRef = do_QueryInterface(key);
MOZ_ASSERT(weakRef);
nsCOMPtr<nsISupports> referent = do_QueryReferent(weakRef);
if (!referent) {
return PL_DHASH_REMOVE;
}
return PL_DHASH_NEXT;
}
};
if (mBackgroundActor && mFileActors.Count()) {
@ -1290,8 +1243,18 @@ IDBDatabase::ExpireFileActors(bool aExpireAll)
if (aExpireAll) {
mReceivedBlobs.Clear();
} else {
mReceivedBlobs.EnumerateEntries(&Helper::MaybeExpireReceivedBlobs,
nullptr);
for (auto iter = mReceivedBlobs.Iter(); !iter.Done(); iter.Next()) {
nsISupports* key = iter.Get()->GetKey();
MOZ_ASSERT(key);
nsCOMPtr<nsIWeakReference> weakRef = do_QueryInterface(key);
MOZ_ASSERT(weakRef);
nsCOMPtr<nsISupports> referent = do_QueryReferent(weakRef);
if (!referent) {
iter.Remove();
}
}
}
}
}

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

@ -753,24 +753,13 @@ IndexedDatabaseManager::InvalidateAllFileManagers()
{
AssertIsOnIOThread();
class MOZ_STACK_CLASS Helper final
{
public:
static PLDHashOperator
Enumerate(const nsACString& aKey,
FileManagerInfo* aValue,
void* aUserArg)
{
AssertIsOnIOThread();
MOZ_ASSERT(!aKey.IsEmpty());
MOZ_ASSERT(aValue);
for (auto iter = mFileManagerInfos.ConstIter(); !iter.Done(); iter.Next()) {
auto value = iter.Data();
MOZ_ASSERT(value);
aValue->InvalidateAllFileManagers();
return PL_DHASH_NEXT;
}
};
value->InvalidateAllFileManagers();
}
mFileManagerInfos.EnumerateRead(Helper::Enumerate, nullptr);
mFileManagerInfos.Clear();
}
@ -1003,29 +992,19 @@ IndexedDatabaseManager::Notify(nsITimer* aTimer)
MOZ_ASSERT(IsMainProcess());
MOZ_ASSERT(NS_IsMainThread());
class MOZ_STACK_CLASS Helper final
{
public:
static PLDHashOperator
CreateAndDispatchRunnables(FileManager* aFileManager,
nsTArray<int64_t>* aValue,
void* aClosure)
{
MOZ_ASSERT(!aValue->IsEmpty());
for (auto iter = mPendingDeleteInfos.ConstIter(); !iter.Done(); iter.Next()) {
auto key = iter.Key();
auto value = iter.Data();
MOZ_ASSERT(!value->IsEmpty());
nsRefPtr<DeleteFilesRunnable> runnable =
new DeleteFilesRunnable(aFileManager, *aValue);
nsRefPtr<DeleteFilesRunnable> runnable =
new DeleteFilesRunnable(key, *value);
MOZ_ASSERT(aValue->IsEmpty());
MOZ_ASSERT(value->IsEmpty());
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
}
return PL_DHASH_NEXT;
}
};
mPendingDeleteInfos.EnumerateRead(Helper::CreateAndDispatchRunnables,
nullptr);
mPendingDeleteInfos.Clear();
return NS_OK;

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

@ -5,7 +5,7 @@
#include "domstubs.idl"
[scriptable, uuid(CE6F563B-BD77-4EF2-9D7C-A94C587353E4)]
[scriptable, uuid(A10D887D-7FC2-48A2-ABC6-A2027423860C)]
interface nsITabParent : nsISupports
{
void injectTouchEvent(in AString aType,
@ -28,13 +28,10 @@ interface nsITabParent : nsISupports
readonly attribute uint64_t tabId;
/**
* Navigate by key. If aForDocumentNavigation is true, navigate by document.
* If aForDocumentNavigation is false, navigate by element.
*
* If aForward is true, navigate to the first focusable element or document.
* If aForward is false, navigate to the last focusable element or document.
* If aForward is true, navigate to the first focusable document.
* If aForward is false, navigate to the last focusable document.
*/
void navigateByKey(in bool aForward, in bool aForDocumentNavigation);
void navigateDocument(in bool aForward);
readonly attribute boolean hasContentOpener;
};

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

@ -698,9 +698,9 @@ child:
SetIsDocShellActive(bool aIsActive);
/**
* Navigate by key (Tab/Shift+Tab/F6/Shift+f6).
* Navigate by document.
*/
NavigateByKey(bool aForward, bool aForDocumentNavigation);
NavigateDocument(bool aForward);
/**
* The parent (chrome thread) requests that the child inform it when

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

@ -2937,7 +2937,7 @@ TabChild::RecvSetIsDocShellActive(const bool& aIsActive)
}
bool
TabChild::RecvNavigateByKey(const bool& aForward, const bool& aForDocumentNavigation)
TabChild::RecvNavigateDocument(const bool& aForward)
{
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
@ -2945,20 +2945,9 @@ TabChild::RecvNavigateByKey(const bool& aForward, const bool& aForDocumentNaviga
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(WebNavigation());
// Move to the first or last document.
uint32_t type = aForward ?
(aForDocumentNavigation ? static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_FIRSTDOC) :
static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_ROOT)) :
(aForDocumentNavigation ? static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_LASTDOC) :
static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_LAST));
fm->MoveFocus(window, nullptr, type,
fm->MoveFocus(window, nullptr, aForward ? nsIFocusManager::MOVEFOCUS_FIRSTDOC :
nsIFocusManager::MOVEFOCUS_LASTDOC,
nsIFocusManager::FLAG_BYKEY, getter_AddRefs(result));
// No valid root element was found, so move to the first focusable element.
if (!result && aForward && !aForDocumentNavigation) {
fm->MoveFocus(window, nullptr, nsIFocusManager::MOVEFOCUS_FIRST,
nsIFocusManager::FLAG_BYKEY, getter_AddRefs(result));
}
SendRequestFocus(false);
}

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

@ -525,7 +525,7 @@ protected:
virtual bool RecvDestroy() override;
virtual bool RecvSetUpdateHitRegion(const bool& aEnabled) override;
virtual bool RecvSetIsDocShellActive(const bool& aIsActive) override;
virtual bool RecvNavigateByKey(const bool& aForward, const bool& aForDocumentNavigation) override;
virtual bool RecvNavigateDocument(const bool& aForward) override;
virtual bool RecvRequestNotifyAfterRemotePaint() override;

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

@ -2950,9 +2950,9 @@ TabParent::SetHasContentOpener(bool aHasContentOpener)
}
NS_IMETHODIMP
TabParent::NavigateByKey(bool aForward, bool aForDocumentNavigation)
TabParent::NavigateDocument(bool aForward)
{
unused << SendNavigateByKey(aForward, aForDocumentNavigation);
unused << SendNavigateDocument(aForward);
return NS_OK;
}

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

@ -75,9 +75,31 @@ definitionlist = definition list
term = term
definition = definition
mathmltable = math table
mathmlcell = cell
mathmlenclosed = enclosed
mathmlfraction = fraction
mathmlfractionwithoutbar = fraction without bar
mathmlroot = root
mathmlscripted = scripted
mathmlsquareroot = square root
# More sophisticated roles which are not actual numeric roles
textarea = text area
base = base
close-fence = closing fence
denominator = denominator
numerator = numerator
open-fence = opening fence
overscript = overscript
presubscript = presubscript
presuperscript = presuperscript
root-index = root index
subscript = subscript
superscript = superscript
underscript = underscript
# Text input types
textInputType_date = date
textInputType_email = e-mail
@ -191,6 +213,26 @@ quicknav_Separator = Separators
quicknav_Table = Tables
quicknav_Checkbox = Check boxes
# MathML menclose notations.
# See developer.mozilla.org/docs/Web/MathML/Element/menclose#attr-notation
notation-longdiv = long division
notation-actuarial = actuarial
notation-phasorangle = phasor angle
notation-radical = radical
notation-box = box
notation-roundedbox = rounded box
notation-circle = circle
notation-left = left
notation-right = right
notation-top = top
notation-bottom = bottom
notation-updiagonalstrike = up diagonal strike
notation-downdiagonalstrike = down diagonal strike
notation-verticalstrike = vertical strike
notation-horizontalstrike = horizontal strike
notation-updiagonalarrow = up diagonal arrow
notation-madruwb = madruwb
# Shortened role names for braille
menubarAbbr = menu bar
scrollbarAbbr = scroll bar
@ -274,3 +316,43 @@ stateCheckedAbbr = (x)
stateUncheckedAbbr = ( )
statePressedAbbr = (x)
stateUnpressedAbbr = ( )
mathmlenclosedAbbr = enclosed
mathmltableAbbr = tbl
mathmlcellAbbr = cell
mathmlfractionAbbr = frac
mathmlfractionwithoutbarAbbr = frac no bar
mathmlrootAbbr = root
mathmlscriptedAbbr = scripted
mathmlsquarerootAbbr = sqrt
baseAbbr = base
close-fenceAbbr = close
denominatorAbbr = den
numeratorAbbr = num
open-fenceAbbr = open
overscriptAbbr = over
presubscriptAbbr = presub
presuperscriptAbbr = presup
root-indexAbbr = index
subscriptAbbr = sub
superscriptAbbr = sup
underscriptAbbr = under
notation-longdivAbbr = longdiv
notation-actuarialAbbr = act
notation-phasorangleAbbr = phasang
notation-radicalAbbr = rad
notation-boxAbbr = box
notation-roundedboxAbbr = rndbox
notation-circleAbbr = circ
notation-leftAbbr = lft
notation-rightAbbr = rght
notation-topAbbr = top
notation-bottomAbbr = bot
notation-updiagonalstrikeAbbr = updiagstrike
notation-downdiagonalstrikeAbbr = dwndiagstrike
notation-verticalstrikeAbbr = vstrike
notation-horizontalstrikeAbbr = hstrike
notation-updiagonalarrowAbbr = updiagarrow
notation-madruwbAbbr = madruwb

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

@ -1663,16 +1663,38 @@ MediaDecoderStateMachine::EnsureAudioDecodeTaskQueued()
return NS_OK;
}
RequestAudioData();
return NS_OK;
}
void
MediaDecoderStateMachine::RequestAudioData()
{
MOZ_ASSERT(OnTaskQueue());
AssertCurrentThreadInMonitor();
SAMPLE_LOG("Queueing audio task - queued=%i, decoder-queued=%o",
AudioQueue().GetSize(), mReader->SizeOfAudioQueueInFrames());
mAudioDataRequest.Begin(ProxyMediaCall(DecodeTaskQueue(), mReader.get(),
__func__, &MediaDecoderReader::RequestAudioData)
->Then(OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnAudioDecoded,
&MediaDecoderStateMachine::OnAudioNotDecoded));
return NS_OK;
if (mSentFirstFrameLoadedEvent) {
mAudioDataRequest.Begin(ProxyMediaCall(DecodeTaskQueue(), mReader.get(),
__func__, &MediaDecoderReader::RequestAudioData)
->Then(OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnAudioDecoded,
&MediaDecoderStateMachine::OnAudioNotDecoded));
} else {
mAudioDataRequest.Begin(
ProxyMediaCall(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::RequestAudioData)
->Then(OwnerThread(), __func__, mStartTimeRendezvous.get(),
&StartTimeRendezvous::ProcessFirstSample<AudioDataPromise>,
&StartTimeRendezvous::FirstSampleRejected<AudioData>)
->CompletionPromise()
->Then(OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnAudioDecoded,
&MediaDecoderStateMachine::OnAudioNotDecoded)
);
}
}
nsresult
@ -1713,26 +1735,52 @@ MediaDecoderStateMachine::EnsureVideoDecodeTaskQueued()
return NS_OK;
}
bool skipToNextKeyFrame = NeedToSkipToNextKeyframe();
int64_t currentTime = mState == DECODER_STATE_SEEKING ? 0 : GetMediaTime();
bool forceDecodeAhead = static_cast<uint32_t>(VideoQueue().GetSize()) <= SCARCE_VIDEO_QUEUE_SIZE;
RequestVideoData();
return NS_OK;
}
void
MediaDecoderStateMachine::RequestVideoData()
{
MOZ_ASSERT(OnTaskQueue());
AssertCurrentThreadInMonitor();
// Time the video decode, so that if it's slow, we can increase our low
// audio threshold to reduce the chance of an audio underrun while we're
// waiting for a video decode to complete.
mVideoDecodeStartTime = TimeStamp::Now();
bool skipToNextKeyFrame = mSentFirstFrameLoadedEvent &&
NeedToSkipToNextKeyframe();
int64_t currentTime = mState == DECODER_STATE_SEEKING ? 0 : GetMediaTime();
bool forceDecodeAhead = mSentFirstFrameLoadedEvent &&
static_cast<uint32_t>(VideoQueue().GetSize()) <= SCARCE_VIDEO_QUEUE_SIZE;
SAMPLE_LOG("Queueing video task - queued=%i, decoder-queued=%o, skip=%i, time=%lld",
VideoQueue().GetSize(), mReader->SizeOfVideoQueueInFrames(), skipToNextKeyFrame,
currentTime);
mVideoDataRequest.Begin(ProxyMediaCall(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::RequestVideoData,
skipToNextKeyFrame, currentTime, forceDecodeAhead)
->Then(OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnVideoDecoded,
&MediaDecoderStateMachine::OnVideoNotDecoded));
return NS_OK;
if (mSentFirstFrameLoadedEvent) {
mVideoDataRequest.Begin(
ProxyMediaCall(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::RequestVideoData,
skipToNextKeyFrame, currentTime, forceDecodeAhead)
->Then(OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnVideoDecoded,
&MediaDecoderStateMachine::OnVideoNotDecoded));
} else {
mVideoDataRequest.Begin(
ProxyMediaCall(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::RequestVideoData,
skipToNextKeyFrame, currentTime, forceDecodeAhead)
->Then(OwnerThread(), __func__, mStartTimeRendezvous.get(),
&StartTimeRendezvous::ProcessFirstSample<VideoDataPromise>,
&StartTimeRendezvous::FirstSampleRejected<VideoData>)
->CompletionPromise()
->Then(OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnVideoDecoded,
&MediaDecoderStateMachine::OnVideoNotDecoded));
}
}
nsresult
@ -2028,30 +2076,10 @@ MediaDecoderStateMachine::DecodeFirstFrame()
NS_ENSURE_SUCCESS(res, res);
} else {
if (HasAudio()) {
mAudioDataRequest.Begin(
ProxyMediaCall(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::RequestAudioData)
->Then(OwnerThread(), __func__, mStartTimeRendezvous.get(),
&StartTimeRendezvous::ProcessFirstSample<AudioDataPromise>,
&StartTimeRendezvous::FirstSampleRejected<AudioData>)
->CompletionPromise()
->Then(OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnAudioDecoded,
&MediaDecoderStateMachine::OnAudioNotDecoded)
);
RequestAudioData();
}
if (HasVideo()) {
mVideoDecodeStartTime = TimeStamp::Now();
mVideoDataRequest.Begin(
ProxyMediaCall(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::RequestVideoData, false, int64_t(0), false)
->Then(OwnerThread(), __func__, mStartTimeRendezvous.get(),
&StartTimeRendezvous::ProcessFirstSample<VideoDataPromise>,
&StartTimeRendezvous::FirstSampleRejected<VideoData>)
->CompletionPromise()
->Then(OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnVideoDecoded,
&MediaDecoderStateMachine::OnVideoNotDecoded));
RequestVideoData();
}
}

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

@ -567,20 +567,26 @@ protected:
nsresult DispatchAudioDecodeTaskIfNeeded();
// Ensures a to decode audio has been dispatched to the decode task queue.
// Ensures a task to decode audio has been dispatched to the decode task queue.
// If a task to decode has already been dispatched, this does nothing,
// otherwise this dispatches a task to do the decode.
// This is called on the state machine or decode threads.
// The decoder monitor must be held.
nsresult EnsureAudioDecodeTaskQueued();
// Start a task to decode audio.
// The decoder monitor must be held.
void RequestAudioData();
nsresult DispatchVideoDecodeTaskIfNeeded();
// Ensures a to decode video has been dispatched to the decode task queue.
// Ensures a task to decode video has been dispatched to the decode task queue.
// If a task to decode has already been dispatched, this does nothing,
// otherwise this dispatches a task to do the decode.
// The decoder monitor must be held.
nsresult EnsureVideoDecodeTaskQueued();
// Start a task to decode video.
// The decoder monitor must be held.
void RequestVideoData();
// Re-evaluates the state and determines whether we need to dispatch
// events to run the decode, or if not whether we should set the reader

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

@ -628,6 +628,7 @@ RTCPeerConnection.prototype = {
},
createOffer: function(optionsOrOnSuccess, onError, options) {
// This entry-point handles both new and legacy call sig. Decipher which one
let onSuccess;
if (typeof optionsOrOnSuccess == "function") {
onSuccess = optionsOrOnSuccess;
@ -694,7 +695,14 @@ RTCPeerConnection.prototype = {
});
},
createAnswer: function(onSuccess, onError) {
createAnswer: function(optionsOrOnSuccess, onError) {
// This entry-point handles both new and legacy call sig. Decipher which one
let onSuccess, options;
if (typeof optionsOrOnSuccess == "function") {
onSuccess = optionsOrOnSuccess;
} else {
options = optionsOrOnSuccess;
}
return this._legacyCatch(onSuccess, onError, () => {
let origin = Cu.getWebIDLCallerPrincipal().origin;
return this._chain(() => {

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

@ -34,7 +34,8 @@ typedef android::MediaCodecProxy MediaCodecProxy;
namespace mozilla {
GonkAudioDecoderManager::GonkAudioDecoderManager(const AudioInfo& aConfig)
: mAudioChannels(aConfig.mChannels)
: mLastDecodedTime(0)
, mAudioChannels(aConfig.mChannels)
, mAudioRate(aConfig.mRate)
, mAudioProfile(aConfig.mProfile)
, mAudioBuffer(nullptr)
@ -164,6 +165,14 @@ GonkAudioDecoderManager::CreateAudioData(int64_t aStreamOffset, AudioData **v) {
return NS_ERROR_NOT_AVAILABLE;
}
if (mLastDecodedTime > timeUs) {
ReleaseAudioBuffer();
GADM_LOG("Output decoded sample time is revert. time=%lld", timeUs);
MOZ_ASSERT(false);
return NS_ERROR_NOT_AVAILABLE;
}
mLastDecodedTime = timeUs;
const uint8_t *data = static_cast<const uint8_t*>(mAudioBuffer->data());
size_t dataOffset = mAudioBuffer->range_offset();
size_t size = mAudioBuffer->range_length();
@ -196,6 +205,8 @@ GonkAudioDecoderManager::Flush()
mQueueSample.Clear();
}
mLastDecodedTime = 0;
if (mDecoder->flush() != OK) {
return NS_ERROR_FAILURE;
}

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

@ -43,6 +43,8 @@ private:
void ReleaseAudioBuffer();
int64_t mLastDecodedTime;
uint32_t mAudioChannels;
uint32_t mAudioRate;
const uint32_t mAudioProfile;

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

@ -23,7 +23,6 @@
namespace mozilla {
static bool sIsWMFEnabled = false;
static bool sDXVAEnabled = false;
static int sNumDecoderThreads = -1;
static bool sIsIntelDecoderEnabled = false;
@ -72,7 +71,6 @@ void
WMFDecoderModule::Init()
{
MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
sIsWMFEnabled = Preferences::GetBool("media.windows-media-foundation.enabled", false);
sDXVAEnabled = gfxPlatform::GetPlatform()->CanUseHardwareVideoDecoding();
sIsIntelDecoderEnabled = Preferences::GetBool("media.webm.intel_decoder.enabled", false);
SetNumOfDecoderThreads();
@ -88,9 +86,7 @@ WMFDecoderModule::GetNumDecoderThreads()
nsresult
WMFDecoderModule::Startup()
{
if (sIsWMFEnabled) {
mWMFInitialized = SUCCEEDED(wmf::MFStartup());
}
mWMFInitialized = SUCCEEDED(wmf::MFStartup());
return mWMFInitialized ? NS_OK : NS_ERROR_FAILURE;
}

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

@ -40,12 +40,12 @@ function check_mp4(v, enabled) {
// H.264 Constrained Baseline Profile Level 3.0, mp3
check("video/mp4; codecs=\"avc1.42E01E, mp3\"", "probably");
check("video/mp4; codecs=\"avc1.42001E, mp4a.40.2\"", "probably");
check("video/mp4; codecs=\"avc1.58A01E, mp4a.40.2\"", "probably");
const ProbablyIfNotLinux = !IsLinuxGStreamer() ? "probably" : "";
// H.264 Main Profile Level 3.0, AAC-LC
check("video/mp4; codecs=\"avc1.4D401E, mp4a.40.2\"", "probably");
// H.264 Main Profile Level 3.1, AAC-LC
@ -74,7 +74,7 @@ function check_mp4(v, enabled) {
check("audio/mp4; codecs=mp4a.40.5", ProbablyIfNotLinux);
check("audio/x-m4a; codecs=\"mp4a.40.5\"", ProbablyIfNotLinux);
check("audio/x-m4a; codecs=mp4a.40.5", ProbablyIfNotLinux);
}
function check_mp3(v, enabled) {
@ -134,12 +134,12 @@ function IsMP4ReaderAvailable() {
return prefs && (IsWindowsVistaOrLater() || IsMacOSSnowLeopardOrLater() || IsJellyBeanOrLater());
}
var haveMp4 = (getPref("media.windows-media-foundation.enabled") && IsWindowsVistaOrLater()) ||
getPref("media.omx.enabled") ||
getPref("media.gstreamer.enabled") ||
IsMP4ReaderAvailable();
var haveMp4 = IsWindowsVistaOrLater() ||
getPref("media.omx.enabled") ||
getPref("media.gstreamer.enabled") ||
IsMP4ReaderAvailable();
// TODO: Add "getPref("media.plugins.enabled")" once MP4 works on Gingerbread.
check_mp4(document.getElementById('v'), haveMp4);
var haveMp3 = getPref("media.directshow.enabled") ||

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

@ -38,10 +38,10 @@
navigator.mediaDevices.getUserMedia({ fake: true, video: true, audio: true })
.then(stream => pc1.addStream(v1.mozSrcObject = stream))
.then(() => pc1.createOffer())
.then(() => pc1.createOffer({})) // check that createOffer accepts arg.
.then(offer => pc1.setLocalDescription(offer))
.then(() => pc2.setRemoteDescription(pc1.localDescription))
.then(() => pc2.createAnswer())
.then(() => pc2.createAnswer({})) // check that createAnswer accepts arg.
.then(answer => pc2.setLocalDescription(answer))
.then(() => pc1.setRemoteDescription(pc2.localDescription))
.then(() => delivered)

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

@ -750,8 +750,16 @@ nsresult WebMReader::SeekInternal(int64_t aTarget)
uint64_t target = aTarget * NS_PER_USEC;
if (mSeekPreroll) {
target = std::max(uint64_t(StartTime() * NS_PER_USEC),
target - mSeekPreroll);
uint64_t startTime = uint64_t(StartTime()) * NS_PER_USEC;
if (target < mSeekPreroll || target - mSeekPreroll < startTime) {
target = startTime;
} else {
target -= mSeekPreroll;
}
LOG(LogLevel::Debug,
("Reader [%p] SeekPreroll: %f StartTime: %f AdjustedTarget: %f",
this, double(mSeekPreroll) / NS_PER_S,
double(startTime) / NS_PER_S, double(target) / NS_PER_S));
}
int r = nestegg_track_seek(mContext, trackToSeek, target);
if (r != 0) {

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

@ -668,7 +668,7 @@ MessagePort::MessagesReceived(nsTArray<MessagePortMessage>& aMessages)
RemoveDocFromBFCache();
FallibleTArray<nsRefPtr<SharedMessagePortMessage>> data;
if (!NS_WARN_IF(SharedMessagePortMessage::FromMessagesToSharedChild(aMessages,
if (NS_WARN_IF(!SharedMessagePortMessage::FromMessagesToSharedChild(aMessages,
data))) {
// OOM, We cannot continue.
return;

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

@ -13,6 +13,7 @@
#include "nsIPermissionManager.h"
#include "nsIPrincipal.h"
#include "nsICookiePermission.h"
#include "nsICookieService.h"
#include "mozilla/dom/StorageBinding.h"
#include "mozilla/dom/StorageEvent.h"
@ -228,10 +229,6 @@ DOMStorage::BroadcastChangeNotification(const nsSubstring& aKey,
NS_DispatchToMainThread(r);
}
static const uint32_t ASK_BEFORE_ACCEPT = 1;
static const uint32_t ACCEPT_SESSION = 2;
static const uint32_t BEHAVIOR_REJECT = 2;
static const char kPermissionType[] = "cookie";
static const char kStorageEnabled[] = "dom.storage.enabled";
static const char kCookiesBehavior[] = "network.cookie.cookieBehavior";
@ -282,11 +279,12 @@ DOMStorage::CanUseStorage(DOMStorage* aStorage)
uint32_t lifetimePolicy = Preferences::GetUint(kCookiesLifetimePolicy);
// Treat "ask every time" as "reject always".
if ((cookieBehavior == BEHAVIOR_REJECT || lifetimePolicy == ASK_BEFORE_ACCEPT)) {
if (cookieBehavior == nsICookieService::BEHAVIOR_REJECT ||
lifetimePolicy == nsICookieService::ASK_BEFORE_ACCEPT) {
return false;
}
if (lifetimePolicy == ACCEPT_SESSION && aStorage) {
if (lifetimePolicy == nsICookieService::ACCEPT_SESSION && aStorage) {
aStorage->mIsSessionOnly = true;
}
}

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

@ -67,7 +67,7 @@ using namespace mozilla::dom::bluetooth;
static void BinderDeadCallback(status_t aErr);
static void InternalSetAudioRoutes(SwitchState aState);
// Refer AudioService.java from Android
static uint32_t sMaxStreamVolumeTbl[AUDIO_STREAM_CNT] = {
static const uint32_t sMaxStreamVolumeTbl[AUDIO_STREAM_CNT] = {
5, // voice call
15, // system
15, // ring
@ -94,7 +94,7 @@ static bool sA2dpSwitchDone = true;
namespace mozilla {
namespace dom {
namespace gonk {
static VolumeData gVolumeData[VOLUME_TOTAL_NUMBER] = {
static const VolumeData gVolumeData[VOLUME_TOTAL_NUMBER] = {
{"audio.volume.content", VOLUME_MEDIA},
{"audio.volume.notification", VOLUME_NOTIFICATION},
{"audio.volume.alarm", VOLUME_ALARM},
@ -763,7 +763,7 @@ nsresult
AudioManager::ValidateVolumeIndex(uint32_t aCategory, uint32_t aIndex) const
{
uint32_t maxIndex = GetMaxVolumeByCategory(aCategory);
if (aIndex < 0 || aIndex > maxIndex) {
if (aIndex > maxIndex) {
return NS_ERROR_FAILURE;
}
return NS_OK;
@ -947,7 +947,7 @@ AudioManager::GetMaxAudioChannelVolume(uint32_t aChannel, uint32_t* aMaxIndex)
nsresult
AudioManager::SetStreamVolumeIndex(int32_t aStream, uint32_t aIndex) {
if (aIndex < 0 || aIndex > sMaxStreamVolumeTbl[aStream]) {
if (aIndex > sMaxStreamVolumeTbl[aStream]) {
return NS_ERROR_INVALID_ARG;
}
mCurrentStreamVolumeTbl[aStream] = aIndex;
@ -1122,7 +1122,7 @@ AudioManager::UpdateProfileState(AudioOutputProfiles aProfile, bool aActive)
// are other profiles. The bluetooth and headset have the same priotity.
uint32_t profilesNum = mAudioProfiles.Length();
MOZ_ASSERT(profilesNum == DEVICE_TOTAL_NUMBER, "Error profile numbers!");
for (uint32_t idx = profilesNum - 1; idx >= 0; --idx) {
for (int32_t idx = profilesNum - 1; idx >= 0; --idx) {
if (mAudioProfiles[idx]->GetActive()) {
mPresentProfile = static_cast<AudioOutputProfiles>(idx);
break;
@ -1148,4 +1148,4 @@ AudioManager::UpdateVolumeFromProfile(AudioProfileData* aProfileData)
SetVolumeByCategory(gVolumeData[idx].mCategory,
aProfileData->mVolumeTable[gVolumeData[idx].mCategory]);
}
}
}

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

@ -21,6 +21,8 @@ interface HTMLAnchorElement : HTMLElement {
attribute DOMString ping;
[SetterThrows]
attribute DOMString rel;
[SetterThrows, Pref="network.http.enablePerElementReferrer"]
attribute DOMString referrer;
readonly attribute DOMTokenList relList;
[SetterThrows]
attribute DOMString hreflang;

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

@ -28,6 +28,8 @@ interface HTMLAreaElement : HTMLElement {
attribute DOMString ping;
[SetterThrows]
attribute DOMString rel;
[SetterThrows, Pref="network.http.enablePerElementReferrer"]
attribute DOMString referrer;
readonly attribute DOMTokenList relList;
// not implemented.

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

@ -52,7 +52,14 @@ dictionary RTCDataChannelInit {
unsigned short stream; // now id
};
dictionary RTCOfferOptions {
dictionary RTCOfferAnswerOptions {
// boolean voiceActivityDetection = true; // TODO: support this (Bug 1184712)
};
dictionary RTCAnswerOptions : RTCOfferAnswerOptions {
};
dictionary RTCOfferOptions : RTCOfferAnswerOptions {
long offerToReceiveVideo;
long offerToReceiveAudio;
boolean mozDontOfferDataChannel;
@ -88,7 +95,7 @@ interface mozRTCPeerConnection : EventTarget {
[Pref="media.peerconnection.identity.enabled"]
Promise<DOMString> getIdentityAssertion();
Promise<mozRTCSessionDescription> createOffer (optional RTCOfferOptions options);
Promise<mozRTCSessionDescription> createAnswer ();
Promise<mozRTCSessionDescription> createAnswer (optional RTCAnswerOptions options);
Promise<void> setLocalDescription (mozRTCSessionDescription description);
Promise<void> setRemoteDescription (mozRTCSessionDescription description);
readonly attribute mozRTCSessionDescription? localDescription;

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

@ -76,11 +76,15 @@ using namespace mozilla::dom;
static nsresult
GetDOMEventTarget(nsWebBrowser* aInBrowser, EventTarget** aTarget)
{
NS_ENSURE_ARG_POINTER(aInBrowser);
if (!aInBrowser) {
return NS_ERROR_INVALID_POINTER;
}
nsCOMPtr<nsIDOMWindow> domWindow;
aInBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
if (!domWindow) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(domWindow);
NS_ENSURE_TRUE(domWindowPrivate, NS_ERROR_FAILURE);

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

@ -360,7 +360,10 @@ nsWebBrowser::SetParentURIContentListener(
NS_IMETHODIMP
nsWebBrowser::GetContentDOMWindow(nsIDOMWindow** aResult)
{
NS_ENSURE_STATE(mDocShell);
if (!mDocShell) {
return NS_ERROR_UNEXPECTED;
}
nsCOMPtr<nsIDOMWindow> retval = mDocShell->GetWindow();
retval.forget(aResult);
return *aResult ? NS_OK : NS_ERROR_FAILURE;

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

@ -7,6 +7,7 @@
#include "DaemonSocket.h"
#include "mozilla/ipc/DaemonSocketConsumer.h"
#include "mozilla/ipc/DaemonSocketPDU.h"
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#ifdef CHROMIUM_LOG
#undef CHROMIUM_LOG
@ -38,6 +39,8 @@ public:
DaemonSocket* aConnection,
DaemonSocketIOConsumer* aConsumer);
~DaemonSocketIO();
// Methods for |DataSocketIO|
//
@ -82,6 +85,13 @@ DaemonSocketIO::DaemonSocketIO(
{
MOZ_ASSERT(mConnection);
MOZ_ASSERT(mConsumer);
MOZ_COUNT_CTOR_INHERITED(DaemonSocketIO, ConnectionOrientedSocketIO);
}
DaemonSocketIO::~DaemonSocketIO()
{
MOZ_COUNT_DTOR_INHERITED(DaemonSocketIO, ConnectionOrientedSocketIO);
}
// |DataSocketIO|
@ -169,10 +179,14 @@ DaemonSocket::DaemonSocket(
, mIndex(aIndex)
{
MOZ_ASSERT(mConsumer);
MOZ_COUNT_CTOR_INHERITED(DaemonSocket, ConnectionOrientedSocket);
}
DaemonSocket::~DaemonSocket()
{ }
{
MOZ_COUNT_DTOR_INHERITED(DaemonSocket, ConnectionOrientedSocket);
}
// |ConnectionOrientedSocket|

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

@ -6,6 +6,7 @@
#include "DaemonSocketPDU.h"
#include "mozilla/ipc/DaemonSocketConsumer.h"
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#ifdef CHROMIUM_LOG
#undef CHROMIUM_LOG
@ -32,6 +33,8 @@ DaemonSocketPDU::DaemonSocketPDU(uint8_t aService, uint8_t aOpcode,
: mConsumer(nullptr)
, mUserData(nullptr)
{
MOZ_COUNT_CTOR_INHERITED(DaemonSocketPDU, UnixSocketIOBuffer);
// Allocate memory
size_t availableSpace = HEADER_SIZE + aPayloadSize;
ResetBuffer(new uint8_t[availableSpace], 0, 0, availableSpace);
@ -50,12 +53,16 @@ DaemonSocketPDU::DaemonSocketPDU(size_t aPayloadSize)
: mConsumer(nullptr)
, mUserData(nullptr)
{
MOZ_COUNT_CTOR_INHERITED(DaemonSocketPDU, UnixSocketIOBuffer);
size_t availableSpace = HEADER_SIZE + aPayloadSize;
ResetBuffer(new uint8_t[availableSpace], 0, 0, availableSpace);
}
DaemonSocketPDU::~DaemonSocketPDU()
{
MOZ_COUNT_DTOR_INHERITED(DaemonSocketPDU, UnixSocketIOBuffer);
nsAutoArrayPtr<uint8_t> data(GetBuffer());
ResetBuffer(nullptr, 0, 0, 0);
}

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

@ -10,6 +10,7 @@
#include <pwd.h>
#include <sys/stat.h>
#include <sys/un.h>
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h" // For NS_IsMainThread.
#ifdef MOZ_WIDGET_GONK
@ -26,10 +27,14 @@ static const char KEYSTORE_SOCKET_PATH[] = "/dev/socket/keystore";
KeyStoreConnector::KeyStoreConnector(const char** const aAllowedUsers)
: mAllowedUsers(aAllowedUsers)
{ }
{
MOZ_COUNT_CTOR_INHERITED(KeyStoreConnector, UnixSocketConnector);
}
KeyStoreConnector::~KeyStoreConnector()
{ }
{
MOZ_COUNT_DTOR_INHERITED(KeyStoreConnector, UnixSocketConnector);
}
nsresult
KeyStoreConnector::CreateSocket(int& aFd) const

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

@ -8,6 +8,7 @@
#include "NfcConnector.h"
#include <fcntl.h>
#include <sys/un.h>
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h" // For NS_IsMainThread.
namespace mozilla {
@ -15,10 +16,14 @@ namespace ipc {
NfcConnector::NfcConnector(const nsACString& aAddressString)
: mAddressString(aAddressString)
{ }
{
MOZ_COUNT_CTOR_INHERITED(NfcConnector, UnixSocketConnector);
}
NfcConnector::~NfcConnector()
{ }
{
MOZ_COUNT_DTOR_INHERITED(NfcConnector, UnixSocketConnector);
}
nsresult
NfcConnector::CreateSocket(int& aFd) const

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

@ -8,6 +8,7 @@
#include "RilConnector.h"
#include <fcntl.h>
#include <sys/socket.h>
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsThreadUtils.h" // For NS_IsMainThread.
#ifdef AF_INET
@ -27,10 +28,14 @@ RilConnector::RilConnector(const nsACString& aAddressString,
unsigned long aClientId)
: mAddressString(aAddressString)
, mClientId(aClientId)
{ }
{
MOZ_COUNT_CTOR_INHERITED(RilConnector, UnixSocketConnector);
}
RilConnector::~RilConnector()
{ }
{
MOZ_COUNT_DTOR_INHERITED(RilConnector, UnixSocketConnector);
}
nsresult
RilConnector::CreateSocket(int aDomain, int& aFd) const

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

@ -9,6 +9,7 @@
#include "mozilla/dom/workers/Workers.h"
#include "mozilla/ipc/UnixSocketConnector.h"
#include "mozilla/RefPtr.h"
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsXULAppAPI.h"
#include "RilSocketConsumer.h"
@ -108,12 +109,16 @@ RilSocketIO::RilSocketIO(WorkerCrossThreadDispatcher* aDispatcher,
{
MOZ_ASSERT(mDispatcher);
MOZ_ASSERT(mRilSocket);
MOZ_COUNT_CTOR_INHERITED(RilSocketIO, ConnectionOrientedSocketIO);
}
RilSocketIO::~RilSocketIO()
{
MOZ_ASSERT(IsConsumerThread());
MOZ_ASSERT(IsShutdownOnConsumerThread());
MOZ_COUNT_DTOR_INHERITED(RilSocketIO, ConnectionOrientedSocketIO);
}
RilSocket*
@ -324,11 +329,15 @@ RilSocket::RilSocket(WorkerCrossThreadDispatcher* aDispatcher,
{
MOZ_ASSERT(mDispatcher);
MOZ_ASSERT(mConsumer);
MOZ_COUNT_CTOR_INHERITED(RilSocket, ConnectionOrientedSocket);
}
RilSocket::~RilSocket()
{
MOZ_ASSERT(!mIO);
MOZ_COUNT_DTOR_INHERITED(RilSocket, ConnectionOrientedSocket);
}
void

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ConnectionOrientedSocket.h"
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "UnixSocketConnector.h"
namespace mozilla {
@ -25,6 +26,8 @@ ConnectionOrientedSocketIO::ConnectionOrientedSocketIO(
, mPeerAddressLength(0)
{
MOZ_ASSERT(mConnector);
MOZ_COUNT_CTOR_INHERITED(ConnectionOrientedSocketIO, DataSocketIO);
}
ConnectionOrientedSocketIO::ConnectionOrientedSocketIO(
@ -37,10 +40,14 @@ ConnectionOrientedSocketIO::ConnectionOrientedSocketIO(
, mPeerAddressLength(0)
{
MOZ_ASSERT(mConnector);
MOZ_COUNT_CTOR_INHERITED(ConnectionOrientedSocketIO, DataSocketIO);
}
ConnectionOrientedSocketIO::~ConnectionOrientedSocketIO()
{ }
{
MOZ_COUNT_DTOR_INHERITED(ConnectionOrientedSocketIO, DataSocketIO);
}
nsresult
ConnectionOrientedSocketIO::Accept(int aFd,
@ -181,8 +188,15 @@ ConnectionOrientedSocketIO::OnError(const char* aFunction, int aErrno)
// ConnectionOrientedSocket
//
ConnectionOrientedSocket::ConnectionOrientedSocket()
{
MOZ_COUNT_CTOR_INHERITED(ConnectionOrientedSocket, DataSocket);
}
ConnectionOrientedSocket::~ConnectionOrientedSocket()
{ }
{
MOZ_COUNT_DTOR_INHERITED(ConnectionOrientedSocket, DataSocket);
}
}
}

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

@ -4,8 +4,8 @@
* 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/. */
#ifndef mozilla_ipc_connectionorientedsocket_h
#define mozilla_ipc_connectionorientedsocket_h
#ifndef mozilla_ipc_ConnectionOrientedSocket_h
#define mozilla_ipc_ConnectionOrientedSocket_h
#include <sys/socket.h>
#include "DataSocket.h"
@ -112,10 +112,11 @@ public:
ConnectionOrientedSocketIO*& aIO) = 0;
protected:
ConnectionOrientedSocket();
virtual ~ConnectionOrientedSocket();
};
}
}
#endif
#endif // mozilla_ipc_ConnectionOrientedSocket

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

@ -6,10 +6,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "mozilla/ipc/DataSocket.h"
#include "DataSocket.h"
#ifdef MOZ_TASK_TRACER
#include "GeckoTaskTracer.h"
#endif
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#ifdef MOZ_TASK_TRACER
using namespace mozilla::tasktracer;
@ -23,7 +24,9 @@ namespace ipc {
//
DataSocketIO::~DataSocketIO()
{ }
{
MOZ_COUNT_DTOR_INHERITED(DataSocketIO, SocketIOBase);
}
void
DataSocketIO::EnqueueData(UnixSocketIOBuffer* aBuffer)
@ -111,14 +114,23 @@ DataSocketIO::SendPendingData(int aFd)
DataSocketIO::DataSocketIO(MessageLoop* aConsumerLoop)
: SocketIOBase(aConsumerLoop)
{ }
{
MOZ_COUNT_CTOR_INHERITED(DataSocketIO, SocketIOBase);
}
//
// DataSocket
//
DataSocket::DataSocket()
{
MOZ_COUNT_CTOR_INHERITED(DataSocket, SocketBase);
}
DataSocket::~DataSocket()
{ }
{
MOZ_COUNT_DTOR_INHERITED(DataSocket, SocketBase);
}
}
}

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

@ -36,6 +36,9 @@ public:
* @param aBuffer Data to be sent to socket
*/
virtual void SendSocketData(UnixSocketIOBuffer* aBuffer) = 0;
protected:
DataSocket();
};
//

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

@ -10,6 +10,7 @@
#include "DataSocket.h"
#include "ListenSocketConsumer.h"
#include "mozilla/RefPtr.h"
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsXULAppAPI.h"
#include "UnixSocketConnector.h"
@ -66,11 +67,11 @@ private:
void FireSocketError();
/**
* Consumer pointer. Non-thread safe RefPtr, so should only be manipulated
* Consumer pointer. Non-thread-safe pointer, so should only be manipulated
* directly from consumer thread. All non-consumer-thread accesses should
* happen with mIO as container.
*/
RefPtr<ListenSocket> mListenSocket;
ListenSocket* mListenSocket;
/**
* Connector object used to create the connection we are currently using.
@ -109,12 +110,16 @@ ListenSocketIO::ListenSocketIO(MessageLoop* aConsumerLoop,
{
MOZ_ASSERT(mListenSocket);
MOZ_ASSERT(mConnector);
MOZ_COUNT_CTOR_INHERITED(ListenSocketIO, SocketIOBase);
}
ListenSocketIO::~ListenSocketIO()
{
MOZ_ASSERT(IsConsumerThread());
MOZ_ASSERT(IsShutdownOnConsumerThread());
MOZ_COUNT_DTOR_INHERITED(ListenSocketIO, SocketIOBase);
}
UnixSocketConnector*
@ -226,7 +231,7 @@ ListenSocketIO::OnSocketCanAcceptWithoutBlocking()
SocketBase*
ListenSocketIO::GetSocketBase()
{
return mListenSocket.get();
return mListenSocket;
}
bool
@ -266,15 +271,21 @@ ListenSocketIO::ShutdownOnIOThread()
// Socket tasks
//
class ListenSocketIO::ListenTask final
: public SocketIOTask<ListenSocketIO>
class ListenSocketIO::ListenTask final : public SocketIOTask<ListenSocketIO>
{
public:
ListenTask(ListenSocketIO* aIO, ConnectionOrientedSocketIO* aCOSocketIO)
: SocketIOTask<ListenSocketIO>(aIO)
, mCOSocketIO(aCOSocketIO)
: SocketIOTask<ListenSocketIO>(aIO)
, mCOSocketIO(aCOSocketIO)
{
MOZ_ASSERT(mCOSocketIO);
MOZ_COUNT_CTOR(ListenTask);
}
~ListenTask()
{
MOZ_COUNT_DTOR(ListenTask);
}
void Run() override
@ -291,7 +302,7 @@ private:
};
//
// UnixSocketConsumer
// ListenSocket
//
ListenSocket::ListenSocket(ListenSocketConsumer* aConsumer, int aIndex)
@ -300,11 +311,15 @@ ListenSocket::ListenSocket(ListenSocketConsumer* aConsumer, int aIndex)
, mIndex(aIndex)
{
MOZ_ASSERT(mConsumer);
MOZ_COUNT_CTOR_INHERITED(ListenSocket, SocketBase);
}
ListenSocket::~ListenSocket()
{
MOZ_ASSERT(!mIO);
MOZ_COUNT_DTOR_INHERITED(ListenSocket, SocketBase);
}
nsresult

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

@ -4,11 +4,11 @@
* 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/. */
#ifndef mozilla_ipc_listensocket_h
#define mozilla_ipc_listensocket_h
#ifndef mozilla_ipc_ListenSocket_h
#define mozilla_ipc_ListenSocket_h
#include "nsString.h"
#include "mozilla/ipc/SocketBase.h"
#include "nsString.h"
class MessageLoop;
@ -90,4 +90,4 @@ private:
} // namespace ipc
} // namepsace mozilla
#endif // mozilla_ipc_listensocket_h
#endif // mozilla_ipc_ListenSocket_h

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

@ -10,6 +10,7 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
namespace mozilla {
namespace ipc {
@ -23,10 +24,14 @@ UnixSocketBuffer::UnixSocketBuffer()
, mOffset(0)
, mAvailableSpace(0)
, mData(nullptr)
{ }
{
MOZ_COUNT_CTOR(UnixSocketBuffer);
}
UnixSocketBuffer::~UnixSocketBuffer()
{
MOZ_COUNT_DTOR(UnixSocketBuffer);
// Make sure that the caller released the buffer's memory.
MOZ_ASSERT(!GetBuffer());
}
@ -96,8 +101,15 @@ UnixSocketBuffer::CleanupLeadingSpace()
// UnixSocketIOBuffer
//
UnixSocketIOBuffer::UnixSocketIOBuffer()
{
MOZ_COUNT_CTOR_INHERITED(UnixSocketIOBuffer, UnixSocketBuffer);
}
UnixSocketIOBuffer::~UnixSocketIOBuffer()
{ }
{
MOZ_COUNT_DTOR_INHERITED(UnixSocketIOBuffer, UnixSocketBuffer);
}
//
// UnixSocketRawData
@ -107,17 +119,23 @@ UnixSocketRawData::UnixSocketRawData(const void* aData, size_t aSize)
{
MOZ_ASSERT(aData || !aSize);
MOZ_COUNT_CTOR_INHERITED(UnixSocketRawData, UnixSocketIOBuffer);
ResetBuffer(static_cast<uint8_t*>(memcpy(new uint8_t[aSize], aData, aSize)),
0, aSize, aSize);
}
UnixSocketRawData::UnixSocketRawData(size_t aSize)
{
MOZ_COUNT_CTOR_INHERITED(UnixSocketRawData, UnixSocketIOBuffer);
ResetBuffer(new uint8_t[aSize], 0, 0, aSize);
}
UnixSocketRawData::~UnixSocketRawData()
{
MOZ_COUNT_DTOR_INHERITED(UnixSocketRawData, UnixSocketIOBuffer);
nsAutoArrayPtr<uint8_t> data(GetBuffer());
ResetBuffer(nullptr, 0, 0, 0);
}
@ -237,11 +255,15 @@ SocketBase::SocketBase()
: mConnectionStatus(SOCKET_DISCONNECTED)
, mConnectTimestamp(0)
, mConnectDelayMs(0)
{ }
{
MOZ_COUNT_CTOR(SocketBase);
}
SocketBase::~SocketBase()
{
MOZ_ASSERT(mConnectionStatus == SOCKET_DISCONNECTED);
MOZ_COUNT_DTOR(SocketBase);
}
void
@ -258,10 +280,14 @@ SocketIOBase::SocketIOBase(MessageLoop* aConsumerLoop)
: mConsumerLoop(aConsumerLoop)
{
MOZ_ASSERT(mConsumerLoop);
MOZ_COUNT_CTOR(SocketIOBase);
}
SocketIOBase::~SocketIOBase()
{ }
{
MOZ_COUNT_DTOR(SocketIOBase);
}
MessageLoop*
SocketIOBase::GetConsumerThread() const
@ -282,7 +308,14 @@ SocketIOBase::IsConsumerThread() const
SocketEventTask::SocketEventTask(SocketIOBase* aIO, SocketEvent aEvent)
: SocketTask<SocketIOBase>(aIO)
, mEvent(aEvent)
{ }
{
MOZ_COUNT_CTOR(SocketEventTask);
}
SocketEventTask::~SocketEventTask()
{
MOZ_COUNT_DTOR(SocketEventTask);
}
void
SocketEventTask::Run()
@ -313,10 +346,16 @@ SocketEventTask::Run()
// SocketRequestClosingTask
//
SocketRequestClosingTask::SocketRequestClosingTask(
SocketIOBase* aIO)
SocketRequestClosingTask::SocketRequestClosingTask(SocketIOBase* aIO)
: SocketTask<SocketIOBase>(aIO)
{ }
{
MOZ_COUNT_CTOR(SocketRequestClosingTask);
}
SocketRequestClosingTask::~SocketRequestClosingTask()
{
MOZ_COUNT_DTOR(SocketRequestClosingTask);
}
void
SocketRequestClosingTask::Run()
@ -341,10 +380,16 @@ SocketRequestClosingTask::Run()
// SocketDeleteInstanceTask
//
SocketDeleteInstanceTask::SocketDeleteInstanceTask(
SocketIOBase* aIO)
SocketDeleteInstanceTask::SocketDeleteInstanceTask(SocketIOBase* aIO)
: mIO(aIO)
{ }
{
MOZ_COUNT_CTOR(SocketDeleteInstanceTask);
}
SocketDeleteInstanceTask::~SocketDeleteInstanceTask()
{
MOZ_COUNT_DTOR(SocketDeleteInstanceTask);
}
void
SocketDeleteInstanceTask::Run()
@ -358,7 +403,14 @@ SocketDeleteInstanceTask::Run()
SocketIOShutdownTask::SocketIOShutdownTask(SocketIOBase* aIO)
: SocketIOTask<SocketIOBase>(aIO)
{ }
{
MOZ_COUNT_CTOR(SocketIOShutdownTask);
}
SocketIOShutdownTask::~SocketIOShutdownTask()
{
MOZ_COUNT_DTOR(SocketIOShutdownTask);
}
void
SocketIOShutdownTask::Run()

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

@ -197,6 +197,7 @@ private:
class UnixSocketIOBuffer : public UnixSocketBuffer
{
public:
UnixSocketIOBuffer();
virtual ~UnixSocketIOBuffer();
/**
@ -439,6 +440,7 @@ public:
};
SocketEventTask(SocketIOBase* aIO, SocketEvent aEvent);
~SocketEventTask();
void Run() override;
@ -454,6 +456,7 @@ class SocketRequestClosingTask final : public SocketTask<SocketIOBase>
{
public:
SocketRequestClosingTask(SocketIOBase* aIO);
~SocketRequestClosingTask();
void Run() override;
};
@ -465,6 +468,7 @@ class SocketDeleteInstanceTask final : public Task
{
public:
SocketDeleteInstanceTask(SocketIOBase* aIO);
~SocketDeleteInstanceTask();
void Run() override;
@ -520,6 +524,7 @@ class SocketIOShutdownTask final : public SocketIOTask<SocketIOBase>
{
public:
SocketIOShutdownTask(SocketIOBase* aIO);
~SocketIOShutdownTask();
void Run() override;
};

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

@ -7,6 +7,7 @@
#include "StreamSocket.h"
#include <fcntl.h>
#include "mozilla/RefPtr.h"
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
#include "nsXULAppAPI.h"
#include "StreamSocketConsumer.h"
#include "UnixSocketConnector.h"
@ -68,11 +69,11 @@ public:
private:
/**
* Consumer pointer. Non-thread safe RefPtr, so should only be manipulated
* Consumer pointer. Non-thread-safe pointer, so should only be manipulated
* directly from consumer thread. All non-consumer-thread accesses should
* happen with mIO as container.
*/
RefPtr<StreamSocket> mStreamSocket;
StreamSocket* mStreamSocket;
/**
* If true, do not requeue whatever task we're running
@ -101,6 +102,8 @@ StreamSocketIO::StreamSocketIO(MessageLoop* aConsumerLoop,
, mDelayedConnectTask(nullptr)
{
MOZ_ASSERT(mStreamSocket);
MOZ_COUNT_CTOR_INHERITED(StreamSocketIO, ConnectionOrientedSocketIO);
}
StreamSocketIO::StreamSocketIO(MessageLoop* aConsumerLoop,
@ -118,24 +121,28 @@ StreamSocketIO::StreamSocketIO(MessageLoop* aConsumerLoop,
, mDelayedConnectTask(nullptr)
{
MOZ_ASSERT(mStreamSocket);
MOZ_COUNT_CTOR_INHERITED(StreamSocketIO, ConnectionOrientedSocketIO);
}
StreamSocketIO::~StreamSocketIO()
{
MOZ_ASSERT(IsConsumerThread());
MOZ_ASSERT(IsShutdownOnConsumerThread());
MOZ_COUNT_DTOR_INHERITED(StreamSocketIO, ConnectionOrientedSocketIO);
}
StreamSocket*
StreamSocketIO::GetStreamSocket()
{
return mStreamSocket.get();
return mStreamSocket;
}
DataSocket*
StreamSocketIO::GetDataSocket()
{
return mStreamSocket.get();
return GetStreamSocket();
}
void
@ -192,7 +199,14 @@ public:
ReceiveTask(StreamSocketIO* aIO, UnixSocketBuffer* aBuffer)
: SocketTask<StreamSocketIO>(aIO)
, mBuffer(aBuffer)
{ }
{
MOZ_COUNT_CTOR(ReceiveTask);
}
~ReceiveTask()
{
MOZ_COUNT_DTOR(ReceiveTask);
}
void Run() override
{
@ -274,13 +288,19 @@ StreamSocketIO::ShutdownOnIOThread()
// Socket tasks
//
class StreamSocketIO::ConnectTask final
: public SocketIOTask<StreamSocketIO>
class StreamSocketIO::ConnectTask final : public SocketIOTask<StreamSocketIO>
{
public:
ConnectTask(StreamSocketIO* aIO)
: SocketIOTask<StreamSocketIO>(aIO)
{ }
: SocketIOTask<StreamSocketIO>(aIO)
{
MOZ_COUNT_CTOR(ReceiveTask);
}
~ConnectTask()
{
MOZ_COUNT_DTOR(ReceiveTask);
}
void Run() override
{
@ -297,7 +317,14 @@ class StreamSocketIO::DelayedConnectTask final
public:
DelayedConnectTask(StreamSocketIO* aIO)
: SocketIOTask<StreamSocketIO>(aIO)
{ }
{
MOZ_COUNT_CTOR(DelayedConnectTask);
}
~DelayedConnectTask()
{
MOZ_COUNT_DTOR(DelayedConnectTask);
}
void Run() override
{
@ -327,11 +354,15 @@ StreamSocket::StreamSocket(StreamSocketConsumer* aConsumer, int aIndex)
, mIndex(aIndex)
{
MOZ_ASSERT(mConsumer);
MOZ_COUNT_CTOR_INHERITED(StreamSocket, ConnectionOrientedSocket);
}
StreamSocket::~StreamSocket()
{
MOZ_ASSERT(!mIO);
MOZ_COUNT_DTOR_INHERITED(StreamSocket, ConnectionOrientedSocket);
}
void

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

@ -5,15 +5,20 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "UnixSocketConnector.h"
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, MOZ_COUNT_DTOR
namespace mozilla {
namespace ipc {
UnixSocketConnector::UnixSocketConnector()
{ }
{
MOZ_COUNT_CTOR(UnixSocketConnector);
}
UnixSocketConnector::~UnixSocketConnector()
{ }
{
MOZ_COUNT_DTOR(UnixSocketConnector);
}
}
}

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

@ -12,6 +12,7 @@
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h"
#include "mozilla/TypeTraits.h"
#include <string.h>
@ -141,10 +142,15 @@ struct CStringHashPolicy
#define ZERO_SIZE(tabKind, servoKind, mSize) mSize(0),
#define COPY_OTHER_SIZE(tabKind, servoKind, mSize) mSize(other.mSize),
#define ADD_OTHER_SIZE(tabKind, servoKind, mSize) mSize += other.mSize;
#define SUB_OTHER_SIZE(tabKind, servoKind, mSize) MOZ_ASSERT(mSize >= other.mSize); \
mSize -= other.mSize;
#define SUB_OTHER_SIZE(tabKind, servoKind, mSize) \
MOZ_ASSERT(mSize >= other.mSize); \
mSize -= other.mSize;
#define ADD_SIZE_TO_N(tabKind, servoKind, mSize) n += mSize;
#define ADD_SIZE_TO_N_IF_LIVE_GC_THING(tabKind, servoKind, mSize) n += (ServoSizes::servoKind == ServoSizes::GCHeapUsed) ? mSize : 0;
#define ADD_SIZE_TO_N_IF_LIVE_GC_THING(tabKind, servoKind, mSize) \
/* Avoid self-comparison warnings by comparing enums indirectly. */ \
n += (mozilla::IsSame<int[ServoSizes::servoKind], int[ServoSizes::GCHeapUsed]>::value) \
? mSize \
: 0;
#define ADD_TO_TAB_SIZES(tabKind, servoKind, mSize) sizes->add(JS::TabSizes::tabKind, mSize);
#define ADD_TO_SERVO_SIZES(tabKind, servoKind, mSize) sizes->add(JS::ServoSizes::servoKind, mSize);

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

@ -604,6 +604,156 @@ condIf(const ParseNode* pn, ParseNodeKind kind)
}
static bool
Fold(ExclusiveContext* cx, ParseNode** pnp,
FullParseHandler& handler, const ReadOnlyCompileOptions& options,
bool inGenexpLambda, SyntacticContext sc);
static bool
FoldTypeOfExpr(ExclusiveContext* cx, ParseNode* node, FullParseHandler& handler,
const ReadOnlyCompileOptions& options, bool inGenexpLambda)
{
MOZ_ASSERT(node->isKind(PNK_TYPEOFEXPR));
MOZ_ASSERT(node->isArity(PN_UNARY));
ParseNode*& expr = node->pn_kid;
if (!Fold(cx, &expr, handler, options, inGenexpLambda, SyntacticContext::Other))
return false;
// Constant-fold the entire |typeof| if given a constant with known type.
RootedPropertyName result(cx);
if (expr->isKind(PNK_STRING) || expr->isKind(PNK_TEMPLATE_STRING))
result = cx->names().string;
else if (expr->isKind(PNK_NUMBER))
result = cx->names().number;
else if (expr->isKind(PNK_NULL))
result = cx->names().object;
else if (expr->isKind(PNK_TRUE) || expr->isKind(PNK_FALSE))
result = cx->names().boolean;
else if (expr->isKind(PNK_FUNCTION))
result = cx->names().function;
if (result) {
handler.prepareNodeForMutation(node);
node->setKind(PNK_STRING);
node->setArity(PN_NULLARY);
node->setOp(JSOP_NOP);
node->pn_atom = result;
}
return true;
}
static bool
FoldVoid(ExclusiveContext* cx, ParseNode* node, FullParseHandler& handler,
const ReadOnlyCompileOptions& options, bool inGenexpLambda, SyntacticContext sc)
{
MOZ_ASSERT(node->isKind(PNK_VOID));
MOZ_ASSERT(node->isArity(PN_UNARY));
ParseNode*& expr = node->pn_kid;
if (!Fold(cx, &expr, handler, options, inGenexpLambda, SyntacticContext::Other))
return false;
if (sc == SyntacticContext::Condition) {
if (expr->isKind(PNK_TRUE) ||
expr->isKind(PNK_FALSE) ||
expr->isKind(PNK_STRING) ||
expr->isKind(PNK_TEMPLATE_STRING) ||
expr->isKind(PNK_NUMBER) ||
expr->isKind(PNK_NULL) ||
expr->isKind(PNK_FUNCTION))
{
handler.prepareNodeForMutation(node);
node->setKind(PNK_FALSE);
node->setArity(PN_NULLARY);
node->setOp(JSOP_FALSE);
}
}
return true;
}
static bool
FoldDeleteExpr(ExclusiveContext* cx, ParseNode* node, FullParseHandler& handler,
const ReadOnlyCompileOptions& options, bool inGenexpLambda)
{
MOZ_ASSERT(node->isKind(PNK_DELETEEXPR));
MOZ_ASSERT(node->isArity(PN_UNARY));
ParseNode*& expr = node->pn_kid;
if (!Fold(cx, &expr, handler, options, inGenexpLambda, SyntacticContext::Other))
return false;
// Expression deletion evaluates the expression, then evaluates to
// true. For trivial expressions, eliminate the expression evaluation.
if (expr->isKind(PNK_TRUE) ||
expr->isKind(PNK_FALSE) ||
expr->isKind(PNK_STRING) ||
expr->isKind(PNK_TEMPLATE_STRING) ||
expr->isKind(PNK_NUMBER) ||
expr->isKind(PNK_NULL) ||
expr->isKind(PNK_FUNCTION))
{
handler.prepareNodeForMutation(node);
node->setKind(PNK_TRUE);
node->setArity(PN_NULLARY);
node->setOp(JSOP_TRUE);
}
return true;
}
static bool
FoldDeleteElement(ExclusiveContext* cx, ParseNode* node, FullParseHandler& handler,
const ReadOnlyCompileOptions& options, bool inGenexpLambda)
{
MOZ_ASSERT(node->isKind(PNK_DELETEELEM) || node->isKind(PNK_DELETESUPERELEM));
MOZ_ASSERT(node->isArity(PN_UNARY));
MOZ_ASSERT(node->pn_kid->isKind(PNK_ELEM) || node->pn_kid->isKind(PNK_SUPERELEM));
ParseNode*& expr = node->pn_kid;
if (!Fold(cx, &expr, handler, options, inGenexpLambda, SyntacticContext::Other))
return false;
// If we're deleting an element, but constant-folding converted our
// element reference into a dotted property access, we must *also*
// morph the node's kind.
//
// In principle this also applies to |super["foo"] -> super.foo|,
// but we don't constant-fold |super["foo"]| yet.
if (node->isKind(PNK_DELETEELEM)) {
MOZ_ASSERT(expr->isKind(PNK_ELEM) || expr->isKind(PNK_DOT));
if (expr->isKind(PNK_DOT))
node->setKind(PNK_DELETEPROP);
}
return true;
}
static bool
FoldDeleteProperty(ExclusiveContext* cx, ParseNode* node, FullParseHandler& handler,
const ReadOnlyCompileOptions& options, bool inGenexpLambda)
{
MOZ_ASSERT(node->isKind(PNK_DELETEPROP) || node->isKind(PNK_DELETESUPERPROP));
MOZ_ASSERT(node->isArity(PN_UNARY));
MOZ_ASSERT(node->pn_kid->isKind(PNK_DOT) || node->pn_kid->isKind(PNK_SUPERPROP));
ParseNode*& expr = node->pn_kid;
#ifdef DEBUG
ParseNodeKind oldKind = expr->getKind();
#endif
if (!Fold(cx, &expr, handler, options, inGenexpLambda, SyntacticContext::Other))
return false;
MOZ_ASSERT(expr->isKind(oldKind),
"kind should have remained invariant under folding");
return true;
}
bool
Fold(ExclusiveContext* cx, ParseNode** pnp,
FullParseHandler& handler, const ReadOnlyCompileOptions& options,
bool inGenexpLambda, SyntacticContext sc)
@ -629,6 +779,169 @@ Fold(ExclusiveContext* cx, ParseNode** pnp,
ParseNode* pn2 = nullptr;
ParseNode* pn3 = nullptr;
switch (pn->getKind()) {
case PNK_NEWTARGET:
case PNK_NOP:
case PNK_REGEXP:
case PNK_STRING:
case PNK_TRUE:
case PNK_FALSE:
case PNK_NULL:
case PNK_ELISION:
case PNK_NUMBER:
case PNK_DEBUGGER:
case PNK_BREAK:
case PNK_CONTINUE:
case PNK_TEMPLATE_STRING:
case PNK_THIS:
case PNK_GENERATOR:
case PNK_EXPORT_BATCH_SPEC:
case PNK_OBJECT_PROPERTY_NAME:
case PNK_SUPERPROP:
case PNK_FRESHENBLOCK:
MOZ_ASSERT(pn->isArity(PN_NULLARY));
goto afterFolding;
case PNK_TYPEOFNAME:
MOZ_ASSERT(pn->isArity(PN_UNARY));
MOZ_ASSERT(pn->pn_kid->isKind(PNK_NAME));
MOZ_ASSERT(!pn->pn_kid->maybeExpr());
return true;
case PNK_TYPEOFEXPR:
return FoldTypeOfExpr(cx, pn, handler, options, inGenexpLambda);
case PNK_VOID:
return FoldVoid(cx, pn, handler, options, inGenexpLambda, sc);
case PNK_DELETENAME: {
MOZ_ASSERT(pn->isArity(PN_UNARY));
MOZ_ASSERT(pn->pn_kid->isKind(PNK_NAME));
return true;
}
case PNK_DELETEEXPR:
return FoldDeleteExpr(cx, pn, handler, options, inGenexpLambda);
case PNK_DELETEELEM:
case PNK_DELETESUPERELEM:
return FoldDeleteElement(cx, pn, handler, options, inGenexpLambda);
case PNK_DELETEPROP:
case PNK_DELETESUPERPROP:
return FoldDeleteProperty(cx, pn, handler, options, inGenexpLambda);
case PNK_NOT:
case PNK_BITNOT:
case PNK_THROW:
case PNK_POS:
case PNK_NEG:
case PNK_PREINCREMENT:
case PNK_POSTINCREMENT:
case PNK_PREDECREMENT:
case PNK_POSTDECREMENT:
case PNK_COMPUTED_NAME:
case PNK_ARRAYPUSH:
case PNK_SPREAD:
case PNK_MUTATEPROTO:
case PNK_EXPORT:
case PNK_SEMI:
case PNK_ASSIGN:
case PNK_ADDASSIGN:
case PNK_SUBASSIGN:
case PNK_BITORASSIGN:
case PNK_BITXORASSIGN:
case PNK_BITANDASSIGN:
case PNK_LSHASSIGN:
case PNK_RSHASSIGN:
case PNK_URSHASSIGN:
case PNK_MULASSIGN:
case PNK_DIVASSIGN:
case PNK_MODASSIGN:
case PNK_ELEM:
case PNK_SUPERELEM:
case PNK_COLON:
case PNK_CASE:
case PNK_SHORTHAND:
case PNK_DOWHILE:
case PNK_WHILE:
case PNK_SWITCH:
case PNK_LETBLOCK:
case PNK_FOR:
case PNK_CLASSMETHOD:
case PNK_WITH:
case PNK_CLASSNAMES:
case PNK_DEFAULT:
case PNK_YIELD_STAR:
case PNK_YIELD:
case PNK_RETURN:
case PNK_IMPORT:
case PNK_EXPORT_FROM:
case PNK_EXPORT_DEFAULT:
case PNK_CONDITIONAL:
case PNK_FORIN:
case PNK_FOROF:
case PNK_FORHEAD:
case PNK_CLASS:
case PNK_IF:
case PNK_TRY:
case PNK_OR:
case PNK_AND:
case PNK_BITOR:
case PNK_BITXOR:
case PNK_BITAND:
case PNK_STRICTEQ:
case PNK_EQ:
case PNK_STRICTNE:
case PNK_NE:
case PNK_LT:
case PNK_LE:
case PNK_GT:
case PNK_GE:
case PNK_INSTANCEOF:
case PNK_IN:
case PNK_LSH:
case PNK_RSH:
case PNK_URSH:
case PNK_ADD:
case PNK_SUB:
case PNK_STAR:
case PNK_DIV:
case PNK_MOD:
case PNK_COMMA:
case PNK_NEW:
case PNK_CALL:
case PNK_GENEXP:
case PNK_ARRAY:
case PNK_STATEMENTLIST:
case PNK_ARGSBODY:
case PNK_ARRAYCOMP:
case PNK_VAR:
case PNK_CONST:
case PNK_LET:
case PNK_GLOBALCONST:
case PNK_OBJECT:
case PNK_CLASSMETHODLIST:
case PNK_TEMPLATE_STRING_LIST:
case PNK_TAGGED_TEMPLATE:
case PNK_EXPORT_SPEC_LIST:
case PNK_IMPORT_SPEC_LIST:
case PNK_CATCHLIST:
case PNK_LABEL:
case PNK_DOT:
case PNK_LEXICALSCOPE:
case PNK_NAME:
case PNK_FUNCTION:
case PNK_CATCH:
case PNK_EXPORT_SPEC:
case PNK_IMPORT_SPEC:
case PNK_CALLSITEOBJ:
break; // for now
case PNK_LIMIT: // invalid sentinel value
MOZ_CRASH("invalid node kind");
}
// First, recursively fold constants on the children of this node.
switch (pn->getArity()) {
case PN_CODE:
@ -653,7 +966,7 @@ Fold(ExclusiveContext* cx, ParseNode** pnp,
// Don't fold a parenthesized call expression. See bug 537673.
ParseNode** listp = &pn->pn_head;
if ((pn->isKind(PNK_CALL) || pn->isKind(PNK_NEW)) && (*listp)->isInParens())
if ((pn->isKind(PNK_CALL) || pn->isKind(PNK_TAGGED_TEMPLATE)) && (*listp)->isInParens())
listp = &(*listp)->pn_next;
for (; *listp; listp = &(*listp)->pn_next) {
@ -728,13 +1041,12 @@ Fold(ExclusiveContext* cx, ParseNode** pnp,
break;
case PN_UNARY:
MOZ_ASSERT(!IsDeleteKind(pn->getKind()),
"should have been handled above");
if (pn->pn_kid) {
SyntacticContext kidsc =
pn->isKind(PNK_NOT)
? SyntacticContext::Condition
: IsDeleteKind(pn->getKind())
? SyntacticContext::Delete
: SyntacticContext::Other;
SyntacticContext kidsc = pn->isKind(PNK_NOT)
? SyntacticContext::Condition
: SyntacticContext::Other;
if (!Fold(cx, &pn->pn_kid, handler, options, inGenexpLambda, kidsc))
return false;
}
@ -1021,6 +1333,8 @@ Fold(ExclusiveContext* cx, ParseNode** pnp,
case PNK_TYPEOFNAME:
case PNK_TYPEOFEXPR:
case PNK_VOID:
MOZ_CRASH("should have been fully handled above");
case PNK_NOT:
case PNK_BITNOT:
case PNK_POS:
@ -1137,6 +1451,7 @@ Fold(ExclusiveContext* cx, ParseNode** pnp,
default:;
}
afterFolding:
if (sc == SyntacticContext::Condition) {
Truthiness t = Boolish(pn);
if (t != Unknown) {

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

@ -5732,7 +5732,7 @@ ICInNativeDoesNotExistCompiler::generateStubCode(MacroAssembler& masm)
masm.loadPtr(Address(ICStubReg, shapeOffset), scratch);
masm.branchTestObjShape(Assembler::NotEqual, protoReg, scratch, &failurePopR0Scratch);
}
masm.addPtr(Imm32(sizeof(size_t)), StackPointer);
masm.addToStackPtr(Imm32(sizeof(size_t)));
// Shape and type checks succeeded, ok to proceed.
masm.moveValue(BooleanValue(false), R0);

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

@ -1019,6 +1019,8 @@ class ICStubCompiler
#elif defined(JS_CODEGEN_MIPS)
MOZ_ASSERT(!regs.has(ICTailCallReg));
MOZ_ASSERT(!regs.has(BaselineSecondScratchReg));
#elif defined(JS_CODEGEN_ARM64)
MOZ_ASSERT(!regs.has(ICTailCallReg));
#endif
regs.take(BaselineFrameReg);
regs.take(ICStubReg);

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

@ -2528,7 +2528,7 @@ namespace JS {
template <typename Outer>
class PropertyDescriptorOperations
{
const JSPropertyDescriptor * desc() const { return static_cast<const Outer*>(this)->extract(); }
const JSPropertyDescriptor* desc() const { return static_cast<const Outer*>(this)->extract(); }
bool has(unsigned bit) const {
MOZ_ASSERT(bit != 0);
@ -2770,17 +2770,12 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations<
namespace js {
template <>
struct GCMethods<JSPropertyDescriptor> {
static JSPropertyDescriptor initial() { return JSPropertyDescriptor(); }
};
template <>
class RootedBase<JSPropertyDescriptor>
: public JS::MutablePropertyDescriptorOperations<JS::Rooted<JSPropertyDescriptor> >
: public JS::MutablePropertyDescriptorOperations<JS::Rooted<JSPropertyDescriptor>>
{
friend class JS::PropertyDescriptorOperations<JS::Rooted<JSPropertyDescriptor> >;
friend class JS::MutablePropertyDescriptorOperations<JS::Rooted<JSPropertyDescriptor> >;
friend class JS::PropertyDescriptorOperations<JS::Rooted<JSPropertyDescriptor>>;
friend class JS::MutablePropertyDescriptorOperations<JS::Rooted<JSPropertyDescriptor>>;
const JSPropertyDescriptor* extract() const {
return static_cast<const JS::Rooted<JSPropertyDescriptor>*>(this)->address();
}
@ -2791,9 +2786,9 @@ class RootedBase<JSPropertyDescriptor>
template <>
class HandleBase<JSPropertyDescriptor>
: public JS::PropertyDescriptorOperations<JS::Handle<JSPropertyDescriptor> >
: public JS::PropertyDescriptorOperations<JS::Handle<JSPropertyDescriptor>>
{
friend class JS::PropertyDescriptorOperations<JS::Handle<JSPropertyDescriptor> >;
friend class JS::PropertyDescriptorOperations<JS::Handle<JSPropertyDescriptor>>;
const JSPropertyDescriptor* extract() const {
return static_cast<const JS::Handle<JSPropertyDescriptor>*>(this)->address();
}
@ -2801,10 +2796,10 @@ class HandleBase<JSPropertyDescriptor>
template <>
class MutableHandleBase<JSPropertyDescriptor>
: public JS::MutablePropertyDescriptorOperations<JS::MutableHandle<JSPropertyDescriptor> >
: public JS::MutablePropertyDescriptorOperations<JS::MutableHandle<JSPropertyDescriptor>>
{
friend class JS::PropertyDescriptorOperations<JS::MutableHandle<JSPropertyDescriptor> >;
friend class JS::MutablePropertyDescriptorOperations<JS::MutableHandle<JSPropertyDescriptor> >;
friend class JS::PropertyDescriptorOperations<JS::MutableHandle<JSPropertyDescriptor>>;
friend class JS::MutablePropertyDescriptorOperations<JS::MutableHandle<JSPropertyDescriptor>>;
const JSPropertyDescriptor* extract() const {
return static_cast<const JS::MutableHandle<JSPropertyDescriptor>*>(this)->address();
}

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

@ -0,0 +1,28 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
//-----------------------------------------------------------------------------
var BUGNUMBER = 1182373;
var summary =
"Don't let constant-folding in the MemberExpression part of a tagged " +
"template cause an incorrect |this| be passed to the callee";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var prop = "global";
var obj = { prop: "obj", f: function() { return this.prop; } };
assertEq(obj.f``, "obj");
assertEq((true ? obj.f : null)``, "global");
/******************************************************************************/
if (typeof reportCompare === "function")
reportCompare(true, true);
print("Tests complete");

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

@ -7,7 +7,6 @@
EXPORTS += [
'nsAXPCNativeCallContext.h',
'nsTArrayHelpers.h',
'SandboxPrivate.h',
'xpc_map_end.h',
]

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

@ -15,8 +15,6 @@
#include "js/RootingAPI.h"
// This interface is public only because it is used in jsd.
// Once jsd is gone this file should be moved back to xpconnect/src.
class SandboxPrivate : public nsIGlobalObject,
public nsIScriptObjectPrincipal,

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

@ -343,7 +343,7 @@ private:
uint32_t count = GetChildCount();
mFlags.mHasHashedFrames = 1;
uint32_t minLength = std::max(kMinChildCountForHashtable,
uint32_t(PL_DHASH_DEFAULT_INITIAL_LENGTH));
uint32_t(PLDHashTable::kDefaultInitialLength));
mFrames = new nsTHashtable< nsPtrHashKey<nsIFrame> >(std::max(count, minLength));
for (nsIFrame* f = mFirstChild; count-- > 0; f = f->GetNextSibling()) {
mFrames->PutEntry(f);

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

@ -28,7 +28,9 @@
* does not have <atomic>. So be sure to check for <atomic> support
* along with C++0x support.
*/
#if defined(__clang__) || defined(__GNUC__)
#if defined(_MSC_VER)
# define MOZ_HAVE_CXX11_ATOMICS
#elif defined(__clang__) || defined(__GNUC__)
/*
* Clang doesn't like <atomic> from libstdc++ before 4.7 due to the
* loose typing of the atomic builtins. GCC 4.5 and 4.6 lacks inline
@ -42,8 +44,6 @@
# elif MOZ_USING_LIBCXX && defined(__clang__)
# define MOZ_HAVE_CXX11_ATOMICS
# endif
#elif defined(_MSC_VER)
# define MOZ_HAVE_CXX11_ATOMICS
#endif
namespace mozilla {

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

@ -289,7 +289,6 @@ pref("media.decoder.heuristic.dormant.enabled", true);
pref("media.decoder.heuristic.dormant.timeout", 60000);
#ifdef MOZ_WMF
pref("media.windows-media-foundation.enabled", true);
pref("media.wmf.decoder.thread-count", -1);
#endif
#ifdef MOZ_DIRECTSHOW

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

@ -19,7 +19,7 @@ enum ReferrerPolicy {
/* spec tokens: default no-referrer-when-downgrade */
RP_No_Referrer_When_Downgrade = nsIHttpChannel::REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE,
RP_Default = nsIHttpChannel::REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE,
RP_Default = nsIHttpChannel::REFERRER_POLICY_DEFAULT,
/* spec tokens: origin-when-cross-origin */
RP_Origin_When_Crossorigin = nsIHttpChannel::REFERRER_POLICY_ORIGIN_WHEN_XORIGIN,
@ -31,28 +31,47 @@ enum ReferrerPolicy {
RP_Unset = nsIHttpChannel::REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE
};
/* spec tokens: never no-referrer */
const char kRPS_Never[] = "never";
const char kRPS_No_Referrer[] = "no-referrer";
/* spec tokens: origin */
const char kRPS_Origin[] = "origin";
/* spec tokens: default no-referrer-when-downgrade */
const char kRPS_Default[] = "default";
const char kRPS_No_Referrer_When_Downgrade[] = "no-referrer-when-downgrade";
/* spec tokens: origin-when-cross-origin */
const char kRPS_Origin_When_Cross_Origin[] = "origin-when-cross-origin";
const char kRPS_Origin_When_Crossorigin[] = "origin-when-crossorigin";
/* spec tokens: always unsafe-url */
const char kRPS_Always[] = "always";
const char kRPS_Unsafe_URL[] = "unsafe-url";
inline ReferrerPolicy
ReferrerPolicyFromString(const nsAString& content)
{
// This is implemented step by step as described in the Referrer Policy
// specification, section 6.4 "Determine token's Policy".
if (content.LowerCaseEqualsLiteral("never") ||
content.LowerCaseEqualsLiteral("no-referrer")) {
if (content.LowerCaseEqualsLiteral(kRPS_Never) ||
content.LowerCaseEqualsLiteral(kRPS_No_Referrer)) {
return RP_No_Referrer;
}
if (content.LowerCaseEqualsLiteral("origin")) {
if (content.LowerCaseEqualsLiteral(kRPS_Origin)) {
return RP_Origin;
}
if (content.LowerCaseEqualsLiteral("default") ||
content.LowerCaseEqualsLiteral("no-referrer-when-downgrade")) {
if (content.LowerCaseEqualsLiteral(kRPS_Default) ||
content.LowerCaseEqualsLiteral(kRPS_No_Referrer_When_Downgrade)) {
return RP_No_Referrer_When_Downgrade;
}
if (content.LowerCaseEqualsLiteral("origin-when-cross-origin") ||
content.LowerCaseEqualsLiteral("origin-when-crossorigin")) {
if (content.LowerCaseEqualsLiteral(kRPS_Origin_When_Cross_Origin) ||
content.LowerCaseEqualsLiteral(kRPS_Origin_When_Crossorigin)) {
return RP_Origin_When_Crossorigin;
}
if (content.LowerCaseEqualsLiteral("always") ||
content.LowerCaseEqualsLiteral("unsafe-url")) {
if (content.LowerCaseEqualsLiteral(kRPS_Always) ||
content.LowerCaseEqualsLiteral(kRPS_Unsafe_URL)) {
return RP_Unsafe_URL;
}
// Spec says if none of the previous match, use No_Referrer.
@ -63,15 +82,42 @@ ReferrerPolicyFromString(const nsAString& content)
inline bool
IsValidReferrerPolicy(const nsAString& content)
{
return content.LowerCaseEqualsLiteral("never")
|| content.LowerCaseEqualsLiteral("no-referrer")
|| content.LowerCaseEqualsLiteral("origin")
|| content.LowerCaseEqualsLiteral("default")
|| content.LowerCaseEqualsLiteral("no-referrer-when-downgrade")
|| content.LowerCaseEqualsLiteral("origin-when-cross-origin")
|| content.LowerCaseEqualsLiteral("origin-when-crossorigin")
|| content.LowerCaseEqualsLiteral("always")
|| content.LowerCaseEqualsLiteral("unsafe-url");
return content.LowerCaseEqualsLiteral(kRPS_Never)
|| content.LowerCaseEqualsLiteral(kRPS_No_Referrer)
|| content.LowerCaseEqualsLiteral(kRPS_Origin)
|| content.LowerCaseEqualsLiteral(kRPS_Default)
|| content.LowerCaseEqualsLiteral(kRPS_No_Referrer_When_Downgrade)
|| content.LowerCaseEqualsLiteral(kRPS_Origin_When_Cross_Origin)
|| content.LowerCaseEqualsLiteral(kRPS_Origin_When_Crossorigin)
|| content.LowerCaseEqualsLiteral(kRPS_Always)
|| content.LowerCaseEqualsLiteral(kRPS_Unsafe_URL);
}
inline bool
IsValidAttributeReferrerPolicy(const nsAString& aContent)
{
// Spec allows only these three policies at the moment
// See bug 1178337
return aContent.LowerCaseEqualsLiteral(kRPS_No_Referrer)
|| aContent.LowerCaseEqualsLiteral(kRPS_Origin)
|| aContent.LowerCaseEqualsLiteral(kRPS_Unsafe_URL);
}
inline ReferrerPolicy
AttributeReferrerPolicyFromString(const nsAString& aContent)
{
// if the referrer attribute string is empty, return RP_Unset
if (aContent.IsEmpty()) {
return RP_Unset;
}
// if the referrer attribute string is not empty and contains a valid
// referrer policy, return the according enum value
if (IsValidAttributeReferrerPolicy(aContent)) {
return ReferrerPolicyFromString(aContent);
}
// in any other case the referrer attribute contains an invalid
// policy value, we thus return RP_No_Referrer
return RP_No_Referrer;
}
} // namespace net

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