Merge inbound to mozilla-central. a=merge

This commit is contained in:
Csoregi Natalia 2018-12-31 17:58:44 +02:00
Родитель c44d7b462d e990c18296
Коммит 0b0e657cc1
61 изменённых файлов: 998 добавлений и 779 удалений

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

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.1.132
Current extension version is: 2.1.145
Taken from upstream commit: d3868e1b
Taken from upstream commit: d8f201ea

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.1.132';
var pdfjsBuild = 'd3868e1b';
var pdfjsVersion = '2.1.145';
var pdfjsBuild = 'd8f201ea';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
@ -235,7 +235,7 @@ Object.defineProperty(exports, "URL", {
return _url_polyfill.URL;
}
});
exports.createObjectURL = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0;
exports.createObjectURL = exports.FormatError = exports.XRefParseException = exports.XRefEntryException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0;
__w_pdfjs_require__(2);
@ -695,6 +695,19 @@ var MissingDataException = function MissingDataExceptionClosure() {
exports.MissingDataException = MissingDataException;
const XRefEntryException = function XRefEntryExceptionClosure() {
function XRefEntryException(msg) {
this.message = msg;
}
XRefEntryException.prototype = new Error();
XRefEntryException.prototype.name = 'XRefEntryException';
XRefEntryException.constructor = XRefEntryException;
return XRefEntryException;
}();
exports.XRefEntryException = XRefEntryException;
var XRefParseException = function XRefParseExceptionClosure() {
function XRefParseException(msg) {
this.message = msg;
@ -5141,7 +5154,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.1.132',
apiVersion: '2.1.145',
source: {
data: source.data,
url: source.url,
@ -6872,9 +6885,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.1.132';
const version = '2.1.145';
exports.version = version;
const build = 'd3868e1b';
const build = 'd8f201ea';
exports.build = build;
/***/ }),
@ -8784,11 +8797,10 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
var name = fontObj.loadedName || 'sans-serif';
var bold = fontObj.black ? '900' : fontObj.bold ? 'bold' : 'normal';
var italic = fontObj.italic ? 'italic' : 'normal';
var typeface = '"' + name + '", ' + fontObj.fallbackName;
var typeface = `"${name}", ${fontObj.fallbackName}`;
var browserFontSize = size < MIN_FONT_SIZE ? MIN_FONT_SIZE : size > MAX_FONT_SIZE ? MAX_FONT_SIZE : size;
this.current.fontSizeScale = size / browserFontSize;
var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface;
this.ctx.font = rule;
this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
},
setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) {
this.current.textRenderingMode = mode;
@ -12344,14 +12356,14 @@ var renderTextLayer = function renderTextLayerClosure() {
if (textDivProperties.canvasWidth !== 0 && width > 0) {
textDivProperties.scale = textDivProperties.canvasWidth / width;
transform = 'scaleX(' + textDivProperties.scale + ')';
transform = `scaleX(${textDivProperties.scale})`;
}
if (textDivProperties.angle !== 0) {
transform = 'rotate(' + textDivProperties.angle + 'deg) ' + transform;
transform = `rotate(${textDivProperties.angle}deg) ${transform}`;
}
if (transform !== '') {
if (transform.length > 0) {
textDivProperties.originalTransform = transform;
textDiv.style.transform = transform;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -56,6 +56,8 @@
background-color: rgb(0, 100, 0);
}
.textLayer ::-moz-selection { background: rgb(0,0,255); }
.textLayer ::selection { background: rgb(0,0,255); }
.textLayer .endOfContent {
@ -1675,6 +1677,7 @@ html[dir='rtl'] .outlineItemToggler::before {
/* TODO: file FF bug to support ::-moz-selection:window-inactive
so we can override the opaque grey background when the window is inactive;
see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */
::-moz-selection { background: rgba(0,0,255,0.3); }
::selection { background: rgba(0,0,255,0.3); }
#errorWrapper {

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

@ -20,7 +20,7 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: version 2.1.132
release: version 2.1.145
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/

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

@ -22,13 +22,13 @@
#include "nsMargin.h"
#include "nsCOMPtr.h"
#include "nsStringFwd.h"
#include "SVGAttrValueWrapper.h"
#include "nsTArrayForwardDeclare.h"
#include "nsAtom.h"
#include "mozilla/AtomArray.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/AtomArray.h"
#include "mozilla/EnumTypeTraits.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/SVGAttrValueWrapper.h"
class nsIDocument;
class nsIURI;

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

@ -108,7 +108,6 @@
#include "nsGlobalWindow.h"
#include "GLContext.h"
#include "GLContextProvider.h"
#include "SVGContentUtils.h"
#include "nsIScreenManager.h"
#include "nsFilterInstance.h"
#include "nsSVGLength2.h"
@ -117,11 +116,12 @@
#include "Units.h"
#include "CanvasUtils.h"
#include "mozilla/CycleCollectedJSRuntime.h"
#include "mozilla/ServoCSSParser.h"
#include "mozilla/ServoStyleSet.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/layers/CanvasClient.h"
#include "mozilla/layers/WebRenderUserData.h"
#include "mozilla/layers/WebRenderCanvasRenderer.h"
#include "mozilla/ServoCSSParser.h"
#undef free // apparently defined by some windows header, clashing with a
// free() method in SkTypes.h

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

@ -329,7 +329,7 @@ void SMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
// (i) Here we sample the timed elements (fetched from the
// SVGAnimationElements) which determine from the active time if the
// element is active and what its simple time etc. is. This information is
// then passed to its time client (nsSMILAnimationFunction).
// then passed to its time client (SMILAnimationFunction).
//
// (ii) During the same loop we also build up a table that contains one
// compositor for each animated attribute and which maps animated elements to
@ -570,7 +570,7 @@ void SMILAnimationController::DoMilestoneSamples() {
// Something's wrong/missing about animation's target; skip this animation
return;
nsSMILAnimationFunction& func = aElement->AnimationFunction();
SMILAnimationFunction& func = aElement->AnimationFunction();
// Only add active animation functions. If there are no active animations
// targeting an attribute, no compositor will be created and any previously

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

@ -4,7 +4,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSMILAnimationFunction.h"
#include "SMILAnimationFunction.h"
#include "mozilla/dom/SVGAnimationElement.h"
#include "mozilla/Move.h"
@ -26,16 +26,18 @@
using namespace mozilla::dom;
namespace mozilla {
//----------------------------------------------------------------------
// Static members
nsAttrValue::EnumTable nsSMILAnimationFunction::sAccumulateTable[] = {
nsAttrValue::EnumTable SMILAnimationFunction::sAccumulateTable[] = {
{"none", false}, {"sum", true}, {nullptr, 0}};
nsAttrValue::EnumTable nsSMILAnimationFunction::sAdditiveTable[] = {
nsAttrValue::EnumTable SMILAnimationFunction::sAdditiveTable[] = {
{"replace", false}, {"sum", true}, {nullptr, 0}};
nsAttrValue::EnumTable nsSMILAnimationFunction::sCalcModeTable[] = {
nsAttrValue::EnumTable SMILAnimationFunction::sCalcModeTable[] = {
{"linear", CALC_LINEAR},
{"discrete", CALC_DISCRETE},
{"paced", CALC_PACED},
@ -49,7 +51,7 @@ nsAttrValue::EnumTable nsSMILAnimationFunction::sCalcModeTable[] = {
//----------------------------------------------------------------------
// Constructors etc.
nsSMILAnimationFunction::nsSMILAnimationFunction()
SMILAnimationFunction::SMILAnimationFunction()
: mSampleTime(-1),
mRepeatIteration(0),
mBeginTime(INT64_MIN),
@ -63,15 +65,14 @@ nsSMILAnimationFunction::nsSMILAnimationFunction()
mPrevSampleWasSingleValueAnimation(false),
mWasSkippedInPrevSample(false) {}
void nsSMILAnimationFunction::SetAnimationElement(
void SMILAnimationFunction::SetAnimationElement(
SVGAnimationElement* aAnimationElement) {
mAnimationElement = aAnimationElement;
}
bool nsSMILAnimationFunction::SetAttr(nsAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult,
nsresult* aParseResult) {
bool SMILAnimationFunction::SetAttr(nsAtom* aAttribute, const nsAString& aValue,
nsAttrValue& aResult,
nsresult* aParseResult) {
bool foundMatch = true;
nsresult parseResult = NS_OK;
@ -106,7 +107,7 @@ bool nsSMILAnimationFunction::SetAttr(nsAtom* aAttribute,
return foundMatch;
}
bool nsSMILAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
bool SMILAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
bool foundMatch = true;
if (aAttribute == nsGkAtoms::by || aAttribute == nsGkAtoms::from ||
@ -129,9 +130,9 @@ bool nsSMILAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
return foundMatch;
}
void nsSMILAnimationFunction::SampleAt(nsSMILTime aSampleTime,
const nsSMILTimeValue& aSimpleDuration,
uint32_t aRepeatIteration) {
void SMILAnimationFunction::SampleAt(nsSMILTime aSampleTime,
const nsSMILTimeValue& aSimpleDuration,
uint32_t aRepeatIteration) {
// * Update mHasChanged ("Might this sample be different from prev one?")
// Were we previously sampling a fill="freeze" final val? (We're not anymore.)
mHasChanged |= mLastValue;
@ -152,7 +153,7 @@ void nsSMILAnimationFunction::SampleAt(nsSMILTime aSampleTime,
mLastValue = false;
}
void nsSMILAnimationFunction::SampleLastValue(uint32_t aRepeatIteration) {
void SMILAnimationFunction::SampleLastValue(uint32_t aRepeatIteration) {
if (mHasChanged || !mLastValue || mRepeatIteration != aRepeatIteration) {
mHasChanged = true;
}
@ -161,21 +162,21 @@ void nsSMILAnimationFunction::SampleLastValue(uint32_t aRepeatIteration) {
mLastValue = true;
}
void nsSMILAnimationFunction::Activate(nsSMILTime aBeginTime) {
void SMILAnimationFunction::Activate(nsSMILTime aBeginTime) {
mBeginTime = aBeginTime;
mIsActive = true;
mIsFrozen = false;
mHasChanged = true;
}
void nsSMILAnimationFunction::Inactivate(bool aIsFrozen) {
void SMILAnimationFunction::Inactivate(bool aIsFrozen) {
mIsActive = false;
mIsFrozen = aIsFrozen;
mHasChanged = true;
}
void nsSMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
nsSMILValue& aResult) {
void SMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
nsSMILValue& aResult) {
mHasChanged = false;
mPrevSampleWasSingleValueAnimation = false;
mWasSkippedInPrevSample = false;
@ -237,8 +238,8 @@ void nsSMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
}
}
int8_t nsSMILAnimationFunction::CompareTo(
const nsSMILAnimationFunction* aOther) const {
int8_t SMILAnimationFunction::CompareTo(
const SMILAnimationFunction* aOther) const {
NS_ENSURE_TRUE(aOther, 0);
NS_ASSERTION(aOther != this, "Trying to compare to self");
@ -272,7 +273,7 @@ int8_t nsSMILAnimationFunction::CompareTo(
: 1;
}
bool nsSMILAnimationFunction::WillReplace() const {
bool SMILAnimationFunction::WillReplace() const {
/*
* In IsAdditive() we don't consider to-animation to be additive as it is
* a special case that is dealt with differently in the compositing method.
@ -282,11 +283,11 @@ bool nsSMILAnimationFunction::WillReplace() const {
return !mErrorFlags && !(IsAdditive() || IsToAnimation());
}
bool nsSMILAnimationFunction::HasChanged() const {
bool SMILAnimationFunction::HasChanged() const {
return mHasChanged || mValueNeedsReparsingEverySample;
}
bool nsSMILAnimationFunction::UpdateCachedTarget(
bool SMILAnimationFunction::UpdateCachedTarget(
const nsSMILTargetIdentifier& aNewTarget) {
if (!mLastTarget.Equals(aNewTarget)) {
mLastTarget = aNewTarget;
@ -298,7 +299,7 @@ bool nsSMILAnimationFunction::UpdateCachedTarget(
//----------------------------------------------------------------------
// Implementation helpers
nsresult nsSMILAnimationFunction::InterpolateResult(
nsresult SMILAnimationFunction::InterpolateResult(
const nsSMILValueArray& aValues, nsSMILValue& aResult,
nsSMILValue& aBaseValue) {
// Sanity check animation values
@ -452,7 +453,7 @@ nsresult nsSMILAnimationFunction::InterpolateResult(
return rv;
}
nsresult nsSMILAnimationFunction::AccumulateResult(
nsresult SMILAnimationFunction::AccumulateResult(
const nsSMILValueArray& aValues, nsSMILValue& aResult) {
if (!IsToAnimation() && GetAccumulate() && mRepeatIteration) {
const nsSMILValue& lastValue = aValues[aValues.Length() - 1];
@ -475,7 +476,7 @@ nsresult nsSMILAnimationFunction::AccumulateResult(
* Returns NS_OK, or NS_ERROR_FAILURE if our values don't support distance
* computation.
*/
nsresult nsSMILAnimationFunction::ComputePacedPosition(
nsresult SMILAnimationFunction::ComputePacedPosition(
const nsSMILValueArray& aValues, double aSimpleProgress,
double& aIntervalProgress, const nsSMILValue*& aFrom,
const nsSMILValue*& aTo) {
@ -568,7 +569,7 @@ nsresult nsSMILAnimationFunction::ComputePacedPosition(
* Returns the total distance, or returns COMPUTE_DISTANCE_ERROR if
* our values don't support distance computation.
*/
double nsSMILAnimationFunction::ComputePacedTotalDistance(
double SMILAnimationFunction::ComputePacedTotalDistance(
const nsSMILValueArray& aValues) const {
NS_ASSERTION(GetCalcMode() == CALC_PACED,
"Calling paced-specific function, but not in paced mode");
@ -592,8 +593,8 @@ double nsSMILAnimationFunction::ComputePacedTotalDistance(
return totalDistance;
}
double nsSMILAnimationFunction::ScaleSimpleProgress(double aProgress,
nsSMILCalcMode aCalcMode) {
double SMILAnimationFunction::ScaleSimpleProgress(double aProgress,
nsSMILCalcMode aCalcMode) {
if (!HasAttr(nsGkAtoms::keyTimes)) return aProgress;
uint32_t numTimes = mKeyTimes.Length();
@ -628,8 +629,8 @@ double nsSMILAnimationFunction::ScaleSimpleProgress(double aProgress,
double(numTimes - 1);
}
double nsSMILAnimationFunction::ScaleIntervalProgress(double aProgress,
uint32_t aIntervalIndex) {
double SMILAnimationFunction::ScaleIntervalProgress(double aProgress,
uint32_t aIntervalIndex) {
if (GetCalcMode() != CALC_SPLINE) return aProgress;
if (!HasAttr(nsGkAtoms::keySplines)) return aProgress;
@ -640,16 +641,16 @@ double nsSMILAnimationFunction::ScaleIntervalProgress(double aProgress,
return spline.GetSplineValue(aProgress);
}
bool nsSMILAnimationFunction::HasAttr(nsAtom* aAttName) const {
bool SMILAnimationFunction::HasAttr(nsAtom* aAttName) const {
return mAnimationElement->HasAttr(aAttName);
}
const nsAttrValue* nsSMILAnimationFunction::GetAttr(nsAtom* aAttName) const {
const nsAttrValue* SMILAnimationFunction::GetAttr(nsAtom* aAttName) const {
return mAnimationElement->GetParsedAttr(aAttName);
}
bool nsSMILAnimationFunction::GetAttr(nsAtom* aAttName,
nsAString& aResult) const {
bool SMILAnimationFunction::GetAttr(nsAtom* aAttName,
nsAString& aResult) const {
return mAnimationElement->GetAttr(aAttName, aResult);
}
@ -669,10 +670,10 @@ bool nsSMILAnimationFunction::GetAttr(nsAtom* aAttName,
*
* Returns false if a parse error occurred, otherwise returns true.
*/
bool nsSMILAnimationFunction::ParseAttr(nsAtom* aAttName,
const nsISMILAttr& aSMILAttr,
nsSMILValue& aResult,
bool& aPreventCachingOfSandwich) const {
bool SMILAnimationFunction::ParseAttr(nsAtom* aAttName,
const nsISMILAttr& aSMILAttr,
nsSMILValue& aResult,
bool& aPreventCachingOfSandwich) const {
nsAutoString attValue;
if (GetAttr(aAttName, attValue)) {
bool preventCachingOfSandwich = false;
@ -701,8 +702,8 @@ bool nsSMILAnimationFunction::ParseAttr(nsAtom* aAttName,
* This helper method applies these rules to fill in the values list and to set
* some internal state.
*/
nsresult nsSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
nsSMILValueArray& aResult) {
nsresult SMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
nsSMILValueArray& aResult) {
if (!mAnimationElement) return NS_ERROR_FAILURE;
mValueNeedsReparsingEverySample = false;
@ -737,26 +738,26 @@ nsresult nsSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
mValueNeedsReparsingEverySample = true;
}
if (!parseOk || !result.SetCapacity(2, mozilla::fallible)) {
if (!parseOk || !result.SetCapacity(2, fallible)) {
return NS_ERROR_FAILURE;
}
// AppendElement() below must succeed, because SetCapacity() succeeded.
if (!to.IsNull()) {
if (!from.IsNull()) {
MOZ_ALWAYS_TRUE(result.AppendElement(from, mozilla::fallible));
MOZ_ALWAYS_TRUE(result.AppendElement(to, mozilla::fallible));
MOZ_ALWAYS_TRUE(result.AppendElement(from, fallible));
MOZ_ALWAYS_TRUE(result.AppendElement(to, fallible));
} else {
MOZ_ALWAYS_TRUE(result.AppendElement(to, mozilla::fallible));
MOZ_ALWAYS_TRUE(result.AppendElement(to, fallible));
}
} else if (!by.IsNull()) {
nsSMILValue effectiveFrom(by.mType);
if (!from.IsNull()) effectiveFrom = from;
// Set values to 'from; from + by'
MOZ_ALWAYS_TRUE(result.AppendElement(effectiveFrom, mozilla::fallible));
MOZ_ALWAYS_TRUE(result.AppendElement(effectiveFrom, fallible));
nsSMILValue effectiveTo(effectiveFrom);
if (!effectiveTo.IsNull() && NS_SUCCEEDED(effectiveTo.Add(by))) {
MOZ_ALWAYS_TRUE(result.AppendElement(effectiveTo, mozilla::fallible));
MOZ_ALWAYS_TRUE(result.AppendElement(effectiveTo, fallible));
} else {
// Using by-animation with non-additive type or bad base-value
return NS_ERROR_FAILURE;
@ -772,8 +773,7 @@ nsresult nsSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
return NS_OK;
}
void nsSMILAnimationFunction::CheckValueListDependentAttrs(
uint32_t aNumValues) {
void SMILAnimationFunction::CheckValueListDependentAttrs(uint32_t aNumValues) {
CheckKeyTimes(aNumValues);
CheckKeySplines(aNumValues);
}
@ -783,7 +783,7 @@ void nsSMILAnimationFunction::CheckValueListDependentAttrs(
* which depend on other attributes and therefore needs to be updated as
* dependent attributes are set.
*/
void nsSMILAnimationFunction::CheckKeyTimes(uint32_t aNumValues) {
void SMILAnimationFunction::CheckKeyTimes(uint32_t aNumValues) {
if (!HasAttr(nsGkAtoms::keyTimes)) return;
nsSMILCalcMode calcMode = GetCalcMode();
@ -825,7 +825,7 @@ void nsSMILAnimationFunction::CheckKeyTimes(uint32_t aNumValues) {
SetKeyTimesErrorFlag(false);
}
void nsSMILAnimationFunction::CheckKeySplines(uint32_t aNumValues) {
void SMILAnimationFunction::CheckKeySplines(uint32_t aNumValues) {
// attribute is ignored if calc mode is not spline
if (GetCalcMode() != CALC_SPLINE) {
SetKeySplinesErrorFlag(false);
@ -861,7 +861,7 @@ void nsSMILAnimationFunction::CheckKeySplines(uint32_t aNumValues) {
SetKeySplinesErrorFlag(false);
}
bool nsSMILAnimationFunction::IsValueFixedForSimpleDuration() const {
bool SMILAnimationFunction::IsValueFixedForSimpleDuration() const {
return mSimpleDuration.IsIndefinite() ||
(!mHasChanged && mPrevSampleWasSingleValueAnimation);
}
@ -869,21 +869,21 @@ bool nsSMILAnimationFunction::IsValueFixedForSimpleDuration() const {
//----------------------------------------------------------------------
// Property getters
bool nsSMILAnimationFunction::GetAccumulate() const {
bool SMILAnimationFunction::GetAccumulate() const {
const nsAttrValue* value = GetAttr(nsGkAtoms::accumulate);
if (!value) return false;
return value->GetEnumValue();
}
bool nsSMILAnimationFunction::GetAdditive() const {
bool SMILAnimationFunction::GetAdditive() const {
const nsAttrValue* value = GetAttr(nsGkAtoms::additive);
if (!value) return false;
return value->GetEnumValue();
}
nsSMILAnimationFunction::nsSMILCalcMode nsSMILAnimationFunction::GetCalcMode()
SMILAnimationFunction::nsSMILCalcMode SMILAnimationFunction::GetCalcMode()
const {
const nsAttrValue* value = GetAttr(nsGkAtoms::calcMode);
if (!value) return CALC_LINEAR;
@ -894,8 +894,8 @@ nsSMILAnimationFunction::nsSMILCalcMode nsSMILAnimationFunction::GetCalcMode()
//----------------------------------------------------------------------
// Property setters / un-setters:
nsresult nsSMILAnimationFunction::SetAccumulate(const nsAString& aAccumulate,
nsAttrValue& aResult) {
nsresult SMILAnimationFunction::SetAccumulate(const nsAString& aAccumulate,
nsAttrValue& aResult) {
mHasChanged = true;
bool parseResult =
aResult.ParseEnumValue(aAccumulate, sAccumulateTable, true);
@ -903,39 +903,39 @@ nsresult nsSMILAnimationFunction::SetAccumulate(const nsAString& aAccumulate,
return parseResult ? NS_OK : NS_ERROR_FAILURE;
}
void nsSMILAnimationFunction::UnsetAccumulate() {
void SMILAnimationFunction::UnsetAccumulate() {
SetAccumulateErrorFlag(false);
mHasChanged = true;
}
nsresult nsSMILAnimationFunction::SetAdditive(const nsAString& aAdditive,
nsAttrValue& aResult) {
nsresult SMILAnimationFunction::SetAdditive(const nsAString& aAdditive,
nsAttrValue& aResult) {
mHasChanged = true;
bool parseResult = aResult.ParseEnumValue(aAdditive, sAdditiveTable, true);
SetAdditiveErrorFlag(!parseResult);
return parseResult ? NS_OK : NS_ERROR_FAILURE;
}
void nsSMILAnimationFunction::UnsetAdditive() {
void SMILAnimationFunction::UnsetAdditive() {
SetAdditiveErrorFlag(false);
mHasChanged = true;
}
nsresult nsSMILAnimationFunction::SetCalcMode(const nsAString& aCalcMode,
nsAttrValue& aResult) {
nsresult SMILAnimationFunction::SetCalcMode(const nsAString& aCalcMode,
nsAttrValue& aResult) {
mHasChanged = true;
bool parseResult = aResult.ParseEnumValue(aCalcMode, sCalcModeTable, true);
SetCalcModeErrorFlag(!parseResult);
return parseResult ? NS_OK : NS_ERROR_FAILURE;
}
void nsSMILAnimationFunction::UnsetCalcMode() {
void SMILAnimationFunction::UnsetCalcMode() {
SetCalcModeErrorFlag(false);
mHasChanged = true;
}
nsresult nsSMILAnimationFunction::SetKeySplines(const nsAString& aKeySplines,
nsAttrValue& aResult) {
nsresult SMILAnimationFunction::SetKeySplines(const nsAString& aKeySplines,
nsAttrValue& aResult) {
mKeySplines.Clear();
aResult.SetTo(aKeySplines);
@ -949,14 +949,14 @@ nsresult nsSMILAnimationFunction::SetKeySplines(const nsAString& aKeySplines,
return NS_OK;
}
void nsSMILAnimationFunction::UnsetKeySplines() {
void SMILAnimationFunction::UnsetKeySplines() {
mKeySplines.Clear();
SetKeySplinesErrorFlag(false);
mHasChanged = true;
}
nsresult nsSMILAnimationFunction::SetKeyTimes(const nsAString& aKeyTimes,
nsAttrValue& aResult) {
nsresult SMILAnimationFunction::SetKeyTimes(const nsAString& aKeyTimes,
nsAttrValue& aResult) {
mKeyTimes.Clear();
aResult.SetTo(aKeyTimes);
@ -971,8 +971,10 @@ nsresult nsSMILAnimationFunction::SetKeyTimes(const nsAString& aKeyTimes,
return NS_OK;
}
void nsSMILAnimationFunction::UnsetKeyTimes() {
void SMILAnimationFunction::UnsetKeyTimes() {
mKeyTimes.Clear();
SetKeyTimesErrorFlag(false);
mHasChanged = true;
}
} // namespace mozilla

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

@ -22,10 +22,9 @@ namespace mozilla {
namespace dom {
class SVGAnimationElement;
} // namespace dom
} // namespace mozilla
//----------------------------------------------------------------------
// nsSMILAnimationFunction
// SMILAnimationFunction
//
// The animation function calculates animation values. It it is provided with
// time parameters (sample time, repeat iteration etc.) and it uses this to
@ -36,9 +35,9 @@ class SVGAnimationElement;
// element (e.g. from, by, to, values, calcMode, additive, accumulate, keyTimes,
// keySplines)
//
class nsSMILAnimationFunction {
class SMILAnimationFunction {
public:
nsSMILAnimationFunction();
SMILAnimationFunction();
/*
* Sets the owning animation element which this class uses to query attribute
@ -138,7 +137,7 @@ class nsSMILAnimationFunction {
*
* This method should never return any other value, including 0.
*/
int8_t CompareTo(const nsSMILAnimationFunction* aOther) const;
int8_t CompareTo(const SMILAnimationFunction* aOther) const;
/*
* The following methods are provided so that the compositor can optimize its
@ -244,15 +243,15 @@ class nsSMILAnimationFunction {
return mValueNeedsReparsingEverySample;
}
// Comparator utility class, used for sorting nsSMILAnimationFunctions
// Comparator utility class, used for sorting SMILAnimationFunctions
class Comparator {
public:
bool Equals(const nsSMILAnimationFunction* aElem1,
const nsSMILAnimationFunction* aElem2) const {
bool Equals(const SMILAnimationFunction* aElem1,
const SMILAnimationFunction* aElem2) const {
return (aElem1->CompareTo(aElem2) == 0);
}
bool LessThan(const nsSMILAnimationFunction* aElem1,
const nsSMILAnimationFunction* aElem2) const {
bool LessThan(const SMILAnimationFunction* aElem1,
const SMILAnimationFunction* aElem2) const {
return (aElem1->CompareTo(aElem2) < 0);
}
};
@ -269,7 +268,7 @@ class nsSMILAnimationFunction {
CALC_SPLINE
};
// Used for sorting nsSMILAnimationFunctions
// Used for sorting SMILAnimationFunctions
nsSMILTime GetBeginTime() const { return mBeginTime; }
// Property getters
@ -417,7 +416,7 @@ class nsSMILAnimationFunction {
// The owning animation element. This is used for sorting based on document
// position and for fetching attribute values stored in the element.
// Raw pointer is OK here, because this nsSMILAnimationFunction can't outlive
// Raw pointer is OK here, because this SMILAnimationFunction can't outlive
// its owning animation element.
mozilla::dom::SVGAnimationElement* mAnimationElement;
@ -441,4 +440,6 @@ class nsSMILAnimationFunction {
bool mWasSkippedInPrevSample : 1;
};
} // namespace mozilla
#endif // NS_SMILANIMATIONFUNCTION_H_

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

@ -4,9 +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/. */
#include "nsSMILSetAnimationFunction.h"
#include "SMILSetAnimationFunction.h"
inline bool nsSMILSetAnimationFunction::IsDisallowedAttribute(
namespace mozilla {
inline bool SMILSetAnimationFunction::IsDisallowedAttribute(
const nsAtom* aAttribute) const {
//
// A <set> element is similar to <animate> but lacks:
@ -25,10 +27,10 @@ inline bool nsSMILSetAnimationFunction::IsDisallowedAttribute(
return false;
}
bool nsSMILSetAnimationFunction::SetAttr(nsAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult,
nsresult* aParseResult) {
bool SMILSetAnimationFunction::SetAttr(nsAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult,
nsresult* aParseResult) {
if (IsDisallowedAttribute(aAttribute)) {
aResult.SetTo(aValue);
if (aParseResult) {
@ -45,35 +47,37 @@ bool nsSMILSetAnimationFunction::SetAttr(nsAtom* aAttribute,
return true;
}
return nsSMILAnimationFunction::SetAttr(aAttribute, aValue, aResult,
aParseResult);
return SMILAnimationFunction::SetAttr(aAttribute, aValue, aResult,
aParseResult);
}
bool nsSMILSetAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
bool SMILSetAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
if (IsDisallowedAttribute(aAttribute)) {
return true;
}
return nsSMILAnimationFunction::UnsetAttr(aAttribute);
return SMILAnimationFunction::UnsetAttr(aAttribute);
}
bool nsSMILSetAnimationFunction::HasAttr(nsAtom* aAttName) const {
bool SMILSetAnimationFunction::HasAttr(nsAtom* aAttName) const {
if (IsDisallowedAttribute(aAttName)) return false;
return nsSMILAnimationFunction::HasAttr(aAttName);
return SMILAnimationFunction::HasAttr(aAttName);
}
const nsAttrValue* nsSMILSetAnimationFunction::GetAttr(nsAtom* aAttName) const {
const nsAttrValue* SMILSetAnimationFunction::GetAttr(nsAtom* aAttName) const {
if (IsDisallowedAttribute(aAttName)) return nullptr;
return nsSMILAnimationFunction::GetAttr(aAttName);
return SMILAnimationFunction::GetAttr(aAttName);
}
bool nsSMILSetAnimationFunction::GetAttr(nsAtom* aAttName,
nsAString& aResult) const {
bool SMILSetAnimationFunction::GetAttr(nsAtom* aAttName,
nsAString& aResult) const {
if (IsDisallowedAttribute(aAttName)) return false;
return nsSMILAnimationFunction::GetAttr(aAttName, aResult);
return SMILAnimationFunction::GetAttr(aAttName, aResult);
}
bool nsSMILSetAnimationFunction::WillReplace() const { return true; }
bool SMILSetAnimationFunction::WillReplace() const { return true; }
} // namespace mozilla

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

@ -8,15 +8,17 @@
#define NS_SMILSETANIMATIONFUNCTION_H_
#include "mozilla/Attributes.h"
#include "nsSMILAnimationFunction.h"
#include "mozilla/SMILAnimationFunction.h"
namespace mozilla {
//----------------------------------------------------------------------
// nsSMILSetAnimationFunction
// SMILSetAnimationFunction
//
// Subclass of nsSMILAnimationFunction that limits the behaviour to that offered
// Subclass of SMILAnimationFunction that limits the behaviour to that offered
// by a <set> element.
//
class nsSMILSetAnimationFunction : public nsSMILAnimationFunction {
class SMILSetAnimationFunction : public SMILAnimationFunction {
public:
/*
* Sets animation-specific attributes (or marks them dirty, in the case
@ -60,4 +62,6 @@ class nsSMILSetAnimationFunction : public nsSMILAnimationFunction {
bool IsDisallowedAttribute(const nsAtom* aAttribute) const;
};
} // namespace mozilla
#endif // NS_SMILSETANIMATIONFUNCTION_H_

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

@ -11,7 +11,6 @@ MOCHITEST_MANIFESTS += ['test/mochitest.ini']
EXPORTS += [
'nsISMILAttr.h',
'nsSMILAnimationFunction.h',
'nsSMILCompositorTable.h',
'nsSMILCSSProperty.h',
'nsSMILInstanceTime.h',
@ -19,7 +18,6 @@ EXPORTS += [
'nsSMILKeySpline.h',
'nsSMILMilestone.h',
'nsSMILRepeatCount.h',
'nsSMILSetAnimationFunction.h',
'nsSMILTargetIdentifier.h',
'nsSMILTimeContainer.h',
'nsSMILTimedElement.h',
@ -35,6 +33,8 @@ EXPORTS += [
EXPORTS.mozilla += [
'SMILAnimationController.h',
'SMILAnimationFunction.h',
'SMILSetAnimationFunction.h',
]
EXPORTS.mozilla.dom += [
@ -42,7 +42,6 @@ EXPORTS.mozilla.dom += [
]
UNIFIED_SOURCES += [
'nsSMILAnimationFunction.cpp',
'nsSMILCompositor.cpp',
'nsSMILCSSProperty.cpp',
'nsSMILInstanceTime.cpp',
@ -50,19 +49,20 @@ UNIFIED_SOURCES += [
'nsSMILKeySpline.cpp',
'nsSMILParserUtils.cpp',
'nsSMILRepeatCount.cpp',
'nsSMILSetAnimationFunction.cpp',
'nsSMILTimeContainer.cpp',
'nsSMILTimedElement.cpp',
'nsSMILTimeValue.cpp',
'nsSMILTimeValueSpec.cpp',
'nsSMILValue.cpp',
'SMILAnimationController.cpp',
'SMILAnimationFunction.cpp',
'SMILBoolType.cpp',
'SMILCSSValueType.cpp',
'SMILEnumType.cpp',
'SMILFloatType.cpp',
'SMILIntegerType.cpp',
'SMILNullType.cpp',
'SMILSetAnimationFunction.cpp',
'SMILStringType.cpp',
'TimeEvent.cpp',
]

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

@ -34,7 +34,7 @@ void nsSMILCompositor::Traverse(nsCycleCollectionTraversalCallback* aCallback) {
}
// Other methods
void nsSMILCompositor::AddAnimationFunction(nsSMILAnimationFunction* aFunc) {
void nsSMILCompositor::AddAnimationFunction(SMILAnimationFunction* aFunc) {
if (aFunc) {
mAnimationFunctions.AppendElement(aFunc);
}
@ -68,7 +68,7 @@ void nsSMILCompositor::ComposeAttribute(bool& aMightHavePendingStyleUpdates) {
}
// SECOND: Sort the animationFunctions, to prepare for compositing.
nsSMILAnimationFunction::Comparator comparator;
SMILAnimationFunction::Comparator comparator;
mAnimationFunctions.Sort(comparator);
// THIRD: Step backwards through animation functions to find out
@ -169,7 +169,7 @@ bool nsSMILCompositor::MightNeedBaseStyle() const {
// We should return true if at least one animation function might build on
// the base value.
for (const nsSMILAnimationFunction* func : mAnimationFunctions) {
for (const SMILAnimationFunction* func : mAnimationFunctions) {
if (!func->WillReplace()) {
return true;
}
@ -193,7 +193,7 @@ uint32_t nsSMILCompositor::GetFirstFuncToAffectSandwich() {
uint32_t i;
for (i = mAnimationFunctions.Length(); i > 0; --i) {
nsSMILAnimationFunction* curAnimFunc = mAnimationFunctions[i - 1];
SMILAnimationFunction* curAnimFunc = mAnimationFunctions[i - 1];
// In the following, the lack of short-circuit behavior of |= means that we
// will ALWAYS run UpdateCachedTarget (even if mForceCompositing is true)
// but only call HasChanged and WasSkippedInPrevSample if necessary. This

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

@ -11,7 +11,7 @@
#include "mozilla/UniquePtr.h"
#include "nsTHashtable.h"
#include "nsString.h"
#include "nsSMILAnimationFunction.h"
#include "SMILAnimationFunction.h"
#include "nsSMILTargetIdentifier.h"
#include "nsSMILCompositorTable.h"
#include "PLDHashTable.h"
@ -46,7 +46,7 @@ class nsSMILCompositor : public PLDHashEntryHdr {
enum { ALLOW_MEMMOVE = false };
// Adds the given animation function to this Compositor's list of functions
void AddAnimationFunction(nsSMILAnimationFunction* aFunc);
void AddAnimationFunction(mozilla::SMILAnimationFunction* aFunc);
// Composes the attribute's current value with the list of animation
// functions, and assigns the resulting value to this compositor's target
@ -104,7 +104,7 @@ class nsSMILCompositor : public PLDHashEntryHdr {
KeyType mKey;
// Hash Value: List of animation functions that animate the specified attr
nsTArray<nsSMILAnimationFunction*> mAnimationFunctions;
nsTArray<mozilla::SMILAnimationFunction*> mAnimationFunctions;
// Member data for detecting when we need to force-recompose
// ---------------------------------------------------------

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSMILParserUtils.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/TextUtils.h"
#include "nsSMILKeySpline.h"
#include "nsISMILAttr.h"
@ -15,7 +16,6 @@
#include "nsSMILRepeatCount.h"
#include "nsContentUtils.h"
#include "nsCharSeparatedTokenizer.h"
#include "SVGContentUtils.h"
using namespace mozilla;
using namespace mozilla::dom;

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

@ -12,7 +12,7 @@
#include "mozilla/TaskCategory.h"
#include "nsSMILTimedElement.h"
#include "nsAttrValueInlines.h"
#include "nsSMILAnimationFunction.h"
#include "SMILAnimationFunction.h"
#include "nsSMILTimeValue.h"
#include "nsSMILTimeValueSpec.h"
#include "nsSMILInstanceTime.h"
@ -449,7 +449,7 @@ void nsSMILTimedElement::RemoveInstanceTimesForCreator(
UpdateCurrentInterval();
}
void nsSMILTimedElement::SetTimeClient(nsSMILAnimationFunction* aClient) {
void nsSMILTimedElement::SetTimeClient(SMILAnimationFunction* aClient) {
//
// No need to check for nullptr. A nullptr parameter simply means to remove
// the previous client which we do by setting to nullptr anyway.

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

@ -22,12 +22,12 @@
#include "nsAutoPtr.h"
#include "nsAttrValue.h"
class nsSMILAnimationFunction;
class nsSMILTimeContainer;
class nsSMILTimeValue;
class nsAtom;
namespace mozilla {
class SMILAnimationFunction;
namespace dom {
class SVGAnimationElement;
} // namespace dom
@ -42,6 +42,7 @@ class nsSMILTimedElement {
~nsSMILTimedElement();
typedef mozilla::dom::Element Element;
typedef mozilla::SMILAnimationFunction SMILAnimationFunction;
/*
* Sets the owning animation element which this class uses to convert between
@ -194,7 +195,7 @@ class nsSMILTimedElement {
* to nullptr will simply disassociate the previous client,
* if any.
*/
void SetTimeClient(nsSMILAnimationFunction* aClient);
void SetTimeClient(SMILAnimationFunction* aClient);
/**
* Samples the object at the given container time. Timing intervals are
@ -580,7 +581,7 @@ class nsSMILTimedElement {
InstanceTimeList mEndInstances;
uint32_t mInstanceSerialIndex;
nsSMILAnimationFunction* mClient;
SMILAnimationFunction* mClient;
mozilla::UniquePtr<nsSMILInterval> mCurrentInterval;
IntervalList mOldIntervals;
uint32_t mCurrentRepeatIteration;

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

@ -31,7 +31,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateElement)
//----------------------------------------------------------------------
nsSMILAnimationFunction& SVGAnimateElement::AnimationFunction() {
SMILAnimationFunction& SVGAnimateElement::AnimationFunction() {
return mAnimationFunction;
}

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

@ -9,7 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/SVGAnimationElement.h"
#include "nsSMILAnimationFunction.h"
#include "mozilla/SMILAnimationFunction.h"
nsresult NS_NewSVGAnimateElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -22,7 +22,7 @@ class SVGAnimateElement final : public SVGAnimationElement {
explicit SVGAnimateElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
nsSMILAnimationFunction mAnimationFunction;
SMILAnimationFunction mAnimationFunction;
friend nsresult(::NS_NewSVGAnimateElement(
nsIContent** aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
@ -35,7 +35,7 @@ class SVGAnimateElement final : public SVGAnimationElement {
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
// SVGAnimationElement
virtual nsSMILAnimationFunction& AnimationFunction() override;
virtual SMILAnimationFunction& AnimationFunction() override;
};
} // namespace dom

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

@ -31,7 +31,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateMotionElement)
//----------------------------------------------------------------------
nsSMILAnimationFunction& SVGAnimateMotionElement::AnimationFunction() {
SMILAnimationFunction& SVGAnimateMotionElement::AnimationFunction() {
return mAnimationFunction;
}

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

@ -35,7 +35,7 @@ class SVGAnimateMotionElement final : public SVGAnimationElement {
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
// SVGAnimationElement
virtual nsSMILAnimationFunction& AnimationFunction() override;
virtual SMILAnimationFunction& AnimationFunction() override;
virtual bool GetTargetAttributeName(int32_t* aNamespaceID,
nsAtom** aLocalName) const override;

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

@ -51,7 +51,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateTransformElement)
//----------------------------------------------------------------------
nsSMILAnimationFunction& SVGAnimateTransformElement::AnimationFunction() {
SMILAnimationFunction& SVGAnimateTransformElement::AnimationFunction() {
return mAnimationFunction;
}

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

@ -9,7 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/SVGAnimationElement.h"
#include "nsSMILAnimationFunction.h"
#include "mozilla/SMILAnimationFunction.h"
nsresult NS_NewSVGAnimateTransformElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -22,7 +22,7 @@ class SVGAnimateTransformElement final : public SVGAnimationElement {
explicit SVGAnimateTransformElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
nsSMILAnimationFunction mAnimationFunction;
SMILAnimationFunction mAnimationFunction;
friend nsresult(::NS_NewSVGAnimateTransformElement(
nsIContent** aResult,
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
@ -41,7 +41,7 @@ class SVGAnimateTransformElement final : public SVGAnimationElement {
nsAttrValue& aResult) override;
// SVGAnimationElement
virtual nsSMILAnimationFunction& AnimationFunction() override;
virtual SMILAnimationFunction& AnimationFunction() override;
};
} // namespace dom

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

@ -9,7 +9,7 @@
#include "mozilla/dom/ElementInlines.h"
#include "nsSMILTimeContainer.h"
#include "SMILAnimationController.h"
#include "nsSMILAnimationFunction.h"
#include "SMILAnimationFunction.h"
#include "nsContentUtils.h"
#include "nsIContentInlines.h"
#include "nsIURI.h"

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

@ -63,7 +63,7 @@ class SVGAnimationElement : public SVGAnimationElementBase, public SVGTests {
nsAtom** aLocalName) const;
nsSMILTimedElement& TimedElement();
nsSMILTimeContainer* GetTimeContainer();
virtual nsSMILAnimationFunction& AnimationFunction() = 0;
virtual SMILAnimationFunction& AnimationFunction() = 0;
virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;

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

@ -13,6 +13,7 @@
*/
#include "mozilla/Attributes.h"
#include "mozilla/SVGContentUtils.h"
#include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/Element.h"
#include "mozilla/gfx/MatrixFwd.h"
@ -23,7 +24,6 @@
#include "nsError.h"
#include "nsISupportsImpl.h"
#include "nsStyledElement.h"
#include "SVGContentUtils.h"
#include "nsSVGClass.h"
#include "gfxMatrix.h"

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

@ -42,7 +42,7 @@ typedef nsresult (*SVGContentCreatorFunction)(
nsIContent** aResult, \
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
mozilla::dom::FromParser aFromParser);
#include "SVGTagList.h"
#include "mozilla/SVGTagList.h"
#undef SVG_TAG
#undef SVG_FROM_PARSER_TAG

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

@ -79,8 +79,8 @@ bool SVGMotionSMILAnimationFunction::SetAttr(nsAtom* aAttribute,
}
} else {
// Defer to superclass method
return nsSMILAnimationFunction::SetAttr(aAttribute, aValue, aResult,
aParseResult);
return SMILAnimationFunction::SetAttr(aAttribute, aValue, aResult,
aParseResult);
}
return true;
@ -97,13 +97,13 @@ bool SVGMotionSMILAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
MarkStaleIfAttributeAffectsPath(aAttribute);
} else {
// Defer to superclass method
return nsSMILAnimationFunction::UnsetAttr(aAttribute);
return SMILAnimationFunction::UnsetAttr(aAttribute);
}
return true;
}
nsSMILAnimationFunction::nsSMILCalcMode
SMILAnimationFunction::nsSMILCalcMode
SVGMotionSMILAnimationFunction::GetCalcMode() const {
const nsAttrValue* value = GetAttr(nsGkAtoms::calcMode);
if (!value) {
@ -164,7 +164,7 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVerticesFromBasicAttrs(
} else {
// Create dummy 'from' value at 0,0, if we're doing by-animation.
// (NOTE: We don't add the dummy 0-point to our list for *to-animation*,
// because the nsSMILAnimationFunction logic for to-animation doesn't
// because the SMILAnimationFunction logic for to-animation doesn't
// expect a dummy value. It only expects one value: the final 'to' value.)
pathGenerator.MoveToOrigin();
if (!HasAttr(nsGkAtoms::to)) {
@ -320,7 +320,7 @@ nsresult SVGMotionSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
void SVGMotionSMILAnimationFunction::CheckValueListDependentAttrs(
uint32_t aNumValues) {
// Call superclass method.
nsSMILAnimationFunction::CheckValueListDependentAttrs(aNumValues);
SMILAnimationFunction::CheckValueListDependentAttrs(aNumValues);
// Added behavior: Do checks specific to keyPoints.
CheckKeyPoints();
@ -332,7 +332,7 @@ bool SVGMotionSMILAnimationFunction::IsToAnimation() const {
// NOTE: We can't rely on mPathSourceType, because it might not have been
// set to a useful value yet (or it might be stale).
return !GetFirstMPathChild(mAnimationElement) && !HasAttr(nsGkAtoms::path) &&
nsSMILAnimationFunction::IsToAnimation();
SMILAnimationFunction::IsToAnimation();
}
void SVGMotionSMILAnimationFunction::CheckKeyPoints() {

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

@ -9,7 +9,7 @@
#include "mozilla/gfx/2D.h"
#include "mozilla/RefPtr.h"
#include "nsSMILAnimationFunction.h"
#include "mozilla/SMILAnimationFunction.h"
#include "nsTArray.h"
#include "SVGMotionSMILType.h" // for RotateType
@ -28,10 +28,10 @@ class SVGMPathElement;
//----------------------------------------------------------------------
// SVGMotionSMILAnimationFunction
//
// Subclass of nsSMILAnimationFunction to support a few extra features offered
// Subclass of SMILAnimationFunction to support a few extra features offered
// by the <animateMotion> element.
//
class SVGMotionSMILAnimationFunction final : public nsSMILAnimationFunction {
class SVGMotionSMILAnimationFunction final : public SMILAnimationFunction {
typedef mozilla::gfx::Path Path;
public:

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

@ -31,7 +31,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSetElement)
//----------------------------------------------------------------------
nsSMILAnimationFunction& SVGSetElement::AnimationFunction() {
SMILAnimationFunction& SVGSetElement::AnimationFunction() {
return mAnimationFunction;
}

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

@ -9,7 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/SVGAnimationElement.h"
#include "nsSMILSetAnimationFunction.h"
#include "mozilla/SMILSetAnimationFunction.h"
nsresult NS_NewSVGSetElement(
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@ -21,7 +21,7 @@ class SVGSetElement final : public SVGAnimationElement {
protected:
explicit SVGSetElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
nsSMILSetAnimationFunction mAnimationFunction;
SMILSetAnimationFunction mAnimationFunction;
friend nsresult(::NS_NewSVGSetElement(
nsIContent** aResult,
@ -35,7 +35,7 @@ class SVGSetElement final : public SVGAnimationElement {
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
// SVGAnimationElement
virtual nsSMILAnimationFunction& AnimationFunction() override;
virtual SMILAnimationFunction& AnimationFunction() override;
};
} // namespace dom

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

@ -7,9 +7,9 @@
#ifndef mozilla_dom_SVGTests_h
#define mozilla_dom_SVGTests_h
#include "nsStringFwd.h"
#include "SVGStringList.h"
#include "nsCOMPtr.h"
#include "nsStringFwd.h"
#include "mozilla/SVGStringList.h"
class nsAttrValue;
class nsAtom;

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

@ -12,6 +12,9 @@ MOCHITEST_MANIFESTS += ['test/mochitest.ini']
EXPORTS += [
'nsSVGClass.h',
'nsSVGFeatures.h',
]
EXPORTS.mozilla += [
'SVGAttrValueWrapper.h',
'SVGContentUtils.h',
'SVGPreserveAspectRatio.h',

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

@ -351,13 +351,9 @@ bool TenuredCell::isInsideZone(JS::Zone* zone) const {
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
MOZ_ASSERT(thing);
MOZ_ASSERT(CurrentThreadCanAccessZone(thing->zoneFromAnyThread()));
// It would be good if barriers were never triggered during collection, but
// at the moment this can happen e.g. when rekeying tables containing
// read-barriered GC things after a moving GC.
//
// TODO: Fix this and assert we're not collecting if we're on the active
// thread.
// Barriers should not be triggered on main thread while collecting.
MOZ_ASSERT_IF(CurrentThreadCanAccessRuntime(thing->runtimeFromAnyThread()),
!JS::RuntimeHeapIsCollecting());
JS::shadow::Zone* shadowZone = thing->shadowZoneFromAnyThread();
if (shadowZone->needsIncrementalBarrier()) {

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

@ -336,6 +336,9 @@ bool Zone::canCollect() {
}
void Zone::notifyObservingDebuggers() {
MOZ_ASSERT(JS::RuntimeHeapIsCollecting(),
"This method should be called during GC.");
JSRuntime* rt = runtimeFromMainThread();
JSContext* cx = rt->mainContextFromOwnThread();
@ -352,7 +355,7 @@ void Zone::notifyObservingDebuggers() {
for (GlobalObject::DebuggerVector::Range r = dbgs->all(); !r.empty();
r.popFront()) {
if (!r.front()->debuggeeIsBeingCollected(rt->gc.majorGCCount())) {
if (!r.front().unbarrieredGet()->debuggeeIsBeingCollected(rt->gc.majorGCCount())) {
#ifdef DEBUG
fprintf(stderr,
"OOM while notifying observing Debuggers of a GC: The "

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

@ -3038,7 +3038,10 @@ void Debugger::updateObservesAsmJSOnDebuggees(IsObserving observing) {
const GlobalObject& debuggee) {
if (auto* v = debuggee.getDebuggers()) {
for (auto p = v->begin(); p != v->end(); p++) {
if ((*p)->trackingAllocationSites && (*p)->enabled) {
// Use unbarrieredGet() to prevent triggering read barrier while
// collecting, this is safe as long as dbg does not escape.
Debugger* dbg = p->unbarrieredGet();
if (dbg->trackingAllocationSites && dbg->enabled) {
return true;
}
}
@ -3176,6 +3179,8 @@ void Debugger::traceCrossCompartmentEdges(JSTracer* trc) {
* returns false.
*/
/* static */ bool Debugger::markIteratively(GCMarker* marker) {
MOZ_ASSERT(JS::RuntimeHeapIsCollecting(),
"This method should be called during GC.");
bool markedAny = false;
// Find all Debugger objects in danger of GC. This code is a little
@ -3193,7 +3198,7 @@ void Debugger::traceCrossCompartmentEdges(JSTracer* trc) {
const GlobalObject::DebuggerVector* debuggers = global->getDebuggers();
MOZ_ASSERT(debuggers);
for (auto p = debuggers->begin(); p != debuggers->end(); p++) {
Debugger* dbg = *p;
Debugger* dbg = p->unbarrieredGet();
// dbg is a Debugger with at least one debuggee. Check three things:
// - dbg is actually in a compartment that is being marked
@ -4204,6 +4209,21 @@ static T* findDebuggerInVector(Debugger* dbg,
return p;
}
// a ReadBarriered version for findDebuggerInVector
// TODO: Bug 1515934 - findDebuggerInVector<T> triggers read barriers.
static ReadBarriered<Debugger*>*
findDebuggerInVector(Debugger* dbg,
Vector<ReadBarriered<Debugger*>, 0, js::SystemAllocPolicy>* vec) {
ReadBarriered<Debugger*>* p;
for (p = vec->begin(); p != vec->end(); p++) {
if (p->unbarrieredGet() == dbg) {
break;
}
}
MOZ_ASSERT(p != vec->end());
return p;
}
void Debugger::removeDebuggeeGlobal(FreeOp* fop, GlobalObject* global,
WeakGlobalObjectSet::Enum* debugEnum) {
// The caller might have found global by enumerating this->debuggees; if

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

@ -2578,7 +2578,8 @@ void DebugEnvironments::checkHashTablesAfterMovingGC() {
for (MissingEnvironmentMap::Range r = missingEnvs.all(); !r.empty();
r.popFront()) {
CheckGCThingAfterMovingGC(r.front().key().scope());
CheckGCThingAfterMovingGC(r.front().value().get());
// Use unbarrieredGet() to prevent triggering read barrier while collecting.
CheckGCThingAfterMovingGC(r.front().value().unbarrieredGet());
}
for (LiveEnvironmentMap::Range r = liveEnvs.all(); !r.empty(); r.popFront()) {
CheckGCThingAfterMovingGC(r.front().key());

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

@ -796,7 +796,9 @@ void Realm::updateDebuggerObservesFlag(unsigned flag) {
: maybeGlobal();
const GlobalObject::DebuggerVector* v = global->getDebuggers();
for (auto p = v->begin(); p != v->end(); p++) {
Debugger* dbg = *p;
// Use unbarrieredGet() to prevent triggering read barrier while collecting,
// this is safe as long as dbg does not escape.
Debugger* dbg = p->unbarrieredGet();
if (flag == DebuggerObservesAllExecution
? dbg->observesAllExecution()
: flag == DebuggerObservesCoverage

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

@ -1676,7 +1676,9 @@ bool SavedStacks::getLocation(JSContext* cx, const FrameIter& iter,
}
void SavedStacks::chooseSamplingProbability(Realm* realm) {
GlobalObject* global = realm->maybeGlobal();
// Use unbarriered version to prevent triggering read barrier while collecting,
// this is safe as long as global does not escape.
GlobalObject* global = realm->unsafeUnbarrieredMaybeGlobal();
if (!global) {
return;
}
@ -1690,15 +1692,18 @@ void SavedStacks::chooseSamplingProbability(Realm* realm) {
mozilla::DebugOnly<bool> foundAnyDebuggers = false;
double probability = 0;
for (auto dbgp = dbgs->begin(); dbgp < dbgs->end(); dbgp++) {
for (auto p = dbgs->begin(); p < dbgs->end(); p++) {
// The set of debuggers had better not change while we're iterating,
// such that the vector gets reallocated.
MOZ_ASSERT(dbgs->begin() == begin);
// Use unbarrieredGet() to prevent triggering read barrier while collecting,
// this is safe as long as dbgp does not escape.
Debugger* dbgp = p->unbarrieredGet();
if ((*dbgp)->trackingAllocationSites && (*dbgp)->enabled) {
if (dbgp->trackingAllocationSites && dbgp->enabled) {
foundAnyDebuggers = true;
probability =
std::max((*dbgp)->allocationSamplingProbability, probability);
std::max(dbgp->allocationSamplingProbability, probability);
}
}
MOZ_ASSERT(foundAnyDebuggers);

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

@ -2291,12 +2291,12 @@ void Zone::fixupInitialShapeTable() {
// If the prototype has moved we have to rekey the entry.
InitialShapeEntry entry = e.front();
if (entry.proto.proto().isObject() &&
IsForwarded(entry.proto.proto().toObject())) {
entry.proto.setProto(
TaggedProto(Forwarded(entry.proto.proto().toObject())));
// Use unbarrieredGet() to prevent triggering read barrier while collecting.
const TaggedProto& proto = entry.proto.proto().unbarrieredGet();
if (proto.isObject() && IsForwarded(proto.toObject())) {
entry.proto.setProto(TaggedProto(Forwarded(proto.toObject())));
using Lookup = InitialShapeEntry::Lookup;
Lookup relookup(shape->getObjectClass(), Lookup::ShapeProto(entry.proto),
Lookup relookup(shape->getObjectClass(), Lookup::ShapeProto(proto),
shape->numFixedSlots(), shape->getObjectFlags());
e.rekeyFront(relookup, entry);
}

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

@ -9,7 +9,7 @@
#include "mozilla/Maybe.h"
#include "mozilla/SVGContextPaint.h"
#include "SVGPreserveAspectRatio.h"
#include "mozilla/SVGPreserveAspectRatio.h"
#include "Units.h"
class nsIFrame;

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

@ -1189,6 +1189,9 @@ function UpdatePatch(patch) {
for (var i = 0; i < patch.attributes.length; ++i) {
var attr = patch.attributes.item(i);
switch (attr.name) {
case "xmlns":
// Don't save the XML namespace.
break;
case "selected":
this.selected = attr.value == "true";
break;
@ -1198,8 +1201,19 @@ function UpdatePatch(patch) {
throw Cr.NS_ERROR_ILLEGAL_VALUE;
}
// fall through
case "type":
case "URL":
case "finalURL":
case "state":
case "errorCode":
this[attr.name] = attr.value;
break;
default:
this[attr.name] = attr.value;
// Save custom attributes when serializing to the local xml file but
// don't use this method for the expected attributes which are already
// handled in serialize.
this.setProperty(attr.name, attr.value);
break;
}
}
@ -1260,16 +1274,22 @@ UpdatePatch.prototype = {
/**
* See nsIPropertyBag.idl
*
* Note: this only contains the nsIPropertyBag name / value pairs and not the
* nsIUpdatePatch name / value pairs.
*/
get enumerator() {
return this.enumerate();
},
* enumerate() {
for (var p in this._properties) {
let prop = this.properties[p].data;
if (prop) {
yield prop;
for (let propName in this._properties) {
if (this._properties[propName].present) {
// The nsIPropertyBag enumerator returns a nsISimpleEnumerator whose
// elements are nsIProperty objects.
yield { name: propName,
value: this._properties[propName].data,
QueryInterface: ChromeUtils.generateQI([Ci.nsIProperty])};
}
}
},
@ -1361,7 +1381,8 @@ function Update(update) {
for (let i = 0; i < update.attributes.length; ++i) {
var attr = update.attributes.item(i);
if (attr.value == "undefined") {
if (attr.name == "xmlns" || attr.value == "undefined") {
// Don't save the XML namespace or undefined values.
continue;
} else if (attr.name == "detailsURL") {
this._detailsURL = attr.value;
@ -1577,16 +1598,22 @@ Update.prototype = {
/**
* See nsIPropertyBag.idl
*
* Note: this only contains the nsIPropertyBag name value / pairs and not the
* nsIUpdate name / value pairs.
*/
get enumerator() {
return this.enumerate();
},
* enumerate() {
for (var p in this._properties) {
let prop = this.properties[p].data;
if (prop) {
yield prop;
for (let propName in this._properties) {
if (this._properties[propName].present) {
// The nsIPropertyBag enumerator returns a nsISimpleEnumerator whose
// elements are nsIProperty objects.
yield { name: propName,
value: this._properties[propName].data,
QueryInterface: ChromeUtils.generateQI([Ci.nsIProperty])};
}
}
},

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

@ -11,7 +11,6 @@ skip-if = os != 'win'
reason = Tests that update config is properly written to file, which is a Windows-only feature
[browser_updatesBackgroundWindow.js]
[browser_updatesBackgroundWindowFailures.js]
skip-if = verify
[browser_updatesBasicPrompt.js]
skip-if = asan
reason = Bug 1168003

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

@ -29,7 +29,7 @@ add_task(async function testUpdatePingReady() {
notificationId: "update-available",
button: "button",
beforeClick() {
checkWhatsNewLink("update-available-whats-new");
checkWhatsNewLink(window, "update-available-whats-new");
},
},
{

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

@ -21,7 +21,7 @@ add_task(async function testUpdatesBackgroundWindow() {
await SimpleTest.promiseFocus(window);
await popupShownPromise;
checkWhatsNewLink("update-available-whats-new");
checkWhatsNewLink(window, "update-available-whats-new");
let buttonEl = getNotificationButton(window, "update-available", "button");
buttonEl.click();
},

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

@ -2,7 +2,7 @@ add_task(async function testBackgroundWindowFailures() {
const maxBackgroundErrors = 5;
SpecialPowers.pushPrefEnv({set: [
[PREF_APP_UPDATE_BACKGROUNDMAXERRORS, maxBackgroundErrors],
[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2],
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
]});
let updateParams = "badURL=1";
@ -19,7 +19,7 @@ add_task(async function testBackgroundWindowFailures() {
is(PanelUI.menuButton.getAttribute("badge-status"), "update-available",
"The badge is showing for the background window");
checkWhatsNewLink("update-available-whats-new");
checkWhatsNewLink(extraWindow, "update-available-whats-new");
let buttonEl = getNotificationButton(extraWindow, "update-available", "button");
buttonEl.click();

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

@ -12,7 +12,7 @@ add_task(async function testBasicPrompt() {
notificationId: "update-available",
button: "button",
beforeClick() {
checkWhatsNewLink("update-available-whats-new");
checkWhatsNewLink(window, "update-available-whats-new");
},
},
{

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

@ -11,7 +11,7 @@ add_task(async function testBasicPromptNoStaging() {
notificationId: "update-available",
button: "button",
beforeClick() {
checkWhatsNewLink("update-available-whats-new");
checkWhatsNewLink(window, "update-available-whats-new");
},
},
{

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

@ -1,5 +1,7 @@
add_task(async function testCompleteAndPartialPatchesWithBadSizes() {
SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2]]});
SpecialPowers.pushPrefEnv({set: [
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
]});
let updateParams = "invalidPartialSize=1&invalidCompleteSize=1";
await runUpdateTest(updateParams, 1, [
@ -20,7 +22,7 @@ add_task(async function testCompleteAndPartialPatchesWithBadSizes() {
notificationId: "update-manual",
button: "button",
beforeClick() {
checkWhatsNewLink("update-manual-whats-new");
checkWhatsNewLink(window, "update-manual-whats-new");
},
async cleanup() {
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);

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

@ -11,7 +11,7 @@ add_task(async function testCompletePatchApplyFailure() {
notificationId: "update-manual",
button: "button",
beforeClick() {
checkWhatsNewLink("update-manual-whats-new");
checkWhatsNewLink(window, "update-manual-whats-new");
},
async cleanup() {
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);

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

@ -1,5 +1,7 @@
add_task(async function testCompletePatchWithBadCompleteSize() {
SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2]]});
SpecialPowers.pushPrefEnv({set: [
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
]});
let updateParams = "completePatchOnly=1&invalidCompleteSize=1";
@ -21,7 +23,7 @@ add_task(async function testCompletePatchWithBadCompleteSize() {
notificationId: "update-manual",
button: "button",
beforeClick() {
checkWhatsNewLink("update-manual-whats-new");
checkWhatsNewLink(window, "update-manual-whats-new");
},
async cleanup() {
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);

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

@ -2,7 +2,7 @@ add_task(async function testDownloadFailures() {
const maxBackgroundErrors = 5;
SpecialPowers.pushPrefEnv({set: [
[PREF_APP_UPDATE_BACKGROUNDMAXERRORS, maxBackgroundErrors],
[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2],
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
]});
let updateParams = "badURL=1";

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

@ -15,7 +15,7 @@ add_task(async function testMalformedXml() {
notificationId: "update-manual",
button: "button",
beforeClick() {
checkWhatsNewLink("update-manual-whats-new", updateDetailsUrl);
checkWhatsNewLink(window, "update-manual-whats-new", updateDetailsUrl);
},
async cleanup() {
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);

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

@ -13,7 +13,7 @@ add_task(async function testPartialPatchApplyFailure() {
notificationId: "update-manual",
button: "button",
beforeClick() {
checkWhatsNewLink("update-manual-whats-new");
checkWhatsNewLink(window, "update-manual-whats-new");
},
async cleanup() {
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);

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

@ -1,7 +1,9 @@
add_task(async function testPartialPatchApplyFailureWithCompleteValidationFailure() {
// because of the way we're simulating failure, we have to just pretend we've already
// retried.
SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 0]]});
SpecialPowers.pushPrefEnv({set: [
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 0],
]});
let patchProps = {type: "partial",
state: STATE_PENDING};
@ -20,7 +22,7 @@ add_task(async function testPartialPatchApplyFailureWithCompleteValidationFailur
notificationId: "update-manual",
button: "button",
beforeClick() {
checkWhatsNewLink("update-manual-whats-new");
checkWhatsNewLink(window, "update-manual-whats-new");
},
async cleanup() {
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);

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

@ -1,5 +1,7 @@
add_task(async function testPartialPatchWithBadPartialSize() {
SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2]]});
SpecialPowers.pushPrefEnv({set: [
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
]});
let updateParams = "partialPatchOnly=1&invalidPartialSize=1";
await runUpdateTest(updateParams, 1, [
@ -20,7 +22,7 @@ add_task(async function testPartialPatchWithBadPartialSize() {
notificationId: "update-manual",
button: "button",
beforeClick() {
checkWhatsNewLink("update-manual-whats-new");
checkWhatsNewLink(window, "update-manual-whats-new");
},
async cleanup() {
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);

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

@ -283,12 +283,13 @@ function waitForEvent(topic, status = null) {
/**
* Gets the specified button for the notification.
*
* @param window
* @param win
* The window to get the notification button for.
* @param notificationId
* The ID of the notification to get the button for.
* @param button
* The anonid of the button to get.
* @return The button element.
*/
function getNotificationButton(win, notificationId, button) {
let notification = win.document.getElementById(`appMenu-${notificationId}-notification`);
@ -301,13 +302,15 @@ function getNotificationButton(win, notificationId, button) {
* matches the url parameter provided. If no URL is provided, it will instead
* ensure that the link matches the default link URL.
*
* @param win
* The window to get the "What's new" link for.
* @param id
* The ID of the "What's new" link element.
* @param url (optional)
* The URL to check against. If none is provided, a default will be used.
*/
function checkWhatsNewLink(id, url) {
let whatsNewLink = document.getElementById(id);
function checkWhatsNewLink(win, id, url) {
let whatsNewLink = win.document.getElementById(id);
is(whatsNewLink.href,
url || URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS",
"What's new link points to the test_details URL");

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

@ -17,7 +17,7 @@ const PREF_APP_UPDATE_CANCELATIONS = "app.update.cancelations";
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
const PREF_APP_UPDATE_DOORHANGER = "app.update.doorhanger";
const PREF_APP_UPDATE_DOWNLOADPROMPTATTEMPTS = "app.update.download.attempts";
const PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS = "app.update.download.maxAttempts";
const PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS = "app.update.download.maxAttempts";
const PREF_APP_UPDATE_DISABLEDFORTESTING = "app.update.disabledForTesting";
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
const PREF_APP_UPDATE_LOG = "app.update.log";

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

@ -162,6 +162,8 @@ function getRemotePatchString(aPatchProps) {
set url(val) {
this._url = val;
},
custom1: null,
custom2: null,
size: SIZE_SIMPLE_MAR,
};
@ -274,6 +276,8 @@ function getLocalPatchString(aPatchProps) {
type: "complete",
url: gURLData + FILE_SIMPLE_MAR,
size: SIZE_SIMPLE_MAR,
custom1: null,
custom2: null,
selected: "true",
state: STATE_SUCCEEDED,
};
@ -335,8 +339,12 @@ function getPatchString(aPatchProps) {
let type = "type=\"" + aPatchProps.type + "\" ";
let url = "URL=\"" + aPatchProps.url + "\" ";
let size = "size=\"" + aPatchProps.size + "\"";
let custom1 = aPatchProps.custom1 ? aPatchProps.custom1 + " " : "";
let custom2 = aPatchProps.custom2 ? aPatchProps.custom2 + " " : "";
return "<patch " +
type +
url +
custom1 +
custom2 +
size;
}

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

@ -16,7 +16,9 @@ function run_test() {
url: "http://partial/",
size: "86",
selected: "true",
state: STATE_PENDING};
state: STATE_PENDING,
custom1: "custom1_attr=\"custom1 patch value\"",
custom2: "custom2_attr=\"custom2 patch value\""};
let patches = getLocalPatchString(patchProps);
let updateProps = {type: "major",
name: "New",
@ -42,7 +44,9 @@ function run_test() {
url: "http://complete/",
size: "75",
selected: "true",
state: STATE_FAILED};
state: STATE_FAILED,
custom1: "custom3_attr=\"custom3 patch value\"",
custom2: "custom4_attr=\"custom4 patch value\""};
patches = getLocalPatchString(patchProps);
updateProps = {type: "minor",
name: "Existing",
@ -66,7 +70,7 @@ function run_test() {
Assert.equal(gUpdateManager.updateCount, 2,
"the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
debugDump("checking the activeUpdate properties");
debugDump("checking the first update properties");
let update = gUpdateManager.getUpdateAt(0).QueryInterface(Ci.nsIWritablePropertyBag);
Assert.equal(update.state, STATE_SUCCEEDED,
"the update state attribute" + MSG_SHOULD_EQUAL);
@ -102,9 +106,35 @@ function run_test() {
"the update custom1_attr property" + MSG_SHOULD_EQUAL);
Assert.equal(update.getProperty("custom2_attr"), "custom2 value",
"the update custom2_attr property" + MSG_SHOULD_EQUAL);
// nsIPropertyBag enumerator
debugDump("checking the first update enumerator");
let e = update.enumerator;
Assert.ok(e.hasMoreElements(),
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
let prop = e.getNext().QueryInterface(Ci.nsIProperty);
Assert.ok(!!prop,
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
Assert.equal(prop.name, "custom1_attr",
"the first property name" + MSG_SHOULD_EQUAL);
Assert.equal(prop.value, "custom1 value",
"the first property value" + MSG_SHOULD_EQUAL);
prop = e.getNext().QueryInterface(Ci.nsIProperty);
Assert.ok(!!prop,
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
Assert.equal(prop.name, "custom2_attr",
"the second property name" + MSG_SHOULD_EQUAL);
Assert.equal(prop.value, "custom2 value",
"the second property value" + MSG_SHOULD_EQUAL);
prop = e.getNext().QueryInterface(Ci.nsIProperty);
Assert.equal(prop.name, "foregroundDownload",
"the third property name" + MSG_SHOULD_EQUAL);
Assert.equal(prop.value, "true",
"the third property value" + MSG_SHOULD_EQUAL);
Assert.ok(!e.hasMoreElements(),
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
debugDump("checking the activeUpdate patch properties");
let patch = update.selectedPatch;
debugDump("checking the first update patch properties");
let patch = update.selectedPatch.QueryInterface(Ci.nsIWritablePropertyBag);
Assert.equal(patch.type, "partial",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, "http://partial/",
@ -115,8 +145,33 @@ function run_test() {
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.state, STATE_SUCCEEDED,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.getProperty("custom1_attr"), "custom1 patch value",
"the update patch custom1_attr property" + MSG_SHOULD_EQUAL);
Assert.equal(patch.getProperty("custom2_attr"), "custom2 patch value",
"the update patch custom2_attr property" + MSG_SHOULD_EQUAL);
// nsIPropertyBag enumerator
debugDump("checking the first update patch enumerator");
e = patch.enumerator;
Assert.ok(e.hasMoreElements(),
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
prop = e.getNext().QueryInterface(Ci.nsIProperty);
Assert.ok(!!prop,
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
Assert.equal(prop.name, "custom1_attr",
"the first property name" + MSG_SHOULD_EQUAL);
Assert.equal(prop.value, "custom1 patch value",
"the first property value" + MSG_SHOULD_EQUAL);
prop = e.getNext().QueryInterface(Ci.nsIProperty);
Assert.ok(!!prop,
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
Assert.equal(prop.name, "custom2_attr",
"the second property name" + MSG_SHOULD_EQUAL);
Assert.equal(prop.value, "custom2 patch value",
"the second property value" + MSG_SHOULD_EQUAL);
Assert.ok(!e.hasMoreElements(),
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
debugDump("checking the first update properties");
debugDump("checking the second update properties");
update = gUpdateManager.getUpdateAt(1).QueryInterface(Ci.nsIWritablePropertyBag);
Assert.equal(update.state, STATE_FAILED,
"the update state attribute" + MSG_SHOULD_EQUAL);
@ -151,9 +206,35 @@ function run_test() {
"the update custom3_attr property" + MSG_SHOULD_EQUAL);
Assert.equal(update.getProperty("custom4_attr"), "custom4 value",
"the update custom4_attr property" + MSG_SHOULD_EQUAL);
// nsIPropertyBag enumerator
debugDump("checking the second update enumerator");
e = update.enumerator;
Assert.ok(e.hasMoreElements(),
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
prop = e.getNext().QueryInterface(Ci.nsIProperty);
Assert.ok(!!prop,
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
Assert.equal(prop.name, "custom3_attr",
"the first property name" + MSG_SHOULD_EQUAL);
Assert.equal(prop.value, "custom3 value",
"the first property value" + MSG_SHOULD_EQUAL);
prop = e.getNext().QueryInterface(Ci.nsIProperty);
Assert.ok(!!prop,
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
Assert.equal(prop.name, "custom4_attr",
"the second property name" + MSG_SHOULD_EQUAL);
Assert.equal(prop.value, "custom4 value",
"the second property value" + MSG_SHOULD_EQUAL);
prop = e.getNext().QueryInterface(Ci.nsIProperty);
Assert.equal(prop.name, "foregroundDownload",
"the third property name" + MSG_SHOULD_EQUAL);
Assert.equal(prop.value, "false",
"the third property value" + MSG_SHOULD_EQUAL);
Assert.ok(!e.hasMoreElements(),
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
debugDump("checking the first update patch properties");
patch = update.selectedPatch;
debugDump("checking the second update patch properties");
patch = update.selectedPatch.QueryInterface(Ci.nsIWritablePropertyBag);
Assert.equal(patch.type, "complete",
"the update patch type attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.URL, "http://complete/",
@ -164,6 +245,31 @@ function run_test() {
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.state, STATE_FAILED,
"the update patch state attribute" + MSG_SHOULD_EQUAL);
Assert.equal(patch.getProperty("custom3_attr"), "custom3 patch value",
"the update patch custom3_attr property" + MSG_SHOULD_EQUAL);
Assert.equal(patch.getProperty("custom4_attr"), "custom4 patch value",
"the update patch custom4_attr property" + MSG_SHOULD_EQUAL);
// nsIPropertyBag enumerator
debugDump("checking the second update patch enumerator");
e = patch.enumerator;
Assert.ok(e.hasMoreElements(),
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
prop = e.getNext().QueryInterface(Ci.nsIProperty);
Assert.ok(!!prop,
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
Assert.equal(prop.name, "custom3_attr",
"the first property name" + MSG_SHOULD_EQUAL);
Assert.equal(prop.value, "custom3 patch value",
"the first property value" + MSG_SHOULD_EQUAL);
prop = e.getNext().QueryInterface(Ci.nsIProperty);
Assert.ok(!!prop,
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
Assert.equal(prop.name, "custom4_attr",
"the second property name" + MSG_SHOULD_EQUAL);
Assert.equal(prop.value, "custom4 patch value",
"the second property value" + MSG_SHOULD_EQUAL);
Assert.ok(!e.hasMoreElements(),
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
// Cleaning up the active update along with reloading the update manager
// in doTestFinish will prevent writing the update xml files during