Merge inbound to m-c.

This commit is contained in:
Ryan VanderMeulen 2014-01-08 15:33:52 -05:00
commit 0486db7a28
150 changed files with 1591 additions and 1272 deletions

View File

@ -108,6 +108,12 @@
BOUNDARY_LINE_START,
[ [ 0, 3, "foo\n", 0, 4 ], [ 4, 4, "", 4, 4 ] ]);
//////////////////////////////////////////////////////////////////////////
// 'Hello world ' (\n is rendered as space)
testTextAtOffset([ "ht_4" ], BOUNDARY_LINE_START,
[ [ 0, 12, "Hello world ", 0, 12 ] ]);
//////////////////////////////////////////////////////////////////////////
// list items
@ -138,6 +144,11 @@
href="https://bugzilla.mozilla.org/show_bug.cgi?id=882292">
Bug 882292
</a>
<a target="_blank"
title="getTextAtOffset broken for last object when closing tag is preceded by newline char"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=947170">
Bug 947170
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -173,6 +184,9 @@ two words
<iframe id="ht_2" src="data:text/html,<div contentEditable='true'>foo<br/></div>"></iframe>
<iframe id="ht_3" src="data:text/html,<div contentEditable='true'>foo<br/><br/></div>"></iframe>
<p id="ht_4">Hello world
</p>
<ul>
<li id="li1">Item</li>
</ul>

View File

@ -39,7 +39,7 @@
<form name="searchForm" id="searchForm" onsubmit="onSearchSubmit(event)">
<div id="searchLogoContainer"><img id="searchEngineLogo"/></div>
<input type="text" name="q" value="" id="searchText" maxlength="256"
autofocus="autofocus"/>
autofocus="autofocus" dir="auto"/>
<input id="searchSubmit" type="submit" value="&abouthome.searchEngineButton.label;"/>
</form>
</div>

View File

@ -6,6 +6,7 @@
role="group"
type="arrow"
hidden="true"
flip="slide"
noautofocus="true">
<panelmultiview id="PanelUI-multiView" mainViewId="PanelUI-mainView">
<panelview id="PanelUI-mainView" context="customizationPanelContextMenu">

View File

@ -1524,6 +1524,17 @@ MOZ_ARG_ENABLE_BOOL(profiling,
MOZ_PROFILING=1,
MOZ_PROFILING= )
dnl ========================================================
dnl = Turn on systrace for android/b2g.
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(systrace,
[ --enable-systrace Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
MOZ_USE_SYSTRACE=1,
MOZ_USE_SYSTRACE= )
if test -n "$MOZ_USE_SYSTRACE"; then
AC_DEFINE(MOZ_USE_SYSTRACE)
fi
# For profiling builds keep the symbol information
if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
case "$OS_TARGET" in

View File

@ -16,7 +16,6 @@ DEPRECATED_OPERATION(RemoveAttributeNode)
DEPRECATED_OPERATION(CreateAttribute)
DEPRECATED_OPERATION(CreateAttributeNS)
DEPRECATED_OPERATION(Specified)
DEPRECATED_OPERATION(OwnerElement)
DEPRECATED_OPERATION(NodeValue)
DEPRECATED_OPERATION(TextContent)
DEPRECATED_OPERATION(EnablePrivilege)

View File

@ -134,6 +134,13 @@ Attr::GetContent() const
return GetContentInternal();
}
Element*
Attr::GetElement() const
{
nsIContent* content = GetContent();
return content ? content->AsElement() : nullptr;
}
nsresult
Attr::SetOwnerDocument(nsIDocument* aDocument)
{
@ -233,29 +240,6 @@ Attr::GetSpecified(bool* aSpecified)
return NS_OK;
}
Element*
Attr::GetOwnerElement(ErrorResult& aRv)
{
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerElement);
return GetContentInternal();
}
NS_IMETHODIMP
Attr::GetOwnerElement(nsIDOMElement** aOwnerElement)
{
NS_ENSURE_ARG_POINTER(aOwnerElement);
OwnerDoc()->WarnOnceAbout(nsIDocument::eOwnerElement);
nsIContent* content = GetContentInternal();
if (content) {
return CallQueryInterface(content, aOwnerElement);
}
*aOwnerElement = nullptr;
return NS_OK;
}
void
Attr::GetNodeValueInternal(nsAString& aNodeValue)
{

View File

@ -55,6 +55,7 @@ public:
// nsIAttribute interface
void SetMap(nsDOMAttributeMap *aMap) MOZ_OVERRIDE;
nsIContent *GetContent() const MOZ_OVERRIDE;
Element *GetElement() const;
nsresult SetOwnerDocument(nsIDocument* aDocument) MOZ_OVERRIDE;
// nsINode interface
@ -92,8 +93,6 @@ public:
// XPCOM GetPrefix() is OK
// XPCOM GetLocalName() is OK
Element* GetOwnerElement(ErrorResult& aRv);
protected:
virtual Element* GetNameSpaceElement()
{

View File

@ -82,7 +82,7 @@ LogBlockedRequest(nsIRequest* aRequest)
// Generate the error message
nsXPIDLString blockedMessage;
NS_ConvertUTF8toUTF16 specUTF16(spec);
const PRUnichar* params[] = { specUTF16.get() };
const char16_t* params[] = { specUTF16.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eSECURITY_PROPERTIES,
"CrossSiteRequestBlocked",
params,

View File

@ -6708,10 +6708,7 @@ nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
// Remove from ownerElement.
nsRefPtr<Attr> adoptedAttr = static_cast<Attr*>(adoptedNode);
nsCOMPtr<Element> ownerElement = adoptedAttr->GetOwnerElement(rv);
if (rv.Failed()) {
return nullptr;
}
nsCOMPtr<Element> ownerElement = adoptedAttr->GetElement();
if (ownerElement) {
nsRefPtr<Attr> newAttr =

View File

@ -29,7 +29,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=364413
var attrNode = test1.getAttributeNodeNS("http://www.foobar.com", "foo");
function mutationHandler(aEvent) {
ok(attrNode == aEvent.relatedNode);
ok(aEvent.target == attrNode.ownerElement);
}
function runTest() {

View File

@ -155,16 +155,15 @@ AudioBlockCopyChannelWithScale(const float aInput[WEBAUDIO_BLOCK_SIZE],
}
void
AudioBufferInPlaceScale(float aBlock[WEBAUDIO_BLOCK_SIZE],
AudioBlockInPlaceScale(float aBlock[WEBAUDIO_BLOCK_SIZE],
uint32_t aChannelCount,
float aScale)
{
AudioBufferInPlaceScale(aBlock, aChannelCount, aScale, WEBAUDIO_BLOCK_SIZE);
AudioBufferInPlaceScale(aBlock, aScale, aChannelCount * WEBAUDIO_BLOCK_SIZE);
}
void
AudioBufferInPlaceScale(float* aBlock,
uint32_t aChannelCount,
float aScale,
uint32_t aSize)
{
@ -173,11 +172,11 @@ AudioBufferInPlaceScale(float* aBlock,
}
#ifdef BUILD_ARM_NEON
if (mozilla::supports_neon()) {
AudioBufferInPlaceScale_NEON(aBlock, aChannelCount, aScale, aSize);
AudioBufferInPlaceScale_NEON(aBlock, aScale, aSize);
return;
}
#endif
for (uint32_t i = 0; i < aSize * aChannelCount; ++i) {
for (uint32_t i = 0; i < aSize; ++i) {
*aBlock++ *= aScale;
}
}

View File

@ -149,7 +149,7 @@ float AudioBufferPeakValue(const float* aInput, uint32_t aSize);
/**
* In place gain. aScale == 1.0f should be optimized.
*/
void AudioBufferInPlaceScale(float aBlock[WEBAUDIO_BLOCK_SIZE],
void AudioBlockInPlaceScale(float aBlock[WEBAUDIO_BLOCK_SIZE],
uint32_t aChannelCount,
float aScale);
@ -157,7 +157,6 @@ void AudioBufferInPlaceScale(float aBlock[WEBAUDIO_BLOCK_SIZE],
* In place gain. aScale == 1.0f should be optimized.
*/
void AudioBufferInPlaceScale(float* aBlock,
uint32_t aChannelCount,
float aScale,
uint32_t aSize);

View File

@ -127,7 +127,6 @@ AudioBlockCopyChannelWithScale_NEON(const float aInput[WEBAUDIO_BLOCK_SIZE],
void
AudioBufferInPlaceScale_NEON(float* aBlock,
uint32_t aChannelCount,
float aScale,
uint32_t aSize)
{
@ -137,11 +136,10 @@ AudioBufferInPlaceScale_NEON(float* aBlock,
float32x4_t vout0, vout1, vout2, vout3;
float32x4_t vscale = vmovq_n_f32(aScale);
uint32_t totalSize = aSize * aChannelCount;
uint32_t dif = totalSize % 16;
totalSize -= dif;
uint32_t dif = aSize % 16;
uint32_t vectorSize = aSize - dif;
uint32_t i = 0;
for (; i < totalSize; i+=16) {
for (; i < vectorSize; i+=16) {
vin0 = vld1q_f32(ADDRESS_OF(aBlock, i));
vin1 = vld1q_f32(ADDRESS_OF(aBlock, i+4));
vin2 = vld1q_f32(ADDRESS_OF(aBlock, i+8));

View File

@ -26,7 +26,6 @@ AudioBlockCopyChannelWithScale_NEON(const float aInput[WEBAUDIO_BLOCK_SIZE],
void
AudioBufferInPlaceScale_NEON(float* aBlock,
uint32_t aChannelCount,
float aScale,
uint32_t aSize);

View File

@ -1543,7 +1543,7 @@ MediaStreamGraphImpl::RunInStableState()
controlMessagesToRunDuringShutdown.MoveElementsFrom(mb.mMessages);
}
mMessageQueue.Clear();
controlMessagesToRunDuringShutdown.MoveElementsFrom(mCurrentTaskMessageQueue);
MOZ_ASSERT(mCurrentTaskMessageQueue.IsEmpty());
// Stop MediaStreamGraph threads. Do not clear gGraph since
// we have outstanding DOM objects that may need it.
mLifecycleState = LIFECYCLE_WAITING_FOR_THREAD_SHUTDOWN;
@ -1619,11 +1619,6 @@ MediaStreamGraphImpl::AppendMessage(ControlMessage* aMessage)
gGraph = nullptr;
}
delete this;
} else if (!mRealtime) {
// Make sure to mark the graph as not doing non-realtime processing,
// because otherwise AppendMessage will try to ensure that the graph
// is running, and we will never manage to release our resources.
mNonRealtimeProcessing = false;
}
return;
}

View File

@ -288,7 +288,7 @@ AnalyserNode::AppendChunk(const AudioChunk& aChunk)
mBuffer.Elements() + mWriteIndex);
}
if (channelCount > 1) {
AudioBufferInPlaceScale(mBuffer.Elements() + mWriteIndex, 1,
AudioBlockInPlaceScale(mBuffer.Elements() + mWriteIndex, 1,
1.0f / aChunk.mChannelData.Length());
}
mWriteIndex += chunkDuration;

View File

@ -623,15 +623,19 @@ void
AudioContext::Mute() const
{
MOZ_ASSERT(!mIsOffline);
if (mDestination) {
mDestination->Mute();
}
}
void
AudioContext::Unmute() const
{
MOZ_ASSERT(!mIsOffline);
if (mDestination) {
mDestination->Unmute();
}
}
AudioChannel
AudioContext::MozAudioChannelType() const

View File

@ -46,7 +46,8 @@ FFTBlock* FFTBlock::CreateInterpolatedBlock(const FFTBlock& block0, const FFTBlo
int fftSize = newBlock->FFTSize();
nsTArray<float> buffer;
buffer.SetLength(fftSize);
newBlock->PerformInverseFFT(buffer.Elements());
newBlock->GetInverseWithoutScaling(buffer.Elements());
AudioBufferInPlaceScale(buffer.Elements(), 1.0f / fftSize, fftSize / 2);
PodZero(buffer.Elements() + fftSize / 2, fftSize / 2);
// Put back into frequency domain.

View File

@ -47,13 +47,18 @@ public:
}
// Inverse-transform internal data and store the resulting FFTSize()
// points in aData.
void PerformInverseFFT(float* aData)
void GetInverse(float* aDataOut)
{
GetInverseWithoutScaling(aDataOut);
AudioBufferInPlaceScale(aDataOut, 1.0f / mFFTSize, mFFTSize);
}
// Inverse-transform internal frequency data and store the resulting
// FFTSize() points in |aDataOut|. If frequency data has not already been
// scaled, then the output will need scaling by 1/FFTSize().
void GetInverseWithoutScaling(float* aDataOut)
{
EnsureIFFT();
kiss_fftri(mIFFT, mOutputBuffer.Elements(), aData);
for (uint32_t i = 0; i < mFFTSize; ++i) {
aData[i] /= mFFTSize;
}
kiss_fftri(mIFFT, mOutputBuffer.Elements(), aDataOut);
}
// Inverse-transform the FFTSize()/2+1 points of data in each
// of aRealDataIn and aImagDataIn and store the resulting
@ -84,12 +89,17 @@ public:
mFFTSize / 2 + 1);
}
void PerformPaddedFFT(const float* aData, size_t dataSize)
// Perform a forward FFT on |aData|, assuming zeros after dataSize samples,
// and pre-scale the generated internal frequency domain coefficients so
// that GetInverseWithoutScaling() can be used to transform to the time
// domain. This is useful for convolution kernels.
void PadAndMakeScaledDFT(const float* aData, size_t dataSize)
{
MOZ_ASSERT(dataSize <= FFTSize());
nsTArray<float> paddedData;
paddedData.SetLength(FFTSize());
PodCopy(paddedData.Elements(), aData, dataSize);
AudioBufferCopyWithScale(aData, 1.0f / FFTSize(),
paddedData.Elements(), dataSize);
PodZero(paddedData.Elements() + dataSize, mFFTSize - dataSize);
PerformFFT(paddedData.Elements());
}

View File

@ -395,7 +395,7 @@ PannerNodeEngine::DistanceAndConeGain(AudioChunk* aChunk, float aGain)
float* samples = static_cast<float*>(const_cast<void*>(*aChunk->mChannelData.Elements()));
uint32_t channelCount = aChunk->mChannelData.Length();
AudioBufferInPlaceScale(samples, channelCount, aGain);
AudioBlockInPlaceScale(samples, channelCount, aGain);
}
// This algorithm is specified in the webaudio spec.

View File

@ -88,7 +88,7 @@ void FFTConvolver::process(FFTBlock* fftKernel, const float* sourceP, float* des
// The input buffer is now filled (get frequency-domain version)
m_frame.PerformFFT(m_inputBuffer.Elements());
m_frame.Multiply(*fftKernel);
m_frame.PerformInverseFFT(m_outputBuffer.Elements());
m_frame.GetInverseWithoutScaling(m_outputBuffer.Elements());
// Overlap-add 1st half from previous time
AudioBufferAddWithScale(m_lastOverlapBuffer.Elements(), 1.0f,

View File

@ -42,6 +42,8 @@ public:
// fftSize must be a power of two
FFTConvolver(size_t fftSize);
// |fftKernel| must be pre-scaled for FFTBlock::GetInverseWithoutScaling().
//
// For now, with multiple calls to Process(), framesToProcess MUST add up EXACTLY to fftSize / 2
//
// FIXME: Later, we can do more sophisticated buffering to relax this requirement...

View File

@ -42,7 +42,7 @@ static float extractAverageGroupDelay(float* impulseP, size_t length)
estimationFrame.PerformFFT(impulseP);
float frameDelay = static_cast<float>(estimationFrame.ExtractAverageGroupDelay());
estimationFrame.PerformInverseFFT(impulseP);
estimationFrame.GetInverse(impulseP);
return frameDelay;
}
@ -70,7 +70,7 @@ HRTFKernel::HRTFKernel(float* impulseResponse, size_t length, float sampleRate)
}
m_fftFrame = new FFTBlock(fftSize);
m_fftFrame->PerformPaddedFFT(impulseResponse, length);
m_fftFrame->PadAndMakeScaledDFT(impulseResponse, length);
}
// Interpolates two kernels with x: 0 -> 1 and returns the result.

View File

@ -182,7 +182,7 @@ void PeriodicWave::createBandLimitedTables(const float* realData, const float* i
// Generate complex conjugate because of the way the
// inverse FFT is defined.
float minusOne = -1;
AudioBufferInPlaceScale(imagP, 1, minusOne, halfSize);
AudioBufferInPlaceScale(imagP, minusOne, halfSize);
// Find the starting bin where we should start culling.
// We need to clear out the highest frequencies to band-limit
@ -224,7 +224,7 @@ void PeriodicWave::createBandLimitedTables(const float* realData, const float* i
}
// Apply normalization scale.
AudioBufferInPlaceScale(data, 1, normalizationScale, m_periodicWaveSize);
AudioBufferInPlaceScale(data, normalizationScale, m_periodicWaveSize);
}
}

View File

@ -49,7 +49,7 @@ ReverbConvolverStage::ReverbConvolverStage(const float* impulseResponse, size_t,
if (!m_directMode) {
m_fftKernel = new FFTBlock(fftSize);
m_fftKernel->PerformPaddedFFT(impulseResponse + stageOffset, stageLength);
m_fftKernel->PadAndMakeScaledDFT(impulseResponse + stageOffset, stageLength);
m_fftConvolver = new FFTConvolver(fftSize);
} else {
m_directKernel.SetLength(fftSize / 2);

View File

@ -73,6 +73,7 @@ SVGFEBlendElement::Mode()
FilterPrimitiveDescription
SVGFEBlendElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
uint32_t mode = mEnumAttributes[MODE].GetAnimValue();

View File

@ -32,6 +32,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -87,6 +87,7 @@ SVGFEColorMatrixElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources
FilterPrimitiveDescription
SVGFEColorMatrixElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
uint32_t type = mEnumAttributes[TYPE].GetAnimValue();

View File

@ -34,6 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -54,6 +54,7 @@ SVGFEComponentTransferElement::GetStringInfo()
FilterPrimitiveDescription
SVGFEComponentTransferElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
nsRefPtr<SVGComponentTransferFunctionElement> childForChannel[4];

View File

@ -32,6 +32,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -112,6 +112,7 @@ SVGFECompositeElement::SetK(float k1, float k2, float k3, float k4)
FilterPrimitiveDescription
SVGFECompositeElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eComposite);

View File

@ -34,6 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -166,6 +166,7 @@ SVGFEConvolveMatrixElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSour
FilterPrimitiveDescription
SVGFEConvolveMatrixElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
const FilterPrimitiveDescription failureDescription(FilterPrimitiveDescription::eNone);

View File

@ -42,6 +42,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -63,6 +63,7 @@ SVGFEDiffuseLightingElement::KernelUnitLengthY()
FilterPrimitiveDescription
SVGFEDiffuseLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
float diffuseConstant = mNumberAttributes[DIFFUSE_CONSTANT].GetAnimValue();

View File

@ -32,6 +32,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const;

View File

@ -93,8 +93,17 @@ SVGFEDisplacementMapElement::YChannelSelector()
FilterPrimitiveDescription
SVGFEDisplacementMapElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
if (aInputsAreTainted[1]) {
// If the map is tainted, refuse to apply the effect and act as a
// pass-through filter instead, as required by the spec.
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eOffset);
descr.Attributes().Set(eOffsetOffset, IntPoint(0, 0));
return descr;
}
float scale = aInstance->GetPrimitiveNumber(SVGContentUtils::XY,
&mNumberAttributes[SCALE]);
uint32_t xChannel = mEnumAttributes[CHANNEL_X].GetAnimValue();

View File

@ -33,6 +33,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -35,6 +35,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFloodElement)
FilterPrimitiveDescription
SVGFEFloodElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eFlood);

View File

@ -34,6 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }

View File

@ -68,6 +68,7 @@ static const float kMaxStdDeviation = 500;
FilterPrimitiveDescription
SVGFEGaussianBlurElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
float stdX = aInstance->GetPrimitiveNumber(SVGContentUtils::X,

View File

@ -34,6 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -193,6 +193,7 @@ SVGFEImageElement::Href()
FilterPrimitiveDescription
SVGFEImageElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
nsIFrame* frame = GetPrimaryFrame();
@ -261,6 +262,51 @@ SVGFEImageElement::AttributeAffectsRendering(int32_t aNameSpaceID,
aAttribute == nsGkAtoms::preserveAspectRatio);
}
bool
SVGFEImageElement::OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
nsIPrincipal* aReferencePrincipal)
{
nsresult rv;
nsCOMPtr<imgIRequest> currentRequest;
GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
getter_AddRefs(currentRequest));
if (!currentRequest) {
return false;
}
uint32_t status;
currentRequest->GetImageStatus(&status);
if ((status & imgIRequest::STATUS_LOAD_COMPLETE) == 0) {
// The load has not completed yet.
return false;
}
nsCOMPtr<nsIPrincipal> principal;
rv = currentRequest->GetImagePrincipal(getter_AddRefs(principal));
if (NS_FAILED(rv) || !principal) {
return true;
}
int32_t corsmode;
if (NS_SUCCEEDED(currentRequest->GetCORSMode(&corsmode)) &&
corsmode != imgIRequest::CORS_NONE) {
// If CORS was used to load the image, the page is allowed to read from it.
return false;
}
// Ignore document.domain in this check.
bool subsumes;
rv = aReferencePrincipal->SubsumesIgnoringDomain(principal, &subsumes);
if (NS_SUCCEEDED(rv) && subsumes) {
// The page is allowed to read from the image.
return false;
}
return true;
}
//----------------------------------------------------------------------
// nsSVGElement methods

View File

@ -41,10 +41,13 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }
virtual bool OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
nsIPrincipal* aReferencePrincipal) MOZ_OVERRIDE;
// nsIContent
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -30,6 +30,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEMergeElement)
FilterPrimitiveDescription
SVGFEMergeElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
return FilterPrimitiveDescription(FilterPrimitiveDescription::eMerge);

View File

@ -32,6 +32,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources) MOZ_OVERRIDE;

View File

@ -114,6 +114,7 @@ SVGFEMorphologyElement::GetRXY(int32_t *aRX, int32_t *aRY,
FilterPrimitiveDescription
SVGFEMorphologyElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
int32_t rx, ry;

View File

@ -35,6 +35,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -72,6 +72,7 @@ SVGFEOffsetElement::GetOffset(const nsSVGFilterInstance& aInstance)
FilterPrimitiveDescription
SVGFEOffsetElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
FilterPrimitiveDescription descr(FilterPrimitiveDescription::eOffset);

View File

@ -34,6 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -70,6 +70,7 @@ SVGFESpecularLightingElement::KernelUnitLengthY()
FilterPrimitiveDescription
SVGFESpecularLightingElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
float specularExponent = mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue();

View File

@ -36,6 +36,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const;

View File

@ -51,6 +51,7 @@ SVGFETileElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
FilterPrimitiveDescription
SVGFETileElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
return FilterPrimitiveDescription(FilterPrimitiveDescription::eTile);

View File

@ -34,6 +34,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -121,6 +121,7 @@ SVGFETurbulenceElement::Type()
FilterPrimitiveDescription
SVGFETurbulenceElement::GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<RefPtr<SourceSurface>>& aInputImages)
{
float fX = mNumberPairAttributes[BASE_FREQ].GetAnimValue(nsSVGNumberPair::eFirst);

View File

@ -38,6 +38,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;

View File

@ -85,6 +85,20 @@ nsSVGFE::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{
}
bool
nsSVGFE::OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
nsIPrincipal* aReferencePrincipal)
{
// This is the default implementation for OutputIsTainted.
// Our output is tainted if we have at least one tainted input.
for (uint32_t i = 0; i < aInputsAreTainted.Length(); i++) {
if (aInputsAreTainted[i]) {
return true;
}
}
return false;
}
bool
nsSVGFE::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const

View File

@ -96,6 +96,7 @@ public:
virtual FilterPrimitiveDescription
GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
const IntRect& aFilterSubregion,
const nsTArray<bool>& aInputsAreTainted,
nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) = 0;
// returns true if changes to the attribute should cause us to
@ -103,6 +104,13 @@ public:
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const;
// Return whether this filter primitive has tainted output. A filter's
// output is tainted if it depends on things that the web page is not
// allowed to read from, e.g. the source graphic or cross-origin images.
// aReferencePrincipal is the node principal of the filtered frame's element.
virtual bool OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
nsIPrincipal* aReferencePrincipal);
static nsIntRect GetMaxRect() {
// Try to avoid overflow errors dealing with this rect. It will
// be intersected with some other reasonable-sized rect eventually.

View File

@ -181,7 +181,7 @@ CollectWindowReports(nsGlobalWindow *aWindow,
nsIMemoryReporterCallback *aCb,
nsISupports *aClosure)
{
nsAutoCString windowPath;
nsAutoCString windowPath("explicit/");
// Avoid calling aWindow->GetTop() if there's no outer window. It will work
// just fine, but will spew a lot of warnings.
@ -233,20 +233,17 @@ CollectWindowReports(nsGlobalWindow *aWindow,
AppendWindowURI(aWindow, windowPath);
windowPath += NS_LITERAL_CSTRING(")");
nsCString explicitWindowPath("explicit/");
explicitWindowPath += windowPath;
// XXXkhuey
nsCString censusWindowPath("event-counts/");
censusWindowPath += windowPath;
// Use |windowPath|, but replace "explicit/" with "event-counts/".
nsCString censusWindowPath(windowPath);
censusWindowPath.Replace(0, strlen("explicit"), "event-counts");
// Remember the path for later.
aWindowPaths->Put(aWindow->WindowID(), explicitWindowPath);
aWindowPaths->Put(aWindow->WindowID(), windowPath);
#define REPORT_SIZE(_pathTail, _amount, _desc) \
do { \
if (_amount > 0) { \
nsAutoCString path(explicitWindowPath); \
nsAutoCString path(windowPath); \
path += _pathTail; \
nsresult rv; \
rv = aCb->Callback(EmptyCString(), path, nsIMemoryReporter::KIND_HEAP, \

View File

@ -87,6 +87,23 @@ ThrowInvalidThis(JSContext* aCx, const JS::CallArgs& aArgs,
return false;
}
bool
ThrowInvalidThis(JSContext* aCx, const JS::CallArgs& aArgs,
const ErrNum aErrorNumber,
prototypes::ID aProtoId)
{
return ThrowInvalidThis(aCx, aArgs, aErrorNumber,
NamesOfInterfacesWithProtos[aProtoId]);
}
bool
ThrowNoSetterArg(JSContext* aCx, prototypes::ID aProtoId)
{
nsPrintfCString errorMessage("%s attribute setter",
NamesOfInterfacesWithProtos[aProtoId]);
return ThrowErrorMessage(aCx, MSG_MISSING_ARGUMENTS, errorMessage.get());
}
} // namespace dom
struct ErrorResult::Message {
@ -2185,5 +2202,94 @@ EnumerateGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj)
return JS_EnumerateStandardClasses(aCx, aObj);
}
bool
GenericBindingGetter(JSContext* cx, unsigned argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
const JSJitInfo *info = FUNCTION_VALUE_TO_JITINFO(args.calleev());
prototypes::ID protoID = static_cast<prototypes::ID>(info->protoID);
if (!args.thisv().isObject()) {
return ThrowInvalidThis(cx, args,
MSG_GETTER_THIS_DOES_NOT_IMPLEMENT_INTERFACE,
protoID);
}
JS::Rooted<JSObject*> obj(cx, &args.thisv().toObject());
void* self;
{
nsresult rv = UnwrapObject<void>(obj, self, protoID, info->depth);
if (NS_FAILED(rv)) {
return ThrowInvalidThis(cx, args,
GetInvalidThisErrorForGetter(rv == NS_ERROR_XPC_SECURITY_MANAGER_VETO),
protoID);
}
}
MOZ_ASSERT(info->type == JSJitInfo::Getter);
JSJitGetterOp getter = info->getter;
return getter(cx, obj, self, JSJitGetterCallArgs(args));
}
bool
GenericBindingSetter(JSContext* cx, unsigned argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
const JSJitInfo *info = FUNCTION_VALUE_TO_JITINFO(args.calleev());
prototypes::ID protoID = static_cast<prototypes::ID>(info->protoID);
if (!args.thisv().isObject()) {
return ThrowInvalidThis(cx, args,
MSG_SETTER_THIS_DOES_NOT_IMPLEMENT_INTERFACE,
protoID);
}
JS::Rooted<JSObject*> obj(cx, &args.thisv().toObject());
void* self;
{
nsresult rv = UnwrapObject<void>(obj, self, protoID, info->depth);
if (NS_FAILED(rv)) {
return ThrowInvalidThis(cx, args,
GetInvalidThisErrorForSetter(rv == NS_ERROR_XPC_SECURITY_MANAGER_VETO),
protoID);
}
}
if (args.length() == 0) {
return ThrowNoSetterArg(cx, protoID);
}
MOZ_ASSERT(info->type == JSJitInfo::Setter);
JSJitSetterOp setter = info->setter;
if (!setter(cx, obj, self, JSJitSetterCallArgs(args))) {
return false;
}
args.rval().set(JSVAL_VOID);
return true;
}
bool
GenericBindingMethod(JSContext* cx, unsigned argc, JS::Value* vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
const JSJitInfo *info = FUNCTION_VALUE_TO_JITINFO(args.calleev());
prototypes::ID protoID = static_cast<prototypes::ID>(info->protoID);
if (!args.thisv().isObject()) {
return ThrowInvalidThis(cx, args,
MSG_METHOD_THIS_DOES_NOT_IMPLEMENT_INTERFACE,
protoID);
}
JS::Rooted<JSObject*> obj(cx, &args.thisv().toObject());
void* self;
{
nsresult rv = UnwrapObject<void>(obj, self, protoID, info->depth);
if (NS_FAILED(rv)) {
return ThrowInvalidThis(cx, args,
GetInvalidThisErrorForMethod(rv == NS_ERROR_XPC_SECURITY_MANAGER_VETO),
protoID);
}
}
MOZ_ASSERT(info->type == JSJitInfo::Method);
JSJitMethodOp method = info->method;
return method(cx, obj, self, JSJitMethodCallArgs(args));
}
} // namespace dom
} // namespace mozilla

View File

@ -93,6 +93,11 @@ ThrowInvalidThis(JSContext* aCx, const JS::CallArgs& aArgs,
const ErrNum aErrorNumber,
const char* aInterfaceName);
bool
ThrowInvalidThis(JSContext* aCx, const JS::CallArgs& aArgs,
const ErrNum aErrorNumber,
prototypes::ID aProtoId);
inline bool
ThrowMethodFailedWithDetails(JSContext* cx, ErrorResult& rv,
const char* ifaceName,
@ -202,9 +207,10 @@ IsDOMObject(JSObject* obj)
// (for example, overload resolution uses unwrapping to tell what sort
// of thing it's looking at).
// U must be something that a T* can be assigned to (e.g. T* or an nsRefPtr<T>).
template <prototypes::ID PrototypeID, class T, typename U>
template <class T, typename U>
MOZ_ALWAYS_INLINE nsresult
UnwrapObject(JSObject* obj, U& value)
UnwrapObject(JSObject* obj, U& value, prototypes::ID protoID,
uint32_t protoDepth)
{
/* First check to see whether we have a DOM object */
const DOMClass* domClass = GetDOMClass(obj);
@ -230,8 +236,7 @@ UnwrapObject(JSObject* obj, U& value)
/* This object is a DOM object. Double-check that it is safely
castable to T by checking whether it claims to inherit from the
class identified by protoID. */
if (domClass->mInterfaceChain[PrototypeTraits<PrototypeID>::Depth] ==
PrototypeID) {
if (domClass->mInterfaceChain[protoDepth] == protoID) {
value = UnwrapDOMObject<T>(obj);
return NS_OK;
}
@ -240,6 +245,14 @@ UnwrapObject(JSObject* obj, U& value)
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
template <prototypes::ID PrototypeID, class T, typename U>
MOZ_ALWAYS_INLINE nsresult
UnwrapObject(JSObject* obj, U& value)
{
return UnwrapObject<T>(obj, value, PrototypeID,
PrototypeTraits<PrototypeID>::Depth);
}
inline bool
IsNotDateOrRegExp(JSContext* cx, JS::Handle<JSObject*> obj)
{
@ -2350,6 +2363,15 @@ CreateGlobal(JSContext* aCx, T* aObject, nsWrapperCache* aCache,
return global;
}
bool
GenericBindingGetter(JSContext* cx, unsigned argc, JS::Value* vp);
bool
GenericBindingSetter(JSContext* cx, unsigned argc, JS::Value* vp);
bool
GenericBindingMethod(JSContext* cx, unsigned argc, JS::Value* vp);
} // namespace dom
} // namespace mozilla

View File

@ -1588,8 +1588,10 @@ class MethodDefiner(PropertyDefiner):
jitinfo = ("&%s_methodinfo" % accessor)
if m.get("allowCrossOriginThis", False):
accessor = "genericCrossOriginMethod"
else:
elif self.descriptor.needsSpecialGenericOps():
accessor = "genericMethod"
else:
accessor = "GenericBindingMethod"
else:
jitinfo = "nullptr"
@ -1646,8 +1648,10 @@ class AttrDefiner(PropertyDefiner):
accessor = "genericLenientGetter"
elif attr.getExtendedAttribute("CrossOriginReadable"):
accessor = "genericCrossOriginGetter"
else:
elif self.descriptor.needsSpecialGenericOps():
accessor = "genericGetter"
else:
accessor = "GenericBindingGetter"
jitinfo = "&%s_getterinfo" % attr.identifier.name
return "{ JS_CAST_NATIVE_TO(%s, JSPropertyOp), %s }" % \
(accessor, jitinfo)
@ -1665,8 +1669,10 @@ class AttrDefiner(PropertyDefiner):
accessor = "genericLenientSetter"
elif attr.getExtendedAttribute("CrossOriginWritable"):
accessor = "genericCrossOriginSetter"
else:
elif self.descriptor.needsSpecialGenericOps():
accessor = "genericSetter"
else:
accessor = "GenericBindingSetter"
jitinfo = "&%s_setterinfo" % attr.identifier.name
return "{ JS_CAST_NATIVE_TO(%s, JSStrictPropertyOp), %s }" % \
(accessor, jitinfo)
@ -8629,7 +8635,7 @@ class CGDescriptor(CGThing):
continue
if (m.isMethod() and m == descriptor.operations['Jsonifier']):
hasJsonifier = True
hasMethod = True
hasMethod = descriptor.needsSpecialGenericOps()
jsonifierMethod = m
elif (m.isMethod() and
(not m.isIdentifierLess() or m == descriptor.operations['Stringifier'])):
@ -8641,7 +8647,7 @@ class CGDescriptor(CGThing):
cgThings.append(CGMemberJITInfo(descriptor, m))
if m.getExtendedAttribute("CrossOriginCallable"):
crossOriginMethods.add(m.identifier.name)
else:
elif descriptor.needsSpecialGenericOps():
hasMethod = True
elif m.isAttr():
if m.isStatic():
@ -8653,7 +8659,7 @@ class CGDescriptor(CGThing):
hasLenientGetter = True
elif m.getExtendedAttribute("CrossOriginReadable"):
crossOriginGetters.add(m.identifier.name)
else:
elif descriptor.needsSpecialGenericOps():
hasGetter = True
if not m.readonly:
if m.isStatic():
@ -8665,16 +8671,17 @@ class CGDescriptor(CGThing):
hasLenientSetter = True
elif m.getExtendedAttribute("CrossOriginWritable"):
crossOriginSetters.add(m.identifier.name)
else:
elif descriptor.needsSpecialGenericOps():
hasSetter = True
elif m.getExtendedAttribute("PutForwards"):
cgThings.append(CGSpecializedForwardingSetter(descriptor, m))
if m.getExtendedAttribute("CrossOriginWritable"):
crossOriginSetters.add(m.identifier.name)
else:
elif descriptor.needsSpecialGenericOps():
hasSetter = True
elif m.getExtendedAttribute("Replaceable"):
cgThings.append(CGSpecializedReplaceableSetter(descriptor, m))
if descriptor.needsSpecialGenericOps():
hasSetter = True
if (not m.isStatic() and
descriptor.interface.hasInterfacePrototypeObject()):
@ -8895,7 +8902,7 @@ class CGNamespacedEnum(CGThing):
def declare(self):
return self.node.declare()
def define(self):
assert False # Only for headers.
return ""
class CGDictionary(CGThing):
def __init__(self, dictionary, descriptorProvider):
@ -11411,11 +11418,14 @@ class GlobalGenRoots():
remaining = [CGGeneric(declare="prototypes::id::_ID_Count")] * (config.maxProtoChainLength - ifaceCount)
macro = CGWrapper(CGList(supplied, ", "),
pre="#define INTERFACE_CHAIN_" + str(ifaceCount) + "(",
post=") \\\n")
post=") \\\n",
declareOnly=True)
macroContent = CGIndenter(CGList(supplied + remaining, ", \\\n"))
macroContent = CGIndenter(CGWrapper(macroContent, pre="{ \\\n",
post=" \\\n}"))
return CGWrapper(CGList([macro, macroContent]), post="\n\n")
post=" \\\n}",
declareOnly=True))
return CGWrapper(CGList([macro, macroContent]), post="\n\n",
declareOnly=True)
idEnum.append(ifaceChainMacro(1))
@ -11448,6 +11458,18 @@ struct PrototypeTraits;
""")]
traitsDecls.extend(CGPrototypeTraitsClass(d) for d in descriptorsWithPrototype)
ifaceNamesWithProto = [' "%s"' % d.interface.identifier.name
for d in descriptorsWithPrototype]
traitsDecls.append(CGGeneric(
declare=("extern const char* const NamesOfInterfacesWithProtos[%d];\n\n" %
len(ifaceNamesWithProto)),
define=("\n"
"extern const char* const NamesOfInterfacesWithProtos[%d] = {\n"
"%s"
"\n};\n\n" %
(len(ifaceNamesWithProto),
",\n".join(ifaceNamesWithProto)))))
traitsDecl = CGNamespace.build(['mozilla', 'dom'],
CGList(traitsDecls, "\n"))

View File

@ -494,6 +494,16 @@ class Descriptor(DescriptorProvider):
any((m.isAttr() or m.isMethod()) and m.isStatic() for m
in self.interface.members))
def needsSpecialGenericOps(self):
"""
Returns true if this descriptor requires generic ops other than
GenericBindingMethod/GenericBindingGetter/GenericBindingSetter.
In practice we need to do this if our this value might be an XPConnect
object or if we need to coerce null/undefined to the global.
"""
return self.hasXPConnectImpls or self.interface.isOnGlobalProtoChain()
# Some utility methods
def getTypesFromDescriptor(descriptor):
"""

View File

@ -138,6 +138,7 @@ class WebIDLCodegenManager(LoggingMixin):
GLOBAL_DEFINE_FILES = {
'RegisterBindings.cpp',
'UnionTypes.cpp',
'PrototypeList.cpp',
}
def __init__(self, config_path, inputs, exported_header_dir,

View File

@ -14,7 +14,7 @@
* http://www.w3.org/TR/DOM-Level-2-Core/
*/
[scriptable, builtinclass, uuid(a974a4d3-2ff1-445b-8b8e-0aada5d4eedc)]
[scriptable, builtinclass, uuid(58f9b5f5-0e39-4999-85b1-095895569c0e)]
interface nsIDOMAttr : nsIDOMNode
{
readonly attribute DOMString name;
@ -22,8 +22,5 @@ interface nsIDOMAttr : nsIDOMNode
attribute DOMString value;
// raises(DOMException) on setting
// Introduced in DOM Level 2:
readonly attribute nsIDOMElement ownerElement;
readonly attribute boolean isId;
};

View File

@ -49,7 +49,6 @@ RemoveAttributeNodeWarning=Use of removeAttributeNode() is deprecated. Use remov
CreateAttributeWarning=Use of document.createAttribute() is deprecated. Use element.setAttribute() instead.
CreateAttributeNSWarning=Use of document.createAttributeNS() is deprecated. Use element.setAttributeNS() instead.
SpecifiedWarning=Use of attributes' specified attribute is deprecated. It always returns true.
OwnerElementWarning=Use of attributes' ownerElement attribute is deprecated.
NodeValueWarning=Use of attributes' nodeValue attribute is deprecated. Use value instead.
TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead.
EnablePrivilegeWarning=Use of enablePrivilege is deprecated. Please use code that runs with the system principal (e.g. an extension) instead.

View File

@ -208,45 +208,73 @@ RTCSessionDescription.prototype = {
}
};
function RTCStatsReport(win, report, pcid) {
function RTCStatsReport(win, dict) {
function appendStats(stats, report) {
stats.forEach(function(stat) {
report[stat.id] = stat;
});
}
this._win = win;
this.report = report;
this.mozPcid = pcid;
this._pcid = dict.pcid;
this._report = {};
appendStats(dict.inboundRTPStreamStats, this._report);
appendStats(dict.outboundRTPStreamStats, this._report);
appendStats(dict.mediaStreamTrackStats, this._report);
appendStats(dict.mediaStreamStats, this._report);
appendStats(dict.transportStats, this._report);
appendStats(dict.iceComponentStats, this._report);
appendStats(dict.iceCandidatePairStats, this._report);
appendStats(dict.iceCandidateStats, this._report);
appendStats(dict.codecStats, this._report);
}
RTCStatsReport.prototype = {
classDescription: "RTCStatsReport",
classID: PC_STATS_CID,
contractID: PC_STATS_CONTRACT,
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
Ci.nsIDOMGlobalPropertyInitializer]),
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
// TODO: Change to use webidl getters once available (Bug 952122)
//
// Since webidl getters are not available, we make the stats available as
// enumerable read-only properties directly on our content-facing object.
// Must be called after our webidl sandwich is made.
makeStatsPublic: function() {
let props = {};
this.forEach(function(stat) {
props[stat.id] = { enumerable: true, configurable: false,
writable: false, value: stat };
});
Object.defineProperties(this.__DOM_IMPL__.wrappedJSObject, props);
},
forEach: function(cb, thisArg) {
for (var key in this.report) {
if (this.report.hasOwnProperty(key)) {
cb.call(thisArg || this, this.get(key), key, this.report);
}
for (var key in this._report) {
cb.call(thisArg || this._report, this.get(key), key, this._report);
}
},
get: function(key) {
function publify(win, obj) {
function publifyReadonly(win, obj) {
let props = {};
for (let k in obj) {
props[k] = {enumerable:true, configurable:true, writable:true, value:obj[k]};
props[k] = {enumerable:true, configurable:false, writable:false, value:obj[k]};
}
let pubobj = Cu.createObjectIn(win);
Object.defineProperties(pubobj, props);
Cu.makeObjectPropsNormal(pubobj);
return pubobj;
}
// Return a content object rather than a wrapped chrome one.
return publify(this._win, this.report[key]);
return publifyReadonly(this._win, this._report[key]);
},
has: function(key) {
return this.report[key] !== undefined;
}
return this._report[key] !== undefined;
},
get mozPcid() { return this._pcid; }
};
function RTCPeerConnection() {
@ -1138,31 +1166,11 @@ PeerConnectionObserver.prototype = {
},
onGetStatsSuccess: function(dict) {
function appendStats(stats, report) {
if (stats) {
stats.forEach(function(stat) {
report[stat.id] = stat;
});
}
}
let report = {};
appendStats(dict.rtpStreamStats, report);
appendStats(dict.inboundRTPStreamStats, report);
appendStats(dict.outboundRTPStreamStats, report);
appendStats(dict.mediaStreamTrackStats, report);
appendStats(dict.mediaStreamStats, report);
appendStats(dict.transportStats, report);
appendStats(dict.iceComponentStats, report);
appendStats(dict.iceCandidatePairStats, report);
appendStats(dict.iceCandidateStats, report);
appendStats(dict.codecStats, report);
this.callCB(this._dompc._onGetStatsSuccess,
this._dompc._win.RTCStatsReport._create(this._dompc._win,
new RTCStatsReport(this._dompc._win,
report,
dict.pcid)));
let chromeobj = new RTCStatsReport(this._dompc._win, dict);
let webidlobj = this._dompc._win.RTCStatsReport._create(this._dompc._win,
chromeobj);
chromeobj.makeStatsPublic();
this.callCB(this._dompc._onGetStatsSuccess, webidlobj);
this._dompc._executeNext();
},

View File

@ -1432,6 +1432,66 @@ PeerConnectionWrapper.prototype = {
_checkMediaFlowPresent(0, onSuccess);
},
/**
* Check that stats are present by checking for known stats.
*
* @param {Function} onSuccess the success callback to return stats to
*/
getStats : function PCW_getStats(selector, onSuccess) {
var self = this;
this._pc.getStats(selector, function(stats) {
info(self + ": Got stats: " + JSON.stringify(stats));
self._last_stats = stats;
onSuccess(stats);
}, unexpectedCallbackAndFinish());
},
/**
* Checks that we are getting the media streams we expect.
*
* @param {object} stats
* The stats to check from this PeerConnectionWrapper
*/
checkStats : function PCW_checkStats(stats) {
function toNum(obj) {
return obj? obj : 0;
}
function numTracks(streams) {
var n = 0;
streams.forEach(function(stream) {
n += stream.getAudioTracks().length + stream.getVideoTracks().length;
});
return n;
}
// Use spec way of enumerating stats
var counters = {};
for (var key in stats) {
if (stats.hasOwnProperty(key)) {
var res = stats[key];
counters[res.type] = toNum(counters[res.type]) + 1;
}
}
// Use MapClass way of enumerating stats
var counters2 = {};
stats.forEach(function(res) {
counters2[res.type] = toNum(counters2[res.type]) + 1;
});
is(JSON.stringify(counters), JSON.stringify(counters2),
"Spec and MapClass variant of RTCStatsReport enumeration agree");
var nin = numTracks(this._pc.getRemoteStreams());
var nout = numTracks(this._pc.getLocalStreams());
// TODO(Bug 957145): Restore stronger inboundrtp test once Bug 948249 is fixed
//is(toNum(counters["inboundrtp"]), nin, "Have " + nin + " inboundrtp stat(s)");
ok(toNum(counters["inboundrtp"]) >= nin, "Have at least " + nin + " inboundrtp stat(s) *");
is(toNum(counters["outboundrtp"]), nout, "Have " + nout + " outboundrtp stat(s)");
ok(toNum(counters["localcandidate"]), "Have localcandidate stat(s)");
ok(toNum(counters["remotecandidate"]), "Have remotecandidate stat(s)");
},
/**
* Closes the connection
*/

View File

@ -211,6 +211,24 @@ var commandsPeerConnection = [
test.next();
});
}
],
[
'PC_LOCAL_CHECK_STATS',
function (test) {
test.pcLocal.getStats(null, function(stats) {
test.pcLocal.checkStats(stats);
test.next();
});
}
],
[
'PC_REMOTE_CHECK_STATS',
function (test) {
test.pcRemote.getStats(null, function(stats) {
test.pcRemote.checkStats(stats);
test.next();
});
}
]
];

View File

@ -29,11 +29,6 @@ support-files =
files/xhtml1-strict.dtd
files/xhtml1-transitional.dtd
[test_attrgetownerelement01.html]
[test_attrgetownerelement02.html]
[test_attrgetownerelement03.html]
[test_attrgetownerelement04.html]
[test_attrgetownerelement05.html]
[test_createAttributeNS01.html]
[test_createAttributeNS02.html]
[test_createAttributeNS03.html]
@ -240,8 +235,6 @@ support-files =
[test_nodenormalize01.html]
[test_normalize01.html]
[test_ownerDocument01.html]
[test_ownerElement01.html]
[test_ownerElement02.html]
[test_prefix01.html]
[test_prefix02.html]
[test_prefix03.html]

View File

@ -1,134 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement01</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="DOMTestCase.js"></script>
<script type="text/javascript" src="exclusions.js"></script>
<script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['attrgetownerelement01'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
setImplementationAttribute("namespaceAware", true);
setImplementationAttribute("validating", true);
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "staffNS");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
markTodos();
SimpleTest.finish();
}
}
var docName = 'attrgetownerelement01';
/**
*
The "getOwnerElement()" will return the Element node this attribute is attached to or
null if this attribute is not in use.
Retreive the default attribute defaultAttr and check its owner element. Verify if the name
the nodeName of the returned ownerElement is emp:employee.
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
*/
function attrgetownerelement01() {
var success;
if(checkInitialization(builder, "attrgetownerelement01") != null) return;
var doc;
var attr;
var element;
var ownerElement;
var ownerElementName;
var elementList;
var attributes;
var nullNS = null;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "staffNS");
elementList = doc.getElementsByTagNameNS("http://www.nist.gov","employee");
element = elementList.item(1);
attributes = element.attributes;
attr = attributes.getNamedItemNS(nullNS,"defaultAttr");
ownerElement = attr.ownerElement;
ownerElementName = ownerElement.nodeName;
assertEquals("attrgetownerelement01","emp:employee",ownerElementName);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement01</h2>
<p></p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University). All
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</p>
</body>
</html>

View File

@ -1,127 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement02</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="DOMTestCase.js"></script>
<script type="text/javascript" src="exclusions.js"></script>
<script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['attrgetownerelement02'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
setImplementationAttribute("namespaceAware", true);
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "staffNS");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
markTodos();
SimpleTest.finish();
}
}
var docName = 'attrgetownerelement02';
/**
*
The "getOwnerElement()" will return the Element node this attribute
is attached to or null if this attribute is not in use.
Create a new element and attribute node, attach the attribute to the element.
Check the value of owner element of the new attribute node
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
*/
function attrgetownerelement02() {
var success;
if(checkInitialization(builder, "attrgetownerelement02") != null) return;
var doc;
var element;
var ownerElement;
var ownerElementName;
var attr;
var newAttr;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "staffNS");
element = doc.createElement("root");
attr = doc.createAttributeNS("http://www.w3.org/DOM/L1","L1:att");
newAttr = element.setAttributeNodeNS(attr);
ownerElement = attr.ownerElement;
ownerElementName = ownerElement.nodeName;
assertEquals("attrgetownerelement02","root".toLowerCase(),ownerElementName.toLowerCase());
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement02</h2>
<p></p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University). All
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</p>
</body>
</html>

View File

@ -1,119 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement03</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="DOMTestCase.js"></script>
<script type="text/javascript" src="exclusions.js"></script>
<script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['attrgetownerelement03'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "staffNS");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
markTodos();
SimpleTest.finish();
}
}
var docName = 'attrgetownerelement03';
/**
*
The "getOwnerElement()" will return the Element node this attribute
is attached to or null if this attribute is not in use.
Create a new attribute node for this document node. Since the newly attribute is
not it use its owner element should be null.
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
*/
function attrgetownerelement03() {
var success;
if(checkInitialization(builder, "attrgetownerelement03") != null) return;
var doc;
var ownerElement;
var attr;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "staffNS");
attr = doc.createAttributeNS("http://www.w3.org/DOM","dom:attr");
ownerElement = attr.ownerElement;
assertNull("attrgetownerelement03",ownerElement);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement03</h2>
<p></p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University). All
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</p>
</body>
</html>

View File

@ -1,140 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement04</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="DOMTestCase.js"></script>
<script type="text/javascript" src="exclusions.js"></script>
<script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['attrgetownerelement04'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
setImplementationAttribute("namespaceAware", true);
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "staffNS");
var docImpRef = null;
if (typeof(this.docImp) != 'undefined') {
docImpRef = this.docImp;
}
docsLoaded += preload(docImpRef, "docImp", "staff");
if (docsLoaded == 2) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 2) {
setUpPageStatus = 'complete';
runJSUnitTests();
markTodos();
SimpleTest.finish();
}
}
var docName = 'attrgetownerelement04';
/**
*
The "getOwnerElement()" will return the Element node this attribute is attached to or
null if this attribute is not in use.
Import an attribute node to another document. If an Attr node is imported, its
ownerElement attribute should be set to null. Verify if the ownerElement has been set
to null.
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
*/
function attrgetownerelement04() {
var success;
if(checkInitialization(builder, "attrgetownerelement04") != null) return;
var doc;
var docImp;
var ownerElement;
var element;
var attr;
var attrImp;
var addresses;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "staffNS");
var docImpRef = null;
if (typeof(this.docImp) != 'undefined') {
docImpRef = this.docImp;
}
docImp = load(docImpRef, "docImp", "staff");
addresses = doc.getElementsByTagNameNS("http://www.nist.gov","address");
element = addresses.item(1);
assertNotNull("empAddressNotNull",element);
attr = element.getAttributeNodeNS("http://www.nist.gov","zone");
attrImp = docImp.importNode(attr,true);
ownerElement = attrImp.ownerElement;
assertNull("attrgetownerelement04",ownerElement);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement04</h2>
<p></p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University). All
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</p>
</body>
</html>

View File

@ -1,138 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement05</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="DOMTestCase.js"></script>
<script type="text/javascript" src="exclusions.js"></script>
<script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['attrgetownerelement05'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
setImplementationAttribute("namespaceAware", true);
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "staffNS");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
markTodos();
SimpleTest.finish();
}
}
var docName = 'attrgetownerelement05';
/**
*
The "getOwnerElement()" will return the Element node this attribute is attached to
or null if this attribute is not in use.
Retreive an element and its attributes. Then remove the element and check the name of
the ownerElement of attribute of the attribute "street".
* @author IBM
* @author Neil Delima
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
* @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=259
*/
function attrgetownerelement05() {
var success;
if(checkInitialization(builder, "attrgetownerelement05") != null) return;
var doc;
var element;
var ownerElement;
var parentElement;
var elementList;
var ownerElementName;
var attr;
var removedChild;
var nodeMap;
var nullNS = null;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "staffNS");
elementList = doc.getElementsByTagNameNS("*","address");
element = elementList.item(1);
parentElement = element.parentNode;
nodeMap = element.attributes;
removedChild = parentElement.removeChild(element);
attr = nodeMap.getNamedItemNS(nullNS,"street");
ownerElement = attr.ownerElement;
ownerElementName = ownerElement.nodeName;
assertEquals("attrgetownerelement05","address",ownerElementName);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/attrgetownerelement05</h2>
<p></p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University). All
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</p>
</body>
</html>

View File

@ -144,9 +144,6 @@ function importNode01() {
assertNotNull("aNode",aNode);
assertURIEquals("systemId",null,null,null,"staffNS.dtd",null,null,null,null,system);
attrOwnerElement = aNode.ownerElement;
assertNull("ownerElement",attrOwnerElement);
specified = aNode.specified;
assertTrue("specified",specified);

View File

@ -1,129 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement01</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="DOMTestCase.js"></script>
<script type="text/javascript" src="exclusions.js"></script>
<script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['ownerElement01'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "staff");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
markTodos();
SimpleTest.finish();
}
}
var docName = 'ownerElement01';
/**
*
The "getOwnerElement()" will return the Element node this attribute
is attached to or null if this attribute is not in use.
Get the "domestic" attribute from the first "address" node.
Apply the "getOwnerElement()" method to get the Element associated
with the attribute. The value returned should be "address".
* @author NIST
* @author Mary Brady
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#ID-F68D095
*/
function ownerElement01() {
var success;
if(checkInitialization(builder, "ownerElement01") != null) return;
var doc;
var addressList;
var testNode;
var attributes;
var domesticAttr;
var elementNode;
var name;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "staff");
addressList = doc.getElementsByTagName("address");
testNode = addressList.item(0);
attributes = testNode.attributes;
domesticAttr = attributes.getNamedItem("domestic");
elementNode = domesticAttr.ownerElement;
name = elementNode.nodeName;
assertEquals("throw_Equals","address",name);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement01</h2>
<p></p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University). All
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</p>
</body>
</html>

View File

@ -1,120 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement02</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="DOMTestCase.js"></script>
<script type="text/javascript" src="exclusions.js"></script>
<script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['ownerElement02'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "staff");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
markTodos();
SimpleTest.finish();
}
}
var docName = 'ownerElement02';
/**
*
The "getOwnerElement()" will return the Element node this attribute
is attached to or null if this attribute is not in use.
Create a new attribute.
Apply the "getOwnerElement()" method to get the Element associated
with the attribute. The value returned should be "null" since this
attribute is not in use.
* @author NIST
* @author Mary Brady
* @see http://www.w3.org/TR/DOM-Level-2-Core/core#Attr-ownerElement
*/
function ownerElement02() {
var success;
if(checkInitialization(builder, "ownerElement02") != null) return;
var doc;
var newAttr;
var elementNode;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "staff");
newAttr = doc.createAttribute("newAttribute");
elementNode = newAttr.ownerElement;
assertNull("throw_Null",elementNode);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/core/ownerElement02</h2>
<p></p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University). All
Rights Reserved. This work is distributed under the <a href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">W3C(r) Software License</a> in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</p>
</body>
</html>

View File

@ -24,8 +24,4 @@ interface Attr : Node {
partial interface Attr {
readonly attribute boolean specified;
[GetterThrows]
readonly attribute Element? ownerElement;
};

View File

@ -58,9 +58,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=319374
// Test 2: If the context node is in anonymous content, changing some
// other anonymous tree shouldn't cause XPath result to throw.
var anonAttr1 =
var anonElem1 =
getAnonymousNodes(document.getElementById('content').
firstChild)[0].getAttributeNode('attr');
firstChild)[0];
var anonAttr1 = anonElem1.getAttributeNode('attr');
var anonAttr2 =
getAnonymousNodes(document.getElementById('content').
lastChild)[0].getAttributeNode('attr');
@ -91,7 +92,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=319374
UNORDERED_NODE_ITERATOR_TYPE,
null);
// Attribute changing in the same anonymous tree.
anonAttr1.ownerElement.setAttribute("foo", "bar");
anonElem1.setAttribute("foo", "bar");
resultAttr = xp3.iterateNext();
ok(resultAttr == anonAttr1,
"XPathEvaluator should have thrown an exception!")

View File

@ -247,13 +247,16 @@ class UnboundnessFixer
{
if (!IsOperatorBoundByMask(blend)) {
mClipBounds = CGContextGetClipBoundingBox(baseCg);
if (CGRectIsEmpty(mClipBounds)) {
return baseCg;
}
// TransparencyLayers aren't blended using the blend mode so
// we are forced to use CGLayers
//XXX: The size here is in default user space units, of the layer relative to the graphics context.
// is the clip bounds still correct if, for example, we have a scale applied to the context?
mLayer = CGLayerCreateWithContext(baseCg, mClipBounds.size, nullptr);
//XXX: if the size is 0x0 we get a nullptr CGContext back from GetContext
mCg = CGLayerGetContext(mLayer);
// CGContext's default to have the origin at the bottom left
// so flip it to the top left and adjust for the origin

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "DecomposeIntoNoRepeatTriangles.h"
#include "gfxMatrix.h"
namespace mozilla {
namespace gl {
@ -14,6 +15,19 @@ RectTriangles::addRect(GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1,
GLfloat tx0, GLfloat ty0, GLfloat tx1, GLfloat ty1,
bool flip_y /* = false */)
{
if (vertexCoords.IsEmpty() &&
x0 == 0.0f && y0 == 0.0f && x1 == 1.0f && y1 == 1.0f) {
mIsSimpleQuad = true;
if (flip_y) {
mTextureTransform = gfx3DMatrix::From2D(gfxMatrix(tx1 - tx0, 0, 0, ty0 - ty1, tx0, ty1));
} else {
mTextureTransform = gfx3DMatrix::From2D(gfxMatrix(tx1 - tx0, 0, 0, ty1 - ty0, tx0, ty0));
}
} else if (mIsSimpleQuad) {
mIsSimpleQuad = false;
mTextureTransform = gfx3DMatrix();
}
vert_coord v;
v.x = x0; v.y = y0;
vertexCoords.AppendElement(v);

View File

@ -10,6 +10,7 @@
#include "GLTypes.h"
#include "nsRect.h"
#include "nsTArray.h"
#include "gfx3DMatrix.h"
namespace mozilla {
namespace gl {
@ -18,7 +19,7 @@ namespace gl {
*/
class RectTriangles {
public:
RectTriangles() { }
RectTriangles() : mIsSimpleQuad(false) { }
// Always pass texture coordinates upright. If you want to flip the
// texture coordinates emitted to the tex_coords array, set flip_y to
@ -27,6 +28,16 @@ public:
GLfloat tx0, GLfloat ty0, GLfloat tx1, GLfloat ty1,
bool flip_y = false);
// Returns whether this object is made of only one rect that can be drawn
// with a pre-buffered unity quad which has 0,0,1,1 as both vertex
// positions and texture coordinates.
// aOutTextureTransform returns the transform that maps 0,0,1,1 texture
// coordinates to the correct ones.
bool IsSimpleQuad(gfx3DMatrix& aOutTextureTransform) const {
aOutTextureTransform = mTextureTransform;
return mIsSimpleQuad;
}
/**
* these return a float pointer to the start of each array respectively.
* Use it for glVertexAttribPointer calls.
@ -50,6 +61,8 @@ private:
// default is 4 rectangles, each made up of 2 triangles (3 coord vertices each)
nsAutoTArray<vert_coord, 6> vertexCoords;
nsAutoTArray<tex_coord, 6> texCoords;
gfx3DMatrix mTextureTransform;
bool mIsSimpleQuad;
};
/**

View File

@ -557,6 +557,9 @@ CompositorOGL::Initialize()
return true;
}
// |aTextureTransform| is the texture transform that will be set on
// aProg, possibly multiplied with another texture transform of our
// own.
// |aTexCoordRect| is the rectangle from the texture that we want to
// draw using the given program. The program already has a necessary
// offset and scale, so the geometry that needs to be drawn is a unit
@ -566,6 +569,7 @@ CompositorOGL::Initialize()
// larger than the rectangle given by |aTexCoordRect|.
void
CompositorOGL::BindAndDrawQuadWithTextureRect(ShaderProgramOGL *aProg,
const gfx3DMatrix& aTextureTransform,
const Rect& aTexCoordRect,
TextureSource *aTexture)
{
@ -622,8 +626,15 @@ CompositorOGL::BindAndDrawQuadWithTextureRect(ShaderProgramOGL *aProg,
rects, flipped);
}
gfx3DMatrix textureTransform;
if (rects.IsSimpleQuad(textureTransform)) {
aProg->SetTextureTransform(aTextureTransform * textureTransform);
BindAndDrawQuad(aProg, false);
} else {
aProg->SetTextureTransform(aTextureTransform);
DrawQuads(mGLContext, mVBOs, aProg, rects);
}
}
void
CompositorOGL::PrepareViewport(const gfx::IntSize& aSize,
@ -1191,12 +1202,11 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
AutoBindTexture bindSource(mGLContext, source->AsSourceOGL(), LOCAL_GL_TEXTURE0);
gfx3DMatrix textureTransform = source->AsSourceOGL()->GetTextureTransform();
program->SetTextureTransform(textureTransform);
GraphicsFilter filter = ThebesFilter(texturedEffect->mFilter);
gfxMatrix textureTransform2D;
gfx3DMatrix textureTransform = source->AsSourceOGL()->GetTextureTransform();
#ifdef MOZ_WIDGET_ANDROID
gfxMatrix textureTransform2D;
if (filter != GraphicsFilter::FILTER_NEAREST &&
aTransform.Is2DIntegerTranslation() &&
textureTransform.Is2D(&textureTransform2D) &&
@ -1218,7 +1228,8 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE1, maskQuadTransform);
}
BindAndDrawQuadWithTextureRect(program, texturedEffect->mTextureCoords, source);
BindAndDrawQuadWithTextureRect(program, textureTransform,
texturedEffect->mTextureCoords, source);
if (!texturedEffect->mPremultiplied) {
mGLContext->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
@ -1251,13 +1262,15 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
program->SetYCbCrTextureUnits(Y, Cb, Cr);
program->SetLayerOpacity(aOpacity);
program->SetTextureTransform(gfx3DMatrix());
AutoSaveTexture bindMask(mGLContext, LOCAL_GL_TEXTURE3);
if (maskType != MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE3, maskQuadTransform);
}
BindAndDrawQuadWithTextureRect(program, effectYCbCr->mTextureCoords, sourceYCbCr->GetSubSource(Y));
BindAndDrawQuadWithTextureRect(program,
gfx3DMatrix(),
effectYCbCr->mTextureCoords,
sourceYCbCr->GetSubSource(Y));
}
break;
case EFFECT_RENDER_TARGET: {
@ -1332,7 +1345,6 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
program->SetWhiteTextureUnit(1);
program->SetLayerOpacity(aOpacity);
program->SetLayerTransform(aTransform);
program->SetTextureTransform(gfx3DMatrix());
program->SetRenderOffset(offset.x, offset.y);
program->SetLayerQuadRect(aRect);
AutoSaveTexture bindMask(mGLContext, LOCAL_GL_TEXTURE2);
@ -1340,7 +1352,10 @@ CompositorOGL::DrawQuadInternal(const Rect& aRect,
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE2, maskQuadTransform);
}
BindAndDrawQuadWithTextureRect(program, effectComponentAlpha->mTextureCoords, effectComponentAlpha->mOnBlack);
BindAndDrawQuadWithTextureRect(program,
gfx3DMatrix(),
effectComponentAlpha->mTextureCoords,
effectComponentAlpha->mOnBlack);
mGLContext->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
LOCAL_GL_ONE, LOCAL_GL_ONE);

View File

@ -309,6 +309,7 @@ private:
bool aFlipped = false,
GLuint aDrawMode = LOCAL_GL_TRIANGLE_STRIP);
void BindAndDrawQuadWithTextureRect(ShaderProgramOGL *aProg,
const gfx3DMatrix& aTextureTransform,
const gfx::Rect& aTexCoordRect,
TextureSource *aTexture);

View File

@ -1471,6 +1471,7 @@ FilterSupport::ComputeSourceNeededRegions(const FilterDescription& aFilter,
FilterPrimitiveDescription::FilterPrimitiveDescription(PrimitiveType aType)
: mType(aType)
, mIsTainted(false)
{
}
@ -1481,6 +1482,7 @@ FilterPrimitiveDescription::FilterPrimitiveDescription(const FilterPrimitiveDesc
, mFilterPrimitiveSubregion(aOther.mFilterPrimitiveSubregion)
, mInputColorSpaces(aOther.mInputColorSpaces)
, mOutputColorSpace(aOther.mOutputColorSpace)
, mIsTainted(aOther.mIsTainted)
{
}
@ -1494,6 +1496,7 @@ FilterPrimitiveDescription::operator=(const FilterPrimitiveDescription& aOther)
mFilterPrimitiveSubregion = aOther.mFilterPrimitiveSubregion;
mInputColorSpaces = aOther.mInputColorSpaces;
mOutputColorSpace = aOther.mOutputColorSpace;
mIsTainted = aOther.mIsTainted;
}
return *this;
}

View File

@ -250,6 +250,7 @@ public:
AttributeMap& Attributes() { return mAttributes; }
IntRect PrimitiveSubregion() const { return mFilterPrimitiveSubregion; }
bool IsTainted() const { return mIsTainted; }
size_t NumberOfInputs() const { return mInputPrimitives.Length(); }
int32_t InputPrimitiveIndex(size_t aInputIndex) const
@ -271,6 +272,11 @@ public:
mFilterPrimitiveSubregion = aRect;
}
void SetIsTainted(bool aIsTainted)
{
mIsTainted = aIsTainted;
}
void SetInputPrimitive(size_t aInputIndex, int32_t aInputPrimitiveIndex)
{
mInputPrimitives.EnsureLengthAtLeast(aInputIndex + 1);
@ -295,6 +301,7 @@ private:
IntRect mFilterPrimitiveSubregion;
nsTArray<ColorSpace> mInputColorSpaces;
ColorSpace mOutputColorSpace;
bool mIsTainted;
};
/**

View File

@ -1,6 +1,3 @@
// Bug 956434 - Disable test due to unpredictable failures on ggc builds
quit(0);
function testSlice() {
function test(subBuf, starts, size) {
var byteLength = size;
@ -43,6 +40,18 @@ function testSlice() {
test("buffer.slice(-20, -8)", 12, 12);
test("buffer.slice(-40, 16)", 0, 16);
test("buffer.slice(-40, 40)", 0, 32);
gczeal(7, 100000);
var nurseryBuf = new ArrayBuffer(32);
var arr = new Int8Array(nurseryBuf);
arr[0] = 77;
// tenure nurseryBuf during the slice operation
nurseryBuf.slice; // Creates an object
schedulegc(1);
var newbuf = nurseryBuf.slice(0);
var arr2 = new Int8Array(newbuf);
assertEq(arr2[0], 77);
}
testSlice();

View File

@ -0,0 +1,23 @@
// Arrays should be initialized to zero
function f() {
for (var ctor of [ Int8Array,
Uint8Array,
Uint8ClampedArray,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array ])
{
for (var len of [ 3, 30, 300, 3000, 30000 ]) {
var arr = ctor(len);
for (var i = 0; i < arr.length; i++)
assertEq(arr[i], 0);
}
}
}
f();
f();

View File

@ -0,0 +1,2 @@
for (var i = 0; i < 5; i++)
[,][i] = 3.14159;

View File

@ -788,6 +788,27 @@ CodeGenerator::visitRegExpTest(LRegExpTest *lir)
return callVM(RegExpTestRawInfo, lir);
}
typedef JSString *(*RegExpReplaceFn)(JSContext *, HandleString, HandleObject, HandleString);
static const VMFunction RegExpReplaceInfo = FunctionInfo<RegExpReplaceFn>(regexp_replace);
bool
CodeGenerator::visitRegExpReplace(LRegExpReplace *lir)
{
if (lir->replacement()->isConstant())
pushArg(ImmGCPtr(lir->replacement()->toConstant()->toString()));
else
pushArg(ToRegister(lir->replacement()));
pushArg(ToRegister(lir->regexp()));
if (lir->string()->isConstant())
pushArg(ImmGCPtr(lir->string()->toConstant()->toString()));
else
pushArg(ToRegister(lir->string()));
return callVM(RegExpReplaceInfo, lir);
}
typedef JSObject *(*LambdaFn)(JSContext *, HandleFunction, HandleObject);
static const VMFunction LambdaInfo =
FunctionInfo<LambdaFn>(js::Lambda);

View File

@ -92,6 +92,7 @@ class CodeGenerator : public CodeGeneratorSpecific
bool visitRegExp(LRegExp *lir);
bool visitRegExpExec(LRegExpExec *lir);
bool visitRegExpTest(LRegExpTest *lir);
bool visitRegExpReplace(LRegExpReplace *lir);
bool visitLambda(LLambda *lir);
bool visitLambdaForSingleton(LLambdaForSingleton *lir);
bool visitLambdaPar(LLambdaPar *lir);

View File

@ -5410,10 +5410,12 @@ IonBuilder::jsop_newarray(uint32_t count)
types::TemporaryTypeSet::DoubleConversion conversion =
ins->resultTypeSet()->convertDoubleElements(constraints());
if (conversion == types::TemporaryTypeSet::AlwaysConvertToDoubles) {
AutoThreadSafeAccess ts(templateObject);
if (conversion == types::TemporaryTypeSet::AlwaysConvertToDoubles)
templateObject->setShouldConvertDoubleElements();
}
else
templateObject->clearShouldConvertDoubleElements();
return true;
}

View File

@ -629,6 +629,7 @@ class IonBuilder : public MIRGenerator
InliningStatus inlineStrCharCodeAt(CallInfo &callInfo);
InliningStatus inlineStrFromCharCode(CallInfo &callInfo);
InliningStatus inlineStrCharAt(CallInfo &callInfo);
InliningStatus inlineStrReplaceRegExp(CallInfo &callInfo);
// RegExp natives.
InliningStatus inlineRegExpExec(CallInfo &callInfo);
@ -961,6 +962,7 @@ class CallInfo
void setFun(MDefinition *fun) {
fun_ = fun;
}
void setImplicitlyUsedUnchecked() {
thisArg_->setImplicitlyUsedUnchecked();
for (uint32_t i = 0; i < argc(); i++)

View File

@ -3262,6 +3262,34 @@ class LRegExpTest : public LCallInstructionHelper<1, 2, 0>
}
};
class LRegExpReplace : public LCallInstructionHelper<1, 3, 0>
{
public:
LIR_HEADER(RegExpReplace)
LRegExpReplace(const LAllocation &string, const LAllocation &regexp,
const LAllocation &replacement)
{
setOperand(0, string);
setOperand(1, regexp);
setOperand(2, replacement);
}
const LAllocation *string() {
return getOperand(0);
}
const LAllocation *regexp() {
return getOperand(1);
}
const LAllocation *replacement() {
return getOperand(2);
}
const MRegExpReplace *mir() const {
return mir_->toRegExpReplace();
}
};
class LLambdaForSingleton : public LCallInstructionHelper<1, 1, 0>
{
public:

View File

@ -151,6 +151,7 @@
_(RegExp) \
_(RegExpExec) \
_(RegExpTest) \
_(RegExpReplace) \
_(Lambda) \
_(LambdaForSingleton) \
_(LambdaPar) \

View File

@ -1938,6 +1938,19 @@ LIRGenerator::visitRegExpTest(MRegExpTest *ins)
return defineReturn(lir, ins) && assignSafepoint(lir, ins);
}
bool
LIRGenerator::visitRegExpReplace(MRegExpReplace *ins)
{
JS_ASSERT(ins->regexp()->type() == MIRType_Object);
JS_ASSERT(ins->string()->type() == MIRType_String);
JS_ASSERT(ins->replacement()->type() == MIRType_String);
LRegExpReplace *lir = new(alloc()) LRegExpReplace(useRegisterOrConstantAtStart(ins->string()),
useRegisterAtStart(ins->regexp()),
useRegisterOrConstantAtStart(ins->replacement()));
return defineReturn(lir, ins) && assignSafepoint(lir, ins);
}
bool
LIRGenerator::visitLambda(MLambda *ins)
{

View File

@ -147,6 +147,7 @@ class LIRGenerator : public LIRGeneratorSpecific
bool visitRegExp(MRegExp *ins);
bool visitRegExpExec(MRegExpExec *ins);
bool visitRegExpTest(MRegExpTest *ins);
bool visitRegExpReplace(MRegExpReplace *ins);
bool visitLambda(MLambda *ins);
bool visitLambdaPar(MLambdaPar *ins);
bool visitImplicitThis(MImplicitThis *ins);

View File

@ -119,6 +119,8 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSNative native)
return inlineStrFromCharCode(callInfo);
if (native == js_str_charAt)
return inlineStrCharAt(callInfo);
if (native == str_replace)
return inlineStrReplaceRegExp(callInfo);
// RegExp natives.
if (native == regexp_exec && CallResultEscapes(pc))
@ -250,9 +252,12 @@ IonBuilder::inlineArray(CallInfo &callInfo)
types::TemporaryTypeSet::DoubleConversion conversion =
getInlineReturnTypeSet()->convertDoubleElements(constraints());
if (conversion == types::TemporaryTypeSet::AlwaysConvertToDoubles) {
{
AutoThreadSafeAccess ts(templateObject);
if (conversion == types::TemporaryTypeSet::AlwaysConvertToDoubles)
templateObject->setShouldConvertDoubleElements();
else
templateObject->clearShouldConvertDoubleElements();
}
MNewArray *ins = MNewArray::New(alloc(), constraints(), initLength, templateObject,
@ -1168,6 +1173,42 @@ IonBuilder::inlineRegExpTest(CallInfo &callInfo)
return InliningStatus_Inlined;
}
IonBuilder::InliningStatus
IonBuilder::inlineStrReplaceRegExp(CallInfo &callInfo)
{
if (callInfo.argc() != 2 || callInfo.constructing())
return InliningStatus_NotInlined;
// Return: String.
if (getInlineReturnType() != MIRType_String)
return InliningStatus_NotInlined;
// This: String.
if (callInfo.thisArg()->type() != MIRType_String)
return InliningStatus_NotInlined;
// Arg 0: RegExp.
types::TemporaryTypeSet *arg0Type = callInfo.getArg(0)->resultTypeSet();
const Class *clasp = arg0Type ? arg0Type->getKnownClass() : nullptr;
if (clasp != &RegExpObject::class_)
return InliningStatus_NotInlined;
// Arg 1: String.
if (callInfo.getArg(1)->type() != MIRType_String)
return InliningStatus_NotInlined;
callInfo.setImplicitlyUsedUnchecked();
MInstruction *cte = MRegExpReplace::New(alloc(), callInfo.thisArg(), callInfo.getArg(0),
callInfo.getArg(1));
current->add(cte);
current->push(cte);
if (!resumeAfter(cte))
return InliningStatus_Error;
return InliningStatus_Inlined;
}
IonBuilder::InliningStatus
IonBuilder::inlineUnsafePutElements(CallInfo &callInfo)
{

Some files were not shown because too many files have changed in this diff Show More