From 92fbf52fbf3cb977cdf6578c876d0e3a6192def1 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 26 Jul 2013 12:57:53 +0900 Subject: [PATCH 01/92] Bug 897723 - Allow faulty.lib's on-demand decompression to be reentrant. r=nfroyd --- mozglue/linker/Mappable.cpp | 21 +++++++++++++++++++-- mozglue/linker/Mappable.h | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/mozglue/linker/Mappable.cpp b/mozglue/linker/Mappable.cpp index 0233b29531bf..c64d4073238e 100644 --- a/mozglue/linker/Mappable.cpp +++ b/mozglue/linker/Mappable.cpp @@ -344,7 +344,11 @@ MappableSeekableZStream::Create(const char *name, Zip *zip, mozilla::ScopedDeletePtr mappable; mappable = new MappableSeekableZStream(zip); - if (pthread_mutex_init(&mappable->mutex, NULL)) + pthread_mutexattr_t recursiveAttr; + pthread_mutexattr_init(&recursiveAttr); + pthread_mutexattr_settype(&recursiveAttr, PTHREAD_MUTEX_RECURSIVE); + + if (pthread_mutex_init(&mappable->mutex, &recursiveAttr)) return NULL; if (!mappable->zStream.Init(stream->GetBuffer(), stream->GetSize())) @@ -466,6 +470,19 @@ MappableSeekableZStream::ensure(const void *addr) length = PageAlignedSize(length); + /* The following lock can be re-acquired by the thread holding it. + * If this happens, it means the following code is interrupted somehow by + * some signal, and ends up retriggering a chunk decompression for the + * same MappableSeekableZStream. + * If the chunk to decompress is different the second time, then everything + * is safe as the only common data touched below is chunkAvailNum, and it is + * atomically updated (leaving out any chance of an interruption while it is + * updated affecting the result). If the chunk to decompress is the same, the + * worst thing that can happen is chunkAvailNum being incremented one too + * many times, which doesn't affect functionality. The chances of it + * happening being pretty slim, and the effect being harmless, we can just + * ignore the issue. Other than that, we'd just be wasting time decompressing + * the same chunk twice. */ AutoLock lock(&mutex); /* The very first page is mapped and accessed separately of the rest, and @@ -522,7 +539,7 @@ MappableSeekableZStream::stats(const char *when, const char *name) const { size_t nEntries = zStream.GetChunksNum(); DEBUG_LOG("%s: %s; %" PRIdSize "/%" PRIdSize " chunks decompressed", - name, when, chunkAvailNum, nEntries); + name, when, static_cast(chunkAvailNum), nEntries); size_t len = 64; mozilla::ScopedDeleteArray map; diff --git a/mozglue/linker/Mappable.h b/mozglue/linker/Mappable.h index a94f6ebe7db6..dd2a18443963 100644 --- a/mozglue/linker/Mappable.h +++ b/mozglue/linker/Mappable.h @@ -265,7 +265,7 @@ private: mozilla::ScopedDeleteArray chunkAvail; /* Number of chunks that have already been decompressed. */ - size_t chunkAvailNum; + mozilla::Atomic chunkAvailNum; /* Mutex protecting decompression */ pthread_mutex_t mutex; From 9cecd6a431051b5c2a60c7f07bf50226a5ba1110 Mon Sep 17 00:00:00 2001 From: Emanuel Hoogeveen Date: Thu, 25 Jul 2013 17:10:25 -0700 Subject: [PATCH 02/92] Bug 888088 (part 11) - Fix #include ordering in js/src/ion/arm/. r=nnethercote. --HG-- extra : rebase_source : 74ce29fbacbf1f52fd5129f92cc0c83de59cfd07 --- js/src/ion/arm/Architecture-arm.cpp | 16 +++++++++------- js/src/ion/arm/Architecture-arm.h | 3 +++ js/src/ion/arm/Assembler-arm.cpp | 12 +++++++----- js/src/ion/arm/Assembler-arm.h | 4 ++-- js/src/ion/arm/Bailouts-arm.cpp | 1 + js/src/ion/arm/BaselineHelpers-arm.h | 5 ++--- js/src/ion/arm/BaselineIC-arm.cpp | 4 ++-- js/src/ion/arm/CodeGenerator-arm.cpp | 7 ++++--- js/src/ion/arm/IonFrames-arm.h | 1 - js/src/ion/arm/Lowering-arm.cpp | 5 +++-- js/src/ion/arm/MacroAssembler-arm.cpp | 3 ++- js/src/ion/arm/MacroAssembler-arm.h | 3 ++- js/src/ion/arm/MoveEmitter-arm.h | 2 +- js/src/ion/arm/Trampoline-arm.cpp | 13 +++++++------ 14 files changed, 45 insertions(+), 34 deletions(-) diff --git a/js/src/ion/arm/Architecture-arm.cpp b/js/src/ion/arm/Architecture-arm.cpp index 9be8e3a6d793..69d41f34546d 100644 --- a/js/src/ion/arm/Architecture-arm.cpp +++ b/js/src/ion/arm/Architecture-arm.cpp @@ -4,14 +4,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#define HWCAP_ARMv7 (1 << 31) +#include "ion/arm/Architecture-arm.h" + #include "mozilla/StandardInteger.h" -#include -#include -#include -#include #include +#include +#include +#include +#include + +#define HWCAP_ARMv7 (1 << 31) // lame check for kernel version // see bug 586550 @@ -27,8 +30,7 @@ #define HWCAP_NEON (1<<6) #define HWCAP_ARMv7 (1<<7) #endif -#include "ion/arm/Architecture-arm.h" -#include "ion/arm/Assembler-arm.h" + namespace js { namespace ion { diff --git a/js/src/ion/arm/Architecture-arm.h b/js/src/ion/arm/Architecture-arm.h index 4f492661036b..58eea13711a9 100644 --- a/js/src/ion/arm/Architecture-arm.h +++ b/js/src/ion/arm/Architecture-arm.h @@ -7,7 +7,10 @@ #ifndef ion_arm_Architecture_arm_h #define ion_arm_Architecture_arm_h +#include "mozilla/StandardInteger.h" + #include + // gcc appears to use __ARM_PCS_VFP to denote that the target is a hard-float target. #ifdef __ARM_PCS_VFP #define JS_CPU_ARM_HARDFP diff --git a/js/src/ion/arm/Assembler-arm.cpp b/js/src/ion/arm/Assembler-arm.cpp index cfac479549d3..eb5a9da3bd46 100644 --- a/js/src/ion/arm/Assembler-arm.cpp +++ b/js/src/ion/arm/Assembler-arm.cpp @@ -4,16 +4,18 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "ion/arm/Assembler-arm.h" + #include "mozilla/DebugOnly.h" #include "mozilla/MathAlgorithms.h" -#include "ion/arm/Assembler-arm.h" -#include "ion/arm/MacroAssembler-arm.h" -#include "gc/Marking.h" -#include "jsutil.h" -#include "assembler/jit/ExecutableAllocator.h" #include "jscompartment.h" +#include "jsutil.h" + +#include "assembler/jit/ExecutableAllocator.h" +#include "gc/Marking.h" #include "ion/IonCompartment.h" +#include "ion/arm/MacroAssembler-arm.h" using namespace js; using namespace js::ion; diff --git a/js/src/ion/arm/Assembler-arm.h b/js/src/ion/arm/Assembler-arm.h index 389564c97ce6..5ce9eb07ff3e 100644 --- a/js/src/ion/arm/Assembler-arm.h +++ b/js/src/ion/arm/Assembler-arm.h @@ -11,11 +11,11 @@ #include "mozilla/MathAlgorithms.h" #include "mozilla/Util.h" -#include "ion/shared/Assembler-shared.h" #include "assembler/assembler/AssemblerBufferWithConstantPool.h" +#include "ion/arm/Architecture-arm.h" #include "ion/CompactBuffer.h" #include "ion/IonCode.h" -#include "ion/arm/Architecture-arm.h" +#include "ion/shared/Assembler-shared.h" #include "ion/shared/IonAssemblerBufferWithConstantPools.h" namespace js { diff --git a/js/src/ion/arm/Bailouts-arm.cpp b/js/src/ion/arm/Bailouts-arm.cpp index 2629835625d4..d56833528017 100644 --- a/js/src/ion/arm/Bailouts-arm.cpp +++ b/js/src/ion/arm/Bailouts-arm.cpp @@ -6,6 +6,7 @@ #include "jscntxt.h" #include "jscompartment.h" + #include "ion/Bailouts.h" #include "ion/IonCompartment.h" diff --git a/js/src/ion/arm/BaselineHelpers-arm.h b/js/src/ion/arm/BaselineHelpers-arm.h index eac9eb85d70b..7b0dfe45376b 100644 --- a/js/src/ion/arm/BaselineHelpers-arm.h +++ b/js/src/ion/arm/BaselineHelpers-arm.h @@ -8,11 +8,10 @@ #define ion_arm_BaselineHelpers_arm_h #ifdef JS_ION - -#include "ion/IonMacroAssembler.h" #include "ion/BaselineFrame.h" -#include "ion/BaselineRegisters.h" #include "ion/BaselineIC.h" +#include "ion/BaselineRegisters.h" +#include "ion/IonMacroAssembler.h" namespace js { namespace ion { diff --git a/js/src/ion/arm/BaselineIC-arm.cpp b/js/src/ion/arm/BaselineIC-arm.cpp index 35faa38cd294..4e35e4d79577 100644 --- a/js/src/ion/arm/BaselineIC-arm.cpp +++ b/js/src/ion/arm/BaselineIC-arm.cpp @@ -4,10 +4,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "ion/BaselineJIT.h" -#include "ion/BaselineIC.h" #include "ion/BaselineCompiler.h" #include "ion/BaselineHelpers.h" +#include "ion/BaselineIC.h" +#include "ion/BaselineJIT.h" #include "ion/IonLinker.h" using namespace js; diff --git a/js/src/ion/arm/CodeGenerator-arm.cpp b/js/src/ion/arm/CodeGenerator-arm.cpp index cf1f62baabbd..f6ba87dc4f33 100644 --- a/js/src/ion/arm/CodeGenerator-arm.cpp +++ b/js/src/ion/arm/CodeGenerator-arm.cpp @@ -4,24 +4,25 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "ion/arm/CodeGenerator-arm.h" + #include "mozilla/MathAlgorithms.h" #include "jscntxt.h" #include "jscompartment.h" #include "jsnum.h" -#include "ion/arm/CodeGenerator-arm.h" -#include "ion/PerfSpewer.h" #include "ion/CodeGenerator.h" #include "ion/IonCompartment.h" #include "ion/IonFrames.h" #include "ion/MIR.h" #include "ion/MIRGraph.h" -#include "ion/shared/CodeGenerator-shared-inl.h" +#include "ion/PerfSpewer.h" #include "vm/Shape.h" #include "jsscriptinlines.h" +#include "ion/shared/CodeGenerator-shared-inl.h" #include "vm/Shape-inl.h" using namespace js; diff --git a/js/src/ion/arm/IonFrames-arm.h b/js/src/ion/arm/IonFrames-arm.h index 6e3e834b8f1b..b692927e9665 100644 --- a/js/src/ion/arm/IonFrames-arm.h +++ b/js/src/ion/arm/IonFrames-arm.h @@ -8,7 +8,6 @@ #define ion_arm_IonFrames_arm_h #include "ion/shared/IonFrames-shared.h" -//#include "ion/arm/Assembler-arm.h" namespace js { namespace ion { diff --git a/js/src/ion/arm/Lowering-arm.cpp b/js/src/ion/arm/Lowering-arm.cpp index 144542cdbf79..19bebcfd25fe 100644 --- a/js/src/ion/arm/Lowering-arm.cpp +++ b/js/src/ion/arm/Lowering-arm.cpp @@ -6,9 +6,10 @@ #include "mozilla/MathAlgorithms.h" -#include "ion/MIR.h" -#include "ion/Lowering.h" #include "ion/arm/Assembler-arm.h" +#include "ion/Lowering.h" +#include "ion/MIR.h" + #include "ion/shared/Lowering-shared-inl.h" using namespace js; diff --git a/js/src/ion/arm/MacroAssembler-arm.cpp b/js/src/ion/arm/MacroAssembler-arm.cpp index 3063bbe72230..badd5fc25ab1 100644 --- a/js/src/ion/arm/MacroAssembler-arm.cpp +++ b/js/src/ion/arm/MacroAssembler-arm.cpp @@ -4,10 +4,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "ion/arm/MacroAssembler-arm.h" + #include "mozilla/DebugOnly.h" #include "mozilla/MathAlgorithms.h" -#include "ion/arm/MacroAssembler-arm.h" #include "ion/BaselineFrame.h" #include "ion/MoveEmitter.h" diff --git a/js/src/ion/arm/MacroAssembler-arm.h b/js/src/ion/arm/MacroAssembler-arm.h index b230b8df629c..1774de57524f 100644 --- a/js/src/ion/arm/MacroAssembler-arm.h +++ b/js/src/ion/arm/MacroAssembler-arm.h @@ -9,11 +9,12 @@ #include "mozilla/DebugOnly.h" +#include "jsopcode.h" + #include "ion/arm/Assembler-arm.h" #include "ion/IonCaches.h" #include "ion/IonFrames.h" #include "ion/MoveResolver.h" -#include "jsopcode.h" using mozilla::DebugOnly; diff --git a/js/src/ion/arm/MoveEmitter-arm.h b/js/src/ion/arm/MoveEmitter-arm.h index 90fe38e796ed..e52b80e79983 100644 --- a/js/src/ion/arm/MoveEmitter-arm.h +++ b/js/src/ion/arm/MoveEmitter-arm.h @@ -7,8 +7,8 @@ #ifndef ion_arm_MoveEmitter_arm_h #define ion_arm_MoveEmitter_arm_h -#include "ion/MoveResolver.h" #include "ion/IonMacroAssembler.h" +#include "ion/MoveResolver.h" namespace js { namespace ion { diff --git a/js/src/ion/arm/Trampoline-arm.cpp b/js/src/ion/arm/Trampoline-arm.cpp index 2544b786627c..5032ddd2be89 100644 --- a/js/src/ion/arm/Trampoline-arm.cpp +++ b/js/src/ion/arm/Trampoline-arm.cpp @@ -5,15 +5,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "jscompartment.h" + #include "assembler/assembler/MacroAssembler.h" -#include "ion/IonCompartment.h" -#include "ion/IonLinker.h" -#include "ion/IonFrames.h" -#include "ion/IonSpewer.h" -#include "ion/Bailouts.h" -#include "ion/VMFunctions.h" #include "ion/arm/BaselineHelpers-arm.h" +#include "ion/Bailouts.h" #include "ion/ExecutionModeInlines.h" +#include "ion/IonCompartment.h" +#include "ion/IonFrames.h" +#include "ion/IonLinker.h" +#include "ion/IonSpewer.h" +#include "ion/VMFunctions.h" using namespace js; using namespace js::ion; From a19a6896344725aa813c9b6e53dc0a77d834c18f Mon Sep 17 00:00:00 2001 From: Emanuel Hoogeveen Date: Thu, 25 Jul 2013 19:13:55 -0700 Subject: [PATCH 03/92] Bug 888088 (part 12) - Fix #include ordering in a handful of remaining places. r=nnethercote. --HG-- extra : rebase_source : 3ab804c5e08732079e5bdcfd36c4566e18192985 --- js/src/ion/IonCaches.h | 6 +++--- js/src/ion/LIR.h | 2 +- js/src/jsclass.h | 2 +- js/src/jsclone.cpp | 2 +- js/src/prmjtime.cpp | 5 +++-- js/src/prmjtime.h | 2 ++ js/src/vm/ForkJoin.cpp | 4 ++-- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/js/src/ion/IonCaches.h b/js/src/ion/IonCaches.h index 01abe2bd86a0..6525066cef60 100644 --- a/js/src/ion/IonCaches.h +++ b/js/src/ion/IonCaches.h @@ -7,12 +7,12 @@ #ifndef ion_IonCaches_h #define ion_IonCaches_h -#include "ion/IonCode.h" -#include "ion/Registers.h" -#include "ion/shared/Assembler-shared.h" #ifdef JS_CPU_ARM # include "ion/arm/Assembler-arm.h" #endif +#include "ion/IonCode.h" +#include "ion/Registers.h" +#include "ion/shared/Assembler-shared.h" #include "vm/ForkJoin.h" class JSFunction; diff --git a/js/src/ion/LIR.h b/js/src/ion/LIR.h index c9a09c8428d7..00b94875f499 100644 --- a/js/src/ion/LIR.h +++ b/js/src/ion/LIR.h @@ -18,8 +18,8 @@ #include "ion/InlineList.h" #include "ion/IonAllocPolicy.h" #include "ion/LOpcodes.h" -#include "ion/MIRGraph.h" #include "ion/MIR.h" +#include "ion/MIRGraph.h" #include "ion/Registers.h" #include "ion/Safepoints.h" #include "ion/shared/Assembler-shared.h" diff --git a/js/src/jsclass.h b/js/src/jsclass.h index 9ffec3fa02b7..182a7b4fee9d 100644 --- a/js/src/jsclass.h +++ b/js/src/jsclass.h @@ -219,7 +219,7 @@ typedef void /* * The helper struct to measure the size of JS_CLASS_MEMBERS to know how much - * we have to padd js::Class to match the size of JSClass; + * we have to pad js::Class to match the size of JSClass. */ struct ClassSizeMeasurement { diff --git a/js/src/jsclone.cpp b/js/src/jsclone.cpp index 40686dac4168..5ae2bea8f1be 100644 --- a/js/src/jsclone.cpp +++ b/js/src/jsclone.cpp @@ -28,12 +28,12 @@ */ #include "jsclone.h" -#include "jswrapper.h" #include "mozilla/Endian.h" #include "mozilla/FloatingPoint.h" #include "jsdate.h" +#include "jswrapper.h" #include "vm/TypedArrayObject.h" #include "vm/WrapperObject.h" diff --git a/js/src/prmjtime.cpp b/js/src/prmjtime.cpp index 446a2a32d21b..b9ec2d343935 100644 --- a/js/src/prmjtime.cpp +++ b/js/src/prmjtime.cpp @@ -6,6 +6,8 @@ /* PR time code. */ +#include "prmjtime.h" + #include "mozilla/MathAlgorithms.h" #ifdef SOLARIS @@ -14,11 +16,10 @@ #include #include -#include "jsprf.h" #include "jslock.h" +#include "jsprf.h" #include "jstypes.h" #include "jsutil.h" -#include "prmjtime.h" #define PRMJ_DO_MILLISECONDS 1 diff --git a/js/src/prmjtime.h b/js/src/prmjtime.h index b48f1d7ddd4d..6801fd3e926a 100644 --- a/js/src/prmjtime.h +++ b/js/src/prmjtime.h @@ -7,6 +7,8 @@ #ifndef prmjtime_h #define prmjtime_h +#include "mozilla/StandardInteger.h" + #include /* diff --git a/js/src/vm/ForkJoin.cpp b/js/src/vm/ForkJoin.cpp index 326028ad50cc..529ad302fa1d 100644 --- a/js/src/vm/ForkJoin.cpp +++ b/js/src/vm/ForkJoin.cpp @@ -4,10 +4,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "jscntxt.h" - #include "vm/ForkJoin.h" +#include "jscntxt.h" + #ifdef JS_THREADSAFE # include "prthread.h" # include "prprf.h" From 269f816a9eefb9408771bacacd51362392980e4f Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 26 Jul 2013 13:35:22 +1200 Subject: [PATCH 04/92] Bug 890716. Fix race in Reverb::Reverb. r=padenot --HG-- extra : rebase_source : 65af577f5ffcf7f7a0b650f1693f4159ddac4ac6 --- content/media/AudioNodeEngine.cpp | 14 ++++++++++ content/media/AudioNodeEngine.h | 8 ++++++ content/media/webaudio/blink/Reverb.cpp | 36 +++++++++++++------------ content/media/webaudio/blink/Reverb.h | 2 +- 4 files changed, 42 insertions(+), 18 deletions(-) diff --git a/content/media/AudioNodeEngine.cpp b/content/media/AudioNodeEngine.cpp index 23f21a3b73ee..9f476e3a0bf6 100644 --- a/content/media/AudioNodeEngine.cpp +++ b/content/media/AudioNodeEngine.cpp @@ -39,6 +39,20 @@ WriteZeroesToAudioBlock(AudioChunk* aChunk, uint32_t aStart, uint32_t aLength) } } +void AudioBufferCopyWithScale(const float* aInput, + float aScale, + float* aOutput, + uint32_t aSize) +{ + if (aScale == 1.0f) { + PodCopy(aOutput, aInput, aSize); + } else { + for (uint32_t i = 0; i < aSize; ++i) { + aOutput[i] = aInput[i]*aScale; + } + } +} + void AudioBufferAddWithScale(const float* aInput, float aScale, float* aOutput, diff --git a/content/media/AudioNodeEngine.h b/content/media/AudioNodeEngine.h index 25f5c4f29239..09016a495ea2 100644 --- a/content/media/AudioNodeEngine.h +++ b/content/media/AudioNodeEngine.h @@ -87,6 +87,14 @@ void AllocateAudioBlock(uint32_t aChannelCount, AudioChunk* aChunk); */ void WriteZeroesToAudioBlock(AudioChunk* aChunk, uint32_t aStart, uint32_t aLength); +/** + * Copy with scale. aScale == 1.0f should be optimized. + */ +void AudioBufferCopyWithScale(const float* aInput, + float aScale, + float* aOutput, + uint32_t aSize); + /** * Pointwise multiply-add operation. aScale == 1.0f should be optimized. */ diff --git a/content/media/webaudio/blink/Reverb.cpp b/content/media/webaudio/blink/Reverb.cpp index c689558a3275..9006d623cfe4 100644 --- a/content/media/webaudio/blink/Reverb.cpp +++ b/content/media/webaudio/blink/Reverb.cpp @@ -80,41 +80,43 @@ Reverb::Reverb(ThreadSharedFloatArrayBufferList* impulseResponse, size_t impulse { float scale = 1; + nsAutoTArray irChannels; + for (size_t i = 0; i < impulseResponse->GetChannels(); ++i) { + irChannels.AppendElement(impulseResponse->GetData(i)); + } + nsAutoTArray tempBuf; + if (normalize) { scale = calculateNormalizationScale(impulseResponse, impulseResponseBufferLength, sampleRate); if (scale) { - for (uint32_t i = 0; i < impulseResponse->GetChannels(); ++i) { - AudioBufferInPlaceScale(const_cast(impulseResponse->GetData(i)), - 1, scale, impulseResponseBufferLength); + tempBuf.SetLength(irChannels.Length()*impulseResponseBufferLength); + for (uint32_t i = 0; i < irChannels.Length(); ++i) { + float* buf = &tempBuf[i*impulseResponseBufferLength]; + AudioBufferCopyWithScale(irChannels[i], scale, buf, + impulseResponseBufferLength); + irChannels[i] = buf; } } } - initialize(impulseResponse, impulseResponseBufferLength, renderSliceSize, maxFFTSize, numberOfChannels, useBackgroundThreads); - - // Undo scaling since this shouldn't be a destructive operation on impulseResponse. - // FIXME: What about roundoff? Perhaps consider making a temporary scaled copy - // instead of scaling and unscaling in place. - if (normalize && scale) { - for (uint32_t i = 0; i < impulseResponse->GetChannels(); ++i) { - AudioBufferInPlaceScale(const_cast(impulseResponse->GetData(i)), - 1, 1 / scale, impulseResponseBufferLength); - } - } + initialize(irChannels, impulseResponseBufferLength, renderSliceSize, + maxFFTSize, numberOfChannels, useBackgroundThreads); } -void Reverb::initialize(ThreadSharedFloatArrayBufferList* impulseResponseBuffer, size_t impulseResponseBufferLength, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads) +void Reverb::initialize(const nsTArray& impulseResponseBuffer, + size_t impulseResponseBufferLength, size_t renderSliceSize, + size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads) { m_impulseResponseLength = impulseResponseBufferLength; // The reverb can handle a mono impulse response and still do stereo processing - size_t numResponseChannels = impulseResponseBuffer->GetChannels(); + size_t numResponseChannels = impulseResponseBuffer.Length(); m_convolvers.SetCapacity(numberOfChannels); int convolverRenderPhase = 0; for (size_t i = 0; i < numResponseChannels; ++i) { - const float* channel = impulseResponseBuffer->GetData(i); + const float* channel = impulseResponseBuffer[i]; size_t length = impulseResponseBufferLength; nsAutoPtr convolver(new ReverbConvolver(channel, length, renderSliceSize, maxFFTSize, convolverRenderPhase, useBackgroundThreads)); diff --git a/content/media/webaudio/blink/Reverb.h b/content/media/webaudio/blink/Reverb.h index 89794748742a..939eeef874bf 100644 --- a/content/media/webaudio/blink/Reverb.h +++ b/content/media/webaudio/blink/Reverb.h @@ -55,7 +55,7 @@ public: size_t latencyFrames() const; private: - void initialize(mozilla::ThreadSharedFloatArrayBufferList* impulseResponseBuffer, size_t impulseResponseBufferLength, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads); + void initialize(const nsTArray& impulseResponseBuffer, size_t impulseResponseBufferLength, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads); size_t m_impulseResponseLength; From 71ed3a62d306a75401431c239f84fe51701fd059 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 26 Jul 2013 13:36:05 +1200 Subject: [PATCH 05/92] Bug 885009. Handle clip-all-descendants cases with rounded corners. r=mats --HG-- extra : rebase_source : 284587e5fa70532bc6435f987f03c1282edc9cb8 --- layout/base/DisplayListClipState.cpp | 7 ++++++- layout/base/DisplayListClipState.h | 8 +++++--- layout/generic/crashtests/885009-1.html | 7 +++++++ layout/generic/crashtests/crashtests.list | 1 + layout/generic/nsGfxScrollFrame.cpp | 11 +++-------- 5 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 layout/generic/crashtests/885009-1.html diff --git a/layout/base/DisplayListClipState.cpp b/layout/base/DisplayListClipState.cpp index 13f3add2f2f6..3b6e7bb05523 100644 --- a/layout/base/DisplayListClipState.cpp +++ b/layout/base/DisplayListClipState.cpp @@ -53,9 +53,14 @@ DisplayListClipState::ClipContainingBlockDescendants(const nsRect& aRect, void DisplayListClipState::ClipContentDescendants(const nsRect& aRect, + const nscoord* aRadii, DisplayItemClip& aClipOnStack) { - aClipOnStack.SetTo(aRect); + if (aRadii) { + aClipOnStack.SetTo(aRect, aRadii); + } else { + aClipOnStack.SetTo(aRect); + } if (mClipContentDescendants) { aClipOnStack.IntersectWith(*mClipContentDescendants); } diff --git a/layout/base/DisplayListClipState.h b/layout/base/DisplayListClipState.h index dcc839ba1d89..54155cd9ab58 100644 --- a/layout/base/DisplayListClipState.h +++ b/layout/base/DisplayListClipState.h @@ -79,6 +79,7 @@ private: DisplayItemClip& aClipOnStack); void ClipContentDescendants(const nsRect& aRect, + const nscoord* aRadii, DisplayItemClip& aClipOnStack); /** @@ -150,7 +151,7 @@ public: * the result, stored in aClipOnStack. */ void ClipContainingBlockDescendants(const nsRect& aRect, - const nscoord* aRadii) + const nscoord* aRadii = nullptr) { NS_ASSERTION(!mRestored, "Already restored!"); NS_ASSERTION(!mClipUsed, "mClip already used"); @@ -158,12 +159,13 @@ public: mState.ClipContainingBlockDescendants(aRect, aRadii, mClip); } - void ClipContentDescendants(const nsRect& aRect) + void ClipContentDescendants(const nsRect& aRect, + const nscoord* aRadii = nullptr) { NS_ASSERTION(!mRestored, "Already restored!"); NS_ASSERTION(!mClipUsed, "mClip already used"); mClipUsed = true; - mState.ClipContentDescendants(aRect, mClip); + mState.ClipContentDescendants(aRect, aRadii, mClip); } /** diff --git a/layout/generic/crashtests/885009-1.html b/layout/generic/crashtests/885009-1.html new file mode 100644 index 000000000000..2403f71820ea --- /dev/null +++ b/layout/generic/crashtests/885009-1.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index 01b71931d6bd..ee9f19283811 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -497,3 +497,4 @@ test-pref(layout.css.flexbox.enabled,true) load 862947-1.html needs-focus pref(accessibility.browsewithcaret,true) load 868906.html test-pref(layout.css.flexbox.enabled,true) load 866547-1.html asserts(1-4) test-pref(layout.css.flexbox.enabled,true) load 876074-1.html # bug 876749 +load 885009-1.html diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index f996cf56a1ce..e4aef81dca07 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2251,18 +2251,13 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder, } } else { nsRect clip = mScrollPort + aBuilder->ToReferenceFrame(mOuter); + nscoord radii[8]; + bool haveRadii = mOuter->GetPaddingBoxBorderRadii(radii); // Our override of GetBorderRadii ensures we never have a radius at // the corners where we have a scrollbar. if (mClipAllDescendants) { -#ifdef DEBUG - nscoord radii[8]; -#endif - NS_ASSERTION(!mOuter->GetPaddingBoxBorderRadii(radii), - "Roots with radii not supported"); - clipState.ClipContentDescendants(clip); + clipState.ClipContentDescendants(clip, haveRadii ? radii : nullptr); } else { - nscoord radii[8]; - bool haveRadii = mOuter->GetPaddingBoxBorderRadii(radii); clipState.ClipContainingBlockDescendants(clip, haveRadii ? radii : nullptr); } } From 669a28a75cad77159c7d318ed05fc353267ce854 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 26 Jul 2013 14:31:41 +1200 Subject: [PATCH 06/92] Bug 837242. Part 1: Convert bool parameters to flags. r=mats --HG-- extra : rebase_source : e59fe41c41f2be6b4f0c78528cf954093f3011bd --- content/base/src/nsDocument.cpp | 12 ++++++---- layout/base/PositionedEventTargeting.cpp | 8 +++---- layout/base/nsLayoutUtils.cpp | 16 +++++-------- layout/base/nsLayoutUtils.h | 29 ++++++++++++++---------- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 4a9c8a70139e..65f50a7f955e 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -3137,8 +3137,9 @@ nsDocument::ElementFromPointHelper(float aX, float aY, return nullptr; // return null to premature XUL callers as a reminder to wait } - nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, true, - aIgnoreRootScrollFrame); + nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, + nsLayoutUtils::IGNORE_PAINT_SUPPRESSION | + (aIgnoreRootScrollFrame ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0)); if (!ptFrame) { return nullptr; } @@ -3192,7 +3193,8 @@ nsDocument::NodesFromRectHelper(float aX, float aY, nsAutoTArray outFrames; nsLayoutUtils::GetFramesForArea(rootFrame, rect, outFrames, - true, aIgnoreRootScrollFrame); + nsLayoutUtils::IGNORE_PAINT_SUPPRESSION | + (aIgnoreRootScrollFrame ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0)); // Used to filter out repeated elements in sequence. nsIContent* lastAdded = nullptr; @@ -9323,8 +9325,8 @@ nsIDocument::CaretPositionFromPoint(float aX, float aY) return nullptr; } - nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, true, - false); + nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, + nsLayoutUtils::IGNORE_PAINT_SUPPRESSION); if (!ptFrame) { return nullptr; } diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp index c1f77d1bcbb9..2072a4e57797 100644 --- a/layout/base/PositionedEventTargeting.cpp +++ b/layout/base/PositionedEventTargeting.cpp @@ -249,10 +249,10 @@ FindFrameTargetedByInputEvent(const nsGUIEvent *aEvent, const nsPoint& aPointRelativeToRootFrame, uint32_t aFlags) { - bool ignoreRootScrollFrame = (aFlags & INPUT_IGNORE_ROOT_SCROLL_FRAME) != 0; + uint32_t flags = (aFlags & INPUT_IGNORE_ROOT_SCROLL_FRAME) ? + nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0; nsIFrame* target = - nsLayoutUtils::GetFrameForPoint(aRootFrame, aPointRelativeToRootFrame, - false, ignoreRootScrollFrame); + nsLayoutUtils::GetFrameForPoint(aRootFrame, aPointRelativeToRootFrame, flags); const EventRadiusPrefs* prefs = GetPrefsFor(aEvent->eventStructType); if (!prefs || !prefs->mEnabled || (target && IsElementClickable(target))) { @@ -271,7 +271,7 @@ FindFrameTargetedByInputEvent(const nsGUIEvent *aEvent, nsRect targetRect = GetTargetRect(aRootFrame, aPointRelativeToRootFrame, prefs); nsAutoTArray candidates; nsresult rv = nsLayoutUtils::GetFramesForArea(aRootFrame, targetRect, candidates, - false, ignoreRootScrollFrame); + flags | nsLayoutUtils::EXCLUDE_COVERED_FRAMES); if (NS_FAILED(rv)) { return target; } diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index dddbf7941f4e..8162ea3da6ea 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1802,15 +1802,12 @@ nsLayoutUtils::GetRemoteContentIds(nsIFrame* aFrame, } nsIFrame* -nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, - bool aShouldIgnoreSuppression, - bool aIgnoreRootScrollFrame) +nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, uint32_t aFlags) { PROFILER_LABEL("nsLayoutUtils", "GetFrameForPoint"); nsresult rv; nsAutoTArray outFrames; - rv = GetFramesForArea(aFrame, nsRect(aPt, nsSize(1, 1)), outFrames, - aShouldIgnoreSuppression, aIgnoreRootScrollFrame); + rv = GetFramesForArea(aFrame, nsRect(aPt, nsSize(1, 1)), outFrames, aFlags); NS_ENSURE_SUCCESS(rv, nullptr); return outFrames.Length() ? outFrames.ElementAt(0) : nullptr; } @@ -1818,20 +1815,19 @@ nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, nsresult nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect, nsTArray &aOutFrames, - bool aShouldIgnoreSuppression, - bool aIgnoreRootScrollFrame) + uint32_t aFlags) { PROFILER_LABEL("nsLayoutUtils","GetFramesForArea"); nsDisplayListBuilder builder(aFrame, nsDisplayListBuilder::EVENT_DELIVERY, - false); + false); nsDisplayList list; nsRect target(aRect); - if (aShouldIgnoreSuppression) { + if (aFlags & IGNORE_PAINT_SUPPRESSION) { builder.IgnorePaintSuppression(); } - if (aIgnoreRootScrollFrame) { + if (aFlags & IGNORE_ROOT_SCROLL_FRAME) { nsIFrame* rootScrollFrame = aFrame->PresContext()->PresShell()->GetRootScrollFrame(); if (rootScrollFrame) { diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index a6ad34415365..263292c2e92b 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -526,19 +526,28 @@ public: nsTArray &aOutIDs, bool aIgnoreRootScrollFrame); + enum FrameForPointFlags { + /** + * When set, paint suppression is ignored, so we'll return non-root page + * elements even if paint suppression is stopping them from painting. + */ + IGNORE_PAINT_SUPPRESSION = 0x01, + /** + * When set, clipping due to the root scroll frame (and any other viewport- + * related clipping) is ignored. + */ + IGNORE_ROOT_SCROLL_FRAME = 0x02 + }; + /** * Given aFrame, the root frame of a stacking context, find its descendant * frame under the point aPt that receives a mouse event at that location, * or nullptr if there is no such frame. * @param aPt the point, relative to the frame origin - * @param aShouldIgnoreSuppression a boolean to control if the display - * list builder should ignore paint suppression or not - * @param aIgnoreRootScrollFrame whether or not the display list builder - * should ignore the root scroll frame. + * @param aFlags some combination of FrameForPointFlags */ static nsIFrame* GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, - bool aShouldIgnoreSuppression = false, - bool aIgnoreRootScrollFrame = false); + uint32_t aFlags = 0); /** * Given aFrame, the root frame of a stacking context, find all descendant @@ -546,15 +555,11 @@ public: * or nullptr if there is no such frame. * @param aRect the rect, relative to the frame origin * @param aOutFrames an array to add all the frames found - * @param aShouldIgnoreSuppression a boolean to control if the display - * list builder should ignore paint suppression or not - * @param aIgnoreRootScrollFrame whether or not the display list builder - * should ignore the root scroll frame. + * @param aFlags some combination of FrameForPointFlags */ static nsresult GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect, nsTArray &aOutFrames, - bool aShouldIgnoreSuppression = false, - bool aIgnoreRootScrollFrame = false); + uint32_t aFlags = 0); /** * Transform aRect relative to aAncestor down to the coordinate system of From 8a7d1fe132c7ea70b2630d497d9cdf4aca50e209 Mon Sep 17 00:00:00 2001 From: William Chen Date: Thu, 25 Jul 2013 22:58:39 -0700 Subject: [PATCH 07/92] Bug 895805 - Ensure nsBindingManager hashtable is initialized before use. r=mrbkap --- content/xbl/crashtests/895805-1.xhtml | 30 ++++++++++++++++++++++++++ content/xbl/crashtests/crashtests.list | 1 + content/xbl/src/nsBindingManager.cpp | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 content/xbl/crashtests/895805-1.xhtml diff --git a/content/xbl/crashtests/895805-1.xhtml b/content/xbl/crashtests/895805-1.xhtml new file mode 100644 index 000000000000..a6598de9c631 --- /dev/null +++ b/content/xbl/crashtests/895805-1.xhtml @@ -0,0 +1,30 @@ + + + +Bug 895805 - Adopting bound element to another document. + + + + + Bug 895805 dummy binding + + + + + + +Test + + + diff --git a/content/xbl/crashtests/crashtests.list b/content/xbl/crashtests/crashtests.list index da26aa6b5fa4..039139d5a25e 100644 --- a/content/xbl/crashtests/crashtests.list +++ b/content/xbl/crashtests/crashtests.list @@ -37,3 +37,4 @@ load 507628-1.xhtml load 507991-1.xhtml load set-field-bad-this.xhtml load 830614-1.xul +load 895805-1.xhtml diff --git a/content/xbl/src/nsBindingManager.cpp b/content/xbl/src/nsBindingManager.cpp index 3da7934a2fd4..9cbe06c36bf4 100644 --- a/content/xbl/src/nsBindingManager.cpp +++ b/content/xbl/src/nsBindingManager.cpp @@ -1114,7 +1114,7 @@ nsBindingManager::Traverse(nsIContent *aContent, return; } - if (mBoundContentSet.Contains(aContent)) { + if (mBoundContentSet.IsInitialized() && mBoundContentSet.Contains(aContent)) { NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "[via binding manager] mBoundContentSet entry"); cb.NoteXPCOMChild(aContent); } From 569ef7a7efbe7f96d46962425251d3b30c1e562a Mon Sep 17 00:00:00 2001 From: Dirk Schulze Date: Fri, 26 Jul 2013 16:02:33 +1000 Subject: [PATCH 08/92] Bug 897392 - Implement parsing of filter:hue-rotate(). r=heycam --- layout/style/nsCSSKeywordList.h | 1 + layout/style/nsCSSParser.cpp | 10 ++-- layout/style/nsComputedDOMStyle.cpp | 32 +++++++++---- layout/style/nsROCSSPrimitiveValue.cpp | 66 ++++++++++++++++++++++++-- layout/style/nsROCSSPrimitiveValue.h | 9 ++++ layout/style/nsRuleNode.cpp | 41 ++++++++++------ layout/style/nsStyleStruct.cpp | 4 +- layout/style/nsStyleStruct.h | 3 +- layout/style/test/property_database.js | 20 ++++++++ 9 files changed, 152 insertions(+), 34 deletions(-) diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 0205580ac601..ee53ad464ea9 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -288,6 +288,7 @@ CSS_KEY(historical-forms, historical_forms) CSS_KEY(historical-ligatures, historical_ligatures) CSS_KEY(horizontal, horizontal) CSS_KEY(horizontal-tb, horizontal_tb) +CSS_KEY(hue-rotate, hue_rotate) CSS_KEY(hz, hz) CSS_KEY(icon, icon) CSS_KEY(ignore, ignore) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 066027e2f6b8..12d371c15b20 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -10081,15 +10081,19 @@ CSSParserImpl::ParseSingleFilter(nsCSSValue* aValue) // VARIANT_NONNEGATIVE_DIMENSION will already reject negative lengths. rejectNegativeArgument = false; break; + case eCSSKeyword_brightness: + case eCSSKeyword_contrast: + case eCSSKeyword_saturate: + break; case eCSSKeyword_grayscale: case eCSSKeyword_invert: case eCSSKeyword_sepia: case eCSSKeyword_opacity: clampArgumentToOne = true; break; - case eCSSKeyword_brightness: - case eCSSKeyword_contrast: - case eCSSKeyword_saturate: + case eCSSKeyword_hue_rotate: + variantMask = VARIANT_ANGLE; + rejectNegativeArgument = false; break; default: // Unrecognized filter function. diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 741853d6bfff..de77e939ab4b 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -1710,16 +1710,8 @@ nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient, if (needSep) { aString.AppendLiteral(" "); } - tmpVal->SetNumber(aGradient->mAngle.GetAngleValue()); - tmpVal->GetCssText(tokenString); + SetCssTextToCoord(tokenString, aGradient->mAngle); aString.Append(tokenString); - switch (aGradient->mAngle.GetUnit()) { - case eStyleUnit_Degree: aString.AppendLiteral("deg"); break; - case eStyleUnit_Grad: aString.AppendLiteral("grad"); break; - case eStyleUnit_Radian: aString.AppendLiteral("rad"); break; - case eStyleUnit_Turn: aString.AppendLiteral("turn"); break; - default: NS_NOTREACHED("unrecognized angle unit"); - } needSep = true; } @@ -4007,6 +3999,23 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue, SetValueToCalc(calc, aValue); } break; + + case eStyleUnit_Degree: + aValue->SetDegree(aCoord.GetAngleValue()); + break; + + case eStyleUnit_Grad: + aValue->SetGrad(aCoord.GetAngleValue()); + break; + + case eStyleUnit_Radian: + aValue->SetRadian(aCoord.GetAngleValue()); + break; + + case eStyleUnit_Turn: + aValue->SetTurn(aCoord.GetAngleValue()); + break; + default: NS_ERROR("Can't handle this unit"); break; @@ -4495,6 +4504,9 @@ GetFilterFunctionName(nsAString& aString, nsStyleFilter::Type mType) case nsStyleFilter::Type::eGrayscale: aString.AssignLiteral("grayscale("); break; + case nsStyleFilter::Type::eHueRotate: + aString.AssignLiteral("hue-rotate("); + break; case nsStyleFilter::Type::eInvert: aString.AssignLiteral("invert("); break; @@ -4530,7 +4542,7 @@ nsComputedDOMStyle::CreatePrimitiveValueForStyleFilter( // Filter function argument. nsAutoString argumentString; - SetCssTextToCoord(argumentString, aStyleFilter.mCoord); + SetCssTextToCoord(argumentString, aStyleFilter.mFilterParameter); filterFunctionString.Append(argumentString); // Filter function closing parenthesis. diff --git a/layout/style/nsROCSSPrimitiveValue.cpp b/layout/style/nsROCSSPrimitiveValue.cpp index 519afc1b32a2..57c898c4eced 100644 --- a/layout/style/nsROCSSPrimitiveValue.cpp +++ b/layout/style/nsROCSSPrimitiveValue.cpp @@ -18,6 +18,13 @@ using namespace mozilla; +// There is no CSS_TURN constant on the CSSPrimitiveValue interface, +// since that unit is newer than DOM Level 2 Style, and CSS OM will +// probably expose CSS values in some other way in the future. We +// use this value in mType for "turn"-unit angles, but we define it +// here to avoid exposing it to content. +#define CSS_TURN 30U + nsROCSSPrimitiveValue::nsROCSSPrimitiveValue() : CSSValue(), mType(CSS_PX) { @@ -134,6 +141,30 @@ nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText) tmpStr.AppendFloat(mValue.mFloat); break; } + case CSS_DEG : + { + tmpStr.AppendFloat(mValue.mFloat); + tmpStr.AppendLiteral("deg"); + break; + } + case CSS_GRAD : + { + tmpStr.AppendFloat(mValue.mFloat); + tmpStr.AppendLiteral("grad"); + break; + } + case CSS_RAD : + { + tmpStr.AppendFloat(mValue.mFloat); + tmpStr.AppendLiteral("rad"); + break; + } + case CSS_TURN : + { + tmpStr.AppendFloat(mValue.mFloat); + tmpStr.AppendLiteral("turn"); + break; + } case CSS_RECT : { NS_ASSERTION(mValue.mRect, "mValue.mRect should never be null"); @@ -230,9 +261,6 @@ nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText) case CSS_UNKNOWN : case CSS_EMS : case CSS_EXS : - case CSS_DEG : - case CSS_RAD : - case CSS_GRAD : case CSS_MS : case CSS_HZ : case CSS_KHZ : @@ -520,6 +548,38 @@ nsROCSSPrimitiveValue::SetPercent(float aValue) mType = CSS_PERCENTAGE; } +void +nsROCSSPrimitiveValue::SetDegree(float aValue) +{ + Reset(); + mValue.mFloat = aValue; + mType = CSS_DEG; +} + +void +nsROCSSPrimitiveValue::SetGrad(float aValue) +{ + Reset(); + mValue.mFloat = aValue; + mType = CSS_GRAD; +} + +void +nsROCSSPrimitiveValue::SetRadian(float aValue) +{ + Reset(); + mValue.mFloat = aValue; + mType = CSS_RAD; +} + +void +nsROCSSPrimitiveValue::SetTurn(float aValue) +{ + Reset(); + mValue.mFloat = aValue; + mType = CSS_TURN; +} + void nsROCSSPrimitiveValue::SetAppUnits(nscoord aValue) { diff --git a/layout/style/nsROCSSPrimitiveValue.h b/layout/style/nsROCSSPrimitiveValue.h index dc444f1e7b09..d6bd3db4a7bb 100644 --- a/layout/style/nsROCSSPrimitiveValue.h +++ b/layout/style/nsROCSSPrimitiveValue.h @@ -44,6 +44,11 @@ public: // CSSPrimitiveValue uint16_t PrimitiveType() { + // New value types were introduced but not added to CSS OM. + // Return CSS_UNKNOWN to avoid exposing CSS_TURN to content. + if (mType > CSS_RGBCOLOR) { + return CSS_UNKNOWN; + } return mType; } void SetFloatValue(uint16_t aUnitType, float aValue, @@ -64,6 +69,10 @@ public: void SetNumber(int32_t aValue); void SetNumber(uint32_t aValue); void SetPercent(float aValue); + void SetDegree(float aValue); + void SetGrad(float aValue); + void SetRadian(float aValue); + void SetTurn(float aValue); void SetAppUnits(nscoord aValue); void SetAppUnits(float aValue); void SetIdent(nsCSSKeyword aKeyword); diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 92d10d08693e..f19ec5938f8b 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -653,6 +653,7 @@ GetFloatFromBoxPosition(int32_t aEnumValue) #define SETCOORD_CALC_CLAMP_NONNEGATIVE 0x00040000 // modifier for CALC_LENGTH_ONLY #define SETCOORD_STORE_CALC 0x00080000 #define SETCOORD_BOX_POSITION 0x00100000 // exclusive with _ENUMERATED +#define SETCOORD_ANGLE 0x00200000 #define SETCOORD_LP (SETCOORD_LENGTH | SETCOORD_PERCENT) #define SETCOORD_LH (SETCOORD_LENGTH | SETCOORD_INHERIT) @@ -765,6 +766,19 @@ static bool SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord, result = false; // didn't set anything } } + else if ((aMask & SETCOORD_ANGLE) != 0 && + (aValue.IsAngularUnit())) { + nsStyleUnit unit; + switch (aValue.GetUnit()) { + case eCSSUnit_Degree: unit = eStyleUnit_Degree; break; + case eCSSUnit_Grad: unit = eStyleUnit_Grad; break; + case eCSSUnit_Radian: unit = eStyleUnit_Radian; break; + case eCSSUnit_Turn: unit = eStyleUnit_Turn; break; + default: NS_NOTREACHED("unrecognized angular unit"); + unit = eStyleUnit_Degree; + } + aCoord.SetAngleValue(aValue.GetAngleValue(), unit); + } else { result = false; // didn't set anything } @@ -987,18 +1001,9 @@ static void SetGradient(const nsCSSValue& aValue, nsPresContext* aPresContext, aResult.mRepeating = gradient->mIsRepeating; // angle - if (gradient->mAngle.IsAngularUnit()) { - nsStyleUnit unit; - switch (gradient->mAngle.GetUnit()) { - case eCSSUnit_Degree: unit = eStyleUnit_Degree; break; - case eCSSUnit_Grad: unit = eStyleUnit_Grad; break; - case eCSSUnit_Radian: unit = eStyleUnit_Radian; break; - case eCSSUnit_Turn: unit = eStyleUnit_Turn; break; - default: NS_NOTREACHED("unrecognized angular unit"); - unit = eStyleUnit_Degree; - } - aResult.mAngle.SetAngleValue(gradient->mAngle.GetAngleValue(), unit); - } else { + const nsStyleCoord dummyParentCoord; + if (!SetCoord(gradient->mAngle, aResult.mAngle, dummyParentCoord, SETCOORD_ANGLE, + aContext, aPresContext, aCanStoreInRuleTree)) { NS_ASSERTION(gradient->mAngle.GetUnit() == eCSSUnit_None, "bad unit for gradient angle"); aResult.mAngle.SetNoneValue(); @@ -7720,6 +7725,8 @@ StyleFilterTypeForFunctionName(nsCSSKeyword functionName) return nsStyleFilter::Type::eContrast; case eCSSKeyword_grayscale: return nsStyleFilter::Type::eGrayscale; + case eCSSKeyword_hue_rotate: + return nsStyleFilter::Type::eHueRotate; case eCSSKeyword_invert: return nsStyleFilter::Type::eInvert; case eCSSKeyword_opacity: @@ -7756,16 +7763,20 @@ SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter, aStyleFilter->mType = StyleFilterTypeForFunctionName(functionName); int32_t mask = SETCOORD_PERCENT | SETCOORD_FACTOR; - if (aStyleFilter->mType == nsStyleFilter::Type::eBlur) + if (aStyleFilter->mType == nsStyleFilter::Type::eBlur) { mask = SETCOORD_LENGTH | SETCOORD_STORE_CALC; + } else if (aStyleFilter->mType == nsStyleFilter::Type::eHueRotate) { + mask = SETCOORD_ANGLE; + } NS_ABORT_IF_FALSE(filterFunction->Count() == 2, "all filter functions except drop-shadow should have " "exactly one argument"); nsCSSValue& arg = filterFunction->Item(1); - DebugOnly success = SetCoord(arg, aStyleFilter->mCoord, nsStyleCoord(), - mask, aStyleContext, aPresContext, + DebugOnly success = SetCoord(arg, aStyleFilter->mFilterParameter, + nsStyleCoord(), mask, + aStyleContext, aPresContext, aCanStoreInRuleTree); NS_ABORT_IF_FALSE(success, "unexpected unit"); } diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index f09d82b1bd75..a1db5828b09e 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -1017,7 +1017,7 @@ nsStyleFilter::nsStyleFilter(const nsStyleFilter& aSource) if (mType == eURL) { mURL = aSource.mURL; } else if (mType != eNull) { - mCoord = aSource.mCoord; + mFilterParameter = aSource.mFilterParameter; } } @@ -1036,7 +1036,7 @@ nsStyleFilter::operator==(const nsStyleFilter& aOther) const if (mType == eURL) { return EqualURIs(mURL, aOther.mURL); } else if (mType != eNull) { - return mCoord == aOther.mCoord; + return mFilterParameter == aOther.mFilterParameter; } return true; diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index eda5ae8ee353..473711e09993 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -2281,6 +2281,7 @@ struct nsStyleFilter { eBlur, eBrightness, eContrast, + eHueRotate, eInvert, eOpacity, eGrayscale, @@ -2290,7 +2291,7 @@ struct nsStyleFilter { Type mType; nsIURI* mURL; - nsStyleCoord mCoord; + nsStyleCoord mFilterParameter; // coord, percent, factor, angle // FIXME: Add a nsCSSShadowItem when we implement drop shadow. }; diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 062f8c146699..691d58b8cade 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -4466,6 +4466,16 @@ if (SpecialPowers.getBoolPref("layout.css.filters.enabled")) { "grayscale(350%)", "grayscale(4.567)", + "hue-rotate(0deg)", + "hue-rotate(90deg)", + "hue-rotate(540deg)", + "hue-rotate(-90deg)", + "hue-rotate(10grad)", + "hue-rotate(1.6rad)", + "hue-rotate(-1.6rad)", + "hue-rotate(0.5turn)", + "hue-rotate(-2turn)", + "invert(0)", "invert(50%)", "invert(1)", @@ -4554,6 +4564,16 @@ if (SpecialPowers.getBoolPref("layout.css.filters.enabled")) { "grayscale(10px)", "grayscale(-1)", + "hue-rotate()", + "hue-rotate(0)", + "hue-rotate(0.5 0.5)", + "hue-rotate(0.5,)", + "hue-rotate(0.5, 0.5)", + "hue-rotate(#my-filter)", + "hue-rotate(10px)", + "hue-rotate(-1)", + "hue-rotate(45deg,)", + "invert()", "invert(0.5 0.5)", "invert(0.5,)", From 769cb44b6f33428af2412c9a658ea92dd21a0d3d Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Fri, 26 Jul 2013 09:25:03 +0200 Subject: [PATCH 09/92] Backed out changeset 44c751cee3b1 (bug 837242) for suspicion of causing OSX Bustage CLOSED TREE --- content/base/src/nsDocument.cpp | 12 ++++------ layout/base/PositionedEventTargeting.cpp | 8 +++---- layout/base/nsLayoutUtils.cpp | 16 ++++++++----- layout/base/nsLayoutUtils.h | 29 ++++++++++-------------- 4 files changed, 31 insertions(+), 34 deletions(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 65f50a7f955e..4a9c8a70139e 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -3137,9 +3137,8 @@ nsDocument::ElementFromPointHelper(float aX, float aY, return nullptr; // return null to premature XUL callers as a reminder to wait } - nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, - nsLayoutUtils::IGNORE_PAINT_SUPPRESSION | - (aIgnoreRootScrollFrame ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0)); + nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, true, + aIgnoreRootScrollFrame); if (!ptFrame) { return nullptr; } @@ -3193,8 +3192,7 @@ nsDocument::NodesFromRectHelper(float aX, float aY, nsAutoTArray outFrames; nsLayoutUtils::GetFramesForArea(rootFrame, rect, outFrames, - nsLayoutUtils::IGNORE_PAINT_SUPPRESSION | - (aIgnoreRootScrollFrame ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0)); + true, aIgnoreRootScrollFrame); // Used to filter out repeated elements in sequence. nsIContent* lastAdded = nullptr; @@ -9325,8 +9323,8 @@ nsIDocument::CaretPositionFromPoint(float aX, float aY) return nullptr; } - nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, - nsLayoutUtils::IGNORE_PAINT_SUPPRESSION); + nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, true, + false); if (!ptFrame) { return nullptr; } diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp index 2072a4e57797..c1f77d1bcbb9 100644 --- a/layout/base/PositionedEventTargeting.cpp +++ b/layout/base/PositionedEventTargeting.cpp @@ -249,10 +249,10 @@ FindFrameTargetedByInputEvent(const nsGUIEvent *aEvent, const nsPoint& aPointRelativeToRootFrame, uint32_t aFlags) { - uint32_t flags = (aFlags & INPUT_IGNORE_ROOT_SCROLL_FRAME) ? - nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0; + bool ignoreRootScrollFrame = (aFlags & INPUT_IGNORE_ROOT_SCROLL_FRAME) != 0; nsIFrame* target = - nsLayoutUtils::GetFrameForPoint(aRootFrame, aPointRelativeToRootFrame, flags); + nsLayoutUtils::GetFrameForPoint(aRootFrame, aPointRelativeToRootFrame, + false, ignoreRootScrollFrame); const EventRadiusPrefs* prefs = GetPrefsFor(aEvent->eventStructType); if (!prefs || !prefs->mEnabled || (target && IsElementClickable(target))) { @@ -271,7 +271,7 @@ FindFrameTargetedByInputEvent(const nsGUIEvent *aEvent, nsRect targetRect = GetTargetRect(aRootFrame, aPointRelativeToRootFrame, prefs); nsAutoTArray candidates; nsresult rv = nsLayoutUtils::GetFramesForArea(aRootFrame, targetRect, candidates, - flags | nsLayoutUtils::EXCLUDE_COVERED_FRAMES); + false, ignoreRootScrollFrame); if (NS_FAILED(rv)) { return target; } diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 8162ea3da6ea..dddbf7941f4e 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1802,12 +1802,15 @@ nsLayoutUtils::GetRemoteContentIds(nsIFrame* aFrame, } nsIFrame* -nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, uint32_t aFlags) +nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, + bool aShouldIgnoreSuppression, + bool aIgnoreRootScrollFrame) { PROFILER_LABEL("nsLayoutUtils", "GetFrameForPoint"); nsresult rv; nsAutoTArray outFrames; - rv = GetFramesForArea(aFrame, nsRect(aPt, nsSize(1, 1)), outFrames, aFlags); + rv = GetFramesForArea(aFrame, nsRect(aPt, nsSize(1, 1)), outFrames, + aShouldIgnoreSuppression, aIgnoreRootScrollFrame); NS_ENSURE_SUCCESS(rv, nullptr); return outFrames.Length() ? outFrames.ElementAt(0) : nullptr; } @@ -1815,19 +1818,20 @@ nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, uint32_t aFlags) nsresult nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect, nsTArray &aOutFrames, - uint32_t aFlags) + bool aShouldIgnoreSuppression, + bool aIgnoreRootScrollFrame) { PROFILER_LABEL("nsLayoutUtils","GetFramesForArea"); nsDisplayListBuilder builder(aFrame, nsDisplayListBuilder::EVENT_DELIVERY, - false); + false); nsDisplayList list; nsRect target(aRect); - if (aFlags & IGNORE_PAINT_SUPPRESSION) { + if (aShouldIgnoreSuppression) { builder.IgnorePaintSuppression(); } - if (aFlags & IGNORE_ROOT_SCROLL_FRAME) { + if (aIgnoreRootScrollFrame) { nsIFrame* rootScrollFrame = aFrame->PresContext()->PresShell()->GetRootScrollFrame(); if (rootScrollFrame) { diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 263292c2e92b..a6ad34415365 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -526,28 +526,19 @@ public: nsTArray &aOutIDs, bool aIgnoreRootScrollFrame); - enum FrameForPointFlags { - /** - * When set, paint suppression is ignored, so we'll return non-root page - * elements even if paint suppression is stopping them from painting. - */ - IGNORE_PAINT_SUPPRESSION = 0x01, - /** - * When set, clipping due to the root scroll frame (and any other viewport- - * related clipping) is ignored. - */ - IGNORE_ROOT_SCROLL_FRAME = 0x02 - }; - /** * Given aFrame, the root frame of a stacking context, find its descendant * frame under the point aPt that receives a mouse event at that location, * or nullptr if there is no such frame. * @param aPt the point, relative to the frame origin - * @param aFlags some combination of FrameForPointFlags + * @param aShouldIgnoreSuppression a boolean to control if the display + * list builder should ignore paint suppression or not + * @param aIgnoreRootScrollFrame whether or not the display list builder + * should ignore the root scroll frame. */ static nsIFrame* GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, - uint32_t aFlags = 0); + bool aShouldIgnoreSuppression = false, + bool aIgnoreRootScrollFrame = false); /** * Given aFrame, the root frame of a stacking context, find all descendant @@ -555,11 +546,15 @@ public: * or nullptr if there is no such frame. * @param aRect the rect, relative to the frame origin * @param aOutFrames an array to add all the frames found - * @param aFlags some combination of FrameForPointFlags + * @param aShouldIgnoreSuppression a boolean to control if the display + * list builder should ignore paint suppression or not + * @param aIgnoreRootScrollFrame whether or not the display list builder + * should ignore the root scroll frame. */ static nsresult GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect, nsTArray &aOutFrames, - uint32_t aFlags = 0); + bool aShouldIgnoreSuppression = false, + bool aIgnoreRootScrollFrame = false); /** * Transform aRect relative to aAncestor down to the coordinate system of From 9590164ca285e06882239b90cc2d7712b5943cee Mon Sep 17 00:00:00 2001 From: Marty Rosenberg Date: Fri, 26 Jul 2013 03:50:22 -0400 Subject: [PATCH 10/92] bug 894251: NEVER use mov to move the address of a call target. The tracer has no clue how to deal with a single instruction move (r=jandem) --- js/src/ion/arm/MacroAssembler-arm.cpp | 30 +++++++++++++++++++++------ js/src/ion/arm/MacroAssembler-arm.h | 16 ++++++++++++-- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/js/src/ion/arm/MacroAssembler-arm.cpp b/js/src/ion/arm/MacroAssembler-arm.cpp index badd5fc25ab1..ed14deb635a1 100644 --- a/js/src/ion/arm/MacroAssembler-arm.cpp +++ b/js/src/ion/arm/MacroAssembler-arm.cpp @@ -389,11 +389,11 @@ MacroAssemblerARM::ma_mov(const ImmGCPtr &ptr, Register dest) // before to recover the pointer, and not after. writeDataRelocation(ptr); RelocStyle rs; - if (hasMOVWT()) { + if (hasMOVWT()) rs = L_MOVWT; - } else { + else rs = L_LDR; - } + ma_movPatchable(Imm32(ptr.value), dest, Always, rs); } @@ -1527,7 +1527,13 @@ MacroAssemblerARMCompat::callWithExitFrame(IonCode *target) Push(Imm32(descriptor)); // descriptor addPendingJump(m_buffer.nextOffset(), target->raw(), Relocation::IONCODE); - ma_mov(Imm32((int) target->raw()), ScratchRegister); + RelocStyle rs; + if (hasMOVWT()) + rs = L_MOVWT; + else + rs = L_LDR; + + ma_movPatchable(Imm32((int) target->raw()), ScratchRegister, Always, rs); ma_callIonHalfPush(ScratchRegister); } @@ -1539,7 +1545,13 @@ MacroAssemblerARMCompat::callWithExitFrame(IonCode *target, Register dynStack) Push(dynStack); // descriptor addPendingJump(m_buffer.nextOffset(), target->raw(), Relocation::IONCODE); - ma_mov(Imm32((int) target->raw()), ScratchRegister); + RelocStyle rs; + if (hasMOVWT()) + rs = L_MOVWT; + else + rs = L_LDR; + + ma_movPatchable(Imm32((int) target->raw()), ScratchRegister, Always, rs); ma_callIonHalfPush(ScratchRegister); } @@ -2970,7 +2982,13 @@ MacroAssemblerARM::ma_callIonHalfPush(const Register r) void MacroAssemblerARM::ma_call(void *dest) { - ma_mov(Imm32((uint32_t)dest), CallReg); + RelocStyle rs; + if (hasMOVWT()) + rs = L_MOVWT; + else + rs = L_LDR; + + ma_movPatchable(Imm32((uint32_t) dest), CallReg, Always, rs); as_blx(CallReg); } diff --git a/js/src/ion/arm/MacroAssembler-arm.h b/js/src/ion/arm/MacroAssembler-arm.h index 1774de57524f..0db5713421a8 100644 --- a/js/src/ion/arm/MacroAssembler-arm.h +++ b/js/src/ion/arm/MacroAssembler-arm.h @@ -516,13 +516,25 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM void call(IonCode *c) { BufferOffset bo = m_buffer.nextOffset(); addPendingJump(bo, c->raw(), Relocation::IONCODE); - ma_mov(Imm32((uint32_t)c->raw()), ScratchRegister); + RelocStyle rs; + if (hasMOVWT()) + rs = L_MOVWT; + else + rs = L_LDR; + + ma_movPatchable(Imm32((int) c->raw()), ScratchRegister, Always, rs); ma_callIonHalfPush(ScratchRegister); } void branch(IonCode *c) { BufferOffset bo = m_buffer.nextOffset(); addPendingJump(bo, c->raw(), Relocation::IONCODE); - ma_mov(Imm32((uint32_t)c->raw()), ScratchRegister); + RelocStyle rs; + if (hasMOVWT()) + rs = L_MOVWT; + else + rs = L_LDR; + + ma_movPatchable(Imm32((int) c->raw()), ScratchRegister, Always, rs); ma_bx(ScratchRegister); } void branch(const Register reg) { From ebf3afbab41268ec1087525afacd167cf27937b3 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Fri, 26 Jul 2013 10:00:38 +0100 Subject: [PATCH 11/92] Bug 896949 - JS_SetProperty APIs should take an immutable parameter r=waldo r=bz --- content/xbl/src/nsXBLProtoImplField.cpp | 4 +- .../templates/src/nsXULTemplateBuilder.cpp | 4 +- dom/bluetooth/BluetoothUtils.cpp | 2 +- dom/camera/CameraControlImpl.cpp | 10 ++--- dom/camera/CameraRecorderProfiles.cpp | 20 +++++----- dom/camera/CameraRecorderProfiles.h | 6 +-- dom/camera/DOMCameraCapabilities.cpp | 8 ++-- dom/plugins/base/nsJSNPRuntime.cpp | 3 +- dom/system/OSFileConstants.cpp | 6 +-- js/ipc/JavaScriptChild.cpp | 2 +- js/ipc/JavaScriptParent.cpp | 2 +- js/src/builtin/TestingFunctions.cpp | 38 +++++++++---------- js/src/jsapi-tests/testContexts.cpp | 2 +- js/src/jsapi-tests/testDebugger.cpp | 4 +- js/src/jsapi-tests/testGetPropertyDefault.cpp | 4 +- .../testRegExpInstanceProperties.cpp | 6 +-- js/src/jsapi.cpp | 13 ++++--- js/src/jsapi.h | 6 +-- js/src/shell/js.cpp | 10 ++--- js/src/shell/jsheaptools.cpp | 2 +- js/xpconnect/loader/mozJSComponentLoader.cpp | 2 +- js/xpconnect/src/XPCComponents.cpp | 2 +- js/xpconnect/src/XPCWrappedJSClass.cpp | 4 +- js/xpconnect/src/XPCWrappedNative.cpp | 2 +- .../directory/nsDirectoryViewer.cpp | 2 +- 25 files changed, 81 insertions(+), 83 deletions(-) diff --git a/content/xbl/src/nsXBLProtoImplField.cpp b/content/xbl/src/nsXBLProtoImplField.cpp index 4e40da0fc69d..10745d4bf3f0 100644 --- a/content/xbl/src/nsXBLProtoImplField.cpp +++ b/content/xbl/src/nsXBLProtoImplField.cpp @@ -280,9 +280,7 @@ FieldSetterImpl(JSContext *cx, JS::CallArgs args) } if (installed) { - JS::Rooted v(cx, - args.length() > 0 ? args[0] : JS::UndefinedValue()); - if (!::JS_SetPropertyById(cx, thisObj, id, &v)) { + if (!::JS_SetPropertyById(cx, thisObj, id, args.get(0))) { return false; } } diff --git a/content/xul/templates/src/nsXULTemplateBuilder.cpp b/content/xul/templates/src/nsXULTemplateBuilder.cpp index ff7fe5016984..c2d44df41f18 100644 --- a/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -1404,7 +1404,7 @@ nsXULTemplateBuilder::InitHTMLTemplateRoot() NS_ENSURE_SUCCESS(rv, rv); bool ok; - ok = JS_SetProperty(jscontext, jselement, "database", &jsdatabase); + ok = JS_SetProperty(jscontext, jselement, "database", jsdatabase); NS_ASSERTION(ok, "unable to set database property"); if (! ok) return NS_ERROR_FAILURE; @@ -1421,7 +1421,7 @@ nsXULTemplateBuilder::InitHTMLTemplateRoot() NS_ENSURE_SUCCESS(rv, rv); bool ok; - ok = JS_SetProperty(jscontext, jselement, "builder", &jsbuilder); + ok = JS_SetProperty(jscontext, jselement, "builder", jsbuilder); if (! ok) return NS_ERROR_FAILURE; } diff --git a/dom/bluetooth/BluetoothUtils.cpp b/dom/bluetooth/BluetoothUtils.cpp index c9b58482f211..7027aafeeb22 100644 --- a/dom/bluetooth/BluetoothUtils.cpp +++ b/dom/bluetooth/BluetoothUtils.cpp @@ -61,7 +61,7 @@ SetJsObject(JSContext* aContext, if (!JS_SetProperty(aContext, aObj, NS_ConvertUTF16toUTF8(arr[i].name()).get(), - &val)) { + val)) { NS_WARNING("Failed to set property"); return false; } diff --git a/dom/camera/CameraControlImpl.cpp b/dom/camera/CameraControlImpl.cpp index c8ab088c0a49..8e52f70d84f6 100644 --- a/dom/camera/CameraControlImpl.cpp +++ b/dom/camera/CameraControlImpl.cpp @@ -161,27 +161,27 @@ CameraControlImpl::Get(JSContext* aCx, uint32_t aKey, JS::Value* aValue) DOM_CAMERA_LOGI("top=%d\n", r->top); v = INT_TO_JSVAL(r->top); - if (!JS_SetProperty(aCx, o, "top", &v)) { + if (!JS_SetProperty(aCx, o, "top", v)) { return NS_ERROR_FAILURE; } DOM_CAMERA_LOGI("left=%d\n", r->left); v = INT_TO_JSVAL(r->left); - if (!JS_SetProperty(aCx, o, "left", &v)) { + if (!JS_SetProperty(aCx, o, "left", v)) { return NS_ERROR_FAILURE; } DOM_CAMERA_LOGI("bottom=%d\n", r->bottom); v = INT_TO_JSVAL(r->bottom); - if (!JS_SetProperty(aCx, o, "bottom", &v)) { + if (!JS_SetProperty(aCx, o, "bottom", v)) { return NS_ERROR_FAILURE; } DOM_CAMERA_LOGI("right=%d\n", r->right); v = INT_TO_JSVAL(r->right); - if (!JS_SetProperty(aCx, o, "right", &v)) { + if (!JS_SetProperty(aCx, o, "right", v)) { return NS_ERROR_FAILURE; } DOM_CAMERA_LOGI("weight=%d\n", r->weight); v = INT_TO_JSVAL(r->weight); - if (!JS_SetProperty(aCx, o, "weight", &v)) { + if (!JS_SetProperty(aCx, o, "weight", v)) { return NS_ERROR_FAILURE; } diff --git a/dom/camera/CameraRecorderProfiles.cpp b/dom/camera/CameraRecorderProfiles.cpp index 3dbc5e5eeb6d..34bad7d86df3 100644 --- a/dom/camera/CameraRecorderProfiles.cpp +++ b/dom/camera/CameraRecorderProfiles.cpp @@ -36,31 +36,31 @@ RecorderVideoProfile::GetJsObject(JSContext* aCx, JSObject** aObject) JS::Rooted s(aCx, JS_NewStringCopyZ(aCx, codec)); JS::Rooted v(aCx, STRING_TO_JSVAL(s)); - if (!JS_SetProperty(aCx, o, "codec", &v)) { + if (!JS_SetProperty(aCx, o, "codec", v)) { return NS_ERROR_FAILURE; } if (mBitrate != -1) { v = INT_TO_JSVAL(mBitrate); - if (!JS_SetProperty(aCx, o, "bitrate", &v)) { + if (!JS_SetProperty(aCx, o, "bitrate", v)) { return NS_ERROR_FAILURE; } } if (mFramerate != -1) { v = INT_TO_JSVAL(mFramerate); - if (!JS_SetProperty(aCx, o, "framerate", &v)) { + if (!JS_SetProperty(aCx, o, "framerate", v)) { return NS_ERROR_FAILURE; } } if (mWidth != -1) { v = INT_TO_JSVAL(mWidth); - if (!JS_SetProperty(aCx, o, "width", &v)) { + if (!JS_SetProperty(aCx, o, "width", v)) { return NS_ERROR_FAILURE; } } if (mHeight != -1) { v = INT_TO_JSVAL(mHeight); - if (!JS_SetProperty(aCx, o, "height", &v)) { + if (!JS_SetProperty(aCx, o, "height", v)) { return NS_ERROR_FAILURE; } } @@ -97,25 +97,25 @@ RecorderAudioProfile::GetJsObject(JSContext* aCx, JSObject** aObject) JS::Rooted s(aCx, JS_NewStringCopyZ(aCx, codec)); JS::Rooted v(aCx, STRING_TO_JSVAL(s)); - if (!JS_SetProperty(aCx, o, "codec", &v)) { + if (!JS_SetProperty(aCx, o, "codec", v)) { return NS_ERROR_FAILURE; } if (mBitrate != -1) { v = INT_TO_JSVAL(mBitrate); - if (!JS_SetProperty(aCx, o, "bitrate", &v)) { + if (!JS_SetProperty(aCx, o, "bitrate", v)) { return NS_ERROR_FAILURE; } } if (mSamplerate != -1) { v = INT_TO_JSVAL(mSamplerate); - if (!JS_SetProperty(aCx, o, "samplerate", &v)) { + if (!JS_SetProperty(aCx, o, "samplerate", v)) { return NS_ERROR_FAILURE; } } if (mChannels != -1) { v = INT_TO_JSVAL(mChannels); - if (!JS_SetProperty(aCx, o, "channels", &v)) { + if (!JS_SetProperty(aCx, o, "channels", v)) { return NS_ERROR_FAILURE; } } @@ -185,7 +185,7 @@ RecorderProfileManager::GetJsObject(JSContext* aCx, JSObject** aObject) const NS_ENSURE_SUCCESS(rv, rv); JS::Rooted v(aCx, OBJECT_TO_JSVAL(p)); - if (!JS_SetProperty(aCx, o, profileName, &v)) { + if (!JS_SetProperty(aCx, o, profileName, v)) { return NS_ERROR_FAILURE; } } diff --git a/dom/camera/CameraRecorderProfiles.h b/dom/camera/CameraRecorderProfiles.h index e6bcd32b3206..7ec20120116e 100644 --- a/dom/camera/CameraRecorderProfiles.h +++ b/dom/camera/CameraRecorderProfiles.h @@ -180,7 +180,7 @@ public: JS::Rooted s(aCx, JS_NewStringCopyZ(aCx, format)); JS::Rooted v(aCx, STRING_TO_JSVAL(s)); - if (!JS_SetProperty(aCx, o, "format", &v)) { + if (!JS_SetProperty(aCx, o, "format", v)) { return NS_ERROR_FAILURE; } @@ -188,7 +188,7 @@ public: nsresult rv = mVideo.GetJsObject(aCx, video.address()); NS_ENSURE_SUCCESS(rv, rv); v = OBJECT_TO_JSVAL(video); - if (!JS_SetProperty(aCx, o, "video", &v)) { + if (!JS_SetProperty(aCx, o, "video", v)) { return NS_ERROR_FAILURE; } @@ -196,7 +196,7 @@ public: rv = mAudio.GetJsObject(aCx, audio.address()); NS_ENSURE_SUCCESS(rv, rv); v = OBJECT_TO_JSVAL(audio); - if (!JS_SetProperty(aCx, o, "audio", &v)) { + if (!JS_SetProperty(aCx, o, "audio", v)) { return NS_ERROR_FAILURE; } diff --git a/dom/camera/DOMCameraCapabilities.cpp b/dom/camera/DOMCameraCapabilities.cpp index ccd7f89202e9..bec5946a5d29 100644 --- a/dom/camera/DOMCameraCapabilities.cpp +++ b/dom/camera/DOMCameraCapabilities.cpp @@ -95,10 +95,10 @@ ParseDimensionItemAndAdd(JSContext* aCx, JS::Handle aArray, return NS_ERROR_OUT_OF_MEMORY; } - if (!JS_SetProperty(aCx, o, "width", &w)) { + if (!JS_SetProperty(aCx, o, "width", w)) { return NS_ERROR_FAILURE; } - if (!JS_SetProperty(aCx, o, "height", &h)) { + if (!JS_SetProperty(aCx, o, "height", h)) { return NS_ERROR_FAILURE; } @@ -371,11 +371,11 @@ DOMCameraCapabilities::GetVideoSizes(JSContext* cx, JS::Value* aVideoSizes) for (uint32_t i = 0; i < sizes.Length(); ++i) { JS::Rooted o(cx, JS_NewObject(cx, nullptr, nullptr, nullptr)); JS::Rooted v(cx, INT_TO_JSVAL(sizes[i].width)); - if (!JS_SetProperty(cx, o, "width", &v)) { + if (!JS_SetProperty(cx, o, "width", v)) { return NS_ERROR_FAILURE; } v = INT_TO_JSVAL(sizes[i].height); - if (!JS_SetProperty(cx, o, "height", &v)) { + if (!JS_SetProperty(cx, o, "height", v)) { return NS_ERROR_FAILURE; } diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index ed7811432619..9087c987b4a9 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -787,8 +787,7 @@ nsJSObjWrapper::NP_SetProperty(NPObject *npobj, NPIdentifier id, NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id), "id must be either string or int!\n"); - ok = ::JS_SetPropertyById(cx, npjsobj->mJSObj, NPIdentifierToJSId(id), - &v); + ok = ::JS_SetPropertyById(cx, npjsobj->mJSObj, NPIdentifierToJSId(id), v); // return ok == JS_TRUE to quiet down compiler warning, even if // return ok is what we really want. diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp index c2081e5c81b2..00e27e28b889 100644 --- a/dom/system/OSFileConstants.cpp +++ b/dom/system/OSFileConstants.cpp @@ -634,7 +634,7 @@ bool SetStringProperty(JSContext *cx, JS::Handle aObject, const char JSString* strValue = JS_NewUCStringCopyZ(cx, aValue.get()); NS_ENSURE_TRUE(strValue, false); JS::Rooted valValue(cx, STRING_TO_JSVAL(strValue)); - return JS_SetProperty(cx, aObject, aProperty, &valValue); + return JS_SetProperty(cx, aObject, aProperty, valValue); } /** @@ -707,14 +707,14 @@ bool DefineOSFileConstants(JSContext *cx, JS::Handle global) } JS::Rooted valVersion(cx, STRING_TO_JSVAL(strVersion)); - if (!JS_SetProperty(cx, objSys, "Name", &valVersion)) { + if (!JS_SetProperty(cx, objSys, "Name", valVersion)) { return false; } } #if defined(DEBUG) JS::Rooted valDebug(cx, JSVAL_TRUE); - if (!JS_SetProperty(cx, objSys, "DEBUG", &valDebug)) { + if (!JS_SetProperty(cx, objSys, "DEBUG", valDebug)) { return false; } #endif diff --git a/js/ipc/JavaScriptChild.cpp b/js/ipc/JavaScriptChild.cpp index 05e2612bf281..2932571d581e 100644 --- a/js/ipc/JavaScriptChild.cpp +++ b/js/ipc/JavaScriptChild.cpp @@ -414,7 +414,7 @@ JavaScriptChild::AnswerSet(const ObjectId &objId, const ObjectId &receiverId, co if (!toValue(cx, value, &val)) return fail(cx, rs); - if (!JS_SetPropertyById(cx, obj, internedId, &val)) + if (!JS_SetPropertyById(cx, obj, internedId, val)) return fail(cx, rs); if (!toVariant(cx, val, result)) diff --git a/js/ipc/JavaScriptParent.cpp b/js/ipc/JavaScriptParent.cpp index af87ded5688c..0cff35f32f44 100644 --- a/js/ipc/JavaScriptParent.cpp +++ b/js/ipc/JavaScriptParent.cpp @@ -436,7 +436,7 @@ JavaScriptParent::call(JSContext *cx, HandleObject proxy, const CallArgs &args) return false; JSObject *obj = &outobjects[i].toObject(); - if (!JS_SetProperty(cx, obj, "value", &v)) + if (!JS_SetProperty(cx, obj, "value", v)) return false; } diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 1fc537d85a60..3dae9a73abe1 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -38,7 +38,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "rooting-analysis", &value)) + if (!JS_SetProperty(cx, info, "rooting-analysis", value)) return false; #ifdef JSGC_USE_EXACT_ROOTING @@ -46,7 +46,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "exact-rooting", &value)) + if (!JS_SetProperty(cx, info, "exact-rooting", value)) return false; #ifdef DEBUG @@ -54,7 +54,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "debug", &value)) + if (!JS_SetProperty(cx, info, "debug", value)) return false; #ifdef JS_HAS_CTYPES @@ -62,7 +62,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "has-ctypes", &value)) + if (!JS_SetProperty(cx, info, "has-ctypes", value)) return false; #ifdef JS_CPU_X86 @@ -70,7 +70,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "x86", &value)) + if (!JS_SetProperty(cx, info, "x86", value)) return false; #ifdef JS_CPU_X64 @@ -78,7 +78,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "x64", &value)) + if (!JS_SetProperty(cx, info, "x64", value)) return false; #ifdef MOZ_ASAN @@ -86,7 +86,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "asan", &value)) + if (!JS_SetProperty(cx, info, "asan", value)) return false; #ifdef JS_GC_ZEAL @@ -94,7 +94,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "has-gczeal", &value)) + if (!JS_SetProperty(cx, info, "has-gczeal", value)) return false; #ifdef JS_THREADSAFE @@ -102,7 +102,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "threadsafe", &value)) + if (!JS_SetProperty(cx, info, "threadsafe", value)) return false; #ifdef JS_MORE_DETERMINISTIC @@ -110,7 +110,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "more-deterministic", &value)) + if (!JS_SetProperty(cx, info, "more-deterministic", value)) return false; #ifdef MOZ_PROFILING @@ -118,7 +118,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "profiling", &value)) + if (!JS_SetProperty(cx, info, "profiling", value)) return false; #ifdef INCLUDE_MOZILLA_DTRACE @@ -126,7 +126,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "dtrace", &value)) + if (!JS_SetProperty(cx, info, "dtrace", value)) return false; #ifdef MOZ_TRACE_JSCALLS @@ -134,7 +134,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "trace-jscalls-api", &value)) + if (!JS_SetProperty(cx, info, "trace-jscalls-api", value)) return false; #ifdef JSGC_INCREMENTAL @@ -142,7 +142,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "incremental-gc", &value)) + if (!JS_SetProperty(cx, info, "incremental-gc", value)) return false; #ifdef JSGC_GENERATIONAL @@ -150,7 +150,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "generational-gc", &value)) + if (!JS_SetProperty(cx, info, "generational-gc", value)) return false; #ifdef MOZ_VALGRIND @@ -158,7 +158,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "valgrind", &value)) + if (!JS_SetProperty(cx, info, "valgrind", value)) return false; #ifdef JS_OOM_DO_BACKTRACES @@ -166,7 +166,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "oom-backtraces", &value)) + if (!JS_SetProperty(cx, info, "oom-backtraces", value)) return false; #ifdef ENABLE_PARALLEL_JS @@ -174,7 +174,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "parallelJS", &value)) + if (!JS_SetProperty(cx, info, "parallelJS", value)) return false; #ifdef ENABLE_BINARYDATA @@ -182,7 +182,7 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) #else value = BooleanValue(false); #endif - if (!JS_SetProperty(cx, info, "binary-data", &value)) + if (!JS_SetProperty(cx, info, "binary-data", value)) return false; *vp = ObjectValue(*info); diff --git a/js/src/jsapi-tests/testContexts.cpp b/js/src/jsapi-tests/testContexts.cpp index ab99d8011cb4..64a0e5b443ba 100644 --- a/js/src/jsapi-tests/testContexts.cpp +++ b/js/src/jsapi-tests/testContexts.cpp @@ -41,7 +41,7 @@ BEGIN_TEST(testContexts_bug563735) JSAutoRequest req(cx2); JSAutoCompartment ac(cx2, global); JS::RootedValue v(cx2); - ok = JS_SetProperty(cx2, global, "x", &v); + ok = JS_SetProperty(cx2, global, "x", v); } CHECK(ok); diff --git a/js/src/jsapi-tests/testDebugger.cpp b/js/src/jsapi-tests/testDebugger.cpp index b92c7375c310..48eb0def7f35 100644 --- a/js/src/jsapi-tests/testDebugger.cpp +++ b/js/src/jsapi-tests/testDebugger.cpp @@ -161,7 +161,7 @@ BEGIN_TEST(testDebugger_debuggerObjectVsDebugMode) JS::RootedObject debuggeeWrapper(cx, debuggee); CHECK(JS_WrapObject(cx, debuggeeWrapper.address())); JS::RootedValue v(cx, JS::ObjectValue(*debuggeeWrapper)); - CHECK(JS_SetProperty(cx, global, "debuggee", &v)); + CHECK(JS_SetProperty(cx, global, "debuggee", v)); EVAL("var dbg = new Debugger(debuggee);\n" "var hits = 0;\n" @@ -199,7 +199,7 @@ BEGIN_TEST(testDebugger_newScriptHook) JS::RootedObject gWrapper(cx, g); CHECK(JS_WrapObject(cx, gWrapper.address())); JS::RootedValue v(cx, JS::ObjectValue(*gWrapper)); - CHECK(JS_SetProperty(cx, global, "g", &v)); + CHECK(JS_SetProperty(cx, global, "g", v)); EXEC("var dbg = Debugger(g);\n" "var hits = 0;\n" diff --git a/js/src/jsapi-tests/testGetPropertyDefault.cpp b/js/src/jsapi-tests/testGetPropertyDefault.cpp index bf6efe189750..5ac24e92deda 100644 --- a/js/src/jsapi-tests/testGetPropertyDefault.cpp +++ b/js/src/jsapi-tests/testGetPropertyDefault.cpp @@ -29,7 +29,7 @@ BEGIN_TEST(testGetPropertyDefault_bug594060) CHECK(obj); JS::RootedValue v0(cx, JSVAL_TRUE); - CHECK(JS_SetProperty(cx, obj, "here", &v0)); + CHECK(JS_SetProperty(cx, obj, "here", v0)); JS::RootedValue v1(cx); CHECK(JS_GetPropertyDefault(cx, obj, "here", JSVAL_FALSE, v1.address())); @@ -53,7 +53,7 @@ BEGIN_TEST(testGetPropertyDefault_bug594060) CHECK(stringToId(cx, "nothere", nothereid.address())); JS::RootedValue v0(cx, JSVAL_TRUE); - CHECK(JS_SetPropertyById(cx, obj, hereid, &v0)); + CHECK(JS_SetPropertyById(cx, obj, hereid, v0)); JS::RootedValue v1(cx); CHECK(JS_GetPropertyByIdDefault(cx, obj, hereid, JSVAL_FALSE, v1.address())); diff --git a/js/src/jsapi-tests/testRegExpInstanceProperties.cpp b/js/src/jsapi-tests/testRegExpInstanceProperties.cpp index 23777f98933a..232f820917bf 100644 --- a/js/src/jsapi-tests/testRegExpInstanceProperties.cpp +++ b/js/src/jsapi-tests/testRegExpInstanceProperties.cpp @@ -55,10 +55,10 @@ JS_NEVER_INLINE bool helper(JSObject *regexpProto) CHECK(!r.empty()); } - jsval v = INT_TO_JSVAL(17); - CHECK(JS_SetProperty(cx, regexpProto, "foopy", &v)); + JS::RootedValue v(cx, INT_TO_JSVAL(17)); + CHECK(JS_SetProperty(cx, regexpProto, "foopy", v)); v = INT_TO_JSVAL(42); - CHECK(JS_SetProperty(cx, regexpProto, "bunky", &v)); + CHECK(JS_SetProperty(cx, regexpProto, "bunky", v)); CHECK(JS_DeleteProperty(cx, regexpProto, "foopy")); CHECK(regexpProto->inDictionaryMode()); diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 9c5adc7cb9ed..bef3eb71ac0d 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -4308,16 +4308,17 @@ JS_GetUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t nam } JS_PUBLIC_API(JSBool) -JS_SetPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, MutableHandleValue vp) +JS_SetPropertyById(JSContext *cx, JSObject *objArg, jsid idArg, HandleValue v) { RootedObject obj(cx, objArg); RootedId id(cx, idArg); + RootedValue value(cx, v); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj, id); JSAutoResolveFlags rf(cx, JSRESOLVE_ASSIGNING); - return JSObject::setGeneric(cx, obj, obj, id, vp, false); + return JSObject::setGeneric(cx, obj, obj, id, &value, false); } JS_PUBLIC_API(JSBool) @@ -4338,20 +4339,20 @@ JS_SetElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval *vp) } JS_PUBLIC_API(JSBool) -JS_SetProperty(JSContext *cx, JSObject *objArg, const char *name, MutableHandleValue vp) +JS_SetProperty(JSContext *cx, JSObject *objArg, const char *name, HandleValue v) { RootedObject obj(cx, objArg); JSAtom *atom = Atomize(cx, name, strlen(name)); - return atom && JS_SetPropertyById(cx, obj, AtomToId(atom), vp); + return atom && JS_SetPropertyById(cx, obj, AtomToId(atom), v); } JS_PUBLIC_API(JSBool) JS_SetUCProperty(JSContext *cx, JSObject *objArg, const jschar *name, size_t namelen, - MutableHandleValue vp) + HandleValue v) { RootedObject obj(cx, objArg); JSAtom *atom = AtomizeChars(cx, name, AUTO_NAMELEN(name, namelen)); - return atom && JS_SetPropertyById(cx, obj, AtomToId(atom), vp); + return atom && JS_SetPropertyById(cx, obj, AtomToId(atom), v); } JS_PUBLIC_API(JSBool) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 7b02250df2d1..8c26fd74b201 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -3489,10 +3489,10 @@ extern JS_PUBLIC_API(JSBool) JS_ForwardGetPropertyTo(JSContext *cx, JSObject *obj, jsid id, JSObject *onBehalfOf, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle vp); +JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v); extern JS_PUBLIC_API(JSBool) -JS_SetPropertyById(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle vp); +JS_SetPropertyById(JSContext *cx, JSObject *obj, jsid id, JS::Handle v); extern JS_PUBLIC_API(JSBool) JS_DeleteProperty(JSContext *cx, JSObject *obj, const char *name); @@ -3577,7 +3577,7 @@ JS_GetUCProperty(JSContext *cx, JSObject *obj, extern JS_PUBLIC_API(JSBool) JS_SetUCProperty(JSContext *cx, JSObject *obj, const jschar *name, size_t namelen, - JS::MutableHandle vp); + JS::Handle v); extern JS_PUBLIC_API(JSBool) JS_DeleteUCProperty2(JSContext *cx, JSObject *obj, diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index a58e84924cdb..657f9981924f 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -2408,10 +2408,10 @@ GetPDA(JSContext *cx, unsigned argc, jsval *vp) value = pd->value; flags.setInt32(pd->flags); alias = pd->alias; - ok = JS_SetProperty(cx, pdobj, "id", &id) && - JS_SetProperty(cx, pdobj, "value", &value) && - JS_SetProperty(cx, pdobj, "flags", &flags) && - JS_SetProperty(cx, pdobj, "alias", &alias); + ok = JS_SetProperty(cx, pdobj, "id", id) && + JS_SetProperty(cx, pdobj, "value", value) && + JS_SetProperty(cx, pdobj, "flags", flags) && + JS_SetProperty(cx, pdobj, "alias", alias); if (!ok) break; } @@ -2517,7 +2517,7 @@ NewSandbox(JSContext *cx, bool lazy) return NULL; RootedValue value(cx, BooleanValue(lazy)); - if (!JS_SetProperty(cx, obj, "lazy", &value)) + if (!JS_SetProperty(cx, obj, "lazy", value)) return NULL; } diff --git a/js/src/shell/jsheaptools.cpp b/js/src/shell/jsheaptools.cpp index b462ae1cf047..e8b29c7dedfb 100644 --- a/js/src/shell/jsheaptools.cpp +++ b/js/src/shell/jsheaptools.cpp @@ -514,7 +514,7 @@ ReferenceFinder::addReferrer(jsval referrerArg, Path *path) if (!array) return false; v.setObject(*array); - return !!JS_SetProperty(context, result, pathName, &v); + return !!JS_SetProperty(context, result, pathName, v); } /* The property's value had better be an array. */ diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index ec9110a5e63d..459a02311bd0 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -1328,7 +1328,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation, JSAutoCompartment target_ac(mContext, targetObj); if (!JS_WrapValue(mContext, value.address()) || - !JS_SetPropertyById(mContext, targetObj, symbolId, &value)) { + !JS_SetPropertyById(mContext, targetObj, symbolId, value)) { JSAutoByteString bytes(mContext, JSID_TO_STRING(symbolId)); if (!bytes) return NS_ERROR_FAILURE; diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 443cc0ade1c7..4975453318b7 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -4287,7 +4287,7 @@ nsXPCComponents_Utils::MakeObjectPropsNormal(const Value &vobj, JSContext *cx) continue; if (!WrapCallable(cx, obj, id, propobj, &v) || - !JS_SetPropertyById(cx, obj, id, &v)) + !JS_SetPropertyById(cx, obj, id, v)) return NS_ERROR_FAILURE; } diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 8ff5fed41bc9..6ccf8be6745c 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -1366,7 +1366,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex, if (param.IsIn()) { if (!JS_SetPropertyById(cx, out_obj, mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE), - &val)) { + val)) { goto pre_call_clean_up; } } @@ -1434,7 +1434,7 @@ pre_call_clean_up: success = JS_GetProperty(cx, obj, name, rval.address()); } else if (XPT_MD_IS_SETTER(info->flags)) { rval = *argv; - success = JS_SetProperty(cx, obj, name, &rval); + success = JS_SetProperty(cx, obj, name, rval); } else { if (!JSVAL_IS_PRIMITIVE(fval)) { uint32_t oldOpts = JS_GetOptions(cx); diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index 841eb6e3d0f7..7b61dda7431a 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -2348,7 +2348,7 @@ CallMethodHelper::GatherAndConvertResults() NS_ASSERTION(mArgv[i].isObject(), "out var is not object"); if (!JS_SetPropertyById(mCallContext, &mArgv[i].toObject(), - mIdxValueId, &v)) { + mIdxValueId, v)) { ThrowBadParam(NS_ERROR_XPC_CANT_SET_OUT_VAL, i, mCallContext); return false; } diff --git a/xpfe/components/directory/nsDirectoryViewer.cpp b/xpfe/components/directory/nsDirectoryViewer.cpp index 0cfa870756c5..b2ebc10154a0 100644 --- a/xpfe/components/directory/nsDirectoryViewer.cpp +++ b/xpfe/components/directory/nsDirectoryViewer.cpp @@ -261,7 +261,7 @@ nsHTTPIndex::OnStartRequest(nsIRequest *request, nsISupports* aContext) JS::Rooted jslistener(cx, OBJECT_TO_JSVAL(jsobj)); // ...and stuff it into the global context - bool ok = JS_SetProperty(cx, global, "HTTPIndex", &jslistener); + bool ok = JS_SetProperty(cx, global, "HTTPIndex", jslistener); NS_ASSERTION(ok, "unable to set Listener property"); if (!ok) return NS_ERROR_FAILURE; From 9709d43d7652f80b310f00092fbf13cb4fa68601 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Fri, 26 Jul 2013 10:00:38 +0100 Subject: [PATCH 12/92] Bug 897484 - GC: Convert JS_GetProperty APIs to take MutableHandleValue r=terrence r=bholley r=smaug --- caps/src/nsSecurityManagerFactory.cpp | 4 +-- content/base/src/nsFrameMessageManager.cpp | 3 +- content/xbl/src/nsXBLBinding.cpp | 2 +- content/xbl/src/nsXBLProtoImplField.cpp | 2 +- dom/audiochannel/AudioChannelService.cpp | 4 +-- dom/base/nsDOMClassInfo.cpp | 23 +++++++++----- dom/bindings/BindingUtils.cpp | 12 ++++++-- dom/bindings/CallbackInterface.cpp | 2 +- dom/bindings/Codegen.py | 12 ++++---- dom/bluetooth/BluetoothHfpManager.cpp | 4 +-- dom/bluetooth/BluetoothService.cpp | 4 +-- dom/indexedDB/KeyPath.cpp | 3 +- dom/network/src/TCPSocketParent.cpp | 2 +- dom/plugins/base/nsJSNPRuntime.cpp | 10 +++---- dom/src/geolocation/nsGeolocation.cpp | 4 +-- dom/src/json/nsJSON.cpp | 2 +- dom/system/OSFileConstants.cpp | 2 +- dom/system/gonk/AudioManager.cpp | 6 ++-- dom/system/gonk/AutoMounterSetting.cpp | 4 +-- dom/system/gonk/TimeZoneSettingObserver.cpp | 4 +-- dom/workers/ChromeWorkerScope.cpp | 2 +- dom/workers/EventListenerManager.cpp | 8 ++--- dom/workers/Events.cpp | 4 +-- dom/workers/WorkerScope.cpp | 7 +++-- ipc/testshell/XPCShellEnvironment.cpp | 2 +- js/ipc/JavaScriptChild.cpp | 4 +-- js/ipc/JavaScriptShared.cpp | 2 +- js/jsd/jsd_val.cpp | 2 +- js/src/ctypes/CTypes.cpp | 12 ++++---- js/src/jsapi-tests/testArrayBuffer.cpp | 14 ++++----- js/src/jsapi-tests/testException.cpp | 2 +- js/src/jsapi-tests/testFunctionProperties.cpp | 4 +-- js/src/jsapi-tests/testGetPropertyDefault.cpp | 8 ++--- js/src/jsapi-tests/testParseJSON.cpp | 8 ++--- js/src/jsapi.cpp | 30 ++++++++----------- js/src/jsapi.h | 15 ++++++---- js/src/jsdbgapi.cpp | 6 ++-- js/src/jsexn.cpp | 10 +++---- js/src/shell/js.cpp | 24 +++++++-------- js/src/shell/jsheaptools.cpp | 2 +- js/src/vm/Debugger.cpp | 4 +-- js/xpconnect/loader/mozJSComponentLoader.cpp | 6 ++-- js/xpconnect/src/XPCComponents.cpp | 12 ++++---- js/xpconnect/src/XPCWrappedJSClass.cpp | 12 ++++---- js/xpconnect/src/XPCWrappedNative.cpp | 8 ++--- js/xpconnect/src/XPCWrappedNativeJSOps.cpp | 2 +- js/xpconnect/src/dictionary_helper_gen.py | 16 ++++------ .../src/peerconnection/PeerConnectionImpl.cpp | 8 ++--- startupcache/test/TestStartupCache.cpp | 4 +-- toolkit/components/ctypes/ctypes.cpp | 6 ++-- toolkit/components/perf/PerfMeasurement.cpp | 4 +-- toolkit/components/places/History.cpp | 8 ++--- 52 files changed, 185 insertions(+), 180 deletions(-) diff --git a/caps/src/nsSecurityManagerFactory.cpp b/caps/src/nsSecurityManagerFactory.cpp index b775fa88de3e..07333299feef 100644 --- a/caps/src/nsSecurityManagerFactory.cpp +++ b/caps/src/nsSecurityManagerFactory.cpp @@ -85,7 +85,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext) JSClass *objectClass = JS_GetClass(obj); JS::Rooted v(cx); - if (!JS_GetProperty(cx, global, "netscape", v.address())) + if (!JS_GetProperty(cx, global, "netscape", &v)) return NS_ERROR_FAILURE; JS::Rooted securityObj(cx); @@ -95,7 +95,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext) * "security" property. */ obj = &v.toObject(); - if (!JS_GetProperty(cx, obj, "security", v.address()) || !v.isObject()) + if (!JS_GetProperty(cx, obj, "security", &v) || !v.isObject()) return NS_ERROR_FAILURE; securityObj = &v.toObject(); } else { diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index 0ec31525f34f..004ed6c8f786 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -748,8 +748,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget, thisValue.address(), nullptr, true); } else { // If the listener is a JS object which has receiveMessage function: - if (!JS_GetProperty(ctx, object, "receiveMessage", - funval.address()) || + if (!JS_GetProperty(ctx, object, "receiveMessage", &funval) || !funval.isObject()) return NS_ERROR_UNEXPECTED; diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index 956207157f80..ffecdb09b8bb 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -1163,7 +1163,7 @@ nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName, // Find our class object. It's in a protected scope and permanent just in case, // so should be there no matter what. JS::RootedValue classObject(aCx); - if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, classObject.address())) { + if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, &classObject)) { return false; } diff --git a/content/xbl/src/nsXBLProtoImplField.cpp b/content/xbl/src/nsXBLProtoImplField.cpp index 10745d4bf3f0..290555f5e70b 100644 --- a/content/xbl/src/nsXBLProtoImplField.cpp +++ b/content/xbl/src/nsXBLProtoImplField.cpp @@ -244,7 +244,7 @@ FieldGetterImpl(JSContext *cx, JS::CallArgs args) } JS::Rooted v(cx); - if (!JS_GetPropertyById(cx, thisObj, id, v.address())) { + if (!JS_GetPropertyById(cx, thisObj, id, &v)) { return false; } args.rval().set(v); diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index 9bbfd81d70a4..4b9593159157 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -541,7 +541,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", key.address()) || + if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) { return NS_OK; } @@ -556,7 +556,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isInt32()) { + if (!JS_GetProperty(cx, obj, "value", &value) || !value.isInt32()) { return NS_OK; } diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index b9ca18c0614c..c283702dfcec 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -2721,7 +2721,7 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner, JSAutoCompartment ac(cx, thisObject); JS::Rooted funval(cx); - if (!JS_GetProperty(cx, thisObject, "constructor", funval.address()) || + if (!JS_GetProperty(cx, thisObject, "constructor", &funval) || !funval.isObject()) { return NS_ERROR_UNEXPECTED; } @@ -3226,7 +3226,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper, // This isn't a normal DOM object, see if this constructor lives on its // prototype chain. JS::Rooted val(cx); - if (!JS_GetProperty(cx, obj, "prototype", val.address())) { + if (!JS_GetProperty(cx, obj, "prototype", &val)) { return NS_ERROR_UNEXPECTED; } @@ -3967,7 +3967,10 @@ ContentWindowGetter(JSContext *cx, unsigned argc, jsval *vp) if (!obj) return JS_FALSE; - return ::JS_GetProperty(cx, obj, "content", vp); + JS::Rooted value(cx); + bool result = ::JS_GetProperty(cx, obj, "content", &value); + *vp = value; + return result; } template @@ -4114,7 +4117,7 @@ DefineComponentsShim(JSContext *cx, JS::HandleObject global) // Look up the appopriate interface object on the global. JS::Rooted v(cx, JS::UndefinedValue()); - ok = JS_GetProperty(cx, global, domName, v.address()); + ok = JS_GetProperty(cx, global, domName, &v); NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY); if (!v.isObject()) { NS_WARNING("Unable to find interface object on global"); @@ -4645,7 +4648,7 @@ nsGenericArraySH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx, *length = 0; JS::Rooted lenval(cx); - if (!JS_GetProperty(cx, obj, "length", lenval.address())) { + if (!JS_GetProperty(cx, obj, "length", &lenval)) { return NS_ERROR_UNEXPECTED; } @@ -4684,7 +4687,7 @@ nsGenericArraySH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, sCurrentlyEnumerating = true; JS::Rooted len_val(cx); - JSBool ok = ::JS_GetProperty(cx, obj, "length", len_val.address()); + JSBool ok = ::JS_GetProperty(cx, obj, "length", &len_val); if (ok && JSVAL_IS_INT(len_val)) { int32_t length = JSVAL_TO_INT(len_val); @@ -5032,7 +5035,13 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp) return JS_FALSE; } - return ::JS_GetUCProperty(cx, self, chars, length, vp); + JS::Rooted value(cx); + if (!::JS_GetUCProperty(cx, self, chars, length, &value)) { + return false; + } + + *vp = value; + return true; } // StringArray helper diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 2f3ca6f15890..9647410a5861 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -1322,7 +1322,13 @@ GetPropertyOnPrototype(JSContext* cx, JS::Handle proxy, return true; } - return JS_ForwardGetPropertyTo(cx, proto, id, proxy, vp); + JS::Rooted value(cx); + if (!JS_ForwardGetPropertyTo(cx, proto, id, proxy, &value)) { + return false; + } + + *vp = value; + return true; } bool @@ -1741,7 +1747,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle obj, } JS::Rooted protov(cx); - DebugOnly ok = JS_GetProperty(cx, obj, "prototype", protov.address()); + DebugOnly ok = JS_GetProperty(cx, obj, "prototype", &protov); MOZ_ASSERT(ok, "Someone messed with our prototype property?"); JS::Rooted interfacePrototype(cx, &protov.toObject()); @@ -1845,7 +1851,7 @@ GetWindowForJSImplementedObject(JSContext* cx, JS::Handle obj, // Look up the content-side object. JS::Rooted domImplVal(cx); - if (!JS_GetProperty(cx, obj, "__DOM_IMPL__", domImplVal.address())) { + if (!JS_GetProperty(cx, obj, "__DOM_IMPL__", &domImplVal)) { return false; } diff --git a/dom/bindings/CallbackInterface.cpp b/dom/bindings/CallbackInterface.cpp index 46d92ceb2340..b07689ccc4db 100644 --- a/dom/bindings/CallbackInterface.cpp +++ b/dom/bindings/CallbackInterface.cpp @@ -16,7 +16,7 @@ bool CallbackInterface::GetCallableProperty(JSContext* cx, const char* aPropName, JS::MutableHandle aCallable) { - if (!JS_GetProperty(cx, mCallback, aPropName, aCallable.address())) { + if (!JS_GetProperty(cx, mCallback, aPropName, aCallable)) { return false; } if (!aCallable.isObject() || diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 5bd898a8ae7c..e173422bf235 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -5478,7 +5478,7 @@ class CGSpecializedForwardingSetter(CGSpecializedSetter): assert all(ord(c) < 128 for c in attrName) assert all(ord(c) < 128 for c in forwardToAttrName) return CGIndenter(CGGeneric("""JS::RootedValue v(cx); -if (!JS_GetProperty(cx, obj, "%s", v.address())) { +if (!JS_GetProperty(cx, obj, "%s", &v)) { return false; } @@ -7338,7 +7338,7 @@ class CGDOMJSProxyHandler_get(ClassMethod): " return false;\n" "}\n" "if (hasUnforgeable) {\n" - " return JS_ForwardGetPropertyTo(cx, ${holder}, id, proxy, vp.address());\n" + " return JS_ForwardGetPropertyTo(cx, ${holder}, id, proxy, vp);\n" "}") getUnforgeableOrExpando = CallOnUnforgeableHolder(self.descriptor, hasUnforgeable) @@ -7352,7 +7352,7 @@ if (expando) { } if (hasProp) { - return JS_GetPropertyById(cx, expando, id, vp.address()); + return JS_GetPropertyById(cx, expando, id, vp); } }""" @@ -8006,11 +8006,11 @@ class CGDictionary(CGThing): # NOTE: jsids are per-runtime, so don't use them in workers if self.workers: propName = member.identifier.name - propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", temp.ref().address())' % + propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", &temp.ref())' % propName) else: propId = self.makeIdName(member.identifier.name); - propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, temp.ref().address())" % + propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, &temp.ref())" % propId) conversionReplacements = { @@ -9907,7 +9907,7 @@ class CallbackGetter(CallbackMember): "attrName": self.attrName } return string.Template( - 'if (!JS_GetProperty(cx, mCallback, "${attrName}", rval.address())) {\n' + 'if (!JS_GetProperty(cx, mCallback, "${attrName}", &rval)) {\n' ' aRv.Throw(NS_ERROR_UNEXPECTED);\n' ' return${errorReturn};\n' '}\n').substitute(replacements); diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp index c30ab62663b4..22b78a582fef 100644 --- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -537,7 +537,7 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData) JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) { + if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) { return; } @@ -548,7 +548,7 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData) } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", value.address())|| + if (!JS_GetProperty(cx, obj, "value", &value)|| !value.isNumber()) { return; } diff --git a/dom/bluetooth/BluetoothService.cpp b/dom/bluetooth/BluetoothService.cpp index 5045df1f5ff5..aa8d75825c8f 100644 --- a/dom/bluetooth/BluetoothService.cpp +++ b/dom/bluetooth/BluetoothService.cpp @@ -566,7 +566,7 @@ BluetoothService::HandleSettingsChanged(const nsAString& aData) JSObject& obj(val.toObject()); - JS::Value key; + JS::Rooted key(cx); if (!JS_GetProperty(cx, &obj, "key", &key)) { MOZ_ASSERT(!JS_IsExceptionPending(cx)); return NS_ERROR_OUT_OF_MEMORY; @@ -584,7 +584,7 @@ BluetoothService::HandleSettingsChanged(const nsAString& aData) } if (match) { - JS::Value value; + JS::Rooted value; if (!JS_GetProperty(cx, &obj, "value", &value)) { MOZ_ASSERT(!JS_IsExceptionPending(cx)); return NS_ERROR_OUT_OF_MEMORY; diff --git a/dom/indexedDB/KeyPath.cpp b/dom/indexedDB/KeyPath.cpp index bc039397f007..ea8f48c6eda3 100644 --- a/dom/indexedDB/KeyPath.cpp +++ b/dom/indexedDB/KeyPath.cpp @@ -117,8 +117,7 @@ GetJSValFromKeyPathString(JSContext* aCx, if (hasProp) { // Get if the property exists... JS::Rooted intermediate(aCx); - JSBool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen, - intermediate.address()); + JSBool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen, &intermediate); NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); // Treat explicitly undefined as an error. diff --git a/dom/network/src/TCPSocketParent.cpp b/dom/network/src/TCPSocketParent.cpp index 1283e1147a8f..65aa5c63af46 100644 --- a/dom/network/src/TCPSocketParent.cpp +++ b/dom/network/src/TCPSocketParent.cpp @@ -171,7 +171,7 @@ TCPSocketParent::SendCallback(const nsAString& aType, const JS::Value& aDataVal, nsDependentJSString name; JS::Rooted val(aCx); - if (!JS_GetProperty(aCx, obj, "name", val.address())) { + if (!JS_GetProperty(aCx, obj, "name", &val)) { NS_ERROR("No name property on supposed error object"); } else if (JSVAL_IS_STRING(val)) { if (!name.init(aCx, JSVAL_TO_STRING(val))) { diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index 9087c987b4a9..a7d85dea0e48 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -540,7 +540,7 @@ nsJSObjWrapper::NP_Invalidate(NPObject *npobj) } static JSBool -GetProperty(JSContext *cx, JSObject *obj, NPIdentifier id, JS::Value *rval) +GetProperty(JSContext *cx, JSObject *obj, NPIdentifier id, JS::MutableHandle rval) { NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id), "id must be either string or int!\n"); @@ -574,7 +574,7 @@ nsJSObjWrapper::NP_HasMethod(NPObject *npobj, NPIdentifier id) AutoJSExceptionReporter reporter(cx); JS::Rooted v(cx); - JSBool ok = GetProperty(cx, npjsobj->mJSObj, id, v.address()); + JSBool ok = GetProperty(cx, npjsobj->mJSObj, id, &v); return ok && !JSVAL_IS_PRIMITIVE(v) && ::JS_ObjectIsFunction(cx, JSVAL_TO_OBJECT(v)); @@ -610,7 +610,7 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args, AutoJSExceptionReporter reporter(cx); if (method != NPIdentifier_VOID) { - if (!GetProperty(cx, npjsobj->mJSObj, method, fv.address()) || + if (!GetProperty(cx, npjsobj->mJSObj, method, &fv) || ::JS_TypeOfValue(cx, fv) != JSTYPE_FUNCTION) { return false; } @@ -752,7 +752,7 @@ nsJSObjWrapper::NP_GetProperty(NPObject *npobj, NPIdentifier id, JSAutoCompartment ac(cx, npjsobj->mJSObj); JS::Rooted v(cx); - return (GetProperty(cx, npjsobj->mJSObj, id, v.address()) && + return (GetProperty(cx, npjsobj->mJSObj, id, &v) && JSValToNPVariant(npp, cx, v, result)); } @@ -1621,7 +1621,7 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle obj, JSType hint, JS:: // giving plugins a [[DefaultValue]] which uses only toString and not valueOf. JS::Rooted v(cx, JSVAL_VOID); - if (!JS_GetProperty(cx, obj, "toString", v.address())) + if (!JS_GetProperty(cx, obj, "toString", &v)) return false; if (!JSVAL_IS_PRIMITIVE(v) && JS_ObjectIsCallable(cx, JSVAL_TO_OBJECT(v))) { if (!JS_CallFunctionValue(cx, obj, v, 0, NULL, vp.address())) diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp index 9bb067ea0a1a..a7def0c15d2f 100644 --- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -718,7 +718,7 @@ nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData) JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) { + if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) { return; } @@ -728,7 +728,7 @@ nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData) } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isBoolean()) { + if (!JS_GetProperty(cx, obj, "value", &value) || !value.isBoolean()) { return; } diff --git a/dom/src/json/nsJSON.cpp b/dom/src/json/nsJSON.cpp index 8f749eed046e..438451bf94c3 100644 --- a/dom/src/json/nsJSON.cpp +++ b/dom/src/json/nsJSON.cpp @@ -211,7 +211,7 @@ nsJSON::EncodeInternal(JSContext* cx, const JS::Value& aValue, */ JS::Rooted val(cx, aValue); JS::Rooted toJSON(cx); - if (JS_GetProperty(cx, obj, "toJSON", toJSON.address()) && + if (JS_GetProperty(cx, obj, "toJSON", &toJSON) && toJSON.isObject() && JS_ObjectIsCallable(cx, &toJSON.toObject())) { // If toJSON is implemented, it must not throw diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp index 00e27e28b889..0c5a92d8e9eb 100644 --- a/dom/system/OSFileConstants.cpp +++ b/dom/system/OSFileConstants.cpp @@ -605,7 +605,7 @@ JSObject *GetOrCreateObjectProperty(JSContext *cx, JS::Handle aObject const char *aProperty) { JS::Rooted val(cx); - if (!JS_GetProperty(cx, aObject, aProperty, val.address())) { + if (!JS_GetProperty(cx, aObject, aProperty, &val)) { return NULL; } if (!val.isUndefined()) { diff --git a/dom/system/gonk/AudioManager.cpp b/dom/system/gonk/AudioManager.cpp index a2e8013ea300..5f85182e271f 100644 --- a/dom/system/gonk/AudioManager.cpp +++ b/dom/system/gonk/AudioManager.cpp @@ -219,7 +219,7 @@ AudioManager::Observe(nsISupports* aSubject, AudioSystem::setParameters(0, cmd); } } - } + } // To process the volume control on each audio channel according to // change of settings else if (!strcmp(aTopic, "mozsettings-changed")) { @@ -233,7 +233,7 @@ AudioManager::Observe(nsISupports* aSubject, JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", key.address()) || + if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) { return NS_OK; } @@ -248,7 +248,7 @@ AudioManager::Observe(nsISupports* aSubject, } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isInt32()) { + if (!JS_GetProperty(cx, obj, "value", &value) || !value.isInt32()) { return NS_OK; } diff --git a/dom/system/gonk/AutoMounterSetting.cpp b/dom/system/gonk/AutoMounterSetting.cpp index 4ffa9595a376..97aa72bd7d75 100644 --- a/dom/system/gonk/AutoMounterSetting.cpp +++ b/dom/system/gonk/AutoMounterSetting.cpp @@ -186,7 +186,7 @@ AutoMounterSetting::Observe(nsISupports* aSubject, return NS_OK; } JSObject& obj(val.toObject()); - JS::Value key; + JS::Rooted key(cx); if (!JS_GetProperty(cx, &obj, "key", &key) || !key.isString()) { return NS_OK; @@ -198,7 +198,7 @@ AutoMounterSetting::Observe(nsISupports* aSubject, return NS_OK; } - JS::Value value; + JS::Rooted value(cx); if (!JS_GetProperty(cx, &obj, "value", &value)) { return NS_OK; } diff --git a/dom/system/gonk/TimeZoneSettingObserver.cpp b/dom/system/gonk/TimeZoneSettingObserver.cpp index 006e8976b17b..eec9f9431e85 100644 --- a/dom/system/gonk/TimeZoneSettingObserver.cpp +++ b/dom/system/gonk/TimeZoneSettingObserver.cpp @@ -180,7 +180,7 @@ TimeZoneSettingObserver::Observe(nsISupports *aSubject, // Get the key, which should be the JS string "time.timezone". JSObject &obj(val.toObject()); - JS::Value key; + JS::Rooted key(cx); if (!JS_GetProperty(cx, &obj, "key", &key) || !key.isString()) { return NS_OK; @@ -192,7 +192,7 @@ TimeZoneSettingObserver::Observe(nsISupports *aSubject, } // Get the value, which should be a JS string like "America/Chicago". - JS::Value value; + JS::Rooted value(cx); if (!JS_GetProperty(cx, &obj, "value", &value) || !value.isString()) { return NS_OK; diff --git a/dom/workers/ChromeWorkerScope.cpp b/dom/workers/ChromeWorkerScope.cpp index de2b6421842c..432d0ce0882b 100644 --- a/dom/workers/ChromeWorkerScope.cpp +++ b/dom/workers/ChromeWorkerScope.cpp @@ -55,7 +55,7 @@ DefineChromeWorkerFunctions(JSContext* aCx, JS::Handle aGlobal) { JS::Rooted ctypes(aCx); if (!JS_InitCTypesClass(aCx, aGlobal) || - !JS_GetProperty(aCx, aGlobal, "ctypes", ctypes.address())) { + !JS_GetProperty(aCx, aGlobal, "ctypes", &ctypes)) { return false; } diff --git a/dom/workers/EventListenerManager.cpp b/dom/workers/EventListenerManager.cpp index 08934d62790b..4403fdd055b8 100644 --- a/dom/workers/EventListenerManager.cpp +++ b/dom/workers/EventListenerManager.cpp @@ -298,7 +298,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, } JS::Rooted val(aCx); - if (!JS_GetProperty(aCx, aEvent, "target", val.address())) { + if (!JS_GetProperty(aCx, aEvent, "target", &val)) { aRv.Throw(NS_ERROR_FAILURE); return false; } @@ -316,7 +316,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, JS::Rooted eventType(aCx); JSBool eventIsTrusted; - if (!JS_GetProperty(aCx, aEvent, "type", val.address()) || + if (!JS_GetProperty(aCx, aEvent, "type", &val) || !(eventType = JS_ValueToString(aCx, val)) || !(eventType = JS_InternJSString(aCx, eventType))) { aRv.Throw(NS_ERROR_FAILURE); @@ -325,7 +325,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, // We have already ensure that the event is one of our types of events so // there is no need to worry about this property being faked. - if (!JS_GetProperty(aCx, aEvent, "isTrusted", val.address()) || + if (!JS_GetProperty(aCx, aEvent, "isTrusted", &val) || !JS_ValueToBoolean(aCx, val, &eventIsTrusted)) { aRv.Throw(NS_ERROR_FAILURE); return false; @@ -408,7 +408,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, } if (hasHandleEvent) { - if (!JS_GetProperty(aCx, listenerObj, sHandleEventChars, listenerVal.address())) { + if (!JS_GetProperty(aCx, listenerObj, sHandleEventChars, &listenerVal)) { if (!JS_ReportPendingException(aCx)) { aRv.Throw(NS_ERROR_FAILURE); return false; diff --git a/dom/workers/Events.cpp b/dom/workers/Events.cpp index 8ac4f8d9568b..e382e4eb5354 100644 --- a/dom/workers/Events.cpp +++ b/dom/workers/Events.cpp @@ -57,14 +57,14 @@ public: if (aMainRuntime) { JS::Rooted windowPropVal(aCx); - if (!JS_GetProperty(aCx, aObj, sClass.name, windowPropVal.address())) { + if (!JS_GetProperty(aCx, aObj, sClass.name, &windowPropVal)) { return NULL; } if (!JSVAL_IS_PRIMITIVE(windowPropVal)) { JS::Rooted protoVal(aCx); if (!JS_GetProperty(aCx, JSVAL_TO_OBJECT(windowPropVal), "prototype", - protoVal.address())) { + &protoVal)) { return NULL; } diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index 98687ba1d89d..f876c16932ff 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -266,9 +266,10 @@ private: JS::Rooted event(aCx, &JS_ARGV(aCx, aVp)[0].toObject()); jsval argv[3] = { JSVAL_VOID, JSVAL_VOID, JSVAL_VOID }; - if (!JS_GetProperty(aCx, event, "message", &argv[0]) || - !JS_GetProperty(aCx, event, "filename", &argv[1]) || - !JS_GetProperty(aCx, event, "lineno", &argv[2])) { + JS::AutoArrayRooter rootedArgv(aCx, ArrayLength(argv), argv); + if (!JS_GetProperty(aCx, event, "message", rootedArgv.handleAt(0)) || + !JS_GetProperty(aCx, event, "filename", rootedArgv.handleAt(1)) || + !JS_GetProperty(aCx, event, "lineno", rootedArgv.handleAt(2))) { return false; } diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index a3fc2c42100b..275e26a20796 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -78,7 +78,7 @@ Environment(JSObject* global) AutoSafeJSContext cx; JSAutoCompartment ac(cx, global); Rooted v(cx); - if (!JS_GetProperty(cx, global, "__XPCShellEnvironment", v.address()) || + if (!JS_GetProperty(cx, global, "__XPCShellEnvironment", &v) || !v.get().isDouble()) { return nullptr; diff --git a/js/ipc/JavaScriptChild.cpp b/js/ipc/JavaScriptChild.cpp index 2932571d581e..89feb408aec2 100644 --- a/js/ipc/JavaScriptChild.cpp +++ b/js/ipc/JavaScriptChild.cpp @@ -372,7 +372,7 @@ JavaScriptChild::AnswerGet(const ObjectId &objId, const ObjectId &receiverId, co if (!convertGeckoStringToId(cx, id, &internedId)) return fail(cx, rs); - JS::Value val; + JS::Rooted val(cx); if (!JS_ForwardGetPropertyTo(cx, obj, internedId, receiver, &val)) return fail(cx, rs); @@ -516,7 +516,7 @@ JavaScriptChild::AnswerCall(const ObjectId &objId, const nsTArray &argv for (size_t i = 0; i < outobjects.length(); i++) { RootedObject obj(cx, &outobjects[i].toObject()); - jsval v; + RootedValue v(cx); JSBool found; if (JS_HasProperty(cx, obj, "value", &found)) { if (!JS_GetProperty(cx, obj, "value", &v)) diff --git a/js/ipc/JavaScriptShared.cpp b/js/ipc/JavaScriptShared.cpp index 43376963f022..ad55c4b2f8b6 100644 --- a/js/ipc/JavaScriptShared.cpp +++ b/js/ipc/JavaScriptShared.cpp @@ -457,7 +457,7 @@ JavaScriptShared::Wrap(JSContext *cx, HandleObject aObj, InfallibleTArray(cx, name, AUTO_NAMELEN(name, namelen)); diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 8c26fd74b201..27eab08da4d4 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -3474,19 +3474,22 @@ extern JS_PUBLIC_API(JSBool) JS_GetOwnPropertyDescriptor(JSContext *cx, JSObject *obj, jsid id, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); +JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle vp); extern JS_PUBLIC_API(JSBool) -JS_GetPropertyDefault(JSContext *cx, JSObject *obj, const char *name, jsval def, jsval *vp); +JS_GetPropertyDefault(JSContext *cx, JSObject *obj, const char *name, jsval def, + JS::MutableHandle vp); extern JS_PUBLIC_API(JSBool) -JS_GetPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp); +JS_GetPropertyById(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle vp); extern JS_PUBLIC_API(JSBool) -JS_GetPropertyByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def, jsval *vp); +JS_GetPropertyByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def, + JS::MutableHandle vp); extern JS_PUBLIC_API(JSBool) -JS_ForwardGetPropertyTo(JSContext *cx, JSObject *obj, jsid id, JSObject *onBehalfOf, jsval *vp); +JS_ForwardGetPropertyTo(JSContext *cx, JSObject *obj, jsid id, JSObject *onBehalfOf, + JS::MutableHandle vp); extern JS_PUBLIC_API(JSBool) JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v); @@ -3572,7 +3575,7 @@ JS_LookupUCProperty(JSContext *cx, JSObject *obj, extern JS_PUBLIC_API(JSBool) JS_GetUCProperty(JSContext *cx, JSObject *obj, const jschar *name, size_t namelen, - jsval *vp); + JS::MutableHandle vp); extern JS_PUBLIC_API(JSBool) JS_SetUCProperty(JSContext *cx, JSObject *obj, diff --git a/js/src/jsdbgapi.cpp b/js/src/jsdbgapi.cpp index 5ed0c84d11e1..82c36419bfc7 100644 --- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -1105,10 +1105,10 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int // print any unnamed trailing args (found in 'arguments' object) RootedValue val(cx); - if (JS_GetProperty(cx, callObj, "arguments", val.address()) && val.isObject()) { + if (JS_GetProperty(cx, callObj, "arguments", &val) && val.isObject()) { uint32_t argCount; RootedObject argsObj(cx, &val.toObject()); - if (JS_GetProperty(cx, argsObj, "length", val.address()) && + if (JS_GetProperty(cx, argsObj, "length", &val) && ToUint32(cx, val, &argCount) && argCount > namedArgCount) { @@ -1116,7 +1116,7 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int char number[8]; JS_snprintf(number, 8, "%d", (int) k); - if (JS_GetProperty(cx, argsObj, number, val.address())) { + if (JS_GetProperty(cx, argsObj, number, &val)) { JSAutoByteString valueBytes; const char *value = FormatValue(cx, val, valueBytes); buf = JS_sprintf_append(buf, "%s%s%s%s", diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index e4eb4e8fccb0..66e9f8cb482d 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -1048,14 +1048,14 @@ js_ReportUncaughtException(JSContext *cx) (exnObject->is() || IsDuckTypedErrorObject(cx, exnObject, &filename_str))) { RootedString name(cx); - if (JS_GetProperty(cx, exnObject, js_name_str, &roots[2]) && + if (JS_GetProperty(cx, exnObject, js_name_str, tvr.handleAt(2)) && JSVAL_IS_STRING(roots[2])) { name = JSVAL_TO_STRING(roots[2]); } RootedString msg(cx); - if (JS_GetProperty(cx, exnObject, js_message_str, &roots[3]) && + if (JS_GetProperty(cx, exnObject, js_message_str, tvr.handleAt(3)) && JSVAL_IS_STRING(roots[3])) { msg = JSVAL_TO_STRING(roots[3]); @@ -1077,21 +1077,21 @@ js_ReportUncaughtException(JSContext *cx) str = msg; } - if (JS_GetProperty(cx, exnObject, filename_str, &roots[4])) { + if (JS_GetProperty(cx, exnObject, filename_str, tvr.handleAt(4))) { JSString *tmp = ToString(cx, HandleValue::fromMarkedLocation(&roots[4])); if (tmp) filename.encodeLatin1(cx, tmp); } uint32_t lineno; - if (!JS_GetProperty(cx, exnObject, js_lineNumber_str, &roots[5]) || + if (!JS_GetProperty(cx, exnObject, js_lineNumber_str, tvr.handleAt(5)) || !ToUint32(cx, roots[5], &lineno)) { lineno = 0; } uint32_t column; - if (!JS_GetProperty(cx, exnObject, js_columnNumber_str, &roots[5]) || + if (!JS_GetProperty(cx, exnObject, js_columnNumber_str, tvr.handleAt(5)) || !ToUint32(cx, roots[5], &column)) { column = 0; diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 657f9981924f..7c45dcbfee81 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -934,7 +934,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) RootedObject opts(cx, &args[1].toObject()); RootedValue v(cx); - if (!JS_GetProperty(cx, opts, "newContext", v.address())) + if (!JS_GetProperty(cx, opts, "newContext", &v)) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -943,7 +943,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) newContext = b; } - if (!JS_GetProperty(cx, opts, "compileAndGo", v.address())) + if (!JS_GetProperty(cx, opts, "compileAndGo", &v)) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -952,7 +952,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) compileAndGo = b; } - if (!JS_GetProperty(cx, opts, "noScriptRval", v.address())) + if (!JS_GetProperty(cx, opts, "noScriptRval", &v)) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -961,7 +961,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) noScriptRval = b; } - if (!JS_GetProperty(cx, opts, "fileName", v.address())) + if (!JS_GetProperty(cx, opts, "fileName", &v)) return false; if (JSVAL_IS_NULL(v)) { fileName = NULL; @@ -974,12 +974,12 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) return false; } - if (!JS_GetProperty(cx, opts, "element", v.address())) + if (!JS_GetProperty(cx, opts, "element", &v)) return false; if (!JSVAL_IS_PRIMITIVE(v)) element = JSVAL_TO_OBJECT(v); - if (!JS_GetProperty(cx, opts, "sourceMapURL", v.address())) + if (!JS_GetProperty(cx, opts, "sourceMapURL", &v)) return false; if (!JSVAL_IS_VOID(v)) { sourceMapURL = JS_ValueToString(cx, v); @@ -987,7 +987,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) return false; } - if (!JS_GetProperty(cx, opts, "lineNumber", v.address())) + if (!JS_GetProperty(cx, opts, "lineNumber", &v)) return false; if (!JSVAL_IS_VOID(v)) { uint32_t u; @@ -996,7 +996,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) lineNumber = u; } - if (!JS_GetProperty(cx, opts, "global", v.address())) + if (!JS_GetProperty(cx, opts, "global", &v)) return false; if (!JSVAL_IS_VOID(v)) { global = JSVAL_IS_PRIMITIVE(v) ? NULL : JSVAL_TO_OBJECT(v); @@ -1012,7 +1012,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) } } - if (!JS_GetProperty(cx, opts, "catchTermination", v.address())) + if (!JS_GetProperty(cx, opts, "catchTermination", &v)) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -1021,7 +1021,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) catchTermination = b; } - if (!JS_GetProperty(cx, opts, "saveFrameChain", v.address())) + if (!JS_GetProperty(cx, opts, "saveFrameChain", &v)) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -2465,7 +2465,7 @@ sandbox_enumerate(JSContext *cx, HandleObject obj) RootedValue v(cx); JSBool b; - if (!JS_GetProperty(cx, obj, "lazy", v.address())) + if (!JS_GetProperty(cx, obj, "lazy", &v)) return false; JS_ValueToBoolean(cx, v, &b); @@ -2479,7 +2479,7 @@ sandbox_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags, RootedValue v(cx); JSBool b, resolved; - if (!JS_GetProperty(cx, obj, "lazy", v.address())) + if (!JS_GetProperty(cx, obj, "lazy", &v)) return false; JS_ValueToBoolean(cx, v, &b); diff --git a/js/src/shell/jsheaptools.cpp b/js/src/shell/jsheaptools.cpp index e8b29c7dedfb..44c86cd42a07 100644 --- a/js/src/shell/jsheaptools.cpp +++ b/js/src/shell/jsheaptools.cpp @@ -506,7 +506,7 @@ ReferenceFinder::addReferrer(jsval referrerArg, Path *path) /* Find the property of the results object named |pathName|. */ RootedValue v(context); - if (!JS_GetProperty(context, result, pathName, v.address())) + if (!JS_GetProperty(context, result, pathName, &v)) return false; if (v.isUndefined()) { /* Create an array to accumulate referents under this path. */ diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 167257929342..49df6a8fd9f5 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -4194,7 +4194,7 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code RootedObject opts(cx, &options.toObject()); RootedValue v(cx); - if (!JS_GetProperty(cx, opts, "url", v.address())) + if (!JS_GetProperty(cx, opts, "url", &v)) return false; if (!v.isUndefined()) { RootedString url_str(cx, JS_ValueToString(cx, v)); @@ -4203,7 +4203,7 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code url = JS_EncodeString(cx, url_str); } - if (!JS_GetProperty(cx, opts, "lineNumber", v.address())) + if (!JS_GetProperty(cx, opts, "lineNumber", &v)) return false; if (!v.isUndefined()) { uint32_t lineno; diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index 459a02311bd0..de20e78f2dc7 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -518,7 +518,7 @@ mozJSComponentLoader::LoadModule(FileLocation &aFile) JSCLAutoErrorReporterSetter aers(cx, xpc::SystemErrorReporter); RootedValue NSGetFactory_val(cx); - if (!JS_GetProperty(cx, entry->obj, "NSGetFactory", NSGetFactory_val.address()) || + if (!JS_GetProperty(cx, entry->obj, "NSGetFactory", &NSGetFactory_val) || JSVAL_IS_VOID(NSGetFactory_val)) { return NULL; } @@ -1281,7 +1281,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation, RootedValue symbols(mContext); if (!JS_GetProperty(mContext, mod->obj, - "EXPORTED_SYMBOLS", symbols.address())) { + "EXPORTED_SYMBOLS", &symbols)) { return ReportOnCaller(cxhelper, ERROR_NOT_PRESENT, PromiseFlatCString(aLocation).get()); } @@ -1316,7 +1316,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation, PromiseFlatCString(aLocation).get(), i); } - if (!JS_GetPropertyById(mContext, mod->obj, symbolId, value.address())) { + if (!JS_GetPropertyById(mContext, mod->obj, symbolId, &value)) { JSAutoByteString bytes(mContext, JSID_TO_STRING(symbolId)); if (!bytes) return NS_ERROR_FAILURE; diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 4975453318b7..60a237ceb805 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -1916,7 +1916,7 @@ struct MOZ_STACK_CLASS ExceptionArgParser } // Get the property. - return JS_GetProperty(cx, obj, name, rv.address()); + return JS_GetProperty(cx, obj, name, rv); } /* @@ -2243,7 +2243,7 @@ nsXPCConstructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,JSContext * RootedObject newObj(cx, &rval.toObject()); // first check existence of function property for better error reporting RootedValue fun(cx); - if (!JS_GetProperty(cx, newObj, mInitializer, fun.address()) || + if (!JS_GetProperty(cx, newObj, mInitializer, &fun) || fun.isPrimitive()) { return ThrowAndFail(NS_ERROR_XPC_BAD_INITIALIZER_NAME, cx, _retval); } @@ -2492,7 +2492,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper, return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval); RootedValue val(cx); - if (!JS_GetPropertyById(cx, ifacesObj, id, val.address()) || val.isPrimitive()) + if (!JS_GetPropertyById(cx, ifacesObj, id, &val) || val.isPrimitive()) return ThrowAndFail(NS_ERROR_XPC_BAD_IID, cx, _retval); nsCOMPtr wn; @@ -2541,7 +2541,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper, return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval); RootedValue val(cx); - if (!JS_GetPropertyById(cx, classesObj, id, val.address()) || val.isPrimitive()) + if (!JS_GetPropertyById(cx, classesObj, id, &val) || val.isPrimitive()) return ThrowAndFail(NS_ERROR_XPC_BAD_CID, cx, _retval); nsCOMPtr wn; @@ -3526,7 +3526,7 @@ GetPropFromOptions(JSContext *cx, HandleObject from, const char *name, MutableHa if (!JS_HasProperty(cx, from, name, found)) return NS_ERROR_INVALID_ARG; - if (found && !JS_GetProperty(cx, from, name, prop.address())) + if (found && !JS_GetProperty(cx, from, name, prop)) return NS_ERROR_INVALID_ARG; return NS_OK; @@ -4275,7 +4275,7 @@ nsXPCComponents_Utils::MakeObjectPropsNormal(const Value &vobj, JSContext *cx) for (size_t i = 0; i < ida.length(); ++i) { id = ida[i]; - if (!JS_GetPropertyById(cx, obj, id, v.address())) + if (!JS_GetPropertyById(cx, obj, id, &v)) return NS_ERROR_FAILURE; if (v.isPrimitive()) diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 6ccf8be6745c..8daab8aabada 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -230,7 +230,7 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx, // check upfront for the existence of the function property funid = mRuntime->GetStringID(XPCJSRuntime::IDX_QUERY_INTERFACE); - if (!JS_GetPropertyById(cx, jsobj, funid, fun.address()) || JSVAL_IS_PRIMITIVE(fun)) + if (!JS_GetPropertyById(cx, jsobj, funid, &fun) || JSVAL_IS_PRIMITIVE(fun)) return nullptr; // Ensure that we are asking for a scriptable interface. @@ -330,7 +330,7 @@ GetNamedPropertyAsVariantRaw(XPCCallContext& ccx, nsXPTType type = nsXPTType((uint8_t)TD_INTERFACE_TYPE); RootedValue val(ccx); - return JS_GetPropertyById(ccx, aJSObj, aName, val.address()) && + return JS_GetPropertyById(ccx, aJSObj, aName, &val) && // Note that this always takes the T_INTERFACE path through // JSData2Native, so the value passed for useAllocator // doesn't really matter. We pass true for consistency. @@ -1264,7 +1264,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex, } } } else { - if (!JS_GetProperty(cx, obj, name, fval.address())) + if (!JS_GetProperty(cx, obj, name, &fval)) goto pre_call_clean_up; // XXX We really want to factor out the error reporting better and // specifically report the failure to find a function with this name. @@ -1431,7 +1431,7 @@ pre_call_clean_up: RootedValue rval(cx); if (XPT_MD_IS_GETTER(info->flags)) { - success = JS_GetProperty(cx, obj, name, rval.address()); + success = JS_GetProperty(cx, obj, name, &rval); } else if (XPT_MD_IS_SETTER(info->flags)) { rval = *argv; success = JS_SetProperty(cx, obj, name, rval); @@ -1514,7 +1514,7 @@ pre_call_clean_up: else if (JSVAL_IS_PRIMITIVE(argv[i]) || !JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]), mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE), - val.address())) + &val)) break; // setup allocator and/or iid @@ -1558,7 +1558,7 @@ pre_call_clean_up: val = rval; else if (!JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]), mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE), - val.address())) + &val)) break; // setup allocator and/or iid diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index 7b61dda7431a..4120c1d57fbc 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -1993,7 +1993,7 @@ class CallMethodHelper nsID* result) const; JS_ALWAYS_INLINE JSBool - GetOutParamSource(uint8_t paramIndex, jsval* srcp) const; + GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp) const; JS_ALWAYS_INLINE JSBool GatherAndConvertResults(); @@ -2249,7 +2249,7 @@ CallMethodHelper::GetInterfaceTypeFromParam(uint8_t paramIndex, } JSBool -CallMethodHelper::GetOutParamSource(uint8_t paramIndex, jsval* srcp) const +CallMethodHelper::GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp) const { const nsXPTParamInfo& paramInfo = mMethodInfo->GetParam(paramIndex); @@ -2529,7 +2529,7 @@ CallMethodHelper::ConvertIndependentParam(uint8_t i) // // This is a no-op for 'in' params. RootedValue src(mCallContext); - if (!GetOutParamSource(i, src.address())) + if (!GetOutParamSource(i, &src)) return false; // All that's left to do is value conversion. Bail early if we don't need @@ -2634,7 +2634,7 @@ CallMethodHelper::ConvertDependentParam(uint8_t i) // // This is a no-op for 'in' params. RootedValue src(mCallContext); - if (!GetOutParamSource(i, src.address())) + if (!GetOutParamSource(i, &src)) return false; // All that's left to do is value conversion. Bail early if we don't need diff --git a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp index a6866a10077e..1b4a5ba46912 100644 --- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp +++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp @@ -121,7 +121,7 @@ GetDoubleWrappedJSObject(XPCCallContext& ccx, XPCWrappedNative* wrapper) JSAutoCompartment ac(ccx, mainObj); RootedValue val(ccx); - if (JS_GetPropertyById(ccx, mainObj, id, val.address()) && + if (JS_GetPropertyById(ccx, mainObj, id, &val) && !JSVAL_IS_PRIMITIVE(val)) { obj = JSVAL_TO_OBJECT(val); } diff --git a/js/xpconnect/src/dictionary_helper_gen.py b/js/xpconnect/src/dictionary_helper_gen.py index 7f95405d9bb2..5db3d4018556 100644 --- a/js/xpconnect/src/dictionary_helper_gen.py +++ b/js/xpconnect/src/dictionary_helper_gen.py @@ -279,13 +279,11 @@ def write_header(iface, fd): def write_getter(a, iface, fd): realtype = a.realtype.nativeType('in') + fd.write(" NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, &v));\n" + % get_jsid(a.name)) if realtype.count("JS::Value"): - fd.write(" NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, &aDict.%s));\n" - % (get_jsid(a.name), a.name)) - else: - fd.write(" NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, v.address()));\n" - % get_jsid(a.name)) - if realtype.count("bool"): + fd.write(" aDict.%s = v;\n" % a.name) + elif realtype.count("bool"): fd.write(" JSBool b;\n") fd.write(" MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));\n") fd.write(" aDict.%s = b;\n" % a.name) @@ -373,15 +371,11 @@ def write_cpp(iface, fd): fd.write(" NS_ENSURE_SUCCESS(rv, rv);\n") fd.write(" JSBool found = JS_FALSE;\n") - needjsval = False needccx = False for a in attributes: - if not a.realtype.nativeType('in').count("JS::Value"): - needjsval = True if a.realtype.nativeType('in').count("nsIVariant"): needccx = True - if needjsval: - fd.write(" JS::RootedValue v(aCx, JSVAL_VOID);\n") + fd.write(" JS::RootedValue v(aCx, JSVAL_VOID);\n") if needccx: fd.write(" XPCCallContext ccx(NATIVE_CALLER, aCx);\n") fd.write(" NS_ENSURE_STATE(ccx.IsValid());\n") diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 51f299f1f071..75da01bbc707 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -905,7 +905,7 @@ PeerConnectionImpl::ConvertConstraints( JS::Rooted constraints(aCx, &aConstraints.toObject()); // Mandatory constraints. Note that we only care if the constraint array exists - if (!JS_GetProperty(aCx, constraints, "mandatory", mandatory.address())) { + if (!JS_GetProperty(aCx, constraints, "mandatory", &mandatory)) { return NS_ERROR_FAILURE; } if (!mandatory.isNullOrUndefined()) { @@ -919,7 +919,7 @@ PeerConnectionImpl::ConvertConstraints( // Iterate over each property. for (size_t i = 0; i < mandatoryOpts.length(); i++) { JS::Rooted option(aCx), optionName(aCx); - if (!JS_GetPropertyById(aCx, opts, mandatoryOpts[i], option.address()) || + if (!JS_GetPropertyById(aCx, opts, mandatoryOpts[i], &option) || !JS_IdToValue(aCx, mandatoryOpts[i], optionName.address()) || // We only support boolean constraints for now. !option.isBoolean()) { @@ -935,7 +935,7 @@ PeerConnectionImpl::ConvertConstraints( } // Optional constraints. - if (!JS_GetProperty(aCx, constraints, "optional", optional.address())) { + if (!JS_GetProperty(aCx, constraints, "optional", &optional)) { return NS_ERROR_FAILURE; } if (!optional.isNullOrUndefined()) { @@ -961,7 +961,7 @@ PeerConnectionImpl::ConvertConstraints( return NS_ERROR_FAILURE; } JS::Rooted option(aCx), optionName(aCx); - if (!JS_GetPropertyById(aCx, opts, optionalOpts[0], option.address()) || + if (!JS_GetPropertyById(aCx, opts, optionalOpts[0], &option) || !JS_IdToValue(aCx, optionalOpts[0], optionName.address())) { return NS_ERROR_FAILURE; } diff --git a/startupcache/test/TestStartupCache.cpp b/startupcache/test/TestStartupCache.cpp index 5ea45947d692..417ccce9cdb1 100644 --- a/startupcache/test/TestStartupCache.cpp +++ b/startupcache/test/TestStartupCache.cpp @@ -416,11 +416,11 @@ GetHistogramCounts(const char *testmsg, const nsACString &histogram_id, JSFunction *snapshot_fn = NULL; Rooted ss(cx); return (JS_GetProperty(cx, JSVAL_TO_OBJECT(h), "snapshot", - snapshot_val.address()) + &snapshot_val) && (snapshot_fn = JS_ValueToFunction(cx, snapshot_val)) && JS::Call(cx, JSVAL_TO_OBJECT(h), snapshot_fn, 0, NULL, &ss) - && JS_GetProperty(cx, JSVAL_TO_OBJECT(ss), "counts", counts.address())); + && JS_GetProperty(cx, JSVAL_TO_OBJECT(ss), "counts", counts)); } nsresult diff --git a/toolkit/components/ctypes/ctypes.cpp b/toolkit/components/ctypes/ctypes.cpp index 927c4b54f4bc..e56a38e2c4cc 100644 --- a/toolkit/components/ctypes/ctypes.cpp +++ b/toolkit/components/ctypes/ctypes.cpp @@ -67,7 +67,7 @@ static JSBool SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) { JS::Rooted prop(cx); - if (!JS_GetProperty(cx, parent, name, prop.address())) + if (!JS_GetProperty(cx, parent, name, &prop)) return false; if (prop.isUndefined()) { @@ -76,7 +76,7 @@ SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) } JS::Rooted obj(cx, prop.toObjectOrNull()); - if (!JS_GetProperty(cx, obj, "prototype", prop.address())) + if (!JS_GetProperty(cx, obj, "prototype", &prop)) return false; JS::Rooted prototype(cx, prop.toObjectOrNull()); @@ -92,7 +92,7 @@ InitAndSealCTypesClass(JSContext* cx, JS::Handle global) // Set callbacks for charset conversion and such. JS::Rooted ctypes(cx); - if (!JS_GetProperty(cx, global, "ctypes", ctypes.address())) + if (!JS_GetProperty(cx, global, "ctypes", &ctypes)) return false; JS_SetCTypesCallbacks(JSVAL_TO_OBJECT(ctypes), &sCallbacks); diff --git a/toolkit/components/perf/PerfMeasurement.cpp b/toolkit/components/perf/PerfMeasurement.cpp index 1f959273535c..09df1d90f9b2 100644 --- a/toolkit/components/perf/PerfMeasurement.cpp +++ b/toolkit/components/perf/PerfMeasurement.cpp @@ -42,7 +42,7 @@ static JSBool SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) { JS::Rooted prop(cx); - if (!JS_GetProperty(cx, parent, name, prop.address())) + if (!JS_GetProperty(cx, parent, name, &prop)) return false; if (prop.isUndefined()) { @@ -51,7 +51,7 @@ SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) } JS::Rooted obj(cx, prop.toObjectOrNull()); - if (!JS_GetProperty(cx, obj, "prototype", prop.address())) + if (!JS_GetProperty(cx, obj, "prototype", &prop)) return false; JS::Rooted prototype(cx, prop.toObjectOrNull()); diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index 07744a875e08..1d3c96ba0ecd 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -297,7 +297,7 @@ GetURIFromJSObject(JSContext* aCtx, const char* aProperty) { JS::Rooted uriVal(aCtx); - JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, uriVal.address()); + JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &uriVal); NS_ENSURE_TRUE(rc, nullptr); return GetJSValueAsURI(aCtx, uriVal); } @@ -355,7 +355,7 @@ GetStringFromJSObject(JSContext* aCtx, nsString& _string) { JS::Rooted val(aCtx); - JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, val.address()); + JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &val); if (!rc) { _string.SetIsVoid(true); return; @@ -385,7 +385,7 @@ GetIntFromJSObject(JSContext* aCtx, IntType* _int) { JS::Rooted value(aCtx); - JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, value.address()); + JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &value); NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED); if (JSVAL_IS_VOID(value)) { return NS_ERROR_INVALID_ARG; @@ -2808,7 +2808,7 @@ History::UpdatePlaces(const JS::Value& aPlaceInfos, JS::Rooted visits(aCtx, nullptr); { JS::Rooted visitsVal(aCtx); - JSBool rc = JS_GetProperty(aCtx, info, "visits", visitsVal.address()); + JSBool rc = JS_GetProperty(aCtx, info, "visits", &visitsVal); NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED); if (!JSVAL_IS_PRIMITIVE(visitsVal)) { visits = JSVAL_TO_OBJECT(visitsVal); From 3df9369621f7306e24b4a1b6cab1052b5a7ff97c Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Fri, 26 Jul 2013 10:00:39 +0100 Subject: [PATCH 13/92] Bug 897956 - Tidy use of fromMarkedLocation() in interpreter r=luke --- js/src/vm/Interpreter.cpp | 80 +++++++++++++++++++-------------------- js/src/vm/Stack.h | 8 ++++ 2 files changed, 48 insertions(+), 40 deletions(-) diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index adaf799c7f38..912d9ae82be3 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -966,7 +966,7 @@ TryNoteIter::settle() #define FETCH_OBJECT(cx, n, obj) \ JS_BEGIN_MACRO \ - HandleValue val = HandleValue::fromMarkedLocation(®s.sp[n]); \ + HandleValue val = regs.stackHandleAt(n); \ obj = ToObjectFromStack(cx, (val)); \ if (!obj) \ goto error; \ @@ -1797,7 +1797,7 @@ END_CASE(JSOP_AND) #define FETCH_ELEMENT_ID(n, id) \ JS_BEGIN_MACRO \ - if (!ValueToId(cx, HandleValue::fromMarkedLocation(®s.sp[n]), &id))\ + if (!ValueToId(cx, regs.stackHandleAt(n), &id)) \ goto error; \ JS_END_MACRO @@ -1819,7 +1819,7 @@ END_CASE(JSOP_AND) BEGIN_CASE(JSOP_IN) { - HandleValue rref = HandleValue::fromMarkedLocation(®s.sp[-1]); + HandleValue rref = regs.stackHandleAt(-1); if (!rref.isObject()) { js_ReportValueError(cx, JSMSG_IN_NOT_OBJECT, -1, rref, NullPtr()); goto error; @@ -1844,7 +1844,7 @@ BEGIN_CASE(JSOP_ITER) { JS_ASSERT(regs.stackDepth() >= 1); uint8_t flags = GET_UINT8(regs.pc); - MutableHandleValue res = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue res = regs.stackHandleAt(-1); if (!ValueToIterator(cx, flags, res)) goto error; JS_ASSERT(!res.isPrimitive()); @@ -1857,7 +1857,7 @@ BEGIN_CASE(JSOP_MOREITER) JS_ASSERT(regs.sp[-1].isObject()); PUSH_NULL(); bool cond; - MutableHandleValue res = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue res = regs.stackHandleAt(-1); if (!IteratorMore(cx, ®s.sp[-2].toObject(), &cond, res)) goto error; regs.sp[-1].setBoolean(cond); @@ -1868,7 +1868,7 @@ BEGIN_CASE(JSOP_ITERNEXT) { JS_ASSERT(regs.sp[-1].isObject()); PUSH_NULL(); - MutableHandleValue res = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue res = regs.stackHandleAt(-1); RootedObject &obj = rootObject0; obj = ®s.sp[-2].toObject(); if (!IteratorNext(cx, obj, res)) @@ -2066,8 +2066,8 @@ END_CASE(JSOP_CASE) BEGIN_CASE(JSOP_LT) { bool cond; - MutableHandleValue lval = MutableHandleValue::fromMarkedLocation(®s.sp[-2]); - MutableHandleValue rval = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue lval = regs.stackHandleAt(-2); + MutableHandleValue rval = regs.stackHandleAt(-1); if (!LessThanOperation(cx, lval, rval, &cond)) goto error; TRY_BRANCH_AFTER_COND(cond, 2); @@ -2079,8 +2079,8 @@ END_CASE(JSOP_LT) BEGIN_CASE(JSOP_LE) { bool cond; - MutableHandleValue lval = MutableHandleValue::fromMarkedLocation(®s.sp[-2]); - MutableHandleValue rval = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue lval = regs.stackHandleAt(-2); + MutableHandleValue rval = regs.stackHandleAt(-1); if (!LessThanOrEqualOperation(cx, lval, rval, &cond)) goto error; TRY_BRANCH_AFTER_COND(cond, 2); @@ -2092,8 +2092,8 @@ END_CASE(JSOP_LE) BEGIN_CASE(JSOP_GT) { bool cond; - MutableHandleValue lval = MutableHandleValue::fromMarkedLocation(®s.sp[-2]); - MutableHandleValue rval = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue lval = regs.stackHandleAt(-2); + MutableHandleValue rval = regs.stackHandleAt(-1); if (!GreaterThanOperation(cx, lval, rval, &cond)) goto error; TRY_BRANCH_AFTER_COND(cond, 2); @@ -2105,8 +2105,8 @@ END_CASE(JSOP_GT) BEGIN_CASE(JSOP_GE) { bool cond; - MutableHandleValue lval = MutableHandleValue::fromMarkedLocation(®s.sp[-2]); - MutableHandleValue rval = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue lval = regs.stackHandleAt(-2); + MutableHandleValue rval = regs.stackHandleAt(-1); if (!GreaterThanOrEqualOperation(cx, lval, rval, &cond)) goto error; TRY_BRANCH_AFTER_COND(cond, 2); @@ -2139,8 +2139,8 @@ END_CASE(JSOP_RSH) BEGIN_CASE(JSOP_URSH) { - HandleValue lval = HandleValue::fromMarkedLocation(®s.sp[-2]); - HandleValue rval = HandleValue::fromMarkedLocation(®s.sp[-1]); + HandleValue lval = regs.stackHandleAt(-2); + HandleValue rval = regs.stackHandleAt(-1); if (!UrshOperation(cx, script, regs.pc, lval, rval, ®s.sp[-2])) goto error; regs.sp--; @@ -2149,8 +2149,8 @@ END_CASE(JSOP_URSH) BEGIN_CASE(JSOP_ADD) { - MutableHandleValue lval = MutableHandleValue::fromMarkedLocation(®s.sp[-2]); - MutableHandleValue rval = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue lval = regs.stackHandleAt(-2); + MutableHandleValue rval = regs.stackHandleAt(-1); if (!AddOperation(cx, script, regs.pc, lval, rval, ®s.sp[-2])) goto error; regs.sp--; @@ -2212,7 +2212,7 @@ END_CASE(JSOP_NOT) BEGIN_CASE(JSOP_BITNOT) { int32_t i; - HandleValue value = HandleValue::fromMarkedLocation(®s.sp[-1]); + HandleValue value = regs.stackHandleAt(-1); if (!BitNot(cx, value, &i)) goto error; regs.sp[-1].setInt32(i); @@ -2223,14 +2223,14 @@ BEGIN_CASE(JSOP_NEG) { RootedValue &val = rootValue0; val = regs.sp[-1]; - MutableHandleValue res = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue res = regs.stackHandleAt(-1); if (!NegOperation(cx, script, regs.pc, val, res)) goto error; } END_CASE(JSOP_NEG) BEGIN_CASE(JSOP_POS) - if (!ToNumber(cx, MutableHandleValue::fromMarkedLocation(®s.sp[-1]))) + if (!ToNumber(cx, regs.stackHandleAt(-1))) goto error; if (!regs.sp[-1].isInt32()) TypeScript::MonitorOverflow(cx, script, regs.pc); @@ -2248,7 +2248,7 @@ BEGIN_CASE(JSOP_DELNAME) scopeObj = regs.fp()->scopeChain(); PUSH_BOOLEAN(true); - MutableHandleValue res = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue res = regs.stackHandleAt(-1); if (!DeleteNameOperation(cx, name, scopeObj, res)) goto error; } @@ -2269,7 +2269,7 @@ BEGIN_CASE(JSOP_DELPROP) obj->reportNotConfigurable(cx, NameToId(name)); goto error; } - MutableHandleValue res = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue res = regs.stackHandleAt(-1); res.setBoolean(succeeded); } END_CASE(JSOP_DELPROP) @@ -2297,7 +2297,7 @@ BEGIN_CASE(JSOP_DELELEM) goto error; } - MutableHandleValue res = MutableHandleValue::fromMarkedLocation(®s.sp[-2]); + MutableHandleValue res = regs.stackHandleAt(-2); res.setBoolean(succeeded); regs.sp--; } @@ -2314,7 +2314,7 @@ BEGIN_CASE(JSOP_TOID) objval = regs.sp[-2]; idval = regs.sp[-1]; - MutableHandleValue res = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue res = regs.stackHandleAt(-1); if (!ToIdOperation(cx, script, regs.pc, objval, idval, res)) goto error; } @@ -2323,7 +2323,7 @@ END_CASE(JSOP_TOID) BEGIN_CASE(JSOP_TYPEOFEXPR) BEGIN_CASE(JSOP_TYPEOF) { - HandleValue ref = HandleValue::fromMarkedLocation(®s.sp[-1]); + HandleValue ref = regs.stackHandleAt(-1); regs.sp[-1].setString(TypeOfOperation(cx, ref)); } END_CASE(JSOP_TYPEOF) @@ -2344,7 +2344,7 @@ BEGIN_CASE(JSOP_LENGTH) BEGIN_CASE(JSOP_CALLPROP) { - MutableHandleValue lval = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue lval = regs.stackHandleAt(-1); if (!GetPropertyOperation(cx, regs.fp(), script, regs.pc, lval, lval)) goto error; @@ -2355,7 +2355,7 @@ END_CASE(JSOP_GETPROP) BEGIN_CASE(JSOP_SETINTRINSIC) { - HandleValue value = HandleValue::fromMarkedLocation(®s.sp[-1]); + HandleValue value = regs.stackHandleAt(-1); if (!SetIntrinsicOperation(cx, script, regs.pc, value)) goto error; @@ -2371,7 +2371,7 @@ BEGIN_CASE(JSOP_SETNAME) RootedObject &scope = rootObject0; scope = ®s.sp[-2].toObject(); - HandleValue value = HandleValue::fromMarkedLocation(®s.sp[-1]); + HandleValue value = regs.stackHandleAt(-1); if (!SetNameOperation(cx, script, regs.pc, scope, value)) goto error; @@ -2383,8 +2383,8 @@ END_CASE(JSOP_SETNAME) BEGIN_CASE(JSOP_SETPROP) { - HandleValue lval = HandleValue::fromMarkedLocation(®s.sp[-2]); - HandleValue rval = HandleValue::fromMarkedLocation(®s.sp[-1]); + HandleValue lval = regs.stackHandleAt(-2); + HandleValue rval = regs.stackHandleAt(-1); if (!SetPropertyOperation(cx, script, regs.pc, lval, rval)) goto error; @@ -2397,9 +2397,9 @@ END_CASE(JSOP_SETPROP) BEGIN_CASE(JSOP_GETELEM) BEGIN_CASE(JSOP_CALLELEM) { - MutableHandleValue lval = MutableHandleValue::fromMarkedLocation(®s.sp[-2]); - HandleValue rval = HandleValue::fromMarkedLocation(®s.sp[-1]); - MutableHandleValue res = MutableHandleValue::fromMarkedLocation(®s.sp[-2]); + MutableHandleValue lval = regs.stackHandleAt(-2); + HandleValue rval = regs.stackHandleAt(-1); + MutableHandleValue res = regs.stackHandleAt(-2); bool done = false; if (!GetElemOptimizedArguments(cx, regs.fp(), lval, rval, res, &done)) @@ -3039,8 +3039,8 @@ END_CASE(JSOP_INITPROP); BEGIN_CASE(JSOP_INITELEM) { JS_ASSERT(regs.stackDepth() >= 3); - HandleValue val = HandleValue::fromMarkedLocation(®s.sp[-1]); - HandleValue id = HandleValue::fromMarkedLocation(®s.sp[-2]); + HandleValue val = regs.stackHandleAt(-1); + HandleValue id = regs.stackHandleAt(-2); RootedObject &obj = rootObject0; obj = ®s.sp[-3].toObject(); @@ -3055,7 +3055,7 @@ END_CASE(JSOP_INITELEM) BEGIN_CASE(JSOP_INITELEM_ARRAY) { JS_ASSERT(regs.stackDepth() >= 2); - HandleValue val = HandleValue::fromMarkedLocation(®s.sp[-1]); + HandleValue val = regs.stackHandleAt(-1); RootedObject &obj = rootObject0; obj = ®s.sp[-2].toObject(); @@ -3073,7 +3073,7 @@ END_CASE(JSOP_INITELEM_ARRAY) BEGIN_CASE(JSOP_INITELEM_INC) { JS_ASSERT(regs.stackDepth() >= 3); - HandleValue val = HandleValue::fromMarkedLocation(®s.sp[-1]); + HandleValue val = regs.stackHandleAt(-1); RootedObject &obj = rootObject0; obj = ®s.sp[-3].toObject(); @@ -3148,7 +3148,7 @@ END_VARLEN_CASE BEGIN_CASE(JSOP_EXCEPTION) { PUSH_NULL(); - MutableHandleValue res = MutableHandleValue::fromMarkedLocation(®s.sp[-1]); + MutableHandleValue res = regs.stackHandleAt(-1); if (!GetAndClearException(cx, res)) goto error; } @@ -3188,7 +3188,7 @@ BEGIN_CASE(JSOP_INSTANCEOF) RootedObject &obj = rootObject0; obj = &rref.toObject(); JSBool cond = JS_FALSE; - if (!HasInstance(cx, obj, HandleValue::fromMarkedLocation(®s.sp[-2]), &cond)) + if (!HasInstance(cx, obj, regs.stackHandleAt(-2), &cond)) goto error; regs.sp--; regs.sp[-1].setBoolean(cond); diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index ecf6eaaa50fc..7f1fb517e636 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -1022,6 +1022,14 @@ class FrameRegs pc = script->code + script->length - JSOP_STOP_LENGTH; JS_ASSERT(*pc == JSOP_STOP); } + + MutableHandleValue stackHandleAt(int i) { + return MutableHandleValue::fromMarkedLocation(&sp[i]); + } + + HandleValue stackHandleAt(int i) const { + return HandleValue::fromMarkedLocation(&sp[i]); + } }; /*****************************************************************************/ From 9e65e2904f84972cd38ac493f9a4942d808e4a4d Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Thu, 25 Jul 2013 16:31:48 -0700 Subject: [PATCH 14/92] Bug 784739 - Switch from NULL to nullptr in mfbt/. r=jwalden --HG-- extra : rebase_source : 090706fa9d97854fe3071adf037a09d914a0854f --- mfbt/GuardObjects.h | 3 ++- mfbt/LinkedList.h | 37 ++++++++++++++++++----------------- mfbt/RangedPtr.h | 3 ++- mfbt/Scoped.h | 5 +++-- mfbt/ThreadLocal.h | 3 ++- mfbt/Vector.h | 6 +++--- mfbt/tests/TestPoisonArea.cpp | 6 ++++-- 7 files changed, 35 insertions(+), 28 deletions(-) diff --git a/mfbt/GuardObjects.h b/mfbt/GuardObjects.h index 763ca1d29a2d..aeae7dcbc082 100644 --- a/mfbt/GuardObjects.h +++ b/mfbt/GuardObjects.h @@ -10,6 +10,7 @@ #define mozilla_GuardObjects_h #include "mozilla/Assertions.h" +#include "mozilla/NullPtr.h" #include "mozilla/Types.h" #ifdef __cplusplus @@ -73,7 +74,7 @@ class MOZ_EXPORT GuardObjectNotifier bool* statementDone; public: - GuardObjectNotifier() : statementDone(NULL) { } + GuardObjectNotifier() : statementDone(nullptr) { } ~GuardObjectNotifier() { *statementDone = true; diff --git a/mfbt/LinkedList.h b/mfbt/LinkedList.h index db1b002975dc..c29760b3e73c 100644 --- a/mfbt/LinkedList.h +++ b/mfbt/LinkedList.h @@ -46,8 +46,8 @@ * } * * void notifyObservers(char* topic) { - * for (Observer* o = list.getFirst(); o != NULL; o = o->getNext()) - * o->Observe(topic); + * for (Observer* o = list.getFirst(); o != nullptr; o = o->getNext()) + * o->observe(topic); * } * }; * @@ -58,6 +58,7 @@ #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" +#include "mozilla/NullPtr.h" #ifdef __cplusplus @@ -70,10 +71,10 @@ template class LinkedListElement { /* - * It's convenient that we return NULL when getNext() or getPrevious() hits - * the end of the list, but doing so costs an extra word of storage in each - * linked list node (to keep track of whether |this| is the sentinel node) - * and a branch on this value in getNext/getPrevious. + * It's convenient that we return nullptr when getNext() or getPrevious() + * hits the end of the list, but doing so costs an extra word of storage in + * each linked list node (to keep track of whether |this| is the sentinel + * node) and a branch on this value in getNext/getPrevious. * * We could get rid of the extra word of storage by shoving the "is * sentinel" bit into one of the pointers, although this would, of course, @@ -121,8 +122,8 @@ class LinkedListElement } /* - * Get the next element in the list, or NULL if this is the last element in - * the list. + * Get the next element in the list, or nullptr if this is the last element + * in the list. */ T* getNext() { return next->asT(); @@ -132,8 +133,8 @@ class LinkedListElement } /* - * Get the previous element in the list, or NULL if this is the first element - * in the list. + * Get the previous element in the list, or nullptr if this is the first + * element in the list. */ T* getPrevious() { return prev->asT(); @@ -206,18 +207,18 @@ class LinkedListElement { } /* - * Return |this| cast to T* if we're a normal node, or return NULL if we're - * a sentinel node. + * Return |this| cast to T* if we're a normal node, or return nullptr if + * we're a sentinel node. */ T* asT() { if (isSentinel) - return NULL; + return nullptr; return static_cast(this); } const T* asT() const { if (isSentinel) - return NULL; + return nullptr; return static_cast(this); } @@ -284,7 +285,7 @@ class LinkedList } /* - * Get the first element of the list, or NULL if the list is empty. + * Get the first element of the list, or nullptr if the list is empty. */ T* getFirst() { return sentinel.getNext(); @@ -294,7 +295,7 @@ class LinkedList } /* - * Get the last element of the list, or NULL if the list is empty. + * Get the last element of the list, or nullptr if the list is empty. */ T* getLast() { return sentinel.getPrevious(); @@ -305,7 +306,7 @@ class LinkedList /* * Get and remove the first element of the list. If the list is empty, - * return NULL. + * return nullptr. */ T* popFirst() { T* ret = sentinel.getNext(); @@ -316,7 +317,7 @@ class LinkedList /* * Get and remove the last element of the list. If the list is empty, - * return NULL. + * return nullptr. */ T* popLast() { T* ret = sentinel.getPrevious(); diff --git a/mfbt/RangedPtr.h b/mfbt/RangedPtr.h index cc6f236c8ce4..493fcdbaee63 100644 --- a/mfbt/RangedPtr.h +++ b/mfbt/RangedPtr.h @@ -14,6 +14,7 @@ #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" +#include "mozilla/NullPtr.h" #include "mozilla/Util.h" namespace mozilla { @@ -60,7 +61,7 @@ class RangedPtr #ifdef DEBUG return RangedPtr(p, rangeStart, rangeEnd); #else - return RangedPtr(p, NULL, size_t(0)); + return RangedPtr(p, nullptr, size_t(0)); #endif } diff --git a/mfbt/Scoped.h b/mfbt/Scoped.h index 4d78986009bc..fc48584b3e7d 100644 --- a/mfbt/Scoped.h +++ b/mfbt/Scoped.h @@ -54,6 +54,7 @@ #include "mozilla/Attributes.h" #include "mozilla/GuardObjects.h" +#include "mozilla/NullPtr.h" namespace mozilla { @@ -195,7 +196,7 @@ template struct ScopedFreePtrTraits { typedef T* type; - static T* empty() { return NULL; } + static T* empty() { return nullptr; } static void release(T* ptr) { free(ptr); } }; SCOPED_TEMPLATE(ScopedFreePtr, ScopedFreePtrTraits) @@ -258,7 +259,7 @@ template struct TypeSpecificScopedPointerTraits { typedef T* type; - const static type empty() { return NULL; } + const static type empty() { return nullptr; } const static void release(type value) { if (value) diff --git a/mfbt/ThreadLocal.h b/mfbt/ThreadLocal.h index fe3b25e23931..99a1c16925ea 100644 --- a/mfbt/ThreadLocal.h +++ b/mfbt/ThreadLocal.h @@ -29,6 +29,7 @@ __declspec(dllimport) unsigned long __stdcall TlsAlloc(); #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" +#include "mozilla/NullPtr.h" namespace mozilla { @@ -107,7 +108,7 @@ ThreadLocal::init() key = TlsAlloc(); inited = key != 0xFFFFFFFFUL; // TLS_OUT_OF_INDEXES #else - inited = !pthread_key_create(&key, NULL); + inited = !pthread_key_create(&key, nullptr); #endif return inited; } diff --git a/mfbt/Vector.h b/mfbt/Vector.h index 762b19020cc3..5b5cfdc53cfa 100644 --- a/mfbt/Vector.h +++ b/mfbt/Vector.h @@ -1050,7 +1050,7 @@ VectorBase::extractRawBuffer() if (usingInlineStorage()) { ret = reinterpret_cast(this->malloc_(mLength * sizeof(T))); if (!ret) - return NULL; + return nullptr; Impl::copyConstruct(ret, beginNoCheck(), endNoCheck()); Impl::destroy(beginNoCheck(), endNoCheck()); /* mBegin, mCapacity are unchanged. */ @@ -1105,14 +1105,14 @@ template inline size_t VectorBase::sizeOfExcludingThis(MallocSizeOf mallocSizeOf) const { - return usingInlineStorage() ? 0 : mallocSizeOf(beginNoCheck()); + return usingInlineStorage() ? 0 : mallocSizeOf(beginNoCheck()); } template inline size_t VectorBase::sizeOfIncludingThis(MallocSizeOf mallocSizeOf) const { - return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); + return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf); } template diff --git a/mfbt/tests/TestPoisonArea.cpp b/mfbt/tests/TestPoisonArea.cpp index cf2417a244d1..062422dabb61 100644 --- a/mfbt/tests/TestPoisonArea.cpp +++ b/mfbt/tests/TestPoisonArea.cpp @@ -79,6 +79,8 @@ * at all. Thus, it is not used here. */ +#include "mozilla/NullPtr.h" + // MAP_ANON(YMOUS) is not in any standard, and the C99 PRI* macros are // not in C++98. Add defines as necessary. #define __STDC_FORMAT_MACROS @@ -195,8 +197,8 @@ StrW32Error(DWORD errcode) FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPSTR) &errmsg, 0, NULL); + nullptr, errcode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)&errmsg, 0, nullptr); // FormatMessage puts an unwanted newline at the end of the string size_t n = strlen(errmsg)-1; From 022df98414baab8bfc7958adcb837cac8e2e582d Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Tue, 23 Jul 2013 14:12:36 -0700 Subject: [PATCH 15/92] Bug 894026 - Implement ES6 binary and octal literals. r=till --HG-- extra : rebase_source : 8b38dbc0f3c98f7246137d21ae9b3a29be640e2b --- js/src/frontend/TokenStream.cpp | 34 ++++-- js/src/js.msg | 4 +- .../ecma_6/Expressions/binary-literals.js | 115 ++++++++++++++++++ js/src/tests/ecma_6/Expressions/browser.js | 0 .../ecma_6/Expressions/octal-literals.js | 103 ++++++++++++++++ js/src/tests/ecma_6/Expressions/shell.js | 0 6 files changed, 247 insertions(+), 9 deletions(-) create mode 100644 js/src/tests/ecma_6/Expressions/binary-literals.js create mode 100644 js/src/tests/ecma_6/Expressions/browser.js create mode 100644 js/src/tests/ecma_6/Expressions/octal-literals.js create mode 100644 js/src/tests/ecma_6/Expressions/shell.js diff --git a/js/src/frontend/TokenStream.cpp b/js/src/frontend/TokenStream.cpp index 69af34fd80c3..519068317cb6 100644 --- a/js/src/frontend/TokenStream.cpp +++ b/js/src/frontend/TokenStream.cpp @@ -1003,7 +1003,7 @@ enum FirstCharKind { Dec, Colon, Plus, - HexOct, + BasePrefix, /* These two must be last, so that |c >= Space| matches both. */ Space, @@ -1022,7 +1022,7 @@ enum FirstCharKind { * Dec: 49..57: '1'..'9' * Colon: 58: ':' * Plus: 43: '+' - * HexOct: 48: '0' + * BasePrefix: 48: '0' * Space: 9, 11, 12: '\t', '\v', '\f' * EOL: 10, 13: '\n', '\r' */ @@ -1032,7 +1032,7 @@ static const uint8_t firstCharKinds[] = { /* 10+ */ EOL, Space, Space, EOL, _______, _______, _______, _______, _______, _______, /* 20+ */ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, /* 30+ */ _______, _______, Space, _______, String, _______, Ident, _______, _______, String, -/* 40+ */ OneChar, OneChar, _______, Plus, OneChar, _______, Dot, _______, HexOct, Dec, +/* 40+ */ OneChar, OneChar, _______, Plus, OneChar, _______, Dot, _______, BasePrefix, Dec, /* 50+ */ Dec, Dec, Dec, Dec, Dec, Dec, Dec, Dec, Colon, OneChar, /* 60+ */ _______, Equals, _______, OneChar, _______, Ident, Ident, Ident, Ident, Ident, /* 70+ */ Ident, Ident, Ident, Ident, Ident, Ident, Ident, Ident, Ident, Ident, @@ -1397,10 +1397,8 @@ TokenStream::getTokenInternal() goto out; } - /* - * Look for a hexadecimal or octal number. - */ - if (c1kind == HexOct) { + // Look for a hexadecimal, octal, or binary number. + if (c1kind == BasePrefix) { int radix; c = getCharIgnoreEOL(); if (c == 'x' || c == 'X') { @@ -1414,6 +1412,28 @@ TokenStream::getTokenInternal() numStart = userbuf.addressOfNextRawChar() - 1; /* one past the '0x' */ while (JS7_ISHEX(c)) c = getCharIgnoreEOL(); + } else if (c == 'b' || c == 'B') { + radix = 2; + c = getCharIgnoreEOL(); + if (c != '0' && c != '1') { + ungetCharIgnoreEOL(c); + reportError(JSMSG_MISSING_BINARY_DIGITS); + goto error; + } + numStart = userbuf.addressOfNextRawChar() - 1; /* one past the '0b' */ + while (c == '0' || c == '1') + c = getCharIgnoreEOL(); + } else if (c == 'o' || c == 'O') { + radix = 8; + c = getCharIgnoreEOL(); + if (c < '0' || c > '7') { + ungetCharIgnoreEOL(c); + reportError(JSMSG_MISSING_OCTAL_DIGITS); + goto error; + } + numStart = userbuf.addressOfNextRawChar() - 1; /* one past the '0o' */ + while ('0' <= c && c <= '7') + c = getCharIgnoreEOL(); } else if (JS7_ISDEC(c)) { radix = 8; numStart = userbuf.addressOfNextRawChar() - 1; /* one past the '0' */ diff --git a/js/src/js.msg b/js/src/js.msg index 74b221442b3c..b6a39c9f3be5 100644 --- a/js/src/js.msg +++ b/js/src/js.msg @@ -184,7 +184,7 @@ MSG_DEF(JSMSG_BAD_OPERAND, 130, 1, JSEXN_SYNTAXERR, "invalid {0} oper MSG_DEF(JSMSG_BAD_PROP_ID, 131, 0, JSEXN_SYNTAXERR, "invalid property id") MSG_DEF(JSMSG_RESERVED_ID, 132, 1, JSEXN_SYNTAXERR, "{0} is a reserved identifier") MSG_DEF(JSMSG_SYNTAX_ERROR, 133, 0, JSEXN_SYNTAXERR, "syntax error") -MSG_DEF(JSMSG_UNUSED134, 134, 0, JSEXN_NONE, "") +MSG_DEF(JSMSG_MISSING_BINARY_DIGITS, 134, 0, JSEXN_SYNTAXERR, "missing binary digits after '0b'") MSG_DEF(JSMSG_BAD_PROTOTYPE, 135, 1, JSEXN_TYPEERR, "'prototype' property of {0} is not an object") MSG_DEF(JSMSG_MISSING_EXPONENT, 136, 0, JSEXN_SYNTAXERR, "missing exponent") MSG_DEF(JSMSG_OUT_OF_MEMORY, 137, 0, JSEXN_ERR, "out of memory") @@ -193,7 +193,7 @@ MSG_DEF(JSMSG_TOO_MANY_PARENS, 139, 0, JSEXN_INTERNALERR, "too many paren MSG_DEF(JSMSG_UNTERMINATED_COMMENT, 140, 0, JSEXN_SYNTAXERR, "unterminated comment") MSG_DEF(JSMSG_UNTERMINATED_REGEXP, 141, 0, JSEXN_SYNTAXERR, "unterminated regular expression literal") MSG_DEF(JSMSG_BAD_CLONE_FUNOBJ_SCOPE, 142, 0, JSEXN_TYPEERR, "bad cloned function scope chain") -MSG_DEF(JSMSG_UNUSED143, 143, 0, JSEXN_NONE, "") +MSG_DEF(JSMSG_MISSING_OCTAL_DIGITS, 143, 0, JSEXN_SYNTAXERR, "missing octal digits after '0o'") MSG_DEF(JSMSG_ILLEGAL_CHARACTER, 144, 0, JSEXN_SYNTAXERR, "illegal character") MSG_DEF(JSMSG_BAD_OCTAL, 145, 1, JSEXN_SYNTAXERR, "{0} is not a legal ECMA-262 octal constant") MSG_DEF(JSMSG_REPEAT_RANGE, 146, 0, JSEXN_RANGEERR, "repeat count must be positive and less than inifinity") diff --git a/js/src/tests/ecma_6/Expressions/binary-literals.js b/js/src/tests/ecma_6/Expressions/binary-literals.js new file mode 100644 index 000000000000..df1f2ed6f34f --- /dev/null +++ b/js/src/tests/ecma_6/Expressions/binary-literals.js @@ -0,0 +1,115 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 894026; +var summary = "Implement ES6 binary literals"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +var chars = ['b', 'B']; + +for (var i = 0; i < 2; i++) +{ + if (i === 2) + { + chars.forEach(function(v) + { + try + { + eval('0' + v + i); + throw "didn't throw"; + } + catch (e) + { + assertEq(e instanceof SyntaxError, true, + "no syntax error evaluating 0" + v + i + ", " + + "got " + e); + } + }); + continue; + } + + for (var j = 0; j < 2; j++) + { + if (j === 2) + { + chars.forEach(function(v) + { + try + { + eval('0' + v + i + j); + throw "didn't throw"; + } + catch (e) + { + assertEq(e instanceof SyntaxError, true, + "no syntax error evaluating 0" + v + i + j + ", " + + "got " + e); + } + }); + continue; + } + + for (var k = 0; k < 2; k++) + { + if (k === 2) + { + chars.forEach(function(v) + { + try + { + eval('0' + v + i + j + k); + throw "didn't throw"; + } + catch (e) + { + assertEq(e instanceof SyntaxError, true, + "no syntax error evaluating 0" + v + i + j + k + ", " + + "got " + e); + } + }); + continue; + } + + chars.forEach(function(v) + { + assertEq(eval('0' + v + i + j + k), i * 4 + j * 2 + k); + }); + } + } +} + +chars.forEach(function(v) +{ + try + { + } + catch (e) + { + assertEq(e instanceof SyntaxError, true, + "no syntax error evaluating 0" + v + ", got " + e); + } +}); + +// Off-by-one check: '/' immediately precedes '0'. +assertEq(0b110/1, 6); +assertEq(0B10110/1, 22); + +function strict() +{ + "use strict"; + return 0b11010101; +} +assertEq(strict(), 128 + 64 + 16 + 4 + 1); + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("Tests complete"); diff --git a/js/src/tests/ecma_6/Expressions/browser.js b/js/src/tests/ecma_6/Expressions/browser.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/js/src/tests/ecma_6/Expressions/octal-literals.js b/js/src/tests/ecma_6/Expressions/octal-literals.js new file mode 100644 index 000000000000..abeef8736fd7 --- /dev/null +++ b/js/src/tests/ecma_6/Expressions/octal-literals.js @@ -0,0 +1,103 @@ +// Any copyright is dedicated to the Public Domain. +// http://creativecommons.org/licenses/publicdomain/ + +//----------------------------------------------------------------------------- +var BUGNUMBER = 894026; +var summary = "Implement ES6 octal literals"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +var chars = ['o', 'O']; + +for (var i = 0; i < 8; i++) +{ + if (i === 8) + { + chars.forEach(function(v) + { + try + { + eval('0' + v + i); + throw "didn't throw"; + } + catch (e) + { + assertEq(e instanceof SyntaxError, true, + "no syntax error evaluating 0" + v + i + ", " + + "got " + e); + } + }); + continue; + } + + for (var j = 0; j < 8; j++) + { + if (j === 8) + { + chars.forEach(function(v) + { + try + { + eval('0' + v + i + j); + throw "didn't throw"; + } + catch (e) + { + assertEq(e instanceof SyntaxError, true, + "no syntax error evaluating 0" + v + i + j + ", " + + "got " + e); + } + }); + continue; + } + + for (var k = 0; k < 8; k++) + { + if (k === 8) + { + chars.forEach(function(v) + { + try + { + eval('0' + v + i + j + k); + throw "didn't throw"; + } + catch (e) + { + assertEq(e instanceof SyntaxError, true, + "no syntax error evaluating 0" + v + i + j + k + ", " + + "got " + e); + } + }); + continue; + } + + chars.forEach(function(v) + { + assertEq(eval('0' + v + i + j + k), i * 64 + j * 8 + k); + }); + } + } +} + +// Off-by-one check: '/' immediately precedes '0'. +assertEq(0o110/2, 36); +assertEq(0O644/2, 210); + +function strict() +{ + "use strict"; + return 0o755; +} +assertEq(strict(), 7 * 64 + 5 * 8 + 5); + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("Tests complete"); diff --git a/js/src/tests/ecma_6/Expressions/shell.js b/js/src/tests/ecma_6/Expressions/shell.js new file mode 100644 index 000000000000..e69de29bb2d1 From 7ea615da33f933ca5f017ac42e1007c7e580f72d Mon Sep 17 00:00:00 2001 From: Max Li Date: Fri, 26 Jul 2013 06:26:44 -0400 Subject: [PATCH 16/92] Bug 690199 - ARIA select widget should expose focusable state regardless the way they manage its children. r=surkov --- accessible/src/base/ARIAMap.cpp | 14 ++-- accessible/src/base/ARIAStateMap.cpp | 11 +++ accessible/src/base/ARIAStateMap.h | 3 +- .../tests/mochitest/states/test_aria.html | 68 ++++++++++++++++--- 4 files changed, 80 insertions(+), 16 deletions(-) diff --git a/accessible/src/base/ARIAMap.cpp b/accessible/src/base/ARIAMap.cpp index 6c0844ef9cd8..8ed7f3daefdb 100644 --- a/accessible/src/base/ARIAMap.cpp +++ b/accessible/src/base/ARIAMap.cpp @@ -176,9 +176,10 @@ static nsRoleMapEntry sWAIRoleMaps[] = eNoAction, eNoLiveAttr, eSelect | eTable, - states::FOCUSABLE, + kNoReqStates, eARIAMultiSelectable, - eARIAReadonlyOrEditable + eARIAReadonlyOrEditable, + eFocusableUntilDisabled }, { // gridcell &nsGkAtoms::gridcell, @@ -263,7 +264,8 @@ static nsRoleMapEntry sWAIRoleMaps[] = eListControl | eSelect, kNoReqStates, eARIAMultiSelectable, - eARIAReadonly + eARIAReadonly, + eFocusableUntilDisabled }, { // listitem &nsGkAtoms::listitem, @@ -605,7 +607,8 @@ static nsRoleMapEntry sWAIRoleMaps[] = eSelect, kNoReqStates, eARIAReadonly, - eARIAMultiSelectable + eARIAMultiSelectable, + eFocusableUntilDisabled }, { // treegrid &nsGkAtoms::treegrid, @@ -617,7 +620,8 @@ static nsRoleMapEntry sWAIRoleMaps[] = eSelect | eTable, kNoReqStates, eARIAReadonly, - eARIAMultiSelectable + eARIAMultiSelectable, + eFocusableUntilDisabled }, { // treeitem &nsGkAtoms::treeitem, diff --git a/accessible/src/base/ARIAStateMap.cpp b/accessible/src/base/ARIAStateMap.cpp index 61bd35dae34f..084e14d49fab 100644 --- a/accessible/src/base/ARIAStateMap.cpp +++ b/accessible/src/base/ARIAStateMap.cpp @@ -5,6 +5,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ARIAMap.h" +#include "nsAccUtils.h" #include "States.h" #include "mozilla/dom/Element.h" @@ -327,6 +328,16 @@ aria::MapToState(EStateRule aRule, dom::Element* aElement, uint64_t* aState) return true; } + case eFocusableUntilDisabled: + { + if (!nsAccUtils::HasDefinedARIAToken(aElement, nsGkAtoms::aria_disabled) || + aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_disabled, + nsGkAtoms::_false, eCaseMatters)) + *aState |= states::FOCUSABLE; + + return true; + } + default: return false; } diff --git a/accessible/src/base/ARIAStateMap.h b/accessible/src/base/ARIAStateMap.h index 651959792676..596230b0a8f6 100644 --- a/accessible/src/base/ARIAStateMap.h +++ b/accessible/src/base/ARIAStateMap.h @@ -44,7 +44,8 @@ enum EStateRule eARIASelectable, eARIASelectableIfDefined, eReadonlyUntilEditable, - eIndeterminateIfNoValue + eIndeterminateIfNoValue, + eFocusableUntilDisabled }; /** diff --git a/accessible/tests/mochitest/states/test_aria.html b/accessible/tests/mochitest/states/test_aria.html index 4e99a18fba2e..f8960c1639ee 100644 --- a/accessible/tests/mochitest/states/test_aria.html +++ b/accessible/tests/mochitest/states/test_aria.html @@ -198,6 +198,14 @@ testStates("aria_progressbar_valuenow", 0, 0, STATE_MIXED); testStates("aria_progressbar_valuetext", 0, 0, STATE_MIXED); + testStates("aria_listbox", STATE_FOCUSABLE); + testStates("aria_grid", STATE_FOCUSABLE); + testStates("aria_tree", STATE_FOCUSABLE); + testStates("aria_treegrid", STATE_FOCUSABLE); + testStates("aria_listbox_disabled", 0, 0, STATE_FOCUSABLE); + testStates("aria_grid_disabled", 0, 0, STATE_FOCUSABLE); + testStates("aria_tree_disabled", 0, 0, STATE_FOCUSABLE); + testStates("aria_treegrid_disabled", 0, 0, STATE_FOCUSABLE); SimpleTest.finish(); } @@ -219,6 +227,11 @@ title="Propagate aria-disabled to descendants"> Mozilla Bug 429285 + + Mozilla Bug 457226 + @@ -234,20 +247,20 @@ title="aria-orientation should be applied to separator and slider roles"> Mozilla Bug 681674 - - Mozilla Bug 699017 - Mozilla Bug 689847 - Mozilla Bug 457226 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=699017" + title="File input control should be propogate states to descendants"> + Mozilla Bug 699017 + + + Mozilla Bug 690199 Mozilla Bug 762876 Mozilla Bug 835121 +

@@ -413,5 +427,39 @@
   
+ + +
+
A
+
a
+
+
+
B
+
b
+
+
C
+
c
+
+
+
D
+
d
+
+
+
E
+
e
+
+
+
F
+
f
+
+
+
G
+
g
+
+
+
H
+
h
+
+ From ce93df92dbddf5c48d0a16e9aa5a9807ebd6d4ad Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Fri, 26 Jul 2013 12:34:25 +0200 Subject: [PATCH 17/92] Backed out changeset ae8d72538dee (bug 897484) for b2g bustage --- caps/src/nsSecurityManagerFactory.cpp | 4 +-- content/base/src/nsFrameMessageManager.cpp | 3 +- content/xbl/src/nsXBLBinding.cpp | 2 +- content/xbl/src/nsXBLProtoImplField.cpp | 2 +- dom/audiochannel/AudioChannelService.cpp | 4 +-- dom/base/nsDOMClassInfo.cpp | 23 +++++--------- dom/bindings/BindingUtils.cpp | 12 ++------ dom/bindings/CallbackInterface.cpp | 2 +- dom/bindings/Codegen.py | 12 ++++---- dom/bluetooth/BluetoothHfpManager.cpp | 4 +-- dom/bluetooth/BluetoothService.cpp | 4 +-- dom/indexedDB/KeyPath.cpp | 3 +- dom/network/src/TCPSocketParent.cpp | 2 +- dom/plugins/base/nsJSNPRuntime.cpp | 10 +++---- dom/src/geolocation/nsGeolocation.cpp | 4 +-- dom/src/json/nsJSON.cpp | 2 +- dom/system/OSFileConstants.cpp | 2 +- dom/system/gonk/AudioManager.cpp | 6 ++-- dom/system/gonk/AutoMounterSetting.cpp | 4 +-- dom/system/gonk/TimeZoneSettingObserver.cpp | 4 +-- dom/workers/ChromeWorkerScope.cpp | 2 +- dom/workers/EventListenerManager.cpp | 8 ++--- dom/workers/Events.cpp | 4 +-- dom/workers/WorkerScope.cpp | 7 ++--- ipc/testshell/XPCShellEnvironment.cpp | 2 +- js/ipc/JavaScriptChild.cpp | 4 +-- js/ipc/JavaScriptShared.cpp | 2 +- js/jsd/jsd_val.cpp | 2 +- js/src/ctypes/CTypes.cpp | 12 ++++---- js/src/jsapi-tests/testArrayBuffer.cpp | 14 ++++----- js/src/jsapi-tests/testException.cpp | 2 +- js/src/jsapi-tests/testFunctionProperties.cpp | 4 +-- js/src/jsapi-tests/testGetPropertyDefault.cpp | 8 ++--- js/src/jsapi-tests/testParseJSON.cpp | 8 ++--- js/src/jsapi.cpp | 30 +++++++++++-------- js/src/jsapi.h | 15 ++++------ js/src/jsdbgapi.cpp | 6 ++-- js/src/jsexn.cpp | 10 +++---- js/src/shell/js.cpp | 24 +++++++-------- js/src/shell/jsheaptools.cpp | 2 +- js/src/vm/Debugger.cpp | 4 +-- js/xpconnect/loader/mozJSComponentLoader.cpp | 6 ++-- js/xpconnect/src/XPCComponents.cpp | 12 ++++---- js/xpconnect/src/XPCWrappedJSClass.cpp | 12 ++++---- js/xpconnect/src/XPCWrappedNative.cpp | 8 ++--- js/xpconnect/src/XPCWrappedNativeJSOps.cpp | 2 +- js/xpconnect/src/dictionary_helper_gen.py | 16 ++++++---- .../src/peerconnection/PeerConnectionImpl.cpp | 8 ++--- startupcache/test/TestStartupCache.cpp | 4 +-- toolkit/components/ctypes/ctypes.cpp | 6 ++-- toolkit/components/perf/PerfMeasurement.cpp | 4 +-- toolkit/components/places/History.cpp | 8 ++--- 52 files changed, 180 insertions(+), 185 deletions(-) diff --git a/caps/src/nsSecurityManagerFactory.cpp b/caps/src/nsSecurityManagerFactory.cpp index 07333299feef..b775fa88de3e 100644 --- a/caps/src/nsSecurityManagerFactory.cpp +++ b/caps/src/nsSecurityManagerFactory.cpp @@ -85,7 +85,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext) JSClass *objectClass = JS_GetClass(obj); JS::Rooted v(cx); - if (!JS_GetProperty(cx, global, "netscape", &v)) + if (!JS_GetProperty(cx, global, "netscape", v.address())) return NS_ERROR_FAILURE; JS::Rooted securityObj(cx); @@ -95,7 +95,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext) * "security" property. */ obj = &v.toObject(); - if (!JS_GetProperty(cx, obj, "security", &v) || !v.isObject()) + if (!JS_GetProperty(cx, obj, "security", v.address()) || !v.isObject()) return NS_ERROR_FAILURE; securityObj = &v.toObject(); } else { diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index 004ed6c8f786..0ec31525f34f 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -748,7 +748,8 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget, thisValue.address(), nullptr, true); } else { // If the listener is a JS object which has receiveMessage function: - if (!JS_GetProperty(ctx, object, "receiveMessage", &funval) || + if (!JS_GetProperty(ctx, object, "receiveMessage", + funval.address()) || !funval.isObject()) return NS_ERROR_UNEXPECTED; diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index ffecdb09b8bb..956207157f80 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -1163,7 +1163,7 @@ nsXBLBinding::LookupMemberInternal(JSContext* aCx, nsString& aName, // Find our class object. It's in a protected scope and permanent just in case, // so should be there no matter what. JS::RootedValue classObject(aCx); - if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, &classObject)) { + if (!JS_GetProperty(aCx, aXBLScope, mJSClass->name, classObject.address())) { return false; } diff --git a/content/xbl/src/nsXBLProtoImplField.cpp b/content/xbl/src/nsXBLProtoImplField.cpp index 290555f5e70b..10745d4bf3f0 100644 --- a/content/xbl/src/nsXBLProtoImplField.cpp +++ b/content/xbl/src/nsXBLProtoImplField.cpp @@ -244,7 +244,7 @@ FieldGetterImpl(JSContext *cx, JS::CallArgs args) } JS::Rooted v(cx); - if (!JS_GetPropertyById(cx, thisObj, id, &v)) { + if (!JS_GetPropertyById(cx, thisObj, id, v.address())) { return false; } args.rval().set(v); diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index 4b9593159157..9bbfd81d70a4 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -541,7 +541,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", &key) || + if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) { return NS_OK; } @@ -556,7 +556,7 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const PR } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", &value) || !value.isInt32()) { + if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isInt32()) { return NS_OK; } diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index c283702dfcec..b9ca18c0614c 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -2721,7 +2721,7 @@ BaseStubConstructor(nsIWeakReference* aWeakOwner, JSAutoCompartment ac(cx, thisObject); JS::Rooted funval(cx); - if (!JS_GetProperty(cx, thisObject, "constructor", &funval) || + if (!JS_GetProperty(cx, thisObject, "constructor", funval.address()) || !funval.isObject()) { return NS_ERROR_UNEXPECTED; } @@ -3226,7 +3226,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper, // This isn't a normal DOM object, see if this constructor lives on its // prototype chain. JS::Rooted val(cx); - if (!JS_GetProperty(cx, obj, "prototype", &val)) { + if (!JS_GetProperty(cx, obj, "prototype", val.address())) { return NS_ERROR_UNEXPECTED; } @@ -3967,10 +3967,7 @@ ContentWindowGetter(JSContext *cx, unsigned argc, jsval *vp) if (!obj) return JS_FALSE; - JS::Rooted value(cx); - bool result = ::JS_GetProperty(cx, obj, "content", &value); - *vp = value; - return result; + return ::JS_GetProperty(cx, obj, "content", vp); } template @@ -4117,7 +4114,7 @@ DefineComponentsShim(JSContext *cx, JS::HandleObject global) // Look up the appopriate interface object on the global. JS::Rooted v(cx, JS::UndefinedValue()); - ok = JS_GetProperty(cx, global, domName, &v); + ok = JS_GetProperty(cx, global, domName, v.address()); NS_ENSURE_TRUE(ok, NS_ERROR_OUT_OF_MEMORY); if (!v.isObject()) { NS_WARNING("Unable to find interface object on global"); @@ -4648,7 +4645,7 @@ nsGenericArraySH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx, *length = 0; JS::Rooted lenval(cx); - if (!JS_GetProperty(cx, obj, "length", &lenval)) { + if (!JS_GetProperty(cx, obj, "length", lenval.address())) { return NS_ERROR_UNEXPECTED; } @@ -4687,7 +4684,7 @@ nsGenericArraySH::Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, sCurrentlyEnumerating = true; JS::Rooted len_val(cx); - JSBool ok = ::JS_GetProperty(cx, obj, "length", &len_val); + JSBool ok = ::JS_GetProperty(cx, obj, "length", len_val.address()); if (ok && JSVAL_IS_INT(len_val)) { int32_t length = JSVAL_TO_INT(len_val); @@ -5035,13 +5032,7 @@ nsHTMLDocumentSH::CallToGetPropMapper(JSContext *cx, unsigned argc, jsval *vp) return JS_FALSE; } - JS::Rooted value(cx); - if (!::JS_GetUCProperty(cx, self, chars, length, &value)) { - return false; - } - - *vp = value; - return true; + return ::JS_GetUCProperty(cx, self, chars, length, vp); } // StringArray helper diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 9647410a5861..2f3ca6f15890 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -1322,13 +1322,7 @@ GetPropertyOnPrototype(JSContext* cx, JS::Handle proxy, return true; } - JS::Rooted value(cx); - if (!JS_ForwardGetPropertyTo(cx, proto, id, proxy, &value)) { - return false; - } - - *vp = value; - return true; + return JS_ForwardGetPropertyTo(cx, proto, id, proxy, vp); } bool @@ -1747,7 +1741,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle obj, } JS::Rooted protov(cx); - DebugOnly ok = JS_GetProperty(cx, obj, "prototype", &protov); + DebugOnly ok = JS_GetProperty(cx, obj, "prototype", protov.address()); MOZ_ASSERT(ok, "Someone messed with our prototype property?"); JS::Rooted interfacePrototype(cx, &protov.toObject()); @@ -1851,7 +1845,7 @@ GetWindowForJSImplementedObject(JSContext* cx, JS::Handle obj, // Look up the content-side object. JS::Rooted domImplVal(cx); - if (!JS_GetProperty(cx, obj, "__DOM_IMPL__", &domImplVal)) { + if (!JS_GetProperty(cx, obj, "__DOM_IMPL__", domImplVal.address())) { return false; } diff --git a/dom/bindings/CallbackInterface.cpp b/dom/bindings/CallbackInterface.cpp index b07689ccc4db..46d92ceb2340 100644 --- a/dom/bindings/CallbackInterface.cpp +++ b/dom/bindings/CallbackInterface.cpp @@ -16,7 +16,7 @@ bool CallbackInterface::GetCallableProperty(JSContext* cx, const char* aPropName, JS::MutableHandle aCallable) { - if (!JS_GetProperty(cx, mCallback, aPropName, aCallable)) { + if (!JS_GetProperty(cx, mCallback, aPropName, aCallable.address())) { return false; } if (!aCallable.isObject() || diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index e173422bf235..5bd898a8ae7c 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -5478,7 +5478,7 @@ class CGSpecializedForwardingSetter(CGSpecializedSetter): assert all(ord(c) < 128 for c in attrName) assert all(ord(c) < 128 for c in forwardToAttrName) return CGIndenter(CGGeneric("""JS::RootedValue v(cx); -if (!JS_GetProperty(cx, obj, "%s", &v)) { +if (!JS_GetProperty(cx, obj, "%s", v.address())) { return false; } @@ -7338,7 +7338,7 @@ class CGDOMJSProxyHandler_get(ClassMethod): " return false;\n" "}\n" "if (hasUnforgeable) {\n" - " return JS_ForwardGetPropertyTo(cx, ${holder}, id, proxy, vp);\n" + " return JS_ForwardGetPropertyTo(cx, ${holder}, id, proxy, vp.address());\n" "}") getUnforgeableOrExpando = CallOnUnforgeableHolder(self.descriptor, hasUnforgeable) @@ -7352,7 +7352,7 @@ if (expando) { } if (hasProp) { - return JS_GetPropertyById(cx, expando, id, vp); + return JS_GetPropertyById(cx, expando, id, vp.address()); } }""" @@ -8006,11 +8006,11 @@ class CGDictionary(CGThing): # NOTE: jsids are per-runtime, so don't use them in workers if self.workers: propName = member.identifier.name - propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", &temp.ref())' % + propGet = ('JS_GetProperty(cx, &val.toObject(), "%s", temp.ref().address())' % propName) else: propId = self.makeIdName(member.identifier.name); - propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, &temp.ref())" % + propGet = ("JS_GetPropertyById(cx, &val.toObject(), %s, temp.ref().address())" % propId) conversionReplacements = { @@ -9907,7 +9907,7 @@ class CallbackGetter(CallbackMember): "attrName": self.attrName } return string.Template( - 'if (!JS_GetProperty(cx, mCallback, "${attrName}", &rval)) {\n' + 'if (!JS_GetProperty(cx, mCallback, "${attrName}", rval.address())) {\n' ' aRv.Throw(NS_ERROR_UNEXPECTED);\n' ' return${errorReturn};\n' '}\n').substitute(replacements); diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp index 22b78a582fef..c30ab62663b4 100644 --- a/dom/bluetooth/BluetoothHfpManager.cpp +++ b/dom/bluetooth/BluetoothHfpManager.cpp @@ -537,7 +537,7 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData) JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) { + if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) { return; } @@ -548,7 +548,7 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData) } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", &value)|| + if (!JS_GetProperty(cx, obj, "value", value.address())|| !value.isNumber()) { return; } diff --git a/dom/bluetooth/BluetoothService.cpp b/dom/bluetooth/BluetoothService.cpp index aa8d75825c8f..5045df1f5ff5 100644 --- a/dom/bluetooth/BluetoothService.cpp +++ b/dom/bluetooth/BluetoothService.cpp @@ -566,7 +566,7 @@ BluetoothService::HandleSettingsChanged(const nsAString& aData) JSObject& obj(val.toObject()); - JS::Rooted key(cx); + JS::Value key; if (!JS_GetProperty(cx, &obj, "key", &key)) { MOZ_ASSERT(!JS_IsExceptionPending(cx)); return NS_ERROR_OUT_OF_MEMORY; @@ -584,7 +584,7 @@ BluetoothService::HandleSettingsChanged(const nsAString& aData) } if (match) { - JS::Rooted value; + JS::Value value; if (!JS_GetProperty(cx, &obj, "value", &value)) { MOZ_ASSERT(!JS_IsExceptionPending(cx)); return NS_ERROR_OUT_OF_MEMORY; diff --git a/dom/indexedDB/KeyPath.cpp b/dom/indexedDB/KeyPath.cpp index ea8f48c6eda3..bc039397f007 100644 --- a/dom/indexedDB/KeyPath.cpp +++ b/dom/indexedDB/KeyPath.cpp @@ -117,7 +117,8 @@ GetJSValFromKeyPathString(JSContext* aCx, if (hasProp) { // Get if the property exists... JS::Rooted intermediate(aCx); - JSBool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen, &intermediate); + JSBool ok = JS_GetUCProperty(aCx, obj, keyPathChars, keyPathLen, + intermediate.address()); NS_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); // Treat explicitly undefined as an error. diff --git a/dom/network/src/TCPSocketParent.cpp b/dom/network/src/TCPSocketParent.cpp index 65aa5c63af46..1283e1147a8f 100644 --- a/dom/network/src/TCPSocketParent.cpp +++ b/dom/network/src/TCPSocketParent.cpp @@ -171,7 +171,7 @@ TCPSocketParent::SendCallback(const nsAString& aType, const JS::Value& aDataVal, nsDependentJSString name; JS::Rooted val(aCx); - if (!JS_GetProperty(aCx, obj, "name", &val)) { + if (!JS_GetProperty(aCx, obj, "name", val.address())) { NS_ERROR("No name property on supposed error object"); } else if (JSVAL_IS_STRING(val)) { if (!name.init(aCx, JSVAL_TO_STRING(val))) { diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index a7d85dea0e48..9087c987b4a9 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -540,7 +540,7 @@ nsJSObjWrapper::NP_Invalidate(NPObject *npobj) } static JSBool -GetProperty(JSContext *cx, JSObject *obj, NPIdentifier id, JS::MutableHandle rval) +GetProperty(JSContext *cx, JSObject *obj, NPIdentifier id, JS::Value *rval) { NS_ASSERTION(NPIdentifierIsInt(id) || NPIdentifierIsString(id), "id must be either string or int!\n"); @@ -574,7 +574,7 @@ nsJSObjWrapper::NP_HasMethod(NPObject *npobj, NPIdentifier id) AutoJSExceptionReporter reporter(cx); JS::Rooted v(cx); - JSBool ok = GetProperty(cx, npjsobj->mJSObj, id, &v); + JSBool ok = GetProperty(cx, npjsobj->mJSObj, id, v.address()); return ok && !JSVAL_IS_PRIMITIVE(v) && ::JS_ObjectIsFunction(cx, JSVAL_TO_OBJECT(v)); @@ -610,7 +610,7 @@ doInvoke(NPObject *npobj, NPIdentifier method, const NPVariant *args, AutoJSExceptionReporter reporter(cx); if (method != NPIdentifier_VOID) { - if (!GetProperty(cx, npjsobj->mJSObj, method, &fv) || + if (!GetProperty(cx, npjsobj->mJSObj, method, fv.address()) || ::JS_TypeOfValue(cx, fv) != JSTYPE_FUNCTION) { return false; } @@ -752,7 +752,7 @@ nsJSObjWrapper::NP_GetProperty(NPObject *npobj, NPIdentifier id, JSAutoCompartment ac(cx, npjsobj->mJSObj); JS::Rooted v(cx); - return (GetProperty(cx, npjsobj->mJSObj, id, &v) && + return (GetProperty(cx, npjsobj->mJSObj, id, v.address()) && JSValToNPVariant(npp, cx, v, result)); } @@ -1621,7 +1621,7 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle obj, JSType hint, JS:: // giving plugins a [[DefaultValue]] which uses only toString and not valueOf. JS::Rooted v(cx, JSVAL_VOID); - if (!JS_GetProperty(cx, obj, "toString", &v)) + if (!JS_GetProperty(cx, obj, "toString", v.address())) return false; if (!JSVAL_IS_PRIMITIVE(v) && JS_ObjectIsCallable(cx, JSVAL_TO_OBJECT(v))) { if (!JS_CallFunctionValue(cx, obj, v, 0, NULL, vp.address())) diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp index a7def0c15d2f..9bb067ea0a1a 100644 --- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -718,7 +718,7 @@ nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData) JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) { + if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) { return; } @@ -728,7 +728,7 @@ nsGeolocationService::HandleMozsettingChanged(const PRUnichar* aData) } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", &value) || !value.isBoolean()) { + if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isBoolean()) { return; } diff --git a/dom/src/json/nsJSON.cpp b/dom/src/json/nsJSON.cpp index 438451bf94c3..8f749eed046e 100644 --- a/dom/src/json/nsJSON.cpp +++ b/dom/src/json/nsJSON.cpp @@ -211,7 +211,7 @@ nsJSON::EncodeInternal(JSContext* cx, const JS::Value& aValue, */ JS::Rooted val(cx, aValue); JS::Rooted toJSON(cx); - if (JS_GetProperty(cx, obj, "toJSON", &toJSON) && + if (JS_GetProperty(cx, obj, "toJSON", toJSON.address()) && toJSON.isObject() && JS_ObjectIsCallable(cx, &toJSON.toObject())) { // If toJSON is implemented, it must not throw diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp index 0c5a92d8e9eb..00e27e28b889 100644 --- a/dom/system/OSFileConstants.cpp +++ b/dom/system/OSFileConstants.cpp @@ -605,7 +605,7 @@ JSObject *GetOrCreateObjectProperty(JSContext *cx, JS::Handle aObject const char *aProperty) { JS::Rooted val(cx); - if (!JS_GetProperty(cx, aObject, aProperty, &val)) { + if (!JS_GetProperty(cx, aObject, aProperty, val.address())) { return NULL; } if (!val.isUndefined()) { diff --git a/dom/system/gonk/AudioManager.cpp b/dom/system/gonk/AudioManager.cpp index 5f85182e271f..a2e8013ea300 100644 --- a/dom/system/gonk/AudioManager.cpp +++ b/dom/system/gonk/AudioManager.cpp @@ -219,7 +219,7 @@ AudioManager::Observe(nsISupports* aSubject, AudioSystem::setParameters(0, cmd); } } - } + } // To process the volume control on each audio channel according to // change of settings else if (!strcmp(aTopic, "mozsettings-changed")) { @@ -233,7 +233,7 @@ AudioManager::Observe(nsISupports* aSubject, JS::Rooted obj(cx, &val.toObject()); JS::Rooted key(cx); - if (!JS_GetProperty(cx, obj, "key", &key) || + if (!JS_GetProperty(cx, obj, "key", key.address()) || !key.isString()) { return NS_OK; } @@ -248,7 +248,7 @@ AudioManager::Observe(nsISupports* aSubject, } JS::Rooted value(cx); - if (!JS_GetProperty(cx, obj, "value", &value) || !value.isInt32()) { + if (!JS_GetProperty(cx, obj, "value", value.address()) || !value.isInt32()) { return NS_OK; } diff --git a/dom/system/gonk/AutoMounterSetting.cpp b/dom/system/gonk/AutoMounterSetting.cpp index 97aa72bd7d75..4ffa9595a376 100644 --- a/dom/system/gonk/AutoMounterSetting.cpp +++ b/dom/system/gonk/AutoMounterSetting.cpp @@ -186,7 +186,7 @@ AutoMounterSetting::Observe(nsISupports* aSubject, return NS_OK; } JSObject& obj(val.toObject()); - JS::Rooted key(cx); + JS::Value key; if (!JS_GetProperty(cx, &obj, "key", &key) || !key.isString()) { return NS_OK; @@ -198,7 +198,7 @@ AutoMounterSetting::Observe(nsISupports* aSubject, return NS_OK; } - JS::Rooted value(cx); + JS::Value value; if (!JS_GetProperty(cx, &obj, "value", &value)) { return NS_OK; } diff --git a/dom/system/gonk/TimeZoneSettingObserver.cpp b/dom/system/gonk/TimeZoneSettingObserver.cpp index eec9f9431e85..006e8976b17b 100644 --- a/dom/system/gonk/TimeZoneSettingObserver.cpp +++ b/dom/system/gonk/TimeZoneSettingObserver.cpp @@ -180,7 +180,7 @@ TimeZoneSettingObserver::Observe(nsISupports *aSubject, // Get the key, which should be the JS string "time.timezone". JSObject &obj(val.toObject()); - JS::Rooted key(cx); + JS::Value key; if (!JS_GetProperty(cx, &obj, "key", &key) || !key.isString()) { return NS_OK; @@ -192,7 +192,7 @@ TimeZoneSettingObserver::Observe(nsISupports *aSubject, } // Get the value, which should be a JS string like "America/Chicago". - JS::Rooted value(cx); + JS::Value value; if (!JS_GetProperty(cx, &obj, "value", &value) || !value.isString()) { return NS_OK; diff --git a/dom/workers/ChromeWorkerScope.cpp b/dom/workers/ChromeWorkerScope.cpp index 432d0ce0882b..de2b6421842c 100644 --- a/dom/workers/ChromeWorkerScope.cpp +++ b/dom/workers/ChromeWorkerScope.cpp @@ -55,7 +55,7 @@ DefineChromeWorkerFunctions(JSContext* aCx, JS::Handle aGlobal) { JS::Rooted ctypes(aCx); if (!JS_InitCTypesClass(aCx, aGlobal) || - !JS_GetProperty(aCx, aGlobal, "ctypes", &ctypes)) { + !JS_GetProperty(aCx, aGlobal, "ctypes", ctypes.address())) { return false; } diff --git a/dom/workers/EventListenerManager.cpp b/dom/workers/EventListenerManager.cpp index 4403fdd055b8..08934d62790b 100644 --- a/dom/workers/EventListenerManager.cpp +++ b/dom/workers/EventListenerManager.cpp @@ -298,7 +298,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, } JS::Rooted val(aCx); - if (!JS_GetProperty(aCx, aEvent, "target", &val)) { + if (!JS_GetProperty(aCx, aEvent, "target", val.address())) { aRv.Throw(NS_ERROR_FAILURE); return false; } @@ -316,7 +316,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, JS::Rooted eventType(aCx); JSBool eventIsTrusted; - if (!JS_GetProperty(aCx, aEvent, "type", &val) || + if (!JS_GetProperty(aCx, aEvent, "type", val.address()) || !(eventType = JS_ValueToString(aCx, val)) || !(eventType = JS_InternJSString(aCx, eventType))) { aRv.Throw(NS_ERROR_FAILURE); @@ -325,7 +325,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, // We have already ensure that the event is one of our types of events so // there is no need to worry about this property being faked. - if (!JS_GetProperty(aCx, aEvent, "isTrusted", &val) || + if (!JS_GetProperty(aCx, aEvent, "isTrusted", val.address()) || !JS_ValueToBoolean(aCx, val, &eventIsTrusted)) { aRv.Throw(NS_ERROR_FAILURE); return false; @@ -408,7 +408,7 @@ EventListenerManager::DispatchEvent(JSContext* aCx, const EventTarget& aTarget, } if (hasHandleEvent) { - if (!JS_GetProperty(aCx, listenerObj, sHandleEventChars, &listenerVal)) { + if (!JS_GetProperty(aCx, listenerObj, sHandleEventChars, listenerVal.address())) { if (!JS_ReportPendingException(aCx)) { aRv.Throw(NS_ERROR_FAILURE); return false; diff --git a/dom/workers/Events.cpp b/dom/workers/Events.cpp index e382e4eb5354..8ac4f8d9568b 100644 --- a/dom/workers/Events.cpp +++ b/dom/workers/Events.cpp @@ -57,14 +57,14 @@ public: if (aMainRuntime) { JS::Rooted windowPropVal(aCx); - if (!JS_GetProperty(aCx, aObj, sClass.name, &windowPropVal)) { + if (!JS_GetProperty(aCx, aObj, sClass.name, windowPropVal.address())) { return NULL; } if (!JSVAL_IS_PRIMITIVE(windowPropVal)) { JS::Rooted protoVal(aCx); if (!JS_GetProperty(aCx, JSVAL_TO_OBJECT(windowPropVal), "prototype", - &protoVal)) { + protoVal.address())) { return NULL; } diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index f876c16932ff..98687ba1d89d 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -266,10 +266,9 @@ private: JS::Rooted event(aCx, &JS_ARGV(aCx, aVp)[0].toObject()); jsval argv[3] = { JSVAL_VOID, JSVAL_VOID, JSVAL_VOID }; - JS::AutoArrayRooter rootedArgv(aCx, ArrayLength(argv), argv); - if (!JS_GetProperty(aCx, event, "message", rootedArgv.handleAt(0)) || - !JS_GetProperty(aCx, event, "filename", rootedArgv.handleAt(1)) || - !JS_GetProperty(aCx, event, "lineno", rootedArgv.handleAt(2))) { + if (!JS_GetProperty(aCx, event, "message", &argv[0]) || + !JS_GetProperty(aCx, event, "filename", &argv[1]) || + !JS_GetProperty(aCx, event, "lineno", &argv[2])) { return false; } diff --git a/ipc/testshell/XPCShellEnvironment.cpp b/ipc/testshell/XPCShellEnvironment.cpp index 275e26a20796..a3fc2c42100b 100644 --- a/ipc/testshell/XPCShellEnvironment.cpp +++ b/ipc/testshell/XPCShellEnvironment.cpp @@ -78,7 +78,7 @@ Environment(JSObject* global) AutoSafeJSContext cx; JSAutoCompartment ac(cx, global); Rooted v(cx); - if (!JS_GetProperty(cx, global, "__XPCShellEnvironment", &v) || + if (!JS_GetProperty(cx, global, "__XPCShellEnvironment", v.address()) || !v.get().isDouble()) { return nullptr; diff --git a/js/ipc/JavaScriptChild.cpp b/js/ipc/JavaScriptChild.cpp index 89feb408aec2..2932571d581e 100644 --- a/js/ipc/JavaScriptChild.cpp +++ b/js/ipc/JavaScriptChild.cpp @@ -372,7 +372,7 @@ JavaScriptChild::AnswerGet(const ObjectId &objId, const ObjectId &receiverId, co if (!convertGeckoStringToId(cx, id, &internedId)) return fail(cx, rs); - JS::Rooted val(cx); + JS::Value val; if (!JS_ForwardGetPropertyTo(cx, obj, internedId, receiver, &val)) return fail(cx, rs); @@ -516,7 +516,7 @@ JavaScriptChild::AnswerCall(const ObjectId &objId, const nsTArray &argv for (size_t i = 0; i < outobjects.length(); i++) { RootedObject obj(cx, &outobjects[i].toObject()); - RootedValue v(cx); + jsval v; JSBool found; if (JS_HasProperty(cx, obj, "value", &found)) { if (!JS_GetProperty(cx, obj, "value", &v)) diff --git a/js/ipc/JavaScriptShared.cpp b/js/ipc/JavaScriptShared.cpp index ad55c4b2f8b6..43376963f022 100644 --- a/js/ipc/JavaScriptShared.cpp +++ b/js/ipc/JavaScriptShared.cpp @@ -457,7 +457,7 @@ JavaScriptShared::Wrap(JSContext *cx, HandleObject aObj, InfallibleTArray(cx, name, AUTO_NAMELEN(name, namelen)); diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 27eab08da4d4..8c26fd74b201 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -3474,22 +3474,19 @@ extern JS_PUBLIC_API(JSBool) JS_GetOwnPropertyDescriptor(JSContext *cx, JSObject *obj, jsid id, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, JS::MutableHandle vp); +JS_GetProperty(JSContext *cx, JSObject *obj, const char *name, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_GetPropertyDefault(JSContext *cx, JSObject *obj, const char *name, jsval def, - JS::MutableHandle vp); +JS_GetPropertyDefault(JSContext *cx, JSObject *obj, const char *name, jsval def, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_GetPropertyById(JSContext *cx, JSObject *obj, jsid id, JS::MutableHandle vp); +JS_GetPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_GetPropertyByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def, - JS::MutableHandle vp); +JS_GetPropertyByIdDefault(JSContext *cx, JSObject *obj, jsid id, jsval def, jsval *vp); extern JS_PUBLIC_API(JSBool) -JS_ForwardGetPropertyTo(JSContext *cx, JSObject *obj, jsid id, JSObject *onBehalfOf, - JS::MutableHandle vp); +JS_ForwardGetPropertyTo(JSContext *cx, JSObject *obj, jsid id, JSObject *onBehalfOf, jsval *vp); extern JS_PUBLIC_API(JSBool) JS_SetProperty(JSContext *cx, JSObject *obj, const char *name, JS::Handle v); @@ -3575,7 +3572,7 @@ JS_LookupUCProperty(JSContext *cx, JSObject *obj, extern JS_PUBLIC_API(JSBool) JS_GetUCProperty(JSContext *cx, JSObject *obj, const jschar *name, size_t namelen, - JS::MutableHandle vp); + jsval *vp); extern JS_PUBLIC_API(JSBool) JS_SetUCProperty(JSContext *cx, JSObject *obj, diff --git a/js/src/jsdbgapi.cpp b/js/src/jsdbgapi.cpp index 82c36419bfc7..5ed0c84d11e1 100644 --- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -1105,10 +1105,10 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int // print any unnamed trailing args (found in 'arguments' object) RootedValue val(cx); - if (JS_GetProperty(cx, callObj, "arguments", &val) && val.isObject()) { + if (JS_GetProperty(cx, callObj, "arguments", val.address()) && val.isObject()) { uint32_t argCount; RootedObject argsObj(cx, &val.toObject()); - if (JS_GetProperty(cx, argsObj, "length", &val) && + if (JS_GetProperty(cx, argsObj, "length", val.address()) && ToUint32(cx, val, &argCount) && argCount > namedArgCount) { @@ -1116,7 +1116,7 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int char number[8]; JS_snprintf(number, 8, "%d", (int) k); - if (JS_GetProperty(cx, argsObj, number, &val)) { + if (JS_GetProperty(cx, argsObj, number, val.address())) { JSAutoByteString valueBytes; const char *value = FormatValue(cx, val, valueBytes); buf = JS_sprintf_append(buf, "%s%s%s%s", diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index 66e9f8cb482d..e4eb4e8fccb0 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -1048,14 +1048,14 @@ js_ReportUncaughtException(JSContext *cx) (exnObject->is() || IsDuckTypedErrorObject(cx, exnObject, &filename_str))) { RootedString name(cx); - if (JS_GetProperty(cx, exnObject, js_name_str, tvr.handleAt(2)) && + if (JS_GetProperty(cx, exnObject, js_name_str, &roots[2]) && JSVAL_IS_STRING(roots[2])) { name = JSVAL_TO_STRING(roots[2]); } RootedString msg(cx); - if (JS_GetProperty(cx, exnObject, js_message_str, tvr.handleAt(3)) && + if (JS_GetProperty(cx, exnObject, js_message_str, &roots[3]) && JSVAL_IS_STRING(roots[3])) { msg = JSVAL_TO_STRING(roots[3]); @@ -1077,21 +1077,21 @@ js_ReportUncaughtException(JSContext *cx) str = msg; } - if (JS_GetProperty(cx, exnObject, filename_str, tvr.handleAt(4))) { + if (JS_GetProperty(cx, exnObject, filename_str, &roots[4])) { JSString *tmp = ToString(cx, HandleValue::fromMarkedLocation(&roots[4])); if (tmp) filename.encodeLatin1(cx, tmp); } uint32_t lineno; - if (!JS_GetProperty(cx, exnObject, js_lineNumber_str, tvr.handleAt(5)) || + if (!JS_GetProperty(cx, exnObject, js_lineNumber_str, &roots[5]) || !ToUint32(cx, roots[5], &lineno)) { lineno = 0; } uint32_t column; - if (!JS_GetProperty(cx, exnObject, js_columnNumber_str, tvr.handleAt(5)) || + if (!JS_GetProperty(cx, exnObject, js_columnNumber_str, &roots[5]) || !ToUint32(cx, roots[5], &column)) { column = 0; diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 7c45dcbfee81..657f9981924f 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -934,7 +934,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) RootedObject opts(cx, &args[1].toObject()); RootedValue v(cx); - if (!JS_GetProperty(cx, opts, "newContext", &v)) + if (!JS_GetProperty(cx, opts, "newContext", v.address())) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -943,7 +943,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) newContext = b; } - if (!JS_GetProperty(cx, opts, "compileAndGo", &v)) + if (!JS_GetProperty(cx, opts, "compileAndGo", v.address())) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -952,7 +952,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) compileAndGo = b; } - if (!JS_GetProperty(cx, opts, "noScriptRval", &v)) + if (!JS_GetProperty(cx, opts, "noScriptRval", v.address())) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -961,7 +961,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) noScriptRval = b; } - if (!JS_GetProperty(cx, opts, "fileName", &v)) + if (!JS_GetProperty(cx, opts, "fileName", v.address())) return false; if (JSVAL_IS_NULL(v)) { fileName = NULL; @@ -974,12 +974,12 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) return false; } - if (!JS_GetProperty(cx, opts, "element", &v)) + if (!JS_GetProperty(cx, opts, "element", v.address())) return false; if (!JSVAL_IS_PRIMITIVE(v)) element = JSVAL_TO_OBJECT(v); - if (!JS_GetProperty(cx, opts, "sourceMapURL", &v)) + if (!JS_GetProperty(cx, opts, "sourceMapURL", v.address())) return false; if (!JSVAL_IS_VOID(v)) { sourceMapURL = JS_ValueToString(cx, v); @@ -987,7 +987,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) return false; } - if (!JS_GetProperty(cx, opts, "lineNumber", &v)) + if (!JS_GetProperty(cx, opts, "lineNumber", v.address())) return false; if (!JSVAL_IS_VOID(v)) { uint32_t u; @@ -996,7 +996,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) lineNumber = u; } - if (!JS_GetProperty(cx, opts, "global", &v)) + if (!JS_GetProperty(cx, opts, "global", v.address())) return false; if (!JSVAL_IS_VOID(v)) { global = JSVAL_IS_PRIMITIVE(v) ? NULL : JSVAL_TO_OBJECT(v); @@ -1012,7 +1012,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) } } - if (!JS_GetProperty(cx, opts, "catchTermination", &v)) + if (!JS_GetProperty(cx, opts, "catchTermination", v.address())) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -1021,7 +1021,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp) catchTermination = b; } - if (!JS_GetProperty(cx, opts, "saveFrameChain", &v)) + if (!JS_GetProperty(cx, opts, "saveFrameChain", v.address())) return false; if (!JSVAL_IS_VOID(v)) { JSBool b; @@ -2465,7 +2465,7 @@ sandbox_enumerate(JSContext *cx, HandleObject obj) RootedValue v(cx); JSBool b; - if (!JS_GetProperty(cx, obj, "lazy", &v)) + if (!JS_GetProperty(cx, obj, "lazy", v.address())) return false; JS_ValueToBoolean(cx, v, &b); @@ -2479,7 +2479,7 @@ sandbox_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags, RootedValue v(cx); JSBool b, resolved; - if (!JS_GetProperty(cx, obj, "lazy", &v)) + if (!JS_GetProperty(cx, obj, "lazy", v.address())) return false; JS_ValueToBoolean(cx, v, &b); diff --git a/js/src/shell/jsheaptools.cpp b/js/src/shell/jsheaptools.cpp index 44c86cd42a07..e8b29c7dedfb 100644 --- a/js/src/shell/jsheaptools.cpp +++ b/js/src/shell/jsheaptools.cpp @@ -506,7 +506,7 @@ ReferenceFinder::addReferrer(jsval referrerArg, Path *path) /* Find the property of the results object named |pathName|. */ RootedValue v(context); - if (!JS_GetProperty(context, result, pathName, &v)) + if (!JS_GetProperty(context, result, pathName, v.address())) return false; if (v.isUndefined()) { /* Create an array to accumulate referents under this path. */ diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 49df6a8fd9f5..167257929342 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -4194,7 +4194,7 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code RootedObject opts(cx, &options.toObject()); RootedValue v(cx); - if (!JS_GetProperty(cx, opts, "url", &v)) + if (!JS_GetProperty(cx, opts, "url", v.address())) return false; if (!v.isUndefined()) { RootedString url_str(cx, JS_ValueToString(cx, v)); @@ -4203,7 +4203,7 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code url = JS_EncodeString(cx, url_str); } - if (!JS_GetProperty(cx, opts, "lineNumber", &v)) + if (!JS_GetProperty(cx, opts, "lineNumber", v.address())) return false; if (!v.isUndefined()) { uint32_t lineno; diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index de20e78f2dc7..459a02311bd0 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -518,7 +518,7 @@ mozJSComponentLoader::LoadModule(FileLocation &aFile) JSCLAutoErrorReporterSetter aers(cx, xpc::SystemErrorReporter); RootedValue NSGetFactory_val(cx); - if (!JS_GetProperty(cx, entry->obj, "NSGetFactory", &NSGetFactory_val) || + if (!JS_GetProperty(cx, entry->obj, "NSGetFactory", NSGetFactory_val.address()) || JSVAL_IS_VOID(NSGetFactory_val)) { return NULL; } @@ -1281,7 +1281,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation, RootedValue symbols(mContext); if (!JS_GetProperty(mContext, mod->obj, - "EXPORTED_SYMBOLS", &symbols)) { + "EXPORTED_SYMBOLS", symbols.address())) { return ReportOnCaller(cxhelper, ERROR_NOT_PRESENT, PromiseFlatCString(aLocation).get()); } @@ -1316,7 +1316,7 @@ mozJSComponentLoader::ImportInto(const nsACString &aLocation, PromiseFlatCString(aLocation).get(), i); } - if (!JS_GetPropertyById(mContext, mod->obj, symbolId, &value)) { + if (!JS_GetPropertyById(mContext, mod->obj, symbolId, value.address())) { JSAutoByteString bytes(mContext, JSID_TO_STRING(symbolId)); if (!bytes) return NS_ERROR_FAILURE; diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 60a237ceb805..4975453318b7 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -1916,7 +1916,7 @@ struct MOZ_STACK_CLASS ExceptionArgParser } // Get the property. - return JS_GetProperty(cx, obj, name, rv); + return JS_GetProperty(cx, obj, name, rv.address()); } /* @@ -2243,7 +2243,7 @@ nsXPCConstructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper,JSContext * RootedObject newObj(cx, &rval.toObject()); // first check existence of function property for better error reporting RootedValue fun(cx); - if (!JS_GetProperty(cx, newObj, mInitializer, &fun) || + if (!JS_GetProperty(cx, newObj, mInitializer, fun.address()) || fun.isPrimitive()) { return ThrowAndFail(NS_ERROR_XPC_BAD_INITIALIZER_NAME, cx, _retval); } @@ -2492,7 +2492,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper, return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval); RootedValue val(cx); - if (!JS_GetPropertyById(cx, ifacesObj, id, &val) || val.isPrimitive()) + if (!JS_GetPropertyById(cx, ifacesObj, id, val.address()) || val.isPrimitive()) return ThrowAndFail(NS_ERROR_XPC_BAD_IID, cx, _retval); nsCOMPtr wn; @@ -2541,7 +2541,7 @@ nsXPCComponents_Constructor::CallOrConstruct(nsIXPConnectWrappedNative *wrapper, return ThrowAndFail(NS_ERROR_XPC_BAD_CONVERT_JS, cx, _retval); RootedValue val(cx); - if (!JS_GetPropertyById(cx, classesObj, id, &val) || val.isPrimitive()) + if (!JS_GetPropertyById(cx, classesObj, id, val.address()) || val.isPrimitive()) return ThrowAndFail(NS_ERROR_XPC_BAD_CID, cx, _retval); nsCOMPtr wn; @@ -3526,7 +3526,7 @@ GetPropFromOptions(JSContext *cx, HandleObject from, const char *name, MutableHa if (!JS_HasProperty(cx, from, name, found)) return NS_ERROR_INVALID_ARG; - if (found && !JS_GetProperty(cx, from, name, prop)) + if (found && !JS_GetProperty(cx, from, name, prop.address())) return NS_ERROR_INVALID_ARG; return NS_OK; @@ -4275,7 +4275,7 @@ nsXPCComponents_Utils::MakeObjectPropsNormal(const Value &vobj, JSContext *cx) for (size_t i = 0; i < ida.length(); ++i) { id = ida[i]; - if (!JS_GetPropertyById(cx, obj, id, &v)) + if (!JS_GetPropertyById(cx, obj, id, v.address())) return NS_ERROR_FAILURE; if (v.isPrimitive()) diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 8daab8aabada..6ccf8be6745c 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -230,7 +230,7 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx, // check upfront for the existence of the function property funid = mRuntime->GetStringID(XPCJSRuntime::IDX_QUERY_INTERFACE); - if (!JS_GetPropertyById(cx, jsobj, funid, &fun) || JSVAL_IS_PRIMITIVE(fun)) + if (!JS_GetPropertyById(cx, jsobj, funid, fun.address()) || JSVAL_IS_PRIMITIVE(fun)) return nullptr; // Ensure that we are asking for a scriptable interface. @@ -330,7 +330,7 @@ GetNamedPropertyAsVariantRaw(XPCCallContext& ccx, nsXPTType type = nsXPTType((uint8_t)TD_INTERFACE_TYPE); RootedValue val(ccx); - return JS_GetPropertyById(ccx, aJSObj, aName, &val) && + return JS_GetPropertyById(ccx, aJSObj, aName, val.address()) && // Note that this always takes the T_INTERFACE path through // JSData2Native, so the value passed for useAllocator // doesn't really matter. We pass true for consistency. @@ -1264,7 +1264,7 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS* wrapper, uint16_t methodIndex, } } } else { - if (!JS_GetProperty(cx, obj, name, &fval)) + if (!JS_GetProperty(cx, obj, name, fval.address())) goto pre_call_clean_up; // XXX We really want to factor out the error reporting better and // specifically report the failure to find a function with this name. @@ -1431,7 +1431,7 @@ pre_call_clean_up: RootedValue rval(cx); if (XPT_MD_IS_GETTER(info->flags)) { - success = JS_GetProperty(cx, obj, name, &rval); + success = JS_GetProperty(cx, obj, name, rval.address()); } else if (XPT_MD_IS_SETTER(info->flags)) { rval = *argv; success = JS_SetProperty(cx, obj, name, rval); @@ -1514,7 +1514,7 @@ pre_call_clean_up: else if (JSVAL_IS_PRIMITIVE(argv[i]) || !JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]), mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE), - &val)) + val.address())) break; // setup allocator and/or iid @@ -1558,7 +1558,7 @@ pre_call_clean_up: val = rval; else if (!JS_GetPropertyById(cx, JSVAL_TO_OBJECT(argv[i]), mRuntime->GetStringID(XPCJSRuntime::IDX_VALUE), - &val)) + val.address())) break; // setup allocator and/or iid diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index 4120c1d57fbc..7b61dda7431a 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -1993,7 +1993,7 @@ class CallMethodHelper nsID* result) const; JS_ALWAYS_INLINE JSBool - GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp) const; + GetOutParamSource(uint8_t paramIndex, jsval* srcp) const; JS_ALWAYS_INLINE JSBool GatherAndConvertResults(); @@ -2249,7 +2249,7 @@ CallMethodHelper::GetInterfaceTypeFromParam(uint8_t paramIndex, } JSBool -CallMethodHelper::GetOutParamSource(uint8_t paramIndex, MutableHandleValue srcp) const +CallMethodHelper::GetOutParamSource(uint8_t paramIndex, jsval* srcp) const { const nsXPTParamInfo& paramInfo = mMethodInfo->GetParam(paramIndex); @@ -2529,7 +2529,7 @@ CallMethodHelper::ConvertIndependentParam(uint8_t i) // // This is a no-op for 'in' params. RootedValue src(mCallContext); - if (!GetOutParamSource(i, &src)) + if (!GetOutParamSource(i, src.address())) return false; // All that's left to do is value conversion. Bail early if we don't need @@ -2634,7 +2634,7 @@ CallMethodHelper::ConvertDependentParam(uint8_t i) // // This is a no-op for 'in' params. RootedValue src(mCallContext); - if (!GetOutParamSource(i, &src)) + if (!GetOutParamSource(i, src.address())) return false; // All that's left to do is value conversion. Bail early if we don't need diff --git a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp index 1b4a5ba46912..a6866a10077e 100644 --- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp +++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp @@ -121,7 +121,7 @@ GetDoubleWrappedJSObject(XPCCallContext& ccx, XPCWrappedNative* wrapper) JSAutoCompartment ac(ccx, mainObj); RootedValue val(ccx); - if (JS_GetPropertyById(ccx, mainObj, id, &val) && + if (JS_GetPropertyById(ccx, mainObj, id, val.address()) && !JSVAL_IS_PRIMITIVE(val)) { obj = JSVAL_TO_OBJECT(val); } diff --git a/js/xpconnect/src/dictionary_helper_gen.py b/js/xpconnect/src/dictionary_helper_gen.py index 5db3d4018556..7f95405d9bb2 100644 --- a/js/xpconnect/src/dictionary_helper_gen.py +++ b/js/xpconnect/src/dictionary_helper_gen.py @@ -279,11 +279,13 @@ def write_header(iface, fd): def write_getter(a, iface, fd): realtype = a.realtype.nativeType('in') - fd.write(" NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, &v));\n" - % get_jsid(a.name)) if realtype.count("JS::Value"): - fd.write(" aDict.%s = v;\n" % a.name) - elif realtype.count("bool"): + fd.write(" NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, &aDict.%s));\n" + % (get_jsid(a.name), a.name)) + else: + fd.write(" NS_ENSURE_STATE(JS_GetPropertyById(aCx, aObj, %s, v.address()));\n" + % get_jsid(a.name)) + if realtype.count("bool"): fd.write(" JSBool b;\n") fd.write(" MOZ_ALWAYS_TRUE(JS_ValueToBoolean(aCx, v, &b));\n") fd.write(" aDict.%s = b;\n" % a.name) @@ -371,11 +373,15 @@ def write_cpp(iface, fd): fd.write(" NS_ENSURE_SUCCESS(rv, rv);\n") fd.write(" JSBool found = JS_FALSE;\n") + needjsval = False needccx = False for a in attributes: + if not a.realtype.nativeType('in').count("JS::Value"): + needjsval = True if a.realtype.nativeType('in').count("nsIVariant"): needccx = True - fd.write(" JS::RootedValue v(aCx, JSVAL_VOID);\n") + if needjsval: + fd.write(" JS::RootedValue v(aCx, JSVAL_VOID);\n") if needccx: fd.write(" XPCCallContext ccx(NATIVE_CALLER, aCx);\n") fd.write(" NS_ENSURE_STATE(ccx.IsValid());\n") diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 75da01bbc707..51f299f1f071 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -905,7 +905,7 @@ PeerConnectionImpl::ConvertConstraints( JS::Rooted constraints(aCx, &aConstraints.toObject()); // Mandatory constraints. Note that we only care if the constraint array exists - if (!JS_GetProperty(aCx, constraints, "mandatory", &mandatory)) { + if (!JS_GetProperty(aCx, constraints, "mandatory", mandatory.address())) { return NS_ERROR_FAILURE; } if (!mandatory.isNullOrUndefined()) { @@ -919,7 +919,7 @@ PeerConnectionImpl::ConvertConstraints( // Iterate over each property. for (size_t i = 0; i < mandatoryOpts.length(); i++) { JS::Rooted option(aCx), optionName(aCx); - if (!JS_GetPropertyById(aCx, opts, mandatoryOpts[i], &option) || + if (!JS_GetPropertyById(aCx, opts, mandatoryOpts[i], option.address()) || !JS_IdToValue(aCx, mandatoryOpts[i], optionName.address()) || // We only support boolean constraints for now. !option.isBoolean()) { @@ -935,7 +935,7 @@ PeerConnectionImpl::ConvertConstraints( } // Optional constraints. - if (!JS_GetProperty(aCx, constraints, "optional", &optional)) { + if (!JS_GetProperty(aCx, constraints, "optional", optional.address())) { return NS_ERROR_FAILURE; } if (!optional.isNullOrUndefined()) { @@ -961,7 +961,7 @@ PeerConnectionImpl::ConvertConstraints( return NS_ERROR_FAILURE; } JS::Rooted option(aCx), optionName(aCx); - if (!JS_GetPropertyById(aCx, opts, optionalOpts[0], &option) || + if (!JS_GetPropertyById(aCx, opts, optionalOpts[0], option.address()) || !JS_IdToValue(aCx, optionalOpts[0], optionName.address())) { return NS_ERROR_FAILURE; } diff --git a/startupcache/test/TestStartupCache.cpp b/startupcache/test/TestStartupCache.cpp index 417ccce9cdb1..5ea45947d692 100644 --- a/startupcache/test/TestStartupCache.cpp +++ b/startupcache/test/TestStartupCache.cpp @@ -416,11 +416,11 @@ GetHistogramCounts(const char *testmsg, const nsACString &histogram_id, JSFunction *snapshot_fn = NULL; Rooted ss(cx); return (JS_GetProperty(cx, JSVAL_TO_OBJECT(h), "snapshot", - &snapshot_val) + snapshot_val.address()) && (snapshot_fn = JS_ValueToFunction(cx, snapshot_val)) && JS::Call(cx, JSVAL_TO_OBJECT(h), snapshot_fn, 0, NULL, &ss) - && JS_GetProperty(cx, JSVAL_TO_OBJECT(ss), "counts", counts)); + && JS_GetProperty(cx, JSVAL_TO_OBJECT(ss), "counts", counts.address())); } nsresult diff --git a/toolkit/components/ctypes/ctypes.cpp b/toolkit/components/ctypes/ctypes.cpp index e56a38e2c4cc..927c4b54f4bc 100644 --- a/toolkit/components/ctypes/ctypes.cpp +++ b/toolkit/components/ctypes/ctypes.cpp @@ -67,7 +67,7 @@ static JSBool SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) { JS::Rooted prop(cx); - if (!JS_GetProperty(cx, parent, name, &prop)) + if (!JS_GetProperty(cx, parent, name, prop.address())) return false; if (prop.isUndefined()) { @@ -76,7 +76,7 @@ SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) } JS::Rooted obj(cx, prop.toObjectOrNull()); - if (!JS_GetProperty(cx, obj, "prototype", &prop)) + if (!JS_GetProperty(cx, obj, "prototype", prop.address())) return false; JS::Rooted prototype(cx, prop.toObjectOrNull()); @@ -92,7 +92,7 @@ InitAndSealCTypesClass(JSContext* cx, JS::Handle global) // Set callbacks for charset conversion and such. JS::Rooted ctypes(cx); - if (!JS_GetProperty(cx, global, "ctypes", &ctypes)) + if (!JS_GetProperty(cx, global, "ctypes", ctypes.address())) return false; JS_SetCTypesCallbacks(JSVAL_TO_OBJECT(ctypes), &sCallbacks); diff --git a/toolkit/components/perf/PerfMeasurement.cpp b/toolkit/components/perf/PerfMeasurement.cpp index 09df1d90f9b2..1f959273535c 100644 --- a/toolkit/components/perf/PerfMeasurement.cpp +++ b/toolkit/components/perf/PerfMeasurement.cpp @@ -42,7 +42,7 @@ static JSBool SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) { JS::Rooted prop(cx); - if (!JS_GetProperty(cx, parent, name, &prop)) + if (!JS_GetProperty(cx, parent, name, prop.address())) return false; if (prop.isUndefined()) { @@ -51,7 +51,7 @@ SealObjectAndPrototype(JSContext* cx, JSObject* parent, const char* name) } JS::Rooted obj(cx, prop.toObjectOrNull()); - if (!JS_GetProperty(cx, obj, "prototype", &prop)) + if (!JS_GetProperty(cx, obj, "prototype", prop.address())) return false; JS::Rooted prototype(cx, prop.toObjectOrNull()); diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index 1d3c96ba0ecd..07744a875e08 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -297,7 +297,7 @@ GetURIFromJSObject(JSContext* aCtx, const char* aProperty) { JS::Rooted uriVal(aCtx); - JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &uriVal); + JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, uriVal.address()); NS_ENSURE_TRUE(rc, nullptr); return GetJSValueAsURI(aCtx, uriVal); } @@ -355,7 +355,7 @@ GetStringFromJSObject(JSContext* aCtx, nsString& _string) { JS::Rooted val(aCtx); - JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &val); + JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, val.address()); if (!rc) { _string.SetIsVoid(true); return; @@ -385,7 +385,7 @@ GetIntFromJSObject(JSContext* aCtx, IntType* _int) { JS::Rooted value(aCtx); - JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &value); + JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, value.address()); NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED); if (JSVAL_IS_VOID(value)) { return NS_ERROR_INVALID_ARG; @@ -2808,7 +2808,7 @@ History::UpdatePlaces(const JS::Value& aPlaceInfos, JS::Rooted visits(aCtx, nullptr); { JS::Rooted visitsVal(aCtx); - JSBool rc = JS_GetProperty(aCtx, info, "visits", &visitsVal); + JSBool rc = JS_GetProperty(aCtx, info, "visits", visitsVal.address()); NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED); if (!JSVAL_IS_PRIMITIVE(visitsVal)) { visits = JSVAL_TO_OBJECT(visitsVal); From c8474713a735edf240657bb71b6929f8384fec97 Mon Sep 17 00:00:00 2001 From: Till Schneidereit Date: Fri, 26 Jul 2013 12:59:48 +0200 Subject: [PATCH 18/92] Bug 898365 - Remove superfluous handler-wrapping form JSFunction::nonLazyScript. rs=jonco --HG-- extra : rebase_source : 67f2c2fd74dbc2e3461ad905e248d06a5c2f9155 --- js/src/jsfun.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/jsfun.h b/js/src/jsfun.h index 2ca723550120..cba66db18e2a 100644 --- a/js/src/jsfun.h +++ b/js/src/jsfun.h @@ -260,7 +260,7 @@ class JSFunction : public JSObject JSScript *nonLazyScript() const { JS_ASSERT(hasScript()); - return JS::HandleScript::fromMarkedLocation(&u.i.s.script_); + return u.i.s.script_; } js::HeapPtrScript &mutableScript() { From 38830953cb010ec706d66afd3d9b2b77d569964d Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Fri, 26 Jul 2013 07:05:37 -0500 Subject: [PATCH 19/92] Bug 897417 - Add support for Talos tp-cmdline parameters in metro browser startup. r=mbrubeck --- browser/metro/base/content/browser.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/browser/metro/base/content/browser.js b/browser/metro/base/content/browser.js index e72d3a1bedc1..d2114cb47dc8 100644 --- a/browser/metro/base/content/browser.js +++ b/browser/metro/base/content/browser.js @@ -21,6 +21,9 @@ window.sizeToContent = function() { Cu.reportError("window.sizeToContent is not allowed in this window"); } +/* + * Returns the browser for the currently displayed tab. + */ function getBrowser() { return Browser.selectedBrowser; } @@ -127,11 +130,20 @@ var Browser = { Util.forceOnline(); // If this is an intial window launch the commandline handler passes us the default - // page as an argument. commandURL _should_ never be empty, but we protect against it - // below. However, we delay trying to get the fallback homepage until we really need it. + // page as an argument. let commandURL = null; - if (window.arguments && window.arguments[0]) - commandURL = window.arguments[0]; + try { + let argsObj = window.arguments[0].wrappedJSObject; + if (argsObj && argsObj.pageloadURL) { + // Talos tp-cmdline parameter + commandURL = argsObj.pageloadURL; + } else if (window.arguments && window.arguments[0]) { + // BrowserCLH paramerter + commandURL = window.arguments[0]; + } + } catch (ex) { + Util.dumpLn(ex); + } messageManager.addMessageListener("DOMLinkAdded", this); messageManager.addMessageListener("MozScrolledAreaChanged", this); From 50350a93835fd77833486e0c52459de322f0e0d0 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 26 Jul 2013 14:17:30 +0200 Subject: [PATCH 20/92] Bug 893307 - Handle surround speaker setups when using the WASAPI cubeb backend. r=kinetik --- media/libcubeb/README_MOZILLA | 2 +- media/libcubeb/src/cubeb_wasapi.cpp | 104 ++++++++++++++++++++++++---- 2 files changed, 93 insertions(+), 13 deletions(-) diff --git a/media/libcubeb/README_MOZILLA b/media/libcubeb/README_MOZILLA index d8858e4a28ef..7469c16b835d 100644 --- a/media/libcubeb/README_MOZILLA +++ b/media/libcubeb/README_MOZILLA @@ -5,4 +5,4 @@ Makefile.in build files for the Mozilla build system. The cubeb git repository is: git://github.com/kinetiknz/cubeb.git -The git commit ID used was f82d1c2c269c452ac4052da404c6b0a42aff3c66. +The git commit ID used was 5beac74eab38b7026404888a8cee7675017c7407. diff --git a/media/libcubeb/src/cubeb_wasapi.cpp b/media/libcubeb/src/cubeb_wasapi.cpp index 2817c0dd3dde..86987bf3ae45 100644 --- a/media/libcubeb/src/cubeb_wasapi.cpp +++ b/media/libcubeb/src/cubeb_wasapi.cpp @@ -154,6 +154,28 @@ mono_to_stereo(T * in, long insamples, T * out) } } +template +void +upmix(T * in, long inframes, T * out, int32_t in_channels, int32_t out_channels) +{ + /* If we are playing a mono stream over stereo speakers, copy the data over. */ + if (in_channels == 1 && out_channels == 2) { + mono_to_stereo(in, inframes, out); + return; + } + /* Otherwise, put silence in other channels. */ + long out_index = 0; + for (long i = 0; i < inframes * in_channels; i+=in_channels) { + for (int j = 0; j < in_channels; j++) { + out[out_index + j] = in[i + j]; + } + for (int j = in_channels; j < out_channels; j++) { + out[out_index + j] = 0.0; + } + out_index += out_channels; + } +} + /* This returns the size of a frame in the stream, * before the eventual upmix occurs. */ static size_t @@ -224,7 +246,8 @@ refill_with_resampling(cubeb_stream * stm, float * data, long frames_needed) assert(out_frames == frames_needed || stm->draining); if (should_upmix(stm)) { - mono_to_stereo(resample_dest, out_frames, data); + upmix(resample_dest, out_frames, data, + stm->stream_params.channels, stm->mix_params.channels); } } @@ -248,7 +271,8 @@ refill(cubeb_stream * stm, float * data, long frames_needed) } if (should_upmix(stm)) { - mono_to_stereo(dest, got, data); + upmix(dest, got, data, + stm->stream_params.channels, stm->mix_params.channels); } } @@ -481,6 +505,63 @@ wasapi_get_max_channel_count(cubeb * ctx, uint32_t * max_channels) void wasapi_stream_destroy(cubeb_stream * stm); +/* Based on the mix format and the stream format, try to find a way to play what + * the user requested. */ +static void +handle_channel_layout(cubeb_stream * stm, WAVEFORMATEX ** mix_format, const cubeb_stream_params * stream_params) +{ + assert((*mix_format)->wFormatTag == WAVE_FORMAT_EXTENSIBLE); + + /* Common case: the hardware supports stereo, and the stream is mono or + * stereo. Easy. */ + if ((*mix_format)->nChannels == 2 && + stream_params->channels <= 2) { + return; + } + + /* The hardware is in surround mode, we want to only use front left and front + * right. Try that, and check if it works. */ + WAVEFORMATEXTENSIBLE * format_pcm = reinterpret_cast((*mix_format)); + switch (stream_params->channels) { + case 1: /* Mono */ + format_pcm->dwChannelMask = KSAUDIO_SPEAKER_MONO; + break; + case 2: /* Stereo */ + format_pcm->dwChannelMask = KSAUDIO_SPEAKER_STEREO; + break; + default: + assert(false && "Channel layout not supported."); + break; + } + (*mix_format)->nChannels = stream_params->channels; + (*mix_format)->nBlockAlign = ((*mix_format)->wBitsPerSample * (*mix_format)->nChannels) / 8; + (*mix_format)->nAvgBytesPerSec = (*mix_format)->nSamplesPerSec * (*mix_format)->nBlockAlign; + format_pcm->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; + (*mix_format)->wBitsPerSample = 32; + format_pcm->Samples.wValidBitsPerSample = (*mix_format)->wBitsPerSample; + + /* Check if wasapi will accept our channel layout request. */ + WAVEFORMATEX * closest; + HRESULT hr = stm->client->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, + *mix_format, + &closest); + + if (hr == S_FALSE) { + /* Not supported, but WASAPI gives us a suggestion. Use it, and handle the + * eventual upmix ourselve */ + LOG("Using WASAPI suggested format: channels: %d", closest->nChannels); + CoTaskMemFree(*mix_format); + *mix_format = closest; + } else if (hr == AUDCLNT_E_UNSUPPORTED_FORMAT) { + /* Not supported, no suggestion, there is a bug somewhere. */ + assert(false && "Format not supported, and no suggestion from WASAPI."); + } else if (hr == S_OK) { + LOG("Requested format accepted by WASAPI."); + } else { + assert(false && "Not reached."); + } +} + int wasapi_stream_init(cubeb * context, cubeb_stream ** stream, char const * stream_name, cubeb_stream_params stream_params, @@ -555,6 +636,8 @@ wasapi_stream_init(cubeb * context, cubeb_stream ** stream, /* this is the number of bytes per frame after the eventual upmix. */ stm->bytes_per_frame = static_cast(mix_format->nBlockAlign); + handle_channel_layout(stm, &mix_format, &stream_params); + /* Shared mode WASAPI always supports float32 sample format, so this * is safe. */ stm->mix_params.format = CUBEB_SAMPLE_FLOAT32NE; @@ -594,12 +677,12 @@ wasapi_stream_init(cubeb * context, cubeb_stream ** stream, } hr = stm->client->Initialize(AUDCLNT_SHAREMODE_SHARED, - AUDCLNT_STREAMFLAGS_EVENTCALLBACK | - AUDCLNT_STREAMFLAGS_NOPERSIST, - ms_to_hns(latency), - 0, - mix_format, - NULL); + AUDCLNT_STREAMFLAGS_EVENTCALLBACK | + AUDCLNT_STREAMFLAGS_NOPERSIST, + ms_to_hns(latency), + 0, + mix_format, + NULL); CoTaskMemFree(mix_format); @@ -616,10 +699,7 @@ wasapi_stream_init(cubeb * context, cubeb_stream ** stream, return CUBEB_ERROR; } - /* If we are playing a mono stream, we need to upmix to stereo. - * For now, we assume that the output support stereo sound. - * The alternative would be sad */ - assert(stm->mix_params.channels == 2); + assert(stm->mix_params.channels >= 2); if (stm->mix_params.channels != stm->stream_params.channels) { stm->upmix_buffer = (float *) malloc(frame_to_bytes_before_upmix(stm, stm->buffer_frame_count)); From 5df108a7f9ef0bb159ddaa74893a16803dcc643f Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Fri, 26 Jul 2013 14:49:17 +0200 Subject: [PATCH 21/92] Backed out changeset df8423fdcad8 (bug 888088) for possible premaorange crash --- js/src/ion/arm/Architecture-arm.cpp | 14 ++++++-------- js/src/ion/arm/Architecture-arm.h | 3 --- js/src/ion/arm/Assembler-arm.cpp | 14 ++++++-------- js/src/ion/arm/Assembler-arm.h | 4 ++-- js/src/ion/arm/Bailouts-arm.cpp | 1 - js/src/ion/arm/BaselineHelpers-arm.h | 7 ++++--- js/src/ion/arm/BaselineIC-arm.cpp | 4 ++-- js/src/ion/arm/CodeGenerator-arm.cpp | 7 +++---- js/src/ion/arm/IonFrames-arm.h | 1 + js/src/ion/arm/Lowering-arm.cpp | 5 ++--- js/src/ion/arm/MacroAssembler-arm.cpp | 3 +-- js/src/ion/arm/MacroAssembler-arm.h | 3 +-- js/src/ion/arm/MoveEmitter-arm.h | 2 +- js/src/ion/arm/Trampoline-arm.cpp | 9 ++++----- 14 files changed, 33 insertions(+), 44 deletions(-) diff --git a/js/src/ion/arm/Architecture-arm.cpp b/js/src/ion/arm/Architecture-arm.cpp index 69d41f34546d..9be8e3a6d793 100644 --- a/js/src/ion/arm/Architecture-arm.cpp +++ b/js/src/ion/arm/Architecture-arm.cpp @@ -4,17 +4,14 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "ion/arm/Architecture-arm.h" - +#define HWCAP_ARMv7 (1 << 31) #include "mozilla/StandardInteger.h" -#include -#include -#include #include +#include +#include #include - -#define HWCAP_ARMv7 (1 << 31) +#include // lame check for kernel version // see bug 586550 @@ -30,7 +27,8 @@ #define HWCAP_NEON (1<<6) #define HWCAP_ARMv7 (1<<7) #endif - +#include "ion/arm/Architecture-arm.h" +#include "ion/arm/Assembler-arm.h" namespace js { namespace ion { diff --git a/js/src/ion/arm/Architecture-arm.h b/js/src/ion/arm/Architecture-arm.h index 58eea13711a9..4f492661036b 100644 --- a/js/src/ion/arm/Architecture-arm.h +++ b/js/src/ion/arm/Architecture-arm.h @@ -7,10 +7,7 @@ #ifndef ion_arm_Architecture_arm_h #define ion_arm_Architecture_arm_h -#include "mozilla/StandardInteger.h" - #include - // gcc appears to use __ARM_PCS_VFP to denote that the target is a hard-float target. #ifdef __ARM_PCS_VFP #define JS_CPU_ARM_HARDFP diff --git a/js/src/ion/arm/Assembler-arm.cpp b/js/src/ion/arm/Assembler-arm.cpp index eb5a9da3bd46..cfac479549d3 100644 --- a/js/src/ion/arm/Assembler-arm.cpp +++ b/js/src/ion/arm/Assembler-arm.cpp @@ -4,18 +4,16 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "ion/arm/Assembler-arm.h" - #include "mozilla/DebugOnly.h" #include "mozilla/MathAlgorithms.h" -#include "jscompartment.h" -#include "jsutil.h" - -#include "assembler/jit/ExecutableAllocator.h" -#include "gc/Marking.h" -#include "ion/IonCompartment.h" +#include "ion/arm/Assembler-arm.h" #include "ion/arm/MacroAssembler-arm.h" +#include "gc/Marking.h" +#include "jsutil.h" +#include "assembler/jit/ExecutableAllocator.h" +#include "jscompartment.h" +#include "ion/IonCompartment.h" using namespace js; using namespace js::ion; diff --git a/js/src/ion/arm/Assembler-arm.h b/js/src/ion/arm/Assembler-arm.h index 5ce9eb07ff3e..389564c97ce6 100644 --- a/js/src/ion/arm/Assembler-arm.h +++ b/js/src/ion/arm/Assembler-arm.h @@ -11,11 +11,11 @@ #include "mozilla/MathAlgorithms.h" #include "mozilla/Util.h" +#include "ion/shared/Assembler-shared.h" #include "assembler/assembler/AssemblerBufferWithConstantPool.h" -#include "ion/arm/Architecture-arm.h" #include "ion/CompactBuffer.h" #include "ion/IonCode.h" -#include "ion/shared/Assembler-shared.h" +#include "ion/arm/Architecture-arm.h" #include "ion/shared/IonAssemblerBufferWithConstantPools.h" namespace js { diff --git a/js/src/ion/arm/Bailouts-arm.cpp b/js/src/ion/arm/Bailouts-arm.cpp index d56833528017..2629835625d4 100644 --- a/js/src/ion/arm/Bailouts-arm.cpp +++ b/js/src/ion/arm/Bailouts-arm.cpp @@ -6,7 +6,6 @@ #include "jscntxt.h" #include "jscompartment.h" - #include "ion/Bailouts.h" #include "ion/IonCompartment.h" diff --git a/js/src/ion/arm/BaselineHelpers-arm.h b/js/src/ion/arm/BaselineHelpers-arm.h index 7b0dfe45376b..eac9eb85d70b 100644 --- a/js/src/ion/arm/BaselineHelpers-arm.h +++ b/js/src/ion/arm/BaselineHelpers-arm.h @@ -8,10 +8,11 @@ #define ion_arm_BaselineHelpers_arm_h #ifdef JS_ION -#include "ion/BaselineFrame.h" -#include "ion/BaselineIC.h" -#include "ion/BaselineRegisters.h" + #include "ion/IonMacroAssembler.h" +#include "ion/BaselineFrame.h" +#include "ion/BaselineRegisters.h" +#include "ion/BaselineIC.h" namespace js { namespace ion { diff --git a/js/src/ion/arm/BaselineIC-arm.cpp b/js/src/ion/arm/BaselineIC-arm.cpp index 4e35e4d79577..35faa38cd294 100644 --- a/js/src/ion/arm/BaselineIC-arm.cpp +++ b/js/src/ion/arm/BaselineIC-arm.cpp @@ -4,10 +4,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "ion/BaselineJIT.h" +#include "ion/BaselineIC.h" #include "ion/BaselineCompiler.h" #include "ion/BaselineHelpers.h" -#include "ion/BaselineIC.h" -#include "ion/BaselineJIT.h" #include "ion/IonLinker.h" using namespace js; diff --git a/js/src/ion/arm/CodeGenerator-arm.cpp b/js/src/ion/arm/CodeGenerator-arm.cpp index f6ba87dc4f33..cf1f62baabbd 100644 --- a/js/src/ion/arm/CodeGenerator-arm.cpp +++ b/js/src/ion/arm/CodeGenerator-arm.cpp @@ -4,25 +4,24 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "ion/arm/CodeGenerator-arm.h" - #include "mozilla/MathAlgorithms.h" #include "jscntxt.h" #include "jscompartment.h" #include "jsnum.h" +#include "ion/arm/CodeGenerator-arm.h" +#include "ion/PerfSpewer.h" #include "ion/CodeGenerator.h" #include "ion/IonCompartment.h" #include "ion/IonFrames.h" #include "ion/MIR.h" #include "ion/MIRGraph.h" -#include "ion/PerfSpewer.h" +#include "ion/shared/CodeGenerator-shared-inl.h" #include "vm/Shape.h" #include "jsscriptinlines.h" -#include "ion/shared/CodeGenerator-shared-inl.h" #include "vm/Shape-inl.h" using namespace js; diff --git a/js/src/ion/arm/IonFrames-arm.h b/js/src/ion/arm/IonFrames-arm.h index b692927e9665..6e3e834b8f1b 100644 --- a/js/src/ion/arm/IonFrames-arm.h +++ b/js/src/ion/arm/IonFrames-arm.h @@ -8,6 +8,7 @@ #define ion_arm_IonFrames_arm_h #include "ion/shared/IonFrames-shared.h" +//#include "ion/arm/Assembler-arm.h" namespace js { namespace ion { diff --git a/js/src/ion/arm/Lowering-arm.cpp b/js/src/ion/arm/Lowering-arm.cpp index 19bebcfd25fe..144542cdbf79 100644 --- a/js/src/ion/arm/Lowering-arm.cpp +++ b/js/src/ion/arm/Lowering-arm.cpp @@ -6,10 +6,9 @@ #include "mozilla/MathAlgorithms.h" -#include "ion/arm/Assembler-arm.h" -#include "ion/Lowering.h" #include "ion/MIR.h" - +#include "ion/Lowering.h" +#include "ion/arm/Assembler-arm.h" #include "ion/shared/Lowering-shared-inl.h" using namespace js; diff --git a/js/src/ion/arm/MacroAssembler-arm.cpp b/js/src/ion/arm/MacroAssembler-arm.cpp index ed14deb635a1..2bbe772ac897 100644 --- a/js/src/ion/arm/MacroAssembler-arm.cpp +++ b/js/src/ion/arm/MacroAssembler-arm.cpp @@ -4,11 +4,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "ion/arm/MacroAssembler-arm.h" - #include "mozilla/DebugOnly.h" #include "mozilla/MathAlgorithms.h" +#include "ion/arm/MacroAssembler-arm.h" #include "ion/BaselineFrame.h" #include "ion/MoveEmitter.h" diff --git a/js/src/ion/arm/MacroAssembler-arm.h b/js/src/ion/arm/MacroAssembler-arm.h index 0db5713421a8..a73e20fdfc82 100644 --- a/js/src/ion/arm/MacroAssembler-arm.h +++ b/js/src/ion/arm/MacroAssembler-arm.h @@ -9,12 +9,11 @@ #include "mozilla/DebugOnly.h" -#include "jsopcode.h" - #include "ion/arm/Assembler-arm.h" #include "ion/IonCaches.h" #include "ion/IonFrames.h" #include "ion/MoveResolver.h" +#include "jsopcode.h" using mozilla::DebugOnly; diff --git a/js/src/ion/arm/MoveEmitter-arm.h b/js/src/ion/arm/MoveEmitter-arm.h index e52b80e79983..90fe38e796ed 100644 --- a/js/src/ion/arm/MoveEmitter-arm.h +++ b/js/src/ion/arm/MoveEmitter-arm.h @@ -7,8 +7,8 @@ #ifndef ion_arm_MoveEmitter_arm_h #define ion_arm_MoveEmitter_arm_h -#include "ion/IonMacroAssembler.h" #include "ion/MoveResolver.h" +#include "ion/IonMacroAssembler.h" namespace js { namespace ion { diff --git a/js/src/ion/arm/Trampoline-arm.cpp b/js/src/ion/arm/Trampoline-arm.cpp index 5032ddd2be89..2544b786627c 100644 --- a/js/src/ion/arm/Trampoline-arm.cpp +++ b/js/src/ion/arm/Trampoline-arm.cpp @@ -5,16 +5,15 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "jscompartment.h" - #include "assembler/assembler/MacroAssembler.h" -#include "ion/arm/BaselineHelpers-arm.h" -#include "ion/Bailouts.h" -#include "ion/ExecutionModeInlines.h" #include "ion/IonCompartment.h" -#include "ion/IonFrames.h" #include "ion/IonLinker.h" +#include "ion/IonFrames.h" #include "ion/IonSpewer.h" +#include "ion/Bailouts.h" #include "ion/VMFunctions.h" +#include "ion/arm/BaselineHelpers-arm.h" +#include "ion/ExecutionModeInlines.h" using namespace js; using namespace js::ion; From 8a971946df7f480082addfca64dda21a0399b8f8 Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Fri, 26 Jul 2013 05:59:07 -0700 Subject: [PATCH 22/92] Bug 898036 - Set layout.css.devPixelsPerPx during robocop tests; r=kats --- testing/mochitest/runtestsremote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/mochitest/runtestsremote.py b/testing/mochitest/runtestsremote.py index 364cd553cf4d..db98bb57e54b 100644 --- a/testing/mochitest/runtestsremote.py +++ b/testing/mochitest/runtestsremote.py @@ -590,7 +590,7 @@ def main(): options.extraPrefs.append('robocop.logfile="%s/robocop.log"' % deviceRoot) options.extraPrefs.append('browser.search.suggest.enabled=true') options.extraPrefs.append('browser.search.suggest.prompted=true') - options.extraPrefs.append('browser.viewport.scaleRatio=100') + options.extraPrefs.append('layout.css.devPixelsPerPx="1.0"') options.extraPrefs.append('browser.chrome.dynamictoolbar=false') if (options.dm_trans == 'adb' and options.robocopApk): From 48a892ea8e51febb5d5129bf0e06a14e1b3c97ee Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Fri, 26 Jul 2013 09:30:27 -0400 Subject: [PATCH 23/92] Bug 888510 - In-content theming fixup for the new plugin click-to-activate. Remove the "lightweight" transparent click-to-play theming and make the normal styling plain grey. Switch from a CSS gradient to an image gradient because of performance issues. Highlight the "check for updates" button for outdated plugins. Icons by shorlander and lco, ui-review=lco r=jaws --HG-- rename : toolkit/themes/osx/mozapps/plugins/contentPluginCrashed.png => toolkit/themes/shared/plugins/contentPluginCrashed.png rename : toolkit/themes/osx/mozapps/plugins/contentPluginDownload.png => toolkit/themes/shared/plugins/contentPluginDownload.png rename : toolkit/themes/osx/mozapps/plugins/contentPluginMissing.png => toolkit/themes/shared/plugins/contentPluginMissing.png rename : toolkit/themes/windows/mozapps/plugins/pluginProblem.css => toolkit/themes/shared/plugins/pluginProblem.css --- browser/base/content/browser-plugins.js | 6 +- .../test/browser_pluginnotification.js | 6 +- .../en-US/chrome/mozapps/plugins/plugins.dtd | 2 +- .../mozapps/plugins/content/pluginProblem.xml | 31 +-- toolkit/themes/linux/mozapps/jar.mn | 1 - .../mozapps/plugins/pluginDisabled-16.png | Bin 795 -> 0 bytes .../linux/mozapps/plugins/pluginDisabled.png | Bin 1664 -> 0 bytes toolkit/themes/osx/mozapps/jar.mn | 19 +- .../mozapps/plugins/contentPluginBlocked.png | Bin 1324 -> 0 bytes .../plugins/contentPluginClickToPlay.png | Bin 1507 -> 0 bytes .../plugins/contentPluginClickToPlayPlain.png | Bin 3014 -> 0 bytes .../mozapps/plugins/contentPluginClose.png | Bin 1106 -> 0 bytes .../mozapps/plugins/contentPluginDisabled.png | Bin 1342 -> 0 bytes .../osx/mozapps/plugins/pluginDisabled-16.png | Bin 844 -> 0 bytes .../osx/mozapps/plugins/pluginDisabled.png | Bin 2189 -> 0 bytes .../osx/mozapps/plugins/pluginProblem.css | 221 ------------------ .../shared/plugins/contentPluginActivate.png | Bin 0 -> 3043 bytes .../shared/plugins/contentPluginBlocked.png | Bin 0 -> 1514 bytes .../shared/plugins/contentPluginClose.png | Bin 0 -> 1370 bytes .../plugins/contentPluginCrashed.png | Bin .../shared/plugins/contentPluginDisabled.png | Bin 0 -> 1620 bytes .../plugins/contentPluginDownload.png | Bin .../plugins/contentPluginMissing.png | Bin .../shared/plugins/contentPluginStripe.png | Bin 0 -> 460 bytes .../plugins/pluginProblem.css | 121 ++++------ toolkit/themes/windows/mozapps/jar.mn | 38 ++- .../mozapps/plugins/contentPluginBlocked.png | Bin 1324 -> 0 bytes .../plugins/contentPluginClickToPlay.png | Bin 1507 -> 0 bytes .../plugins/contentPluginClickToPlayPlain.png | Bin 3014 -> 0 bytes .../mozapps/plugins/contentPluginClose.png | Bin 1106 -> 0 bytes .../mozapps/plugins/contentPluginCrashed.png | Bin 1470 -> 0 bytes .../mozapps/plugins/contentPluginDisabled.png | Bin 1342 -> 0 bytes .../mozapps/plugins/contentPluginDownload.png | Bin 1061 -> 0 bytes .../mozapps/plugins/contentPluginMissing.png | Bin 1572 -> 0 bytes .../plugins/pluginDisabled-16-aero.png | Bin 654 -> 0 bytes .../mozapps/plugins/pluginDisabled-16.png | Bin 664 -> 0 bytes .../mozapps/plugins/pluginDisabled-aero.png | Bin 1307 -> 0 bytes .../mozapps/plugins/pluginDisabled.png | Bin 1353 -> 0 bytes 38 files changed, 98 insertions(+), 347 deletions(-) delete mode 100644 toolkit/themes/linux/mozapps/plugins/pluginDisabled-16.png delete mode 100644 toolkit/themes/linux/mozapps/plugins/pluginDisabled.png delete mode 100644 toolkit/themes/osx/mozapps/plugins/contentPluginBlocked.png delete mode 100644 toolkit/themes/osx/mozapps/plugins/contentPluginClickToPlay.png delete mode 100644 toolkit/themes/osx/mozapps/plugins/contentPluginClickToPlayPlain.png delete mode 100644 toolkit/themes/osx/mozapps/plugins/contentPluginClose.png delete mode 100644 toolkit/themes/osx/mozapps/plugins/contentPluginDisabled.png delete mode 100644 toolkit/themes/osx/mozapps/plugins/pluginDisabled-16.png delete mode 100644 toolkit/themes/osx/mozapps/plugins/pluginDisabled.png delete mode 100644 toolkit/themes/osx/mozapps/plugins/pluginProblem.css create mode 100644 toolkit/themes/shared/plugins/contentPluginActivate.png create mode 100644 toolkit/themes/shared/plugins/contentPluginBlocked.png create mode 100644 toolkit/themes/shared/plugins/contentPluginClose.png rename toolkit/themes/{osx/mozapps => shared}/plugins/contentPluginCrashed.png (100%) create mode 100644 toolkit/themes/shared/plugins/contentPluginDisabled.png rename toolkit/themes/{osx/mozapps => shared}/plugins/contentPluginDownload.png (100%) rename toolkit/themes/{osx/mozapps => shared}/plugins/contentPluginMissing.png (100%) create mode 100644 toolkit/themes/shared/plugins/contentPluginStripe.png rename toolkit/themes/{windows/mozapps => shared}/plugins/pluginProblem.css (61%) delete mode 100644 toolkit/themes/windows/mozapps/plugins/contentPluginBlocked.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/contentPluginClickToPlay.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/contentPluginClickToPlayPlain.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/contentPluginClose.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/contentPluginCrashed.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/contentPluginDisabled.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/contentPluginDownload.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/contentPluginMissing.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/pluginDisabled-16-aero.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/pluginDisabled-16.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/pluginDisabled-aero.png delete mode 100644 toolkit/themes/windows/mozapps/plugins/pluginDisabled.png diff --git a/browser/base/content/browser-plugins.js b/browser/base/content/browser-plugins.js index 00682ad7cf3c..485bd5bcfdb1 100644 --- a/browser/base/content/browser-plugins.js +++ b/browser/base/content/browser-plugins.js @@ -269,7 +269,7 @@ var gPluginHandler = { let iconStatus = doc.getAnonymousElementByAttribute(plugin, "class", "icon"); iconStatus.setAttribute("installable", "true"); - let installLink = doc.getAnonymousElementByAttribute(plugin, "class", "installPluginLink"); + let installLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "installPluginLink"); this.addLinkClickCallback(installLink, "installSinglePlugin", plugin); } break; @@ -280,7 +280,7 @@ var gPluginHandler = { break; case "PluginVulnerableUpdatable": - let updateLink = doc.getAnonymousElementByAttribute(plugin, "class", "checkForUpdatesLink"); + let updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink"); this.addLinkClickCallback(updateLink, "openPluginUpdatePage"); /* FALLTHRU */ @@ -306,7 +306,7 @@ var gPluginHandler = { break; case "PluginDisabled": - let manageLink = doc.getAnonymousElementByAttribute(plugin, "class", "managePluginsLink"); + let manageLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "managePluginsLink"); this.addLinkClickCallback(manageLink, "managePlugins"); shouldShowNotification = true; break; diff --git a/browser/base/content/test/browser_pluginnotification.js b/browser/base/content/test/browser_pluginnotification.js index 8dda75617e42..70d314937a6f 100644 --- a/browser/base/content/test/browser_pluginnotification.js +++ b/browser/base/content/test/browser_pluginnotification.js @@ -134,7 +134,7 @@ function test3() { ok(pluginNode, "Test 3, Found plugin in page"); var objLoadingContent = pluginNode.QueryInterface(Ci.nsIObjectLoadingContent); is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED, "Test 3, plugin fallback type should be PLUGIN_DISABLED"); - var manageLink = gTestBrowser.contentDocument.getAnonymousElementByAttribute(pluginNode, "class", "managePluginsLink"); + var manageLink = gTestBrowser.contentDocument.getAnonymousElementByAttribute(pluginNode, "anonid", "managePluginsLink"); ok(manageLink, "Test 3, found 'manage' link in plugin-problem binding"); EventUtils.synthesizeMouseAtCenter(manageLink, {}, gTestBrowser.contentWindow); @@ -344,7 +344,7 @@ function test18a() { ok(!objLoadingContent.activated, "Test 18a, Plugin should not be activated"); var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox"); ok(overlay.style.visibility != "hidden", "Test 18a, Plugin overlay should exist, not be hidden"); - var updateLink = doc.getAnonymousElementByAttribute(plugin, "class", "checkForUpdatesLink"); + var updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink"); ok(updateLink.style.visibility != "hidden", "Test 18a, Plugin should have an update link"); var tabOpenListener = new TabOpenListener(Services.urlFormatter.formatURLPref("plugins.update.url"), false, false); @@ -387,7 +387,7 @@ function test18c() { ok(!objLoadingContent.activated, "Test 18c, Plugin should not be activated"); var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox"); ok(overlay.style.visibility != "hidden", "Test 18c, Plugin overlay should exist, not be hidden"); - var updateLink = doc.getAnonymousElementByAttribute(plugin, "class", "checkForUpdatesLink"); + var updateLink = doc.getAnonymousElementByAttribute(plugin, "anonid", "checkForUpdatesLink"); ok(updateLink.style.display != "block", "Test 18c, Plugin should not have an update link"); // check that click "Always allow" works with blocklisted plugins diff --git a/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd b/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd index a5f216ad0b7b..ad6eeaa876dd 100644 --- a/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd +++ b/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd @@ -39,7 +39,7 @@ - + diff --git a/toolkit/mozapps/plugins/content/pluginProblem.xml b/toolkit/mozapps/plugins/content/pluginProblem.xml index 5c26d2accb7b..a68aba2cfe5f 100644 --- a/toolkit/mozapps/plugins/content/pluginProblem.xml +++ b/toolkit/mozapps/plugins/content/pluginProblem.xml @@ -22,19 +22,17 @@ - - - - - + + + - + &tapToPlayPlugin; + &clickToActivatePlugin; + + + &missingPlugin; &unsupportedPlatform.pre;&unsupportedPlatform.learnMore;&unsupportedPlatform.post; - &tapToPlayPlugin; - - &checkForUpdates; - &clickToActivatePlugin; &disabledPlugin; &blockedPlugin.label; @@ -44,9 +42,11 @@ - &installPlugin; + + &installPlugin; + - &managePlugins; + &managePlugins; &report.failed; &report.unavailable; - - - + &checkForUpdates; + + + diff --git a/toolkit/themes/linux/mozapps/jar.mn b/toolkit/themes/linux/mozapps/jar.mn index 63545741e5f1..2b7951076727 100644 --- a/toolkit/themes/linux/mozapps/jar.mn +++ b/toolkit/themes/linux/mozapps/jar.mn @@ -32,7 +32,6 @@ toolkit.jar: + skin/classic/mozapps/plugins/notifyPluginCrashed.png (plugins/pluginGeneric-16.png) + skin/classic/mozapps/plugins/notifyPluginGeneric.png (plugins/pluginGeneric-16.png) + skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png) -+ skin/classic/mozapps/plugins/pluginDisabled.png (plugins/pluginDisabled.png) + skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png) + skin/classic/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16.png) + skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png) diff --git a/toolkit/themes/linux/mozapps/plugins/pluginDisabled-16.png b/toolkit/themes/linux/mozapps/plugins/pluginDisabled-16.png deleted file mode 100644 index a32fb0c0ff51e89e1e12f2489cf62fea6594a702..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 795 zcmV+$1LXXPP)N0$gZ>c!000+sMObt} zb#!QNasW(WaBm<(VQgV-VQyq{Woh4$8Y%z)02p*dSad^jWnpw_Z*Cw|X>DZyGB7YW zEio}IFf_X303`qb0x(HLK~y-6m62Od6Hyd}zcXjT89+*GN-qvjGzfBOVq(H28pB0` z#2>;>@Wn@8{0aOJMMS`u5DA8)fEr^Wf-)&6LefGztT@nwatU3-My<*#jZOoH54D z4BRA{NCEJAb%k=-M=6K9x5oiEILxvAK8p~-GsetLP0TzMi_7!-qr-RHy}ey>-#v7o zknXKT*gR$Zl<-wMHq$$nXf; z+glu;oB%K|Fi5(ilVrlJ30T#Kls1>6Q8JkfN+|#~H?y1-izub&>%GC%bQjW+^&Lnl z5yB#wND=({&DZ^JXk$=H5pRogy}K771VV`V0=Bekq+c%ATmV!m6$~b{JrqGoo7}+x zzVD+N6m79MszIT(X6MW2&;c(9*wW_s_$Nn4KM+C?iA3n>?jaIsMF>GYpU2C2;Rw=_ zUg0$FMx!yJ(HOlw{TBvChGLQn##002ovPDHLkV1n7sPu2hc diff --git a/toolkit/themes/linux/mozapps/plugins/pluginDisabled.png b/toolkit/themes/linux/mozapps/plugins/pluginDisabled.png deleted file mode 100644 index 631d4f536688838c892a23c6476eb6c19caf4a71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1664 zcmV-`27md9P)N0$gZ>c!000+sMObt} zb#!QNasW(WaBm<(VQgV-VQyq{Woh4$8Y%z)02p*dSad^jWnpw_Z*Cw|X>DZyGB7YW zEio}IFf_X303`qb1(iueK~z|U&6iDY8^;;Pe>3~SB`JzZB-yeoSy3EYvD3gp+#qP+ z2Cf4eh{e@weztUPC zi=rqmrCf<3{Z-qHK6>ZJ@00(8Da_&SOr9Yv820$=~@(Mq^@{p$UW-r|if9+b+Dl~PJ;t+i50H@6%5 zFE{_R{pIz`AM6)H>{f&e*RH-VCBFrcJv1@N+_4h~DG34}ujS!xR=9WXpRofW5JK?g z8)wL7^MqlWmfxbWUFX5_J!)Gu3~6jdI{NvAw=aI)A8P=>!ooscT2blDn`d+NdX0@r ziK)X!aGWg7W}RB2M%As*tT*_<$$4_QEO-8~#PiRMa$tOdpzYIW*4f;0sZ=YBj*Kxr zHqO_7z157`^5BIF7n=LlfHd`o(^E61l!A?oGWABCZ@&GCAPBHb3)3=jG7d9GW(mW9 zMk8c$Vv^OhRUWP^69hg%JHRw8EX%?VT4XW~6BCoh`lCl50-x*$Kp^y`>BC3t+uwi3 z@Nkj&Q>QUa6DcH0h4_Kb!`MULU%pSVIKsRSjQkitmpjjm525kjDp z+K&NACkOrct~a(ger%3LqfXVW_Sl{I(Oa~950W&d#oAXl0=YYY&f;D*&>2hRb-b3B z(%z8=%lDX?no2gX<5ct&tPlbfb^*vlS?&bTp{qX?I*M3bSw#woZP_>(2ivl-EgRQ$ zaox=>?LG7-b77<@5F&nPbZVdrAkCc|$lco78leg?3H*s zme=aBHTpNxt$`STh`F-50Aw%fWGt7;Y*^&m%F*+Cwf|RtL4#b*0HP%=gyu_@(ntQsMWT1?WTS8mH`4Y zHp5g(sdhUw3WXwQ(sQii36YLyHXE^a(kC1z3kaIcdg3MyY8Ynvzl%esz?F&=@c|GW zO;swDKfCrK3G4xN zz!%A@wM+sVJpHewC;_3g)=~OeF8Z7FQx=^B-u1)ee<{!WEzc(Qk1+GUZC0WLa)Apj9zIOnEF|aEO6lCrdG`EX~dN4VS1R6!OuC2UN;O ztw0q4XIXsRZO1a+vZY=$|q?Vc5ezVSq|H5k}S- z_$+k35|s>>s3VjmffLZ^gx-eGJb3mQjzC)gUkU%j41|$YKqL~QUx`YFyyh*-`bN{V zY?$m=&-#kWvTgezbL7c4_u*ZK4r+ir%E>Wl1%hMQ^RN2R< z0S0EG*$s%2Os*PItrEEe21IBXVn|6%3u{2JSlr&(*?G9WzW)2@=;-5IE@zLAkKgL* z>Uyiay*(R^M$;h;c&>(0VNnw4yp1{W4*{da-rU^W>KbW7N|9WX@=_y9! z7#Z}GggSv!{Npr7oQL!J)#p}u%1h{h4~N}pX=%BO(LF{dO;WSCmFc2fX=Ql1P$+!G z9J}4e5_-SZ67oD6ySuyJqlPJ<)2gWb8D2ssTk)R2KNYl`Cl48cXCRaTGcz+kk!Yi_ z+4~jPV%TK(8Q8?P@_*>%JVnT8i~-Zr(@#jKG<@)i{9{2zV+>%4DMEzmK6rJZi&eg% zoY-woeBjlgGMP+lZEY4?nc=)4iHrom#91-8q*<&C_@&%_c zI1lIbtFNvzz`^#YudJ@Fe$w6DeO+4jHld@DD#~eBR#radyngl7eFiw<@pyW1aq;fd z)YKi6C2^c9QSfg`7Wd!gw24IGb`V`&YN4?(yN#2RlV7&Cw;ye6Z2UPgGQulVWnyCD zwa(7Y*VE~ACYemW6LM4kS*`uR{U$$^_?#MGxSYA$m*jHBk@En(P-y1%TuEU_AI(cJ z112>>BZs9tL=_JY54QsBk}d@3Talhpzi_ljE*laguB#1P=c10v<7V^O2QBtl^Eh5quPkt z2qOPUOo#S^G)#zoZH0`Y=BUkd%AC$cnTt%qpS{2E4vyzhpU<6w7kKa*=RKca@8|h` zKi}{3JiBFaaq)l6hJf{Exz8pN0yYB^*doA0d-yTNTE-H6n2Z5Jff?Ke!a*dl_z+3L z!8Y25(m!O4V{H-%pu<)siw5z)4(B#&R2nVD%;e)JC`tB%E*LL>q<12fepA<$`X9Gn90f{(#Da2bq& zYv4;Be;(8+KftpG)+UyjwHba)Od1ay2=cO@Nh_2e{Uga*#M%Z-lCHBAL{Ygbz@%9m z&v6QV&k8V>i?vu-o2D!2yG}Sr06TyiL5_iX@G5u)DIlzk`N13<*oCI%!GoXiO?<>&4<5i#xeudy}uv5YB zg#pI$f*jTqr|n9*t}{0`_YEB9f)RW^*LNj-*ZB+l8Kg|PlNUIqbm6 zg(OghM@L8BX=!PBuB@!=(YUy{qV)9i;;O2u$D5m*Yt%7ivzi>LM%Id&Q9J*MkPG&ZT>e(5Y+(Bae69zQOV!9)BeepO!7eWEVlc5T;0!+l z-y*P=9V3&MdOLA|yO`Vq3ahKDpH{y9=2JC-WUT;;kAUB#%+JqXEGa2@41Nc|ZWfu! zGju!KUMxxA1aweHzVcNu{K@Gfz_OfxUxkd+)zzspzn?2_I!N-_Nm{w0NBC@^Efkf) zv7D!3aDykxD-m!*!rU1DTdh_bMOfG|!hqR#b4L;R0|Nsm zqqyZa;OyYkw*gAK&x3_yK%nHIOAdG@ycqOt`EEQ9dTOwf0 z2(-h~oQw_@A4>sg8rzY{$;lI?rKL_DkKz@$l|w6@F+3`!B)3GsH6vPETaR$uC-LmY zaO`I+WskG_LtkItvteOj$rKyGD-y%J*==oYhb6fs0!EC$89m63lR)2ScAlLp`QZ-h zgQljYeH0PND`HczR7^>3iGZs{V1n*v*Rg^KpZkX#f&Uc@t2&B~;z@9*n3CKQ0YgS$ z(&cmV#(;1ZBK7}eVq)SYUWF*mgY6KIC&?`laM=i~q9s}Z694Jx=`;29^$)=APOX6Q z^70}{Zi#@Ojp*p;c#7R4RzHOF_E>Gtb#`{vm`tWTZZi_KLkKPRNl9*rfQv?;kp~`oJH?4+iA-(+v()S#>N8W>u)}ZfG_+76R-#4_-H{vLAKEijo0gS zDO=?eNG`nq{VnBZfr6qw!o9!?U0q!dS5{W;vDs`6yWO6Sg>QFvclV+3@$qBIW;HqV zx0L#u`kr7$e^al2tkNCKXdkQS9&AlbO`U?_C&376dtLirOZRAz3O(RHPz(;Pz(eFg z+TIVmTzwDt!r#2KDW(toSIkk&THL^?eYB{1xJv^EjkCcnAvp^AWDytP-#A7)XV-M6=IbrFzDiZZY+$PtLF2@33~ELb3xsTflciAMyhw93jKRw{>- z@kl63@qk=Pv^av`9)OENgc4a?7EDUyz7|;azTTUe?k~$M?D39yGw&52e{}N)zv=n) z_w~GLy78ZIW8?S@=C8TIeC`0?gGo3^8LjwPI(PvfAlpQvI7vsK9y%fMNQHcutc+zh zV$$~Ax&9D`ME(LjDq52Td=EMl1 zhC~z1W@9~Uf}lG=g~{|wTEa3Ip$(ryC%ad|cVgxZmqJce^^|xTZ z3qdpaN-dX5gxEn~GQGik4fZ(~R9GxuV1DM1FPUs)tEwuT3es?yuSk;$f#VRUv(8Fd z1G)o28b0fNfJ^3rFVSRyE%XNHu?3ZR^*>+{ljwp^C>d31FK!LQ7L>_<>l>p=1b0DT zu+CHFZ=fZHpe*H2-tk<5>*!T)u?2Ag&M?XfU6J3xk304AnEvc#r!rPClX8$bV5eWXNm? z!0&n4m%|C;!Xt3<<#<+sAEHH$`j@1*^#Ca3%~e-JPBeV+2y>kpw;li_?iYV89uZBD zM|&wHn-e4uoKmv2m%tMd;N`D)a#%uqg*-X@74SyXlVZNBWI;lFBqhsyw>TxDAY7h2 zDs*-w23e4qNG@I>c@+LC;=@;X#)k6^W-y7a6ph7|k@)5x*~qYgqGXZ*x>3YNnlDEZ zG~G8Zd}-EM$(Z>!`MPz-FM*&+-&~jup)t!_8oo4}xH9`G?UpvfMPhO3ErD5~q{0%M z%fk2q?@yh_ech6Q<6si+D=Y~Wq-o1N5gZ6)6SV0C<#&@QoW2BtM{3JK8v@e!ib!8B zLS;hIw1?+E(!opij%^p9UMrf%=iR-cpK*PJ|y0$V}9Mo`tIij2jdQ9k+5 zhO_4~xdTgzl@;_JFd`@NorC3_JW?SHT1{HWRozxG{ zFLbS6mrVXo&QW;L8FebUP2+I=z3q?&z$mc z^px^ZW7emTvXwst%r!r4RPnS~0mZbNVurE+fDynC7!gGIV^?g2#dlBW zEj9yX#DB>MCR+OLL<0B0Zl3p4{*P^n4GHosLDS;m<86}{j2UNBY)Eptl|jl#B#1Av z$1N@!o*t#xkdzVDOy9=h#AEif@|79GqZAwKCHK84#>wZYQ)iZ?q(vz<1RT{TXc&X| zgHN3O;7^#0@MUAYWUC#H6hB{`xTNIg-8@3EA+cMpwsb2bz)!ucXxiOD7OB{XaxFnD z0|^odmOj6<;EvAFJVIirR-28G7~enl>AUW2G>}4PIK%3sC&*e%7ba#xBF zlEtMP$|oC&+aMXq1Ot%WlsLWh_{SA3oI-}*W3}ChY zWnu^)f_;Ko2@|5rw(4!Wzx8=SJ_dxc!)lud65}`SSY7*>UnLC9pH{2WmLQ+b)@?p^ zG+hbfLx&|uT#$*lKeA^-jYK7UFG=>2t@d0Z6JQ+qXxrLkL*ro<2<3UJa~=}lcbu;L zdXGnN7H%1#0e};jXXO;4xYmfK??0yWM6_XMTS8+D&cARMtI)X`!f z_xwvcKT>-9T2zOGRA+Ve!-6>Ybh>UoGt!ml4iWZSB?k3^-15!(-5Y8MxhkXQh9Ic7 zy59)bdi47BpRP;MHEttT5PWmBWxJ(oe*3A4ufOyP&TROS*zP_-oxwVRF6d21Ki+bo zHN_+B@B;Ni(Aih!X03F=r>3tqzuJB-GemxP0oV4O{itq+!{CB%cI@A`wY%LaESo?$ z+)K6ufv7Q=L%M9K-16oBd|s22y;GB!pY_YC6zG(HvHH*TpZm3#yOsh))%8Ap;&=k+ z)WJ=sj$JLR7<`GiZD3D&kJ0Mn5$2)KH+)Wt^~H*XH(Fs&KVX;HLXHaSgNncTOwP%{ zfrb{Sxeib_QM<#!IFpxn2 zTLYIPr3GH2w^aOlZ*O5qPUr-Wfy?m85YR^bq8-1X>W#x+_%+E09P#ywuyHU)T_dkR zR6dE52REMXEi4I+_<-_?x&~mdAYFee7-4jbMVKwxJFnv09%=M zZ>R)`23i~Bgf5Q3wAaw9*9j*E_%9|GhZc}Ti2%%6lAY`6uA<*vC%oU!x^FeRH>`lJ z@xcXOGP!H#lK^3Yz@xtI8_5Y03KKie7%LzcE(pB*9q(u*LB7DiN%L_CgbON6F*hm0 zF+o0|IL8-Ob@dBcJM{R=tI1iM64BG$9DEKM0U`(j$Wh<+`dI>eiGfDr3Aj7}7(D*@ zBh2+YGZ96EW(!|heKy+ppvK?}-Hm3PPoS%MdI^@E$Z^?tI&eu~0@-uPc-qnvF{;n< zN6jXQ@#{C6_@kDdD1rbQg3ooFHWu3ebKF=4=k4&- z$M_O)M#jaLOq}6Ms*epNhNGIz7416$ibR*Gue5JBS3onwiYD=R_cq-%Ust-fipQZT z7QVVcE0^1aLg;ekQRH^5ygF=pac$INz+M-}fCEvF0iTErn5C}Ja-CTs5KM0{q8tN` zJpQ>Q^gQ#ULq0Lth^ux~L?T5?#{K#e?d!VQ1B!`cyXpj#uJ-nI`V*EO=dss#r0dN< zo53W;kk0~bU2htXSb7}Cj!&UTt`VJr5yr?ICOYLBD2k}Z%AiS+#a+5HiGQK2Y2Ef z%1GrF%s?*y1*lbA6ldtaU~OpF#|bBwS*Bnf8^wmPtZSELn&ky~it6ED?8_{%$3H(y z-a}JiG~J9DeV19N6)(X_JixxFj(wTseYml4@&@zQ-eCU!0bHhMhsK@mBme*a07*qo IM6N<$f+`%ga{vGU diff --git a/toolkit/themes/osx/mozapps/plugins/contentPluginClose.png b/toolkit/themes/osx/mozapps/plugins/contentPluginClose.png deleted file mode 100644 index 7a1607ebc641e6ca149fc855d73810af1cce5192..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1106 zcmV-Y1g-mtP)>u4HuOW@ZJs7pt3|BG#2^E0e6&EWB9I=)&j&j54~(Fv`d- z5`qksGR!s66AMf)tFLMUTdG4Mc{QvMiFyb3D zzWc+de+Iu%P!MnDmYFPB0AP@aMR0<*Xx9Z#6{An^kilp;gcAId z`R36IAa(<;wWToEB8}NFB3b=2eg}S1P%ySR^G(A4zF5|OSFgd}j^)K@kGxaf;w0&U zv1YI$0r85CpW(SqhMw!@Eb``w^+4hqbo^|$XlLHyG}|UQ_lgbL!;f_Qj9kIWyvZ(D zlH^_LLqPJ~`7V=+UVCX#Deo{C1$R-Yqm<8?lwZd4_#XQ)BZ+@@K~Gz=t$n8RTwBiq z&o;>J=J}5=5}i7}vvp~!uF&zFt(|l7Nd>yP7fR7>vw%{hoI*#*bv(DDWar~hDS=R53N>SG5)G7N@7JkPG5S0g0?oFG>btQdF>Yg^qWvNGSp&(+k-9<-n1_!-I!^ zJYKIcPfrCt^VB~l2K8>>$le{B`?j9^G?`t)Q`5|oeznd#Hu?F_dbjoD=DyzYy3v=C zdEKguNc2dU7Tu+~!tKputwAHnN3IB)7VZ$SqtQd_E&`~fgX=FPh3Nwcg+L1G@n+`-b z9ok_ThRmEH`_#oKyfxgd_230vhpSmA=t^ zzv+tANd-WNhHyrE8b9urFPAT6720`N@<6~zP!xwr{OKUB)`w2jYosXI2E<3vA2XvK z2hmvNyX5Wv4U&rKn1~rM;gIn)F%YR(jr-pxZ(ogc1+m@|8N06so}NCI0oC@<#?;G-)~fxANwRjZAgNgGr?q7Th#gt! z?O1NMnYY2DYvHdLz_k?q%KQ$jG}`5CSae1Gf`ho4!p;UiI+uI79kXC!OpM4~$1bJt YAGuvoa)c@+C;$Ke07*qoM6N<$f^E$p!TP)BNVg?O!Z1+KWlY^+RuObH(qv`DENzvf zBwH7EW_0F#>Ad0G;qLQ2XWo0`Is+c~FmK+w_uPB#`Fii=RaNEA=#1xjJ*lgVok5F+y|7zj?8Dhy=inM*P+HJ$(*GnfmIfxkpIFiUg*2@nB<@t0@# zIpxKnFmXx1fi3_pNs@F|wLn^XtsnMxBa*=@!$@E=6B4mQrYMSc;CBx2Jm3Xns6Agq z#?JvZ0S^F6(Eh&Gk5M_7Bwn(S1_ToUsLI_ogM%CUi;O8c0ng!}|DhvEh#+7eRem1ZZv*}U{EOeH06a4Z zC%g`@pNx}_MI~Yob?9K{5dmx?GVK*)8pJ-kfXCSO5c^5^jcULNuS1MPboFCViRf)! zmgQkV5MFYU9g|sKvAh&Txd)E@Hj@t&HsWY2e*rrDnbM^L&*#C<6F^8aD`F6JQoTHN zqe(@5j1_>OCQ@C13?`HFL|3c0(m((gTZRx_QWMfZfTwCGvx?9XHa9oDv$L~(3AR_p z#>T$c+1c^i8B1UC6O(E%VcOc-8qLkky{*OM`T6;9RaMpXgwt{3kwUk%-T*(O?~C@c&0GJ26uON|8}4OQvnnU zP-|*xIu;ifU&d@2sHmv;3I5;IZ%U@8r*G8P*WX2957yS!E*BRUzh`kgCD|H?u1INV zY1i`dvIpyxV0n4DcWG&<7r)ChGc#Y**4Fy4TnMkPufJ1RSa`*u55ye7h4qG3lV5^N z?6+x-%F4=0Z%IkXZMrz{|II)k5UQ-Kqz=n(Y;3gU<>g&-kcnT%LN8h`842KX;8V)# z>S_;|#t;^BD!Wh+tvYgYa;`aXS`gqeD}YlUIAWhgMMdw!DmP=T@&s`J&fW%-zv_^` zlE{`)ahPb7AP}=Dk1kv&6xvS$Z!Qr59y#DAd%fPzo12^O=|2<{6bw&JPClxutNSR~ zY5B+`Y$7}`FmMAV|A5*&M4Pw3kv+IjJcQ9-$H&LNb}&Xln|jFx!hL;xz3uJozoFy0 zVB&A&=jVS24*dya=vPq)rLnPbd1Pedmd$ablMo>MEl_7?=kN3|3$pPmF!3(B35W9H z1IWUasF_GhOUugO;NW*BC4d!mMtXXBzVGhten^?m&COMnm6cu9wNoLHbxll6yhsL&xaoXbCObA)#eD)qqhV`_gJ8@cDeh zgb*2=^xZ_l?9kBAkJ;JT7om=7vXRI>j+co)OYu$pr>p?P#0S!bh{2h=k|uLk^_iHx zP)KEZswN`3mytBkK!g=SU=B;8Noj9y?|u?0#uEX~EzF)$A30iNE*moOy~rhYDR)wK zF4LVJmgbN3M~nJK93I>4Glxj0ZS(Z5jGki0j@k)hLJ_9JA$R;m+-W$i{?adILRPO; zpLwX{%&%QlUN=Fjm(kB!n79|;XLLpu>3;zR0Lk~Ev`8Pt9{>OV07*qoM6N<$f>dmM A{{R30 diff --git a/toolkit/themes/osx/mozapps/plugins/pluginDisabled-16.png b/toolkit/themes/osx/mozapps/plugins/pluginDisabled-16.png deleted file mode 100644 index 68cfae5eeea4380998cda73b8dd2d07c1c5811d8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 844 zcmV-S1GD^zP)f(V?Z#7 zX@jWkLJj%@`bg-en?8R*_f2d14{X%9wkD>UG_gsOx@uFy!v27Eqd^xa6+w^!!hiw; z&V!yyXws10%$Ix5+;hHj?s;(d|1!+a&-){h$Q%=*(df^Wm6Z$~X4sYO zl}hDMr`KDVpejnuZnxj2W2Jkq5U$zIbxG{0RBDswd4Idz<`h-c?d`>;R8_&XEQ5?O zJ{H_3O|`AHNxfZNUS58&y1JTVp3U#p)}GoOt~aWt4NJ|YuU4yh2L=XUGV!qVTi|rq z!Eu~dmKC4WYWc{?4WrR0Zf}47!MuCpM~U3&X$tAHGc=n`ghFGOn+-#juc2ug36uylJ127U{I+ac`+dfuLu_9(<3YC@Z zER%uFW~0Ozp|z=G^a+9h|HuduiDT#udbBCArBaDC)-@w&9UsMGjYb_Jz0c?KQY9p4 zs!WP-~&p~~H!$S&*Y*`=R=qO&L&dZL4LN^7$?YO$EQUv-=`9i@U za=9Gx`8=kkry)tw$=ij6rS0svT z*RLNsckbL}hr`jOD2h%V=yXaf7W3b_b?diRu3UMDTUq)aT>5L*t{qDzlS(|1c%tz$ zyyvB7%xaqxm{B!-+5MvWz2l3~u_3Q_2US#5Y+Jawxk;;Q>$GQg=OKIzse9|od~k4^ zusp1we%}^=0cO8<@7|?`hK92SgTbLaC=?2@m6b@q<#N3^^kBHXSS*myXrz2TFJ?BG zNvGG7&1U5Q#(loA_gdT9x~gndT}7p+L#g0M2ZR#-o}Qjm6cTOaFCAn|_Q3-O4!l}vwY|0yS*pfp*+OQsNuJNl%=|9k_y6&YH-7m! z2jC5d=N8QtGfmIT(8R=KX;C&O5HoaWIjTm6yE{9mp`l)$Gop_}Y%-a+CF%2#FDR4A zP&&<)md{qJm1=5SJ_iS&n_pN6Bg$refg$p^-2$tk z6w4S$w6M5HQ`6HDtPz_iQr9A!>ZR6+WRhGiCo!6A9*Gvz_zgwqevv8c0x{!Gpe%N!410*l(Us3$kGPr z?OXe7ZN=-7?3)9~&d<+{dTML;#N#o7nxQteluV@sGR~G!u^=NW+Ko{uL0(ju4O73f zaS6EI1_+h4(jwp4aj{UOsi{fushZp#4+Vn3QTELN{%f*BR1wkuc`>-0{%ynB|R@tCE#mpY@&tvd1T}v1DG#a zNFd-ycuoSX_0)(%m(wB68EPp_vD6g;eW}(oGBQHDIy$JXzFyEMz#jR0>@&won7=zX zFu@P_%An0!TU&`I?ZVu=Y{uLee)t)UkB6iUQ>hf{8AcWXQ9yo&*C%nme_(+A^5KUl z+lm0h&bdPl9Xu#v#h>~8n>TMxuy4IOnbN3hSnFpbA(Feg8lmOoWeNoR;(+y^w7$o` zOg5uxygIZXzw2vjltv)Ew?Cm^AV9%jfV#T6q)Rw+et$J0EtuvddUY)3vSBb^d2F;z0k_p;Q1$}tM^Jh+PtwpCqKl%@alnshfaZ%mNTcn#b>@uU*A9bu3o+R zr%*6B#+?XTXQnG(weiyiQ1&wOqY~zUH6wtpU3le{*KnMscdotteqUeT5bm?aM_A{T zZRfeC2;dnm)()E*$PV@1vg$agvHQRMZTKwfm>*_MNmXf8=>P5dmjD9*Q8l<3ZBX$> P00000NkvXXu0mjfLvB7v diff --git a/toolkit/themes/osx/mozapps/plugins/pluginProblem.css b/toolkit/themes/osx/mozapps/plugins/pluginProblem.css deleted file mode 100644 index 0db6b86119bc..000000000000 --- a/toolkit/themes/osx/mozapps/plugins/pluginProblem.css +++ /dev/null @@ -1,221 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -@namespace html url(http://www.w3.org/1999/xhtml); - -/* These styles affect only the bound element, not other page content. */ - -.mainBox { - font: message-box; - font-size: 12px; - text-align: center; - background-image: -moz-repeating-linear-gradient(-45deg, - rgba(65, 65, 65, 0.8), - rgba(65, 65, 65, 0.8) 20px, - rgba(69, 69, 69, 0.8) 20px, - rgba(69, 69, 69, 0.8) 40px); - color: white; - text-shadow: rgba(0,0,0,0.8) 0 0 3.5px; - border-radius: 12px; - /* recessed effect with dark inner shadow and lightened bottom */ - box-shadow: inset 0 1px 3.5px rgba(0,0,0,0.8), - 0 1px 0 rgba(255,255,255,0.2); - -moz-user-select: none; - position: relative; -} - -.hoverBox { - padding: 5px; -} - -html|a { - color: white; -} - -.icon { - display: inline-block; - width: 48px; - height: 48px; - background-position: center; - background-repeat: no-repeat; - border: none; - background-color: transparent; -} -:-moz-type-unsupported .icon { - background-image: url(chrome://mozapps/skin/plugins/contentPluginMissing.png); -} -:-moz-type-unsupported .icon[installable] { - background-image: url(chrome://mozapps/skin/plugins/contentPluginDownload.png); -} -:-moz-handler-vulnerable-updatable .icon, -:-moz-handler-vulnerable-no-update .icon { - background-image: url(chrome://mozapps/skin/plugins/contentPluginClickToPlay.png); -} - -:-moz-handler-clicktoplay .icon { - background-image: url(chrome://mozapps/skin/plugins/contentPluginClickToPlayPlain.png); - background-position: 0 0; -} -:-moz-handler-clicktoplay .hoverBox:hover .icon { - background-position: -48px 0; -} -:-moz-handler-clicktoplay .hoverBox:hover:active .icon { - background-position: -96px 0; -} - -:-moz-handler-disabled .icon { - background-image: url(chrome://mozapps/skin/plugins/contentPluginDisabled.png); -} -:-moz-handler-blocked .icon { - background-image: url(chrome://mozapps/skin/plugins/contentPluginBlocked.png); -} -:-moz-handler-crashed .icon { - background-image: url(chrome://mozapps/skin/plugins/contentPluginCrashed.png); -} - -.throbber { - padding-left: 16px; /* width of the background image */ - background: url(chrome://global/skin/icons/loading_16.png) no-repeat; - margin-left: 5px; -} - -.msg { - cursor: default; - width: 100%; -} - -:-moz-handler-clicktoplay .mainBox, -:-moz-handler-clicktoplay .icon, -:-moz-handler-clicktoplay .msgClickToPlay, -:-moz-handler-vulnerable-updatable .msgClickToPlay, -:-moz-handler-vulnerable-no-update .msgClickToPlay { - cursor: pointer; -} - -:-moz-handler-clicktoplay .msgTapToPlay { - display: none; -} - -.submitStatus div { - min-height: 19px; /* height of biggest line (with throbber) */ -} - -.submitComment { - width: 340px; - height: 70px; - padding: 5px; - border: none; - border-radius: 5px; - resize: none; - font-family: inherit; - font-size: inherit; -} - -.submitURLOptInBox { - text-align: start; -} - -.submitURLOptIn { - margin-left: -1px; -} - -.mainBox[chromedir="rtl"] .submitURLOptIn { - margin-left: 0; - margin-right: -1px; -} - -.submitButtonBox { - margin-top: 7px; -} - -.submitButton { - float: right; -} - -.mainBox[chromedir="rtl"] .submitButton { - float: left; -} - -.helpIcon { - display: inline-block; - min-width: 16px; - min-height: 16px; - background: url(chrome://mozapps/skin/plugins/pluginHelp-16.png) no-repeat; - cursor: pointer; - float: left; -} - -.mainBox[chromedir="rtl"] .helpIcon { - float: right; -} - -.closeIcon { - display: block; - position: absolute; - width: 16px; - height: 16px; - top: 4px; - right: 4px; - border: none; - background-color: transparent; - background-image: url("chrome://global/skin/icons/close.png"); - background-repeat: no-repeat; -} - -.mainBox[chromedir="rtl"] .closeIcon { - right: auto; - left: 4px; -} - -.closeIcon:hover { - background-position: -16px 0; -} - -.closeIcon:hover:active { - background-position: -32px 0; -} - -@media (min-resolution: 2dppx) { - .closeIcon { - background-image: url("chrome://global/skin/icons/close@2x.png"); - background-size: auto 16px; - } -} - -:-moz-handler-clicktoplay .mainBox { - background-image: none; - background-color: hsla(0,0%,100%,.2); - border: 1px dashed hsla(0,0%,50%,0.5); - border-radius: 2.5px; - color: hsl(0,0%,50%); - text-shadow: none; - box-shadow: none; - transition: background-color 150ms ease; -} - -:-moz-handler-clicktoplay .mainBox:hover { - background-color: hsla(0,0%,90%,.7); -} -:-moz-handler-clicktoplay .mainBox:hover:active { - background-color: hsla(0,0%,90%,.8); -} - -:-moz-handler-clicktoplay .mainBox, -:-moz-handler-clicktoplay html|a { - color: hsl(0,0%,35%); -} - -:-moz-handler-clicktoplay .hoverBox:hover, -:-moz-handler-clicktoplay .hoverBox:hover html|a { - color: hsl(0,0%,20%); -} - -:-moz-handler-clicktoplay .hoverBox:hover:active, -:-moz-handler-clicktoplay .hoverBox:hover:active html|a { - color: hsl(0,0%,10%); -} - -:-moz-handler-clicktoplay .closeIcon { - background-image: url("chrome://mozapps/skin/plugins/contentPluginClose.png"); -} diff --git a/toolkit/themes/shared/plugins/contentPluginActivate.png b/toolkit/themes/shared/plugins/contentPluginActivate.png new file mode 100644 index 0000000000000000000000000000000000000000..31351dc3b7ef57cee15989759c9556e8a2f6dd79 GIT binary patch literal 3043 zcmV<93mo)`P)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+6gxa1B6k+CnA%mOSC4s5&6UzVlpv@SV$}* z))J2sFA#f(L&P^E5{W}HC%KRUNwK6<(h|}}(r!{C=`5+6G)NjFlgZj-YqAG9lq?`C z$c5yc>d>VnA`E_*3F2Qp##d8RZb=H01_mm@+|Cqnc9PsG(F5HIG_C zt)aG3uTh7n6Et<2In9F>NlT@zqLtGcXcuVrX|L#Xx)I%#9!{6gSJKPrN9dR61N3(c z4Tcqi$B1Vr8Jidf7-t!G7_XR2rWwr)$3XQ?}=hpK0&Z&W{| zep&sA23f;Q!%st`QJ}G3cbou<7-yIK2z4nfCCCtN2-XOGSWo##{8Q{ATurxr~;I`ytDs%xbip}RzP zziy}Qn4Z2~fSycmr`~zJ=lUFdFa1>gZThG6M+{g7vkW8#+YHVaJjFF}Z#*3@$J_By zLtVo_L#1JrVVB{Ak-5=4qt!-@Mh}c>#$4kh<88)m#-k<%CLtzEP3leVno>={htGUuD;o7bD)w_sX$S}eAxwzy?UvgBH(S?;#HZiQMoS*2K2 zT3xe7t(~nU*1N5{rxB;QPLocnp4Ml>u<^FZwyC!nu;thW+pe~4wtZn|Vi#w(#jeBd zlf9FDx_yoPJqHbk*$%56S{;6Kv~mM9!g3B(KJ}#RZ#@)!hR|78Dq|Iq-afF%KE1Brn_fm;Im z_u$xr8UFki1L{Ox>G0o)(&RAZ;=|I=wN2l97;cLaHH6leTB-XXa*h%dBOEvi`+x zi?=Txl?TadvyiL>SuF~-LZ;|cS}4~l2eM~nS7yJ>iOM;atDY;(?aZ^v+mJV$@1Ote z62cPUlD4IWOIIx&SmwQ~YB{nzae3Pc;}r!fhE@iwJh+OsDs9zItL;~pu715HdQEGA zUct(O!LkCy1<%NCg+}G`0PgpNm-?d@-hMgNe6^V+j6x$b<6@S<$+<4_1hi}Ti zncS4LsjI}fWY1>OX6feMEuLErma3QLmkw?X+1j)X-&VBk_4Y;EFPF_I+q;9dL%E~B zJh;4Nr^(LEJ3myURP{Rblsw%57T)g973R8o)DE9*xN#~;4_o$q%o z4K@u`jhx2fBXC4{U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0 z_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5!7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ? z-G|jbTmIbG@7#ZCz;~eY(cDM(28Dyq{*m>M4?_iynUBkc4TkHUI6gT!;y-fz>HMcd z&t%Ugo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P` z?ZJ24cOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi{{a60 z|De66lK=n!32;bRa{vGf6951U69E94oEQKA00(qQO+^RY2MZ4x9H=E9=>Px$6-h)v zRA}Dq+PzA|KorICUyNG$h4?gLW8s7Na6W~iU~6k@Wg%NwD1N)i*vx{6U=}pVxc9;| zVYoB@oO31&q)I6%xt0`O0T2KI5C8!X00A&$Eq9o6ggw-G{%ow|XYhLZLupV9_nqlnl^zxkyBa|2P9p00h7SpF*khD`g4=LV-Ai%Kj3c lU~Q!Pz4-c|ioaC`t`8f-ab10-#Ww%|002ovPDHLkV1k>Tu+{(o literal 0 HcmV?d00001 diff --git a/toolkit/themes/shared/plugins/contentPluginBlocked.png b/toolkit/themes/shared/plugins/contentPluginBlocked.png new file mode 100644 index 0000000000000000000000000000000000000000..1e092bf189c77dbc943c31707d00bdae283d1495 GIT binary patch literal 1514 zcmV0pxf>%cIR&OR60>&7P@dAw(r~@6u#1N6e#$XQC z)4CH|ncE6mJIB@ou)$!%vAGp61X0F8yus&Z`s$OV3T5rraq&yO^nKp{;cNSK{W|N$ zjT?6~{~TPq{^v}YC#(=Y6>5cUVMrJUj(Lo=^vp}_nW5*53(OH-6KaGB;Y^mWXAc@^ z*;(K&VYQGTNRCLNiFUpVEE9T!)HEih&i&Fg*&GZEe)vwH?}a6y=o5}e_X4XAIOZ|d zm|>PZ8FYH^$VUN(uwlC4m8r`|Myo6Q(dQoS?3!yOdfZn0kkIe8VzFuP7;DTh%O3Wk zk)a4)j$9R3Ahc+Mt5>fLjeJw)>w3WI?@b4eX9;`Qiw0U~qOAzwJ<|dUg{T(3FnF~2 z;8V`-AH}?nvpYl3KnqRLZo)%>_hYwP;31(`iH)E9dZVAG-<9r5U<%X)4iruN6DUStu}MAPbpPiItfOR0}`DaMgBSyEJF>Y=A6e zGWp0ly}&%-bb4`Y|FcEm4mVHV?0_s}A{!aWN@iVPg=zQuxpU!WdG~k9rr89U$Yyeq zSr_Ch%zrV#T?|#{2XcP8{K*L-Ml6fY97oIu;nMNA|J~F2HL>Jg;7WzL}>u;6I z*AMdAGc>!b#BZs|4%Y1eFFbVyGLcQqRp|m@v(UD5aY%+^`xSL^Mp&~GJaq;#kxk8n zb%8-)3>p?WBMgTW0k@T8%}(&t8OTI7HFH=O7&G|qxBBI`Heo0{p=1uBG5h`hhXA8=andZ!gLc;u4yYihEMbvw9tCe?9Zl zXW9`7(0Ud@ri*9KcBlf&r~ffGEc_&lc%CT=d$@c$X9r{<6WPd^&U%k706STPqm|{} z8hOgRvT-&*7BZ17O;x7v1Fx8Y%a^A5s_wJ;_izaMNXb>EtS4GkD@X8IJ{3`0&kctHATZh@of0dLKf&5w!`t@Dy*a&O)|Zy|q|sHpxB8 zq5W%00z2fBa2Miv1`oXO#9M{mnC;EoMpa^i-S z8NwR*bnK07-&$MobWwPV%SvpO>o%dv(*but`k2R9V}@Dwuon%Zr&yoMANe#(h4u`F zCoZH?ZG!=iC-mNGUrq6n(6&e1kuCGB7;wyEtTDqZdot*tU2Mk>-6cX4(;N{+6K%Wy z)!=2JQaCQ0%o6rgqG9j98f0dk@S^aMP%g9z{lYQen8#RShS^;Gv&S9HU#%qSZj(K{ QY5)KL07*qoM6N<$f)-2HA^-pY literal 0 HcmV?d00001 diff --git a/toolkit/themes/shared/plugins/contentPluginClose.png b/toolkit/themes/shared/plugins/contentPluginClose.png new file mode 100644 index 0000000000000000000000000000000000000000..61eb5582881dc34346107611c7921be6fcfe899a GIT binary patch literal 1370 zcmV-g1*Q6lP)|+(tjx zyYPg=v#^>Lz{#KybfS5~T}&cOP-SeXB|FoS+1#_zOX2mq-63wywcly zGT4;_=Gj(ziwecB{GlAfq$4u6YPH?ztLV1@?qmgK3CWNB>lJ{2l#Jbjh1)uh{l_{n zg9y^grF$x-^iYFE0hCPq94p>>7@?fMHJtyctq%|j)t{K3#P3y7H*G~0STxTBPp ztU0F)J6s*h{XW?l2`srZs*%z90Q2B$egNYhFK^NNZABM-?R93)$n6E4;|!y@AJt;P zRlpdtH|U8mNA7OyHrul!4?oRNO>A5NDg^TGBmp-5j#Zvd3^`nO=Rja_=cvLAbSIHV zg|{>Y_+ENRYpUN?EO|z6FYJn@G2yljFY*VhWWX4+H)x5`%qjMqNNAU=3O2}iXrp`q z6$a=L0SJH~+cN|U5EF(wpuhc$Y4V- zu|T-Y0Rd@dW?QA~j09ps4%hEXy%{7yl-VeRV7Z+Ho2E-0^^zxgOYO53U-spjVS<<= z;XVf38Ut`9nq)aA97>EhTzgE86hO#N;DO*jtEWOLv-vA+&T!zluBr?1A&0ADsoMt0 z=jJZ7t@1#cF4|X0p0S&AuPtuX`fMead~RZCRRR3yoG*xS5{(XfcDQe+d3!Q3?3mJI z&PakPOt>s?dbYE!Xiz9hB=CIan9>vXb;Jj?v`Y2GWjS;P-xU_uxQ9hDHhObGS5yzC z7yDCzw5EzWcVQ79!ikyIV!L8WrXu}2%__#t+m-mRZWvS|&#>Yo0qUm6nityR<7s0= zg+X9bi8Tf}>r9pFH_JgF(U^E^c}sje&Ep0bVBv*A_Uw*Y`H;N~?n?pix324_mn|w7F^C`_2t9g*_tY}iHU1V8XjjIi^VN$y;{wD4 zBJ`OmyyvUsKX?}&IgopCM~3GqRRS}E!BJa5?#FWOMH~PK6I6*`*Vf)0YYE*+0#Dmk zOr4c&{sli;bxcZ_X$OB02%PM{p#gKus|yOf_?(*T8YUf;@J{-*f3!}m-%9LO7gwi!aSgDq)Xmn}0XNJoRFw9Kn zPN9gUNds!^Edn##FXE+zx@aiSy21A`->0vWb7tn8IZV>UFHFw&zR&wS=bOu!Gd!`q zz5Q78?}M#Jf2B$`QB0gCoWwOEN-PVa;+Rv^yoH_=XQmt=gLs$dCRT{wHG-ZVp^=f! z09nKb#7!76h+9H4Yo`Mg5o5$}F|6EOyLWYPXt?*Y%4+-3(&NtO_80mrd!7jcJjOAs zp$4_+QP6>Q(M|-&B)*6pxW2J@+v)N+4!-iL$CQ(M$z;y$&oSqQ1tE?+jvCaW2fffx z2!dIeMg@3^xWor+Y(0!LwYE9(@(cQz>5vv=7-&EXnlT{;F+0@&dx%jk9G#vC>@R%L zXZp`{FhxSpf+lJE`7ALzUvGfj#1Bktxv{y`PTSuvjT=k|+L(b^Y%VJCsunxDS(~$1vuRvI|d~%u!vg5Vr7C5 zSgTU$g=V~&@Wkrvu>rD~=+c2hhxDTj;c50R>Q4m`md>n-L1&JoLC;PMb&OaU}$2(f@(#sWfMC{U|O);xeGx)gV? z{!e*;cDX>;>>Z-Xn+y=HsjKf$3!!EnJ?Mo-lK9|_X>{-aBXXhSSXs9WU_=Om%mW|1 zF`W?}V1ifz`<{QnO~n_rLWcZwwy~4*&{1I?HK^4y1Kya{Z607rl9#_%mpCxxun;Qd zQKMHM-k9Dj53neqB0POOdLVN?dOt^iIibgy!y0Pz>cbn;o8bY*dcF%26JP$3uSgRIL$X$>%s=erje5dxmbo1OJn@Bl~T!kyK%AsPx% zS3Dp{?NSfu}pG_l8*Sk=Tp58DbuyFCRSIi`4PV)7i7h9>z?i zFt4Qt#}kBb!xOy89^y$J0JKX{r^}5`N{@wy7T~=^w^c@D@kC?_X0Z!SjyyATO9ZbK7mn!xy`<63cG}6o?4KtlUCjJQqT4Fq z4PsVup|RN}1~}6RW`5JqWaD1oE!kU(^|FcXQAW>v{E1cHnbyBEn2FiU{Fhp9?gm+i z@efa(mLYm~63jUDQMnB>nfajBo4deFTxBBBhNc#)DM##t@#dY-#th72bK$|P_XiFO z@f|TE8IMF=bjuO@W`&R?~WD{=^S2Z0`Yi2td*nIsDJi&toa){EtPez SMPx#24YJ`L;(K){{a7>y{D4^00DGKL_t(&-sRg(O9L?w#_|7_-USu(;6dV11;76{ z(3YM(&6f}q(V`bueCf8k*}Tk5a-YDDXA($AIwD61;Rv{+{Md-dQ*3b;i9G>sDqvS4 z@;qmPt|jbbuyyPtum|jDuovtouqW(6a0uZPxb}kG3-*W|1bfBq1bfE*16RU+0P7Oi zU*Hz7-{4lT0E-a9aiul8DUAhK0=F$B+jsJ^A?yWkwrB`@1+ZudTMDcO+izOAu`3aI z(SXgJusUo`uu5z$uv%;muxe~-uzGAtunBA`uo-L$uqo_ZusQ4;ut{tz*eo^%Y#KWi zY#uuW>;gL$>;^jq><+sR>=HW!c8lEwc8&cDc8~oDZUWnbo5A+rbtUY1X)Hv( zwX~Ql@D4n5En!9Et!oKew52s*i-EOZi-0v@r`~v2!ET4JSre{^y&uA618c=*0c*x4 z2W!VB1zW%-16#o+0b9b(27i6WyR2~FdK8h@n8HsCfL7Btes|*l0000Ezc(Qk1+GUZC0WLa)Apj9zIOnEF|aEO6lCrdG`EX~dN4VS1R6!OuC2UN;O ztw0q4XIXsRZO1a+vZY=$|q?Vc5ezVSq|H5k}S- z_$+k35|s>>s3VjmffLZ^gx-eGJb3mQjzC)gUkU%j41|$YKqL~QUx`YFyyh*-`bN{V zY?$m=&-#kWvTgezbL7c4_u*ZK4r+ir%E>Wl1%hMQ^RN2R< z0S0EG*$s%2Os*PItrEEe21IBXVn|6%3u{2JSlr&(*?G9WzW)2@=;-5IE@zLAkKgL* z>Uyiay*(R^M$;h;c&>(0VNnw4yp1{W4*{da-rU^W>KbW7N|9WX@=_y9! z7#Z}GggSv!{Npr7oQL!J)#p}u%1h{h4~N}pX=%BO(LF{dO;WSCmFc2fX=Ql1P$+!G z9J}4e5_-SZ67oD6ySuyJqlPJ<)2gWb8D2ssTk)R2KNYl`Cl48cXCRaTGcz+kk!Yi_ z+4~jPV%TK(8Q8?P@_*>%JVnT8i~-Zr(@#jKG<@)i{9{2zV+>%4DMEzmK6rJZi&eg% zoY-woeBjlgGMP+lZEY4?nc=)4iHrom#91-8q*<&C_@&%_c zI1lIbtFNvzz`^#YudJ@Fe$w6DeO+4jHld@DD#~eBR#radyngl7eFiw<@pyW1aq;fd z)YKi6C2^c9QSfg`7Wd!gw24IGb`V`&YN4?(yN#2RlV7&Cw;ye6Z2UPgGQulVWnyCD zwa(7Y*VE~ACYemW6LM4kS*`uR{U$$^_?#MGxSYA$m*jHBk@En(P-y1%TuEU_AI(cJ z112>>BZs9tL=_JY54QsBk}d@3Talhpzi_ljE*laguB#1P=c10v<7V^O2QBtl^Eh5quPkt z2qOPUOo#S^G)#zoZH0`Y=BUkd%AC$cnTt%qpS{2E4vyzhpU<6w7kKa*=RKca@8|h` zKi}{3JiBFaaq)l6hJf{Exz8pN0yYB^*doA0d-yTNTE-H6n2Z5Jff?Ke!a*dl_z+3L z!8Y25(m!O4V{H-%pu<)siw5z)4(B#&R2nVD%;e)JC`tB%E*LL>q<12fepA<$`X9Gn90f{(#Da2bq& zYv4;Be;(8+KftpG)+UyjwHba)Od1ay2=cO@Nh_2e{Uga*#M%Z-lCHBAL{Ygbz@%9m z&v6QV&k8V>i?vu-o2D!2yG}Sr06TyiL5_iX@G5u)DIlzk`N13<*oCI%!GoXiO?<>&4<5i#xeudy}uv5YB zg#pI$f*jTqr|n9*t}{0`_YEB9f)RW^*LNj-*ZB+l8Kg|PlNUIqbm6 zg(OghM@L8BX=!PBuB@!=(YUy{qV)9i;;O2u$D5m*Yt%7ivzi>LM%Id&Q9J*MkPG&ZT>e(5Y+(Bae69zQOV!9)BeepO!7eWEVlc5T;0!+l z-y*P=9V3&MdOLA|yO`Vq3ahKDpH{y9=2JC-WUT;;kAUB#%+JqXEGa2@41Nc|ZWfu! zGju!KUMxxA1aweHzVcNu{K@Gfz_OfxUxkd+)zzspzn?2_I!N-_Nm{w0NBC@^Efkf) zv7D!3aDykxD-m!*!rU1DTdh_bMOfG|!hqR#b4L;R0|Nsm zqqyZa;OyYkw*gAK&x3_yK%nHIOAdG@ycqOt`EEQ9dTOwf0 z2(-h~oQw_@A4>sg8rzY{$;lI?rKL_DkKz@$l|w6@F+3`!B)3GsH6vPETaR$uC-LmY zaO`I+WskG_LtkItvteOj$rKyGD-y%J*==oYhb6fs0!EC$89m63lR)2ScAlLp`QZ-h zgQljYeH0PND`HczR7^>3iGZs{V1n*v*Rg^KpZkX#f&Uc@t2&B~;z@9*n3CKQ0YgS$ z(&cmV#(;1ZBK7}eVq)SYUWF*mgY6KIC&?`laM=i~q9s}Z694Jx=`;29^$)=APOX6Q z^70}{Zi#@Ojp*p;c#7R4RzHOF_E>Gtb#`{vm`tWTZZi_KLkKPRNl9*rfQv?;kp~`oJH?4+iA-(+v()S#>N8W>u)}ZfG_+76R-#4_-H{vLAKEijo0gS zDO=?eNG`nq{VnBZfr6qw!o9!?U0q!dS5{W;vDs`6yWO6Sg>QFvclV+3@$qBIW;HqV zx0L#u`kr7$e^al2tkNCKXdkQS9&AlbO`U?_C&376dtLirOZRAz3O(RHPz(;Pz(eFg z+TIVmTzwDt!r#2KDW(toSIkk&THL^?eYB{1xJv^EjkCcnAvp^AWDytP-#A7)XV-M6=IbrFzDiZZY+$PtLF2@33~ELb3xsTflciAMyhw93jKRw{>- z@kl63@qk=Pv^av`9)OENgc4a?7EDUyz7|;azTTUe?k~$M?D39yGw&52e{}N)zv=n) z_w~GLy78ZIW8?S@=C8TIeC`0?gGo3^8LjwPI(PvfAlpQvI7vsK9y%fMNQHcutc+zh zV$$~Ax&9D`ME(LjDq52Td=EMl1 zhC~z1W@9~Uf}lG=g~{|wTEa3Ip$(ryC%ad|cVgxZmqJce^^|xTZ z3qdpaN-dX5gxEn~GQGik4fZ(~R9GxuV1DM1FPUs)tEwuT3es?yuSk;$f#VRUv(8Fd z1G)o28b0fNfJ^3rFVSRyE%XNHu?3ZR^*>+{ljwp^C>d31FK!LQ7L>_<>l>p=1b0DT zu+CHFZ=fZHpe*H2-tk<5>*!T)u?2Ag&M?XfU6J3xk304AnEvc#r!rPClX8$bV5eWXNm? z!0&n4m%|C;!Xt3<<#<+sAEHH$`j@1*^#Ca3%~e-JPBeV+2y>kpw;li_?iYV89uZBD zM|&wHn-e4uoKmv2m%tMd;N`D)a#%uqg*-X@74SyXlVZNBWI;lFBqhsyw>TxDAY7h2 zDs*-w23e4qNG@I>c@+LC;=@;X#)k6^W-y7a6ph7|k@)5x*~qYgqGXZ*x>3YNnlDEZ zG~G8Zd}-EM$(Z>!`MPz-FM*&+-&~jup)t!_8oo4}xH9`G?UpvfMPhO3ErD5~q{0%M z%fk2q?@yh_ech6Q<6si+D=Y~Wq-o1N5gZ6)6SV0C<#&@QoW2BtM{3JK8v@e!ib!8B zLS;hIw1?+E(!opij%^p9UMrf%=iR-cpK*PJ|y0$V}9Mo`tIij2jdQ9k+5 zhO_4~xdTgzl@;_JFd`@NorC3_JW?SHT1{HWRozxG{ zFLbS6mrVXo&QW;L8FebUP2+I=z3q?&z$mc z^px^ZW7emTvXwst%r!r4RPnS~0mZbNVurE+fDynC7!gGIV^?g2#dlBW zEj9yX#DB>MCR+OLL<0B0Zl3p4{*P^n4GHosLDS;m<86}{j2UNBY)Eptl|jl#B#1Av z$1N@!o*t#xkdzVDOy9=h#AEif@|79GqZAwKCHK84#>wZYQ)iZ?q(vz<1RT{TXc&X| zgHN3O;7^#0@MUAYWUC#H6hB{`xTNIg-8@3EA+cMpwsb2bz)!ucXxiOD7OB{XaxFnD z0|^odmOj6<;EvAFJVIirR-28G7~enl>AUW2G>}4PIK%3sC&*e%7ba#xBF zlEtMP$|oC&+aMXq1Ot%WlsLWh_{SA3oI-}*W3}ChY zWnu^)f_;Ko2@|5rw(4!Wzx8=SJ_dxc!)lud65}`SSY7*>UnLC9pH{2WmLQ+b)@?p^ zG+hbfLx&|uT#$*lKeA^-jYK7UFG=>2t@d0Z6JQ+qXxrLkL*ro<2<3UJa~=}lcbu;L zdXGnN7H%1#0e};jXXO;4xYmfK??0yWM6_XMTS8+D&cARMtI)X`!f z_xwvcKT>-9T2zOGRA+Ve!-6>Ybh>UoGt!ml4iWZSB?k3^-15!(-5Y8MxhkXQh9Ic7 zy59)bdi47BpRP;MHEttT5PWmBWxJ(oe*3A4ufOyP&TROS*zP_-oxwVRF6d21Ki+bo zHN_+B@B;Ni(Aih!X03F=r>3tqzuJB-GemxP0oV4O{itq+!{CB%cI@A`wY%LaESo?$ z+)K6ufv7Q=L%M9K-16oBd|s22y;GB!pY_YC6zG(HvHH*TpZm3#yOsh))%8Ap;&=k+ z)WJ=sj$JLR7<`GiZD3D&kJ0Mn5$2)KH+)Wt^~H*XH(Fs&KVX;HLXHaSgNncTOwP%{ zfrb{Sxeib_QM<#!IFpxn2 zTLYIPr3GH2w^aOlZ*O5qPUr-Wfy?m85YR^bq8-1X>W#x+_%+E09P#ywuyHU)T_dkR zR6dE52REMXEi4I+_<-_?x&~mdAYFee7-4jbMVKwxJFnv09%=M zZ>R)`23i~Bgf5Q3wAaw9*9j*E_%9|GhZc}Ti2%%6lAY`6uA<*vC%oU!x^FeRH>`lJ z@xcXOGP!H#lK^3Yz@xtI8_5Y03KKie7%LzcE(pB*9q(u*LB7DiN%L_CgbON6F*hm0 zF+o0|IL8-Ob@dBcJM{R=tI1iM64BG$9DEKM0U`(j$Wh<+`dI>eiGfDr3Aj7}7(D*@ zBh2+YGZ96EW(!|heKy+ppvK?}-Hm3PPoS%MdI^@E$Z^?tI&eu~0@-uPc-qnvF{;n< zN6jXQ@#{C6_@kDdD1rbQg3ooFHWu3ebKF=4=k4&- z$M_O)M#jaLOq}6Ms*epNhNGIz7416$ibR*Gue5JBS3onwiYD=R_cq-%Ust-fipQZT z7QVVcE0^1aLg;ekQRH^5ygF=pac$INz+M-}fCEvF0iTErn5C}Ja-CTs5KM0{q8tN` zJpQ>Q^gQ#ULq0Lth^ux~L?T5?#{K#e?d!VQ1B!`cyXpj#uJ-nI`V*EO=dss#r0dN< zo53W;kk0~bU2htXSb7}Cj!&UTt`VJr5yr?ICOYLBD2k}Z%AiS+#a+5HiGQK2Y2Ef z%1GrF%s?*y1*lbA6ldtaU~OpF#|bBwS*Bnf8^wmPtZSELn&ky~it6ED?8_{%$3H(y z-a}JiG~J9DeV19N6)(X_JixxFj(wTseYml4@&@zQ-eCU!0bHhMhsK@mBme*a07*qo IM6N<$f+`%ga{vGU diff --git a/toolkit/themes/windows/mozapps/plugins/contentPluginClose.png b/toolkit/themes/windows/mozapps/plugins/contentPluginClose.png deleted file mode 100644 index 7a1607ebc641e6ca149fc855d73810af1cce5192..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1106 zcmV-Y1g-mtP)>u4HuOW@ZJs7pt3|BG#2^E0e6&EWB9I=)&j&j54~(Fv`d- z5`qksGR!s66AMf)tFLMUTdG4Mc{QvMiFyb3D zzWc+de+Iu%P!MnDmYFPB0AP@aMR0<*Xx9Z#6{An^kilp;gcAId z`R36IAa(<;wWToEB8}NFB3b=2eg}S1P%ySR^G(A4zF5|OSFgd}j^)K@kGxaf;w0&U zv1YI$0r85CpW(SqhMw!@Eb``w^+4hqbo^|$XlLHyG}|UQ_lgbL!;f_Qj9kIWyvZ(D zlH^_LLqPJ~`7V=+UVCX#Deo{C1$R-Yqm<8?lwZd4_#XQ)BZ+@@K~Gz=t$n8RTwBiq z&o;>J=J}5=5}i7}vvp~!uF&zFt(|l7Nd>yP7fR7>vw%{hoI*#*bv(DDWar~hDS=R53N>SG5)G7N@7JkPG5S0g0?oFG>btQdF>Yg^qWvNGSp&(+k-9<-n1_!-I!^ zJYKIcPfrCt^VB~l2K8>>$le{B`?j9^G?`t)Q`5|oeznd#Hu?F_dbjoD=DyzYy3v=C zdEKguNc2dU7Tu+~!tKputwAHnN3IB)7VZ$SqtQd_E&`~fgX=FPh3Nwcg+L1G@n+`-b z9ok_ThRmEH`_#oKyfxgd_230vhpSmA=t^ zzv+tANd-WNhHyrE8b9urFPAT6720`N@<6~zP!xwr{OKUB)`w2jYosXI2E<3vA2XvK z2hmvNyX5Wv4U&rKn1~rM;gIn)F%YR(jr-pxZ(ogc1+m@|8N06so}NCI0oC@<#?;G-)~fxANwRjZAgNgGr?q7Th#gt! z?O1NMnYY2DYvHdLz_k?q%KQ$jG}`5CSae1Gf`ho4!p;UiI+uI79kXC!OpM4~$1bJt YAGuvoa)c@+C;$Ke07*qoM6N<$f^E$p!Ti6OXal&E-6Faa?!1VYThLQq#$Fc%L251z!6=uMEgsN|NAHLxJ=K@fw)A6%D^ zOxR>kYnYI@QD=3=$=LJLomcW|D9i5Y?wLVn$QFFqQ(f=XdsXkRsufjL6|%Y6ge-4a zuYhRKFLE$yDhHlts=UtGyQCw$h`U2zXP#{uic_WvgBbHHq?wm$q=3Lo<^VYHuf$Ev zHabBR5CMeougLIAm6w3ZnDPrUQ32p;G#Xt|Ei^Ko&>_7Gkq%x?Ers<=$c_YgcDwx{ z{CxzthRg`A0Ez)_G6wJmzyo*;d^{>i8c~N%mX8RcQW7^Q5%6DBb{}wvLdZxLMSgS#QsE`z zIJ)}rs6xm;pzZ*O&DW8-IFpM|EDQdRwHYir+5Pf!0we)sqHS2s5|-!eh3Xw^^- zOy#ct>VSCwAnQRtW~#I!GURXFyMK zLmkRWWOnFPgQ^}@R#v{=+}!*No)0i)?~&)l#YL~jhUw^?(Sa4EO`WYfk}rv2S!FleoRD5Fg!fG#nHc@^!P3jeauWXn$QOz z$%QeIgfM&3Xq5v=MmF*vhr_|s)0QL4@`(X`>N_wyJNpiIGKwGhhK7dfjCNpjbhK7a zy7BSxn^t$gvI4EGt#?{lTCOlP6G3iQSJ(C0+S=Pj3N$n{-0JM?yvEa$K8QrOttud5 z6e0yv5jkLhr$4~o`unIT&o?$UzM7brcwAIeWFH(HY_6%P>9N^trDnn?&>w7XZ{M4m znj$tY3=9msTVG#)*93hKLhZ-s_(!L|H5B+Bk8qjTjzNJ>SOug6CM0BNCN_*hF$|4a z(Ihik{%;ike+pv_@4QF_qRBAw`~AN|Wcp=cVd0-pC={KWoAWcdLWF{?2ojwg!sYd* zrly+0!ooMxbvMdKp?g*s_+^~2e zyK59ir_3@tJUo0-R#x^f91aJWb1E%GM2!Q9$liQ7ozDEdy}gfMH>xZsFu*FHmx)bb za&qz!2v6^9!c|pO!q(Q-&E4JIj$kl&2Wp!y2;jMg^g;5vQBhGLprSI+%JcK{KUtYG ztv*m(Tx_Fu4rTV+P-1k#3c2}lu+lh!-6Z%ps6RXMW08E@ySy@?^ zO!NYUUjw8P`BdJ7*n9a*Zf7E##C1lpK!FHxr#9|pVhK#BZTCQ1&nJ>hbVdhTiw zow)!H8cuvK>e--9U@){@lXNPE&M+Q7kI{M0TrKj01dQte?i&0uZJvHBJ3$%aSM96` zMHm8ENc&;bc&R{Y?LPqq Y0E!xJo>h86SO5S307*qoM6N<$g3G$7cK`qY diff --git a/toolkit/themes/windows/mozapps/plugins/contentPluginDisabled.png b/toolkit/themes/windows/mozapps/plugins/contentPluginDisabled.png deleted file mode 100644 index 72f7db9489bf75499ec4f4502360650ad6313198..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1342 zcmV-E1;P4>P)BNVg?O!Z1+KWlY^+RuObH(qv`DENzvf zBwH7EW_0F#>Ad0G;qLQ2XWo0`Is+c~FmK+w_uPB#`Fii=RaNEA=#1xjJ*lgVok5F+y|7zj?8Dhy=inM*P+HJ$(*GnfmIfxkpIFiUg*2@nB<@t0@# zIpxKnFmXx1fi3_pNs@F|wLn^XtsnMxBa*=@!$@E=6B4mQrYMSc;CBx2Jm3Xns6Agq z#?JvZ0S^F6(Eh&Gk5M_7Bwn(S1_ToUsLI_ogM%CUi;O8c0ng!}|DhvEh#+7eRem1ZZv*}U{EOeH06a4Z zC%g`@pNx}_MI~Yob?9K{5dmx?GVK*)8pJ-kfXCSO5c^5^jcULNuS1MPboFCViRf)! zmgQkV5MFYU9g|sKvAh&Txd)E@Hj@t&HsWY2e*rrDnbM^L&*#C<6F^8aD`F6JQoTHN zqe(@5j1_>OCQ@C13?`HFL|3c0(m((gTZRx_QWMfZfTwCGvx?9XHa9oDv$L~(3AR_p z#>T$c+1c^i8B1UC6O(E%VcOc-8qLkky{*OM`T6;9RaMpXgwt{3kwUk%-T*(O?~C@c&0GJ26uON|8}4OQvnnU zP-|*xIu;ifU&d@2sHmv;3I5;IZ%U@8r*G8P*WX2957yS!E*BRUzh`kgCD|H?u1INV zY1i`dvIpyxV0n4DcWG&<7r)ChGc#Y**4Fy4TnMkPufJ1RSa`*u55ye7h4qG3lV5^N z?6+x-%F4=0Z%IkXZMrz{|II)k5UQ-Kqz=n(Y;3gU<>g&-kcnT%LN8h`842KX;8V)# z>S_;|#t;^BD!Wh+tvYgYa;`aXS`gqeD}YlUIAWhgMMdw!DmP=T@&s`J&fW%-zv_^` zlE{`)ahPb7AP}=Dk1kv&6xvS$Z!Qr59y#DAd%fPzo12^O=|2<{6bw&JPClxutNSR~ zY5B+`Y$7}`FmMAV|A5*&M4Pw3kv+IjJcQ9-$H&LNb}&Xln|jFx!hL;xz3uJozoFy0 zVB&A&=jVS24*dya=vPq)rLnPbd1Pedmd$ablMo>MEl_7?=kN3|3$pPmF!3(B35W9H z1IWUasF_GhOUugO;NW*BC4d!mMtXXBzVGhten^?m&COMnm6cu9wNoLHbxll6yhsL&xaoXbCObA)#eD)qqhV`_gJ8@cDeh zgb*2=^xZ_l?9kBAkJ;JT7om=7vXRI>j+co)OYu$pr>p?P#0S!bh{2h=k|uLk^_iHx zP)KEZswN`3mytBkK!g=SU=B;8Noj9y?|u?0#uEX~EzF)$A30iNE*moOy~rhYDR)wK zF4LVJmgbN3M~nJK93I>4Glxj0ZS(Z5jGki0j@k)hLJ_9JA$R;m+-W$i{?adILRPO; zpLwX{%&%QlUN=Fjm(kB!n79|;XLLpu>3;zR0Lk~Ev`8Pt9{>OV07*qoM6N<$f>dmM A{{R30 diff --git a/toolkit/themes/windows/mozapps/plugins/contentPluginDownload.png b/toolkit/themes/windows/mozapps/plugins/contentPluginDownload.png deleted file mode 100644 index 714302dc26e66aaea12a27bc1c7f5c0ceea9d503..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1061 zcmV+=1ls$FP)ti=!ypnGbe?f}i69Cn0XD)RW!unCG4%;N zQnnK0bD>`$j+Twb=x;M@>(l)yZCAqq_aI%K{Uur3P8F&ra5mn`P~qUVOF zlS6@%D0B~9=OWsG19bT`w*LyknWcmmi;W(K}%JNFsG~$q~4NfA( zF%CfX`3cy^wjJ!};(y8mad>q|R1;X1*;9$r&NE9Q3cdA%DMtMvXe8evI_!fRUSeGZt zh_n@mYoRs{{s3dOMRKa#D0rZYmOnyeX!z@nf(Ja3tf`zu{q~08fw%%pXIG(Tky%#2 zHJn`q@l56w=#i;HZy7x8pr4uozk+t&+}wP-va(Wx;%^L{dxqRyDIn`Qu+cq)?=`?x zc|P9Q*tlITm)GKK%ceyb2q5@zwOYM}(dG~%Pe+?Zbo!|1B-^%SU&$kk%peN5VX(Zs zT&dM+cgP_1>0^-ve9}htk$uC;OI!horKP2{dcFPtr=&w}5Nxg7zon3EWuGXrf~)~A z%3NGrTwLGT+41M*=3bG7%=Bcg*=#VlC*qk z9#FKfu&}zlz3pK6e$tlL6%YyT#3xiLmF^|YQ_q^YHgG>JOC@=~MGeBW%3ey=N|Jh1 z37hPaa)EVQt=5)x_K7Dmz_E2nRx8e3En26K4O3X}Siv6Uf}ZHY^73%d>ZrO;uNKc; z?&81;*6Dkeoq;*8-pbT1_LHP{ph=G(5KL0(!gg|rVTLcWAw0<8Tjx$ frZI)2zXA*Z`)+5Io1<*f00000NkvXXu0mjf&9nF! diff --git a/toolkit/themes/windows/mozapps/plugins/contentPluginMissing.png b/toolkit/themes/windows/mozapps/plugins/contentPluginMissing.png deleted file mode 100644 index 9fb2eac26ed3717c2cdffdfec365c484c537984b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1572 zcmV+<2HW|GP)()8ndER^Lno23-uHChpH#4W-Oi^A_DN6Gkl-HGbce;Ql zvY2dfZ)GU1nZ|-5ac|r*FO{i)PG-|I4Izx)m-uQ6p;=7}3qd|#O`*V`yr@MfoI-WH z;FlH)8UxLQVYrF@eWuTN+`b@s{zO01c>0dNuQ1&PFT!LAoIOLx<_{{iZ9f*4oCV$I z?{wb-(3{++czlIj9q<_U7Iv^668JnA%e?jOoj@NQ32L|O8FonPw%c|sLRGpHD zUHbS7Qp$0h2jy}(g0N_MdO9M@1wjzOVye^Wm~b~S{1Vg#-D8(KGK6l(tHz2%OiETI zOH>J42pZulDf27n7YOJ;`z8c8V70S}iHTDHIEDMq$;H0!ldzYd-`CgI9|=AQFYdcG zFJVxP$(2>i5!O#)AI!gjg&w7o1y*T8SZ8KtCaBeF!R+j;IzK;mDJD-(PaV8>_1Lww zwa-CxyU1PpH|2%CZGDfb^poqlAB*`QcG6V`;Okj4<;u#+90YY178bn4#YGPQ$mMpW zQYpiNW%QACe&b4_+d~mTy1nd^mwjc{{U6(mW84c^<^`+9eG_aC@5M8b9E z=H?n8Z+?E>gYaNvWF&64+t%^%v3q!USUx&BDxaL3jJ8^>5)#sk<2a!tJ}pZT!Lka8 z>%;P`JYJwGyiq|oIY{W*($dmXt~T$;sw6|mmh%F@|4raw9UoR{A=$`M0jw0sH3~gb zKio_1Rse%S;@KL!ZlnMuF2;x8<>&DN4~q;ziA`9bfSkK@4wz1AtwQuc;&a!%kHjKD z9TGS-H5EXS5JF>7>%uBjFZ2X3zwsfoCM465sUV6_eFb znaB$!k;aAguEgwQtid(In220YZl^@+0_tM?pqmrP3!xa1Y>gueW6uyu*0gb~L<|4k7|64yKE7Qz#WT~@{@iQP{M`j{b`{Jh>ccP`B@?K z9TVk1%y}@3ut{=|0HksCmBcc6Sb?IGI1@|XNlc2XR2&T>dASl9*Gb|8FzRrC={&@e zAOHjTXP}Tqp##}AFgS#zTLfe&@IGsQPg{Rj^MLe%#?^NS>DbGgNM5lQa^+`v;5mQ% zVXB0wA*Fy$;^(QgP<|D9T|%gr7o5C0JZul-%|lk+Jb+Ef&~iY_zOD!Ae0@uQILr_d z;OqS;V2XLb!j8zsp47qy+bLQBl1Z`&17Q*J%`64v%kSx?*=&A98wviEXB-?HI7KRe zt*JwQD9+B#O2Fc3TxgFa=B}VtS6AQO-roL$Tu7U9Y%vR+iD?EV@bH35Sb7~Xx#Ayw z6`}WIm$C2h^@kh2zm+kF2$}~P{BP(Ywk}RYu>N?Fb7p1S@cqDJ7+WZgoz$h@iu?n$ z%J=%`kxHFW71i{=A5$2(!`5%}y|1fF#D@_&!+p*VYlu5Cd72rE^Rfkje1sVry^lf*-xnJ_j$O?Z!0R4H7p+Y0!S`LeYu9Z52`~V1 WdyupwJ%7;v0000@DTNqa!Y_9vGh(98n7%{e&)wBQ+6qO=_F@&=KOqf z&Uel*V+{Uharlt0zSP$niPdVA05F?@b?WtcZ?x7Qj5eo- zxh$?{Gx({LbK1xavWHpxoX+S7;R7IEE|FP!^n# z%HXJQgw6R-95y12OCwm;Y zWpEOPA*3{*8=NW#1Of^$8kk3OD7B%pfbV%vrB%xMfczL-4Xfzs+s8^slAQB~t#Uje(GP>Qa zoe#G!l}gTT#iM%8KA$~L049@3$`G=hFe|p5_PBv z5TS5s4F&^@Mk7?KRd;T;+b9$Ys8lKmH$mW!cL3UOt<~1VoMY^4SFKjNLot=9B)Ind z1b};-kq}|C9ko>Fc7p9F+|C9OY)$r!@DyhWzOWLZ~4$Ner49&9r?G o)J5aKEWmlI`TZT<;*S6W0O=PmfVrhg`~Uy|07*qoM6N<$f}@r!zW@LL diff --git a/toolkit/themes/windows/mozapps/plugins/pluginDisabled-16.png b/toolkit/themes/windows/mozapps/plugins/pluginDisabled-16.png deleted file mode 100644 index 6d0cd01fe5acf12650925cc3466fb226c0ed0ef5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 664 zcmV;J0%!e+P); zqb6(?LO39gz}=e%-@?856yChaBe)OX9^h`c5JFf^7);0-{#*q%aoL&fwyHTKST1L5F(Z7boy~JnOxD_zGrJsCSSi#zfId(X+&|H0tn8450TRw zt@V3amxCa{ZnuT&dVB)$U4&u~;)ZNO%2*2d?zD3HfdSk!6)9hbVOY-jc_7vZibV)V zB%9j6Xdn!V*zfo5X19Aq)&~F;r4-hSB|I;SeH5XP&C!m*@7r6ldAQr}kuMbBI?mH0 z4tO}ObCS>Jp()aKyMrQtTs}wQBZ^{dHXA6~K;yCR`|yiCY~sfLtR93X zRW%Qf;CjYjBnI#@0jBujL=U0hy{pbnXlEEe;B0Oz01pGYTT z4Sc9xucO&)qTlahFc{!vqk(F*`nN0%x(B%UeDNsdV6|Rl43u@Y9B|zvHZu~wc?V~u zVk$&qwODy60BuU6OzJ!yk1?Cg(4fc+IvfsBDwR;FRKQP15xHJ2EAImk$0m(jtJUn` zL(Q#LE7cR>78@r8kO|GWUjKkH%3fPdGe_dg4C&0Tp$!THhdbsb_uK;Xdc8S6qBxGl yp*_hX<5?s#KM4Em$jQx^-k09|?Clx;2rvMqQc*v!a)zz|0000=Q}?$tBf&pmrc_hw>t-5kD7?^YqeTr8AT^2C*L)L z&U0m=FM(OZZNEE?^XtOG;!jFN^y*dR`!Ec@#%oW|+vvYx{>9SL($Ayh_gt^i7{ImL z?ULW{0ZWrb20u+&5uN<`mtQJPxR!QgG{m}#dc!m4_0Kkh;ml}SPw5{mP>o?zGZc9VKrQe_#?;crMn>5ySf{@NmYn02oWFkZD zW}CeG9@%zGXb=Q+dU{IPY&KS+=*P#8SAG}<;H?W({HHCAL8w*gn_{s@xtvRx%S&>y z8L};#f-u0Gp?tw5&zlkHwOSPdBN1aIAUw~bd_FH=&d<-E-Y5p3lq>~S!K2ptSuX2R z-nGebCdKLq)MqnUDi$ZO*rTA+5!Ze4(Z|#UdqL2pD2m9*IOMu{$WU>lYyJ7PSrCEB zR=Z82-;&{S*2&P{|J10_2oM$qloy1h#-&fE)fy;w$brQ*(A|XVcrKI4hyl%}&z8$P z0OSr24=2Ympj1er7YP1%`ErrzSB@dS)g&J=fM`LGXn->km~5R#(-eWVdK2??6T6Xp zt5hOW)6~?IfPyQ&g5O_^sRNe0pzw2D_c^}=RxxTp85Sx_g41H*hO@&-LI-2omLQg% zDCb+w3T{YAzC0bz01HxhgoT!6J!1eI6ZdC4(CbsnZ&N4iQpT|nm^pG0U?x%JO_#+5 zZMZN9+K7RyWB?2i87!;WY(5zafb+M_5gtbHxAR2?0&MuCP%KcfkcT^*m|o751agGP zXU-Tc6KJu zD=RBhC=}$rUa!-^!GYYD%Vm1-;9;7A!+?!E4`{{tt%R<@j?|>Nxw%vzD`dso_xJbH zb+faxQlzjwr@c2fmVq|*e%Vi?%nfzE0$6_Z zNJ%*)Q~G6VD@Dv#7TCKo2&SKv_qX-+btycfEai9S=jW$!d%>Y`e0*$%9mzP)EG{B! zA^W|99gnX)Dlf4$Z*Om3v79@P@!a5ee~%5knrHt3fOR&Xj94*W`vv$Y$-BF|>0+jw zd#~{vuNectz7_x<3E0}fmzjm5qoeeBb#+y;fcwVAMmo-G_$+x-2JEZ!Qyd3FiV+{T z*!QE_=H}*2V$SN*V@4gzHNC%Y75%^dE->;rK-6M?VfT6;`dWz&(--yeJ#thfjIf{X zp}V)p5G&q$gGRCwCNSIbT#M-)Bv=x(}g^DqN5 z8i)jDOjZyHfgn<(fn79ywE)+}P z=;)}BOpf_VX(-ZOt{U9jTopc?iD0?O57 zpoZf(s8lL&UQA$kc$nlXxV^o7Jun9Z(J~?%gb*8^=Rqoo(Rk8^)sS~X-VlPA4>6(< z(Laa?FQ%r+NrMV;CaPB9`5uCVPuU@NtfOXrpel$cbcRVpFG(qwC)ZGXp779!WO9gWw2q zR7l=9!Wt%siII(l9H0->>JO%^V_5~Q<;vjoPR3Q!Dr4%;jk$YSGr(?WHxg6l`QzYb zKyZ8YFrb424Y_XMdwY90KR>s>S65dNkH@V{miB_3ogMqm`1m*$78V|Y(jiG*s6bMw*<>n} z(sWP}y^dr|0@aUjw6$VuYpa8Fo12?9C0)V!H*ATjdX_sQaBy&7Y6b``On2}`z8iB( zOG{W;S!n|8?(Q~?Xs--$fBq1r#e${*6q?3PqZ+l{UTXXM`^`B9<^u=wVq;^YDR+2y z*a43FE}-hQ*0l_q2K1`)#l^**b-up7-qrKAp;~ZEuVcCV;3m^Uwm0cb|L=l^@+Ssw z3wCD;_$}5_;)k=dv!*fa5orbPCevq>>KNvJ`>DTBCn2x!KK6_cJx}=M#GpmGF1hCs zQBBY9g1RA2oiI;1!UlNP50m;%ZcjcfCHZ87fTMxFjQ;QOp8x{@?eng{m?YOB00000 LNkvXXu0mjfAz^;o From bf46e8cd7928fd289b88f9fbe354f7531493b10b Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Fri, 26 Jul 2013 10:41:25 -0400 Subject: [PATCH 24/92] Bug 896326 - Accessibility may return empty lines where there are embedded objects, r=tbsaunde --- .../src/generic/HyperTextAccessible.cpp | 28 +++++-------------- accessible/tests/mochitest/common.js | 4 +-- .../mochitest/text/test_atcaretoffset.html | 2 +- .../mochitest/text/test_lineboundary.html | 27 +++++++++++++++++- 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/accessible/src/generic/HyperTextAccessible.cpp b/accessible/src/generic/HyperTextAccessible.cpp index 62ec359bc092..a79a5fc57bf3 100644 --- a/accessible/src/generic/HyperTextAccessible.cpp +++ b/accessible/src/generic/HyperTextAccessible.cpp @@ -718,33 +718,19 @@ HyperTextAccessible::GetRelativeOffset(nsIPresShell* aPresShell, 0, kIsJumpLinesOk, kIsScrollViewAStop, kIsKeyboardSelect, kIsVisualBidi, aWordMovementType); rv = aFromFrame->PeekOffset(&pos); - if (NS_FAILED(rv)) { - pos.mResultContent = aFromFrame->GetContent(); - if (aDirection == eDirPrevious) { - // Use passed-in frame as starting point in failure case for now, - // this is a hack to deal with starting on a list bullet frame, - // which fails in PeekOffset() because the line iterator doesn't see it. - // XXX Need to look at our overall handling of list bullets, which are an odd case - int32_t endOffsetUnused; - aFromFrame->GetOffsets(pos.mContentOffset, endOffsetUnused); - } - else { - // XXX: PeekOffset fails on a last frame in the document for - // eSelectLine/eDirNext. DOM selection (up/down arrowing processing) has - // similar code to handle this case. One day it should be incorporated - // into PeekOffset. - int32_t startOffsetUnused; - aFromFrame->GetOffsets(startOffsetUnused, pos.mContentOffset); - } - } - // Turn the resulting node and offset into a hyperTextOffset - int32_t hyperTextOffset; + // PeekOffset fails on last/first lines of the text in certain cases. + if (NS_FAILED(rv) && aAmount == eSelectLine) { + pos.mAmount = (aDirection == eDirNext) ? eSelectEndLine : eSelectBeginLine; + aFromFrame->PeekOffset(&pos); + } if (!pos.mResultContent) return -1; + // Turn the resulting node and offset into a hyperTextOffset // If finalAccessible is nullptr, then DOMPointToHypertextOffset() searched // through the hypertext children without finding the node/offset position. + int32_t hyperTextOffset; Accessible* finalAccessible = DOMPointToHypertextOffset(pos.mResultContent, pos.mContentOffset, &hyperTextOffset, aDirection == eDirNext); diff --git a/accessible/tests/mochitest/common.js b/accessible/tests/mochitest/common.js index 78f87815944f..934997b6212d 100644 --- a/accessible/tests/mochitest/common.js +++ b/accessible/tests/mochitest/common.js @@ -158,7 +158,7 @@ function isObject(aObj, aExpectedObj, aMsg) /** * Return the DOM node by identifier (may be accessible, DOM node or ID). */ -function getNode(aAccOrNodeOrID) +function getNode(aAccOrNodeOrID, aDocument) { if (!aAccOrNodeOrID) return null; @@ -169,7 +169,7 @@ function getNode(aAccOrNodeOrID) if (aAccOrNodeOrID instanceof nsIAccessible) return aAccOrNodeOrID.DOMNode; - node = document.getElementById(aAccOrNodeOrID); + node = (aDocument || document).getElementById(aAccOrNodeOrID); if (!node) { ok(false, "Can't get DOM element for " + aAccOrNodeOrID); return null; diff --git a/accessible/tests/mochitest/text/test_atcaretoffset.html b/accessible/tests/mochitest/text/test_atcaretoffset.html index 26ea53c39a3c..3144f6a5c7a8 100644 --- a/accessible/tests/mochitest/text/test_atcaretoffset.html +++ b/accessible/tests/mochitest/text/test_atcaretoffset.html @@ -115,7 +115,7 @@ // __w__o__r__d__s // 10 11 12 13 14 15 - traverseTextByLines(gQueue, "textarea", + traverseTextByLines(gQueue, "textarea", [ [ "aword", "\n", 0, 5 ], [ "two ", "", 6, 10 ], [ "words", "", 10, 15 ]] ); diff --git a/accessible/tests/mochitest/text/test_lineboundary.html b/accessible/tests/mochitest/text/test_lineboundary.html index ff98aa3265a1..80687f98ffe5 100644 --- a/accessible/tests/mochitest/text/test_lineboundary.html +++ b/accessible/tests/mochitest/text/test_lineboundary.html @@ -17,7 +17,8 @@ // __h__e__l__l__o__ __m__y__ __f__r__i__e__n__d__ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - var IDs = [ "input", "div", "editable", "textarea" ]; + var IDs = [ "input", "div", "editable", "textarea", + getNode("ta", getNode("ta_cntr").contentDocument) ]; testTextBeforeOffset(IDs, BOUNDARY_LINE_START, [ [ 0, 15, "", 0, 0 ] ]); @@ -76,6 +77,26 @@ [ 9, 18, "\n", 18, 19 ], [ 19, 19, "", 19, 19 ]]); + ////////////////////////////////////////////////////////////////////////// + // a * b (* is embedded char for link) + testTextBeforeOffset([ getAccessible("ht_1").firstChild ], BOUNDARY_LINE_START, + [ [ 0, 5, "", 0, 0 ] ]); + + testTextBeforeOffset([ getAccessible("ht_1").firstChild ], BOUNDARY_LINE_END, + [ [ 0, 5, "", 0, 0 ] ]); + + testTextAtOffset([ getAccessible("ht_1").firstChild ], BOUNDARY_LINE_START, + [ [ 0, 5, "a " + kEmbedChar + " c", 0, 5 ] ]); + + testTextAtOffset([ getAccessible("ht_1").firstChild ], BOUNDARY_LINE_END, + [ [ 0, 5, "a " + kEmbedChar + " c", 0, 5 ] ]); + + testTextAfterOffset([ getAccessible("ht_1").firstChild ], BOUNDARY_LINE_START, + [ [ 0, 5, "", 5, 5 ] ]); + + testTextAfterOffset([ getAccessible("ht_1").firstChild ], BOUNDARY_LINE_END, + [ [ 0, 5, "", 5, 5 ] ]); + SimpleTest.finish(); } @@ -110,6 +131,8 @@
hello my friend
hello my friend
+
     
oneword @@ -127,5 +150,7 @@ two words two words
+ + From 6014dc8bbed2293f5535da1fd7ae299229b2270a Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Fri, 26 Jul 2013 10:38:51 -0400 Subject: [PATCH 25/92] Bug 887466 - Rearrange SyncDecode so that we never try to finish a size decode with the decode lock held. r=seth --HG-- extra : rebase_source : 0c63494d7b6330b6d477ba28af34f26af2e2f3ab --- image/src/RasterImage.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index a1e161e07b85..06e01e99deaf 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -2320,18 +2320,6 @@ RasterImage::RequestDecodeCore(RequestDecodeType aDecodeType) nsresult RasterImage::SyncDecode() { - MutexAutoLock imgLock(mDecodingMutex); - - if (mDecodeRequest) { - // If the image is waiting for decode work to be notified, go ahead and do that. - if (mDecodeRequest->mRequestStatus == DecodeRequest::REQUEST_WORK_DONE) { - nsresult rv = FinishedSomeDecoding(); - CONTAINER_ENSURE_SUCCESS(rv); - } - } - - nsresult rv; - PROFILER_LABEL_PRINTF("RasterImage", "SyncDecode", "%s", GetURIString().get());; // We really have no good way of forcing a synchronous decode if we're being @@ -2353,6 +2341,18 @@ RasterImage::SyncDecode() } } + MutexAutoLock imgLock(mDecodingMutex); + + if (mDecodeRequest) { + // If the image is waiting for decode work to be notified, go ahead and do that. + if (mDecodeRequest->mRequestStatus == DecodeRequest::REQUEST_WORK_DONE) { + nsresult rv = FinishedSomeDecoding(); + CONTAINER_ENSURE_SUCCESS(rv); + } + } + + nsresult rv; + // If we're decoded already, or decoding until the size was available // finished us as a side-effect, no worries if (mDecoded) From 86ebd6ba9f366ab6d8ffd503a6c57f858557e53c Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Fri, 26 Jul 2013 10:41:57 -0400 Subject: [PATCH 26/92] Bug 897488 - Apply any dirt on frames whenever we get a drawable frame, not just in Draw(). r=seth --HG-- extra : rebase_source : f4b9e2ccded3844e9384e6f8eb7a801b5e25105d --- image/src/RasterImage.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 06e01e99deaf..54320e972e31 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -676,6 +676,11 @@ RasterImage::GetDrawableImgFrame(uint32_t framenum) // so we can catch crashes for reasons we haven't investigated. if (frame && frame->GetCompositingFailed()) return nullptr; + + if (frame) { + frame->ApplyDirtToSurfaces(); + } + return frame; } @@ -2470,14 +2475,16 @@ RasterImage::ScalingDone(ScaleRequest* request, ScaleStatus status) if (status == SCALE_DONE) { MOZ_ASSERT(request->done); + imgFrame *scaledFrame = request->dstFrame.forget(); + scaledFrame->ImageUpdated(scaledFrame->GetRect()); + scaledFrame->ApplyDirtToSurfaces(); + if (mStatusTracker) { - imgFrame *scaledFrame = request->dstFrame.get(); - scaledFrame->ImageUpdated(scaledFrame->GetRect()); mStatusTracker->FrameChanged(&request->srcRect); } mScaleResult.status = SCALE_DONE; - mScaleResult.frame = request->dstFrame; + mScaleResult.frame = scaledFrame; mScaleResult.scale = request->scale; } else { mScaleResult.status = SCALE_INVALID; @@ -2554,8 +2561,6 @@ RasterImage::DrawWithPreDownscaleIfNeeded(imgFrame *aFrame, mSize.height - framerect.YMost(), framerect.x); - frame->ApplyDirtToSurfaces(); - frame->Draw(aContext, aFilter, userSpaceToImageSpace, aFill, padding, subimage, aFlags); } From 11e2b523b875a29acfed38bab7ee90d7c6cbd657 Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Fri, 26 Jul 2013 10:42:16 -0400 Subject: [PATCH 27/92] Bug 882190 - Remove empty variable assignment. r=glandium --HG-- extra : rebase_source : 3b4c06182d01e8ba98fb7dbb3516a165bc599d75 --- widget/gtk2/moz.build | 3 --- 1 file changed, 3 deletions(-) diff --git a/widget/gtk2/moz.build b/widget/gtk2/moz.build index 778fa7dd93d6..00fbb5c894b8 100644 --- a/widget/gtk2/moz.build +++ b/widget/gtk2/moz.build @@ -53,6 +53,3 @@ if CONFIG['MOZ_X11']: 'nsClipboard.cpp', 'nsDragService.cpp', ] - -CPP_SOURCES += [ -] From 5a474cd13e123d6af2f3b06985f7d76be043a5e8 Mon Sep 17 00:00:00 2001 From: Monica Chew Date: Thu, 25 Jul 2013 21:25:43 -0700 Subject: [PATCH 28/92] Bug 837199 - Write interface to query application reputation (r=paolo,sr=mossop) --- browser/app/profile/firefox.js | 6 + toolkit/components/build/nsToolkitCompsCID.h | 12 + .../components/build/nsToolkitCompsModule.cpp | 12 +- .../downloads/ApplicationReputation.cpp | 339 ++ .../downloads/ApplicationReputation.h | 98 + toolkit/components/downloads/Makefile.in | 6 +- toolkit/components/downloads/csd.pb.cc | 4309 +++++++++++++++++ toolkit/components/downloads/csd.pb.h | 4077 ++++++++++++++++ toolkit/components/downloads/generate_csd.sh | 23 + toolkit/components/downloads/moz.build | 3 + .../downloads/nsIApplicationReputation.idl | 94 + .../test/unit/tail_download_manager.js | 24 + .../downloads/test/unit/test_app_rep.js | 132 + .../downloads/test/unit/xpcshell.ini | 3 +- toolkit/components/protobuf/Makefile.in | 2 +- 15 files changed, 9136 insertions(+), 4 deletions(-) create mode 100644 toolkit/components/downloads/ApplicationReputation.cpp create mode 100644 toolkit/components/downloads/ApplicationReputation.h create mode 100644 toolkit/components/downloads/csd.pb.cc create mode 100644 toolkit/components/downloads/csd.pb.h create mode 100755 toolkit/components/downloads/generate_csd.sh create mode 100644 toolkit/components/downloads/nsIApplicationReputation.idl create mode 100644 toolkit/components/downloads/test/unit/tail_download_manager.js create mode 100644 toolkit/components/downloads/test/unit/test_app_rep.js diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index ba71000db3fd..a128c300f780 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -763,6 +763,12 @@ pref("browser.safebrowsing.reportMalwareErrorURL", "http://%LOCALE%.malware-erro pref("browser.safebrowsing.warning.infoURL", "https://www.mozilla.org/%LOCALE%/firefox/phishing-protection/"); pref("browser.safebrowsing.malware.reportURL", "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?client=%NAME%&hl=%LOCALE%&site="); +// Since the application reputation query isn't hooked in anywhere yet, this +// preference does not matter. To be extra safe, don't turn this preference on +// for official builds without whitelisting (bug 842828). +#ifndef MOZILLA_OFFICIAL +pref("browser.safebrowsing.appRepURL", "https://sb-ssl.google.com/safebrowsing/clientreport/download"); +#endif #ifdef MOZILLA_OFFICIAL // Normally the "client ID" sent in updates is appinfo.name, but for diff --git a/toolkit/components/build/nsToolkitCompsCID.h b/toolkit/components/build/nsToolkitCompsCID.h index 0f6cea5ae4c5..e9a7cc1ac5e9 100644 --- a/toolkit/components/build/nsToolkitCompsCID.h +++ b/toolkit/components/build/nsToolkitCompsCID.h @@ -168,3 +168,15 @@ #define NS_UPDATEPROCESSOR_CID \ { 0xf3dcf644, 0x79e8, 0x4f59, { 0xa1, 0xbb, 0x87, 0x84, 0x54, 0x48, 0x8e, 0xf9 } } #endif + +#define NS_APPLICATION_REPUTATION_QUERY_CONTRACTID \ + "@mozilla.org/downloads/application-reputation-query;1" + +#define NS_APPLICATION_REPUTATION_QUERY_CID \ +{ 0x857da2c0, 0xcfe5, 0x11e2, { 0x8b, 0x8b, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } } + +#define NS_APPLICATION_REPUTATION_SERVICE_CONTRACTID \ + "@mozilla.org/downloads/application-reputation-service;1" + +#define NS_APPLICATION_REPUTATION_SERVICE_CID \ +{ 0x8576c950, 0xf4a2, 0x11e2, { 0xb7, 0x78, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } } diff --git a/toolkit/components/build/nsToolkitCompsModule.cpp b/toolkit/components/build/nsToolkitCompsModule.cpp index dcd997722378..46ef7bb6600b 100644 --- a/toolkit/components/build/nsToolkitCompsModule.cpp +++ b/toolkit/components/build/nsToolkitCompsModule.cpp @@ -32,6 +32,7 @@ #endif #include "nsBrowserStatusFilter.h" +#include "ApplicationReputation.h" ///////////////////////////////////////////////////////////////////////////// @@ -46,7 +47,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsParentalControlsServiceWin) NS_GENERIC_FACTORY_CONSTRUCTOR(nsAlertsService) NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsDownloadManager, - nsDownloadManager::GetSingleton) + nsDownloadManager::GetSingleton) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadProxy) NS_GENERIC_FACTORY_CONSTRUCTOR(nsTypeAheadFind) @@ -76,11 +77,16 @@ nsUrlClassifierDBServiceConstructor(nsISupports *aOuter, REFNSIID aIID, } #endif +NS_GENERIC_FACTORY_CONSTRUCTOR(ApplicationReputationQuery) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ApplicationReputationService, + ApplicationReputationService::GetSingleton) NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserStatusFilter) #if defined(USE_MOZ_UPDATER) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUpdateProcessor) #endif +NS_DEFINE_NAMED_CID(NS_APPLICATION_REPUTATION_QUERY_CID); +NS_DEFINE_NAMED_CID(NS_APPLICATION_REPUTATION_SERVICE_CID); NS_DEFINE_NAMED_CID(NS_TOOLKIT_APPSTARTUP_CID); NS_DEFINE_NAMED_CID(NS_USERINFO_CID); NS_DEFINE_NAMED_CID(NS_ALERTSSERVICE_CID); @@ -104,6 +110,8 @@ NS_DEFINE_NAMED_CID(NS_UPDATEPROCESSOR_CID); #endif static const mozilla::Module::CIDEntry kToolkitCIDs[] = { + { &kNS_APPLICATION_REPUTATION_QUERY_CID, false, NULL, ApplicationReputationQueryConstructor }, + { &kNS_APPLICATION_REPUTATION_SERVICE_CID, false, NULL, ApplicationReputationServiceConstructor }, { &kNS_TOOLKIT_APPSTARTUP_CID, false, NULL, nsAppStartupConstructor }, { &kNS_USERINFO_CID, false, NULL, nsUserInfoConstructor }, { &kNS_ALERTSSERVICE_CID, false, NULL, nsAlertsServiceConstructor }, @@ -129,6 +137,8 @@ static const mozilla::Module::CIDEntry kToolkitCIDs[] = { }; static const mozilla::Module::ContractIDEntry kToolkitContracts[] = { + { NS_APPLICATION_REPUTATION_QUERY_CONTRACTID, &kNS_APPLICATION_REPUTATION_QUERY_CID }, + { NS_APPLICATION_REPUTATION_SERVICE_CONTRACTID, &kNS_APPLICATION_REPUTATION_SERVICE_CID }, { NS_APPSTARTUP_CONTRACTID, &kNS_TOOLKIT_APPSTARTUP_CID }, { NS_USERINFO_CONTRACTID, &kNS_USERINFO_CID }, { NS_ALERTSERVICE_CONTRACTID, &kNS_ALERTSSERVICE_CID }, diff --git a/toolkit/components/downloads/ApplicationReputation.cpp b/toolkit/components/downloads/ApplicationReputation.cpp new file mode 100644 index 000000000000..99c743f9ea72 --- /dev/null +++ b/toolkit/components/downloads/ApplicationReputation.cpp @@ -0,0 +1,339 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "ApplicationReputation.h" +#include "csd.pb.h" + +#include "nsIApplicationReputation.h" +#include "nsIChannel.h" +#include "nsIHttpChannel.h" +#include "nsIIOService.h" +#include "nsIObserverService.h" +#include "nsIPrefService.h" +#include "nsIStreamListener.h" +#include "nsIStringStream.h" +#include "nsIUploadChannel2.h" +#include "nsIURI.h" + +#include "mozilla/Preferences.h" +#include "mozilla/Services.h" + +#include "nsCOMPtr.h" +#include "nsDebug.h" +#include "nsError.h" +#include "nsNetCID.h" +#include "nsServiceManagerUtils.h" +#include "nsString.h" +#include "nsThreadUtils.h" +#include "nsXPCOMStrings.h" + +using mozilla::Preferences; + +// Preferences that we need to initialize the query. We may need another +// preference than browser.safebrowsing.malware.enabled, or simply use +// browser.safebrowsing.appRepURL. See bug 887041. +#define PREF_SB_APP_REP_URL "browser.safebrowsing.appRepURL" +#define PREF_SB_MALWARE_ENABLED "browser.safebrowsing.malware.enabled" +#define PREF_GENERAL_LOCALE "general.useragent.locale" + +NS_IMPL_ISUPPORTS1(ApplicationReputationService, nsIApplicationReputationService) + +ApplicationReputationService* ApplicationReputationService::gApplicationReputationService = nullptr; + +ApplicationReputationService * +ApplicationReputationService::GetSingleton() +{ + if (gApplicationReputationService) { + NS_ADDREF(gApplicationReputationService); + return gApplicationReputationService; + } + + gApplicationReputationService = new ApplicationReputationService(); + if (gApplicationReputationService) { + NS_ADDREF(gApplicationReputationService); + } + + return gApplicationReputationService; +} + +ApplicationReputationService::ApplicationReputationService() { } +ApplicationReputationService::~ApplicationReputationService() { } + +NS_IMETHODIMP +ApplicationReputationService::QueryReputation( + nsIApplicationReputationQuery* aQuery, + nsIApplicationReputationCallback* aCallback) { + NS_ENSURE_ARG_POINTER(aQuery); + NS_ENSURE_ARG_POINTER(aCallback); + + nsresult rv = QueryReputationInternal(aQuery, aCallback); + if (NS_FAILED(rv)) { + aCallback->OnComplete(false, rv); + aCallback = nullptr; + } + return NS_OK; +} + +nsresult +ApplicationReputationService::QueryReputationInternal( + nsIApplicationReputationQuery* aQuery, + nsIApplicationReputationCallback* aCallback) { + nsresult rv; + aQuery->SetCallback(aCallback); + + // If malware checks aren't enabled, don't query application reputation. + if (!Preferences::GetBool(PREF_SB_MALWARE_ENABLED, false)) { + return NS_ERROR_NOT_AVAILABLE; + } + + // If there is no service URL for querying application reputation, abort. + nsCString serviceUrl; + NS_ENSURE_SUCCESS(Preferences::GetCString(PREF_SB_APP_REP_URL, &serviceUrl), + NS_ERROR_NOT_AVAILABLE); + if (serviceUrl.EqualsLiteral("")) { + return NS_ERROR_NOT_AVAILABLE; + } + + safe_browsing::ClientDownloadRequest req; + + nsCString spec; + nsCOMPtr aURI; + rv = aQuery->GetSourceURI(getter_AddRefs(aURI)); + NS_ENSURE_SUCCESS(rv, rv); + // If the URI hasn't been set, bail + NS_ENSURE_STATE(aURI); + rv = aURI->GetSpec(spec); + NS_ENSURE_SUCCESS(rv, rv); + + req.set_url(spec.get()); + uint32_t fileSize; + rv = aQuery->GetFileSize(&fileSize); + NS_ENSURE_SUCCESS(rv, rv); + req.set_length(fileSize); + // We have no way of knowing whether or not a user initiated the download. + req.set_user_initiated(false); + + nsCString locale; + NS_ENSURE_SUCCESS(Preferences::GetCString(PREF_GENERAL_LOCALE, &locale), + NS_ERROR_NOT_AVAILABLE); + req.set_locale(locale.get()); + nsCString sha256Hash; + rv = aQuery->GetSha256Hash(sha256Hash); + NS_ENSURE_SUCCESS(rv, rv); + req.mutable_digests()->set_sha256(sha256Hash.Data()); + nsString fileName; + rv = aQuery->GetSuggestedFileName(fileName); + NS_ENSURE_SUCCESS(rv, rv); + req.set_file_basename(NS_ConvertUTF16toUTF8(fileName).get()); + + // Serialize the protocol buffer to a string. This can only fail if we are + // out of memory, or if the protocol buffer req is missing required fields + // (only the URL for now). + std::string serialized; + if (!req.SerializeToString(&serialized)) { + return NS_ERROR_UNEXPECTED; + } + + // Set the input stream to the serialized protocol buffer + nsCOMPtr sstream = + do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + + rv = sstream->SetData(serialized.c_str(), serialized.length()); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr ios = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + // Set up the channel to transmit the request to the service. + nsCOMPtr channel; + rv = ios->NewChannel(serviceUrl, nullptr, nullptr, getter_AddRefs(channel)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr httpChannel(do_QueryInterface(channel, &rv)); + NS_ENSURE_SUCCESS(rv, rv); + + // See bug 887044 for finalizing the user agent. + const nsCString userAgent = NS_LITERAL_CSTRING("CsdTesting/Mozilla"); + rv = httpChannel->SetRequestHeader( + NS_LITERAL_CSTRING("User-Agent"), userAgent, false); + NS_ENSURE_SUCCESS(rv, rv); + + // Upload the protobuf to the application reputation service. + nsCOMPtr uploadChannel = do_QueryInterface(channel, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + rv = uploadChannel->ExplicitSetUploadStream(sstream, + NS_LITERAL_CSTRING("application/octet-stream"), serialized.size(), + NS_LITERAL_CSTRING("POST"), false); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr listener = do_QueryInterface(aQuery, &rv); + NS_ENSURE_SUCCESS(rv, rv); + rv = channel->AsyncOpen(listener, nullptr); + NS_ENSURE_SUCCESS(rv, rv); + + return NS_OK; +} + +NS_IMPL_ISUPPORTS3(ApplicationReputationQuery, + nsIApplicationReputationQuery, + nsIStreamListener, + nsIRequestObserver) + +ApplicationReputationQuery::ApplicationReputationQuery() : + mURI(nullptr), + mFileSize(0), + mCallback(nullptr) { +} + +ApplicationReputationQuery::~ApplicationReputationQuery() { +} + +NS_IMETHODIMP +ApplicationReputationQuery::GetSourceURI(nsIURI** aURI) { + *aURI = mURI; + NS_IF_ADDREF(*aURI); + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::SetSourceURI(nsIURI* aURI) { + mURI = aURI; + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::GetSuggestedFileName( + nsAString& aSuggestedFileName) { + aSuggestedFileName = mSuggestedFileName; + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::SetSuggestedFileName( + const nsAString& aSuggestedFileName) { + mSuggestedFileName = aSuggestedFileName; + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::GetFileSize(uint32_t* aFileSize) { + *aFileSize = mFileSize; + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::SetFileSize(uint32_t aFileSize) { + mFileSize = aFileSize; + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::GetSha256Hash(nsACString& aSha256Hash) { + aSha256Hash = mSha256Hash; + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::SetSha256Hash(const nsACString& aSha256Hash) { + mSha256Hash = aSha256Hash; + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::GetCallback( + nsIApplicationReputationCallback** aCallback) { + *aCallback = mCallback; + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::SetCallback( + nsIApplicationReputationCallback* aCallback) { + mCallback = aCallback; + return NS_OK; +} + +//////////////////////////////////////////////////////////////////////////////// +//// nsIStreamListener + +static NS_METHOD +AppendSegmentToString(nsIInputStream* inputStream, + void *closure, + const char *rawSegment, + uint32_t toOffset, + uint32_t count, + uint32_t *writeCount) { + nsAutoCString* decodedData = static_cast(closure); + decodedData->Append(rawSegment, count); + *writeCount = count; + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::OnDataAvailable(nsIRequest *aRequest, + nsISupports *aContext, + nsIInputStream *aStream, + uint64_t offset, + uint32_t count) { + uint32_t read; + return aStream->ReadSegments(AppendSegmentToString, &mResponse, count, &read); +} + +NS_IMETHODIMP +ApplicationReputationQuery::OnStartRequest(nsIRequest *aRequest, + nsISupports *aContext) { + return NS_OK; +} + +NS_IMETHODIMP +ApplicationReputationQuery::OnStopRequest(nsIRequest *aRequest, + nsISupports *aContext, + nsresult aResult) { + NS_ENSURE_STATE(mCallback); + + bool shouldBlock = false; + nsresult rv = OnStopRequestInternal(aRequest, aContext, aResult, + &shouldBlock); + mCallback->OnComplete(shouldBlock, rv); + mCallback = nullptr; + return rv; +} + +nsresult +ApplicationReputationQuery::OnStopRequestInternal(nsIRequest *aRequest, + nsISupports *aContext, + nsresult aResult, + bool* aShouldBlock) { + *aShouldBlock = false; + nsresult rv; + nsCOMPtr channel = do_QueryInterface(aRequest, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + uint32_t status = 0; + rv = channel->GetResponseStatus(&status); + NS_ENSURE_SUCCESS(rv, rv); + + if (status != 200) { + return NS_ERROR_NOT_AVAILABLE; + } + + std::string buf(mResponse.Data(), mResponse.Length()); + safe_browsing::ClientDownloadResponse response; + if (!response.ParseFromString(buf)) { + NS_WARNING("Could not parse protocol buffer"); + return NS_ERROR_CANNOT_CONVERT_DATA; + } + + // There are several more verdicts, but we only respect one for now and treat + // everything else as SAFE. + if (response.verdict() == safe_browsing::ClientDownloadResponse::DANGEROUS) { + *aShouldBlock = true; + } + + return NS_OK; +} diff --git a/toolkit/components/downloads/ApplicationReputation.h b/toolkit/components/downloads/ApplicationReputation.h new file mode 100644 index 000000000000..775cf2fcda25 --- /dev/null +++ b/toolkit/components/downloads/ApplicationReputation.h @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef ApplicationReputation_h__ +#define ApplicationReputation_h__ + +#include "nsIApplicationReputation.h" +#include "nsIRequestObserver.h" +#include "nsIStreamListener.h" +#include "nsISupports.h" + +#include "nsCOMPtr.h" +#include "nsString.h" + +class nsIApplicationReputationListener; +class nsIChannel; +class nsIObserverService; +class nsIRequest; +class PRLogModuleInfo; + +class ApplicationReputationService MOZ_FINAL : + public nsIApplicationReputationService { +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIAPPLICATIONREPUTATIONSERVICE + +public: + static ApplicationReputationService* GetSingleton(); + +private: + /** + * Global singleton object for holding this factory service. + */ + static ApplicationReputationService* gApplicationReputationService; + + ApplicationReputationService(); + ~ApplicationReputationService(); + + /** + * Wrapper function for QueryReputation that makes it easier to ensure the + * callback is called. + */ + nsresult QueryReputationInternal(nsIApplicationReputationQuery* aQuery, + nsIApplicationReputationCallback* aCallback); +}; + +/** + * This class implements nsIApplicationReputation. See the + * nsIApplicationReputation.idl for details. ApplicationReputation also + * implements nsIStreamListener because it calls nsIChannel->AsyncOpen. + */ +class ApplicationReputationQuery MOZ_FINAL : + public nsIApplicationReputationQuery, + public nsIStreamListener { +public: + NS_DECL_ISUPPORTS + NS_DECL_NSIREQUESTOBSERVER + NS_DECL_NSISTREAMLISTENER + NS_DECL_NSIAPPLICATIONREPUTATIONQUERY + + ApplicationReputationQuery(); + ~ApplicationReputationQuery(); + +private: + /** + * Corresponding member variables for the attributes in the IDL. + */ + nsString mSuggestedFileName; + nsCOMPtr mURI; + uint32_t mFileSize; + nsCString mSha256Hash; + + /** + * The callback for the request. + */ + nsCOMPtr mCallback; + + /** + * The response from the application reputation query. This is read in chunks + * as part of our nsIStreamListener implementation and may contain embedded + * NULLs. + */ + nsCString mResponse; + + /** + * Wrapper function for nsIStreamListener.onStopRequest to make it easy to + * guarantee calling the callback + */ + nsresult OnStopRequestInternal(nsIRequest *aRequest, + nsISupports *aContext, + nsresult aResult, + bool* aShouldBlock); +}; + +#endif /* ApplicationReputation_h__ */ diff --git a/toolkit/components/downloads/Makefile.in b/toolkit/components/downloads/Makefile.in index 334c066fbf02..2ac02f985486 100644 --- a/toolkit/components/downloads/Makefile.in +++ b/toolkit/components/downloads/Makefile.in @@ -16,4 +16,8 @@ FAIL_ON_WARNINGS = 1 include $(topsrcdir)/config/rules.mk -CXXFLAGS += $(TK_CFLAGS) +CXXFLAGS += $(TK_CFLAGS) -DGOOGLE_PROTOBUF_NO_RTTI + +LOCAL_INCLUDES += \ + -I$(srcdir)/../protobuf \ + $(NULL) diff --git a/toolkit/components/downloads/csd.pb.cc b/toolkit/components/downloads/csd.pb.cc new file mode 100644 index 000000000000..b430183c0471 --- /dev/null +++ b/toolkit/components/downloads/csd.pb.cc @@ -0,0 +1,4309 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "csd.pb.h" + +#include + +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace safe_browsing { + +void protobuf_ShutdownFile_csd_2eproto() { + delete ClientPhishingRequest::default_instance_; + delete ClientPhishingRequest_Feature::default_instance_; + delete ClientPhishingResponse::default_instance_; + delete ClientMalwareRequest::default_instance_; + delete ClientMalwareRequest_Feature::default_instance_; + delete ClientMalwareResponse::default_instance_; + delete ClientDownloadRequest::default_instance_; + delete ClientDownloadRequest_Digests::default_instance_; + delete ClientDownloadRequest_Resource::default_instance_; + delete ClientDownloadRequest_CertificateChain::default_instance_; + delete ClientDownloadRequest_CertificateChain_Element::default_instance_; + delete ClientDownloadRequest_SignatureInfo::default_instance_; + delete ClientDownloadResponse::default_instance_; + delete ClientDownloadResponse_MoreInfo::default_instance_; + delete ClientDownloadReport::default_instance_; + delete ClientDownloadReport_UserInformation::default_instance_; + delete ClientUploadResponse::default_instance_; +} + +void protobuf_AddDesc_csd_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + ClientPhishingRequest::default_instance_ = new ClientPhishingRequest(); + ClientPhishingRequest_Feature::default_instance_ = new ClientPhishingRequest_Feature(); + ClientPhishingResponse::default_instance_ = new ClientPhishingResponse(); + ClientMalwareRequest::default_instance_ = new ClientMalwareRequest(); + ClientMalwareRequest_Feature::default_instance_ = new ClientMalwareRequest_Feature(); + ClientMalwareResponse::default_instance_ = new ClientMalwareResponse(); + ClientDownloadRequest::default_instance_ = new ClientDownloadRequest(); + ClientDownloadRequest_Digests::default_instance_ = new ClientDownloadRequest_Digests(); + ClientDownloadRequest_Resource::default_instance_ = new ClientDownloadRequest_Resource(); + ClientDownloadRequest_CertificateChain::default_instance_ = new ClientDownloadRequest_CertificateChain(); + ClientDownloadRequest_CertificateChain_Element::default_instance_ = new ClientDownloadRequest_CertificateChain_Element(); + ClientDownloadRequest_SignatureInfo::default_instance_ = new ClientDownloadRequest_SignatureInfo(); + ClientDownloadResponse::default_instance_ = new ClientDownloadResponse(); + ClientDownloadResponse_MoreInfo::default_instance_ = new ClientDownloadResponse_MoreInfo(); + ClientDownloadReport::default_instance_ = new ClientDownloadReport(); + ClientDownloadReport_UserInformation::default_instance_ = new ClientDownloadReport_UserInformation(); + ClientUploadResponse::default_instance_ = new ClientUploadResponse(); + ClientPhishingRequest::default_instance_->InitAsDefaultInstance(); + ClientPhishingRequest_Feature::default_instance_->InitAsDefaultInstance(); + ClientPhishingResponse::default_instance_->InitAsDefaultInstance(); + ClientMalwareRequest::default_instance_->InitAsDefaultInstance(); + ClientMalwareRequest_Feature::default_instance_->InitAsDefaultInstance(); + ClientMalwareResponse::default_instance_->InitAsDefaultInstance(); + ClientDownloadRequest::default_instance_->InitAsDefaultInstance(); + ClientDownloadRequest_Digests::default_instance_->InitAsDefaultInstance(); + ClientDownloadRequest_Resource::default_instance_->InitAsDefaultInstance(); + ClientDownloadRequest_CertificateChain::default_instance_->InitAsDefaultInstance(); + ClientDownloadRequest_CertificateChain_Element::default_instance_->InitAsDefaultInstance(); + ClientDownloadRequest_SignatureInfo::default_instance_->InitAsDefaultInstance(); + ClientDownloadResponse::default_instance_->InitAsDefaultInstance(); + ClientDownloadResponse_MoreInfo::default_instance_->InitAsDefaultInstance(); + ClientDownloadReport::default_instance_->InitAsDefaultInstance(); + ClientDownloadReport_UserInformation::default_instance_->InitAsDefaultInstance(); + ClientUploadResponse::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_csd_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_csd_2eproto { + StaticDescriptorInitializer_csd_2eproto() { + protobuf_AddDesc_csd_2eproto(); + } +} static_descriptor_initializer_csd_2eproto_; + + +// =================================================================== + +#ifndef _MSC_VER +const int ClientPhishingRequest_Feature::kNameFieldNumber; +const int ClientPhishingRequest_Feature::kValueFieldNumber; +#endif // !_MSC_VER + +ClientPhishingRequest_Feature::ClientPhishingRequest_Feature() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientPhishingRequest_Feature::InitAsDefaultInstance() { +} + +ClientPhishingRequest_Feature::ClientPhishingRequest_Feature(const ClientPhishingRequest_Feature& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientPhishingRequest_Feature::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + value_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientPhishingRequest_Feature::~ClientPhishingRequest_Feature() { + SharedDtor(); +} + +void ClientPhishingRequest_Feature::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (this != default_instance_) { + } +} + +void ClientPhishingRequest_Feature::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientPhishingRequest_Feature& ClientPhishingRequest_Feature::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientPhishingRequest_Feature* ClientPhishingRequest_Feature::default_instance_ = NULL; + +ClientPhishingRequest_Feature* ClientPhishingRequest_Feature::New() const { + return new ClientPhishingRequest_Feature; +} + +void ClientPhishingRequest_Feature::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + value_ = 0; + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientPhishingRequest_Feature::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(17)) goto parse_value; + break; + } + + // required double value = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) { + parse_value: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( + input, &value_))); + set_has_value(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientPhishingRequest_Feature::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // required double value = 2; + if (has_value()) { + ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->value(), output); + } + +} + +int ClientPhishingRequest_Feature::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // required double value = 2; + if (has_value()) { + total_size += 1 + 8; + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientPhishingRequest_Feature::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientPhishingRequest_Feature::MergeFrom(const ClientPhishingRequest_Feature& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_value()) { + set_value(from.value()); + } + } +} + +void ClientPhishingRequest_Feature::CopyFrom(const ClientPhishingRequest_Feature& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientPhishingRequest_Feature::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void ClientPhishingRequest_Feature::Swap(ClientPhishingRequest_Feature* other) { + if (other != this) { + std::swap(name_, other->name_); + std::swap(value_, other->value_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientPhishingRequest_Feature::GetTypeName() const { + return "safe_browsing.ClientPhishingRequest.Feature"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientPhishingRequest::kUrlFieldNumber; +const int ClientPhishingRequest::kOBSOLETEHashPrefixFieldNumber; +const int ClientPhishingRequest::kClientScoreFieldNumber; +const int ClientPhishingRequest::kIsPhishingFieldNumber; +const int ClientPhishingRequest::kFeatureMapFieldNumber; +const int ClientPhishingRequest::kModelVersionFieldNumber; +const int ClientPhishingRequest::kNonModelFeatureMapFieldNumber; +const int ClientPhishingRequest::kOBSOLETEReferrerUrlFieldNumber; +#endif // !_MSC_VER + +ClientPhishingRequest::ClientPhishingRequest() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientPhishingRequest::InitAsDefaultInstance() { +} + +ClientPhishingRequest::ClientPhishingRequest(const ClientPhishingRequest& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientPhishingRequest::SharedCtor() { + _cached_size_ = 0; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + obsolete_hash_prefix_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + client_score_ = 0; + is_phishing_ = false; + model_version_ = 0; + obsolete_referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientPhishingRequest::~ClientPhishingRequest() { + SharedDtor(); +} + +void ClientPhishingRequest::SharedDtor() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + delete url_; + } + if (obsolete_hash_prefix_ != &::google::protobuf::internal::kEmptyString) { + delete obsolete_hash_prefix_; + } + if (obsolete_referrer_url_ != &::google::protobuf::internal::kEmptyString) { + delete obsolete_referrer_url_; + } + if (this != default_instance_) { + } +} + +void ClientPhishingRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientPhishingRequest& ClientPhishingRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientPhishingRequest* ClientPhishingRequest::default_instance_ = NULL; + +ClientPhishingRequest* ClientPhishingRequest::New() const { + return new ClientPhishingRequest; +} + +void ClientPhishingRequest::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_url()) { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + } + if (has_obsolete_hash_prefix()) { + if (obsolete_hash_prefix_ != &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_->clear(); + } + } + client_score_ = 0; + is_phishing_ = false; + model_version_ = 0; + if (has_obsolete_referrer_url()) { + if (obsolete_referrer_url_ != &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_->clear(); + } + } + } + feature_map_.Clear(); + non_model_feature_map_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientPhishingRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string url = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(21)) goto parse_client_score; + break; + } + + // required float client_score = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) { + parse_client_score: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( + input, &client_score_))); + set_has_client_score(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(32)) goto parse_is_phishing; + break; + } + + // optional bool is_phishing = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_is_phishing: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &is_phishing_))); + set_has_is_phishing(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_feature_map; + break; + } + + // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_feature_map: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_feature_map())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_feature_map; + if (input->ExpectTag(48)) goto parse_model_version; + break; + } + + // optional int32 model_version = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_model_version: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &model_version_))); + set_has_model_version(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(66)) goto parse_non_model_feature_map; + break; + } + + // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_non_model_feature_map: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_non_model_feature_map())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(66)) goto parse_non_model_feature_map; + if (input->ExpectTag(74)) goto parse_OBSOLETE_referrer_url; + break; + } + + // optional string OBSOLETE_referrer_url = 9; + case 9: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_OBSOLETE_referrer_url: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_obsolete_referrer_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(82)) goto parse_OBSOLETE_hash_prefix; + break; + } + + // optional bytes OBSOLETE_hash_prefix = 10; + case 10: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_OBSOLETE_hash_prefix: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_obsolete_hash_prefix())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientPhishingRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string url = 1; + if (has_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->url(), output); + } + + // required float client_score = 2; + if (has_client_score()) { + ::google::protobuf::internal::WireFormatLite::WriteFloat(2, this->client_score(), output); + } + + // optional bool is_phishing = 4; + if (has_is_phishing()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(4, this->is_phishing(), output); + } + + // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; + for (int i = 0; i < this->feature_map_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 5, this->feature_map(i), output); + } + + // optional int32 model_version = 6; + if (has_model_version()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->model_version(), output); + } + + // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; + for (int i = 0; i < this->non_model_feature_map_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 8, this->non_model_feature_map(i), output); + } + + // optional string OBSOLETE_referrer_url = 9; + if (has_obsolete_referrer_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 9, this->obsolete_referrer_url(), output); + } + + // optional bytes OBSOLETE_hash_prefix = 10; + if (has_obsolete_hash_prefix()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 10, this->obsolete_hash_prefix(), output); + } + +} + +int ClientPhishingRequest::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string url = 1; + if (has_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->url()); + } + + // optional bytes OBSOLETE_hash_prefix = 10; + if (has_obsolete_hash_prefix()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->obsolete_hash_prefix()); + } + + // required float client_score = 2; + if (has_client_score()) { + total_size += 1 + 4; + } + + // optional bool is_phishing = 4; + if (has_is_phishing()) { + total_size += 1 + 1; + } + + // optional int32 model_version = 6; + if (has_model_version()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->model_version()); + } + + // optional string OBSOLETE_referrer_url = 9; + if (has_obsolete_referrer_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->obsolete_referrer_url()); + } + + } + // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; + total_size += 1 * this->feature_map_size(); + for (int i = 0; i < this->feature_map_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->feature_map(i)); + } + + // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; + total_size += 1 * this->non_model_feature_map_size(); + for (int i = 0; i < this->non_model_feature_map_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->non_model_feature_map(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientPhishingRequest::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientPhishingRequest::MergeFrom(const ClientPhishingRequest& from) { + GOOGLE_CHECK_NE(&from, this); + feature_map_.MergeFrom(from.feature_map_); + non_model_feature_map_.MergeFrom(from.non_model_feature_map_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_url()) { + set_url(from.url()); + } + if (from.has_obsolete_hash_prefix()) { + set_obsolete_hash_prefix(from.obsolete_hash_prefix()); + } + if (from.has_client_score()) { + set_client_score(from.client_score()); + } + if (from.has_is_phishing()) { + set_is_phishing(from.is_phishing()); + } + if (from.has_model_version()) { + set_model_version(from.model_version()); + } + if (from.has_obsolete_referrer_url()) { + set_obsolete_referrer_url(from.obsolete_referrer_url()); + } + } +} + +void ClientPhishingRequest::CopyFrom(const ClientPhishingRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientPhishingRequest::IsInitialized() const { + if ((_has_bits_[0] & 0x00000004) != 0x00000004) return false; + + for (int i = 0; i < feature_map_size(); i++) { + if (!this->feature_map(i).IsInitialized()) return false; + } + for (int i = 0; i < non_model_feature_map_size(); i++) { + if (!this->non_model_feature_map(i).IsInitialized()) return false; + } + return true; +} + +void ClientPhishingRequest::Swap(ClientPhishingRequest* other) { + if (other != this) { + std::swap(url_, other->url_); + std::swap(obsolete_hash_prefix_, other->obsolete_hash_prefix_); + std::swap(client_score_, other->client_score_); + std::swap(is_phishing_, other->is_phishing_); + feature_map_.Swap(&other->feature_map_); + std::swap(model_version_, other->model_version_); + non_model_feature_map_.Swap(&other->non_model_feature_map_); + std::swap(obsolete_referrer_url_, other->obsolete_referrer_url_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientPhishingRequest::GetTypeName() const { + return "safe_browsing.ClientPhishingRequest"; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int ClientPhishingResponse::kPhishyFieldNumber; +const int ClientPhishingResponse::kOBSOLETEWhitelistExpressionFieldNumber; +#endif // !_MSC_VER + +ClientPhishingResponse::ClientPhishingResponse() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientPhishingResponse::InitAsDefaultInstance() { +} + +ClientPhishingResponse::ClientPhishingResponse(const ClientPhishingResponse& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientPhishingResponse::SharedCtor() { + _cached_size_ = 0; + phishy_ = false; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientPhishingResponse::~ClientPhishingResponse() { + SharedDtor(); +} + +void ClientPhishingResponse::SharedDtor() { + if (this != default_instance_) { + } +} + +void ClientPhishingResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientPhishingResponse& ClientPhishingResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientPhishingResponse* ClientPhishingResponse::default_instance_ = NULL; + +ClientPhishingResponse* ClientPhishingResponse::New() const { + return new ClientPhishingResponse; +} + +void ClientPhishingResponse::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + phishy_ = false; + } + obsolete_whitelist_expression_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientPhishingResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required bool phishy = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &phishy_))); + set_has_phishy(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_OBSOLETE_whitelist_expression; + break; + } + + // repeated string OBSOLETE_whitelist_expression = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_OBSOLETE_whitelist_expression: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_obsolete_whitelist_expression())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_OBSOLETE_whitelist_expression; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientPhishingResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required bool phishy = 1; + if (has_phishy()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->phishy(), output); + } + + // repeated string OBSOLETE_whitelist_expression = 2; + for (int i = 0; i < this->obsolete_whitelist_expression_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->obsolete_whitelist_expression(i), output); + } + +} + +int ClientPhishingResponse::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required bool phishy = 1; + if (has_phishy()) { + total_size += 1 + 1; + } + + } + // repeated string OBSOLETE_whitelist_expression = 2; + total_size += 1 * this->obsolete_whitelist_expression_size(); + for (int i = 0; i < this->obsolete_whitelist_expression_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->obsolete_whitelist_expression(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientPhishingResponse::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientPhishingResponse::MergeFrom(const ClientPhishingResponse& from) { + GOOGLE_CHECK_NE(&from, this); + obsolete_whitelist_expression_.MergeFrom(from.obsolete_whitelist_expression_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_phishy()) { + set_phishy(from.phishy()); + } + } +} + +void ClientPhishingResponse::CopyFrom(const ClientPhishingResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientPhishingResponse::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; + + return true; +} + +void ClientPhishingResponse::Swap(ClientPhishingResponse* other) { + if (other != this) { + std::swap(phishy_, other->phishy_); + obsolete_whitelist_expression_.Swap(&other->obsolete_whitelist_expression_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientPhishingResponse::GetTypeName() const { + return "safe_browsing.ClientPhishingResponse"; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int ClientMalwareRequest_Feature::kNameFieldNumber; +const int ClientMalwareRequest_Feature::kValueFieldNumber; +const int ClientMalwareRequest_Feature::kMetainfoFieldNumber; +#endif // !_MSC_VER + +ClientMalwareRequest_Feature::ClientMalwareRequest_Feature() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientMalwareRequest_Feature::InitAsDefaultInstance() { +} + +ClientMalwareRequest_Feature::ClientMalwareRequest_Feature(const ClientMalwareRequest_Feature& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientMalwareRequest_Feature::SharedCtor() { + _cached_size_ = 0; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + value_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientMalwareRequest_Feature::~ClientMalwareRequest_Feature() { + SharedDtor(); +} + +void ClientMalwareRequest_Feature::SharedDtor() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + delete name_; + } + if (this != default_instance_) { + } +} + +void ClientMalwareRequest_Feature::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientMalwareRequest_Feature& ClientMalwareRequest_Feature::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientMalwareRequest_Feature* ClientMalwareRequest_Feature::default_instance_ = NULL; + +ClientMalwareRequest_Feature* ClientMalwareRequest_Feature::New() const { + return new ClientMalwareRequest_Feature; +} + +void ClientMalwareRequest_Feature::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_name()) { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + } + value_ = 0; + } + metainfo_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientMalwareRequest_Feature::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required string name = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_name())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(17)) goto parse_value; + break; + } + + // required double value = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) { + parse_value: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>( + input, &value_))); + set_has_value(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_metainfo; + break; + } + + // repeated string metainfo = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_metainfo: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->add_metainfo())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_metainfo; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientMalwareRequest_Feature::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required string name = 1; + if (has_name()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->name(), output); + } + + // required double value = 2; + if (has_value()) { + ::google::protobuf::internal::WireFormatLite::WriteDouble(2, this->value(), output); + } + + // repeated string metainfo = 3; + for (int i = 0; i < this->metainfo_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 3, this->metainfo(i), output); + } + +} + +int ClientMalwareRequest_Feature::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required string name = 1; + if (has_name()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->name()); + } + + // required double value = 2; + if (has_value()) { + total_size += 1 + 8; + } + + } + // repeated string metainfo = 3; + total_size += 1 * this->metainfo_size(); + for (int i = 0; i < this->metainfo_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::StringSize( + this->metainfo(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientMalwareRequest_Feature::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientMalwareRequest_Feature::MergeFrom(const ClientMalwareRequest_Feature& from) { + GOOGLE_CHECK_NE(&from, this); + metainfo_.MergeFrom(from.metainfo_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_name()) { + set_name(from.name()); + } + if (from.has_value()) { + set_value(from.value()); + } + } +} + +void ClientMalwareRequest_Feature::CopyFrom(const ClientMalwareRequest_Feature& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientMalwareRequest_Feature::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void ClientMalwareRequest_Feature::Swap(ClientMalwareRequest_Feature* other) { + if (other != this) { + std::swap(name_, other->name_); + std::swap(value_, other->value_); + metainfo_.Swap(&other->metainfo_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientMalwareRequest_Feature::GetTypeName() const { + return "safe_browsing.ClientMalwareRequest.Feature"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientMalwareRequest::kUrlFieldNumber; +const int ClientMalwareRequest::kFeatureMapFieldNumber; +const int ClientMalwareRequest::kReferrerUrlFieldNumber; +#endif // !_MSC_VER + +ClientMalwareRequest::ClientMalwareRequest() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientMalwareRequest::InitAsDefaultInstance() { +} + +ClientMalwareRequest::ClientMalwareRequest(const ClientMalwareRequest& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientMalwareRequest::SharedCtor() { + _cached_size_ = 0; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientMalwareRequest::~ClientMalwareRequest() { + SharedDtor(); +} + +void ClientMalwareRequest::SharedDtor() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + delete url_; + } + if (referrer_url_ != &::google::protobuf::internal::kEmptyString) { + delete referrer_url_; + } + if (this != default_instance_) { + } +} + +void ClientMalwareRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientMalwareRequest& ClientMalwareRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientMalwareRequest* ClientMalwareRequest::default_instance_ = NULL; + +ClientMalwareRequest* ClientMalwareRequest::New() const { + return new ClientMalwareRequest; +} + +void ClientMalwareRequest::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_url()) { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + } + if (has_referrer_url()) { + if (referrer_url_ != &::google::protobuf::internal::kEmptyString) { + referrer_url_->clear(); + } + } + } + feature_map_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientMalwareRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required string url = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_feature_map; + break; + } + + // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_feature_map: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_feature_map())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_feature_map; + if (input->ExpectTag(34)) goto parse_referrer_url; + break; + } + + // optional string referrer_url = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_referrer_url: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_referrer_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientMalwareRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required string url = 1; + if (has_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->url(), output); + } + + // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; + for (int i = 0; i < this->feature_map_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, this->feature_map(i), output); + } + + // optional string referrer_url = 4; + if (has_referrer_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 4, this->referrer_url(), output); + } + +} + +int ClientMalwareRequest::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required string url = 1; + if (has_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->url()); + } + + // optional string referrer_url = 4; + if (has_referrer_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->referrer_url()); + } + + } + // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; + total_size += 1 * this->feature_map_size(); + for (int i = 0; i < this->feature_map_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->feature_map(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientMalwareRequest::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientMalwareRequest::MergeFrom(const ClientMalwareRequest& from) { + GOOGLE_CHECK_NE(&from, this); + feature_map_.MergeFrom(from.feature_map_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_url()) { + set_url(from.url()); + } + if (from.has_referrer_url()) { + set_referrer_url(from.referrer_url()); + } + } +} + +void ClientMalwareRequest::CopyFrom(const ClientMalwareRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientMalwareRequest::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; + + for (int i = 0; i < feature_map_size(); i++) { + if (!this->feature_map(i).IsInitialized()) return false; + } + return true; +} + +void ClientMalwareRequest::Swap(ClientMalwareRequest* other) { + if (other != this) { + std::swap(url_, other->url_); + feature_map_.Swap(&other->feature_map_); + std::swap(referrer_url_, other->referrer_url_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientMalwareRequest::GetTypeName() const { + return "safe_browsing.ClientMalwareRequest"; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int ClientMalwareResponse::kBlacklistFieldNumber; +const int ClientMalwareResponse::kBadIpFieldNumber; +#endif // !_MSC_VER + +ClientMalwareResponse::ClientMalwareResponse() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientMalwareResponse::InitAsDefaultInstance() { +} + +ClientMalwareResponse::ClientMalwareResponse(const ClientMalwareResponse& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientMalwareResponse::SharedCtor() { + _cached_size_ = 0; + blacklist_ = false; + bad_ip_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientMalwareResponse::~ClientMalwareResponse() { + SharedDtor(); +} + +void ClientMalwareResponse::SharedDtor() { + if (bad_ip_ != &::google::protobuf::internal::kEmptyString) { + delete bad_ip_; + } + if (this != default_instance_) { + } +} + +void ClientMalwareResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientMalwareResponse& ClientMalwareResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientMalwareResponse* ClientMalwareResponse::default_instance_ = NULL; + +ClientMalwareResponse* ClientMalwareResponse::New() const { + return new ClientMalwareResponse; +} + +void ClientMalwareResponse::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + blacklist_ = false; + if (has_bad_ip()) { + if (bad_ip_ != &::google::protobuf::internal::kEmptyString) { + bad_ip_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientMalwareResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required bool blacklist = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &blacklist_))); + set_has_blacklist(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_bad_ip; + break; + } + + // optional string bad_ip = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_bad_ip: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_bad_ip())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientMalwareResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required bool blacklist = 1; + if (has_blacklist()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(1, this->blacklist(), output); + } + + // optional string bad_ip = 2; + if (has_bad_ip()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->bad_ip(), output); + } + +} + +int ClientMalwareResponse::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required bool blacklist = 1; + if (has_blacklist()) { + total_size += 1 + 1; + } + + // optional string bad_ip = 2; + if (has_bad_ip()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->bad_ip()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientMalwareResponse::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientMalwareResponse::MergeFrom(const ClientMalwareResponse& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_blacklist()) { + set_blacklist(from.blacklist()); + } + if (from.has_bad_ip()) { + set_bad_ip(from.bad_ip()); + } + } +} + +void ClientMalwareResponse::CopyFrom(const ClientMalwareResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientMalwareResponse::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; + + return true; +} + +void ClientMalwareResponse::Swap(ClientMalwareResponse* other) { + if (other != this) { + std::swap(blacklist_, other->blacklist_); + std::swap(bad_ip_, other->bad_ip_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientMalwareResponse::GetTypeName() const { + return "safe_browsing.ClientMalwareResponse"; +} + + +// =================================================================== + +bool ClientDownloadRequest_ResourceType_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const ClientDownloadRequest_ResourceType ClientDownloadRequest::DOWNLOAD_URL; +const ClientDownloadRequest_ResourceType ClientDownloadRequest::DOWNLOAD_REDIRECT; +const ClientDownloadRequest_ResourceType ClientDownloadRequest::TAB_URL; +const ClientDownloadRequest_ResourceType ClientDownloadRequest::TAB_REDIRECT; +const ClientDownloadRequest_ResourceType ClientDownloadRequest::ResourceType_MIN; +const ClientDownloadRequest_ResourceType ClientDownloadRequest::ResourceType_MAX; +const int ClientDownloadRequest::ResourceType_ARRAYSIZE; +#endif // _MSC_VER +bool ClientDownloadRequest_DownloadType_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + case 3: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const ClientDownloadRequest_DownloadType ClientDownloadRequest::WIN_EXECUTABLE; +const ClientDownloadRequest_DownloadType ClientDownloadRequest::CHROME_EXTENSION; +const ClientDownloadRequest_DownloadType ClientDownloadRequest::ANDROID_APK; +const ClientDownloadRequest_DownloadType ClientDownloadRequest::ZIPPED_EXECUTABLE; +const ClientDownloadRequest_DownloadType ClientDownloadRequest::DownloadType_MIN; +const ClientDownloadRequest_DownloadType ClientDownloadRequest::DownloadType_MAX; +const int ClientDownloadRequest::DownloadType_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int ClientDownloadRequest_Digests::kSha256FieldNumber; +const int ClientDownloadRequest_Digests::kSha1FieldNumber; +const int ClientDownloadRequest_Digests::kMd5FieldNumber; +#endif // !_MSC_VER + +ClientDownloadRequest_Digests::ClientDownloadRequest_Digests() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadRequest_Digests::InitAsDefaultInstance() { +} + +ClientDownloadRequest_Digests::ClientDownloadRequest_Digests(const ClientDownloadRequest_Digests& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadRequest_Digests::SharedCtor() { + _cached_size_ = 0; + sha256_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + sha1_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + md5_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadRequest_Digests::~ClientDownloadRequest_Digests() { + SharedDtor(); +} + +void ClientDownloadRequest_Digests::SharedDtor() { + if (sha256_ != &::google::protobuf::internal::kEmptyString) { + delete sha256_; + } + if (sha1_ != &::google::protobuf::internal::kEmptyString) { + delete sha1_; + } + if (md5_ != &::google::protobuf::internal::kEmptyString) { + delete md5_; + } + if (this != default_instance_) { + } +} + +void ClientDownloadRequest_Digests::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadRequest_Digests& ClientDownloadRequest_Digests::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadRequest_Digests* ClientDownloadRequest_Digests::default_instance_ = NULL; + +ClientDownloadRequest_Digests* ClientDownloadRequest_Digests::New() const { + return new ClientDownloadRequest_Digests; +} + +void ClientDownloadRequest_Digests::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_sha256()) { + if (sha256_ != &::google::protobuf::internal::kEmptyString) { + sha256_->clear(); + } + } + if (has_sha1()) { + if (sha1_ != &::google::protobuf::internal::kEmptyString) { + sha1_->clear(); + } + } + if (has_md5()) { + if (md5_ != &::google::protobuf::internal::kEmptyString) { + md5_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadRequest_Digests::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional bytes sha256 = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_sha256())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_sha1; + break; + } + + // optional bytes sha1 = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_sha1: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_sha1())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_md5; + break; + } + + // optional bytes md5 = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_md5: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_md5())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadRequest_Digests::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional bytes sha256 = 1; + if (has_sha256()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 1, this->sha256(), output); + } + + // optional bytes sha1 = 2; + if (has_sha1()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 2, this->sha1(), output); + } + + // optional bytes md5 = 3; + if (has_md5()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 3, this->md5(), output); + } + +} + +int ClientDownloadRequest_Digests::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional bytes sha256 = 1; + if (has_sha256()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->sha256()); + } + + // optional bytes sha1 = 2; + if (has_sha1()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->sha1()); + } + + // optional bytes md5 = 3; + if (has_md5()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->md5()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadRequest_Digests::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadRequest_Digests::MergeFrom(const ClientDownloadRequest_Digests& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_sha256()) { + set_sha256(from.sha256()); + } + if (from.has_sha1()) { + set_sha1(from.sha1()); + } + if (from.has_md5()) { + set_md5(from.md5()); + } + } +} + +void ClientDownloadRequest_Digests::CopyFrom(const ClientDownloadRequest_Digests& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest_Digests::IsInitialized() const { + + return true; +} + +void ClientDownloadRequest_Digests::Swap(ClientDownloadRequest_Digests* other) { + if (other != this) { + std::swap(sha256_, other->sha256_); + std::swap(sha1_, other->sha1_); + std::swap(md5_, other->md5_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadRequest_Digests::GetTypeName() const { + return "safe_browsing.ClientDownloadRequest.Digests"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadRequest_Resource::kUrlFieldNumber; +const int ClientDownloadRequest_Resource::kTypeFieldNumber; +const int ClientDownloadRequest_Resource::kRemoteIpFieldNumber; +const int ClientDownloadRequest_Resource::kReferrerFieldNumber; +#endif // !_MSC_VER + +ClientDownloadRequest_Resource::ClientDownloadRequest_Resource() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadRequest_Resource::InitAsDefaultInstance() { +} + +ClientDownloadRequest_Resource::ClientDownloadRequest_Resource(const ClientDownloadRequest_Resource& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadRequest_Resource::SharedCtor() { + _cached_size_ = 0; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + type_ = 0; + remote_ip_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + referrer_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadRequest_Resource::~ClientDownloadRequest_Resource() { + SharedDtor(); +} + +void ClientDownloadRequest_Resource::SharedDtor() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + delete url_; + } + if (remote_ip_ != &::google::protobuf::internal::kEmptyString) { + delete remote_ip_; + } + if (referrer_ != &::google::protobuf::internal::kEmptyString) { + delete referrer_; + } + if (this != default_instance_) { + } +} + +void ClientDownloadRequest_Resource::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadRequest_Resource& ClientDownloadRequest_Resource::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadRequest_Resource* ClientDownloadRequest_Resource::default_instance_ = NULL; + +ClientDownloadRequest_Resource* ClientDownloadRequest_Resource::New() const { + return new ClientDownloadRequest_Resource; +} + +void ClientDownloadRequest_Resource::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_url()) { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + } + type_ = 0; + if (has_remote_ip()) { + if (remote_ip_ != &::google::protobuf::internal::kEmptyString) { + remote_ip_->clear(); + } + } + if (has_referrer()) { + if (referrer_ != &::google::protobuf::internal::kEmptyString) { + referrer_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadRequest_Resource::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required string url = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_type; + break; + } + + // required .safe_browsing.ClientDownloadRequest.ResourceType type = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_type: + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::safe_browsing::ClientDownloadRequest_ResourceType_IsValid(value)) { + set_type(static_cast< ::safe_browsing::ClientDownloadRequest_ResourceType >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_remote_ip; + break; + } + + // optional bytes remote_ip = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_remote_ip: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_remote_ip())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_referrer; + break; + } + + // optional string referrer = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_referrer: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_referrer())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadRequest_Resource::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required string url = 1; + if (has_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->url(), output); + } + + // required .safe_browsing.ClientDownloadRequest.ResourceType type = 2; + if (has_type()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 2, this->type(), output); + } + + // optional bytes remote_ip = 3; + if (has_remote_ip()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 3, this->remote_ip(), output); + } + + // optional string referrer = 4; + if (has_referrer()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 4, this->referrer(), output); + } + +} + +int ClientDownloadRequest_Resource::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required string url = 1; + if (has_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->url()); + } + + // required .safe_browsing.ClientDownloadRequest.ResourceType type = 2; + if (has_type()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); + } + + // optional bytes remote_ip = 3; + if (has_remote_ip()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->remote_ip()); + } + + // optional string referrer = 4; + if (has_referrer()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->referrer()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadRequest_Resource::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadRequest_Resource::MergeFrom(const ClientDownloadRequest_Resource& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_url()) { + set_url(from.url()); + } + if (from.has_type()) { + set_type(from.type()); + } + if (from.has_remote_ip()) { + set_remote_ip(from.remote_ip()); + } + if (from.has_referrer()) { + set_referrer(from.referrer()); + } + } +} + +void ClientDownloadRequest_Resource::CopyFrom(const ClientDownloadRequest_Resource& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest_Resource::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void ClientDownloadRequest_Resource::Swap(ClientDownloadRequest_Resource* other) { + if (other != this) { + std::swap(url_, other->url_); + std::swap(type_, other->type_); + std::swap(remote_ip_, other->remote_ip_); + std::swap(referrer_, other->referrer_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadRequest_Resource::GetTypeName() const { + return "safe_browsing.ClientDownloadRequest.Resource"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadRequest_CertificateChain_Element::kCertificateFieldNumber; +#endif // !_MSC_VER + +ClientDownloadRequest_CertificateChain_Element::ClientDownloadRequest_CertificateChain_Element() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadRequest_CertificateChain_Element::InitAsDefaultInstance() { +} + +ClientDownloadRequest_CertificateChain_Element::ClientDownloadRequest_CertificateChain_Element(const ClientDownloadRequest_CertificateChain_Element& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadRequest_CertificateChain_Element::SharedCtor() { + _cached_size_ = 0; + certificate_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadRequest_CertificateChain_Element::~ClientDownloadRequest_CertificateChain_Element() { + SharedDtor(); +} + +void ClientDownloadRequest_CertificateChain_Element::SharedDtor() { + if (certificate_ != &::google::protobuf::internal::kEmptyString) { + delete certificate_; + } + if (this != default_instance_) { + } +} + +void ClientDownloadRequest_CertificateChain_Element::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadRequest_CertificateChain_Element& ClientDownloadRequest_CertificateChain_Element::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadRequest_CertificateChain_Element* ClientDownloadRequest_CertificateChain_Element::default_instance_ = NULL; + +ClientDownloadRequest_CertificateChain_Element* ClientDownloadRequest_CertificateChain_Element::New() const { + return new ClientDownloadRequest_CertificateChain_Element; +} + +void ClientDownloadRequest_CertificateChain_Element::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_certificate()) { + if (certificate_ != &::google::protobuf::internal::kEmptyString) { + certificate_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadRequest_CertificateChain_Element::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional bytes certificate = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_certificate())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadRequest_CertificateChain_Element::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional bytes certificate = 1; + if (has_certificate()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 1, this->certificate(), output); + } + +} + +int ClientDownloadRequest_CertificateChain_Element::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional bytes certificate = 1; + if (has_certificate()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->certificate()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadRequest_CertificateChain_Element::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadRequest_CertificateChain_Element::MergeFrom(const ClientDownloadRequest_CertificateChain_Element& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_certificate()) { + set_certificate(from.certificate()); + } + } +} + +void ClientDownloadRequest_CertificateChain_Element::CopyFrom(const ClientDownloadRequest_CertificateChain_Element& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest_CertificateChain_Element::IsInitialized() const { + + return true; +} + +void ClientDownloadRequest_CertificateChain_Element::Swap(ClientDownloadRequest_CertificateChain_Element* other) { + if (other != this) { + std::swap(certificate_, other->certificate_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadRequest_CertificateChain_Element::GetTypeName() const { + return "safe_browsing.ClientDownloadRequest.CertificateChain.Element"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadRequest_CertificateChain::kElementFieldNumber; +#endif // !_MSC_VER + +ClientDownloadRequest_CertificateChain::ClientDownloadRequest_CertificateChain() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadRequest_CertificateChain::InitAsDefaultInstance() { +} + +ClientDownloadRequest_CertificateChain::ClientDownloadRequest_CertificateChain(const ClientDownloadRequest_CertificateChain& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadRequest_CertificateChain::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadRequest_CertificateChain::~ClientDownloadRequest_CertificateChain() { + SharedDtor(); +} + +void ClientDownloadRequest_CertificateChain::SharedDtor() { + if (this != default_instance_) { + } +} + +void ClientDownloadRequest_CertificateChain::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadRequest_CertificateChain& ClientDownloadRequest_CertificateChain::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadRequest_CertificateChain* ClientDownloadRequest_CertificateChain::default_instance_ = NULL; + +ClientDownloadRequest_CertificateChain* ClientDownloadRequest_CertificateChain::New() const { + return new ClientDownloadRequest_CertificateChain; +} + +void ClientDownloadRequest_CertificateChain::Clear() { + element_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadRequest_CertificateChain::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .safe_browsing.ClientDownloadRequest.CertificateChain.Element element = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_element: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_element())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(10)) goto parse_element; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadRequest_CertificateChain::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .safe_browsing.ClientDownloadRequest.CertificateChain.Element element = 1; + for (int i = 0; i < this->element_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 1, this->element(i), output); + } + +} + +int ClientDownloadRequest_CertificateChain::ByteSize() const { + int total_size = 0; + + // repeated .safe_browsing.ClientDownloadRequest.CertificateChain.Element element = 1; + total_size += 1 * this->element_size(); + for (int i = 0; i < this->element_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->element(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadRequest_CertificateChain::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadRequest_CertificateChain::MergeFrom(const ClientDownloadRequest_CertificateChain& from) { + GOOGLE_CHECK_NE(&from, this); + element_.MergeFrom(from.element_); +} + +void ClientDownloadRequest_CertificateChain::CopyFrom(const ClientDownloadRequest_CertificateChain& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest_CertificateChain::IsInitialized() const { + + return true; +} + +void ClientDownloadRequest_CertificateChain::Swap(ClientDownloadRequest_CertificateChain* other) { + if (other != this) { + element_.Swap(&other->element_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadRequest_CertificateChain::GetTypeName() const { + return "safe_browsing.ClientDownloadRequest.CertificateChain"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadRequest_SignatureInfo::kCertificateChainFieldNumber; +const int ClientDownloadRequest_SignatureInfo::kTrustedFieldNumber; +#endif // !_MSC_VER + +ClientDownloadRequest_SignatureInfo::ClientDownloadRequest_SignatureInfo() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadRequest_SignatureInfo::InitAsDefaultInstance() { +} + +ClientDownloadRequest_SignatureInfo::ClientDownloadRequest_SignatureInfo(const ClientDownloadRequest_SignatureInfo& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadRequest_SignatureInfo::SharedCtor() { + _cached_size_ = 0; + trusted_ = false; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadRequest_SignatureInfo::~ClientDownloadRequest_SignatureInfo() { + SharedDtor(); +} + +void ClientDownloadRequest_SignatureInfo::SharedDtor() { + if (this != default_instance_) { + } +} + +void ClientDownloadRequest_SignatureInfo::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadRequest_SignatureInfo& ClientDownloadRequest_SignatureInfo::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadRequest_SignatureInfo* ClientDownloadRequest_SignatureInfo::default_instance_ = NULL; + +ClientDownloadRequest_SignatureInfo* ClientDownloadRequest_SignatureInfo::New() const { + return new ClientDownloadRequest_SignatureInfo; +} + +void ClientDownloadRequest_SignatureInfo::Clear() { + if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { + trusted_ = false; + } + certificate_chain_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadRequest_SignatureInfo::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .safe_browsing.ClientDownloadRequest.CertificateChain certificate_chain = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_certificate_chain: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_certificate_chain())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(10)) goto parse_certificate_chain; + if (input->ExpectTag(16)) goto parse_trusted; + break; + } + + // optional bool trusted = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_trusted: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &trusted_))); + set_has_trusted(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadRequest_SignatureInfo::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // repeated .safe_browsing.ClientDownloadRequest.CertificateChain certificate_chain = 1; + for (int i = 0; i < this->certificate_chain_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 1, this->certificate_chain(i), output); + } + + // optional bool trusted = 2; + if (has_trusted()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->trusted(), output); + } + +} + +int ClientDownloadRequest_SignatureInfo::ByteSize() const { + int total_size = 0; + + if (_has_bits_[1 / 32] & (0xffu << (1 % 32))) { + // optional bool trusted = 2; + if (has_trusted()) { + total_size += 1 + 1; + } + + } + // repeated .safe_browsing.ClientDownloadRequest.CertificateChain certificate_chain = 1; + total_size += 1 * this->certificate_chain_size(); + for (int i = 0; i < this->certificate_chain_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->certificate_chain(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadRequest_SignatureInfo::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadRequest_SignatureInfo::MergeFrom(const ClientDownloadRequest_SignatureInfo& from) { + GOOGLE_CHECK_NE(&from, this); + certificate_chain_.MergeFrom(from.certificate_chain_); + if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) { + if (from.has_trusted()) { + set_trusted(from.trusted()); + } + } +} + +void ClientDownloadRequest_SignatureInfo::CopyFrom(const ClientDownloadRequest_SignatureInfo& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest_SignatureInfo::IsInitialized() const { + + return true; +} + +void ClientDownloadRequest_SignatureInfo::Swap(ClientDownloadRequest_SignatureInfo* other) { + if (other != this) { + certificate_chain_.Swap(&other->certificate_chain_); + std::swap(trusted_, other->trusted_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadRequest_SignatureInfo::GetTypeName() const { + return "safe_browsing.ClientDownloadRequest.SignatureInfo"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadRequest::kUrlFieldNumber; +const int ClientDownloadRequest::kDigestsFieldNumber; +const int ClientDownloadRequest::kLengthFieldNumber; +const int ClientDownloadRequest::kResourcesFieldNumber; +const int ClientDownloadRequest::kSignatureFieldNumber; +const int ClientDownloadRequest::kUserInitiatedFieldNumber; +const int ClientDownloadRequest::kFileBasenameFieldNumber; +const int ClientDownloadRequest::kDownloadTypeFieldNumber; +const int ClientDownloadRequest::kLocaleFieldNumber; +#endif // !_MSC_VER + +ClientDownloadRequest::ClientDownloadRequest() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadRequest::InitAsDefaultInstance() { + digests_ = const_cast< ::safe_browsing::ClientDownloadRequest_Digests*>(&::safe_browsing::ClientDownloadRequest_Digests::default_instance()); + signature_ = const_cast< ::safe_browsing::ClientDownloadRequest_SignatureInfo*>(&::safe_browsing::ClientDownloadRequest_SignatureInfo::default_instance()); +} + +ClientDownloadRequest::ClientDownloadRequest(const ClientDownloadRequest& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadRequest::SharedCtor() { + _cached_size_ = 0; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + digests_ = NULL; + length_ = GOOGLE_LONGLONG(0); + signature_ = NULL; + user_initiated_ = false; + file_basename_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + download_type_ = 0; + locale_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadRequest::~ClientDownloadRequest() { + SharedDtor(); +} + +void ClientDownloadRequest::SharedDtor() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + delete url_; + } + if (file_basename_ != &::google::protobuf::internal::kEmptyString) { + delete file_basename_; + } + if (locale_ != &::google::protobuf::internal::kEmptyString) { + delete locale_; + } + if (this != default_instance_) { + delete digests_; + delete signature_; + } +} + +void ClientDownloadRequest::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadRequest& ClientDownloadRequest::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadRequest* ClientDownloadRequest::default_instance_ = NULL; + +ClientDownloadRequest* ClientDownloadRequest::New() const { + return new ClientDownloadRequest; +} + +void ClientDownloadRequest::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_url()) { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + } + if (has_digests()) { + if (digests_ != NULL) digests_->::safe_browsing::ClientDownloadRequest_Digests::Clear(); + } + length_ = GOOGLE_LONGLONG(0); + if (has_signature()) { + if (signature_ != NULL) signature_->::safe_browsing::ClientDownloadRequest_SignatureInfo::Clear(); + } + user_initiated_ = false; + if (has_file_basename()) { + if (file_basename_ != &::google::protobuf::internal::kEmptyString) { + file_basename_->clear(); + } + } + download_type_ = 0; + } + if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { + if (has_locale()) { + if (locale_ != &::google::protobuf::internal::kEmptyString) { + locale_->clear(); + } + } + } + resources_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadRequest::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required string url = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_digests; + break; + } + + // required .safe_browsing.ClientDownloadRequest.Digests digests = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_digests: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_digests())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_length; + break; + } + + // required int64 length = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_length: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &length_))); + set_has_length(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_resources; + break; + } + + // repeated .safe_browsing.ClientDownloadRequest.Resource resources = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_resources: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_resources())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_resources; + if (input->ExpectTag(42)) goto parse_signature; + break; + } + + // optional .safe_browsing.ClientDownloadRequest.SignatureInfo signature = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_signature: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_signature())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(48)) goto parse_user_initiated; + break; + } + + // optional bool user_initiated = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_user_initiated: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &user_initiated_))); + set_has_user_initiated(); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(74)) goto parse_file_basename; + break; + } + + // optional string file_basename = 9; + case 9: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_file_basename: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_file_basename())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(80)) goto parse_download_type; + break; + } + + // optional .safe_browsing.ClientDownloadRequest.DownloadType download_type = 10 [default = WIN_EXECUTABLE]; + case 10: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_download_type: + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::safe_browsing::ClientDownloadRequest_DownloadType_IsValid(value)) { + set_download_type(static_cast< ::safe_browsing::ClientDownloadRequest_DownloadType >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(90)) goto parse_locale; + break; + } + + // optional string locale = 11; + case 11: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_locale: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_locale())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadRequest::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required string url = 1; + if (has_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->url(), output); + } + + // required .safe_browsing.ClientDownloadRequest.Digests digests = 2; + if (has_digests()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, this->digests(), output); + } + + // required int64 length = 3; + if (has_length()) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(3, this->length(), output); + } + + // repeated .safe_browsing.ClientDownloadRequest.Resource resources = 4; + for (int i = 0; i < this->resources_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 4, this->resources(i), output); + } + + // optional .safe_browsing.ClientDownloadRequest.SignatureInfo signature = 5; + if (has_signature()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 5, this->signature(), output); + } + + // optional bool user_initiated = 6; + if (has_user_initiated()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(6, this->user_initiated(), output); + } + + // optional string file_basename = 9; + if (has_file_basename()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 9, this->file_basename(), output); + } + + // optional .safe_browsing.ClientDownloadRequest.DownloadType download_type = 10 [default = WIN_EXECUTABLE]; + if (has_download_type()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 10, this->download_type(), output); + } + + // optional string locale = 11; + if (has_locale()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 11, this->locale(), output); + } + +} + +int ClientDownloadRequest::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required string url = 1; + if (has_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->url()); + } + + // required .safe_browsing.ClientDownloadRequest.Digests digests = 2; + if (has_digests()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->digests()); + } + + // required int64 length = 3; + if (has_length()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->length()); + } + + // optional .safe_browsing.ClientDownloadRequest.SignatureInfo signature = 5; + if (has_signature()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->signature()); + } + + // optional bool user_initiated = 6; + if (has_user_initiated()) { + total_size += 1 + 1; + } + + // optional string file_basename = 9; + if (has_file_basename()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->file_basename()); + } + + // optional .safe_browsing.ClientDownloadRequest.DownloadType download_type = 10 [default = WIN_EXECUTABLE]; + if (has_download_type()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->download_type()); + } + + } + if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { + // optional string locale = 11; + if (has_locale()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->locale()); + } + + } + // repeated .safe_browsing.ClientDownloadRequest.Resource resources = 4; + total_size += 1 * this->resources_size(); + for (int i = 0; i < this->resources_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->resources(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadRequest::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadRequest::MergeFrom(const ClientDownloadRequest& from) { + GOOGLE_CHECK_NE(&from, this); + resources_.MergeFrom(from.resources_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_url()) { + set_url(from.url()); + } + if (from.has_digests()) { + mutable_digests()->::safe_browsing::ClientDownloadRequest_Digests::MergeFrom(from.digests()); + } + if (from.has_length()) { + set_length(from.length()); + } + if (from.has_signature()) { + mutable_signature()->::safe_browsing::ClientDownloadRequest_SignatureInfo::MergeFrom(from.signature()); + } + if (from.has_user_initiated()) { + set_user_initiated(from.user_initiated()); + } + if (from.has_file_basename()) { + set_file_basename(from.file_basename()); + } + if (from.has_download_type()) { + set_download_type(from.download_type()); + } + } + if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) { + if (from.has_locale()) { + set_locale(from.locale()); + } + } +} + +void ClientDownloadRequest::CopyFrom(const ClientDownloadRequest& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadRequest::IsInitialized() const { + if ((_has_bits_[0] & 0x00000007) != 0x00000007) return false; + + for (int i = 0; i < resources_size(); i++) { + if (!this->resources(i).IsInitialized()) return false; + } + return true; +} + +void ClientDownloadRequest::Swap(ClientDownloadRequest* other) { + if (other != this) { + std::swap(url_, other->url_); + std::swap(digests_, other->digests_); + std::swap(length_, other->length_); + resources_.Swap(&other->resources_); + std::swap(signature_, other->signature_); + std::swap(user_initiated_, other->user_initiated_); + std::swap(file_basename_, other->file_basename_); + std::swap(download_type_, other->download_type_); + std::swap(locale_, other->locale_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadRequest::GetTypeName() const { + return "safe_browsing.ClientDownloadRequest"; +} + + +// =================================================================== + +bool ClientDownloadResponse_Verdict_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + case 3: + case 4: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const ClientDownloadResponse_Verdict ClientDownloadResponse::SAFE; +const ClientDownloadResponse_Verdict ClientDownloadResponse::DANGEROUS; +const ClientDownloadResponse_Verdict ClientDownloadResponse::UNCOMMON; +const ClientDownloadResponse_Verdict ClientDownloadResponse::POTENTIALLY_UNWANTED; +const ClientDownloadResponse_Verdict ClientDownloadResponse::DANGEROUS_HOST; +const ClientDownloadResponse_Verdict ClientDownloadResponse::Verdict_MIN; +const ClientDownloadResponse_Verdict ClientDownloadResponse::Verdict_MAX; +const int ClientDownloadResponse::Verdict_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int ClientDownloadResponse_MoreInfo::kDescriptionFieldNumber; +const int ClientDownloadResponse_MoreInfo::kUrlFieldNumber; +#endif // !_MSC_VER + +ClientDownloadResponse_MoreInfo::ClientDownloadResponse_MoreInfo() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadResponse_MoreInfo::InitAsDefaultInstance() { +} + +ClientDownloadResponse_MoreInfo::ClientDownloadResponse_MoreInfo(const ClientDownloadResponse_MoreInfo& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadResponse_MoreInfo::SharedCtor() { + _cached_size_ = 0; + description_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadResponse_MoreInfo::~ClientDownloadResponse_MoreInfo() { + SharedDtor(); +} + +void ClientDownloadResponse_MoreInfo::SharedDtor() { + if (description_ != &::google::protobuf::internal::kEmptyString) { + delete description_; + } + if (url_ != &::google::protobuf::internal::kEmptyString) { + delete url_; + } + if (this != default_instance_) { + } +} + +void ClientDownloadResponse_MoreInfo::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadResponse_MoreInfo& ClientDownloadResponse_MoreInfo::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadResponse_MoreInfo* ClientDownloadResponse_MoreInfo::default_instance_ = NULL; + +ClientDownloadResponse_MoreInfo* ClientDownloadResponse_MoreInfo::New() const { + return new ClientDownloadResponse_MoreInfo; +} + +void ClientDownloadResponse_MoreInfo::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_description()) { + if (description_ != &::google::protobuf::internal::kEmptyString) { + description_->clear(); + } + } + if (has_url()) { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadResponse_MoreInfo::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string description = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_description())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_url; + break; + } + + // optional string url = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_url: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_url())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadResponse_MoreInfo::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string description = 1; + if (has_description()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->description(), output); + } + + // optional string url = 2; + if (has_url()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->url(), output); + } + +} + +int ClientDownloadResponse_MoreInfo::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string description = 1; + if (has_description()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->description()); + } + + // optional string url = 2; + if (has_url()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->url()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadResponse_MoreInfo::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadResponse_MoreInfo::MergeFrom(const ClientDownloadResponse_MoreInfo& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_description()) { + set_description(from.description()); + } + if (from.has_url()) { + set_url(from.url()); + } + } +} + +void ClientDownloadResponse_MoreInfo::CopyFrom(const ClientDownloadResponse_MoreInfo& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadResponse_MoreInfo::IsInitialized() const { + + return true; +} + +void ClientDownloadResponse_MoreInfo::Swap(ClientDownloadResponse_MoreInfo* other) { + if (other != this) { + std::swap(description_, other->description_); + std::swap(url_, other->url_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadResponse_MoreInfo::GetTypeName() const { + return "safe_browsing.ClientDownloadResponse.MoreInfo"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadResponse::kVerdictFieldNumber; +const int ClientDownloadResponse::kMoreInfoFieldNumber; +const int ClientDownloadResponse::kTokenFieldNumber; +#endif // !_MSC_VER + +ClientDownloadResponse::ClientDownloadResponse() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadResponse::InitAsDefaultInstance() { + more_info_ = const_cast< ::safe_browsing::ClientDownloadResponse_MoreInfo*>(&::safe_browsing::ClientDownloadResponse_MoreInfo::default_instance()); +} + +ClientDownloadResponse::ClientDownloadResponse(const ClientDownloadResponse& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadResponse::SharedCtor() { + _cached_size_ = 0; + verdict_ = 0; + more_info_ = NULL; + token_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadResponse::~ClientDownloadResponse() { + SharedDtor(); +} + +void ClientDownloadResponse::SharedDtor() { + if (token_ != &::google::protobuf::internal::kEmptyString) { + delete token_; + } + if (this != default_instance_) { + delete more_info_; + } +} + +void ClientDownloadResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadResponse& ClientDownloadResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadResponse* ClientDownloadResponse::default_instance_ = NULL; + +ClientDownloadResponse* ClientDownloadResponse::New() const { + return new ClientDownloadResponse; +} + +void ClientDownloadResponse::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + verdict_ = 0; + if (has_more_info()) { + if (more_info_ != NULL) more_info_->::safe_browsing::ClientDownloadResponse_MoreInfo::Clear(); + } + if (has_token()) { + if (token_ != &::google::protobuf::internal::kEmptyString) { + token_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required .safe_browsing.ClientDownloadResponse.Verdict verdict = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::safe_browsing::ClientDownloadResponse_Verdict_IsValid(value)) { + set_verdict(static_cast< ::safe_browsing::ClientDownloadResponse_Verdict >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_more_info; + break; + } + + // optional .safe_browsing.ClientDownloadResponse.MoreInfo more_info = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_more_info: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_more_info())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_token; + break; + } + + // optional bytes token = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_token: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_token())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required .safe_browsing.ClientDownloadResponse.Verdict verdict = 1; + if (has_verdict()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->verdict(), output); + } + + // optional .safe_browsing.ClientDownloadResponse.MoreInfo more_info = 2; + if (has_more_info()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, this->more_info(), output); + } + + // optional bytes token = 3; + if (has_token()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 3, this->token(), output); + } + +} + +int ClientDownloadResponse::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required .safe_browsing.ClientDownloadResponse.Verdict verdict = 1; + if (has_verdict()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->verdict()); + } + + // optional .safe_browsing.ClientDownloadResponse.MoreInfo more_info = 2; + if (has_more_info()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->more_info()); + } + + // optional bytes token = 3; + if (has_token()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->token()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadResponse::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadResponse::MergeFrom(const ClientDownloadResponse& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_verdict()) { + set_verdict(from.verdict()); + } + if (from.has_more_info()) { + mutable_more_info()->::safe_browsing::ClientDownloadResponse_MoreInfo::MergeFrom(from.more_info()); + } + if (from.has_token()) { + set_token(from.token()); + } + } +} + +void ClientDownloadResponse::CopyFrom(const ClientDownloadResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadResponse::IsInitialized() const { + if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false; + + return true; +} + +void ClientDownloadResponse::Swap(ClientDownloadResponse* other) { + if (other != this) { + std::swap(verdict_, other->verdict_); + std::swap(more_info_, other->more_info_); + std::swap(token_, other->token_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadResponse::GetTypeName() const { + return "safe_browsing.ClientDownloadResponse"; +} + + +// =================================================================== + +bool ClientDownloadReport_Reason_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const ClientDownloadReport_Reason ClientDownloadReport::SHARE; +const ClientDownloadReport_Reason ClientDownloadReport::FALSE_POSITIVE; +const ClientDownloadReport_Reason ClientDownloadReport::APPEAL; +const ClientDownloadReport_Reason ClientDownloadReport::Reason_MIN; +const ClientDownloadReport_Reason ClientDownloadReport::Reason_MAX; +const int ClientDownloadReport::Reason_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int ClientDownloadReport_UserInformation::kEmailFieldNumber; +#endif // !_MSC_VER + +ClientDownloadReport_UserInformation::ClientDownloadReport_UserInformation() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadReport_UserInformation::InitAsDefaultInstance() { +} + +ClientDownloadReport_UserInformation::ClientDownloadReport_UserInformation(const ClientDownloadReport_UserInformation& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadReport_UserInformation::SharedCtor() { + _cached_size_ = 0; + email_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadReport_UserInformation::~ClientDownloadReport_UserInformation() { + SharedDtor(); +} + +void ClientDownloadReport_UserInformation::SharedDtor() { + if (email_ != &::google::protobuf::internal::kEmptyString) { + delete email_; + } + if (this != default_instance_) { + } +} + +void ClientDownloadReport_UserInformation::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadReport_UserInformation& ClientDownloadReport_UserInformation::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadReport_UserInformation* ClientDownloadReport_UserInformation::default_instance_ = NULL; + +ClientDownloadReport_UserInformation* ClientDownloadReport_UserInformation::New() const { + return new ClientDownloadReport_UserInformation; +} + +void ClientDownloadReport_UserInformation::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (has_email()) { + if (email_ != &::google::protobuf::internal::kEmptyString) { + email_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadReport_UserInformation::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional string email = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_email())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadReport_UserInformation::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional string email = 1; + if (has_email()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 1, this->email(), output); + } + +} + +int ClientDownloadReport_UserInformation::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional string email = 1; + if (has_email()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->email()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadReport_UserInformation::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadReport_UserInformation::MergeFrom(const ClientDownloadReport_UserInformation& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_email()) { + set_email(from.email()); + } + } +} + +void ClientDownloadReport_UserInformation::CopyFrom(const ClientDownloadReport_UserInformation& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadReport_UserInformation::IsInitialized() const { + + return true; +} + +void ClientDownloadReport_UserInformation::Swap(ClientDownloadReport_UserInformation* other) { + if (other != this) { + std::swap(email_, other->email_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadReport_UserInformation::GetTypeName() const { + return "safe_browsing.ClientDownloadReport.UserInformation"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int ClientDownloadReport::kReasonFieldNumber; +const int ClientDownloadReport::kDownloadRequestFieldNumber; +const int ClientDownloadReport::kUserInformationFieldNumber; +const int ClientDownloadReport::kCommentFieldNumber; +const int ClientDownloadReport::kDownloadResponseFieldNumber; +#endif // !_MSC_VER + +ClientDownloadReport::ClientDownloadReport() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientDownloadReport::InitAsDefaultInstance() { + download_request_ = const_cast< ::safe_browsing::ClientDownloadRequest*>(&::safe_browsing::ClientDownloadRequest::default_instance()); + user_information_ = const_cast< ::safe_browsing::ClientDownloadReport_UserInformation*>(&::safe_browsing::ClientDownloadReport_UserInformation::default_instance()); + download_response_ = const_cast< ::safe_browsing::ClientDownloadResponse*>(&::safe_browsing::ClientDownloadResponse::default_instance()); +} + +ClientDownloadReport::ClientDownloadReport(const ClientDownloadReport& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientDownloadReport::SharedCtor() { + _cached_size_ = 0; + reason_ = 0; + download_request_ = NULL; + user_information_ = NULL; + comment_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + download_response_ = NULL; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientDownloadReport::~ClientDownloadReport() { + SharedDtor(); +} + +void ClientDownloadReport::SharedDtor() { + if (comment_ != &::google::protobuf::internal::kEmptyString) { + delete comment_; + } + if (this != default_instance_) { + delete download_request_; + delete user_information_; + delete download_response_; + } +} + +void ClientDownloadReport::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientDownloadReport& ClientDownloadReport::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientDownloadReport* ClientDownloadReport::default_instance_ = NULL; + +ClientDownloadReport* ClientDownloadReport::New() const { + return new ClientDownloadReport; +} + +void ClientDownloadReport::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + reason_ = 0; + if (has_download_request()) { + if (download_request_ != NULL) download_request_->::safe_browsing::ClientDownloadRequest::Clear(); + } + if (has_user_information()) { + if (user_information_ != NULL) user_information_->::safe_browsing::ClientDownloadReport_UserInformation::Clear(); + } + if (has_comment()) { + if (comment_ != &::google::protobuf::internal::kEmptyString) { + comment_->clear(); + } + } + if (has_download_response()) { + if (download_response_ != NULL) download_response_->::safe_browsing::ClientDownloadResponse::Clear(); + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientDownloadReport::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::safe_browsing::ClientDownloadReport_Reason_IsValid(value)) { + set_reason(static_cast< ::safe_browsing::ClientDownloadReport_Reason >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_download_request; + break; + } + + // optional .safe_browsing.ClientDownloadRequest download_request = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_download_request: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_download_request())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_user_information; + break; + } + + // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_user_information: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_user_information())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(34)) goto parse_comment; + break; + } + + // optional bytes comment = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_comment: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->mutable_comment())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_download_response; + break; + } + + // optional .safe_browsing.ClientDownloadResponse download_response = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_download_response: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_download_response())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientDownloadReport::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; + if (has_reason()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->reason(), output); + } + + // optional .safe_browsing.ClientDownloadRequest download_request = 2; + if (has_download_request()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 2, this->download_request(), output); + } + + // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; + if (has_user_information()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 3, this->user_information(), output); + } + + // optional bytes comment = 4; + if (has_comment()) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 4, this->comment(), output); + } + + // optional .safe_browsing.ClientDownloadResponse download_response = 5; + if (has_download_response()) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 5, this->download_response(), output); + } + +} + +int ClientDownloadReport::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; + if (has_reason()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->reason()); + } + + // optional .safe_browsing.ClientDownloadRequest download_request = 2; + if (has_download_request()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->download_request()); + } + + // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; + if (has_user_information()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->user_information()); + } + + // optional bytes comment = 4; + if (has_comment()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::BytesSize( + this->comment()); + } + + // optional .safe_browsing.ClientDownloadResponse download_response = 5; + if (has_download_response()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->download_response()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientDownloadReport::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientDownloadReport::MergeFrom(const ClientDownloadReport& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_reason()) { + set_reason(from.reason()); + } + if (from.has_download_request()) { + mutable_download_request()->::safe_browsing::ClientDownloadRequest::MergeFrom(from.download_request()); + } + if (from.has_user_information()) { + mutable_user_information()->::safe_browsing::ClientDownloadReport_UserInformation::MergeFrom(from.user_information()); + } + if (from.has_comment()) { + set_comment(from.comment()); + } + if (from.has_download_response()) { + mutable_download_response()->::safe_browsing::ClientDownloadResponse::MergeFrom(from.download_response()); + } + } +} + +void ClientDownloadReport::CopyFrom(const ClientDownloadReport& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientDownloadReport::IsInitialized() const { + + if (has_download_request()) { + if (!this->download_request().IsInitialized()) return false; + } + if (has_download_response()) { + if (!this->download_response().IsInitialized()) return false; + } + return true; +} + +void ClientDownloadReport::Swap(ClientDownloadReport* other) { + if (other != this) { + std::swap(reason_, other->reason_); + std::swap(download_request_, other->download_request_); + std::swap(user_information_, other->user_information_); + std::swap(comment_, other->comment_); + std::swap(download_response_, other->download_response_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientDownloadReport::GetTypeName() const { + return "safe_browsing.ClientDownloadReport"; +} + + +// =================================================================== + +bool ClientUploadResponse_UploadStatus_IsValid(int value) { + switch(value) { + case 0: + case 1: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const ClientUploadResponse_UploadStatus ClientUploadResponse::SUCCESS; +const ClientUploadResponse_UploadStatus ClientUploadResponse::UPLOAD_FAILURE; +const ClientUploadResponse_UploadStatus ClientUploadResponse::UploadStatus_MIN; +const ClientUploadResponse_UploadStatus ClientUploadResponse::UploadStatus_MAX; +const int ClientUploadResponse::UploadStatus_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int ClientUploadResponse::kStatusFieldNumber; +const int ClientUploadResponse::kPermalinkFieldNumber; +#endif // !_MSC_VER + +ClientUploadResponse::ClientUploadResponse() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void ClientUploadResponse::InitAsDefaultInstance() { +} + +ClientUploadResponse::ClientUploadResponse(const ClientUploadResponse& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void ClientUploadResponse::SharedCtor() { + _cached_size_ = 0; + status_ = 0; + permalink_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ClientUploadResponse::~ClientUploadResponse() { + SharedDtor(); +} + +void ClientUploadResponse::SharedDtor() { + if (permalink_ != &::google::protobuf::internal::kEmptyString) { + delete permalink_; + } + if (this != default_instance_) { + } +} + +void ClientUploadResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ClientUploadResponse& ClientUploadResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_csd_2eproto(); return *default_instance_; +} + +ClientUploadResponse* ClientUploadResponse::default_instance_ = NULL; + +ClientUploadResponse* ClientUploadResponse::New() const { + return new ClientUploadResponse; +} + +void ClientUploadResponse::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + status_ = 0; + if (has_permalink()) { + if (permalink_ != &::google::protobuf::internal::kEmptyString) { + permalink_->clear(); + } + } + } + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool ClientUploadResponse::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::safe_browsing::ClientUploadResponse_UploadStatus_IsValid(value)) { + set_status(static_cast< ::safe_browsing::ClientUploadResponse_UploadStatus >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(18)) goto parse_permalink; + break; + } + + // optional string permalink = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_permalink: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_permalink())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void ClientUploadResponse::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; + if (has_status()) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->status(), output); + } + + // optional string permalink = 2; + if (has_permalink()) { + ::google::protobuf::internal::WireFormatLite::WriteString( + 2, this->permalink(), output); + } + +} + +int ClientUploadResponse::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; + if (has_status()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->status()); + } + + // optional string permalink = 2; + if (has_permalink()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->permalink()); + } + + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void ClientUploadResponse::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void ClientUploadResponse::MergeFrom(const ClientUploadResponse& from) { + GOOGLE_CHECK_NE(&from, this); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from.has_status()) { + set_status(from.status()); + } + if (from.has_permalink()) { + set_permalink(from.permalink()); + } + } +} + +void ClientUploadResponse::CopyFrom(const ClientUploadResponse& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool ClientUploadResponse::IsInitialized() const { + + return true; +} + +void ClientUploadResponse::Swap(ClientUploadResponse* other) { + if (other != this) { + std::swap(status_, other->status_); + std::swap(permalink_, other->permalink_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string ClientUploadResponse::GetTypeName() const { + return "safe_browsing.ClientUploadResponse"; +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace safe_browsing + +// @@protoc_insertion_point(global_scope) diff --git a/toolkit/components/downloads/csd.pb.h b/toolkit/components/downloads/csd.pb.h new file mode 100644 index 000000000000..5b963c993fa7 --- /dev/null +++ b/toolkit/components/downloads/csd.pb.h @@ -0,0 +1,4077 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: csd.proto + +#ifndef PROTOBUF_csd_2eproto__INCLUDED +#define PROTOBUF_csd_2eproto__INCLUDED + +#include + +#include + +#if GOOGLE_PROTOBUF_VERSION < 2004000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 2004001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace safe_browsing { + +// Internal implementation detail -- do not call these. +void protobuf_AddDesc_csd_2eproto(); +void protobuf_AssignDesc_csd_2eproto(); +void protobuf_ShutdownFile_csd_2eproto(); + +class ClientPhishingRequest; +class ClientPhishingRequest_Feature; +class ClientPhishingResponse; +class ClientMalwareRequest; +class ClientMalwareRequest_Feature; +class ClientMalwareResponse; +class ClientDownloadRequest; +class ClientDownloadRequest_Digests; +class ClientDownloadRequest_Resource; +class ClientDownloadRequest_CertificateChain; +class ClientDownloadRequest_CertificateChain_Element; +class ClientDownloadRequest_SignatureInfo; +class ClientDownloadResponse; +class ClientDownloadResponse_MoreInfo; +class ClientDownloadReport; +class ClientDownloadReport_UserInformation; +class ClientUploadResponse; + +enum ClientDownloadRequest_ResourceType { + ClientDownloadRequest_ResourceType_DOWNLOAD_URL = 0, + ClientDownloadRequest_ResourceType_DOWNLOAD_REDIRECT = 1, + ClientDownloadRequest_ResourceType_TAB_URL = 2, + ClientDownloadRequest_ResourceType_TAB_REDIRECT = 3 +}; +bool ClientDownloadRequest_ResourceType_IsValid(int value); +const ClientDownloadRequest_ResourceType ClientDownloadRequest_ResourceType_ResourceType_MIN = ClientDownloadRequest_ResourceType_DOWNLOAD_URL; +const ClientDownloadRequest_ResourceType ClientDownloadRequest_ResourceType_ResourceType_MAX = ClientDownloadRequest_ResourceType_TAB_REDIRECT; +const int ClientDownloadRequest_ResourceType_ResourceType_ARRAYSIZE = ClientDownloadRequest_ResourceType_ResourceType_MAX + 1; + +enum ClientDownloadRequest_DownloadType { + ClientDownloadRequest_DownloadType_WIN_EXECUTABLE = 0, + ClientDownloadRequest_DownloadType_CHROME_EXTENSION = 1, + ClientDownloadRequest_DownloadType_ANDROID_APK = 2, + ClientDownloadRequest_DownloadType_ZIPPED_EXECUTABLE = 3 +}; +bool ClientDownloadRequest_DownloadType_IsValid(int value); +const ClientDownloadRequest_DownloadType ClientDownloadRequest_DownloadType_DownloadType_MIN = ClientDownloadRequest_DownloadType_WIN_EXECUTABLE; +const ClientDownloadRequest_DownloadType ClientDownloadRequest_DownloadType_DownloadType_MAX = ClientDownloadRequest_DownloadType_ZIPPED_EXECUTABLE; +const int ClientDownloadRequest_DownloadType_DownloadType_ARRAYSIZE = ClientDownloadRequest_DownloadType_DownloadType_MAX + 1; + +enum ClientDownloadResponse_Verdict { + ClientDownloadResponse_Verdict_SAFE = 0, + ClientDownloadResponse_Verdict_DANGEROUS = 1, + ClientDownloadResponse_Verdict_UNCOMMON = 2, + ClientDownloadResponse_Verdict_POTENTIALLY_UNWANTED = 3, + ClientDownloadResponse_Verdict_DANGEROUS_HOST = 4 +}; +bool ClientDownloadResponse_Verdict_IsValid(int value); +const ClientDownloadResponse_Verdict ClientDownloadResponse_Verdict_Verdict_MIN = ClientDownloadResponse_Verdict_SAFE; +const ClientDownloadResponse_Verdict ClientDownloadResponse_Verdict_Verdict_MAX = ClientDownloadResponse_Verdict_DANGEROUS_HOST; +const int ClientDownloadResponse_Verdict_Verdict_ARRAYSIZE = ClientDownloadResponse_Verdict_Verdict_MAX + 1; + +enum ClientDownloadReport_Reason { + ClientDownloadReport_Reason_SHARE = 0, + ClientDownloadReport_Reason_FALSE_POSITIVE = 1, + ClientDownloadReport_Reason_APPEAL = 2 +}; +bool ClientDownloadReport_Reason_IsValid(int value); +const ClientDownloadReport_Reason ClientDownloadReport_Reason_Reason_MIN = ClientDownloadReport_Reason_SHARE; +const ClientDownloadReport_Reason ClientDownloadReport_Reason_Reason_MAX = ClientDownloadReport_Reason_APPEAL; +const int ClientDownloadReport_Reason_Reason_ARRAYSIZE = ClientDownloadReport_Reason_Reason_MAX + 1; + +enum ClientUploadResponse_UploadStatus { + ClientUploadResponse_UploadStatus_SUCCESS = 0, + ClientUploadResponse_UploadStatus_UPLOAD_FAILURE = 1 +}; +bool ClientUploadResponse_UploadStatus_IsValid(int value); +const ClientUploadResponse_UploadStatus ClientUploadResponse_UploadStatus_UploadStatus_MIN = ClientUploadResponse_UploadStatus_SUCCESS; +const ClientUploadResponse_UploadStatus ClientUploadResponse_UploadStatus_UploadStatus_MAX = ClientUploadResponse_UploadStatus_UPLOAD_FAILURE; +const int ClientUploadResponse_UploadStatus_UploadStatus_ARRAYSIZE = ClientUploadResponse_UploadStatus_UploadStatus_MAX + 1; + +// =================================================================== + +class ClientPhishingRequest_Feature : public ::google::protobuf::MessageLite { + public: + ClientPhishingRequest_Feature(); + virtual ~ClientPhishingRequest_Feature(); + + ClientPhishingRequest_Feature(const ClientPhishingRequest_Feature& from); + + inline ClientPhishingRequest_Feature& operator=(const ClientPhishingRequest_Feature& from) { + CopyFrom(from); + return *this; + } + + static const ClientPhishingRequest_Feature& default_instance(); + + void Swap(ClientPhishingRequest_Feature* other); + + // implements Message ---------------------------------------------- + + ClientPhishingRequest_Feature* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientPhishingRequest_Feature& from); + void MergeFrom(const ClientPhishingRequest_Feature& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // required double value = 2; + inline bool has_value() const; + inline void clear_value(); + static const int kValueFieldNumber = 2; + inline double value() const; + inline void set_value(double value); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientPhishingRequest.Feature) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_value(); + inline void clear_has_value(); + + ::std::string* name_; + double value_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientPhishingRequest_Feature* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientPhishingRequest : public ::google::protobuf::MessageLite { + public: + ClientPhishingRequest(); + virtual ~ClientPhishingRequest(); + + ClientPhishingRequest(const ClientPhishingRequest& from); + + inline ClientPhishingRequest& operator=(const ClientPhishingRequest& from) { + CopyFrom(from); + return *this; + } + + static const ClientPhishingRequest& default_instance(); + + void Swap(ClientPhishingRequest* other); + + // implements Message ---------------------------------------------- + + ClientPhishingRequest* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientPhishingRequest& from); + void MergeFrom(const ClientPhishingRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientPhishingRequest_Feature Feature; + + // accessors ------------------------------------------------------- + + // optional string url = 1; + inline bool has_url() const; + inline void clear_url(); + static const int kUrlFieldNumber = 1; + inline const ::std::string& url() const; + inline void set_url(const ::std::string& value); + inline void set_url(const char* value); + inline void set_url(const char* value, size_t size); + inline ::std::string* mutable_url(); + inline ::std::string* release_url(); + + // optional bytes OBSOLETE_hash_prefix = 10; + inline bool has_obsolete_hash_prefix() const; + inline void clear_obsolete_hash_prefix(); + static const int kOBSOLETEHashPrefixFieldNumber = 10; + inline const ::std::string& obsolete_hash_prefix() const; + inline void set_obsolete_hash_prefix(const ::std::string& value); + inline void set_obsolete_hash_prefix(const char* value); + inline void set_obsolete_hash_prefix(const void* value, size_t size); + inline ::std::string* mutable_obsolete_hash_prefix(); + inline ::std::string* release_obsolete_hash_prefix(); + + // required float client_score = 2; + inline bool has_client_score() const; + inline void clear_client_score(); + static const int kClientScoreFieldNumber = 2; + inline float client_score() const; + inline void set_client_score(float value); + + // optional bool is_phishing = 4; + inline bool has_is_phishing() const; + inline void clear_is_phishing(); + static const int kIsPhishingFieldNumber = 4; + inline bool is_phishing() const; + inline void set_is_phishing(bool value); + + // repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; + inline int feature_map_size() const; + inline void clear_feature_map(); + static const int kFeatureMapFieldNumber = 5; + inline const ::safe_browsing::ClientPhishingRequest_Feature& feature_map(int index) const; + inline ::safe_browsing::ClientPhishingRequest_Feature* mutable_feature_map(int index); + inline ::safe_browsing::ClientPhishingRequest_Feature* add_feature_map(); + inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& + feature_map() const; + inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* + mutable_feature_map(); + + // optional int32 model_version = 6; + inline bool has_model_version() const; + inline void clear_model_version(); + static const int kModelVersionFieldNumber = 6; + inline ::google::protobuf::int32 model_version() const; + inline void set_model_version(::google::protobuf::int32 value); + + // repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; + inline int non_model_feature_map_size() const; + inline void clear_non_model_feature_map(); + static const int kNonModelFeatureMapFieldNumber = 8; + inline const ::safe_browsing::ClientPhishingRequest_Feature& non_model_feature_map(int index) const; + inline ::safe_browsing::ClientPhishingRequest_Feature* mutable_non_model_feature_map(int index); + inline ::safe_browsing::ClientPhishingRequest_Feature* add_non_model_feature_map(); + inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& + non_model_feature_map() const; + inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* + mutable_non_model_feature_map(); + + // optional string OBSOLETE_referrer_url = 9; + inline bool has_obsolete_referrer_url() const; + inline void clear_obsolete_referrer_url(); + static const int kOBSOLETEReferrerUrlFieldNumber = 9; + inline const ::std::string& obsolete_referrer_url() const; + inline void set_obsolete_referrer_url(const ::std::string& value); + inline void set_obsolete_referrer_url(const char* value); + inline void set_obsolete_referrer_url(const char* value, size_t size); + inline ::std::string* mutable_obsolete_referrer_url(); + inline ::std::string* release_obsolete_referrer_url(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientPhishingRequest) + private: + inline void set_has_url(); + inline void clear_has_url(); + inline void set_has_obsolete_hash_prefix(); + inline void clear_has_obsolete_hash_prefix(); + inline void set_has_client_score(); + inline void clear_has_client_score(); + inline void set_has_is_phishing(); + inline void clear_has_is_phishing(); + inline void set_has_model_version(); + inline void clear_has_model_version(); + inline void set_has_obsolete_referrer_url(); + inline void clear_has_obsolete_referrer_url(); + + ::std::string* url_; + ::std::string* obsolete_hash_prefix_; + float client_score_; + bool is_phishing_; + ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature > feature_map_; + ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature > non_model_feature_map_; + ::std::string* obsolete_referrer_url_; + ::google::protobuf::int32 model_version_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientPhishingRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientPhishingResponse : public ::google::protobuf::MessageLite { + public: + ClientPhishingResponse(); + virtual ~ClientPhishingResponse(); + + ClientPhishingResponse(const ClientPhishingResponse& from); + + inline ClientPhishingResponse& operator=(const ClientPhishingResponse& from) { + CopyFrom(from); + return *this; + } + + static const ClientPhishingResponse& default_instance(); + + void Swap(ClientPhishingResponse* other); + + // implements Message ---------------------------------------------- + + ClientPhishingResponse* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientPhishingResponse& from); + void MergeFrom(const ClientPhishingResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required bool phishy = 1; + inline bool has_phishy() const; + inline void clear_phishy(); + static const int kPhishyFieldNumber = 1; + inline bool phishy() const; + inline void set_phishy(bool value); + + // repeated string OBSOLETE_whitelist_expression = 2; + inline int obsolete_whitelist_expression_size() const; + inline void clear_obsolete_whitelist_expression(); + static const int kOBSOLETEWhitelistExpressionFieldNumber = 2; + inline const ::std::string& obsolete_whitelist_expression(int index) const; + inline ::std::string* mutable_obsolete_whitelist_expression(int index); + inline void set_obsolete_whitelist_expression(int index, const ::std::string& value); + inline void set_obsolete_whitelist_expression(int index, const char* value); + inline void set_obsolete_whitelist_expression(int index, const char* value, size_t size); + inline ::std::string* add_obsolete_whitelist_expression(); + inline void add_obsolete_whitelist_expression(const ::std::string& value); + inline void add_obsolete_whitelist_expression(const char* value); + inline void add_obsolete_whitelist_expression(const char* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& obsolete_whitelist_expression() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_obsolete_whitelist_expression(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientPhishingResponse) + private: + inline void set_has_phishy(); + inline void clear_has_phishy(); + + ::google::protobuf::RepeatedPtrField< ::std::string> obsolete_whitelist_expression_; + bool phishy_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientPhishingResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientMalwareRequest_Feature : public ::google::protobuf::MessageLite { + public: + ClientMalwareRequest_Feature(); + virtual ~ClientMalwareRequest_Feature(); + + ClientMalwareRequest_Feature(const ClientMalwareRequest_Feature& from); + + inline ClientMalwareRequest_Feature& operator=(const ClientMalwareRequest_Feature& from) { + CopyFrom(from); + return *this; + } + + static const ClientMalwareRequest_Feature& default_instance(); + + void Swap(ClientMalwareRequest_Feature* other); + + // implements Message ---------------------------------------------- + + ClientMalwareRequest_Feature* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientMalwareRequest_Feature& from); + void MergeFrom(const ClientMalwareRequest_Feature& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required string name = 1; + inline bool has_name() const; + inline void clear_name(); + static const int kNameFieldNumber = 1; + inline const ::std::string& name() const; + inline void set_name(const ::std::string& value); + inline void set_name(const char* value); + inline void set_name(const char* value, size_t size); + inline ::std::string* mutable_name(); + inline ::std::string* release_name(); + + // required double value = 2; + inline bool has_value() const; + inline void clear_value(); + static const int kValueFieldNumber = 2; + inline double value() const; + inline void set_value(double value); + + // repeated string metainfo = 3; + inline int metainfo_size() const; + inline void clear_metainfo(); + static const int kMetainfoFieldNumber = 3; + inline const ::std::string& metainfo(int index) const; + inline ::std::string* mutable_metainfo(int index); + inline void set_metainfo(int index, const ::std::string& value); + inline void set_metainfo(int index, const char* value); + inline void set_metainfo(int index, const char* value, size_t size); + inline ::std::string* add_metainfo(); + inline void add_metainfo(const ::std::string& value); + inline void add_metainfo(const char* value); + inline void add_metainfo(const char* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& metainfo() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_metainfo(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientMalwareRequest.Feature) + private: + inline void set_has_name(); + inline void clear_has_name(); + inline void set_has_value(); + inline void clear_has_value(); + + ::std::string* name_; + double value_; + ::google::protobuf::RepeatedPtrField< ::std::string> metainfo_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientMalwareRequest_Feature* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientMalwareRequest : public ::google::protobuf::MessageLite { + public: + ClientMalwareRequest(); + virtual ~ClientMalwareRequest(); + + ClientMalwareRequest(const ClientMalwareRequest& from); + + inline ClientMalwareRequest& operator=(const ClientMalwareRequest& from) { + CopyFrom(from); + return *this; + } + + static const ClientMalwareRequest& default_instance(); + + void Swap(ClientMalwareRequest* other); + + // implements Message ---------------------------------------------- + + ClientMalwareRequest* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientMalwareRequest& from); + void MergeFrom(const ClientMalwareRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientMalwareRequest_Feature Feature; + + // accessors ------------------------------------------------------- + + // required string url = 1; + inline bool has_url() const; + inline void clear_url(); + static const int kUrlFieldNumber = 1; + inline const ::std::string& url() const; + inline void set_url(const ::std::string& value); + inline void set_url(const char* value); + inline void set_url(const char* value, size_t size); + inline ::std::string* mutable_url(); + inline ::std::string* release_url(); + + // repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; + inline int feature_map_size() const; + inline void clear_feature_map(); + static const int kFeatureMapFieldNumber = 2; + inline const ::safe_browsing::ClientMalwareRequest_Feature& feature_map(int index) const; + inline ::safe_browsing::ClientMalwareRequest_Feature* mutable_feature_map(int index); + inline ::safe_browsing::ClientMalwareRequest_Feature* add_feature_map(); + inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >& + feature_map() const; + inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >* + mutable_feature_map(); + + // optional string referrer_url = 4; + inline bool has_referrer_url() const; + inline void clear_referrer_url(); + static const int kReferrerUrlFieldNumber = 4; + inline const ::std::string& referrer_url() const; + inline void set_referrer_url(const ::std::string& value); + inline void set_referrer_url(const char* value); + inline void set_referrer_url(const char* value, size_t size); + inline ::std::string* mutable_referrer_url(); + inline ::std::string* release_referrer_url(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientMalwareRequest) + private: + inline void set_has_url(); + inline void clear_has_url(); + inline void set_has_referrer_url(); + inline void clear_has_referrer_url(); + + ::std::string* url_; + ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature > feature_map_; + ::std::string* referrer_url_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientMalwareRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientMalwareResponse : public ::google::protobuf::MessageLite { + public: + ClientMalwareResponse(); + virtual ~ClientMalwareResponse(); + + ClientMalwareResponse(const ClientMalwareResponse& from); + + inline ClientMalwareResponse& operator=(const ClientMalwareResponse& from) { + CopyFrom(from); + return *this; + } + + static const ClientMalwareResponse& default_instance(); + + void Swap(ClientMalwareResponse* other); + + // implements Message ---------------------------------------------- + + ClientMalwareResponse* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientMalwareResponse& from); + void MergeFrom(const ClientMalwareResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required bool blacklist = 1; + inline bool has_blacklist() const; + inline void clear_blacklist(); + static const int kBlacklistFieldNumber = 1; + inline bool blacklist() const; + inline void set_blacklist(bool value); + + // optional string bad_ip = 2; + inline bool has_bad_ip() const; + inline void clear_bad_ip(); + static const int kBadIpFieldNumber = 2; + inline const ::std::string& bad_ip() const; + inline void set_bad_ip(const ::std::string& value); + inline void set_bad_ip(const char* value); + inline void set_bad_ip(const char* value, size_t size); + inline ::std::string* mutable_bad_ip(); + inline ::std::string* release_bad_ip(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientMalwareResponse) + private: + inline void set_has_blacklist(); + inline void clear_has_blacklist(); + inline void set_has_bad_ip(); + inline void clear_has_bad_ip(); + + ::std::string* bad_ip_; + bool blacklist_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientMalwareResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadRequest_Digests : public ::google::protobuf::MessageLite { + public: + ClientDownloadRequest_Digests(); + virtual ~ClientDownloadRequest_Digests(); + + ClientDownloadRequest_Digests(const ClientDownloadRequest_Digests& from); + + inline ClientDownloadRequest_Digests& operator=(const ClientDownloadRequest_Digests& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadRequest_Digests& default_instance(); + + void Swap(ClientDownloadRequest_Digests* other); + + // implements Message ---------------------------------------------- + + ClientDownloadRequest_Digests* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadRequest_Digests& from); + void MergeFrom(const ClientDownloadRequest_Digests& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional bytes sha256 = 1; + inline bool has_sha256() const; + inline void clear_sha256(); + static const int kSha256FieldNumber = 1; + inline const ::std::string& sha256() const; + inline void set_sha256(const ::std::string& value); + inline void set_sha256(const char* value); + inline void set_sha256(const void* value, size_t size); + inline ::std::string* mutable_sha256(); + inline ::std::string* release_sha256(); + + // optional bytes sha1 = 2; + inline bool has_sha1() const; + inline void clear_sha1(); + static const int kSha1FieldNumber = 2; + inline const ::std::string& sha1() const; + inline void set_sha1(const ::std::string& value); + inline void set_sha1(const char* value); + inline void set_sha1(const void* value, size_t size); + inline ::std::string* mutable_sha1(); + inline ::std::string* release_sha1(); + + // optional bytes md5 = 3; + inline bool has_md5() const; + inline void clear_md5(); + static const int kMd5FieldNumber = 3; + inline const ::std::string& md5() const; + inline void set_md5(const ::std::string& value); + inline void set_md5(const char* value); + inline void set_md5(const void* value, size_t size); + inline ::std::string* mutable_md5(); + inline ::std::string* release_md5(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.Digests) + private: + inline void set_has_sha256(); + inline void clear_has_sha256(); + inline void set_has_sha1(); + inline void clear_has_sha1(); + inline void set_has_md5(); + inline void clear_has_md5(); + + ::std::string* sha256_; + ::std::string* sha1_; + ::std::string* md5_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadRequest_Digests* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadRequest_Resource : public ::google::protobuf::MessageLite { + public: + ClientDownloadRequest_Resource(); + virtual ~ClientDownloadRequest_Resource(); + + ClientDownloadRequest_Resource(const ClientDownloadRequest_Resource& from); + + inline ClientDownloadRequest_Resource& operator=(const ClientDownloadRequest_Resource& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadRequest_Resource& default_instance(); + + void Swap(ClientDownloadRequest_Resource* other); + + // implements Message ---------------------------------------------- + + ClientDownloadRequest_Resource* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadRequest_Resource& from); + void MergeFrom(const ClientDownloadRequest_Resource& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required string url = 1; + inline bool has_url() const; + inline void clear_url(); + static const int kUrlFieldNumber = 1; + inline const ::std::string& url() const; + inline void set_url(const ::std::string& value); + inline void set_url(const char* value); + inline void set_url(const char* value, size_t size); + inline ::std::string* mutable_url(); + inline ::std::string* release_url(); + + // required .safe_browsing.ClientDownloadRequest.ResourceType type = 2; + inline bool has_type() const; + inline void clear_type(); + static const int kTypeFieldNumber = 2; + inline ::safe_browsing::ClientDownloadRequest_ResourceType type() const; + inline void set_type(::safe_browsing::ClientDownloadRequest_ResourceType value); + + // optional bytes remote_ip = 3; + inline bool has_remote_ip() const; + inline void clear_remote_ip(); + static const int kRemoteIpFieldNumber = 3; + inline const ::std::string& remote_ip() const; + inline void set_remote_ip(const ::std::string& value); + inline void set_remote_ip(const char* value); + inline void set_remote_ip(const void* value, size_t size); + inline ::std::string* mutable_remote_ip(); + inline ::std::string* release_remote_ip(); + + // optional string referrer = 4; + inline bool has_referrer() const; + inline void clear_referrer(); + static const int kReferrerFieldNumber = 4; + inline const ::std::string& referrer() const; + inline void set_referrer(const ::std::string& value); + inline void set_referrer(const char* value); + inline void set_referrer(const char* value, size_t size); + inline ::std::string* mutable_referrer(); + inline ::std::string* release_referrer(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.Resource) + private: + inline void set_has_url(); + inline void clear_has_url(); + inline void set_has_type(); + inline void clear_has_type(); + inline void set_has_remote_ip(); + inline void clear_has_remote_ip(); + inline void set_has_referrer(); + inline void clear_has_referrer(); + + ::std::string* url_; + ::std::string* remote_ip_; + ::std::string* referrer_; + int type_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadRequest_Resource* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadRequest_CertificateChain_Element : public ::google::protobuf::MessageLite { + public: + ClientDownloadRequest_CertificateChain_Element(); + virtual ~ClientDownloadRequest_CertificateChain_Element(); + + ClientDownloadRequest_CertificateChain_Element(const ClientDownloadRequest_CertificateChain_Element& from); + + inline ClientDownloadRequest_CertificateChain_Element& operator=(const ClientDownloadRequest_CertificateChain_Element& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadRequest_CertificateChain_Element& default_instance(); + + void Swap(ClientDownloadRequest_CertificateChain_Element* other); + + // implements Message ---------------------------------------------- + + ClientDownloadRequest_CertificateChain_Element* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadRequest_CertificateChain_Element& from); + void MergeFrom(const ClientDownloadRequest_CertificateChain_Element& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional bytes certificate = 1; + inline bool has_certificate() const; + inline void clear_certificate(); + static const int kCertificateFieldNumber = 1; + inline const ::std::string& certificate() const; + inline void set_certificate(const ::std::string& value); + inline void set_certificate(const char* value); + inline void set_certificate(const void* value, size_t size); + inline ::std::string* mutable_certificate(); + inline ::std::string* release_certificate(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.CertificateChain.Element) + private: + inline void set_has_certificate(); + inline void clear_has_certificate(); + + ::std::string* certificate_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadRequest_CertificateChain_Element* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadRequest_CertificateChain : public ::google::protobuf::MessageLite { + public: + ClientDownloadRequest_CertificateChain(); + virtual ~ClientDownloadRequest_CertificateChain(); + + ClientDownloadRequest_CertificateChain(const ClientDownloadRequest_CertificateChain& from); + + inline ClientDownloadRequest_CertificateChain& operator=(const ClientDownloadRequest_CertificateChain& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadRequest_CertificateChain& default_instance(); + + void Swap(ClientDownloadRequest_CertificateChain* other); + + // implements Message ---------------------------------------------- + + ClientDownloadRequest_CertificateChain* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadRequest_CertificateChain& from); + void MergeFrom(const ClientDownloadRequest_CertificateChain& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientDownloadRequest_CertificateChain_Element Element; + + // accessors ------------------------------------------------------- + + // repeated .safe_browsing.ClientDownloadRequest.CertificateChain.Element element = 1; + inline int element_size() const; + inline void clear_element(); + static const int kElementFieldNumber = 1; + inline const ::safe_browsing::ClientDownloadRequest_CertificateChain_Element& element(int index) const; + inline ::safe_browsing::ClientDownloadRequest_CertificateChain_Element* mutable_element(int index); + inline ::safe_browsing::ClientDownloadRequest_CertificateChain_Element* add_element(); + inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_CertificateChain_Element >& + element() const; + inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_CertificateChain_Element >* + mutable_element(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.CertificateChain) + private: + + ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_CertificateChain_Element > element_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadRequest_CertificateChain* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadRequest_SignatureInfo : public ::google::protobuf::MessageLite { + public: + ClientDownloadRequest_SignatureInfo(); + virtual ~ClientDownloadRequest_SignatureInfo(); + + ClientDownloadRequest_SignatureInfo(const ClientDownloadRequest_SignatureInfo& from); + + inline ClientDownloadRequest_SignatureInfo& operator=(const ClientDownloadRequest_SignatureInfo& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadRequest_SignatureInfo& default_instance(); + + void Swap(ClientDownloadRequest_SignatureInfo* other); + + // implements Message ---------------------------------------------- + + ClientDownloadRequest_SignatureInfo* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadRequest_SignatureInfo& from); + void MergeFrom(const ClientDownloadRequest_SignatureInfo& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .safe_browsing.ClientDownloadRequest.CertificateChain certificate_chain = 1; + inline int certificate_chain_size() const; + inline void clear_certificate_chain(); + static const int kCertificateChainFieldNumber = 1; + inline const ::safe_browsing::ClientDownloadRequest_CertificateChain& certificate_chain(int index) const; + inline ::safe_browsing::ClientDownloadRequest_CertificateChain* mutable_certificate_chain(int index); + inline ::safe_browsing::ClientDownloadRequest_CertificateChain* add_certificate_chain(); + inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_CertificateChain >& + certificate_chain() const; + inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_CertificateChain >* + mutable_certificate_chain(); + + // optional bool trusted = 2; + inline bool has_trusted() const; + inline void clear_trusted(); + static const int kTrustedFieldNumber = 2; + inline bool trusted() const; + inline void set_trusted(bool value); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest.SignatureInfo) + private: + inline void set_has_trusted(); + inline void clear_has_trusted(); + + ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_CertificateChain > certificate_chain_; + bool trusted_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadRequest_SignatureInfo* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadRequest : public ::google::protobuf::MessageLite { + public: + ClientDownloadRequest(); + virtual ~ClientDownloadRequest(); + + ClientDownloadRequest(const ClientDownloadRequest& from); + + inline ClientDownloadRequest& operator=(const ClientDownloadRequest& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadRequest& default_instance(); + + void Swap(ClientDownloadRequest* other); + + // implements Message ---------------------------------------------- + + ClientDownloadRequest* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadRequest& from); + void MergeFrom(const ClientDownloadRequest& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientDownloadRequest_Digests Digests; + typedef ClientDownloadRequest_Resource Resource; + typedef ClientDownloadRequest_CertificateChain CertificateChain; + typedef ClientDownloadRequest_SignatureInfo SignatureInfo; + + typedef ClientDownloadRequest_ResourceType ResourceType; + static const ResourceType DOWNLOAD_URL = ClientDownloadRequest_ResourceType_DOWNLOAD_URL; + static const ResourceType DOWNLOAD_REDIRECT = ClientDownloadRequest_ResourceType_DOWNLOAD_REDIRECT; + static const ResourceType TAB_URL = ClientDownloadRequest_ResourceType_TAB_URL; + static const ResourceType TAB_REDIRECT = ClientDownloadRequest_ResourceType_TAB_REDIRECT; + static inline bool ResourceType_IsValid(int value) { + return ClientDownloadRequest_ResourceType_IsValid(value); + } + static const ResourceType ResourceType_MIN = + ClientDownloadRequest_ResourceType_ResourceType_MIN; + static const ResourceType ResourceType_MAX = + ClientDownloadRequest_ResourceType_ResourceType_MAX; + static const int ResourceType_ARRAYSIZE = + ClientDownloadRequest_ResourceType_ResourceType_ARRAYSIZE; + + typedef ClientDownloadRequest_DownloadType DownloadType; + static const DownloadType WIN_EXECUTABLE = ClientDownloadRequest_DownloadType_WIN_EXECUTABLE; + static const DownloadType CHROME_EXTENSION = ClientDownloadRequest_DownloadType_CHROME_EXTENSION; + static const DownloadType ANDROID_APK = ClientDownloadRequest_DownloadType_ANDROID_APK; + static const DownloadType ZIPPED_EXECUTABLE = ClientDownloadRequest_DownloadType_ZIPPED_EXECUTABLE; + static inline bool DownloadType_IsValid(int value) { + return ClientDownloadRequest_DownloadType_IsValid(value); + } + static const DownloadType DownloadType_MIN = + ClientDownloadRequest_DownloadType_DownloadType_MIN; + static const DownloadType DownloadType_MAX = + ClientDownloadRequest_DownloadType_DownloadType_MAX; + static const int DownloadType_ARRAYSIZE = + ClientDownloadRequest_DownloadType_DownloadType_ARRAYSIZE; + + // accessors ------------------------------------------------------- + + // required string url = 1; + inline bool has_url() const; + inline void clear_url(); + static const int kUrlFieldNumber = 1; + inline const ::std::string& url() const; + inline void set_url(const ::std::string& value); + inline void set_url(const char* value); + inline void set_url(const char* value, size_t size); + inline ::std::string* mutable_url(); + inline ::std::string* release_url(); + + // required .safe_browsing.ClientDownloadRequest.Digests digests = 2; + inline bool has_digests() const; + inline void clear_digests(); + static const int kDigestsFieldNumber = 2; + inline const ::safe_browsing::ClientDownloadRequest_Digests& digests() const; + inline ::safe_browsing::ClientDownloadRequest_Digests* mutable_digests(); + inline ::safe_browsing::ClientDownloadRequest_Digests* release_digests(); + + // required int64 length = 3; + inline bool has_length() const; + inline void clear_length(); + static const int kLengthFieldNumber = 3; + inline ::google::protobuf::int64 length() const; + inline void set_length(::google::protobuf::int64 value); + + // repeated .safe_browsing.ClientDownloadRequest.Resource resources = 4; + inline int resources_size() const; + inline void clear_resources(); + static const int kResourcesFieldNumber = 4; + inline const ::safe_browsing::ClientDownloadRequest_Resource& resources(int index) const; + inline ::safe_browsing::ClientDownloadRequest_Resource* mutable_resources(int index); + inline ::safe_browsing::ClientDownloadRequest_Resource* add_resources(); + inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_Resource >& + resources() const; + inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_Resource >* + mutable_resources(); + + // optional .safe_browsing.ClientDownloadRequest.SignatureInfo signature = 5; + inline bool has_signature() const; + inline void clear_signature(); + static const int kSignatureFieldNumber = 5; + inline const ::safe_browsing::ClientDownloadRequest_SignatureInfo& signature() const; + inline ::safe_browsing::ClientDownloadRequest_SignatureInfo* mutable_signature(); + inline ::safe_browsing::ClientDownloadRequest_SignatureInfo* release_signature(); + + // optional bool user_initiated = 6; + inline bool has_user_initiated() const; + inline void clear_user_initiated(); + static const int kUserInitiatedFieldNumber = 6; + inline bool user_initiated() const; + inline void set_user_initiated(bool value); + + // optional string file_basename = 9; + inline bool has_file_basename() const; + inline void clear_file_basename(); + static const int kFileBasenameFieldNumber = 9; + inline const ::std::string& file_basename() const; + inline void set_file_basename(const ::std::string& value); + inline void set_file_basename(const char* value); + inline void set_file_basename(const char* value, size_t size); + inline ::std::string* mutable_file_basename(); + inline ::std::string* release_file_basename(); + + // optional .safe_browsing.ClientDownloadRequest.DownloadType download_type = 10 [default = WIN_EXECUTABLE]; + inline bool has_download_type() const; + inline void clear_download_type(); + static const int kDownloadTypeFieldNumber = 10; + inline ::safe_browsing::ClientDownloadRequest_DownloadType download_type() const; + inline void set_download_type(::safe_browsing::ClientDownloadRequest_DownloadType value); + + // optional string locale = 11; + inline bool has_locale() const; + inline void clear_locale(); + static const int kLocaleFieldNumber = 11; + inline const ::std::string& locale() const; + inline void set_locale(const ::std::string& value); + inline void set_locale(const char* value); + inline void set_locale(const char* value, size_t size); + inline ::std::string* mutable_locale(); + inline ::std::string* release_locale(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadRequest) + private: + inline void set_has_url(); + inline void clear_has_url(); + inline void set_has_digests(); + inline void clear_has_digests(); + inline void set_has_length(); + inline void clear_has_length(); + inline void set_has_signature(); + inline void clear_has_signature(); + inline void set_has_user_initiated(); + inline void clear_has_user_initiated(); + inline void set_has_file_basename(); + inline void clear_has_file_basename(); + inline void set_has_download_type(); + inline void clear_has_download_type(); + inline void set_has_locale(); + inline void clear_has_locale(); + + ::std::string* url_; + ::safe_browsing::ClientDownloadRequest_Digests* digests_; + ::google::protobuf::int64 length_; + ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_Resource > resources_; + ::safe_browsing::ClientDownloadRequest_SignatureInfo* signature_; + ::std::string* file_basename_; + bool user_initiated_; + int download_type_; + ::std::string* locale_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(9 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadRequest* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadResponse_MoreInfo : public ::google::protobuf::MessageLite { + public: + ClientDownloadResponse_MoreInfo(); + virtual ~ClientDownloadResponse_MoreInfo(); + + ClientDownloadResponse_MoreInfo(const ClientDownloadResponse_MoreInfo& from); + + inline ClientDownloadResponse_MoreInfo& operator=(const ClientDownloadResponse_MoreInfo& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadResponse_MoreInfo& default_instance(); + + void Swap(ClientDownloadResponse_MoreInfo* other); + + // implements Message ---------------------------------------------- + + ClientDownloadResponse_MoreInfo* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadResponse_MoreInfo& from); + void MergeFrom(const ClientDownloadResponse_MoreInfo& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string description = 1; + inline bool has_description() const; + inline void clear_description(); + static const int kDescriptionFieldNumber = 1; + inline const ::std::string& description() const; + inline void set_description(const ::std::string& value); + inline void set_description(const char* value); + inline void set_description(const char* value, size_t size); + inline ::std::string* mutable_description(); + inline ::std::string* release_description(); + + // optional string url = 2; + inline bool has_url() const; + inline void clear_url(); + static const int kUrlFieldNumber = 2; + inline const ::std::string& url() const; + inline void set_url(const ::std::string& value); + inline void set_url(const char* value); + inline void set_url(const char* value, size_t size); + inline ::std::string* mutable_url(); + inline ::std::string* release_url(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadResponse.MoreInfo) + private: + inline void set_has_description(); + inline void clear_has_description(); + inline void set_has_url(); + inline void clear_has_url(); + + ::std::string* description_; + ::std::string* url_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadResponse_MoreInfo* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadResponse : public ::google::protobuf::MessageLite { + public: + ClientDownloadResponse(); + virtual ~ClientDownloadResponse(); + + ClientDownloadResponse(const ClientDownloadResponse& from); + + inline ClientDownloadResponse& operator=(const ClientDownloadResponse& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadResponse& default_instance(); + + void Swap(ClientDownloadResponse* other); + + // implements Message ---------------------------------------------- + + ClientDownloadResponse* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadResponse& from); + void MergeFrom(const ClientDownloadResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientDownloadResponse_MoreInfo MoreInfo; + + typedef ClientDownloadResponse_Verdict Verdict; + static const Verdict SAFE = ClientDownloadResponse_Verdict_SAFE; + static const Verdict DANGEROUS = ClientDownloadResponse_Verdict_DANGEROUS; + static const Verdict UNCOMMON = ClientDownloadResponse_Verdict_UNCOMMON; + static const Verdict POTENTIALLY_UNWANTED = ClientDownloadResponse_Verdict_POTENTIALLY_UNWANTED; + static const Verdict DANGEROUS_HOST = ClientDownloadResponse_Verdict_DANGEROUS_HOST; + static inline bool Verdict_IsValid(int value) { + return ClientDownloadResponse_Verdict_IsValid(value); + } + static const Verdict Verdict_MIN = + ClientDownloadResponse_Verdict_Verdict_MIN; + static const Verdict Verdict_MAX = + ClientDownloadResponse_Verdict_Verdict_MAX; + static const int Verdict_ARRAYSIZE = + ClientDownloadResponse_Verdict_Verdict_ARRAYSIZE; + + // accessors ------------------------------------------------------- + + // required .safe_browsing.ClientDownloadResponse.Verdict verdict = 1; + inline bool has_verdict() const; + inline void clear_verdict(); + static const int kVerdictFieldNumber = 1; + inline ::safe_browsing::ClientDownloadResponse_Verdict verdict() const; + inline void set_verdict(::safe_browsing::ClientDownloadResponse_Verdict value); + + // optional .safe_browsing.ClientDownloadResponse.MoreInfo more_info = 2; + inline bool has_more_info() const; + inline void clear_more_info(); + static const int kMoreInfoFieldNumber = 2; + inline const ::safe_browsing::ClientDownloadResponse_MoreInfo& more_info() const; + inline ::safe_browsing::ClientDownloadResponse_MoreInfo* mutable_more_info(); + inline ::safe_browsing::ClientDownloadResponse_MoreInfo* release_more_info(); + + // optional bytes token = 3; + inline bool has_token() const; + inline void clear_token(); + static const int kTokenFieldNumber = 3; + inline const ::std::string& token() const; + inline void set_token(const ::std::string& value); + inline void set_token(const char* value); + inline void set_token(const void* value, size_t size); + inline ::std::string* mutable_token(); + inline ::std::string* release_token(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadResponse) + private: + inline void set_has_verdict(); + inline void clear_has_verdict(); + inline void set_has_more_info(); + inline void clear_has_more_info(); + inline void set_has_token(); + inline void clear_has_token(); + + ::safe_browsing::ClientDownloadResponse_MoreInfo* more_info_; + ::std::string* token_; + int verdict_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadResponse* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadReport_UserInformation : public ::google::protobuf::MessageLite { + public: + ClientDownloadReport_UserInformation(); + virtual ~ClientDownloadReport_UserInformation(); + + ClientDownloadReport_UserInformation(const ClientDownloadReport_UserInformation& from); + + inline ClientDownloadReport_UserInformation& operator=(const ClientDownloadReport_UserInformation& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadReport_UserInformation& default_instance(); + + void Swap(ClientDownloadReport_UserInformation* other); + + // implements Message ---------------------------------------------- + + ClientDownloadReport_UserInformation* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadReport_UserInformation& from); + void MergeFrom(const ClientDownloadReport_UserInformation& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // optional string email = 1; + inline bool has_email() const; + inline void clear_email(); + static const int kEmailFieldNumber = 1; + inline const ::std::string& email() const; + inline void set_email(const ::std::string& value); + inline void set_email(const char* value); + inline void set_email(const char* value, size_t size); + inline ::std::string* mutable_email(); + inline ::std::string* release_email(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadReport.UserInformation) + private: + inline void set_has_email(); + inline void clear_has_email(); + + ::std::string* email_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadReport_UserInformation* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientDownloadReport : public ::google::protobuf::MessageLite { + public: + ClientDownloadReport(); + virtual ~ClientDownloadReport(); + + ClientDownloadReport(const ClientDownloadReport& from); + + inline ClientDownloadReport& operator=(const ClientDownloadReport& from) { + CopyFrom(from); + return *this; + } + + static const ClientDownloadReport& default_instance(); + + void Swap(ClientDownloadReport* other); + + // implements Message ---------------------------------------------- + + ClientDownloadReport* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientDownloadReport& from); + void MergeFrom(const ClientDownloadReport& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientDownloadReport_UserInformation UserInformation; + + typedef ClientDownloadReport_Reason Reason; + static const Reason SHARE = ClientDownloadReport_Reason_SHARE; + static const Reason FALSE_POSITIVE = ClientDownloadReport_Reason_FALSE_POSITIVE; + static const Reason APPEAL = ClientDownloadReport_Reason_APPEAL; + static inline bool Reason_IsValid(int value) { + return ClientDownloadReport_Reason_IsValid(value); + } + static const Reason Reason_MIN = + ClientDownloadReport_Reason_Reason_MIN; + static const Reason Reason_MAX = + ClientDownloadReport_Reason_Reason_MAX; + static const int Reason_ARRAYSIZE = + ClientDownloadReport_Reason_Reason_ARRAYSIZE; + + // accessors ------------------------------------------------------- + + // optional .safe_browsing.ClientDownloadReport.Reason reason = 1; + inline bool has_reason() const; + inline void clear_reason(); + static const int kReasonFieldNumber = 1; + inline ::safe_browsing::ClientDownloadReport_Reason reason() const; + inline void set_reason(::safe_browsing::ClientDownloadReport_Reason value); + + // optional .safe_browsing.ClientDownloadRequest download_request = 2; + inline bool has_download_request() const; + inline void clear_download_request(); + static const int kDownloadRequestFieldNumber = 2; + inline const ::safe_browsing::ClientDownloadRequest& download_request() const; + inline ::safe_browsing::ClientDownloadRequest* mutable_download_request(); + inline ::safe_browsing::ClientDownloadRequest* release_download_request(); + + // optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; + inline bool has_user_information() const; + inline void clear_user_information(); + static const int kUserInformationFieldNumber = 3; + inline const ::safe_browsing::ClientDownloadReport_UserInformation& user_information() const; + inline ::safe_browsing::ClientDownloadReport_UserInformation* mutable_user_information(); + inline ::safe_browsing::ClientDownloadReport_UserInformation* release_user_information(); + + // optional bytes comment = 4; + inline bool has_comment() const; + inline void clear_comment(); + static const int kCommentFieldNumber = 4; + inline const ::std::string& comment() const; + inline void set_comment(const ::std::string& value); + inline void set_comment(const char* value); + inline void set_comment(const void* value, size_t size); + inline ::std::string* mutable_comment(); + inline ::std::string* release_comment(); + + // optional .safe_browsing.ClientDownloadResponse download_response = 5; + inline bool has_download_response() const; + inline void clear_download_response(); + static const int kDownloadResponseFieldNumber = 5; + inline const ::safe_browsing::ClientDownloadResponse& download_response() const; + inline ::safe_browsing::ClientDownloadResponse* mutable_download_response(); + inline ::safe_browsing::ClientDownloadResponse* release_download_response(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientDownloadReport) + private: + inline void set_has_reason(); + inline void clear_has_reason(); + inline void set_has_download_request(); + inline void clear_has_download_request(); + inline void set_has_user_information(); + inline void clear_has_user_information(); + inline void set_has_comment(); + inline void clear_has_comment(); + inline void set_has_download_response(); + inline void clear_has_download_response(); + + ::safe_browsing::ClientDownloadRequest* download_request_; + ::safe_browsing::ClientDownloadReport_UserInformation* user_information_; + ::std::string* comment_; + ::safe_browsing::ClientDownloadResponse* download_response_; + int reason_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientDownloadReport* default_instance_; +}; +// ------------------------------------------------------------------- + +class ClientUploadResponse : public ::google::protobuf::MessageLite { + public: + ClientUploadResponse(); + virtual ~ClientUploadResponse(); + + ClientUploadResponse(const ClientUploadResponse& from); + + inline ClientUploadResponse& operator=(const ClientUploadResponse& from) { + CopyFrom(from); + return *this; + } + + static const ClientUploadResponse& default_instance(); + + void Swap(ClientUploadResponse* other); + + // implements Message ---------------------------------------------- + + ClientUploadResponse* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const ClientUploadResponse& from); + void MergeFrom(const ClientUploadResponse& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef ClientUploadResponse_UploadStatus UploadStatus; + static const UploadStatus SUCCESS = ClientUploadResponse_UploadStatus_SUCCESS; + static const UploadStatus UPLOAD_FAILURE = ClientUploadResponse_UploadStatus_UPLOAD_FAILURE; + static inline bool UploadStatus_IsValid(int value) { + return ClientUploadResponse_UploadStatus_IsValid(value); + } + static const UploadStatus UploadStatus_MIN = + ClientUploadResponse_UploadStatus_UploadStatus_MIN; + static const UploadStatus UploadStatus_MAX = + ClientUploadResponse_UploadStatus_UploadStatus_MAX; + static const int UploadStatus_ARRAYSIZE = + ClientUploadResponse_UploadStatus_UploadStatus_ARRAYSIZE; + + // accessors ------------------------------------------------------- + + // optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; + inline bool has_status() const; + inline void clear_status(); + static const int kStatusFieldNumber = 1; + inline ::safe_browsing::ClientUploadResponse_UploadStatus status() const; + inline void set_status(::safe_browsing::ClientUploadResponse_UploadStatus value); + + // optional string permalink = 2; + inline bool has_permalink() const; + inline void clear_permalink(); + static const int kPermalinkFieldNumber = 2; + inline const ::std::string& permalink() const; + inline void set_permalink(const ::std::string& value); + inline void set_permalink(const char* value); + inline void set_permalink(const char* value, size_t size); + inline ::std::string* mutable_permalink(); + inline ::std::string* release_permalink(); + + // @@protoc_insertion_point(class_scope:safe_browsing.ClientUploadResponse) + private: + inline void set_has_status(); + inline void clear_has_status(); + inline void set_has_permalink(); + inline void clear_has_permalink(); + + ::std::string* permalink_; + int status_; + + mutable int _cached_size_; + ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32]; + + friend void protobuf_AddDesc_csd_2eproto(); + friend void protobuf_AssignDesc_csd_2eproto(); + friend void protobuf_ShutdownFile_csd_2eproto(); + + void InitAsDefaultInstance(); + static ClientUploadResponse* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +// ClientPhishingRequest_Feature + +// required string name = 1; +inline bool ClientPhishingRequest_Feature::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientPhishingRequest_Feature::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientPhishingRequest_Feature::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientPhishingRequest_Feature::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& ClientPhishingRequest_Feature::name() const { + return *name_; +} +inline void ClientPhishingRequest_Feature::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void ClientPhishingRequest_Feature::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void ClientPhishingRequest_Feature::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientPhishingRequest_Feature::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* ClientPhishingRequest_Feature::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// required double value = 2; +inline bool ClientPhishingRequest_Feature::has_value() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientPhishingRequest_Feature::set_has_value() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientPhishingRequest_Feature::clear_has_value() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientPhishingRequest_Feature::clear_value() { + value_ = 0; + clear_has_value(); +} +inline double ClientPhishingRequest_Feature::value() const { + return value_; +} +inline void ClientPhishingRequest_Feature::set_value(double value) { + set_has_value(); + value_ = value; +} + +// ------------------------------------------------------------------- + +// ClientPhishingRequest + +// optional string url = 1; +inline bool ClientPhishingRequest::has_url() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientPhishingRequest::set_has_url() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientPhishingRequest::clear_has_url() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientPhishingRequest::clear_url() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + clear_has_url(); +} +inline const ::std::string& ClientPhishingRequest::url() const { + return *url_; +} +inline void ClientPhishingRequest::set_url(const ::std::string& value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientPhishingRequest::set_url(const char* value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientPhishingRequest::set_url(const char* value, size_t size) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientPhishingRequest::mutable_url() { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + return url_; +} +inline ::std::string* ClientPhishingRequest::release_url() { + clear_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = url_; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional bytes OBSOLETE_hash_prefix = 10; +inline bool ClientPhishingRequest::has_obsolete_hash_prefix() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientPhishingRequest::set_has_obsolete_hash_prefix() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientPhishingRequest::clear_has_obsolete_hash_prefix() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientPhishingRequest::clear_obsolete_hash_prefix() { + if (obsolete_hash_prefix_ != &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_->clear(); + } + clear_has_obsolete_hash_prefix(); +} +inline const ::std::string& ClientPhishingRequest::obsolete_hash_prefix() const { + return *obsolete_hash_prefix_; +} +inline void ClientPhishingRequest::set_obsolete_hash_prefix(const ::std::string& value) { + set_has_obsolete_hash_prefix(); + if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_ = new ::std::string; + } + obsolete_hash_prefix_->assign(value); +} +inline void ClientPhishingRequest::set_obsolete_hash_prefix(const char* value) { + set_has_obsolete_hash_prefix(); + if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_ = new ::std::string; + } + obsolete_hash_prefix_->assign(value); +} +inline void ClientPhishingRequest::set_obsolete_hash_prefix(const void* value, size_t size) { + set_has_obsolete_hash_prefix(); + if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_ = new ::std::string; + } + obsolete_hash_prefix_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientPhishingRequest::mutable_obsolete_hash_prefix() { + set_has_obsolete_hash_prefix(); + if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { + obsolete_hash_prefix_ = new ::std::string; + } + return obsolete_hash_prefix_; +} +inline ::std::string* ClientPhishingRequest::release_obsolete_hash_prefix() { + clear_has_obsolete_hash_prefix(); + if (obsolete_hash_prefix_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = obsolete_hash_prefix_; + obsolete_hash_prefix_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// required float client_score = 2; +inline bool ClientPhishingRequest::has_client_score() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientPhishingRequest::set_has_client_score() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientPhishingRequest::clear_has_client_score() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientPhishingRequest::clear_client_score() { + client_score_ = 0; + clear_has_client_score(); +} +inline float ClientPhishingRequest::client_score() const { + return client_score_; +} +inline void ClientPhishingRequest::set_client_score(float value) { + set_has_client_score(); + client_score_ = value; +} + +// optional bool is_phishing = 4; +inline bool ClientPhishingRequest::has_is_phishing() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void ClientPhishingRequest::set_has_is_phishing() { + _has_bits_[0] |= 0x00000008u; +} +inline void ClientPhishingRequest::clear_has_is_phishing() { + _has_bits_[0] &= ~0x00000008u; +} +inline void ClientPhishingRequest::clear_is_phishing() { + is_phishing_ = false; + clear_has_is_phishing(); +} +inline bool ClientPhishingRequest::is_phishing() const { + return is_phishing_; +} +inline void ClientPhishingRequest::set_is_phishing(bool value) { + set_has_is_phishing(); + is_phishing_ = value; +} + +// repeated .safe_browsing.ClientPhishingRequest.Feature feature_map = 5; +inline int ClientPhishingRequest::feature_map_size() const { + return feature_map_.size(); +} +inline void ClientPhishingRequest::clear_feature_map() { + feature_map_.Clear(); +} +inline const ::safe_browsing::ClientPhishingRequest_Feature& ClientPhishingRequest::feature_map(int index) const { + return feature_map_.Get(index); +} +inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::mutable_feature_map(int index) { + return feature_map_.Mutable(index); +} +inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::add_feature_map() { + return feature_map_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& +ClientPhishingRequest::feature_map() const { + return feature_map_; +} +inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* +ClientPhishingRequest::mutable_feature_map() { + return &feature_map_; +} + +// optional int32 model_version = 6; +inline bool ClientPhishingRequest::has_model_version() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void ClientPhishingRequest::set_has_model_version() { + _has_bits_[0] |= 0x00000020u; +} +inline void ClientPhishingRequest::clear_has_model_version() { + _has_bits_[0] &= ~0x00000020u; +} +inline void ClientPhishingRequest::clear_model_version() { + model_version_ = 0; + clear_has_model_version(); +} +inline ::google::protobuf::int32 ClientPhishingRequest::model_version() const { + return model_version_; +} +inline void ClientPhishingRequest::set_model_version(::google::protobuf::int32 value) { + set_has_model_version(); + model_version_ = value; +} + +// repeated .safe_browsing.ClientPhishingRequest.Feature non_model_feature_map = 8; +inline int ClientPhishingRequest::non_model_feature_map_size() const { + return non_model_feature_map_.size(); +} +inline void ClientPhishingRequest::clear_non_model_feature_map() { + non_model_feature_map_.Clear(); +} +inline const ::safe_browsing::ClientPhishingRequest_Feature& ClientPhishingRequest::non_model_feature_map(int index) const { + return non_model_feature_map_.Get(index); +} +inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::mutable_non_model_feature_map(int index) { + return non_model_feature_map_.Mutable(index); +} +inline ::safe_browsing::ClientPhishingRequest_Feature* ClientPhishingRequest::add_non_model_feature_map() { + return non_model_feature_map_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >& +ClientPhishingRequest::non_model_feature_map() const { + return non_model_feature_map_; +} +inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientPhishingRequest_Feature >* +ClientPhishingRequest::mutable_non_model_feature_map() { + return &non_model_feature_map_; +} + +// optional string OBSOLETE_referrer_url = 9; +inline bool ClientPhishingRequest::has_obsolete_referrer_url() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void ClientPhishingRequest::set_has_obsolete_referrer_url() { + _has_bits_[0] |= 0x00000080u; +} +inline void ClientPhishingRequest::clear_has_obsolete_referrer_url() { + _has_bits_[0] &= ~0x00000080u; +} +inline void ClientPhishingRequest::clear_obsolete_referrer_url() { + if (obsolete_referrer_url_ != &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_->clear(); + } + clear_has_obsolete_referrer_url(); +} +inline const ::std::string& ClientPhishingRequest::obsolete_referrer_url() const { + return *obsolete_referrer_url_; +} +inline void ClientPhishingRequest::set_obsolete_referrer_url(const ::std::string& value) { + set_has_obsolete_referrer_url(); + if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_ = new ::std::string; + } + obsolete_referrer_url_->assign(value); +} +inline void ClientPhishingRequest::set_obsolete_referrer_url(const char* value) { + set_has_obsolete_referrer_url(); + if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_ = new ::std::string; + } + obsolete_referrer_url_->assign(value); +} +inline void ClientPhishingRequest::set_obsolete_referrer_url(const char* value, size_t size) { + set_has_obsolete_referrer_url(); + if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_ = new ::std::string; + } + obsolete_referrer_url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientPhishingRequest::mutable_obsolete_referrer_url() { + set_has_obsolete_referrer_url(); + if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { + obsolete_referrer_url_ = new ::std::string; + } + return obsolete_referrer_url_; +} +inline ::std::string* ClientPhishingRequest::release_obsolete_referrer_url() { + clear_has_obsolete_referrer_url(); + if (obsolete_referrer_url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = obsolete_referrer_url_; + obsolete_referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientPhishingResponse + +// required bool phishy = 1; +inline bool ClientPhishingResponse::has_phishy() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientPhishingResponse::set_has_phishy() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientPhishingResponse::clear_has_phishy() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientPhishingResponse::clear_phishy() { + phishy_ = false; + clear_has_phishy(); +} +inline bool ClientPhishingResponse::phishy() const { + return phishy_; +} +inline void ClientPhishingResponse::set_phishy(bool value) { + set_has_phishy(); + phishy_ = value; +} + +// repeated string OBSOLETE_whitelist_expression = 2; +inline int ClientPhishingResponse::obsolete_whitelist_expression_size() const { + return obsolete_whitelist_expression_.size(); +} +inline void ClientPhishingResponse::clear_obsolete_whitelist_expression() { + obsolete_whitelist_expression_.Clear(); +} +inline const ::std::string& ClientPhishingResponse::obsolete_whitelist_expression(int index) const { + return obsolete_whitelist_expression_.Get(index); +} +inline ::std::string* ClientPhishingResponse::mutable_obsolete_whitelist_expression(int index) { + return obsolete_whitelist_expression_.Mutable(index); +} +inline void ClientPhishingResponse::set_obsolete_whitelist_expression(int index, const ::std::string& value) { + obsolete_whitelist_expression_.Mutable(index)->assign(value); +} +inline void ClientPhishingResponse::set_obsolete_whitelist_expression(int index, const char* value) { + obsolete_whitelist_expression_.Mutable(index)->assign(value); +} +inline void ClientPhishingResponse::set_obsolete_whitelist_expression(int index, const char* value, size_t size) { + obsolete_whitelist_expression_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* ClientPhishingResponse::add_obsolete_whitelist_expression() { + return obsolete_whitelist_expression_.Add(); +} +inline void ClientPhishingResponse::add_obsolete_whitelist_expression(const ::std::string& value) { + obsolete_whitelist_expression_.Add()->assign(value); +} +inline void ClientPhishingResponse::add_obsolete_whitelist_expression(const char* value) { + obsolete_whitelist_expression_.Add()->assign(value); +} +inline void ClientPhishingResponse::add_obsolete_whitelist_expression(const char* value, size_t size) { + obsolete_whitelist_expression_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +ClientPhishingResponse::obsolete_whitelist_expression() const { + return obsolete_whitelist_expression_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +ClientPhishingResponse::mutable_obsolete_whitelist_expression() { + return &obsolete_whitelist_expression_; +} + +// ------------------------------------------------------------------- + +// ClientMalwareRequest_Feature + +// required string name = 1; +inline bool ClientMalwareRequest_Feature::has_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientMalwareRequest_Feature::set_has_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientMalwareRequest_Feature::clear_has_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientMalwareRequest_Feature::clear_name() { + if (name_ != &::google::protobuf::internal::kEmptyString) { + name_->clear(); + } + clear_has_name(); +} +inline const ::std::string& ClientMalwareRequest_Feature::name() const { + return *name_; +} +inline void ClientMalwareRequest_Feature::set_name(const ::std::string& value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void ClientMalwareRequest_Feature::set_name(const char* value) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(value); +} +inline void ClientMalwareRequest_Feature::set_name(const char* value, size_t size) { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + name_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientMalwareRequest_Feature::mutable_name() { + set_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + name_ = new ::std::string; + } + return name_; +} +inline ::std::string* ClientMalwareRequest_Feature::release_name() { + clear_has_name(); + if (name_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = name_; + name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// required double value = 2; +inline bool ClientMalwareRequest_Feature::has_value() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientMalwareRequest_Feature::set_has_value() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientMalwareRequest_Feature::clear_has_value() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientMalwareRequest_Feature::clear_value() { + value_ = 0; + clear_has_value(); +} +inline double ClientMalwareRequest_Feature::value() const { + return value_; +} +inline void ClientMalwareRequest_Feature::set_value(double value) { + set_has_value(); + value_ = value; +} + +// repeated string metainfo = 3; +inline int ClientMalwareRequest_Feature::metainfo_size() const { + return metainfo_.size(); +} +inline void ClientMalwareRequest_Feature::clear_metainfo() { + metainfo_.Clear(); +} +inline const ::std::string& ClientMalwareRequest_Feature::metainfo(int index) const { + return metainfo_.Get(index); +} +inline ::std::string* ClientMalwareRequest_Feature::mutable_metainfo(int index) { + return metainfo_.Mutable(index); +} +inline void ClientMalwareRequest_Feature::set_metainfo(int index, const ::std::string& value) { + metainfo_.Mutable(index)->assign(value); +} +inline void ClientMalwareRequest_Feature::set_metainfo(int index, const char* value) { + metainfo_.Mutable(index)->assign(value); +} +inline void ClientMalwareRequest_Feature::set_metainfo(int index, const char* value, size_t size) { + metainfo_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* ClientMalwareRequest_Feature::add_metainfo() { + return metainfo_.Add(); +} +inline void ClientMalwareRequest_Feature::add_metainfo(const ::std::string& value) { + metainfo_.Add()->assign(value); +} +inline void ClientMalwareRequest_Feature::add_metainfo(const char* value) { + metainfo_.Add()->assign(value); +} +inline void ClientMalwareRequest_Feature::add_metainfo(const char* value, size_t size) { + metainfo_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +ClientMalwareRequest_Feature::metainfo() const { + return metainfo_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +ClientMalwareRequest_Feature::mutable_metainfo() { + return &metainfo_; +} + +// ------------------------------------------------------------------- + +// ClientMalwareRequest + +// required string url = 1; +inline bool ClientMalwareRequest::has_url() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientMalwareRequest::set_has_url() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientMalwareRequest::clear_has_url() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientMalwareRequest::clear_url() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + clear_has_url(); +} +inline const ::std::string& ClientMalwareRequest::url() const { + return *url_; +} +inline void ClientMalwareRequest::set_url(const ::std::string& value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientMalwareRequest::set_url(const char* value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientMalwareRequest::set_url(const char* value, size_t size) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientMalwareRequest::mutable_url() { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + return url_; +} +inline ::std::string* ClientMalwareRequest::release_url() { + clear_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = url_; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// repeated .safe_browsing.ClientMalwareRequest.Feature feature_map = 2; +inline int ClientMalwareRequest::feature_map_size() const { + return feature_map_.size(); +} +inline void ClientMalwareRequest::clear_feature_map() { + feature_map_.Clear(); +} +inline const ::safe_browsing::ClientMalwareRequest_Feature& ClientMalwareRequest::feature_map(int index) const { + return feature_map_.Get(index); +} +inline ::safe_browsing::ClientMalwareRequest_Feature* ClientMalwareRequest::mutable_feature_map(int index) { + return feature_map_.Mutable(index); +} +inline ::safe_browsing::ClientMalwareRequest_Feature* ClientMalwareRequest::add_feature_map() { + return feature_map_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >& +ClientMalwareRequest::feature_map() const { + return feature_map_; +} +inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientMalwareRequest_Feature >* +ClientMalwareRequest::mutable_feature_map() { + return &feature_map_; +} + +// optional string referrer_url = 4; +inline bool ClientMalwareRequest::has_referrer_url() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientMalwareRequest::set_has_referrer_url() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientMalwareRequest::clear_has_referrer_url() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientMalwareRequest::clear_referrer_url() { + if (referrer_url_ != &::google::protobuf::internal::kEmptyString) { + referrer_url_->clear(); + } + clear_has_referrer_url(); +} +inline const ::std::string& ClientMalwareRequest::referrer_url() const { + return *referrer_url_; +} +inline void ClientMalwareRequest::set_referrer_url(const ::std::string& value) { + set_has_referrer_url(); + if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { + referrer_url_ = new ::std::string; + } + referrer_url_->assign(value); +} +inline void ClientMalwareRequest::set_referrer_url(const char* value) { + set_has_referrer_url(); + if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { + referrer_url_ = new ::std::string; + } + referrer_url_->assign(value); +} +inline void ClientMalwareRequest::set_referrer_url(const char* value, size_t size) { + set_has_referrer_url(); + if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { + referrer_url_ = new ::std::string; + } + referrer_url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientMalwareRequest::mutable_referrer_url() { + set_has_referrer_url(); + if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { + referrer_url_ = new ::std::string; + } + return referrer_url_; +} +inline ::std::string* ClientMalwareRequest::release_referrer_url() { + clear_has_referrer_url(); + if (referrer_url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = referrer_url_; + referrer_url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientMalwareResponse + +// required bool blacklist = 1; +inline bool ClientMalwareResponse::has_blacklist() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientMalwareResponse::set_has_blacklist() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientMalwareResponse::clear_has_blacklist() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientMalwareResponse::clear_blacklist() { + blacklist_ = false; + clear_has_blacklist(); +} +inline bool ClientMalwareResponse::blacklist() const { + return blacklist_; +} +inline void ClientMalwareResponse::set_blacklist(bool value) { + set_has_blacklist(); + blacklist_ = value; +} + +// optional string bad_ip = 2; +inline bool ClientMalwareResponse::has_bad_ip() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientMalwareResponse::set_has_bad_ip() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientMalwareResponse::clear_has_bad_ip() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientMalwareResponse::clear_bad_ip() { + if (bad_ip_ != &::google::protobuf::internal::kEmptyString) { + bad_ip_->clear(); + } + clear_has_bad_ip(); +} +inline const ::std::string& ClientMalwareResponse::bad_ip() const { + return *bad_ip_; +} +inline void ClientMalwareResponse::set_bad_ip(const ::std::string& value) { + set_has_bad_ip(); + if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { + bad_ip_ = new ::std::string; + } + bad_ip_->assign(value); +} +inline void ClientMalwareResponse::set_bad_ip(const char* value) { + set_has_bad_ip(); + if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { + bad_ip_ = new ::std::string; + } + bad_ip_->assign(value); +} +inline void ClientMalwareResponse::set_bad_ip(const char* value, size_t size) { + set_has_bad_ip(); + if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { + bad_ip_ = new ::std::string; + } + bad_ip_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientMalwareResponse::mutable_bad_ip() { + set_has_bad_ip(); + if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { + bad_ip_ = new ::std::string; + } + return bad_ip_; +} +inline ::std::string* ClientMalwareResponse::release_bad_ip() { + clear_has_bad_ip(); + if (bad_ip_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = bad_ip_; + bad_ip_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientDownloadRequest_Digests + +// optional bytes sha256 = 1; +inline bool ClientDownloadRequest_Digests::has_sha256() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadRequest_Digests::set_has_sha256() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadRequest_Digests::clear_has_sha256() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadRequest_Digests::clear_sha256() { + if (sha256_ != &::google::protobuf::internal::kEmptyString) { + sha256_->clear(); + } + clear_has_sha256(); +} +inline const ::std::string& ClientDownloadRequest_Digests::sha256() const { + return *sha256_; +} +inline void ClientDownloadRequest_Digests::set_sha256(const ::std::string& value) { + set_has_sha256(); + if (sha256_ == &::google::protobuf::internal::kEmptyString) { + sha256_ = new ::std::string; + } + sha256_->assign(value); +} +inline void ClientDownloadRequest_Digests::set_sha256(const char* value) { + set_has_sha256(); + if (sha256_ == &::google::protobuf::internal::kEmptyString) { + sha256_ = new ::std::string; + } + sha256_->assign(value); +} +inline void ClientDownloadRequest_Digests::set_sha256(const void* value, size_t size) { + set_has_sha256(); + if (sha256_ == &::google::protobuf::internal::kEmptyString) { + sha256_ = new ::std::string; + } + sha256_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_Digests::mutable_sha256() { + set_has_sha256(); + if (sha256_ == &::google::protobuf::internal::kEmptyString) { + sha256_ = new ::std::string; + } + return sha256_; +} +inline ::std::string* ClientDownloadRequest_Digests::release_sha256() { + clear_has_sha256(); + if (sha256_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = sha256_; + sha256_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional bytes sha1 = 2; +inline bool ClientDownloadRequest_Digests::has_sha1() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientDownloadRequest_Digests::set_has_sha1() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientDownloadRequest_Digests::clear_has_sha1() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientDownloadRequest_Digests::clear_sha1() { + if (sha1_ != &::google::protobuf::internal::kEmptyString) { + sha1_->clear(); + } + clear_has_sha1(); +} +inline const ::std::string& ClientDownloadRequest_Digests::sha1() const { + return *sha1_; +} +inline void ClientDownloadRequest_Digests::set_sha1(const ::std::string& value) { + set_has_sha1(); + if (sha1_ == &::google::protobuf::internal::kEmptyString) { + sha1_ = new ::std::string; + } + sha1_->assign(value); +} +inline void ClientDownloadRequest_Digests::set_sha1(const char* value) { + set_has_sha1(); + if (sha1_ == &::google::protobuf::internal::kEmptyString) { + sha1_ = new ::std::string; + } + sha1_->assign(value); +} +inline void ClientDownloadRequest_Digests::set_sha1(const void* value, size_t size) { + set_has_sha1(); + if (sha1_ == &::google::protobuf::internal::kEmptyString) { + sha1_ = new ::std::string; + } + sha1_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_Digests::mutable_sha1() { + set_has_sha1(); + if (sha1_ == &::google::protobuf::internal::kEmptyString) { + sha1_ = new ::std::string; + } + return sha1_; +} +inline ::std::string* ClientDownloadRequest_Digests::release_sha1() { + clear_has_sha1(); + if (sha1_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = sha1_; + sha1_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional bytes md5 = 3; +inline bool ClientDownloadRequest_Digests::has_md5() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientDownloadRequest_Digests::set_has_md5() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientDownloadRequest_Digests::clear_has_md5() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientDownloadRequest_Digests::clear_md5() { + if (md5_ != &::google::protobuf::internal::kEmptyString) { + md5_->clear(); + } + clear_has_md5(); +} +inline const ::std::string& ClientDownloadRequest_Digests::md5() const { + return *md5_; +} +inline void ClientDownloadRequest_Digests::set_md5(const ::std::string& value) { + set_has_md5(); + if (md5_ == &::google::protobuf::internal::kEmptyString) { + md5_ = new ::std::string; + } + md5_->assign(value); +} +inline void ClientDownloadRequest_Digests::set_md5(const char* value) { + set_has_md5(); + if (md5_ == &::google::protobuf::internal::kEmptyString) { + md5_ = new ::std::string; + } + md5_->assign(value); +} +inline void ClientDownloadRequest_Digests::set_md5(const void* value, size_t size) { + set_has_md5(); + if (md5_ == &::google::protobuf::internal::kEmptyString) { + md5_ = new ::std::string; + } + md5_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_Digests::mutable_md5() { + set_has_md5(); + if (md5_ == &::google::protobuf::internal::kEmptyString) { + md5_ = new ::std::string; + } + return md5_; +} +inline ::std::string* ClientDownloadRequest_Digests::release_md5() { + clear_has_md5(); + if (md5_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = md5_; + md5_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientDownloadRequest_Resource + +// required string url = 1; +inline bool ClientDownloadRequest_Resource::has_url() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadRequest_Resource::set_has_url() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadRequest_Resource::clear_has_url() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadRequest_Resource::clear_url() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + clear_has_url(); +} +inline const ::std::string& ClientDownloadRequest_Resource::url() const { + return *url_; +} +inline void ClientDownloadRequest_Resource::set_url(const ::std::string& value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientDownloadRequest_Resource::set_url(const char* value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientDownloadRequest_Resource::set_url(const char* value, size_t size) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_Resource::mutable_url() { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + return url_; +} +inline ::std::string* ClientDownloadRequest_Resource::release_url() { + clear_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = url_; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// required .safe_browsing.ClientDownloadRequest.ResourceType type = 2; +inline bool ClientDownloadRequest_Resource::has_type() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientDownloadRequest_Resource::set_has_type() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientDownloadRequest_Resource::clear_has_type() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientDownloadRequest_Resource::clear_type() { + type_ = 0; + clear_has_type(); +} +inline ::safe_browsing::ClientDownloadRequest_ResourceType ClientDownloadRequest_Resource::type() const { + return static_cast< ::safe_browsing::ClientDownloadRequest_ResourceType >(type_); +} +inline void ClientDownloadRequest_Resource::set_type(::safe_browsing::ClientDownloadRequest_ResourceType value) { + GOOGLE_DCHECK(::safe_browsing::ClientDownloadRequest_ResourceType_IsValid(value)); + set_has_type(); + type_ = value; +} + +// optional bytes remote_ip = 3; +inline bool ClientDownloadRequest_Resource::has_remote_ip() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientDownloadRequest_Resource::set_has_remote_ip() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientDownloadRequest_Resource::clear_has_remote_ip() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientDownloadRequest_Resource::clear_remote_ip() { + if (remote_ip_ != &::google::protobuf::internal::kEmptyString) { + remote_ip_->clear(); + } + clear_has_remote_ip(); +} +inline const ::std::string& ClientDownloadRequest_Resource::remote_ip() const { + return *remote_ip_; +} +inline void ClientDownloadRequest_Resource::set_remote_ip(const ::std::string& value) { + set_has_remote_ip(); + if (remote_ip_ == &::google::protobuf::internal::kEmptyString) { + remote_ip_ = new ::std::string; + } + remote_ip_->assign(value); +} +inline void ClientDownloadRequest_Resource::set_remote_ip(const char* value) { + set_has_remote_ip(); + if (remote_ip_ == &::google::protobuf::internal::kEmptyString) { + remote_ip_ = new ::std::string; + } + remote_ip_->assign(value); +} +inline void ClientDownloadRequest_Resource::set_remote_ip(const void* value, size_t size) { + set_has_remote_ip(); + if (remote_ip_ == &::google::protobuf::internal::kEmptyString) { + remote_ip_ = new ::std::string; + } + remote_ip_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_Resource::mutable_remote_ip() { + set_has_remote_ip(); + if (remote_ip_ == &::google::protobuf::internal::kEmptyString) { + remote_ip_ = new ::std::string; + } + return remote_ip_; +} +inline ::std::string* ClientDownloadRequest_Resource::release_remote_ip() { + clear_has_remote_ip(); + if (remote_ip_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = remote_ip_; + remote_ip_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string referrer = 4; +inline bool ClientDownloadRequest_Resource::has_referrer() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void ClientDownloadRequest_Resource::set_has_referrer() { + _has_bits_[0] |= 0x00000008u; +} +inline void ClientDownloadRequest_Resource::clear_has_referrer() { + _has_bits_[0] &= ~0x00000008u; +} +inline void ClientDownloadRequest_Resource::clear_referrer() { + if (referrer_ != &::google::protobuf::internal::kEmptyString) { + referrer_->clear(); + } + clear_has_referrer(); +} +inline const ::std::string& ClientDownloadRequest_Resource::referrer() const { + return *referrer_; +} +inline void ClientDownloadRequest_Resource::set_referrer(const ::std::string& value) { + set_has_referrer(); + if (referrer_ == &::google::protobuf::internal::kEmptyString) { + referrer_ = new ::std::string; + } + referrer_->assign(value); +} +inline void ClientDownloadRequest_Resource::set_referrer(const char* value) { + set_has_referrer(); + if (referrer_ == &::google::protobuf::internal::kEmptyString) { + referrer_ = new ::std::string; + } + referrer_->assign(value); +} +inline void ClientDownloadRequest_Resource::set_referrer(const char* value, size_t size) { + set_has_referrer(); + if (referrer_ == &::google::protobuf::internal::kEmptyString) { + referrer_ = new ::std::string; + } + referrer_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_Resource::mutable_referrer() { + set_has_referrer(); + if (referrer_ == &::google::protobuf::internal::kEmptyString) { + referrer_ = new ::std::string; + } + return referrer_; +} +inline ::std::string* ClientDownloadRequest_Resource::release_referrer() { + clear_has_referrer(); + if (referrer_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = referrer_; + referrer_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientDownloadRequest_CertificateChain_Element + +// optional bytes certificate = 1; +inline bool ClientDownloadRequest_CertificateChain_Element::has_certificate() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadRequest_CertificateChain_Element::set_has_certificate() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadRequest_CertificateChain_Element::clear_has_certificate() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadRequest_CertificateChain_Element::clear_certificate() { + if (certificate_ != &::google::protobuf::internal::kEmptyString) { + certificate_->clear(); + } + clear_has_certificate(); +} +inline const ::std::string& ClientDownloadRequest_CertificateChain_Element::certificate() const { + return *certificate_; +} +inline void ClientDownloadRequest_CertificateChain_Element::set_certificate(const ::std::string& value) { + set_has_certificate(); + if (certificate_ == &::google::protobuf::internal::kEmptyString) { + certificate_ = new ::std::string; + } + certificate_->assign(value); +} +inline void ClientDownloadRequest_CertificateChain_Element::set_certificate(const char* value) { + set_has_certificate(); + if (certificate_ == &::google::protobuf::internal::kEmptyString) { + certificate_ = new ::std::string; + } + certificate_->assign(value); +} +inline void ClientDownloadRequest_CertificateChain_Element::set_certificate(const void* value, size_t size) { + set_has_certificate(); + if (certificate_ == &::google::protobuf::internal::kEmptyString) { + certificate_ = new ::std::string; + } + certificate_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest_CertificateChain_Element::mutable_certificate() { + set_has_certificate(); + if (certificate_ == &::google::protobuf::internal::kEmptyString) { + certificate_ = new ::std::string; + } + return certificate_; +} +inline ::std::string* ClientDownloadRequest_CertificateChain_Element::release_certificate() { + clear_has_certificate(); + if (certificate_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = certificate_; + certificate_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientDownloadRequest_CertificateChain + +// repeated .safe_browsing.ClientDownloadRequest.CertificateChain.Element element = 1; +inline int ClientDownloadRequest_CertificateChain::element_size() const { + return element_.size(); +} +inline void ClientDownloadRequest_CertificateChain::clear_element() { + element_.Clear(); +} +inline const ::safe_browsing::ClientDownloadRequest_CertificateChain_Element& ClientDownloadRequest_CertificateChain::element(int index) const { + return element_.Get(index); +} +inline ::safe_browsing::ClientDownloadRequest_CertificateChain_Element* ClientDownloadRequest_CertificateChain::mutable_element(int index) { + return element_.Mutable(index); +} +inline ::safe_browsing::ClientDownloadRequest_CertificateChain_Element* ClientDownloadRequest_CertificateChain::add_element() { + return element_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_CertificateChain_Element >& +ClientDownloadRequest_CertificateChain::element() const { + return element_; +} +inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_CertificateChain_Element >* +ClientDownloadRequest_CertificateChain::mutable_element() { + return &element_; +} + +// ------------------------------------------------------------------- + +// ClientDownloadRequest_SignatureInfo + +// repeated .safe_browsing.ClientDownloadRequest.CertificateChain certificate_chain = 1; +inline int ClientDownloadRequest_SignatureInfo::certificate_chain_size() const { + return certificate_chain_.size(); +} +inline void ClientDownloadRequest_SignatureInfo::clear_certificate_chain() { + certificate_chain_.Clear(); +} +inline const ::safe_browsing::ClientDownloadRequest_CertificateChain& ClientDownloadRequest_SignatureInfo::certificate_chain(int index) const { + return certificate_chain_.Get(index); +} +inline ::safe_browsing::ClientDownloadRequest_CertificateChain* ClientDownloadRequest_SignatureInfo::mutable_certificate_chain(int index) { + return certificate_chain_.Mutable(index); +} +inline ::safe_browsing::ClientDownloadRequest_CertificateChain* ClientDownloadRequest_SignatureInfo::add_certificate_chain() { + return certificate_chain_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_CertificateChain >& +ClientDownloadRequest_SignatureInfo::certificate_chain() const { + return certificate_chain_; +} +inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_CertificateChain >* +ClientDownloadRequest_SignatureInfo::mutable_certificate_chain() { + return &certificate_chain_; +} + +// optional bool trusted = 2; +inline bool ClientDownloadRequest_SignatureInfo::has_trusted() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientDownloadRequest_SignatureInfo::set_has_trusted() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientDownloadRequest_SignatureInfo::clear_has_trusted() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientDownloadRequest_SignatureInfo::clear_trusted() { + trusted_ = false; + clear_has_trusted(); +} +inline bool ClientDownloadRequest_SignatureInfo::trusted() const { + return trusted_; +} +inline void ClientDownloadRequest_SignatureInfo::set_trusted(bool value) { + set_has_trusted(); + trusted_ = value; +} + +// ------------------------------------------------------------------- + +// ClientDownloadRequest + +// required string url = 1; +inline bool ClientDownloadRequest::has_url() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadRequest::set_has_url() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadRequest::clear_has_url() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadRequest::clear_url() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + clear_has_url(); +} +inline const ::std::string& ClientDownloadRequest::url() const { + return *url_; +} +inline void ClientDownloadRequest::set_url(const ::std::string& value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientDownloadRequest::set_url(const char* value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientDownloadRequest::set_url(const char* value, size_t size) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest::mutable_url() { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + return url_; +} +inline ::std::string* ClientDownloadRequest::release_url() { + clear_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = url_; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// required .safe_browsing.ClientDownloadRequest.Digests digests = 2; +inline bool ClientDownloadRequest::has_digests() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientDownloadRequest::set_has_digests() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientDownloadRequest::clear_has_digests() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientDownloadRequest::clear_digests() { + if (digests_ != NULL) digests_->::safe_browsing::ClientDownloadRequest_Digests::Clear(); + clear_has_digests(); +} +inline const ::safe_browsing::ClientDownloadRequest_Digests& ClientDownloadRequest::digests() const { + return digests_ != NULL ? *digests_ : *default_instance_->digests_; +} +inline ::safe_browsing::ClientDownloadRequest_Digests* ClientDownloadRequest::mutable_digests() { + set_has_digests(); + if (digests_ == NULL) digests_ = new ::safe_browsing::ClientDownloadRequest_Digests; + return digests_; +} +inline ::safe_browsing::ClientDownloadRequest_Digests* ClientDownloadRequest::release_digests() { + clear_has_digests(); + ::safe_browsing::ClientDownloadRequest_Digests* temp = digests_; + digests_ = NULL; + return temp; +} + +// required int64 length = 3; +inline bool ClientDownloadRequest::has_length() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientDownloadRequest::set_has_length() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientDownloadRequest::clear_has_length() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientDownloadRequest::clear_length() { + length_ = GOOGLE_LONGLONG(0); + clear_has_length(); +} +inline ::google::protobuf::int64 ClientDownloadRequest::length() const { + return length_; +} +inline void ClientDownloadRequest::set_length(::google::protobuf::int64 value) { + set_has_length(); + length_ = value; +} + +// repeated .safe_browsing.ClientDownloadRequest.Resource resources = 4; +inline int ClientDownloadRequest::resources_size() const { + return resources_.size(); +} +inline void ClientDownloadRequest::clear_resources() { + resources_.Clear(); +} +inline const ::safe_browsing::ClientDownloadRequest_Resource& ClientDownloadRequest::resources(int index) const { + return resources_.Get(index); +} +inline ::safe_browsing::ClientDownloadRequest_Resource* ClientDownloadRequest::mutable_resources(int index) { + return resources_.Mutable(index); +} +inline ::safe_browsing::ClientDownloadRequest_Resource* ClientDownloadRequest::add_resources() { + return resources_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_Resource >& +ClientDownloadRequest::resources() const { + return resources_; +} +inline ::google::protobuf::RepeatedPtrField< ::safe_browsing::ClientDownloadRequest_Resource >* +ClientDownloadRequest::mutable_resources() { + return &resources_; +} + +// optional .safe_browsing.ClientDownloadRequest.SignatureInfo signature = 5; +inline bool ClientDownloadRequest::has_signature() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void ClientDownloadRequest::set_has_signature() { + _has_bits_[0] |= 0x00000010u; +} +inline void ClientDownloadRequest::clear_has_signature() { + _has_bits_[0] &= ~0x00000010u; +} +inline void ClientDownloadRequest::clear_signature() { + if (signature_ != NULL) signature_->::safe_browsing::ClientDownloadRequest_SignatureInfo::Clear(); + clear_has_signature(); +} +inline const ::safe_browsing::ClientDownloadRequest_SignatureInfo& ClientDownloadRequest::signature() const { + return signature_ != NULL ? *signature_ : *default_instance_->signature_; +} +inline ::safe_browsing::ClientDownloadRequest_SignatureInfo* ClientDownloadRequest::mutable_signature() { + set_has_signature(); + if (signature_ == NULL) signature_ = new ::safe_browsing::ClientDownloadRequest_SignatureInfo; + return signature_; +} +inline ::safe_browsing::ClientDownloadRequest_SignatureInfo* ClientDownloadRequest::release_signature() { + clear_has_signature(); + ::safe_browsing::ClientDownloadRequest_SignatureInfo* temp = signature_; + signature_ = NULL; + return temp; +} + +// optional bool user_initiated = 6; +inline bool ClientDownloadRequest::has_user_initiated() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void ClientDownloadRequest::set_has_user_initiated() { + _has_bits_[0] |= 0x00000020u; +} +inline void ClientDownloadRequest::clear_has_user_initiated() { + _has_bits_[0] &= ~0x00000020u; +} +inline void ClientDownloadRequest::clear_user_initiated() { + user_initiated_ = false; + clear_has_user_initiated(); +} +inline bool ClientDownloadRequest::user_initiated() const { + return user_initiated_; +} +inline void ClientDownloadRequest::set_user_initiated(bool value) { + set_has_user_initiated(); + user_initiated_ = value; +} + +// optional string file_basename = 9; +inline bool ClientDownloadRequest::has_file_basename() const { + return (_has_bits_[0] & 0x00000040u) != 0; +} +inline void ClientDownloadRequest::set_has_file_basename() { + _has_bits_[0] |= 0x00000040u; +} +inline void ClientDownloadRequest::clear_has_file_basename() { + _has_bits_[0] &= ~0x00000040u; +} +inline void ClientDownloadRequest::clear_file_basename() { + if (file_basename_ != &::google::protobuf::internal::kEmptyString) { + file_basename_->clear(); + } + clear_has_file_basename(); +} +inline const ::std::string& ClientDownloadRequest::file_basename() const { + return *file_basename_; +} +inline void ClientDownloadRequest::set_file_basename(const ::std::string& value) { + set_has_file_basename(); + if (file_basename_ == &::google::protobuf::internal::kEmptyString) { + file_basename_ = new ::std::string; + } + file_basename_->assign(value); +} +inline void ClientDownloadRequest::set_file_basename(const char* value) { + set_has_file_basename(); + if (file_basename_ == &::google::protobuf::internal::kEmptyString) { + file_basename_ = new ::std::string; + } + file_basename_->assign(value); +} +inline void ClientDownloadRequest::set_file_basename(const char* value, size_t size) { + set_has_file_basename(); + if (file_basename_ == &::google::protobuf::internal::kEmptyString) { + file_basename_ = new ::std::string; + } + file_basename_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest::mutable_file_basename() { + set_has_file_basename(); + if (file_basename_ == &::google::protobuf::internal::kEmptyString) { + file_basename_ = new ::std::string; + } + return file_basename_; +} +inline ::std::string* ClientDownloadRequest::release_file_basename() { + clear_has_file_basename(); + if (file_basename_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = file_basename_; + file_basename_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional .safe_browsing.ClientDownloadRequest.DownloadType download_type = 10 [default = WIN_EXECUTABLE]; +inline bool ClientDownloadRequest::has_download_type() const { + return (_has_bits_[0] & 0x00000080u) != 0; +} +inline void ClientDownloadRequest::set_has_download_type() { + _has_bits_[0] |= 0x00000080u; +} +inline void ClientDownloadRequest::clear_has_download_type() { + _has_bits_[0] &= ~0x00000080u; +} +inline void ClientDownloadRequest::clear_download_type() { + download_type_ = 0; + clear_has_download_type(); +} +inline ::safe_browsing::ClientDownloadRequest_DownloadType ClientDownloadRequest::download_type() const { + return static_cast< ::safe_browsing::ClientDownloadRequest_DownloadType >(download_type_); +} +inline void ClientDownloadRequest::set_download_type(::safe_browsing::ClientDownloadRequest_DownloadType value) { + GOOGLE_DCHECK(::safe_browsing::ClientDownloadRequest_DownloadType_IsValid(value)); + set_has_download_type(); + download_type_ = value; +} + +// optional string locale = 11; +inline bool ClientDownloadRequest::has_locale() const { + return (_has_bits_[0] & 0x00000100u) != 0; +} +inline void ClientDownloadRequest::set_has_locale() { + _has_bits_[0] |= 0x00000100u; +} +inline void ClientDownloadRequest::clear_has_locale() { + _has_bits_[0] &= ~0x00000100u; +} +inline void ClientDownloadRequest::clear_locale() { + if (locale_ != &::google::protobuf::internal::kEmptyString) { + locale_->clear(); + } + clear_has_locale(); +} +inline const ::std::string& ClientDownloadRequest::locale() const { + return *locale_; +} +inline void ClientDownloadRequest::set_locale(const ::std::string& value) { + set_has_locale(); + if (locale_ == &::google::protobuf::internal::kEmptyString) { + locale_ = new ::std::string; + } + locale_->assign(value); +} +inline void ClientDownloadRequest::set_locale(const char* value) { + set_has_locale(); + if (locale_ == &::google::protobuf::internal::kEmptyString) { + locale_ = new ::std::string; + } + locale_->assign(value); +} +inline void ClientDownloadRequest::set_locale(const char* value, size_t size) { + set_has_locale(); + if (locale_ == &::google::protobuf::internal::kEmptyString) { + locale_ = new ::std::string; + } + locale_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadRequest::mutable_locale() { + set_has_locale(); + if (locale_ == &::google::protobuf::internal::kEmptyString) { + locale_ = new ::std::string; + } + return locale_; +} +inline ::std::string* ClientDownloadRequest::release_locale() { + clear_has_locale(); + if (locale_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = locale_; + locale_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientDownloadResponse_MoreInfo + +// optional string description = 1; +inline bool ClientDownloadResponse_MoreInfo::has_description() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadResponse_MoreInfo::set_has_description() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadResponse_MoreInfo::clear_has_description() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadResponse_MoreInfo::clear_description() { + if (description_ != &::google::protobuf::internal::kEmptyString) { + description_->clear(); + } + clear_has_description(); +} +inline const ::std::string& ClientDownloadResponse_MoreInfo::description() const { + return *description_; +} +inline void ClientDownloadResponse_MoreInfo::set_description(const ::std::string& value) { + set_has_description(); + if (description_ == &::google::protobuf::internal::kEmptyString) { + description_ = new ::std::string; + } + description_->assign(value); +} +inline void ClientDownloadResponse_MoreInfo::set_description(const char* value) { + set_has_description(); + if (description_ == &::google::protobuf::internal::kEmptyString) { + description_ = new ::std::string; + } + description_->assign(value); +} +inline void ClientDownloadResponse_MoreInfo::set_description(const char* value, size_t size) { + set_has_description(); + if (description_ == &::google::protobuf::internal::kEmptyString) { + description_ = new ::std::string; + } + description_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadResponse_MoreInfo::mutable_description() { + set_has_description(); + if (description_ == &::google::protobuf::internal::kEmptyString) { + description_ = new ::std::string; + } + return description_; +} +inline ::std::string* ClientDownloadResponse_MoreInfo::release_description() { + clear_has_description(); + if (description_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = description_; + description_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional string url = 2; +inline bool ClientDownloadResponse_MoreInfo::has_url() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientDownloadResponse_MoreInfo::set_has_url() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientDownloadResponse_MoreInfo::clear_has_url() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientDownloadResponse_MoreInfo::clear_url() { + if (url_ != &::google::protobuf::internal::kEmptyString) { + url_->clear(); + } + clear_has_url(); +} +inline const ::std::string& ClientDownloadResponse_MoreInfo::url() const { + return *url_; +} +inline void ClientDownloadResponse_MoreInfo::set_url(const ::std::string& value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientDownloadResponse_MoreInfo::set_url(const char* value) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(value); +} +inline void ClientDownloadResponse_MoreInfo::set_url(const char* value, size_t size) { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + url_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadResponse_MoreInfo::mutable_url() { + set_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + url_ = new ::std::string; + } + return url_; +} +inline ::std::string* ClientDownloadResponse_MoreInfo::release_url() { + clear_has_url(); + if (url_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = url_; + url_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientDownloadResponse + +// required .safe_browsing.ClientDownloadResponse.Verdict verdict = 1; +inline bool ClientDownloadResponse::has_verdict() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadResponse::set_has_verdict() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadResponse::clear_has_verdict() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadResponse::clear_verdict() { + verdict_ = 0; + clear_has_verdict(); +} +inline ::safe_browsing::ClientDownloadResponse_Verdict ClientDownloadResponse::verdict() const { + return static_cast< ::safe_browsing::ClientDownloadResponse_Verdict >(verdict_); +} +inline void ClientDownloadResponse::set_verdict(::safe_browsing::ClientDownloadResponse_Verdict value) { + GOOGLE_DCHECK(::safe_browsing::ClientDownloadResponse_Verdict_IsValid(value)); + set_has_verdict(); + verdict_ = value; +} + +// optional .safe_browsing.ClientDownloadResponse.MoreInfo more_info = 2; +inline bool ClientDownloadResponse::has_more_info() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientDownloadResponse::set_has_more_info() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientDownloadResponse::clear_has_more_info() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientDownloadResponse::clear_more_info() { + if (more_info_ != NULL) more_info_->::safe_browsing::ClientDownloadResponse_MoreInfo::Clear(); + clear_has_more_info(); +} +inline const ::safe_browsing::ClientDownloadResponse_MoreInfo& ClientDownloadResponse::more_info() const { + return more_info_ != NULL ? *more_info_ : *default_instance_->more_info_; +} +inline ::safe_browsing::ClientDownloadResponse_MoreInfo* ClientDownloadResponse::mutable_more_info() { + set_has_more_info(); + if (more_info_ == NULL) more_info_ = new ::safe_browsing::ClientDownloadResponse_MoreInfo; + return more_info_; +} +inline ::safe_browsing::ClientDownloadResponse_MoreInfo* ClientDownloadResponse::release_more_info() { + clear_has_more_info(); + ::safe_browsing::ClientDownloadResponse_MoreInfo* temp = more_info_; + more_info_ = NULL; + return temp; +} + +// optional bytes token = 3; +inline bool ClientDownloadResponse::has_token() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientDownloadResponse::set_has_token() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientDownloadResponse::clear_has_token() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientDownloadResponse::clear_token() { + if (token_ != &::google::protobuf::internal::kEmptyString) { + token_->clear(); + } + clear_has_token(); +} +inline const ::std::string& ClientDownloadResponse::token() const { + return *token_; +} +inline void ClientDownloadResponse::set_token(const ::std::string& value) { + set_has_token(); + if (token_ == &::google::protobuf::internal::kEmptyString) { + token_ = new ::std::string; + } + token_->assign(value); +} +inline void ClientDownloadResponse::set_token(const char* value) { + set_has_token(); + if (token_ == &::google::protobuf::internal::kEmptyString) { + token_ = new ::std::string; + } + token_->assign(value); +} +inline void ClientDownloadResponse::set_token(const void* value, size_t size) { + set_has_token(); + if (token_ == &::google::protobuf::internal::kEmptyString) { + token_ = new ::std::string; + } + token_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadResponse::mutable_token() { + set_has_token(); + if (token_ == &::google::protobuf::internal::kEmptyString) { + token_ = new ::std::string; + } + return token_; +} +inline ::std::string* ClientDownloadResponse::release_token() { + clear_has_token(); + if (token_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = token_; + token_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientDownloadReport_UserInformation + +// optional string email = 1; +inline bool ClientDownloadReport_UserInformation::has_email() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadReport_UserInformation::set_has_email() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadReport_UserInformation::clear_has_email() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadReport_UserInformation::clear_email() { + if (email_ != &::google::protobuf::internal::kEmptyString) { + email_->clear(); + } + clear_has_email(); +} +inline const ::std::string& ClientDownloadReport_UserInformation::email() const { + return *email_; +} +inline void ClientDownloadReport_UserInformation::set_email(const ::std::string& value) { + set_has_email(); + if (email_ == &::google::protobuf::internal::kEmptyString) { + email_ = new ::std::string; + } + email_->assign(value); +} +inline void ClientDownloadReport_UserInformation::set_email(const char* value) { + set_has_email(); + if (email_ == &::google::protobuf::internal::kEmptyString) { + email_ = new ::std::string; + } + email_->assign(value); +} +inline void ClientDownloadReport_UserInformation::set_email(const char* value, size_t size) { + set_has_email(); + if (email_ == &::google::protobuf::internal::kEmptyString) { + email_ = new ::std::string; + } + email_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadReport_UserInformation::mutable_email() { + set_has_email(); + if (email_ == &::google::protobuf::internal::kEmptyString) { + email_ = new ::std::string; + } + return email_; +} +inline ::std::string* ClientDownloadReport_UserInformation::release_email() { + clear_has_email(); + if (email_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = email_; + email_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// ------------------------------------------------------------------- + +// ClientDownloadReport + +// optional .safe_browsing.ClientDownloadReport.Reason reason = 1; +inline bool ClientDownloadReport::has_reason() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientDownloadReport::set_has_reason() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientDownloadReport::clear_has_reason() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientDownloadReport::clear_reason() { + reason_ = 0; + clear_has_reason(); +} +inline ::safe_browsing::ClientDownloadReport_Reason ClientDownloadReport::reason() const { + return static_cast< ::safe_browsing::ClientDownloadReport_Reason >(reason_); +} +inline void ClientDownloadReport::set_reason(::safe_browsing::ClientDownloadReport_Reason value) { + GOOGLE_DCHECK(::safe_browsing::ClientDownloadReport_Reason_IsValid(value)); + set_has_reason(); + reason_ = value; +} + +// optional .safe_browsing.ClientDownloadRequest download_request = 2; +inline bool ClientDownloadReport::has_download_request() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientDownloadReport::set_has_download_request() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientDownloadReport::clear_has_download_request() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientDownloadReport::clear_download_request() { + if (download_request_ != NULL) download_request_->::safe_browsing::ClientDownloadRequest::Clear(); + clear_has_download_request(); +} +inline const ::safe_browsing::ClientDownloadRequest& ClientDownloadReport::download_request() const { + return download_request_ != NULL ? *download_request_ : *default_instance_->download_request_; +} +inline ::safe_browsing::ClientDownloadRequest* ClientDownloadReport::mutable_download_request() { + set_has_download_request(); + if (download_request_ == NULL) download_request_ = new ::safe_browsing::ClientDownloadRequest; + return download_request_; +} +inline ::safe_browsing::ClientDownloadRequest* ClientDownloadReport::release_download_request() { + clear_has_download_request(); + ::safe_browsing::ClientDownloadRequest* temp = download_request_; + download_request_ = NULL; + return temp; +} + +// optional .safe_browsing.ClientDownloadReport.UserInformation user_information = 3; +inline bool ClientDownloadReport::has_user_information() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void ClientDownloadReport::set_has_user_information() { + _has_bits_[0] |= 0x00000004u; +} +inline void ClientDownloadReport::clear_has_user_information() { + _has_bits_[0] &= ~0x00000004u; +} +inline void ClientDownloadReport::clear_user_information() { + if (user_information_ != NULL) user_information_->::safe_browsing::ClientDownloadReport_UserInformation::Clear(); + clear_has_user_information(); +} +inline const ::safe_browsing::ClientDownloadReport_UserInformation& ClientDownloadReport::user_information() const { + return user_information_ != NULL ? *user_information_ : *default_instance_->user_information_; +} +inline ::safe_browsing::ClientDownloadReport_UserInformation* ClientDownloadReport::mutable_user_information() { + set_has_user_information(); + if (user_information_ == NULL) user_information_ = new ::safe_browsing::ClientDownloadReport_UserInformation; + return user_information_; +} +inline ::safe_browsing::ClientDownloadReport_UserInformation* ClientDownloadReport::release_user_information() { + clear_has_user_information(); + ::safe_browsing::ClientDownloadReport_UserInformation* temp = user_information_; + user_information_ = NULL; + return temp; +} + +// optional bytes comment = 4; +inline bool ClientDownloadReport::has_comment() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void ClientDownloadReport::set_has_comment() { + _has_bits_[0] |= 0x00000008u; +} +inline void ClientDownloadReport::clear_has_comment() { + _has_bits_[0] &= ~0x00000008u; +} +inline void ClientDownloadReport::clear_comment() { + if (comment_ != &::google::protobuf::internal::kEmptyString) { + comment_->clear(); + } + clear_has_comment(); +} +inline const ::std::string& ClientDownloadReport::comment() const { + return *comment_; +} +inline void ClientDownloadReport::set_comment(const ::std::string& value) { + set_has_comment(); + if (comment_ == &::google::protobuf::internal::kEmptyString) { + comment_ = new ::std::string; + } + comment_->assign(value); +} +inline void ClientDownloadReport::set_comment(const char* value) { + set_has_comment(); + if (comment_ == &::google::protobuf::internal::kEmptyString) { + comment_ = new ::std::string; + } + comment_->assign(value); +} +inline void ClientDownloadReport::set_comment(const void* value, size_t size) { + set_has_comment(); + if (comment_ == &::google::protobuf::internal::kEmptyString) { + comment_ = new ::std::string; + } + comment_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientDownloadReport::mutable_comment() { + set_has_comment(); + if (comment_ == &::google::protobuf::internal::kEmptyString) { + comment_ = new ::std::string; + } + return comment_; +} +inline ::std::string* ClientDownloadReport::release_comment() { + clear_has_comment(); + if (comment_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = comment_; + comment_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + +// optional .safe_browsing.ClientDownloadResponse download_response = 5; +inline bool ClientDownloadReport::has_download_response() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void ClientDownloadReport::set_has_download_response() { + _has_bits_[0] |= 0x00000010u; +} +inline void ClientDownloadReport::clear_has_download_response() { + _has_bits_[0] &= ~0x00000010u; +} +inline void ClientDownloadReport::clear_download_response() { + if (download_response_ != NULL) download_response_->::safe_browsing::ClientDownloadResponse::Clear(); + clear_has_download_response(); +} +inline const ::safe_browsing::ClientDownloadResponse& ClientDownloadReport::download_response() const { + return download_response_ != NULL ? *download_response_ : *default_instance_->download_response_; +} +inline ::safe_browsing::ClientDownloadResponse* ClientDownloadReport::mutable_download_response() { + set_has_download_response(); + if (download_response_ == NULL) download_response_ = new ::safe_browsing::ClientDownloadResponse; + return download_response_; +} +inline ::safe_browsing::ClientDownloadResponse* ClientDownloadReport::release_download_response() { + clear_has_download_response(); + ::safe_browsing::ClientDownloadResponse* temp = download_response_; + download_response_ = NULL; + return temp; +} + +// ------------------------------------------------------------------- + +// ClientUploadResponse + +// optional .safe_browsing.ClientUploadResponse.UploadStatus status = 1; +inline bool ClientUploadResponse::has_status() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void ClientUploadResponse::set_has_status() { + _has_bits_[0] |= 0x00000001u; +} +inline void ClientUploadResponse::clear_has_status() { + _has_bits_[0] &= ~0x00000001u; +} +inline void ClientUploadResponse::clear_status() { + status_ = 0; + clear_has_status(); +} +inline ::safe_browsing::ClientUploadResponse_UploadStatus ClientUploadResponse::status() const { + return static_cast< ::safe_browsing::ClientUploadResponse_UploadStatus >(status_); +} +inline void ClientUploadResponse::set_status(::safe_browsing::ClientUploadResponse_UploadStatus value) { + GOOGLE_DCHECK(::safe_browsing::ClientUploadResponse_UploadStatus_IsValid(value)); + set_has_status(); + status_ = value; +} + +// optional string permalink = 2; +inline bool ClientUploadResponse::has_permalink() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void ClientUploadResponse::set_has_permalink() { + _has_bits_[0] |= 0x00000002u; +} +inline void ClientUploadResponse::clear_has_permalink() { + _has_bits_[0] &= ~0x00000002u; +} +inline void ClientUploadResponse::clear_permalink() { + if (permalink_ != &::google::protobuf::internal::kEmptyString) { + permalink_->clear(); + } + clear_has_permalink(); +} +inline const ::std::string& ClientUploadResponse::permalink() const { + return *permalink_; +} +inline void ClientUploadResponse::set_permalink(const ::std::string& value) { + set_has_permalink(); + if (permalink_ == &::google::protobuf::internal::kEmptyString) { + permalink_ = new ::std::string; + } + permalink_->assign(value); +} +inline void ClientUploadResponse::set_permalink(const char* value) { + set_has_permalink(); + if (permalink_ == &::google::protobuf::internal::kEmptyString) { + permalink_ = new ::std::string; + } + permalink_->assign(value); +} +inline void ClientUploadResponse::set_permalink(const char* value, size_t size) { + set_has_permalink(); + if (permalink_ == &::google::protobuf::internal::kEmptyString) { + permalink_ = new ::std::string; + } + permalink_->assign(reinterpret_cast(value), size); +} +inline ::std::string* ClientUploadResponse::mutable_permalink() { + set_has_permalink(); + if (permalink_ == &::google::protobuf::internal::kEmptyString) { + permalink_ = new ::std::string; + } + return permalink_; +} +inline ::std::string* ClientUploadResponse::release_permalink() { + clear_has_permalink(); + if (permalink_ == &::google::protobuf::internal::kEmptyString) { + return NULL; + } else { + ::std::string* temp = permalink_; + permalink_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString); + return temp; + } +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace safe_browsing + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_csd_2eproto__INCLUDED diff --git a/toolkit/components/downloads/generate_csd.sh b/toolkit/components/downloads/generate_csd.sh new file mode 100755 index 000000000000..ff2b1c18a675 --- /dev/null +++ b/toolkit/components/downloads/generate_csd.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# A script to generate toolkit/components/downloads/csd.pb.{cc,h} for use in +# nsIApplicationReputationQuery. This script assumes you have downloaded and +# installed the protocol buffer compiler. + +if [ -n $PROTOC_PATH ]; then + PROTOC_PATH=/usr/local/bin/protoc +fi + +echo "Using $PROTOC_PATH as protocol compiler" + +if [ ! -e $PROTOC_PATH ]; then + echo "You must install the protocol compiler from " \ + "https://code.google.com/p/protobuf/downloads/list" + exit 1 +fi + +# Get the protocol buffer and compile it +CMD='wget http://src.chromium.org/chrome/trunk/src/chrome/common/safe_browsing/csd.proto -O csd.proto' +OUTPUT_PATH=toolkit/components/downloads + +$CMD +$PROTOC_PATH csd.proto --cpp_out=$OUTPUT_PATH diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build index b651c440d1fb..da4f7ddb96e6 100644 --- a/toolkit/components/downloads/moz.build +++ b/toolkit/components/downloads/moz.build @@ -7,6 +7,7 @@ TEST_DIRS += ['test'] XPIDL_SOURCES += [ + 'nsIApplicationReputation.idl', 'nsIDownload.idl', 'nsIDownloadManager.idl', 'nsIDownloadManagerUI.idl', @@ -18,6 +19,8 @@ MODULE = 'downloads' CPP_SOURCES += [ 'SQLFunctions.cpp', 'nsDownloadManager.cpp', + 'ApplicationReputation.cpp', + 'csd.pb.cc' ] if CONFIG['OS_ARCH'] == 'WINNT': diff --git a/toolkit/components/downloads/nsIApplicationReputation.idl b/toolkit/components/downloads/nsIApplicationReputation.idl new file mode 100644 index 000000000000..b947de9fecb3 --- /dev/null +++ b/toolkit/components/downloads/nsIApplicationReputation.idl @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +interface nsIApplicationReputationCallback; +interface nsIApplicationReputationQuery; +interface nsIURI; + +/* + * A service for asynchronously querying an application reputation service + * based on metadata of the downloaded file. + */ +[scriptable, uuid(9c12a510-eb1c-11e2-a98a-fa916188709b)] +interface nsIApplicationReputationService : nsISupports { + /** + * Start querying the application reputation service. + * + * @param aQuery + * The nsIApplicationReputationQuery containing metadata of the + * downloaded file. + * + * @param aCallback + * The callback for receiving the results of the query. + * + * @remarks aCallback may not be null. onComplete is guaranteed to be called + * on aCallback. This function may not be called more than once with + * the same query object. If any of the attributes of aQuery have + * not been set or have been set with empty data (with the exception + * of sourceURI), then a valid request can still be constructed and + * will solicit a valid response, but won't produce any useful + * information. + */ + void queryReputation(in nsIApplicationReputationQuery aQuery, + in nsIApplicationReputationCallback aCallback); +}; + +/** + * A single-use, write-once interface for recording the metadata of the + * downloaded file. nsIApplicationReputationService.Start() may only be called + * once with a single query. + */ +[scriptable, uuid(857da2c0-cfe5-11e2-8b8b-0800200c9a66)] +interface nsIApplicationReputationQuery : nsISupports { + /* + * The nsIURI from which the file was downloaded. This may not be null. + */ + attribute nsIURI sourceURI; + + /* + * The target filename for the downloaded file, as inferred from the source + * URI or provided by the Content-Disposition attachment file name. If this + * is not set by the caller, it will be passed as an empty string but the + * query won't produce any useful information. + */ + attribute AString suggestedFileName; + + /* + * The size of the downloaded file in bytes. + */ + attribute unsigned long fileSize; + + /* + * The SHA256 hash of the downloaded file in raw bytes. If this is not set by + * the caller, it will be passed as an empty string but the query won't + * produce any useful information. + */ + attribute ACString sha256Hash; + + /** + * The callback object listening to this query. + */ + attribute nsIApplicationReputationCallback callback; +}; + +[scriptable, function, uuid(9a228470-cfe5-11e2-8b8b-0800200c9a66)] +interface nsIApplicationReputationCallback : nsISupports { + /** + * Callback for the result of the application reputation query. + * @param aStatus + * NS_OK if and only if the query succeeded. If it did, then + * shouldBlock is meaningful (otherwise it defaults to false). This + * may be NS_ERROR_FAILURE if the response cannot be parsed, or + * NS_ERROR_NOT_AVAILABLE if the service has been disabled or is not + * reachable. + * @param aShouldBlock + * Whether or not the download should be blocked. + */ + void onComplete(in bool aShouldBlock, + in nsresult aStatus); +}; diff --git a/toolkit/components/downloads/test/unit/tail_download_manager.js b/toolkit/components/downloads/test/unit/tail_download_manager.js new file mode 100644 index 000000000000..0705c1dbf751 --- /dev/null +++ b/toolkit/components/downloads/test/unit/tail_download_manager.js @@ -0,0 +1,24 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * Provides infrastructure for automated download components tests. + */ + +"use strict"; + +//////////////////////////////////////////////////////////////////////////////// +//// Termination functions common to all tests + +add_task(function test_common_terminate() +{ + // Stop the HTTP server. We must do this inside a task in "tail.js" until the + // xpcshell testing framework supports asynchronous termination functions. + let deferred = Promise.defer(); + gHttpServer.stop(deferred.resolve); + yield deferred.promise; +}); + diff --git a/toolkit/components/downloads/test/unit/test_app_rep.js b/toolkit/components/downloads/test/unit/test_app_rep.js new file mode 100644 index 000000000000..93129f9fe51d --- /dev/null +++ b/toolkit/components/downloads/test/unit/test_app_rep.js @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +Cu.import('resource://gre/modules/NetUtil.jsm'); +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +const ApplicationReputationQuery = Components.Constructor( + "@mozilla.org/downloads/application-reputation-query;1", + "nsIApplicationReputationQuery"); + +const gAppRep = Cc["@mozilla.org/downloads/application-reputation-service;1"]. + getService(Ci.nsIApplicationReputationService); +let gHttpServ = null; + +function run_test() { + // Set up a local HTTP server to return bad verdicts. + Services.prefs.setCharPref("browser.safebrowsing.appRepURL", + "http://localhost:4444/download"); + gHttpServ = new HttpServer(); + gHttpServ.registerDirectory("/", do_get_cwd()); + + function createVerdict(aShouldBlock) { + // We can't programmatically create a protocol buffer here, so just + // hardcode some already serialized ones. + blob = String.fromCharCode(parseInt(0x08, 16)); + if (aShouldBlock) { + // A safe_browsing::ClientDownloadRequest with a DANGEROUS verdict + blob += String.fromCharCode(parseInt(0x01, 16)); + } else { + // A safe_browsing::ClientDownloadRequest with a SAFE verdict + blob += String.fromCharCode(parseInt(0x00, 16)); + } + return blob; + } + + gHttpServ.registerPathHandler("/download", function(request, response) { + response.setHeader("Content-Type", "application/octet-stream", false); + let buf = NetUtil.readInputStreamToString( + request.bodyInputStream, + request.bodyInputStream.available()); + do_print("Request length: " + buf.length); + // A garbage response. + let blob = "this is not a serialized protocol buffer"; + // We can't actually parse the protocol buffer here, so just switch on the + // length instead of inspecting the contents. + if (buf.length == 35) { + blob = createVerdict(true); + } else if (buf.length == 38) { + blob = createVerdict(false); + } + response.bodyOutputStream.write(blob, blob.length); + }); + + gHttpServ.start(4444); + + run_next_test(); +} + +add_test(function test_shouldBlock() { + let query = new ApplicationReputationQuery(); + query.sourceURI = createURI("http://evil.com"); + query.fileSize = 12; + + gAppRep.queryReputation(query, function onComplete(aShouldBlock, aStatus) { + do_check_true(aShouldBlock); + do_check_eq(Cr.NS_OK, aStatus); + run_next_test(); + }); +}); + +add_test(function test_shouldNotBlock() { + let query = new ApplicationReputationQuery(); + query.sourceURI = createURI("http://mozilla.com"); + query.fileSize = 12; + + gAppRep.queryReputation(query, function onComplete(aShouldBlock, aStatus) { + do_check_eq(Cr.NS_OK, aStatus); + do_check_false(aShouldBlock); + run_next_test(); + }); +}); + +add_test(function test_garbage() { + let query = new ApplicationReputationQuery(); + query.sourceURI = createURI("http://thisisagarbageurl.com"); + query.fileSize = 12; + + gAppRep.queryReputation(query, function onComplete(aShouldBlock, aStatus) { + // We should be getting the garbage response. + do_check_eq(Cr.NS_ERROR_CANNOT_CONVERT_DATA, aStatus); + do_check_false(aShouldBlock); + run_next_test(); + }); +}); + +add_test(function test_nullSourceURI() { + let query = new ApplicationReputationQuery(); + query.fileSize = 12; + // No source URI + gAppRep.queryReputation(query, function onComplete(aShouldBlock, aStatus) { + do_check_eq(Cr.NS_ERROR_UNEXPECTED, aStatus); + do_check_false(aShouldBlock); + run_next_test(); + }); +}); + +add_test(function test_nullCallback() { + let query = new ApplicationReputationQuery(); + query.fileSize = 12; + try { + gAppRep.queryReputation(query, null); + do_throw("Callback cannot be null"); + } catch (ex if ex.result == Cr.NS_ERROR_INVALID_POINTER) { + run_next_test(); + } +}); + +add_test(function test_disabled() { + Services.prefs.setCharPref("browser.safebrowsing.appRepURL", ""); + let query = new ApplicationReputationQuery(); + query.sourceURI = createURI("http://example.com"); + query.fileSize = 12; + gAppRep.queryReputation(query, function onComplete(aShouldBlock, aStatus) { + // We should be getting NS_ERROR_NOT_AVAILABLE if the service is disabled + do_check_eq(Cr.NS_ERROR_NOT_AVAILABLE, aStatus); + do_check_false(aShouldBlock); + run_next_test(); + }); +}); diff --git a/toolkit/components/downloads/test/unit/xpcshell.ini b/toolkit/components/downloads/test/unit/xpcshell.ini index ded33cfabe26..7a23e27565b3 100644 --- a/toolkit/components/downloads/test/unit/xpcshell.ini +++ b/toolkit/components/downloads/test/unit/xpcshell.ini @@ -1,8 +1,9 @@ [DEFAULT] head = head_download_manager.js -tail = +tail = tail_download_manager.js firefox-appdir = browser +[test_app_rep.js] [test_bug_382825.js] [test_bug_384744.js] [test_bug_395092.js] diff --git a/toolkit/components/protobuf/Makefile.in b/toolkit/components/protobuf/Makefile.in index 618a4c38a99f..c0aaf14b3a95 100644 --- a/toolkit/components/protobuf/Makefile.in +++ b/toolkit/components/protobuf/Makefile.in @@ -26,4 +26,4 @@ LOCAL_INCLUDES = \ include $(topsrcdir)/config/rules.mk -CXXFLAGS += $(TK_CFLAGS) +CXXFLAGS += $(TK_CFLAGS) -DGOOGLE_PROTOBUF_NO_RTTI From db3de1c7a257bf3b7607395d4bdc9fed56b3dff9 Mon Sep 17 00:00:00 2001 From: Armen Zambrano Gasparnian Date: Fri, 26 Jul 2013 11:04:31 -0400 Subject: [PATCH 29/92] Bug 895451 - Automate Talos setup & running Talos on the tree. DONTBUILD. r=gps --- build/mach_bootstrap.py | 1 + testing/talos/mach_commands.py | 149 +++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 testing/talos/mach_commands.py diff --git a/build/mach_bootstrap.py b/build/mach_bootstrap.py index 310c97630abb..c2ec84bf8613 100644 --- a/build/mach_bootstrap.py +++ b/build/mach_bootstrap.py @@ -65,6 +65,7 @@ MACH_MODULES = [ 'testing/marionette/mach_commands.py', 'testing/mochitest/mach_commands.py', 'testing/xpcshell/mach_commands.py', + 'testing/talos/mach_commands.py', 'tools/mach_commands.py', ] diff --git a/testing/talos/mach_commands.py b/testing/talos/mach_commands.py new file mode 100644 index 000000000000..6cc389383d11 --- /dev/null +++ b/testing/talos/mach_commands.py @@ -0,0 +1,149 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Integrates Talos mozharness with mach + +from __future__ import print_function, unicode_literals + +import os +import sys +import json +import which + +from mozbuild.base import ( + MozbuildObject, + MachCommandBase +) + +from mach.decorators import ( + CommandArgument, + CommandProvider, + Command, +) + +class TalosRunner(MozbuildObject): + def run_test(self, suite, repo, rev): + """ + We want to do couple of things before running Talos + 1. Clone mozharness + 2. Make config for Talos Mozharness + 3. Run mozharness + """ + + print("Running Talos test suite %s" % suite) + self.init_variables(suite, repo, rev) + self.clone_mozharness() + self.make_config() + self.write_config() + self.make_args() + return self.run_mozharness() + + def init_variables(self, suite, repo, rev): + self.suite = suite + self.mozharness_repo = repo + self.mozharness_rev = rev + + self.talos_dir = os.path.join(self.topsrcdir, 'testing', 'talos') + self.mozharness_dir = os.path.join(self.topobjdir, 'mozharness') + self.config_dir = os.path.join(self.mozharness_dir, 'configs', 'talos') + self.talos_json = os.path.join(self.talos_dir, 'talos.json') + self.config_filename = 'in_tree_conf.json' + self.config_file_path = os.path.join(self.config_dir, + self.config_filename) + self.binary_path = self.get_binary_path() + self.virtualenv_script = os.path.join(self.topsrcdir, 'python', + 'virtualenv', 'virtualenv.py') + self.virtualenv_path = os.path.join(self.mozharness_dir, 'venv') + self.python_interp = sys.executable + + def clone_mozharness(self): + """Clones mozharness into topobjdir/mozharness + using mercurial. If mozharness is already cloned, + it updates it to the latest version""" + try: + mercurial = which.which('hg') + except which.WhichError as e: + print("You don't have hg in your PATH: {0}".format(e)) + raise e + clone_cmd = [mercurial, 'clone', '-r', self.mozharness_rev, + self.mozharness_repo, self.mozharness_dir] + pull_cmd = [mercurial, 'pull', '-r', self.mozharness_rev, '-u'] + + dot_hg = os.path.join(self.mozharness_dir, '.hg') + if os.path.exists(dot_hg): + self.run_process(args=pull_cmd, cwd=self.mozharness_dir) + else: + self.run_process(args=clone_cmd) + + def make_config(self): + self.config = { + 'talos_json': self.talos_json, + 'binary_path': self.binary_path, + 'log_name': 'talos', + 'virtualenv_path': self.virtualenv_path, + 'pypi_url': 'http://pypi.python.org/simple', + 'use_talos_json': True, + 'base_work_dir': self.mozharness_dir, + 'exes': { + 'python': self.python_interp, + 'virtualenv': [self.python_interp, self.virtualenv_script] + }, + 'title': os.uname()[1].lower().split('.')[0], + 'default_actions': [ + 'clone-talos', + 'create-virtualenv', + 'run-tests', + ], + 'python_webserver': True + } + + def make_args(self): + self.args = { + 'config': { + 'suite': self.suite, + 'use_talos_json': True + }, + 'initial_config_file': self.config_file_path, + } + + def write_config(self): + try: + config_file = open(self.config_file_path, 'wb') + config_file.write(json.dumps(self.config)) + except IOError as e: + err_str = "Error writing to Talos Mozharness config file {0}:{1}" + print(err_str.format(self.config_file_path, str(e))) + raise e + + def run_mozharness(self): + sys.path.append(self.mozharness_dir) + from mozharness.mozilla.testing.talos import Talos + talos_mh = Talos(config=self.args['config'], + initial_config_file=self.args['initial_config_file']) + return talos_mh.run() + +@CommandProvider +class MachCommands(MachCommandBase): + mozharness_repo = 'https://hg.mozilla.org/build/mozharness' + mozharness_rev = 'production' + + @Command('talos-test', category='testing', + description='Run talos tests.') + @CommandArgument('suite', help='Talos test suite to run. Valid suites are ' + 'chromez, dirtypaint, dromaeojs, other,' + 'svgr, rafx, tpn, tp5o, xperf.') + @CommandArgument('--repo', default=mozharness_repo, + help='The mozharness repository to clone from. ' + 'Defaults to http://hg.mozilla.org/build/mozharness') + @CommandArgument('--rev', default=mozharness_rev, + help='The mozharness revision to clone. Defaults to ' + 'production') + def run_talos_test(self, suite, repo=None, rev=None): + talos = self._spawn(TalosRunner) + + try: + return talos.run_test(suite, repo, rev) + except Exception as e: + print(str(e)) + return 1 From ae2c4db874bda781f9b7b8e2f8005be735997f0d Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 24 Jul 2013 12:53:43 -0400 Subject: [PATCH 30/92] Bug 897407 - package JS shell for all android builds; r=gps --- mobile/android/config/mozconfigs/common | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mobile/android/config/mozconfigs/common b/mobile/android/config/mozconfigs/common index 9c0742838080..086d0ee3fc7c 100644 --- a/mobile/android/config/mozconfigs/common +++ b/mobile/android/config/mozconfigs/common @@ -39,5 +39,8 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL} # Treat warnings as errors in directories with FAIL_ON_WARNINGS. ac_add_options --enable-warnings-as-errors +# Package js shell. +export MOZ_PACKAGE_JSSHELL=1 + # Use ccache ac_add_options --with-ccache=/usr/bin/ccache From 371753028b8318592b5c272b629b850a7fa6f823 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Fri, 26 Jul 2013 08:12:51 -0700 Subject: [PATCH 31/92] Bug 692226 - Record weak map entries in the cycle collector log. r=smaug --- xpcom/base/nsCycleCollector.cpp | 15 +++++++++++++++ xpcom/base/nsICycleCollectorListener.idl | 6 +++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 7152ace340a9..89b9f494c20d 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -1519,6 +1519,16 @@ public: } return NS_OK; } + NS_IMETHOD NoteWeakMapEntry(uint64_t aMap, uint64_t aKey, + uint64_t aKeyDelegate, uint64_t aValue) + { + if (!mDisableLog) { + fprintf(mStream, "WeakMapEntry map=%p key=%p keyDelegate=%p value=%p\n", + (void*)aMap, (void*)aKey, (void*)aKeyDelegate, (void*)aValue); + } + // We don't support after-processing for weak map entries. + return NS_OK; + } NS_IMETHOD BeginResults() { if (!mDisableLog) { @@ -2070,6 +2080,11 @@ GCGraphBuilder::NoteWeakMapping(void *map, void *key, void *kdelegate, void *val mapping->mKey = key ? AddWeakMapNode(key) : nullptr; mapping->mKeyDelegate = kdelegate ? AddWeakMapNode(kdelegate) : mapping->mKey; mapping->mVal = val ? AddWeakMapNode(val) : nullptr; + + if (mListener) { + mListener->NoteWeakMapEntry((uint64_t)map, (uint64_t)key, + (uint64_t)kdelegate, (uint64_t)val); + } } static bool diff --git a/xpcom/base/nsICycleCollectorListener.idl b/xpcom/base/nsICycleCollectorListener.idl index e33073c60bfb..1ee71f8d495d 100644 --- a/xpcom/base/nsICycleCollectorListener.idl +++ b/xpcom/base/nsICycleCollectorListener.idl @@ -34,7 +34,7 @@ interface nsICycleCollectorHandler : nsISupports * a call to end(). If begin() returns an error none of the other * functions will be called. */ -[scriptable, builtinclass, uuid(4282249c-7f80-4093-b620-96c573ad683e)] +[scriptable, builtinclass, uuid(32a3ab19-82a3-4096-a12a-de37274f51c3)] interface nsICycleCollectorListener : nsISupports { nsICycleCollectorListener allTraces(); @@ -58,6 +58,10 @@ interface nsICycleCollectorListener : nsISupports in string aObjectDescription); void noteEdge(in unsigned long long aToAddress, in string aEdgeName); + void noteWeakMapEntry(in unsigned long long aMap, + in unsigned long long aKey, + in unsigned long long aKeyDelegate, + in unsigned long long aValue); void beginResults(); void describeRoot(in unsigned long long aAddress, in unsigned long aKnownEdges); From d2297abc430475dc75ef8141df33f3c3296a5398 Mon Sep 17 00:00:00 2001 From: Eitan Isaacson Date: Fri, 26 Jul 2013 08:18:12 -0700 Subject: [PATCH 32/92] Bug 898008 - Use 'wheel' event for scrolling. r=maxli --- accessible/src/jsat/AccessFu.jsm | 35 ++++++++++-- accessible/src/jsat/content-script.js | 81 +++------------------------ 2 files changed, 38 insertions(+), 78 deletions(-) diff --git a/accessible/src/jsat/AccessFu.jsm b/accessible/src/jsat/AccessFu.jsm index cd056c7ce638..1ace843abd91 100644 --- a/accessible/src/jsat/AccessFu.jsm +++ b/accessible/src/jsat/AccessFu.jsm @@ -201,6 +201,9 @@ this.AccessFu = { case 'AccessFu:ActivateContextMenu': this.Input.activateContextMenu(aMessage.json); break; + case 'AccessFu:DoScroll': + this.Input.doScroll(aMessage.json); + break; } }, @@ -240,6 +243,7 @@ this.AccessFu = { aMessageManager.addMessageListener('AccessFu:Input', this); aMessageManager.addMessageListener('AccessFu:Ready', this); aMessageManager.addMessageListener('AccessFu:ActivateContextMenu', this); + aMessageManager.addMessageListener('AccessFu:DoScroll', this); }, _removeMessageListeners: function _removeMessageListeners(aMessageManager) { @@ -247,6 +251,7 @@ this.AccessFu = { aMessageManager.removeMessageListener('AccessFu:Input', this); aMessageManager.removeMessageListener('AccessFu:Ready', this); aMessageManager.removeMessageListener('AccessFu:ActivateContextMenu', this); + aMessageManager.removeMessageListener('AccessFu:DoScroll', this); }, _handleMessageManager: function _handleMessageManager(aMessageManager) { @@ -668,16 +673,16 @@ var Input = { this.moveCursor('movePrevious', 'Simple', 'gesture'); break; case 'swiperight2': - this.scroll(-1, true); + this.sendScrollMessage(-1, true); break; case 'swipedown2': - this.scroll(-1); + this.sendScrollMessage(-1); break; case 'swipeleft2': - this.scroll(1, true); + this.sendScrollMessage(1, true); break; case 'swipeup2': - this.scroll(1); + this.sendScrollMessage(1); break; case 'explore2': Utils.CurrentBrowser.contentWindow.scrollBy( @@ -820,9 +825,9 @@ var Input = { mm.sendAsyncMessage('AccessFu:ContextMenu', {}); }, - activateContextMenu: function activateContextMenu(aMessage) { + activateContextMenu: function activateContextMenu(aDetails) { if (Utils.MozBuildApp === 'mobile/android') { - let p = AccessFu.adjustContentBounds(aMessage.bounds, Utils.CurrentBrowser, + let p = AccessFu.adjustContentBounds(aDetails.bounds, Utils.CurrentBrowser, true, true).center(); Services.obs.notifyObservers(null, 'Gesture:LongPress', JSON.stringify({x: p.x, y: p.y})); @@ -833,11 +838,29 @@ var Input = { this.editState = aEditState; }, + // XXX: This is here for backwards compatability with screen reader simulator + // it should be removed when the extension is updated on amo. scroll: function scroll(aPage, aHorizontal) { + this.sendScrollMessage(aPage, aHorizontal); + }, + + sendScrollMessage: function sendScrollMessage(aPage, aHorizontal) { let mm = Utils.getMessageManager(Utils.CurrentBrowser); mm.sendAsyncMessage('AccessFu:Scroll', {page: aPage, horizontal: aHorizontal, origin: 'top'}); }, + doScroll: function doScroll(aDetails) { + let horizontal = aDetails.horizontal; + let page = aDetails.page; + let p = AccessFu.adjustContentBounds(aDetails.bounds, Utils.CurrentBrowser, + true, true).center(); + let wu = Utils.win.QueryInterface(Ci.nsIInterfaceRequestor). + getInterface(Ci.nsIDOMWindowUtils); + wu.sendWheelEvent(p.x, p.y, + horizontal ? page : 0, horizontal ? 0 : page, 0, + Utils.win.WheelEvent.DOM_DELTA_PAGE, 0, 0, 0, 0); + }, + get keyMap() { delete this.keyMap; this.keyMap = { diff --git a/accessible/src/jsat/content-script.js b/accessible/src/jsat/content-script.js index 9b157b13fbab..13d4c2649f8c 100644 --- a/accessible/src/jsat/content-script.js +++ b/accessible/src/jsat/content-script.js @@ -306,80 +306,17 @@ function presentCaretChange(aText, aOldOffset, aNewOffset) { } function scroll(aMessage) { - let vc = Utils.getVirtualCursor(content.document); - - function tryToScroll() { - let horiz = aMessage.json.horizontal; - let page = aMessage.json.page; - - // Search up heirarchy for scrollable element. - let acc = vc.position; - while (acc) { - let elem = acc.DOMNode; - - // This is inspired by IndieUI events. Once they are - // implemented, it should be easy to transition to them. - // https://dvcs.w3.org/hg/IndieUI/raw-file/tip/src/indie-ui-events.html#scrollrequest - let uiactions = elem.getAttribute ? elem.getAttribute('uiactions') : ''; - if (uiactions && uiactions.split(' ').indexOf('scroll') >= 0) { - let evt = elem.ownerDocument.createEvent('CustomEvent'); - let details = horiz ? { deltaX: page * elem.clientWidth } : - { deltaY: page * elem.clientHeight }; - evt.initCustomEvent( - 'scrollrequest', true, true, - ObjectWrapper.wrap(details, elem.ownerDocument.defaultView)); - if (!elem.dispatchEvent(evt)) - return; - } - - // We will do window scrolling next. - if (elem == content.document) - break; - - if (!horiz && elem.clientHeight < elem.scrollHeight) { - let s = content.getComputedStyle(elem); - if (s.overflowY == 'scroll' || s.overflowY == 'auto') { - elem.scrollTop += page * elem.clientHeight; - return true; - } - } - - if (horiz) { - if (elem.clientWidth < elem.scrollWidth) { - let s = content.getComputedStyle(elem); - if (s.overflowX == 'scroll' || s.overflowX == 'auto') { - elem.scrollLeft += page * elem.clientWidth; - return true; - } - } - } - acc = acc.parent; - } - - // Scroll window. - if (!horiz && content.scrollMaxY && - ((page > 0 && content.scrollY < content.scrollMaxY) || - (page < 0 && content.scrollY > 0))) { - content.scroll(0, content.innerHeight * page + content.scrollY); - return true; - } else if (horiz && content.scrollMaxX && - ((page > 0 && content.scrollX < content.scrollMaxX) || - (page < 0 && content.scrollX > 0))) { - content.scroll(content.innerWidth * page + content.scrollX); - return true; - } - - return false; + function sendScrollCoordinates(aAccessible) { + let bounds = Utils.getBounds(aAccessible); + sendAsyncMessage('AccessFu:DoScroll', + { bounds: bounds, + page: aMessage.json.page, + horizontal: aMessage.json.horizontal }); } - if (aMessage.json.origin != 'child' && - forwardToChild(aMessage, scroll, vc.position)) { - return; - } - - if (!tryToScroll()) { - // Failed to scroll anything in this document. Try in parent document. - forwardToParent(aMessage); + let position = Utils.getVirtualCursor(content.document).position; + if (!forwardToChild(aMessage, scroll, position)) { + sendScrollCoordinates(position); } } From 99445148b262249cb2a3edfbddb18424cd1406d8 Mon Sep 17 00:00:00 2001 From: Ivan Alagenchev Date: Fri, 26 Jul 2013 08:36:50 -0700 Subject: [PATCH 33/92] Bug 846918 - Adds new message category to webconsole.js and learn more link to security messages .r=msucan --- browser/devtools/webconsole/test/Makefile.in | 3 +++ ...console_bug_846918_hsts_invalid-headers.js | 27 +++++++++++++++++++ .../test-bug-846918-hsts-invalid-headers.html | 13 +++++++++ ...-846918-hsts-invalid-headers.html^headers^ | 1 + browser/devtools/webconsole/webconsole.js | 1 + 5 files changed, 45 insertions(+) create mode 100644 browser/devtools/webconsole/test/browser_webconsole_bug_846918_hsts_invalid-headers.js create mode 100644 browser/devtools/webconsole/test/test-bug-846918-hsts-invalid-headers.html create mode 100644 browser/devtools/webconsole/test/test-bug-846918-hsts-invalid-headers.html^headers^ diff --git a/browser/devtools/webconsole/test/Makefile.in b/browser/devtools/webconsole/test/Makefile.in index 09cfeaa06cef..2e105b0f79f6 100644 --- a/browser/devtools/webconsole/test/Makefile.in +++ b/browser/devtools/webconsole/test/Makefile.in @@ -117,6 +117,7 @@ MOCHITEST_BROWSER_FILES = \ browser_netpanel_longstring_expand.js \ browser_repeated_messages_accuracy.js \ browser_webconsole_bug_821877_csp_errors.js \ + browser_webconsole_bug_846918_hsts_invalid-headers.js \ browser_eval_in_debugger_stackframe.js \ browser_console_variables_view.js \ browser_console_variables_view_while_debugging.js \ @@ -236,6 +237,8 @@ MOCHITEST_BROWSER_FILES += \ test-bug-766001-js-errors.js \ test-bug-821877-csperrors.html \ test-bug-821877-csperrors.html^headers^ \ + test-bug-846918-hsts-invalid-headers.html \ + test-bug-846918-hsts-invalid-headers.html^headers^ \ test-eval-in-stackframe.html \ test-bug-859170-longstring-hang.html \ test-bug-837351-security-errors.html \ diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_846918_hsts_invalid-headers.js b/browser/devtools/webconsole/test/browser_webconsole_bug_846918_hsts_invalid-headers.js new file mode 100644 index 000000000000..b94853645f18 --- /dev/null +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_846918_hsts_invalid-headers.js @@ -0,0 +1,27 @@ + /* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ +/* Tests that errors about invalid HSTS security headers are logged + * to the web console */ +const TEST_URI = "https://example.com/browser/browser/devtools/webconsole/test/test-bug-846918-hsts-invalid-headers.html"; +const HSTS_INVALID_HEADER_MSG = "The site specified an invalid Strict-Transport-Security header."; + +function test() +{ + addTab(TEST_URI); + browser.addEventListener("load", function onLoad(aEvent) { + browser.removeEventListener(aEvent.type, onLoad, true); + openConsole(null, function testHSTSErrorLogged (hud) { + waitForMessages({ + webconsole: hud, + messages: [ + { + name: "Invalid HSTS header error displayed successfully", + text: HSTS_INVALID_HEADER_MSG, + category: CATEGORY_SECURITY, + severity: SEVERITY_WARNING + }, + ], + }).then(finishTest); + }); + }, true); +} diff --git a/browser/devtools/webconsole/test/test-bug-846918-hsts-invalid-headers.html b/browser/devtools/webconsole/test/test-bug-846918-hsts-invalid-headers.html new file mode 100644 index 000000000000..a2353354ddeb --- /dev/null +++ b/browser/devtools/webconsole/test/test-bug-846918-hsts-invalid-headers.html @@ -0,0 +1,13 @@ + + + + + Bug 846918 - Report invalid strict-transport-security + headers to the web console + + + +

This page is served with an invalid STS header.

+ + diff --git a/browser/devtools/webconsole/test/test-bug-846918-hsts-invalid-headers.html^headers^ b/browser/devtools/webconsole/test/test-bug-846918-hsts-invalid-headers.html^headers^ new file mode 100644 index 000000000000..9778993d7bca --- /dev/null +++ b/browser/devtools/webconsole/test/test-bug-846918-hsts-invalid-headers.html^headers^ @@ -0,0 +1 @@ +Strict-Transport-Security: max-age444 \ No newline at end of file diff --git a/browser/devtools/webconsole/webconsole.js b/browser/devtools/webconsole/webconsole.js index d6a41ba43392..103eccb25e9a 100644 --- a/browser/devtools/webconsole/webconsole.js +++ b/browser/devtools/webconsole/webconsole.js @@ -4421,6 +4421,7 @@ var Utils = { case "Mixed Content Blocker": case "CSP": + case "Invalid HSTS Headers": return CATEGORY_SECURITY; default: From c1306611582250e3acf75197b6dbdb551b5e8b40 Mon Sep 17 00:00:00 2001 From: Ivan Alagenchev Date: Fri, 26 Jul 2013 08:37:02 -0700 Subject: [PATCH 34/92] Bug 846918: Adds internal httpchannel idl for communication between documents and channels. r=jlebar --- xpcom/base/moz.build | 2 ++ xpcom/base/nsISecurityConsoleMessage.idl | 20 +++++++++++ xpcom/base/nsSecurityConsoleMessage.cpp | 43 ++++++++++++++++++++++++ xpcom/base/nsSecurityConsoleMessage.h | 28 +++++++++++++++ xpcom/build/nsXPComInit.cpp | 7 ++++ 5 files changed, 100 insertions(+) create mode 100644 xpcom/base/nsISecurityConsoleMessage.idl create mode 100644 xpcom/base/nsSecurityConsoleMessage.cpp create mode 100644 xpcom/base/nsSecurityConsoleMessage.h diff --git a/xpcom/base/moz.build b/xpcom/base/moz.build index 1c643548058d..b8a7148e3e20 100644 --- a/xpcom/base/moz.build +++ b/xpcom/base/moz.build @@ -22,6 +22,7 @@ XPIDL_SOURCES += [ 'nsIMessageLoop.idl', 'nsIMutable.idl', 'nsIProgrammingLanguage.idl', + 'nsISecurityConsoleMessage.idl', 'nsISupports.idl', 'nsITraceRefcnt.idl', 'nsIUUIDGenerator.idl', @@ -103,6 +104,7 @@ CPP_SOURCES += [ 'nsMemoryInfoDumper.cpp', 'nsMemoryReporterManager.cpp', 'nsMessageLoop.cpp', + 'nsSecurityConsoleMessage.cpp', 'nsStackWalk.cpp', 'nsSystemInfo.cpp', 'nsTraceRefcntImpl.cpp', diff --git a/xpcom/base/nsISecurityConsoleMessage.idl b/xpcom/base/nsISecurityConsoleMessage.idl new file mode 100644 index 000000000000..917968d83bec --- /dev/null +++ b/xpcom/base/nsISecurityConsoleMessage.idl @@ -0,0 +1,20 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsISupports.idl" + +/* + * Holds localization message tag and message category + * for security related console messages. + */ +[uuid(FE9FC9B6-DDE2-11E2-A8F1-0A326188709B)] +interface nsISecurityConsoleMessage : nsISupports +{ + attribute AString tag; + attribute AString category; +}; + +%{ C++ +#define NS_SECURITY_CONSOLE_MESSAGE_CONTRACTID "@mozilla.org/securityconsole/message;1" +%} diff --git a/xpcom/base/nsSecurityConsoleMessage.cpp b/xpcom/base/nsSecurityConsoleMessage.cpp new file mode 100644 index 000000000000..c47558890069 --- /dev/null +++ b/xpcom/base/nsSecurityConsoleMessage.cpp @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsSecurityConsoleMessage.h" + +NS_IMPL_ISUPPORTS1(nsSecurityConsoleMessage, nsISecurityConsoleMessage) + +nsSecurityConsoleMessage::nsSecurityConsoleMessage() +{ +} + +nsSecurityConsoleMessage::~nsSecurityConsoleMessage() +{ +} + +NS_IMETHODIMP +nsSecurityConsoleMessage::GetTag(nsAString& aTag) +{ + aTag = mTag; + return NS_OK; +} + +NS_IMETHODIMP +nsSecurityConsoleMessage::SetTag(const nsAString& aTag) +{ + mTag = aTag; + return NS_OK; +} + +NS_IMETHODIMP +nsSecurityConsoleMessage::GetCategory(nsAString& aCategory) +{ + aCategory = mCategory; + return NS_OK; +} + +NS_IMETHODIMP +nsSecurityConsoleMessage::SetCategory(const nsAString& aCategory) +{ + mCategory = aCategory; + return NS_OK; +} diff --git a/xpcom/base/nsSecurityConsoleMessage.h b/xpcom/base/nsSecurityConsoleMessage.h new file mode 100644 index 000000000000..828fe5b720ad --- /dev/null +++ b/xpcom/base/nsSecurityConsoleMessage.h @@ -0,0 +1,28 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsSecurityConsoleMessage_h__ +#define nsSecurityConsoleMessage_h__ +#include "nsISecurityConsoleMessage.h" +#include "nsString.h" + +class nsSecurityConsoleMessage : public nsISecurityConsoleMessage +{ + public: + NS_DECL_ISUPPORTS + NS_DECL_NSISECURITYCONSOLEMESSAGE + + nsSecurityConsoleMessage(); + + private: + ~nsSecurityConsoleMessage(); + + protected: + nsString mTag; + nsString mCategory; +}; + +#define NS_SECURITY_CONSOLE_MESSAGE_CID \ + {0x43ebf210, 0x8a7b, 0x4ddb, {0xa8, 0x3d, 0xb8, 0x7c, 0x51, 0xa0, 0x58, 0xdb}} +#endif //nsSecurityConsoleMessage_h__ diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp index 0fc6044dd105..a15e21b29719 100644 --- a/xpcom/build/nsXPComInit.cpp +++ b/xpcom/build/nsXPComInit.cpp @@ -99,6 +99,7 @@ extern nsresult nsStringInputStreamConstructor(nsISupports *, REFNSIID, void **) #include "nsSystemInfo.h" #include "nsMemoryReporterManager.h" #include "nsMemoryInfoDumper.h" +#include "nsSecurityConsoleMessage.h" #include "nsMessageLoop.h" #include @@ -209,6 +210,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMemoryInfoDumper) NS_GENERIC_FACTORY_CONSTRUCTOR(nsIOUtil) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSecurityConsoleMessage) + static nsresult nsThreadManagerGetSingleton(nsISupports* outer, const nsIID& aIID, @@ -249,6 +252,8 @@ static NS_DEFINE_CID(kSimpleUnicharStreamFactoryCID, NS_SIMPLE_UNICHAR_STREAM_FA NS_DEFINE_NAMED_CID(NS_CHROMEREGISTRY_CID); NS_DEFINE_NAMED_CID(NS_CHROMEPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_SECURITY_CONSOLE_MESSAGE_CID); + NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsChromeRegistry, nsChromeRegistry::GetSingleton) NS_GENERIC_FACTORY_CONSTRUCTOR(nsChromeProtocolHandler) @@ -283,6 +288,7 @@ const mozilla::Module::CIDEntry kXPCOMCIDEntries[] = { #include "XPCOMModule.inc" { &kNS_CHROMEREGISTRY_CID, false, NULL, nsChromeRegistryConstructor }, { &kNS_CHROMEPROTOCOLHANDLER_CID, false, NULL, nsChromeProtocolHandlerConstructor }, + { &kNS_SECURITY_CONSOLE_MESSAGE_CID, false, NULL, nsSecurityConsoleMessageConstructor }, { NULL } }; #undef COMPONENT @@ -293,6 +299,7 @@ const mozilla::Module::ContractIDEntry kXPCOMContracts[] = { { NS_CHROMEREGISTRY_CONTRACTID, &kNS_CHROMEREGISTRY_CID }, { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "chrome", &kNS_CHROMEPROTOCOLHANDLER_CID }, { NS_INIPARSERFACTORY_CONTRACTID, &kINIParserFactoryCID }, + { NS_SECURITY_CONSOLE_MESSAGE_CONTRACTID, &kNS_SECURITY_CONSOLE_MESSAGE_CID }, { NULL } }; #undef COMPONENT From 7931f44b23d9493906ac68f59de1c2dca6ada7ea Mon Sep 17 00:00:00 2001 From: Ivan Alagenchev Date: Fri, 26 Jul 2013 08:37:03 -0700 Subject: [PATCH 35/92] Bug 846918: add hsts message queue to httpchannel. r=bsmith. --- netwerk/protocol/http/HttpBaseChannel.cpp | 33 +++++++++++++++++++ netwerk/protocol/http/HttpBaseChannel.h | 4 +++ netwerk/protocol/http/nsHttpChannel.cpp | 5 ++- .../protocol/http/nsIHttpChannelInternal.idl | 12 ++++++- 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index f28c489d2692..cbd7bfc04282 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -23,6 +23,7 @@ #include "nsILoadContext.h" #include "nsEscape.h" #include "nsStreamListenerWrapper.h" +#include "nsISecurityConsoleMessage.h" #include "prnetdb.h" #include @@ -1301,6 +1302,38 @@ HttpBaseChannel::GetLocalAddress(nsACString& addr) return NS_OK; } +NS_IMETHODIMP +HttpBaseChannel::TakeAllSecurityMessages( + nsCOMArray &aMessages) +{ + aMessages.Clear(); + aMessages.SwapElements(mSecurityConsoleMessages); + return NS_OK; +} + +/* Please use this method with care. This can cause the message + * queue to grow large and cause the channel to take up a lot + * of memory. Use only static string messages and do not add + * server side data to the queue, as that can be large. + * Add only a limited number of messages to the queue to keep + * the channel size down and do so only in rare erroneous situations. + * More information can be found here: + * https://bugzilla.mozilla.org/show_bug.cgi?id=846918 + */ +NS_IMETHODIMP +HttpBaseChannel::AddSecurityMessage(const nsAString &aMessageTag, + const nsAString &aMessageCategory) +{ + nsresult rv; + nsCOMPtr message = + do_CreateInstance(NS_SECURITY_CONSOLE_MESSAGE_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + message->SetTag(aMessageTag); + message->SetCategory(aMessageCategory); + mSecurityConsoleMessages.AppendElement(message); + return NS_OK; +} + NS_IMETHODIMP HttpBaseChannel::GetLocalPort(int32_t* port) { diff --git a/netwerk/protocol/http/HttpBaseChannel.h b/netwerk/protocol/http/HttpBaseChannel.h index 15868a413489..73aac163a7b8 100644 --- a/netwerk/protocol/http/HttpBaseChannel.h +++ b/netwerk/protocol/http/HttpBaseChannel.h @@ -33,6 +33,7 @@ #include "nsThreadUtils.h" #include "PrivateBrowsingChannel.h" #include "mozilla/net/DNS.h" +#include "nsISecurityConsoleMessage.h" extern PRLogModuleInfo *gHttpLog; @@ -151,6 +152,8 @@ public: NS_IMETHOD SetLoadAsBlocking(bool aLoadAsBlocking); NS_IMETHOD GetLoadUnblocked(bool *aLoadUnblocked); NS_IMETHOD SetLoadUnblocked(bool aLoadUnblocked); + NS_IMETHOD AddSecurityMessage(const nsAString &aMessageTag, const nsAString &aMessageCategory); + NS_IMETHOD TakeAllSecurityMessages(nsCOMArray &aMessages); inline void CleanRedirectCacheChainIfNecessary() { @@ -199,6 +202,7 @@ public: public: /* Necko internal use only... */ protected: + nsCOMArray mSecurityConsoleMessages; // Handle notifying listener, removing from loadgroup if request failed. void DoNotifyListener(); diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index f2c9f225e8d7..157f73902720 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -45,9 +45,11 @@ #include "nsContentUtils.h" #include "nsIPermissionManager.h" #include "nsIPrincipal.h" +#include "nsISecurityConsoleMessage.h" #include "nsIScriptSecurityManager.h" #include "nsISSLStatus.h" #include "nsISSLStatusProvider.h" +#include "nsIDOMWindow.h" namespace mozilla { namespace net { @@ -1194,8 +1196,9 @@ nsHttpChannel::ProcessSTSHeader() rv = stss->ProcessStsHeader(mURI, stsHeader.get(), flags, NULL, NULL); if (NS_FAILED(rv)) { + AddSecurityMessage(NS_LITERAL_STRING("InvalidSTSHeaders"), + NS_LITERAL_STRING("Invalid HSTS Headers")); LOG(("STS: Failed to parse STS header, continuing load.\n")); - return NS_OK; } return NS_OK; diff --git a/netwerk/protocol/http/nsIHttpChannelInternal.idl b/netwerk/protocol/http/nsIHttpChannelInternal.idl index f1301e401b06..b20837b1fa70 100644 --- a/netwerk/protocol/http/nsIHttpChannelInternal.idl +++ b/netwerk/protocol/http/nsIHttpChannelInternal.idl @@ -7,15 +7,19 @@ %{C++ #include "nsTArray.h" +#include "nsCOMArray.h" + class nsCString; %} [ptr] native StringArray(nsTArray); +[ref] native securityMessagesArray(nsCOMArray); interface nsISocketTransport; interface nsIAsyncInputStream; interface nsIAsyncOutputStream; interface nsIURI; interface nsIProxyInfo; +interface nsISecurityConsoleMessage; /** * The callback interface for nsIHttpChannelInternal::HTTPUpgrade() @@ -34,7 +38,7 @@ interface nsIHttpUpgradeListener : nsISupports * using any feature exposed by this interface, be aware that this interface * will change and you will be broken. You have been warned. */ -[scriptable, uuid(2cd7f6a6-63f3-4bd6-a0f5-6e3d6dcff81b)] +[scriptable, uuid(5b4b2632-cee4-11e2-8e84-c7506188709b)] interface nsIHttpChannelInternal : nsISupports { /** @@ -52,6 +56,12 @@ interface nsIHttpChannelInternal : nsISupports */ void getResponseVersion(out unsigned long major, out unsigned long minor); + /* + * Retrieves all security messages from the security message queue + * and empties the queue after retrieval + */ + [noscript] void takeAllSecurityMessages(in securityMessagesArray aMessages); + /** * Helper method to set a cookie with a consumer-provided * cookie header, _but_ using the channel's other information From 524d8bcceecacf10fd4fd942bfcadca18105b257 Mon Sep 17 00:00:00 2001 From: Ivan Alagenchev Date: Fri, 26 Jul 2013 08:37:03 -0700 Subject: [PATCH 36/92] Bug 846918: adds hsts reporting from nsDocument. r=smaug. --- content/base/src/nsDocument.cpp | 29 ++++++++++++++++++++++++++++- content/base/src/nsDocument.h | 2 ++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 4a9c8a70139e..8ca9b07f4bda 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -208,6 +208,8 @@ #include "nsIEditor.h" #include "nsIDOMCSSStyleRule.h" #include "mozilla/css/Rule.h" +#include "nsIHttpChannelInternal.h" +#include "nsISecurityConsoleMessage.h" using namespace mozilla; using namespace mozilla::dom; @@ -2468,6 +2470,23 @@ CSPErrorQueue::Flush(nsIDocument* aDocument) mErrors.Clear(); } +void +nsDocument::SendToConsole(nsCOMArray& aMessages) +{ + for (uint32_t i = 0; i < aMessages.Length(); ++i) { + nsAutoString messageTag; + aMessages[i]->GetTag(messageTag); + + nsAutoString category; + aMessages[i]->GetCategory(category); + + nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, + NS_ConvertUTF16toUTF8(category).get(), + this, nsContentUtils::eSECURITY_PROPERTIES, + NS_ConvertUTF16toUTF8(messageTag).get()); + } +} + nsresult nsDocument::InitCSP(nsIChannel* aChannel) { @@ -4286,8 +4305,16 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject) mWindow = window; // Now that we know what our window is, we can flush the CSP errors to the - // Web Console. + // Web Console. We are flushing all messages that occured and were stored + // in the queue prior to this point. FlushCSPWebConsoleErrorQueue(); + nsCOMPtr internalChannel = + do_QueryInterface(GetChannel()); + if (internalChannel) { + nsCOMArray messages; + internalChannel->TakeAllSecurityMessages(messages); + SendToConsole(messages); + } // Set our visibility state, but do not fire the event. This is correct // because either we're coming out of bfcache (in which case IsVisible() will diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index 12102b92687a..cab0743cb647 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -94,6 +94,7 @@ class nsWindowSizes; class nsHtml5TreeOpExecutor; class nsDocumentOnStack; class nsPointerLockPermissionRequest; +class nsISecurityConsoleMessage; namespace mozilla { namespace dom { @@ -754,6 +755,7 @@ public: private: nsRadioGroupStruct* GetRadioGroupInternal(const nsAString& aName) const; + void SendToConsole(nsCOMArray& aMessages); public: // nsIDOMNode From c822b1becc23262657fab88da7b835bc3aa28a76 Mon Sep 17 00:00:00 2001 From: Ivan Alagenchev Date: Fri, 26 Jul 2013 08:37:03 -0700 Subject: [PATCH 37/92] Bug 846918: localization for invalid sts. r=dolske. --- dom/locales/en-US/chrome/security/security.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dom/locales/en-US/chrome/security/security.properties b/dom/locales/en-US/chrome/security/security.properties index 66bf86ab8a95..4313fb7d345c 100644 --- a/dom/locales/en-US/chrome/security/security.properties +++ b/dom/locales/en-US/chrome/security/security.properties @@ -9,3 +9,5 @@ ReportOnlyCSPIgnored=Report-only CSP policy will be ignored because there are ot OldCSPHeaderDeprecated=The X-Content-Security-Policy and X-Content-Security-Report-Only headers will be deprecated in the future. Please use the Content-Security-Policy and Content-Security-Report-Only headers with CSP spec compliant syntax instead. # LOCALIZATION NOTE: Do not translate "X-Content-Security-Policy/Report-Only" or "Content-Security-Policy/Report-Only" BothCSPHeadersPresent=This site specified both an X-Content-Security-Policy/Report-Only header and a Content-Security-Policy/Report-Only header. The X-Content-Security-Policy/Report-Only header(s) will be ignored. +# LOCALIZATION NOTE: Do not translate "Strict-Transport-Security" or "HSTS" +InvalidSTSHeaders=The site specified an invalid Strict-Transport-Security header. From 395f11310028a05b3ea716524ce7b5a100d0354d Mon Sep 17 00:00:00 2001 From: Stephen Pohl Date: Fri, 26 Jul 2013 11:46:19 -0400 Subject: [PATCH 38/92] Bug 896443: Followup for Windows: Fix the z-ordering of overlay scrollbars to make them appear on top of content with z-index > 0. r=roc --- toolkit/themes/windows/global/xulscrollbars.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/toolkit/themes/windows/global/xulscrollbars.css b/toolkit/themes/windows/global/xulscrollbars.css index e28e255ce923..e47f50f7e7db 100644 --- a/toolkit/themes/windows/global/xulscrollbars.css +++ b/toolkit/themes/windows/global/xulscrollbars.css @@ -18,6 +18,11 @@ scrollbar { background: url("chrome://global/skin/scrollbar/slider.gif") scrollbar; } +scrollbar[root="true"] { + position: relative; + z-index: 2147483647; /* largest positive value of a signed 32-bit integer */ +} + scrollbar[orient="vertical"] { -moz-appearance: scrollbartrack-vertical; From 94e16d2f4b754c03d05239b53c5f21303d3bf9ed Mon Sep 17 00:00:00 2001 From: Mina Almasry Date: Fri, 26 Jul 2013 11:59:35 -0400 Subject: [PATCH 39/92] Bug 734861 - Add a waitForExplicitFinish() call to match the finish() call in test. r=bz --- layout/inspector/tests/test_get_all_style_sheets.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/layout/inspector/tests/test_get_all_style_sheets.html b/layout/inspector/tests/test_get_all_style_sheets.html index 590418f973fe..7e5a4d49b063 100644 --- a/layout/inspector/tests/test_get_all_style_sheets.html +++ b/layout/inspector/tests/test_get_all_style_sheets.html @@ -12,6 +12,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=734861 /** Test for Bug 734861 **/ + SimpleTest.waitForExplicitFinish(); + function runTest() { var utils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"] .getService(SpecialPowers.Ci.inIDOMUtils); From b505bca21bf665e1b2aab9d021260c4f977c67c9 Mon Sep 17 00:00:00 2001 From: David Rajchenbach-Teller Date: Fri, 26 Jul 2013 11:59:53 -0400 Subject: [PATCH 40/92] Bug 898034 - Fix module.exports. r=gozala --- toolkit/components/workerloader/require.js | 7 +-- .../components/workerloader/tests/Makefile.in | 1 + .../tests/moduleH-module-dot-exports.js | 12 +++++ .../workerloader/tests/worker_test_loading.js | 45 ++++++++++++++----- 4 files changed, 52 insertions(+), 13 deletions(-) create mode 100644 toolkit/components/workerloader/tests/moduleH-module-dot-exports.js diff --git a/toolkit/components/workerloader/require.js b/toolkit/components/workerloader/require.js index 566a9de70110..56a429da144d 100644 --- a/toolkit/components/workerloader/require.js +++ b/toolkit/components/workerloader/require.js @@ -168,9 +168,9 @@ // Make module available immediately // (necessary in case of circular dependencies) if (modules.has(path)) { - return modules.get(path); + return modules.get(path).exports; } - modules.set(path, exports); + modules.set(path, module); // Load source of module, synchronously @@ -216,6 +216,7 @@ } Object.freeze(module.exports); + Object.freeze(module); return module.exports; }; })(); @@ -235,4 +236,4 @@ enumerable: true, configurable: false }); -})(this); \ No newline at end of file +})(this); diff --git a/toolkit/components/workerloader/tests/Makefile.in b/toolkit/components/workerloader/tests/Makefile.in index cc086d483696..b270a13c750c 100644 --- a/toolkit/components/workerloader/tests/Makefile.in +++ b/toolkit/components/workerloader/tests/Makefile.in @@ -22,6 +22,7 @@ MOCHITEST_CHROME_FILES := \ moduleE-throws-during-require.js \ moduleF-syntax-error.js \ moduleG-throws-later.js \ + moduleH-module-dot-exports.js \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/toolkit/components/workerloader/tests/moduleH-module-dot-exports.js b/toolkit/components/workerloader/tests/moduleH-module-dot-exports.js new file mode 100644 index 000000000000..a6b93bbccb11 --- /dev/null +++ b/toolkit/components/workerloader/tests/moduleH-module-dot-exports.js @@ -0,0 +1,12 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// This should be overwritten by module.exports +exports.key = "wrong value"; + +module.exports = { + key: "value" +}; + +// This should also be overwritten by module.exports +exports.key = "another wrong value"; diff --git a/toolkit/components/workerloader/tests/worker_test_loading.js b/toolkit/components/workerloader/tests/worker_test_loading.js index 9bf02d9423a1..4ebc7119a067 100644 --- a/toolkit/components/workerloader/tests/worker_test_loading.js +++ b/toolkit/components/workerloader/tests/worker_test_loading.js @@ -1,12 +1,15 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + importScripts("utils_worker.js"); // Test suite code info("Test suite configured"); importScripts("resource://gre/modules/workers/require.js"); info("Loader imported"); +let PATH = "chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/"; let tests = []; let add_test = function(test) { tests.push(test); @@ -18,7 +21,7 @@ add_test(function test_setup() { // Test simple loading (moduleA-depends.js requires moduleB-dependency.js) add_test(function test_load() { - let A = require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleA-depends.js"); + let A = require(PATH + "moduleA-depends.js"); ok(true, "Opened module A"); is(A.A, true, "Module A exported value A"); @@ -26,7 +29,7 @@ add_test(function test_load() { is(A.importedFoo, "foo", "Module A re-exported B.foo"); // re-evaluating moduleB-dependency.js would cause an error, but re-requiring it shouldn't - let B = require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleB-dependency.js"); + let B = require(PATH + "moduleB-dependency.js"); ok(true, "Managed to re-require module B"); is(B.B, true, "Module B exported value B"); is(B.foo, "foo", "Module B exported value foo"); @@ -34,11 +37,11 @@ add_test(function test_load() { // Test simple circular loading (moduleC-circular.js and moduleD-circular.js require each other) add_test(function test_circular() { - let C = require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleC-circular.js"); + let C = require(PATH + "moduleC-circular.js"); ok(true, "Loaded circular modules C and D"); is(C.copiedFromD.copiedFromC.enteredC, true, "Properties exported by C before requiring D can be seen by D immediately"); - let D = require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleD-circular.js"); + let D = require(PATH + "moduleD-circular.js"); is(D.exportedFromC.finishedC, true, "Properties exported by C after requiring D can be seen by D eventually"); }); @@ -53,30 +56,52 @@ add_test(function test_exceptions() { } }; - let exn = should_throw(() => require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/this module doesn't exist")); + let exn = should_throw(() => require(PATH + "this module doesn't exist")); ok(!!exn, "Attempting to load a module that doesn't exist raises an error"); - exn = should_throw(() => require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleE-throws-during-require.js")); + exn = should_throw(() => require(PATH + "moduleE-throws-during-require.js")); ok(!!exn, "Attempting to load a module that throws at toplevel raises an error"); - is(exn.moduleName, "chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleE-throws-during-require.js", + is(exn.moduleName, PATH + "moduleE-throws-during-require.js", "moduleName is correct"); isnot(exn.moduleStack.indexOf("moduleE-throws-during-require.js"), -1, "moduleStack contains the name of the module"); is(exn.lineNumber, 10, "The error comes with the right line number"); - exn = should_throw(() => require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleF-syntaxerror.xml")); + exn = should_throw(() => require(PATH + "moduleF-syntaxerror.xml")); ok(!!exn, "Attempting to load a non-well formatted module raises an error"); - exn = should_throw(() => require("chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleG-throws-later.js").doThrow()); + exn = should_throw(() => require(PATH + "moduleG-throws-later.js").doThrow()); ok(!!exn, "G.doThrow() has raised an error"); info(exn); ok(exn.toString().startsWith("TypeError"), "The exception is a TypeError."); - is(exn.moduleName, "chrome://mochitests/content/chrome/toolkit/components/workerloader/tests/moduleG-throws-later.js", "The name of the module is correct"); + is(exn.moduleName, PATH + "moduleG-throws-later.js", "The name of the module is correct"); isnot(exn.moduleStack.indexOf("moduleG-throws-later.js"), -1, "The name of the right file appears somewhere in the stack"); is(exn.lineNumber, 11, "The error comes with the right line number"); }); +function get_exn(f) { + try { + f(); + return undefined; + } catch (ex) { + return ex; + } +} + +// Test module.exports +add_test(function test_module_dot_exports() { + let H = require(PATH + "moduleH-module-dot-exports.js"); + is(H.key, "value", "module.exports worked"); + let H2 = require(PATH + "moduleH-module-dot-exports.js"); + is(H2.key, "value", "module.exports returned the same key"); + ok(H2 === H, "module.exports returned the same module the second time"); + let exn = get_exn(() => H.key = "this should not be accepted"); + ok(exn instanceof TypeError, "Cannot alter value in module.exports after export"); + exn = get_exn(() => H.key2 = "this should not be accepted, either"); + ok(exn instanceof TypeError, "Cannot add value to module.exports after export"); +}); + self.onmessage = function(message) { for (let test of tests) { info("Entering " + test.name); From 3bee00b4eb3d5aa50d1f7e654f9178d4c0865863 Mon Sep 17 00:00:00 2001 From: Martijn Wargers Date: Fri, 26 Jul 2013 00:57:25 +0200 Subject: [PATCH 41/92] Bug 873864 - Test failures when reloading test_bug669671.html. r=jlebar --- docshell/test/file_bug669671.sjs | 3 ++- docshell/test/test_bug669671.html | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docshell/test/file_bug669671.sjs b/docshell/test/file_bug669671.sjs index 389a21010be9..b6fd1ec7c512 100644 --- a/docshell/test/file_bug669671.sjs +++ b/docshell/test/file_bug669671.sjs @@ -1,8 +1,9 @@ function handleRequest(request, response) { var count = parseInt(getState('count')); - if (!count) + if (!count || request.queryString == 'countreset') count = 0; + setState('count', count + 1 + ''); response.setHeader('Content-Type', 'text/html', false); diff --git a/docshell/test/test_bug669671.html b/docshell/test/test_bug669671.html index 970ded3d1f53..ef670fffb759 100644 --- a/docshell/test/test_bug669671.html +++ b/docshell/test/test_bug669671.html @@ -66,6 +66,12 @@ function checkPopupLoadCount() function test() { + // Step 0 - Make sure the count is reset to 0 in case of reload + popup.location = 'file_bug669671.sjs?countreset'; + yield; + is(popup.document.body.innerHTML, '0', + 'Load count should be reset to 0'); + // Step 1 - The popup's body counts how many times we've requested the // resource. This is the first time we've requested it, so it should be '0'. checkPopupLoadCount(); From 27f9b1cdb14038d1921cace4c9ba945ebeb73920 Mon Sep 17 00:00:00 2001 From: Mina Almasry Date: Fri, 26 Jul 2013 12:00:49 -0400 Subject: [PATCH 42/92] Bug 760851 - Add jsonifier WebIDL declaration and add toJSON to performance.timing. r=bz This patch adds a jsonifier declaration to WebIDL's. The declaration adds an autogenerated method toJSON() on the given webidl. This patch also adds jsonifier and toJSON() to PerformanceTiming.webidl, and performance.timing, respectively. --- dom/bindings/Codegen.py | 59 ++++++++++++++++++--- dom/bindings/Configuration.py | 5 +- dom/bindings/parser/WebIDL.py | 36 ++++++++++++- dom/bindings/test/TestCodeGen.webidl | 1 + dom/bindings/test/TestExampleGen.webidl | 1 + dom/bindings/test/TestJSImplGen.webidl | 1 + dom/tests/mochitest/bugs/Makefile.in | 1 + dom/tests/mochitest/bugs/test_toJSON.html | 64 +++++++++++++++++++++++ dom/webidl/Performance.webidl | 2 + dom/webidl/PerformanceNavigation.webidl | 2 + dom/webidl/PerformanceTiming.webidl | 2 + js/src/jsfriendapi.h | 4 ++ 12 files changed, 169 insertions(+), 9 deletions(-) create mode 100644 dom/tests/mochitest/bugs/test_toJSON.html diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 5bd898a8ae7c..13e3ba1789cd 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1438,6 +1438,17 @@ class MethodDefiner(PropertyDefiner): self.chrome.append(toStringDesc) else: self.regular.append(toStringDesc) + jsonifier = descriptor.operations['Jsonifier'] + if jsonifier: + toJSONDesc = { "name": "toJSON", + "nativeName": jsonifier.identifier.name, + "length": 0, + "flags": "JSPROP_ENUMERATE", + "condition": PropertyDefiner.getControllingCondition(jsonifier) } + if isChromeOnly(jsonifier): + self.chrome.append(toJSONDesc) + else: + self.regular.append(toJSONDesc) elif (descriptor.interface.isJSImplemented() and descriptor.interface.hasInterfaceObject()): self.chrome.append({"name": '_create', @@ -5207,6 +5218,32 @@ class CGSpecializedMethod(CGAbstractStaticMethod): name = method.identifier.name return MakeNativeName(descriptor.binaryNames.get(name, name)) +class CGJsonifierMethod(CGSpecializedMethod): + def __init__(self, descriptor, method): + assert method.isJsonifier() + CGSpecializedMethod.__init__(self, descriptor, method) + + def definition_body(self): + ret = ('JS::Rooted result(cx, JS_NewObject(cx, nullptr, nullptr, nullptr));\n' + 'if (!result) {\n' + ' return false;\n' + '}\n') + for m in self.descriptor.interface.members: + if m.isAttr() and not m.isStatic(): + ret += ('{ // scope for "temp"\n' + ' JS::Rooted temp(cx);\n' + ' if (!get_%s(cx, obj, self, JSJitGetterCallArgs(&temp))) {\n' + ' return false;\n' + ' }\n' + ' if (!JS_DefineProperty(cx, result, "%s", temp, nullptr, nullptr, JSPROP_ENUMERATE)) {\n' + ' return false;\n' + ' }\n' + '}\n' % (m.identifier.name, m.identifier.name)) + + ret += ('args.rval().setObject(*result);\n' + 'return true;') + return CGIndenter(CGGeneric(ret)).define() + class CGLegacyCallHook(CGAbstractBindingMethod): """ Call hook for our object @@ -7544,15 +7581,19 @@ class CGDescriptor(CGThing): cgThings = [] # These are set to true if at least one non-static - # method/getter/setter exist on the interface. - (hasMethod, hasGetter, hasLenientGetter, - hasSetter, hasLenientSetter) = False, False, False, False, False + # method/getter/setter or jsonifier exist on the interface. + (hasMethod, hasGetter, hasLenientGetter, hasSetter, hasJsonifier, + hasLenientSetter) = False, False, False, False, False, False for n in descriptor.interface.namedConstructors: cgThings.append(CGClassConstructor(descriptor, n, NamedConstructorName(n))) for m in descriptor.interface.members: - if (m.isMethod() and - (not m.isIdentifierLess() or m == descriptor.operations['Stringifier'])): + if (m.isMethod() and m == descriptor.operations['Jsonifier']): + hasJsonifier = True + hasMethod = True + jsonifierMethod = m + elif (m.isMethod() and + (not m.isIdentifierLess() or m == descriptor.operations['Stringifier'])): if m.isStatic(): assert descriptor.interface.hasInterfaceObject cgThings.append(CGStaticMethod(descriptor, m)) @@ -7586,6 +7627,9 @@ class CGDescriptor(CGThing): if (not m.isStatic() and descriptor.interface.hasInterfacePrototypeObject()): cgThings.append(CGMemberJITInfo(descriptor, m)) + if hasJsonifier: + cgThings.append(CGJsonifierMethod(descriptor, jsonifierMethod)) + cgThings.append(CGMemberJITInfo(descriptor, jsonifierMethod)) if hasMethod: cgThings.append(CGGenericMethod(descriptor)) if hasGetter: cgThings.append(CGGenericGetter(descriptor)) if hasLenientGetter: cgThings.append(CGGenericGetter(descriptor, @@ -8989,6 +9033,9 @@ class CGBindingImplClass(CGClass): else: # We already added this method return + if name == "Jsonifier": + # We already added this method + return self.methodDecls.append( CGNativeMember(descriptor, op, name, @@ -9554,7 +9601,7 @@ class CGCallbackInterface(CGCallback): setters = [CallbackSetter(a, descriptor) for a in attrs if not a.readonly] methods = [m for m in iface.members - if m.isMethod() and not m.isStatic()] + if m.isMethod() and not m.isStatic() and not m.isIdentifierLess()] methods = [CallbackOperation(m, sig, descriptor) for m in methods for sig in m.signatures()] if iface.isJSImplemented() and iface.ctor(): diff --git a/dom/bindings/Configuration.py b/dom/bindings/Configuration.py index d8f36b410b31..d82138138942 100644 --- a/dom/bindings/Configuration.py +++ b/dom/bindings/Configuration.py @@ -277,7 +277,8 @@ class Descriptor(DescriptorProvider): 'NamedCreator': None, 'NamedDeleter': None, 'Stringifier': None, - 'LegacyCaller': None + 'LegacyCaller': None, + 'Jsonifier': None } if self.concrete: self.proxy = False @@ -290,6 +291,8 @@ class Descriptor(DescriptorProvider): for m in iface.members: if m.isMethod() and m.isStringifier(): addOperation('Stringifier', m) + if m.isMethod() and m.isJsonifier(): + addOperation('Jsonifier', m) # Don't worry about inheriting legacycallers either: in # practice these are on most-derived prototypes. if m.isMethod() and m.isLegacycaller(): diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index 33537378d378..41d836e757b6 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -718,12 +718,15 @@ class IDLInterface(IDLObjectWithScope): memberType = "deleters" elif member.isStringifier(): memberType = "stringifiers" + elif member.isJsonifier(): + memberType = "jsonifiers" elif member.isLegacycaller(): memberType = "legacycallers" else: continue - if memberType != "stringifiers" and memberType != "legacycallers": + if (memberType != "stringifiers" and memberType != "legacycallers" and + memberType != "jsonifiers"): if member.isNamed(): memberType = "named " + memberType else: @@ -2812,7 +2815,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope): def __init__(self, location, identifier, returnType, arguments, static=False, getter=False, setter=False, creator=False, deleter=False, specialType=NamedOrIndexed.Neither, - legacycaller=False, stringifier=False): + legacycaller=False, stringifier=False, jsonifier=False): # REVIEW: specialType is NamedOrIndexed -- wow, this is messed up. IDLInterfaceMember.__init__(self, location, identifier, IDLInterfaceMember.Tags.Method) @@ -2838,6 +2841,8 @@ class IDLMethod(IDLInterfaceMember, IDLScope): self._legacycaller = legacycaller assert isinstance(stringifier, bool) self._stringifier = stringifier + assert isinstance(jsonifier, bool) + self._jsonifier = jsonifier self._specialType = specialType if static and identifier.name == "prototype": @@ -2875,6 +2880,12 @@ class IDLMethod(IDLInterfaceMember, IDLScope): assert len(overload.arguments) == 0 assert overload.returnType == BuiltinTypes[IDLBuiltinType.Types.domstring] + if self._jsonifier: + assert len(self._overloads) == 1 + overload = self._overloads[0] + assert len(overload.arguments) == 0 + assert overload.returnType == BuiltinTypes[IDLBuiltinType.Types.object] + def isStatic(self): return self._static @@ -2906,6 +2917,9 @@ class IDLMethod(IDLInterfaceMember, IDLScope): def isStringifier(self): return self._stringifier + def isJsonifier(self): + return self._jsonifier + def hasOverloads(self): return self._hasOverloads @@ -2951,6 +2965,8 @@ class IDLMethod(IDLInterfaceMember, IDLScope): assert not method.isDeleter() assert not self.isStringifier() assert not method.isStringifier() + assert not self.isJsonifier() + assert not method.isJsonifier() return self @@ -3284,6 +3300,7 @@ class Tokenizer(object): "false": "FALSE", "serializer": "SERIALIZER", "stringifier": "STRINGIFIER", + "jsonifier": "JSONIFIER", "unrestricted": "UNRESTRICTED", "attribute": "ATTRIBUTE", "readonly": "READONLY", @@ -3914,6 +3931,19 @@ class Parser(Tokenizer): stringifier=True) p[0] = method + def p_Jsonifier(self, p): + """ + Operation : JSONIFIER SEMICOLON + """ + identifier = IDLUnresolvedIdentifier(BuiltinLocation(""), + "__jsonifier", allowDoubleUnderscore=True) + method = IDLMethod(self.getLocation(p, 1), + identifier, + returnType=BuiltinTypes[IDLBuiltinType.Types.object], + arguments=[], + jsonifier=True) + p[0] = method + def p_QualifierStatic(self, p): """ Qualifier : STATIC @@ -4066,6 +4096,7 @@ class Parser(Tokenizer): | SETTER | STATIC | STRINGIFIER + | JSONIFIER | TYPEDEF | UNRESTRICTED """ @@ -4195,6 +4226,7 @@ class Parser(Tokenizer): | SHORT | STATIC | STRINGIFIER + | JSONIFIER | TRUE | TYPEDEF | UNSIGNED diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index d56054a3597d..1ca795176b2d 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -575,6 +575,7 @@ interface TestInterface { optional TestInterface? arg2 = null, optional Dict arg3, optional double arg4 = 5.0, optional float arg5); + jsonifier; // If you add things here, add them to TestExampleGen and TestJSImplGen as well }; diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl index 0b56f34debb6..4a476914e420 100644 --- a/dom/bindings/test/TestExampleGen.webidl +++ b/dom/bindings/test/TestExampleGen.webidl @@ -472,6 +472,7 @@ interface TestExampleInterface { optional TestInterface? arg2 = null, optional Dict arg3, optional double arg4 = 5.0, optional float arg5); + jsonifier; // If you add things here, add them to TestCodeGen and TestJSImplGen as well }; diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl index cdf1d65bcabe..0578aa4d4952 100644 --- a/dom/bindings/test/TestJSImplGen.webidl +++ b/dom/bindings/test/TestJSImplGen.webidl @@ -464,6 +464,7 @@ interface TestJSImplInterface { optional TestInterface? arg2 = null, optional Dict arg3, optional double arg4 = 5.0, optional float arg5); + jsonifier; // If you add things here, add them to TestCodeGen as well }; diff --git a/dom/tests/mochitest/bugs/Makefile.in b/dom/tests/mochitest/bugs/Makefile.in index b9b884012517..7676344fc0e3 100644 --- a/dom/tests/mochitest/bugs/Makefile.in +++ b/dom/tests/mochitest/bugs/Makefile.in @@ -146,6 +146,7 @@ MOCHITEST_FILES = \ test_bug862540.html \ test_bug857555.html \ test_bug876098.html \ + test_toJSON.html \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/dom/tests/mochitest/bugs/test_toJSON.html b/dom/tests/mochitest/bugs/test_toJSON.html new file mode 100644 index 000000000000..efbd42466371 --- /dev/null +++ b/dom/tests/mochitest/bugs/test_toJSON.html @@ -0,0 +1,64 @@ + + + + + + Test for Bug 760851 + + + + + +Mozilla Bug 760851 +

+ +
+
+ + diff --git a/dom/webidl/Performance.webidl b/dom/webidl/Performance.webidl index a10997dd620d..a6b89af8e750 100644 --- a/dom/webidl/Performance.webidl +++ b/dom/webidl/Performance.webidl @@ -19,4 +19,6 @@ interface Performance { readonly attribute PerformanceTiming timing; [Constant] readonly attribute PerformanceNavigation navigation; + + jsonifier; }; diff --git a/dom/webidl/PerformanceNavigation.webidl b/dom/webidl/PerformanceNavigation.webidl index b2896e34bb07..771cf7e98c77 100644 --- a/dom/webidl/PerformanceNavigation.webidl +++ b/dom/webidl/PerformanceNavigation.webidl @@ -18,4 +18,6 @@ interface PerformanceNavigation { readonly attribute unsigned short type; readonly attribute unsigned short redirectCount; + + jsonifier; }; diff --git a/dom/webidl/PerformanceTiming.webidl b/dom/webidl/PerformanceTiming.webidl index 06712daddf67..f75a46b7c1ef 100644 --- a/dom/webidl/PerformanceTiming.webidl +++ b/dom/webidl/PerformanceTiming.webidl @@ -33,4 +33,6 @@ interface PerformanceTiming { readonly attribute unsigned long long domComplete; readonly attribute unsigned long long loadEventStart; readonly attribute unsigned long long loadEventEnd; + + jsonifier; }; diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index d849c4a78a1a..47bd2e82f123 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -1475,6 +1475,10 @@ class JSJitGetterCallArgs : protected JS::MutableHandleValue : JS::MutableHandleValue(args.rval()) {} + explicit JSJitGetterCallArgs(JS::Rooted* rooted) + : JS::MutableHandleValue(rooted) + {} + JS::MutableHandleValue rval() { return *this; } From ad7f9ea657382531e3283aac5a50e36a69238a24 Mon Sep 17 00:00:00 2001 From: Bob Owen Date: Fri, 21 Jun 2013 18:33:39 +0100 Subject: [PATCH 43/92] Bug 885140 - Fix intermittent timeout in content/html/content/test/test_iframe_sandbox_navigation.html. r=imelven --- .../html/content/test/file_iframe_sandbox_d_if8.html | 12 +++--------- .../content/test/test_iframe_sandbox_navigation.html | 9 +++++---- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/content/html/content/test/file_iframe_sandbox_d_if8.html b/content/html/content/test/file_iframe_sandbox_d_if8.html index 2f8618329ac0..2b4398ef00c8 100644 --- a/content/html/content/test/file_iframe_sandbox_d_if8.html +++ b/content/html/content/test/file_iframe_sandbox_d_if8.html @@ -5,19 +5,13 @@ Test for Bug 341604 + + I am sandboxed with 'allow-scripts' and 'allow-same-origin' the first time I am loaded, and with 'allow-scripts' the second time diff --git a/content/html/content/test/test_iframe_sandbox_navigation.html b/content/html/content/test/test_iframe_sandbox_navigation.html index 32793ce3e928..003f7228a65f 100644 --- a/content/html/content/test/test_iframe_sandbox_navigation.html +++ b/content/html/content/test/test_iframe_sandbox_navigation.html @@ -43,7 +43,7 @@ windowsToClose.push(window.open("about:blank", "window_to_navigate2")); var attemptedTests = 0; var passedTests = 0; -var totalTestsToPass = 8; +var totalTestsToPass = 7; var totalTestsToAttempt = 13; function ok_wrapper(result, desc, addToAttempted = true) { @@ -120,7 +120,7 @@ function doTest() { // (done by file_iframe_sandbox_d_if6.html which simulates a link click and navigates // to file_iframe_sandbox_d_if7.html which attempts to call back into its parent). - // passes if good, fails if bad + // fails if bad // 6) An iframe (if_8) has sandbox="allow-same-origin allow-scripts", the sandboxed document // (file_iframe_sandbox_d_if_8.html) that it contains accesses its parent (this file) and removes // 'allow-same-origin' and then triggers a reload. @@ -180,7 +180,7 @@ window.modified_if_8 = false; function reload_if_8() { var if_8 = document.getElementById('if_8'); - if_8.src = 'file_iframe_sandbox_d_if8.html?onreload'; + if_8.src = 'file_iframe_sandbox_d_if8.html'; } function modify_if_8() { @@ -188,7 +188,7 @@ function modify_if_8() { // that's a failed test (allow-same-origin was removed // the first time). if (window.modified_if_8) { - ok_wrapper(false, "an sandboxed iframe from which 'allow-same-origin' was removed should not be able to access its parent"); + ok_wrapper(false, "a sandboxed iframe from which 'allow-same-origin' was removed should not be able to access its parent"); // need to return here since we end up in an infinite loop otherwise return; @@ -199,6 +199,7 @@ function modify_if_8() { if_8.sandbox = 'allow-scripts'; sendMouseEvent({type:'click'}, 'a_button'); + testAttempted(); } window.modified_if_9 = false; From e76bfadffdb5250d401048e0c95dfa2cbead4844 Mon Sep 17 00:00:00 2001 From: David Keeler Date: Thu, 25 Jul 2013 16:13:50 -0700 Subject: [PATCH 44/92] bug 846825 - refactor, make HSTS header parser more spec-conformant r=cviecco r=grobinson --- netwerk/test/TestSTSParser.cpp | 31 ++- security/manager/boot/src/moz.build | 1 + .../boot/src/nsSecurityHeaderParser.cpp | 254 ++++++++++++++++++ .../manager/boot/src/nsSecurityHeaderParser.h | 74 +++++ .../src/nsStrictTransportSecurityService.cpp | 135 +++++----- .../unit/test_sts_preloadlist_perwindowpb.js | 13 +- 6 files changed, 430 insertions(+), 78 deletions(-) create mode 100644 security/manager/boot/src/nsSecurityHeaderParser.cpp create mode 100644 security/manager/boot/src/nsSecurityHeaderParser.h diff --git a/netwerk/test/TestSTSParser.cpp b/netwerk/test/TestSTSParser.cpp index 960abe4647b1..9239393042f7 100644 --- a/netwerk/test/TestSTSParser.cpp +++ b/netwerk/test/TestSTSParser.cpp @@ -116,6 +116,10 @@ main(int32_t argc, char *argv[]) rvs.AppendElement(TestSuccess("max-age =100", false, 100, false, stss, pm)); rvs.AppendElement(TestSuccess(" max-age=100", false, 100, false, stss, pm)); rvs.AppendElement(TestSuccess("max-age = 100 ", false, 100, false, stss, pm)); + rvs.AppendElement(TestSuccess("max-age = \"100\" ", false, 100, false, stss, pm)); + rvs.AppendElement(TestSuccess("max-age=\"100\"", false, 100, false, stss, pm)); + rvs.AppendElement(TestSuccess(" max-age =\"100\" ", false, 100, false, stss, pm)); + rvs.AppendElement(TestSuccess("\tmax-age\t=\t\"100\"\t", false, 100, false, stss, pm)); rvs.AppendElement(TestSuccess("max-age = 100 ", false, 100, false, stss, pm)); rvs.AppendElement(TestSuccess("maX-aGe=100", false, 100, false, stss, pm)); @@ -125,7 +129,7 @@ main(int32_t argc, char *argv[]) rvs.AppendElement(TestSuccess("MAX-AGE = 100 ", false, 100, false, stss, pm)); rvs.AppendElement(TestSuccess("max-age=100;includeSubdomains", false, 100, true, stss, pm)); - rvs.AppendElement(TestSuccess("max-age=100; includeSubdomains", false, 100, true, stss, pm)); + rvs.AppendElement(TestSuccess("max-age=100\t; includeSubdomains", false, 100, true, stss, pm)); rvs.AppendElement(TestSuccess(" max-age=100; includeSubdomains", false, 100, true, stss, pm)); rvs.AppendElement(TestSuccess("max-age = 100 ; includeSubdomains", false, 100, true, stss, pm)); rvs.AppendElement(TestSuccess("max-age = 100 ; includeSubdomains", false, 100, true, stss, pm)); @@ -135,13 +139,15 @@ main(int32_t argc, char *argv[]) rvs.AppendElement(TestSuccess("max-AGE=100; iNcLuDeSuBdoMaInS", false, 100, true, stss, pm)); rvs.AppendElement(TestSuccess("Max-Age = 100; includesubdomains ", false, 100, true, stss, pm)); rvs.AppendElement(TestSuccess("INCLUDESUBDOMAINS;MaX-AgE = 100 ", false, 100, true, stss, pm)); + // Turns out, the actual directive is entirely optional (hence the + // trailing semicolon) + rvs.AppendElement(TestSuccess("max-age=100;includeSubdomains;", true, 100, true, stss, pm)); // these are weird tests, but are testing that some extended syntax is // still allowed (but it is ignored) - rvs.AppendElement(TestSuccess("max-age=100randomstuffhere", true, 100, false, stss, pm)); - rvs.AppendElement(TestSuccess("max-age=100 includesubdomains", true, 100, false, stss, pm)); - rvs.AppendElement(TestSuccess("max-age=100 bar foo", true, 100, false, stss, pm)); rvs.AppendElement(TestSuccess("max-age=100 ; includesubdomainsSomeStuff", true, 100, false, stss, pm)); + rvs.AppendElement(TestSuccess("\r\n\t\t \tcompletelyUnrelated = foobar; max-age= 34520103 \t \t; alsoUnrelated;asIsThis;\tincludeSubdomains\t\t \t", true, 34520103, true, stss, pm)); + rvs.AppendElement(TestSuccess("max-age=100; unrelated=\"quoted \\\"thingy\\\"\"", true, 100, false, stss, pm)); rv0 = rvs.Contains(false) ? 1 : 0; if (rv0 == 0) @@ -152,6 +158,7 @@ main(int32_t argc, char *argv[]) // SHOULD FAIL: printf("*** Attempting to parse invalid STS headers (should not parse)...\n"); // invalid max-ages + rvs.AppendElement(TestFailure("max-age", stss, pm)); rvs.AppendElement(TestFailure("max-age ", stss, pm)); rvs.AppendElement(TestFailure("max-age=p", stss, pm)); rvs.AppendElement(TestFailure("max-age=*1p2", stss, pm)); @@ -166,6 +173,22 @@ main(int32_t argc, char *argv[]) rvs.AppendElement(TestFailure("max-ag=100", stss, pm)); rvs.AppendElement(TestFailure("includesubdomains", stss, pm)); rvs.AppendElement(TestFailure(";", stss, pm)); + rvs.AppendElement(TestFailure("max-age=\"100", stss, pm)); + // The max-age directive here doesn't conform to the spec, so it MUST + // be ignored. Consequently, the REQUIRED max-age directive is not + // present in this header, and so it is invalid. + rvs.AppendElement(TestFailure("max-age=100, max-age=200; includeSubdomains", stss, pm)); + rvs.AppendElement(TestFailure("max-age=100 includesubdomains", stss, pm)); + rvs.AppendElement(TestFailure("max-age=100 bar foo", stss, pm)); + rvs.AppendElement(TestFailure("max-age=100randomstuffhere", stss, pm)); + // All directives MUST appear only once in an STS header field. + rvs.AppendElement(TestFailure("max-age=100; max-age=200", stss, pm)); + rvs.AppendElement(TestFailure("includeSubdomains; max-age=200; includeSubdomains", stss, pm)); + rvs.AppendElement(TestFailure("max-age=200; includeSubdomains; includeSubdomains", stss, pm)); + // The includeSubdomains directive is valueless. + rvs.AppendElement(TestFailure("max-age=100; includeSubdomains=unexpected", stss, pm)); + // LWS must have at least one space or horizontal tab + rvs.AppendElement(TestFailure("\r\nmax-age=200", stss, pm)); rv1 = rvs.Contains(false) ? 1 : 0; if (rv1 == 0) diff --git a/security/manager/boot/src/moz.build b/security/manager/boot/src/moz.build index 30e9aa3f5d20..2d478e920b1b 100644 --- a/security/manager/boot/src/moz.build +++ b/security/manager/boot/src/moz.build @@ -10,6 +10,7 @@ CPP_SOURCES += [ 'nsBOOTModule.cpp', 'nsEntropyCollector.cpp', 'nsSecureBrowserUIImpl.cpp', + 'nsSecurityHeaderParser.cpp', 'nsSecurityWarningDialogs.cpp', 'nsStrictTransportSecurityService.cpp', ] diff --git a/security/manager/boot/src/nsSecurityHeaderParser.cpp b/security/manager/boot/src/nsSecurityHeaderParser.cpp new file mode 100644 index 000000000000..a956a59f28b8 --- /dev/null +++ b/security/manager/boot/src/nsSecurityHeaderParser.cpp @@ -0,0 +1,254 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsSecurityHeaderParser.h" +#include "prlog.h" + +// The character classes in this file are informed by [RFC2616], Section 2.2. +// signed char is a signed data type one byte (8 bits) wide, so its value can +// never be greater than 127. The following implicitly makes use of this. + +// A token is one or more CHAR except CTLs or separators. +// A CHAR is any US-ASCII character (octets 0 - 127). +// A CTL is any US-ASCII control character (octets 0 - 31) and DEL (127). +// A separator is one of ()<>@,;:\"/[]?={} as well as space and +// horizontal-tab (32 and 9, respectively). +// So, this returns true if chr is any octet 33-126 except ()<>@,;:\"/[]?={} +bool +IsTokenSymbol(signed char chr) { + if (chr < 33 || chr == 127 || + chr == '(' || chr == ')' || chr == '<' || chr == '>' || + chr == '@' || chr == ',' || chr == ';' || chr == ':' || + chr == '"' || chr == '/' || chr == '[' || chr == ']' || + chr == '?' || chr == '=' || chr == '{' || chr == '}' || chr == '\\') { + return false; + } + return true; +} + +// A quoted-string consists of a quote (") followed by any amount of +// qdtext or quoted-pair, followed by a quote. +// qdtext is any TEXT except a quote. +// TEXT is any 8-bit octet except CTLs, but including LWS. +// quoted-pair is a backslash (\) followed by a CHAR. +// So, it turns out, \ can't really be a qdtext symbol for our purposes. +// This returns true if chr is any octet 9,10,13,32-126 except <"> or "\" +bool +IsQuotedTextSymbol(signed char chr) { + return ((chr >= 32 && chr != '"' && chr != '\\' && chr != 127) || + chr == 0x9 || chr == 0xa || chr == 0xd); +} + +// The octet following the "\" in a quoted pair can be anything 0-127. +bool +IsQuotedPairSymbol(signed char chr) { + return (chr >= 0); +} + +#if defined(PR_LOGGING) +static PRLogModuleInfo * +GetSHParserLog() +{ + static PRLogModuleInfo *sSHParserLog; + if (!sSHParserLog) { + sSHParserLog = PR_NewLogModule("nsSecurityHeaderParser"); + } + return sSHParserLog; +} +#endif + +#define SHPARSERLOG(args) PR_LOG(GetSHParserLog(), PR_LOG_DEBUG, args) + +nsSecurityHeaderParser::nsSecurityHeaderParser(const char *aHeader) + : mCursor(aHeader) + , mError(false) +{ +} + +nsSecurityHeaderParser::~nsSecurityHeaderParser() { + nsSecurityHeaderDirective *directive; + while ((directive = mDirectives.popFirst())) { + delete directive; + } +} + +mozilla::LinkedList * +nsSecurityHeaderParser::GetDirectives() { + return &mDirectives; +} + +nsresult +nsSecurityHeaderParser::Parse() { + MOZ_ASSERT(mDirectives.isEmpty()); + SHPARSERLOG(("trying to parse '%s'", mCursor)); + + Header(); + + // if we didn't consume the entire input, we were unable to parse it => error + if (mError || *mCursor) { + return NS_ERROR_FAILURE; + } else { + return NS_OK; + } +} + +bool +nsSecurityHeaderParser::Accept(char aChr) +{ + if (*mCursor == aChr) { + Advance(); + return true; + } + + return false; +} + +bool +nsSecurityHeaderParser::Accept(bool (*aClassifier) (signed char)) +{ + if (aClassifier(*mCursor)) { + Advance(); + return true; + } + + return false; +} + +void +nsSecurityHeaderParser::Expect(char aChr) +{ + if (*mCursor != aChr) { + mError = true; + } else { + Advance(); + } +} + +void +nsSecurityHeaderParser::Advance() +{ + // Technically, 0 is valid in quoted-pair, but we were handed a + // null-terminated const char *, so this doesn't handle that. + if (*mCursor) { + mOutput.Append(*mCursor); + mCursor++; + } else { + mError = true; + } +} + +void +nsSecurityHeaderParser::Header() +{ + Directive(); + while (Accept(';')) { + Directive(); + } +} + +void +nsSecurityHeaderParser::Directive() +{ + mDirective = new nsSecurityHeaderDirective(); + LWSMultiple(); + DirectiveName(); + LWSMultiple(); + if (Accept('=')) { + LWSMultiple(); + DirectiveValue(); + LWSMultiple(); + } + mDirectives.insertBack(mDirective); + SHPARSERLOG(("read directive name '%s', value '%s'", + mDirective->mName.Data(), mDirective->mValue.Data())); +} + +void +nsSecurityHeaderParser::DirectiveName() +{ + mOutput.Truncate(0); + Token(); + mDirective->mName.Assign(mOutput); +} + +void +nsSecurityHeaderParser::DirectiveValue() +{ + mOutput.Truncate(0); + if (Accept(IsTokenSymbol)) { + Token(); + mDirective->mValue.Assign(mOutput); + } else if (Accept('"')) { + // Accept advances the cursor if successful, which appends a character to + // mOutput. The " is not part of what we want to capture, so truncate + // mOutput again. + mOutput.Truncate(0); + QuotedString(); + mDirective->mValue.Assign(mOutput); + Expect('"'); + } +} + +void +nsSecurityHeaderParser::Token() +{ + while (Accept(IsTokenSymbol)); +} + +void +nsSecurityHeaderParser::QuotedString() +{ + while (true) { + if (Accept(IsQuotedTextSymbol)) { + QuotedText(); + } else if (Accept('\\')) { + QuotedPair(); + } else { + break; + } + } +} + +void +nsSecurityHeaderParser::QuotedText() +{ + while (Accept(IsQuotedTextSymbol)); +} + +void +nsSecurityHeaderParser::QuotedPair() +{ + Accept(IsQuotedPairSymbol); +} + +void +nsSecurityHeaderParser::LWSMultiple() +{ + while (true) { + if (Accept('\r')) { + LWSCRLF(); + } else if (Accept(' ') || Accept('\t')) { + LWS(); + } else { + break; + } + } +} + +void +nsSecurityHeaderParser::LWSCRLF() { + Expect('\n'); + if (!(Accept(' ') || Accept('\t'))) { + mError = true; + } + LWS(); +} + +void +nsSecurityHeaderParser::LWS() +{ + // Note that becaue of how we're called, we don't have to check for + // the mandatory presense of at least one of SP or HT. + while (Accept(' ') || Accept('\t')); +} diff --git a/security/manager/boot/src/nsSecurityHeaderParser.h b/security/manager/boot/src/nsSecurityHeaderParser.h new file mode 100644 index 000000000000..5e8ded11da5b --- /dev/null +++ b/security/manager/boot/src/nsSecurityHeaderParser.h @@ -0,0 +1,74 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsSecurityHeaderParser_h__ +#define nsSecurityHeaderParser_h__ + +#include "nsString.h" +#include "mozilla/LinkedList.h" +#include "nsCOMPtr.h" + +// Utility class for handing back parsed directives and (optional) values +class nsSecurityHeaderDirective : public mozilla::LinkedListElement { +public: + nsAutoCString mName; + nsAutoCString mValue; +}; + +// This class parses security-related HTTP headers like +// Strict-Transport-Security. The Augmented Backus-Naur Form syntax for this +// header is reproduced below, for reference: +// +// Strict-Transport-Security = "Strict-Transport-Security" ":" +// [ directive ] *( ";" [ directive ] ) +// +// directive = directive-name [ "=" directive-value ] +// directive-name = token +// directive-value = token | quoted-string +// +// where: +// +// token = +// quoted-string = / +// +// For further reference, see [RFC6797], Section 6.1 + +class nsSecurityHeaderParser { +public: + nsSecurityHeaderParser(const char *aHeader); + ~nsSecurityHeaderParser(); + + // Only call Parse once. + nsresult Parse(); + // The caller does not take ownership of the memory returned here. + mozilla::LinkedList *GetDirectives(); + +private: + bool Accept(char aChr); + bool Accept(bool (*aClassifier) (signed char)); + void Expect(char aChr); + void Advance(); + void Header(); // header = [ directive ] *( ";" [ directive ] ) + void Directive(); // directive = directive-name [ "=" directive-value ] + void DirectiveName(); // directive-name = token + void DirectiveValue(); // directive-value = token | quoted-string + void Token(); // token = 1* + void QuotedString(); // quoted-string = (<"> *( qdtext | quoted-pair ) <">) + void QuotedText(); // qdtext = and "\"> + void QuotedPair(); // quoted-pair = "\" CHAR + + // LWS = [CRLF] 1*( SP | HT ) + void LWSMultiple(); // Handles *( LWS ) + void LWSCRLF(); // Handles the [CRLF] part of LWS + void LWS(); // Handles the 1*( SP | HT ) part of LWS + + mozilla::LinkedList mDirectives; + const char *mCursor; + nsSecurityHeaderDirective *mDirective; + + nsAutoCString mOutput; + bool mError; +}; + +#endif /* nsSecurityHeaderParser_h__ */ diff --git a/security/manager/boot/src/nsStrictTransportSecurityService.cpp b/security/manager/boot/src/nsStrictTransportSecurityService.cpp index 53374ed2c904..eac114b935e2 100644 --- a/security/manager/boot/src/nsStrictTransportSecurityService.cpp +++ b/security/manager/boot/src/nsStrictTransportSecurityService.cpp @@ -17,6 +17,8 @@ #include "nsIScriptSecurityManager.h" #include "nsISocketProvider.h" #include "mozilla/Preferences.h" +#include "mozilla/LinkedList.h" +#include "nsSecurityHeaderParser.h" // A note about the preload list: // When a site specifically disables sts by sending a header with @@ -45,12 +47,6 @@ GetSTSLog() #define STSLOG(args) PR_LOG(GetSTSLog(), 4, args) -#define STS_PARSER_FAIL_IF(test,args) \ - if (test) { \ - STSLOG(args); \ - return NS_ERROR_FAILURE; \ - } - //////////////////////////////////////////////////////////////////////////////// nsSTSHostEntry::nsSTSHostEntry(const char* aHost) @@ -252,7 +248,7 @@ nsStrictTransportSecurityService::ProcessStsHeaderMutating(nsIURI* aSourceURI, uint64_t *aMaxAge, bool *aIncludeSubdomains) { - STSLOG(("STS: ProcessStrictTransportHeader(%s)\n", aHeader)); + STSLOG(("STS: processing header '%s'", aHeader)); // "Strict-Transport-Security" ":" OWS // STS-d *( OWS ";" OWS STS-d OWS) @@ -263,95 +259,100 @@ nsStrictTransportSecurityService::ProcessStsHeaderMutating(nsIURI* aSourceURI, // maxAge = "max-age" "=" delta-seconds v-ext // // includeSubDomains = [ "includeSubDomains" ] - - const char* directive; + // + // The order of the directives is not significant. + // All directives must appear only once. + // Directive names are case-insensitive. + // The entire header is invalid if a directive not conforming to the + // syntax is encountered. + // Unrecognized directives (that are otherwise syntactically valid) are + // ignored, and the rest of the header is parsed as normal. bool foundMaxAge = false; - bool foundUnrecognizedTokens = false; - bool includeSubdomains = false; + bool foundIncludeSubdomains = false; + bool foundUnrecognizedDirective = false; int64_t maxAge = 0; NS_NAMED_LITERAL_CSTRING(max_age_var, "max-age"); NS_NAMED_LITERAL_CSTRING(include_subd_var, "includesubdomains"); - while ((directive = NS_strtok(";", &aHeader))) { - //skip leading whitespace - directive = NS_strspnp(" \t", directive); - STS_PARSER_FAIL_IF(!(*directive), ("error removing initial whitespace\n.")); - if (!PL_strncasecmp(directive, max_age_var.get(), max_age_var.Length())) { - // skip directive name - directive += max_age_var.Length(); - // skip leading whitespace - directive = NS_strspnp(" \t", directive); - STS_PARSER_FAIL_IF(*directive != '=', - ("No equal sign found in max-age directive\n")); + nsSecurityHeaderParser parser(aHeader); + nsresult rv = parser.Parse(); + if (NS_FAILED(rv)) { + STSLOG(("STS: could not parse header")); + return rv; + } + mozilla::LinkedList *directives = parser.GetDirectives(); - // skip over the equal sign - STS_PARSER_FAIL_IF(*(++directive) == '\0', - ("No delta-seconds present\n")); + for (nsSecurityHeaderDirective *directive = directives->getFirst(); + directive != nullptr; directive = directive->getNext()) { + if (directive->mName.Length() == max_age_var.Length() && + directive->mName.EqualsIgnoreCase(max_age_var.get(), + max_age_var.Length())) { + if (foundMaxAge) { + STSLOG(("STS: found two max-age directives")); + return NS_ERROR_FAILURE; + } - // obtain the delta-seconds value - STS_PARSER_FAIL_IF(PR_sscanf(directive, "%lld", &maxAge) != 1, - ("Could not convert delta-seconds\n")); - STSLOG(("STS: ProcessStrictTransportHeader() STS found maxage %lld\n", maxAge)); + STSLOG(("STS: found max-age directive")); foundMaxAge = true; - // skip max-age value and trailing whitespace - directive = NS_strspnp("0123456789 \t", directive); - - // log unknown tokens, but don't fail (for forwards compatibility) - if (*directive != '\0') { - foundUnrecognizedTokens = true; - STSLOG(("Extra stuff in max-age after delta-seconds: %s \n", directive)); - } - } - else if (!PL_strncasecmp(directive, include_subd_var.get(), include_subd_var.Length())) { - directive += include_subd_var.Length(); - - // only record "includesubdomains" if it is a token by itself... for - // example, don't set includeSubdomains = true if the directive is - // "includesubdomainsFooBar". - if (*directive == '\0' || *directive =='\t' || *directive == ' ') { - includeSubdomains = true; - STSLOG(("STS: ProcessStrictTransportHeader: obtained subdomains status\n")); - - // skip trailing whitespace - directive = NS_strspnp(" \t", directive); - - if (*directive != '\0') { - foundUnrecognizedTokens = true; - STSLOG(("Extra stuff after includesubdomains: %s\n", directive)); + size_t len = directive->mValue.Length(); + for (size_t i = 0; i < len; i++) { + char chr = directive->mValue.CharAt(i); + if (chr < '0' || chr > '9') { + STSLOG(("STS: invalid value for max-age directive")); + return NS_ERROR_FAILURE; } - } else { - foundUnrecognizedTokens = true; - STSLOG(("Unrecognized directive in header: %s\n", directive)); } - } - else { - // log unknown directives, but don't fail (for backwards compatibility) - foundUnrecognizedTokens = true; - STSLOG(("Unrecognized directive in header: %s\n", directive)); + + if (PR_sscanf(directive->mValue.get(), "%lld", &maxAge) != 1) { + STSLOG(("STS: could not parse delta-seconds")); + return NS_ERROR_FAILURE; + } + + STSLOG(("STS: parsed delta-seconds: %lld", maxAge)); + } else if (directive->mName.Length() == include_subd_var.Length() && + directive->mName.EqualsIgnoreCase(include_subd_var.get(), + include_subd_var.Length())) { + if (foundIncludeSubdomains) { + STSLOG(("STS: found two includeSubdomains directives")); + return NS_ERROR_FAILURE; + } + + STSLOG(("STS: found includeSubdomains directive")); + foundIncludeSubdomains = true; + + if (directive->mValue.Length() != 0) { + STSLOG(("STS: includeSubdomains directive unexpectedly had value '%s'", directive->mValue.get())); + return NS_ERROR_FAILURE; + } + } else { + STSLOG(("STS: ignoring unrecognized directive '%s'", directive->mName.get())); + foundUnrecognizedDirective = true; } } // after processing all the directives, make sure we came across max-age // somewhere. - STS_PARSER_FAIL_IF(!foundMaxAge, - ("Parse ERROR: couldn't locate max-age token\n")); + if (!foundMaxAge) { + STSLOG(("STS: did not encounter required max-age directive")); + return NS_ERROR_FAILURE; + } // record the successfully parsed header data. - SetStsState(aSourceURI, maxAge, includeSubdomains, aFlags); + SetStsState(aSourceURI, maxAge, foundIncludeSubdomains, aFlags); if (aMaxAge != nullptr) { *aMaxAge = (uint64_t)maxAge; } if (aIncludeSubdomains != nullptr) { - *aIncludeSubdomains = includeSubdomains; + *aIncludeSubdomains = foundIncludeSubdomains; } - return foundUnrecognizedTokens ? + return foundUnrecognizedDirective ? NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA : NS_OK; } diff --git a/security/manager/ssl/tests/unit/test_sts_preloadlist_perwindowpb.js b/security/manager/ssl/tests/unit/test_sts_preloadlist_perwindowpb.js index 53ffb39a9ade..b1934814d7af 100644 --- a/security/manager/ssl/tests/unit/test_sts_preloadlist_perwindowpb.js +++ b/security/manager/ssl/tests/unit/test_sts_preloadlist_perwindowpb.js @@ -163,13 +163,12 @@ function test_private_browsing1() { // (sanity check first - this should be in the preload list) do_check_true(gSTSService.isStsHost("login.persona.org", IS_PRIVATE)); var uri = Services.io.newURI("http://login.persona.org", null, null); - // according to the rfc, max-age can't be negative, but this is a great - // way to test an expired entry - gSTSService.processStsHeader(uri, "max-age=-1000", IS_PRIVATE); - do_check_false(gSTSService.isStsHost("login.persona.org", IS_PRIVATE)); - - // Simulate leaving private browsing mode - Services.obs.notifyObservers(null, "last-pb-context-exited", null); + gSTSService.processStsHeader(uri, "max-age=1", IS_PRIVATE); + do_timeout(1250, function() { + do_check_false(gSTSService.isStsHost("login.persona.org", IS_PRIVATE)); + // Simulate leaving private browsing mode + Services.obs.notifyObservers(null, "last-pb-context-exited", null); + }); } function test_private_browsing2() { From 1efdf039a6311a313e23c5dcb14466953b47c6b5 Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Fri, 26 Jul 2013 09:14:04 -0700 Subject: [PATCH 45/92] Bug 896117 - Add enter and exit dialogs for guest mode. r=margaret --- mobile/android/base/BrowserApp.java | 51 +++++++++++++++++-- mobile/android/base/Prompt.java | 9 +++- .../base/locales/en-US/android_strings.dtd | 11 +++- mobile/android/base/strings.xml.in | 7 +++ 4 files changed, 71 insertions(+), 7 deletions(-) diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index 46e316c47167..ae2bedd933fe 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -113,6 +113,12 @@ abstract public class BrowserApp extends GeckoApp public int parent; } + // The types of guest mdoe dialogs we show + private static enum GuestModeDialog { + ENTERING, + LEAVING + } + private Vector mAddonMenuItemsCache; private PropertyAnimator mMainLayoutAnimator; @@ -1755,18 +1761,55 @@ abstract public class BrowserApp extends GeckoApp addPrivateTab(); return true; case R.id.enter_guest_mode: - doRestart("--guest-mode"); - System.exit(0); + showGuestModeDialog(GuestModeDialog.ENTERING); return true; case R.id.exit_guest_mode: - doRestart(); - System.exit(0); + showGuestModeDialog(GuestModeDialog.LEAVING); return true; default: return super.onOptionsItemSelected(item); } } + private void showGuestModeDialog(final GuestModeDialog type) { + final Prompt ps = new Prompt(this, new Prompt.PromptCallback() { + @Override + public void onPromptFinished(String result) { + try { + int itemId = new JSONObject(result).getInt("button"); + if (itemId == 0) { + String args = ""; + if (type == GuestModeDialog.ENTERING) { + args = "--guest-mode"; + } + doRestart(args); + System.exit(0); + } + } catch(JSONException ex) { + Log.e(LOGTAG, "Exception reading guest mode prompt result", ex); + } + } + }); + + Resources res = getResources(); + ps.setButtons(new String[] { + res.getString(R.string.guest_mode_dialog_continue), + res.getString(R.string.guest_mode_dialog_cancel) + }); + + int titleString = 0; + int msgString = 0; + if (type == GuestModeDialog.ENTERING) { + titleString = R.string.guest_mode_enter_title; + msgString = R.string.guest_mode_enter_text; + } else { + titleString = R.string.guest_mode_leave_title; + msgString = R.string.guest_mode_leave_text; + } + + ps.show(res.getString(titleString), res.getString(msgString), null, false); + } + /** * This will detect if the key pressed is back. If so, will show the history. */ diff --git a/mobile/android/base/Prompt.java b/mobile/android/base/Prompt.java index 791370263810..5a29ec553f6e 100644 --- a/mobile/android/base/Prompt.java +++ b/mobile/android/base/Prompt.java @@ -75,7 +75,6 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis private static int mInputPaddingSize; private static int mMinRowSize; - public Prompt(Context context, ConcurrentLinkedQueue queue) { this(context); mCallback = null; @@ -212,6 +211,14 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis mDialog.show(); } + public void setButtons(String[] buttons) { + mButtons = buttons; + } + + public void setInputs(PromptInput[] inputs) { + mInputs = inputs; + } + @Override public void onClick(DialogInterface aDialog, int aWhich) { ThreadUtils.assertOnUiThread(); diff --git a/mobile/android/base/locales/en-US/android_strings.dtd b/mobile/android/base/locales/en-US/android_strings.dtd index 5ec329072d2c..ecc8965a5eb6 100644 --- a/mobile/android/base/locales/en-US/android_strings.dtd +++ b/mobile/android/base/locales/en-US/android_strings.dtd @@ -352,5 +352,12 @@ just addresses the organization to follow, e.g. "This site is run by " --> - - + + + + + + + + + diff --git a/mobile/android/base/strings.xml.in b/mobile/android/base/strings.xml.in index 184066a41039..c39ea22154c9 100644 --- a/mobile/android/base/strings.xml.in +++ b/mobile/android/base/strings.xml.in @@ -323,4 +323,11 @@ &enter_guest_mode; &exit_guest_mode; + &guest_mode_dialog_continue; + &guest_mode_dialog_cancel; + &guest_mode_enter_title; + &guest_mode_enter_text; + + &guest_mode_leave_title; + &guest_mode_leave_text; From 85f24f0d0044f8456ddac924f5edba3e63ec9ea4 Mon Sep 17 00:00:00 2001 From: Sam Foster Date: Thu, 25 Jul 2013 20:54:52 -0700 Subject: [PATCH 46/92] Bug 890148 - Streamline transitions when showing the find appbar. r=mbrubeck --HG-- extra : rebase_source : ce97851f3e729795871a9c4bb1ef38ae3b34635f --- browser/metro/theme/browser.css | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/browser/metro/theme/browser.css b/browser/metro/theme/browser.css index 1a98e4b536c2..fba2a72cd6ff 100644 --- a/browser/metro/theme/browser.css +++ b/browser/metro/theme/browser.css @@ -268,17 +268,18 @@ documenttab[selected] .documenttab-selection { transition-duration: .3s; transition-timing-function: ease-in-out; } - #browsers browser { - transition: padding-bottom @metro_animation_duration@ @metro_animation_easing@; + /* unset padding-bottom immediately */ + transition-duration: 0s; + transition-delay: 0s; + transition-property: padding-bottom; } - #browsers[findbar] browser { + /* delay setting padding-bottom until the findbar has transitioned in */ + transition-delay: @metro_animation_duration@; padding-bottom: @findbar_height@; } - /* Selection overlay and monocles */ - #page, .selection-overlay { -moz-stack-sizing: ignore; From ee112975618a2eba0f2e3934eaddf0e0aadf7488 Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Fri, 26 Jul 2013 09:24:51 -0700 Subject: [PATCH 47/92] Bug 895549 - Only remove transforms when we're about to recycle a view. r=lucasr --- mobile/android/base/TabsTray.java | 32 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/mobile/android/base/TabsTray.java b/mobile/android/base/TabsTray.java index 14a3a2d876fb..e1c840f47964 100644 --- a/mobile/android/base/TabsTray.java +++ b/mobile/android/base/TabsTray.java @@ -49,6 +49,7 @@ public class TabsTray extends TwoWayView private static final int ANIMATION_DURATION = 250; private static final String ABOUT_HOME = "about:home"; + private int mOriginalSize = 0; public TabsTray(Context context, AttributeSet attrs) { super(context, attrs); @@ -261,6 +262,20 @@ public class TabsTray extends TwoWayView row.close.setTag(row); } + private void resetTransforms(View view) { + ViewHelper.setAlpha(view, 1); + if (mOriginalSize == 0) + return; + + if (isVertical()) { + ViewHelper.setHeight(view, mOriginalSize); + ViewHelper.setTranslationX(view, 0); + } else { + ViewHelper.setWidth(view, mOriginalSize); + ViewHelper.setTranslationY(view, 0); + } + } + @Override public View getView(int position, View convertView, ViewGroup parent) { TabRow row; @@ -272,6 +287,9 @@ public class TabsTray extends TwoWayView convertView.setTag(row); } else { row = (TabRow) convertView.getTag(); + // If we're recycling this view, there's a chance it was transformed during + // the close animation. Remove any of those properties. + resetTransforms(convertView); } Tab tab = mTabs.get(position); @@ -331,23 +349,15 @@ public class TabsTray extends TwoWayView TabRow tab = (TabRow)view.getTag(); final int tabId = tab.id; - final int originalSize = (isVertical ? view.getHeight() : view.getWidth()); + // Caching this assumes that all rows are the same height + if (mOriginalSize == 0) + mOriginalSize = (isVertical ? view.getHeight() : view.getWidth()); animator.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() { @Override public void onPropertyAnimationStart() { } @Override public void onPropertyAnimationEnd() { - ViewHelper.setAlpha(view, 1); - - if (isVertical) { - ViewHelper.setHeight(view, originalSize); - ViewHelper.setTranslationX(view, 0); - } else { - ViewHelper.setWidth(view, originalSize); - ViewHelper.setTranslationY(view, 0); - } - Tabs tabs = Tabs.getInstance(); Tab tab = tabs.getTab(tabId); tabs.closeTab(tab); From 9931c2c3a71c433b7960a88fcb4d830b59098bb0 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Fri, 26 Jul 2013 12:25:27 -0400 Subject: [PATCH 48/92] Followup to bug 888510 - windowless-layers reftest should be skip-if no testplugin, not fails-if --HG-- extra : rebase_source : 283a63049eb382168f64ec2b554dd4c31ad59994 --- dom/plugins/test/reftest/reftest.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/plugins/test/reftest/reftest.list b/dom/plugins/test/reftest/reftest.list index 1e63670f9ee5..cef03366e424 100644 --- a/dom/plugins/test/reftest/reftest.list +++ b/dom/plugins/test/reftest/reftest.list @@ -27,4 +27,4 @@ random-if(!haveTestPlugin) == plugin-transform-1.html plugin-transform-1-ref.htm fails-if(!haveTestPlugin) == plugin-transform-2.html plugin-transform-2-ref.html skip-if(!haveTestPlugin) == shrink-1.html shrink-1-ref.html skip-if(!haveTestPlugin) == update-1.html update-1-ref.html -fails-if(!haveTestPlugin) == windowless-layers.html windowless-layers-ref.html +skip-if(!haveTestPlugin) == windowless-layers.html windowless-layers-ref.html From ed8bccacc94acdbe14f36ceeb1377d81856ee25d Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Wed, 24 Jul 2013 15:41:55 -0700 Subject: [PATCH 49/92] Bug 896292: Mark widget/gtk2 as FAIL_ON_WARNINGS. r=karlt r=gps --- widget/gtk2/Makefile.in | 1 + 1 file changed, 1 insertion(+) diff --git a/widget/gtk2/Makefile.in b/widget/gtk2/Makefile.in index 903286d02c92..25e1cfed0deb 100644 --- a/widget/gtk2/Makefile.in +++ b/widget/gtk2/Makefile.in @@ -18,6 +18,7 @@ endif EXPORT_LIBRARY = 1 LIBXUL_LIBRARY = 1 +FAIL_ON_WARNINGS = 1 NATIVE_THEME_SUPPORT = 1 From 85bccc71aed194eca30d86df4dc9ea106122dd30 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 26 Jul 2013 18:46:31 +0200 Subject: [PATCH 50/92] Bug 894941 - Move SSE.{h,cpp} and arm.{h,cpp} to mozglue/build/. r=glandium --HG-- rename : xpcom/glue/SSE.cpp => mozglue/build/SSE.cpp rename : xpcom/glue/SSE.h => mozglue/build/SSE.h rename : xpcom/glue/arm.cpp => mozglue/build/arm.cpp rename : xpcom/glue/arm.h => mozglue/build/arm.h rename : xpcom/tests/ShowSSEConfig.cpp => mozglue/tests/ShowSSEConfig.cpp --- {xpcom/glue => mozglue/build}/SSE.cpp | 0 {xpcom/glue => mozglue/build}/SSE.h | 20 ++++++++++---------- {xpcom/glue => mozglue/build}/arm.cpp | 0 {xpcom/glue => mozglue/build}/arm.h | 12 ++++++------ mozglue/build/moz.build | 17 +++++++++++++++++ {xpcom => mozglue}/tests/ShowSSEConfig.cpp | 0 mozglue/tests/moz.build | 1 + xpcom/glue/moz.build | 2 -- xpcom/glue/nomozalloc/Makefile.in | 2 +- xpcom/glue/objs.mk | 5 ----- xpcom/glue/staticruntime/Makefile.in | 2 +- xpcom/tests/moz.build | 1 - 12 files changed, 36 insertions(+), 26 deletions(-) rename {xpcom/glue => mozglue/build}/SSE.cpp (100%) rename {xpcom/glue => mozglue/build}/SSE.h (95%) rename {xpcom/glue => mozglue/build}/arm.cpp (100%) rename {xpcom/glue => mozglue/build}/arm.h (95%) rename {xpcom => mozglue}/tests/ShowSSEConfig.cpp (100%) diff --git a/xpcom/glue/SSE.cpp b/mozglue/build/SSE.cpp similarity index 100% rename from xpcom/glue/SSE.cpp rename to mozglue/build/SSE.cpp diff --git a/xpcom/glue/SSE.h b/mozglue/build/SSE.h similarity index 95% rename from xpcom/glue/SSE.h rename to mozglue/build/SSE.h index 15a064c6b1f8..1d10cc5babb1 100644 --- a/xpcom/glue/SSE.h +++ b/mozglue/build/SSE.h @@ -8,8 +8,8 @@ #ifndef mozilla_SSE_h_ #define mozilla_SSE_h_ -// for definition of NS_COM_GLUE -#include "nscore.h" +// for definition of MFBT_DATA +#include "mozilla/Types.h" /** * The public interface of this header consists of a set of macros and @@ -176,28 +176,28 @@ namespace mozilla { namespace sse_private { #if defined(MOZILLA_SSE_HAVE_CPUID_DETECTION) #if !defined(MOZILLA_PRESUME_MMX) - extern bool NS_COM_GLUE mmx_enabled; + extern bool MFBT_DATA mmx_enabled; #endif #if !defined(MOZILLA_PRESUME_SSE) - extern bool NS_COM_GLUE sse_enabled; + extern bool MFBT_DATA sse_enabled; #endif #if !defined(MOZILLA_PRESUME_SSE2) - extern bool NS_COM_GLUE sse2_enabled; + extern bool MFBT_DATA sse2_enabled; #endif #if !defined(MOZILLA_PRESUME_SSE3) - extern bool NS_COM_GLUE sse3_enabled; + extern bool MFBT_DATA sse3_enabled; #endif #if !defined(MOZILLA_PRESUME_SSSE3) - extern bool NS_COM_GLUE ssse3_enabled; + extern bool MFBT_DATA ssse3_enabled; #endif #if !defined(MOZILLA_PRESUME_SSE4A) - extern bool NS_COM_GLUE sse4a_enabled; + extern bool MFBT_DATA sse4a_enabled; #endif #if !defined(MOZILLA_PRESUME_SSE4_1) - extern bool NS_COM_GLUE sse4_1_enabled; + extern bool MFBT_DATA sse4_1_enabled; #endif #if !defined(MOZILLA_PRESUME_SSE4_2) - extern bool NS_COM_GLUE sse4_2_enabled; + extern bool MFBT_DATA sse4_2_enabled; #endif #endif } diff --git a/xpcom/glue/arm.cpp b/mozglue/build/arm.cpp similarity index 100% rename from xpcom/glue/arm.cpp rename to mozglue/build/arm.cpp diff --git a/xpcom/glue/arm.h b/mozglue/build/arm.h similarity index 95% rename from xpcom/glue/arm.h rename to mozglue/build/arm.h index e0bcba8f3f9a..6fe410d0f4d8 100644 --- a/xpcom/glue/arm.h +++ b/mozglue/build/arm.h @@ -7,8 +7,8 @@ #ifndef mozilla_arm_h_ #define mozilla_arm_h_ -// for definition of NS_COM_GLUE -#include "nscore.h" +// for definition of MFBT_DATA +#include "mozilla/Types.h" /* This is patterned after SSE.h, but provides ARMv5E, ARMv6, and NEON detection. For reasons similar to the SSE code, code using NEON (even just @@ -104,16 +104,16 @@ namespace mozilla { namespace arm_private { #if defined(MOZILLA_ARM_HAVE_CPUID_DETECTION) #if !defined(MOZILLA_PRESUME_EDSP) - extern bool NS_COM_GLUE edsp_enabled; + extern bool MFBT_DATA edsp_enabled; #endif #if !defined(MOZILLA_PRESUME_ARMV6) - extern bool NS_COM_GLUE armv6_enabled; + extern bool MFBT_DATA armv6_enabled; #endif #if !defined(MOZILLA_PRESUME_ARMV7) - extern bool NS_COM_GLUE armv7_enabled; + extern bool MFBT_DATA armv7_enabled; #endif #if !defined(MOZILLA_PRESUME_NEON) - extern bool NS_COM_GLUE neon_enabled; + extern bool MFBT_DATA neon_enabled; #endif #endif } diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build index 0671669107bf..f2b3f2d54bd5 100644 --- a/mozglue/build/moz.build +++ b/mozglue/build/moz.build @@ -30,5 +30,22 @@ if CONFIG['OS_TARGET'] == 'Android': 'BionicGlue.cpp', ] +EXPORTS.mozilla += [ + 'SSE.h', + 'arm.h', +] + +if CONFIG['CPU_ARCH'].startswith('x86'): + CPP_SOURCES += [ + 'SSE.cpp', + ] + +if CONFIG['CPU_ARCH'] == 'arm': + CPP_SOURCES += [ + 'arm.cpp', + ] + + + LIBRARY_NAME = 'mozglue' diff --git a/xpcom/tests/ShowSSEConfig.cpp b/mozglue/tests/ShowSSEConfig.cpp similarity index 100% rename from xpcom/tests/ShowSSEConfig.cpp rename to mozglue/tests/ShowSSEConfig.cpp diff --git a/mozglue/tests/moz.build b/mozglue/tests/moz.build index aa9cefccd766..5f0fcc5544d5 100644 --- a/mozglue/tests/moz.build +++ b/mozglue/tests/moz.build @@ -9,4 +9,5 @@ NO_DIST_INSTALL = True if CONFIG['MOZ_LINKER']: CPP_SOURCES += [ 'TestZip.cpp', + 'ShowSSEConfig.cpp', ] diff --git a/xpcom/glue/moz.build b/xpcom/glue/moz.build index d417bac1c0a5..428fb53ef687 100644 --- a/xpcom/glue/moz.build +++ b/xpcom/glue/moz.build @@ -79,8 +79,6 @@ EXPORTS.mozilla += [ 'Mutex.h', 'Observer.h', 'ReentrantMonitor.h', - 'SSE.h', - 'arm.h', 'unused.h', ] diff --git a/xpcom/glue/nomozalloc/Makefile.in b/xpcom/glue/nomozalloc/Makefile.in index 37436ba0e4a8..e2caa73a566b 100644 --- a/xpcom/glue/nomozalloc/Makefile.in +++ b/xpcom/glue/nomozalloc/Makefile.in @@ -45,7 +45,7 @@ OS_COMPILE_CFLAGS += -Zl DEFINES += -D_USE_ANSI_CPP endif -export:: $(XPCOM_GLUE_SRC_CPPSRCS) $(XPCOM_GLUENS_SRC_CPPSRCS) $(topsrcdir)/xpcom/glue/nsStringAPI.cpp $(topsrcdir)/xpcom/glue/GenericModule.cpp $(topsrcdir)/xpcom/glue/DeadlockDetector.h $(topsrcdir)/xpcom/glue/SSE.h $(topsrcdir)/xpcom/glue/arm.h +export:: $(XPCOM_GLUE_SRC_CPPSRCS) $(XPCOM_GLUENS_SRC_CPPSRCS) $(topsrcdir)/xpcom/glue/nsStringAPI.cpp $(topsrcdir)/xpcom/glue/GenericModule.cpp $(topsrcdir)/xpcom/glue/DeadlockDetector.h $(INSTALL) $^ . ifdef TARGET_XPCOM_ABI diff --git a/xpcom/glue/objs.mk b/xpcom/glue/objs.mk index 0de21b136654..525e3cbcc45d 100644 --- a/xpcom/glue/objs.mk +++ b/xpcom/glue/objs.mk @@ -38,15 +38,10 @@ XPCOM_GLUE_SRC_CPPSRCS = $(addprefix $(topsrcdir)/xpcom/glue/, $(XPCOM_GLUE_SRC_ XPCOM_GLUENS_SRC_LCPPSRCS = \ BlockingResourceBase.cpp \ DeadlockDetector.cpp \ - SSE.cpp \ unused.cpp \ nsProxyRelease.cpp \ nsTextFormatter.cpp \ GenericFactory.cpp \ $(NULL) -ifneq (,$(filter arm%,$(TARGET_CPU))) -XPCOM_GLUENS_SRC_LCPPSRCS += arm.cpp -endif - XPCOM_GLUENS_SRC_CPPSRCS = $(addprefix $(topsrcdir)/xpcom/glue/,$(XPCOM_GLUENS_SRC_LCPPSRCS)) diff --git a/xpcom/glue/staticruntime/Makefile.in b/xpcom/glue/staticruntime/Makefile.in index 7b0db3f67ae4..911f7ab92b96 100644 --- a/xpcom/glue/staticruntime/Makefile.in +++ b/xpcom/glue/staticruntime/Makefile.in @@ -42,7 +42,7 @@ OS_COMPILE_CFLAGS += -Zl DEFINES += -D_USE_ANSI_CPP endif -export:: $(XPCOM_GLUE_SRC_CPPSRCS) $(XPCOM_GLUENS_SRC_CPPSRCS) $(topsrcdir)/xpcom/glue/nsStringAPI.cpp $(topsrcdir)/xpcom/glue/GenericModule.cpp $(topsrcdir)/xpcom/glue/DeadlockDetector.h $(topsrcdir)/xpcom/glue/SSE.h $(topsrcdir)/xpcom/glue/arm.h +export:: $(XPCOM_GLUE_SRC_CPPSRCS) $(XPCOM_GLUENS_SRC_CPPSRCS) $(topsrcdir)/xpcom/glue/nsStringAPI.cpp $(topsrcdir)/xpcom/glue/GenericModule.cpp $(topsrcdir)/xpcom/glue/DeadlockDetector.h $(INSTALL) $^ . ifdef TARGET_XPCOM_ABI diff --git a/xpcom/tests/moz.build b/xpcom/tests/moz.build index 33bd8a673382..11a690221b3b 100644 --- a/xpcom/tests/moz.build +++ b/xpcom/tests/moz.build @@ -52,7 +52,6 @@ CPP_SOURCES += [ CPP_UNIT_TESTS += [ 'ShowAlignments.cpp', - 'ShowSSEConfig.cpp', 'TestAutoPtr.cpp', 'TestAutoRef.cpp', 'TestCOMArray.cpp', From fd327d47d12788b6f3bc159b0ef4ec38191478cd Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 26 Jul 2013 18:46:32 +0200 Subject: [PATCH 51/92] Bug 894941 - Import SSE-optimized routines for the speex resampler. r=ehsan --- media/libspeex_resampler/src/resample_sse.h | 128 ++++++++++++++++++++ media/libspeex_resampler/update.sh | 3 +- 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 media/libspeex_resampler/src/resample_sse.h diff --git a/media/libspeex_resampler/src/resample_sse.h b/media/libspeex_resampler/src/resample_sse.h new file mode 100644 index 000000000000..64be8a161612 --- /dev/null +++ b/media/libspeex_resampler/src/resample_sse.h @@ -0,0 +1,128 @@ +/* Copyright (C) 2007-2008 Jean-Marc Valin + * Copyright (C) 2008 Thorvald Natvig + */ +/** + @file resample_sse.h + @brief Resampler functions (SSE version) +*/ +/* + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + - Neither the name of the Xiph.org Foundation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include + +#define OVERRIDE_INNER_PRODUCT_SINGLE +static inline float inner_product_single(const float *a, const float *b, unsigned int len) +{ + int i; + float ret; + __m128 sum = _mm_setzero_ps(); + for (i=0;i +#define OVERRIDE_INNER_PRODUCT_DOUBLE + +static inline double inner_product_double(const float *a, const float *b, unsigned int len) +{ + int i; + double ret; + __m128d sum = _mm_setzero_pd(); + __m128 t; + for (i=0;i # # Copies the needed files from a directory containing the original -# libspeex sources that we need for HTML5 media playback rate change. +# libspeex sources. cp $1/libspeex/resample.c src +cp $1/libspeex/resample_sse.h src cp $1/libspeex/arch.h src cp $1/libspeex/stack_alloc.h src cp $1/libspeex/fixed_generic.h src From 10466001b126ceed401d4b9c8ac6a08d50aed055 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 26 Jul 2013 18:46:32 +0200 Subject: [PATCH 52/92] Bug 894941 - Patch the speex resampler to do runtime checks for SSE. r=ehsan,glandium --- media/libspeex_resampler/src/Makefile.in | 10 ++ media/libspeex_resampler/src/moz.build | 4 + media/libspeex_resampler/src/resample.c | 74 ++++++--- media/libspeex_resampler/src/sse_detect.cpp | 15 ++ media/libspeex_resampler/src/sse_detect.h | 20 +++ .../sse-detect-runtime.patch | 143 ++++++++++++++++++ media/libspeex_resampler/update.sh | 1 + 7 files changed, 242 insertions(+), 25 deletions(-) create mode 100644 media/libspeex_resampler/src/sse_detect.cpp create mode 100644 media/libspeex_resampler/src/sse_detect.h create mode 100644 media/libspeex_resampler/sse-detect-runtime.patch diff --git a/media/libspeex_resampler/src/Makefile.in b/media/libspeex_resampler/src/Makefile.in index aa51cd67b26c..85b5bf47ebb7 100644 --- a/media/libspeex_resampler/src/Makefile.in +++ b/media/libspeex_resampler/src/Makefile.in @@ -31,3 +31,13 @@ CSRCS = \ $(NULL) include $(topsrcdir)/config/rules.mk + +# Only use SSE code when using floating point samples, and on x86 +ifneq (,$(INTEL_ARCHITECTURE)) +ifneq ($(OS_TARGET),Android) +DEFINES += -D_USE_SSE -D_USE_SSE2 +ifdef GNU_CC +resample.$(OBJ_SUFFIX): CFLAGS+=-msse2 +endif +endif +endif diff --git a/media/libspeex_resampler/src/moz.build b/media/libspeex_resampler/src/moz.build index b9fc026a7fe1..c41396f6e1e6 100644 --- a/media/libspeex_resampler/src/moz.build +++ b/media/libspeex_resampler/src/moz.build @@ -12,5 +12,9 @@ EXPORTS.speex += [ 'speex_types.h', ] +CPP_SOURCES += [ + 'sse_detect.cpp', +] + LIBRARY_NAME = 'speex_resampler' diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/src/resample.c index 84f1d7d738aa..8709f78efd46 100644 --- a/media/libspeex_resampler/src/resample.c +++ b/media/libspeex_resampler/src/resample.c @@ -95,8 +95,18 @@ static void speex_free (void *ptr) {free(ptr);} #define NULL 0 #endif +#include "sse_detect.h" + +/* We compile SSE code on x86 all the time, but we only use it if we find at + * runtime that the CPU supports it. */ #ifdef _USE_SSE +#ifdef _MSC_VER +#define inline __inline +#endif #include "resample_sse.h" +#ifdef _MSC_VER +#undef inline +#endif #endif /* Numer of elements to allocate on the stack */ @@ -344,10 +354,13 @@ static int resampler_basic_direct_single(SpeexResamplerState *st, spx_uint32_t c const spx_word16_t *sinc = & sinc_table[samp_frac_num*N]; const spx_word16_t *iptr = & in[last_sample]; -#ifndef OVERRIDE_INNER_PRODUCT_SINGLE +#ifdef OVERRIDE_INNER_PRODUCT_SINGLE + if (moz_has_sse()) { + sum = inner_product_single(sinc, iptr, N); + } else { +#endif sum = 0; for(j=0;jsinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); + } else { +#endif + spx_word32_t accum[4] = {0,0,0,0}; for(j=0;jsinc_table[4+(j+1)*st->oversample-offset-2]); @@ -467,14 +489,12 @@ static int resampler_basic_interpolate_single(SpeexResamplerState *st, spx_uint3 accum[2] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset]); accum[3] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset+1]); } - cubic_coef(frac, interp); sum = MULT16_32_Q15(interp[0],SHR32(accum[0], 1)) + MULT16_32_Q15(interp[1],SHR32(accum[1], 1)) + MULT16_32_Q15(interp[2],SHR32(accum[2], 1)) + MULT16_32_Q15(interp[3],SHR32(accum[3], 1)); -#else - cubic_coef(frac, interp); - sum = interpolate_product_single(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); +#ifdef OVERRIDE_INTERPOLATE_PRODUCT_SINGLE + } #endif - + out[out_stride * out_sample++] = SATURATE32(PSHR32(sum, 14), 32767); last_sample += int_advance; samp_frac_num += frac_advance; @@ -519,7 +539,12 @@ static int resampler_basic_interpolate_double(SpeexResamplerState *st, spx_uint3 spx_word16_t interp[4]; -#ifndef OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE +#ifdef OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE + if (moz_has_sse2()) { + cubic_coef(frac, interp); + sum = interpolate_product_double(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); + } else { +#endif double accum[4] = {0,0,0,0}; for(j=0;jsinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); +#ifdef OVERRIDE_INNER_PRODUCT_DOUBLE + } #endif out[out_stride * out_sample++] = PSHR32(sum,15); diff --git a/media/libspeex_resampler/src/sse_detect.cpp b/media/libspeex_resampler/src/sse_detect.cpp new file mode 100644 index 000000000000..b37112b66075 --- /dev/null +++ b/media/libspeex_resampler/src/sse_detect.cpp @@ -0,0 +1,15 @@ +/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "mozilla/SSE.h" +#include "sse_detect.h" + +int moz_has_sse2() { + return mozilla::supports_sse2() ? 1 : 0; +} + +int moz_has_sse() { + return mozilla::supports_sse() ? 1 : 0; +} diff --git a/media/libspeex_resampler/src/sse_detect.h b/media/libspeex_resampler/src/sse_detect.h new file mode 100644 index 000000000000..b246bb5c7c24 --- /dev/null +++ b/media/libspeex_resampler/src/sse_detect.h @@ -0,0 +1,20 @@ +/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef SSE_DETECT +#define SSE_DETECT + +#ifdef __cplusplus +extern "C" { +#endif + + int moz_has_sse2(); + int moz_has_sse(); + +#ifdef __cplusplus +} +#endif + +#endif // SSE_DETECT diff --git a/media/libspeex_resampler/sse-detect-runtime.patch b/media/libspeex_resampler/sse-detect-runtime.patch new file mode 100644 index 000000000000..b906c43f4fe8 --- /dev/null +++ b/media/libspeex_resampler/sse-detect-runtime.patch @@ -0,0 +1,143 @@ +diff --git a/media/libspeex_resampler/src/resample.c b/media/libspeex_resampler/src/resample.c +--- a/src/resample.c ++++ b/src/resample.c +@@ -95,8 +95,18 @@ static void speex_free (void *ptr) {free + #define NULL 0 + #endif + ++#include "sse_detect.h" ++ ++/* We compile SSE code on x86 all the time, but we only use it if we find at ++ * runtime that the CPU supports it. */ + #ifdef _USE_SSE ++#ifdef _MSC_VER ++#define inline __inline ++#endif + #include "resample_sse.h" ++#ifdef _MSC_VER ++#undef inline ++#endif + #endif + + /* Numer of elements to allocate on the stack */ +@@ -344,10 +354,13 @@ static int resampler_basic_direct_single + const spx_word16_t *sinc = & sinc_table[samp_frac_num*N]; + const spx_word16_t *iptr = & in[last_sample]; + +-#ifndef OVERRIDE_INNER_PRODUCT_SINGLE ++#ifdef OVERRIDE_INNER_PRODUCT_SINGLE ++ if (moz_has_sse()) { ++ sum = inner_product_single(sinc, iptr, N); ++ } else { ++#endif + sum = 0; + for(j=0;jsinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); ++ } else { ++#endif ++ + spx_word32_t accum[4] = {0,0,0,0}; +- + for(j=0;jsinc_table[4+(j+1)*st->oversample-offset-2]); +@@ -467,14 +489,12 @@ static int resampler_basic_interpolate_s + accum[2] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset]); + accum[3] += MULT16_16(curr_in,st->sinc_table[4+(j+1)*st->oversample-offset+1]); + } +- + cubic_coef(frac, interp); + sum = MULT16_32_Q15(interp[0],SHR32(accum[0], 1)) + MULT16_32_Q15(interp[1],SHR32(accum[1], 1)) + MULT16_32_Q15(interp[2],SHR32(accum[2], 1)) + MULT16_32_Q15(interp[3],SHR32(accum[3], 1)); +-#else +- cubic_coef(frac, interp); +- sum = interpolate_product_single(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); ++#ifdef OVERRIDE_INTERPOLATE_PRODUCT_SINGLE ++ } + #endif +- ++ + out[out_stride * out_sample++] = SATURATE32(PSHR32(sum, 14), 32767); + last_sample += int_advance; + samp_frac_num += frac_advance; +@@ -519,7 +539,12 @@ static int resampler_basic_interpolate_d + spx_word16_t interp[4]; + + +-#ifndef OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE ++#ifdef OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE ++ if (moz_has_sse2()) { ++ cubic_coef(frac, interp); ++ sum = interpolate_product_double(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); ++ } else { ++#endif + double accum[4] = {0,0,0,0}; + + for(j=0;jsinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); ++#ifdef OVERRIDE_INNER_PRODUCT_DOUBLE ++ } + #endif + + out[out_stride * out_sample++] = PSHR32(sum,15); diff --git a/media/libspeex_resampler/update.sh b/media/libspeex_resampler/update.sh index 8943f99e85cb..383a17c33297 100644 --- a/media/libspeex_resampler/update.sh +++ b/media/libspeex_resampler/update.sh @@ -20,3 +20,4 @@ cp $1/COPYING . # apply outstanding local patches patch -p1 < truncation.patch +patch -p1 < sse-detect-runtime.patch From 53a2f501c5daaa10999968bb44708deb2054408d Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 19 Jul 2013 16:40:56 +0200 Subject: [PATCH 53/92] Bug 882543 - Retain storage for media streams accross iterations instead of reallocating. r=jlebar,roc --- content/media/MediaStreamGraph.cpp | 12 ++++++------ content/media/MediaStreamGraphImpl.h | 5 +++++ xpcom/glue/nsTArray.h | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index 369d423cf192..f3facb4c4284 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -489,10 +489,10 @@ MediaStreamGraphImpl::UpdateStreamOrderForStream(nsTArray* aStack, void MediaStreamGraphImpl::UpdateStreamOrder() { - nsTArray > oldStreams; - oldStreams.SwapElements(mStreams); - for (uint32_t i = 0; i < oldStreams.Length(); ++i) { - MediaStream* stream = oldStreams[i]; + mOldStreams.SwapElements(mStreams); + mStreams.ClearAndRetainStorage(); + for (uint32_t i = 0; i < mOldStreams.Length(); ++i) { + MediaStream* stream = mOldStreams[i]; stream->mHasBeenOrdered = false; stream->mIsConsumed = false; stream->mIsOnOrderingStack = false; @@ -504,8 +504,8 @@ MediaStreamGraphImpl::UpdateStreamOrder() } nsAutoTArray stack; - for (uint32_t i = 0; i < oldStreams.Length(); ++i) { - nsRefPtr& s = oldStreams[i]; + for (uint32_t i = 0; i < mOldStreams.Length(); ++i) { + nsRefPtr& s = mOldStreams[i]; if (!s->mAudioOutputs.IsEmpty() || !s->mVideoOutputs.IsEmpty()) { MarkConsumed(s); } diff --git a/content/media/MediaStreamGraphImpl.h b/content/media/MediaStreamGraphImpl.h index 628c1f5525a3..4a1f4c8ed475 100644 --- a/content/media/MediaStreamGraphImpl.h +++ b/content/media/MediaStreamGraphImpl.h @@ -370,6 +370,11 @@ public: // is not running and this state can be used from the main thread. nsTArray > mStreams; + /** + * mOldStreams is used as temporary storage for streams when computing the + * order in which we compute them. + */ + nsTArray > mOldStreams; /** * The current graph time for the current iteration of the RunThread control * loop. diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index 06a6ae64f3aa..3a386477005a 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -1042,6 +1042,20 @@ public: // // Mutation methods // + // This method call the destructor on each element of the array, empties it, + // but does not shrink the array's capacity. + // + // Make sure to call Compact() if needed to avoid keeping a huge array + // around. + void ClearAndRetainStorage() { + if (base_type::mHdr == EmptyHdr()) { + return; + } + + DestructRange(0, Length()); + base_type::mHdr->mLength = 0; + } + // This method replaces a range of elements in this array. // @param start The starting index of the elements to replace. From cf5a18b6c85e4c3aa94d7d650a2043087346ffcd Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 19 Jul 2013 16:40:57 +0200 Subject: [PATCH 54/92] Bug 882543 - Actually run offline MSG offline. r=roc --- content/media/MediaStreamGraph.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index f3facb4c4284..a750f714b862 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -313,20 +313,30 @@ MediaStreamGraphImpl::GetAudioPosition(MediaStream* aStream) void MediaStreamGraphImpl::UpdateCurrentTime() { - GraphTime prevCurrentTime = mCurrentTime; - TimeStamp now = TimeStamp::Now(); - GraphTime nextCurrentTime = - SecondsToMediaTime((now - mCurrentTimeStamp).ToSeconds()) + mCurrentTime; + GraphTime prevCurrentTime, nextCurrentTime; + if (mRealtime) { + TimeStamp now = TimeStamp::Now(); + prevCurrentTime = mCurrentTime; + nextCurrentTime = + SecondsToMediaTime((now - mCurrentTimeStamp).ToSeconds()) + mCurrentTime; + + mCurrentTimeStamp = now; + LOG(PR_LOG_DEBUG+1, ("Updating current time to %f (real %f, mStateComputedTime %f)", + MediaTimeToSeconds(nextCurrentTime), + (now - mInitialTimeStamp).ToSeconds(), + MediaTimeToSeconds(mStateComputedTime))); + } else { + prevCurrentTime = mCurrentTime; + nextCurrentTime = mCurrentTime + MEDIA_GRAPH_TARGET_PERIOD_MS; + LOG(PR_LOG_DEBUG+1, ("Updating offline current time to %f (mStateComputedTime %f)", + MediaTimeToSeconds(nextCurrentTime), + MediaTimeToSeconds(mStateComputedTime))); + } + if (mStateComputedTime < nextCurrentTime) { LOG(PR_LOG_WARNING, ("Media graph global underrun detected")); nextCurrentTime = mStateComputedTime; } - mCurrentTimeStamp = now; - - LOG(PR_LOG_DEBUG+1, ("Updating current time to %f (real %f, mStateComputedTime %f)", - MediaTimeToSeconds(nextCurrentTime), - (now - mInitialTimeStamp).ToSeconds(), - MediaTimeToSeconds(mStateComputedTime))); if (prevCurrentTime >= nextCurrentTime) { NS_ASSERTION(prevCurrentTime == nextCurrentTime, "Time can't go backwards!"); From 2703867eb28417d35c2128066f9312cea53b9d3d Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 19 Jul 2013 16:40:57 +0200 Subject: [PATCH 55/92] Bug 882543 - Don't spam the main thread when rendering an offline graph. r=ehsan,roc --- content/media/MediaStreamGraph.cpp | 53 +++++++++++++++++++--------- content/media/MediaStreamGraphImpl.h | 10 ++++++ 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index a750f714b862..eed493eedc15 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -898,28 +898,47 @@ MediaStreamGraphImpl::PlayVideo(MediaStream* aStream) } } +bool +MediaStreamGraphImpl::ShouldUpdateMainThread() +{ + if (mRealtime) { + return true; + } + + TimeStamp now = TimeStamp::Now(); + if ((now - mLastMainThreadUpdate).ToMilliseconds() > MEDIA_GRAPH_TARGET_PERIOD_MS) { + mLastMainThreadUpdate = now; + return true; + } + return false; +} + void MediaStreamGraphImpl::PrepareUpdatesToMainThreadState(bool aFinalUpdate) { mMonitor.AssertCurrentThreadOwns(); - mStreamUpdates.SetCapacity(mStreamUpdates.Length() + mStreams.Length()); - for (uint32_t i = 0; i < mStreams.Length(); ++i) { - MediaStream* stream = mStreams[i]; - if (!stream->MainThreadNeedsUpdates()) { - continue; + // We don't want to update the main thread about timing update when we are not + // running in realtime. + if (ShouldUpdateMainThread()) { + mStreamUpdates.SetCapacity(mStreamUpdates.Length() + mStreams.Length()); + for (uint32_t i = 0; i < mStreams.Length(); ++i) { + MediaStream* stream = mStreams[i]; + if (!stream->MainThreadNeedsUpdates()) { + continue; + } + StreamUpdate* update = mStreamUpdates.AppendElement(); + update->mGraphUpdateIndex = stream->mGraphUpdateIndices.GetAt(mCurrentTime); + update->mStream = stream; + update->mNextMainThreadCurrentTime = + GraphTimeToStreamTime(stream, mCurrentTime); + update->mNextMainThreadFinished = + stream->mFinished && + StreamTimeToGraphTime(stream, stream->GetBufferEnd()) <= mCurrentTime; + } + if (!mPendingUpdateRunnables.IsEmpty()) { + mUpdateRunnables.MoveElementsFrom(mPendingUpdateRunnables); } - StreamUpdate* update = mStreamUpdates.AppendElement(); - update->mGraphUpdateIndex = stream->mGraphUpdateIndices.GetAt(mCurrentTime); - update->mStream = stream; - update->mNextMainThreadCurrentTime = - GraphTimeToStreamTime(stream, mCurrentTime); - update->mNextMainThreadFinished = - stream->mFinished && - StreamTimeToGraphTime(stream, stream->GetBufferEnd()) <= mCurrentTime; - } - if (!mPendingUpdateRunnables.IsEmpty()) { - mUpdateRunnables.MoveElementsFrom(mPendingUpdateRunnables); } // Don't send the message to the main thread if it's not going to have @@ -2178,7 +2197,7 @@ MediaStreamGraphImpl::MediaStreamGraphImpl(bool aRealtime) } #endif - mCurrentTimeStamp = mInitialTimeStamp = TimeStamp::Now(); + mCurrentTimeStamp = mInitialTimeStamp = mLastMainThreadUpdate = TimeStamp::Now(); } NS_IMPL_ISUPPORTS1(MediaStreamGraphShutdownObserver, nsIObserver) diff --git a/content/media/MediaStreamGraphImpl.h b/content/media/MediaStreamGraphImpl.h index 4a1f4c8ed475..dcc9ba719aa9 100644 --- a/content/media/MediaStreamGraphImpl.h +++ b/content/media/MediaStreamGraphImpl.h @@ -190,6 +190,12 @@ public: * mMonitor must be held. */ void PrepareUpdatesToMainThreadState(bool aFinalUpdate); + /** + * If we are rendering in non-realtime mode, we don't want to send messages to + * the main thread at each iteration for performance reasons. We instead + * notify the main thread at the same rate + */ + bool ShouldUpdateMainThread(); // The following methods are the various stages of RunThread processing. /** * Compute a new current time for the graph and advance all on-graph-thread @@ -394,6 +400,10 @@ public: * The real timestamp of the latest run of UpdateCurrentTime. */ TimeStamp mCurrentTimeStamp; + /** + * Date of the last time we updated the main thread with the graph state. + */ + TimeStamp mLastMainThreadUpdate; /** * Which update batch we are currently processing. */ From 857acbc9aa6e8a7f092f3b97ff2c467619680bc2 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 19 Jul 2013 16:40:57 +0200 Subject: [PATCH 56/92] Bug 882543 - Register the MSG thread for in the profiler. r=benwa --- content/media/MediaStreamGraph.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index eed493eedc15..994c245e35b9 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -23,6 +23,7 @@ #include "AudioNodeStream.h" #include #include "DOMMediaStream.h" +#include "GeckoProfiler.h" using namespace mozilla::layers; using namespace mozilla::dom; @@ -1201,6 +1202,7 @@ MediaStreamGraphImpl::RunThread() if (!mRealtime) { mNonRealtimeIsRunning = false; } + profiler_unregister_thread(); } void @@ -1246,6 +1248,23 @@ MediaStreamGraphImpl::ForceShutDown() namespace { +class MediaStreamGraphInitThreadRunnable : public nsRunnable { +public: + explicit MediaStreamGraphInitThreadRunnable(MediaStreamGraphImpl* aGraph) + : mGraph(aGraph) + { + } + NS_IMETHOD Run() + { + char aLocal; + profiler_register_thread("MediaStreamGraph", &aLocal); + mGraph->RunThread(); + return NS_OK; + } +private: + MediaStreamGraphImpl* mGraph; +}; + class MediaStreamGraphThreadRunnable : public nsRunnable { public: explicit MediaStreamGraphThreadRunnable(MediaStreamGraphImpl* aGraph) @@ -1385,7 +1404,7 @@ MediaStreamGraphImpl::RunInStableState() // Start the thread now. We couldn't start it earlier because // the graph might exit immediately on finding it has no streams. The // first message for a new graph must create a stream. - nsCOMPtr event = new MediaStreamGraphThreadRunnable(this); + nsCOMPtr event = new MediaStreamGraphInitThreadRunnable(this); NS_NewNamedThread("MediaStreamGrph", getter_AddRefs(mThread), event); } From c4b7a6598aa87a0ec11e68fc62b11d441a4cb6f1 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Fri, 19 Jul 2013 16:40:58 +0200 Subject: [PATCH 57/92] Bug 882543 - Use a linked list for ordering stream instead of an array. r=ehsan --- content/media/MediaStreamGraph.cpp | 19 +++++++++++-------- content/media/MediaStreamGraph.h | 3 ++- content/media/MediaStreamGraphImpl.h | 5 ++++- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index 994c245e35b9..482f314e0cef 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -4,6 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "MediaStreamGraphImpl.h" +#include "mozilla/LinkedList.h" #include "AudioSegment.h" #include "VideoSegment.h" @@ -465,22 +466,24 @@ MediaStreamGraphImpl::MarkConsumed(MediaStream* aStream) } void -MediaStreamGraphImpl::UpdateStreamOrderForStream(nsTArray* aStack, +MediaStreamGraphImpl::UpdateStreamOrderForStream(mozilla::LinkedList* aStack, already_AddRefed aStream) { nsRefPtr stream = aStream; NS_ASSERTION(!stream->mHasBeenOrdered, "stream should not have already been ordered"); if (stream->mIsOnOrderingStack) { - for (int32_t i = aStack->Length() - 1; ; --i) { - aStack->ElementAt(i)->AsProcessedStream()->mInCycle = true; - if (aStack->ElementAt(i) == stream) - break; + MediaStream* iter = aStack->getLast(); + if (iter) { + do { + iter->AsProcessedStream()->mInCycle = true; + iter = iter->getPrevious(); + } while (iter && iter != stream); } return; } ProcessedMediaStream* ps = stream->AsProcessedStream(); if (ps) { - aStack->AppendElement(stream); + aStack->insertBack(stream); stream->mIsOnOrderingStack = true; for (uint32_t i = 0; i < ps->mInputs.Length(); ++i) { MediaStream* source = ps->mInputs[i]->mSource; @@ -489,7 +492,7 @@ MediaStreamGraphImpl::UpdateStreamOrderForStream(nsTArray* aStack, UpdateStreamOrderForStream(aStack, s.forget()); } } - aStack->RemoveElementAt(aStack->Length() - 1); + aStack->popLast(); stream->mIsOnOrderingStack = false; } @@ -514,7 +517,7 @@ MediaStreamGraphImpl::UpdateStreamOrder() } } - nsAutoTArray stack; + mozilla::LinkedList stack; for (uint32_t i = 0; i < mOldStreams.Length(); ++i) { nsRefPtr& s = mOldStreams[i]; if (!s->mAudioOutputs.IsEmpty() || !s->mVideoOutputs.IsEmpty()) { diff --git a/content/media/MediaStreamGraph.h b/content/media/MediaStreamGraph.h index 9cf5df5459b5..2465e6737805 100644 --- a/content/media/MediaStreamGraph.h +++ b/content/media/MediaStreamGraph.h @@ -7,6 +7,7 @@ #define MOZILLA_MEDIASTREAMGRAPH_H_ #include "mozilla/Mutex.h" +#include "mozilla/LinkedList.h" #include "AudioStream.h" #include "nsTArray.h" #include "nsIRunnable.h" @@ -257,7 +258,7 @@ struct AudioChunk; * for those objects in arbitrary order and the MediaStreamGraph has to be able * to handle this. */ -class MediaStream { +class MediaStream : public mozilla::LinkedListElement { public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaStream) diff --git a/content/media/MediaStreamGraphImpl.h b/content/media/MediaStreamGraphImpl.h index dcc9ba719aa9..695fb5f1239e 100644 --- a/content/media/MediaStreamGraphImpl.h +++ b/content/media/MediaStreamGraphImpl.h @@ -15,6 +15,9 @@ namespace mozilla { +template +class LinkedList; + #ifdef PR_LOGGING extern PRLogModuleInfo* gMediaStreamGraphLog; #define LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg) @@ -221,7 +224,7 @@ public: * If aStream hasn't already been ordered, push it onto aStack and order * its children. */ - void UpdateStreamOrderForStream(nsTArray* aStack, + void UpdateStreamOrderForStream(mozilla::LinkedList* aStack, already_AddRefed aStream); /** * Mark aStream and all its inputs (recursively) as consumed. From 2e4ee127e61ce86f4e6d618ecaaf6690a0afad8c Mon Sep 17 00:00:00 2001 From: Reuben Morais Date: Thu, 25 Jul 2013 17:43:47 -0700 Subject: [PATCH 58/92] Bug 895994 - Add a missing .bind(this) to ContactDB's upgrade code. r=gwagner --- dom/contacts/fallback/ContactDB.jsm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/contacts/fallback/ContactDB.jsm b/dom/contacts/fallback/ContactDB.jsm index 31d4a632e188..f243b74e3f8d 100644 --- a/dom/contacts/fallback/ContactDB.jsm +++ b/dom/contacts/fallback/ContactDB.jsm @@ -106,7 +106,7 @@ ContactDB.prototype = { _dispatcher: {}, upgradeSchema: function upgradeSchema(aTransaction, aDb, aOldVersion, aNewVersion) { - function loadInitialContacts() { + let loadInitialContacts = function() { // Add default contacts let jsm = {}; Cu.import("resource://gre/modules/FileUtils.jsm", jsm); @@ -155,7 +155,7 @@ ContactDB.prototype = { if (DEBUG) debug("import: " + JSON.stringify(contact)); objectStore.put(contact); } - } + }.bind(this); if (DEBUG) debug("upgrade schema from: " + aOldVersion + " to " + aNewVersion + " called!"); let db = aDb; From 87a9de249e625b54d262a3c4d80834094e175c85 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Thu, 25 Jul 2013 22:30:27 -0700 Subject: [PATCH 59/92] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/15b9a5231e9e Author: John Hu Desc: Merge pull request #11161 from huchengtw-moz/media/Bug_891797-2 Bug 891797 - [OTA][Data Migration][MediaDB] Data of Gallery, Video, and ...r=djf ======== https://hg.mozilla.org/integration/gaia-central/rev/17e4246eac8d Author: John Hu Desc: Bug 891797 - [OTA][Data Migration][MediaDB] Data of Gallery, Video, and Music app is different than original after update from v1.0.1 to v1.1.0. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index c6192876aff6..71956f01af2a 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "72f1b7c657c65389c843dcd032e5bb787f4afafc", + "revision": "15b9a5231e9e1d128f1fa1f520123f9380b5b1f1", "repo_path": "/integration/gaia-central" } From 08238c97294e0aba215aa0f8d4b9e864944653dc Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Fri, 26 Jul 2013 02:10:25 -0700 Subject: [PATCH 60/92] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/4d96cb10a7e4 Author: George Desc: Merge pull request #11180 from cctuan/master-898290 Bug 898290 - [Gallery] HD gradient image rename ======== https://hg.mozilla.org/integration/gaia-central/rev/c9dbe04b6115 Author: cctuan Desc: Bug 898290 - [Gallery] HD gradient image rename --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 71956f01af2a..aa20cd2dae11 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "15b9a5231e9e1d128f1fa1f520123f9380b5b1f1", + "revision": "4d96cb10a7e4a8595b62c49904d633e4a1f88ba6", "repo_path": "/integration/gaia-central" } From a41bcac4eb207c6ca58ad9cb46c01235f1e09303 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Fri, 26 Jul 2013 03:05:23 -0700 Subject: [PATCH 61/92] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/2bcf223e3a7f Author: Alive.Kuo Desc: Merge pull request #11164 from alivedise/bugzilla/897874/notification-disappearing Bug 897874: Delay the notification transition before event handler, r=timdream, a=leo+ ======== https://hg.mozilla.org/integration/gaia-central/rev/e4e69274fdb1 Author: Alive Kuo Desc: Bug 897874: Delay the notification transition before event handler --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index aa20cd2dae11..37faa08815ee 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "4d96cb10a7e4a8595b62c49904d633e4a1f88ba6", + "revision": "2bcf223e3a7fdb14a956ac450a1e347b2c48d8e1", "repo_path": "/integration/gaia-central" } From 7aeae4c5b3c018f1955d487bf6c21d88b5efc70b Mon Sep 17 00:00:00 2001 From: Vicamo Yang Date: Fri, 26 Jul 2013 18:40:27 +0800 Subject: [PATCH 62/92] Bug 891235: remove mozSms. rs=mounir --- dom/base/Navigator.cpp | 28 - dom/base/Navigator.h | 5 - dom/base/nsDOMClassInfo.cpp | 8 - dom/base/nsDOMClassInfoClasses.h | 1 - dom/bindings/Bindings.conf | 1 - dom/mobilemessage/interfaces/moz.build | 1 - .../interfaces/nsIDOMSmsManager.idl | 44 -- .../src/MobileMessageCursorCallback.h | 2 - dom/mobilemessage/src/SmsManager.cpp | 502 ------------------ dom/mobilemessage/src/SmsManager.h | 58 -- dom/mobilemessage/src/moz.build | 2 - .../marionette/test_between_emulators.py | 6 +- .../tests/marionette/test_bug814761.js | 12 +- .../marionette/test_emulator_loopback.js | 9 +- .../tests/marionette/test_filter_date.js | 25 +- .../marionette/test_filter_date_notfound.js | 23 +- .../tests/marionette/test_filter_mixed.js | 17 +- .../marionette/test_filter_number_multiple.js | 35 +- .../marionette/test_filter_number_single.js | 25 +- .../tests/marionette/test_filter_read.js | 31 +- .../tests/marionette/test_filter_received.js | 35 +- .../tests/marionette/test_filter_sent.js | 35 +- .../tests/marionette/test_filter_unread.js | 31 +- .../tests/marionette/test_getmessage.js | 35 +- .../marionette/test_getmessage_notfound.js | 19 +- .../tests/marionette/test_getmessages.js | 25 +- .../marionette/test_getsegmentinfofortext.js | 9 +- .../tests/marionette/test_getthreads.js | 21 +- .../tests/marionette/test_incoming.js | 7 +- .../tests/marionette/test_incoming_delete.js | 21 +- .../marionette/test_incoming_max_segments.js | 19 +- .../marionette/test_incoming_multipart.js | 19 +- .../tests/marionette/test_invalid_address.js | 19 +- .../tests/marionette/test_mark_msg_read.js | 31 +- .../marionette/test_mark_msg_read_error.js | 17 +- .../test_massive_incoming_delete.js | 21 +- .../tests/marionette/test_message_classes.js | 19 +- .../marionette/test_mmsmessage_attachments.js | 17 +- .../tests/marionette/test_outgoing.js | 21 +- .../tests/marionette/test_outgoing_delete.js | 27 +- .../marionette/test_outgoing_max_segments.js | 25 +- .../test_phone_number_normalization.js | 15 +- .../tests/marionette/test_segment_info.js | 7 +- .../marionette/test_strict_7bit_encoding.js | 9 +- .../test_update_thread_record_in_delete.js | 19 +- dom/mobilemessage/tests/test_sms_basics.html | 14 +- dom/permission/tests/test_sms.html | 4 +- .../mochitest/general/test_interfaces.html | 1 - dom/webidl/Navigator.webidl | 7 - 49 files changed, 381 insertions(+), 1003 deletions(-) delete mode 100644 dom/mobilemessage/interfaces/nsIDOMSmsManager.idl delete mode 100644 dom/mobilemessage/src/SmsManager.cpp delete mode 100644 dom/mobilemessage/src/SmsManager.h diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index a7e55f149ca0..64ac55d6170d 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -30,7 +30,6 @@ #include "PowerManager.h" #include "nsIDOMWakeLock.h" #include "nsIPowerManagerService.h" -#include "mozilla/dom/SmsManager.h" #include "mozilla/dom/MobileMessageManager.h" #include "nsISmsService.h" #include "mozilla/Hal.h" @@ -141,7 +140,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotification) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPowerManager) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSmsManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMobileMessageManager) #ifdef MOZ_B2G_RIL NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTelephony) @@ -204,11 +202,6 @@ Navigator::Invalidate() mPowerManager = nullptr; } - if (mSmsManager) { - mSmsManager->Shutdown(); - mSmsManager = nullptr; - } - if (mMobileMessageManager) { mMobileMessageManager->Shutdown(); mMobileMessageManager = nullptr; @@ -1114,19 +1107,6 @@ Navigator::RequestWakeLock(const nsAString &aTopic, ErrorResult& aRv) return wakelock.forget(); } -nsIDOMMozSmsManager* -Navigator::GetMozSms() -{ - if (!mSmsManager) { - NS_ENSURE_TRUE(mWindow, nullptr); - NS_ENSURE_TRUE(mWindow->GetDocShell(), nullptr); - - mSmsManager = SmsManager::CreateInstance(mWindow); - } - - return mSmsManager; -} - nsIDOMMozMobileMessageManager* Navigator::GetMozMobileMessage() { @@ -1615,14 +1595,6 @@ Navigator::HasWakeLockSupport(JSContext* /* unused*/, JSObject* /*unused */) return !!pmService; } -/* static */ -bool -Navigator::HasSmsSupport(JSContext* /* unused */, JSObject* aGlobal) -{ - nsCOMPtr win = GetWindowFromGlobal(aGlobal); - return win && SmsManager::CreationIsAllowed(win); -} - /* static */ bool Navigator::HasMobileMessageSupport(JSContext* /* unused */, JSObject* aGlobal) diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index 0612194d30cd..0a305262436f 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -9,7 +9,6 @@ #include "mozilla/MemoryReporting.h" #include "nsIDOMNavigator.h" -#include "nsIDOMSmsManager.h" #include "nsIDOMMobileMessageManager.h" #include "nsIMozNavigatorNetwork.h" #include "nsAutoPtr.h" @@ -63,7 +62,6 @@ class BatteryManager; } // namespace battery class DesktopNotificationCenter; -class SmsManager; class MobileMessageManager; class MozIdleObserver; #ifdef MOZ_GAMEPAD @@ -208,7 +206,6 @@ public: DesktopNotificationCenter* GetMozNotification(ErrorResult& aRv); bool MozIsLocallyAvailable(const nsAString& aURI, bool aWhenOffline, ErrorResult& aRv); - nsIDOMMozSmsManager* GetMozSms(); nsIDOMMozMobileMessageManager* GetMozMobileMessage(); nsIDOMMozConnection* GetMozConnection(); nsDOMCameraManager* GetMozCameras(ErrorResult& aRv); @@ -257,7 +254,6 @@ public: { return HasDesktopNotificationSupport(); } - static bool HasSmsSupport(JSContext* /* unused */, JSObject* aGlobal); static bool HasMobileMessageSupport(JSContext* /* unused */, JSObject* aGlobal); static bool HasCameraSupport(JSContext* /* unused */, @@ -306,7 +302,6 @@ private: nsRefPtr mNotification; nsRefPtr mBatteryManager; nsRefPtr mPowerManager; - nsRefPtr mSmsManager; nsRefPtr mMobileMessageManager; #ifdef MOZ_B2G_RIL nsCOMPtr mTelephony; diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index b9ca18c0614c..7b5600524216 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -218,7 +218,6 @@ using mozilla::dom::workers::ResolveWorkerClasses; #include "BatteryManager.h" #include "nsIDOMPowerManager.h" #include "nsIDOMWakeLock.h" -#include "nsIDOMSmsManager.h" #include "nsIDOMMobileMessageManager.h" #include "nsIDOMMozSmsMessage.h" #include "nsIDOMMozMmsMessage.h" @@ -577,9 +576,6 @@ static nsDOMClassInfoData sClassInfoData[] = { NS_DEFINE_CLASSINFO_DATA(MozWakeLock, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(MozSmsManager, nsDOMGenericSH, - DOM_DEFAULT_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(MozMobileMessageManager, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) @@ -1441,10 +1437,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozWakeLock) DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(MozSmsManager, nsIDOMMozSmsManager) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSmsManager) - DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(MozMobileMessageManager, nsIDOMMozMobileMessageManager) DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozMobileMessageManager) DOM_CLASSINFO_MAP_END diff --git a/dom/base/nsDOMClassInfoClasses.h b/dom/base/nsDOMClassInfoClasses.h index d56eb1ad74ad..6828d1ad8d3f 100644 --- a/dom/base/nsDOMClassInfoClasses.h +++ b/dom/base/nsDOMClassInfoClasses.h @@ -95,7 +95,6 @@ DOMCI_CLASS(ModalContentWindow) DOMCI_CLASS(MozPowerManager) DOMCI_CLASS(MozWakeLock) -DOMCI_CLASS(MozSmsManager) DOMCI_CLASS(MozMobileMessageManager) DOMCI_CLASS(MozSmsMessage) DOMCI_CLASS(MozMmsMessage) diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index a0b5681221f5..080834488b41 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -1743,7 +1743,6 @@ addExternalIface('MozPowerManager', headerFile='nsIDOMPowerManager.h') addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource', notflattened=True) addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True) -addExternalIface('MozSmsManager', headerFile='nsIDOMSmsManager.h') addExternalIface('MozTelephony', nativeType='nsIDOMTelephony') addExternalIface('MozTreeBoxObject', nativeType='nsITreeBoxObject', notflattened=True) diff --git a/dom/mobilemessage/interfaces/moz.build b/dom/mobilemessage/interfaces/moz.build index 77ac6c64fb54..2e7e55c3829d 100644 --- a/dom/mobilemessage/interfaces/moz.build +++ b/dom/mobilemessage/interfaces/moz.build @@ -12,7 +12,6 @@ XPIDL_SOURCES += [ 'nsIDOMMozSmsEvent.idl', 'nsIDOMMozSmsMessage.idl', 'nsIDOMSmsFilter.idl', - 'nsIDOMSmsManager.idl', 'nsIDOMSmsSegmentInfo.idl', 'nsIMmsService.idl', 'nsIMobileMessageCallback.idl', diff --git a/dom/mobilemessage/interfaces/nsIDOMSmsManager.idl b/dom/mobilemessage/interfaces/nsIDOMSmsManager.idl deleted file mode 100644 index 31307b2f7aed..000000000000 --- a/dom/mobilemessage/interfaces/nsIDOMSmsManager.idl +++ /dev/null @@ -1,44 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsIDOMEventTarget.idl" - -interface nsIDOMDOMCursor; -interface nsIDOMDOMRequest; -interface nsIDOMEventListener; -interface nsIDOMMozSmsFilter; -interface nsIDOMMozSmsSegmentInfo; - -[scriptable, builtinclass, uuid(8ce00d77-71b4-43f6-92a1-2eae7c9581b9)] -interface nsIDOMMozSmsManager : nsIDOMEventTarget -{ - nsIDOMMozSmsSegmentInfo getSegmentInfoForText(in DOMString text); - - // The first parameter can be either a DOMString (only one number) or an array - // of DOMStrings. - // The method returns a DOMRequest object if one number has been passed. - // An array of DOMRequest objects otherwise. - jsval send(in jsval number, in DOMString message); - - [binaryname(GetMessageMoz)] - nsIDOMDOMRequest getMessage(in long id); - - // The parameter can be either a message id or a SmsMessage. - nsIDOMDOMRequest delete(in jsval param); - - // Iterates through nsIDOMMozSmsMessage. - nsIDOMDOMCursor getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse); - - nsIDOMDOMRequest markMessageRead(in long id, in boolean aValue); - - // Iterates through nsIDOMMozMobileMessageThread. - nsIDOMDOMCursor getThreads(); - - [implicit_jscontext] attribute jsval onreceived; - [implicit_jscontext] attribute jsval onsending; - [implicit_jscontext] attribute jsval onsent; - [implicit_jscontext] attribute jsval onfailed; - [implicit_jscontext] attribute jsval ondeliverysuccess; - [implicit_jscontext] attribute jsval ondeliveryerror; -}; diff --git a/dom/mobilemessage/src/MobileMessageCursorCallback.h b/dom/mobilemessage/src/MobileMessageCursorCallback.h index cfeb43f18efa..460291063a65 100644 --- a/dom/mobilemessage/src/MobileMessageCursorCallback.h +++ b/dom/mobilemessage/src/MobileMessageCursorCallback.h @@ -18,14 +18,12 @@ namespace dom { class DOMCursor; class MobileMessageManager; -class SmsManager; namespace mobilemessage { class MobileMessageCursorCallback : public nsIMobileMessageCursorCallback { friend class mozilla::dom::MobileMessageManager; - friend class mozilla::dom::SmsManager; public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/dom/mobilemessage/src/SmsManager.cpp b/dom/mobilemessage/src/SmsManager.cpp deleted file mode 100644 index 1d73cb700cd2..000000000000 --- a/dom/mobilemessage/src/SmsManager.cpp +++ /dev/null @@ -1,502 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "SmsFilter.h" -#include "SmsManager.h" -#include "nsIDOMClassInfo.h" -#include "nsISmsService.h" -#include "nsIObserverService.h" -#include "mozilla/Preferences.h" -#include "mozilla/Services.h" -#include "Constants.h" -#include "nsIDOMMozSmsEvent.h" -#include "nsIDOMMozSmsMessage.h" -#include "nsJSUtils.h" -#include "nsContentUtils.h" -#include "nsCxPusher.h" -#include "nsIMobileMessageDatabaseService.h" -#include "nsIXPConnect.h" -#include "nsIPermissionManager.h" -#include "GeneratedEvents.h" -#include "MobileMessageCallback.h" -#include "MobileMessageCursorCallback.h" -#include "DOMCursor.h" - -#define RECEIVED_EVENT_NAME NS_LITERAL_STRING("received") -#define SENDING_EVENT_NAME NS_LITERAL_STRING("sending") -#define SENT_EVENT_NAME NS_LITERAL_STRING("sent") -#define FAILED_EVENT_NAME NS_LITERAL_STRING("failed") -#define DELIVERY_SUCCESS_EVENT_NAME NS_LITERAL_STRING("deliverysuccess") -#define DELIVERY_ERROR_EVENT_NAME NS_LITERAL_STRING("deliveryerror") - -using namespace mozilla::dom::mobilemessage; - -DOMCI_DATA(MozSmsManager, mozilla::dom::SmsManager) - -namespace mozilla { -namespace dom { - -NS_INTERFACE_MAP_BEGIN(SmsManager) - NS_INTERFACE_MAP_ENTRY(nsIDOMMozSmsManager) - NS_INTERFACE_MAP_ENTRY(nsIObserver) - NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozSmsManager) -NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper) - -NS_IMPL_ADDREF_INHERITED(SmsManager, nsDOMEventTargetHelper) -NS_IMPL_RELEASE_INHERITED(SmsManager, nsDOMEventTargetHelper) - -NS_IMPL_EVENT_HANDLER(SmsManager, received) -NS_IMPL_EVENT_HANDLER(SmsManager, sending) -NS_IMPL_EVENT_HANDLER(SmsManager, sent) -NS_IMPL_EVENT_HANDLER(SmsManager, failed) -NS_IMPL_EVENT_HANDLER(SmsManager, deliverysuccess) -NS_IMPL_EVENT_HANDLER(SmsManager, deliveryerror) - -/* static */ -bool -SmsManager::CreationIsAllowed(nsPIDOMWindow* aWindow) -{ - NS_ASSERTION(aWindow, "Null pointer!"); - -#ifndef MOZ_WEBSMS_BACKEND - return false; -#endif - - // First of all, the general pref has to be turned on. - bool enabled = false; - Preferences::GetBool("dom.sms.enabled", &enabled); - NS_ENSURE_TRUE(enabled, false); - - nsCOMPtr permMgr = - do_GetService(NS_PERMISSIONMANAGER_CONTRACTID); - NS_ENSURE_TRUE(permMgr, false); - - uint32_t permission = nsIPermissionManager::DENY_ACTION; - permMgr->TestPermissionFromWindow(aWindow, "sms", &permission); - - if (permission != nsIPermissionManager::ALLOW_ACTION) { - return false; - } - - // Check the Sms Service: - nsCOMPtr smsService = do_GetService(SMS_SERVICE_CONTRACTID); - NS_ENSURE_TRUE(smsService, false); - - bool result = false; - smsService->HasSupport(&result); - if (!result) { - return false; - } - - return true; -} - -// static -already_AddRefed -SmsManager::CreateInstance(nsPIDOMWindow* aWindow) -{ - nsRefPtr smsMgr = new SmsManager(); - smsMgr->Init(aWindow); - - return smsMgr.forget(); -} - -void -SmsManager::Init(nsPIDOMWindow *aWindow) -{ - BindToOwner(aWindow); - - nsCOMPtr obs = services::GetObserverService(); - // GetObserverService() can return null is some situations like shutdown. - if (!obs) { - return; - } - - obs->AddObserver(this, kSmsReceivedObserverTopic, false); - obs->AddObserver(this, kSmsSendingObserverTopic, false); - obs->AddObserver(this, kSmsSentObserverTopic, false); - obs->AddObserver(this, kSmsFailedObserverTopic, false); - obs->AddObserver(this, kSmsDeliverySuccessObserverTopic, false); - obs->AddObserver(this, kSmsDeliveryErrorObserverTopic, false); -} - -void -SmsManager::Shutdown() -{ - nsCOMPtr obs = services::GetObserverService(); - // GetObserverService() can return null is some situations like shutdown. - if (!obs) { - return; - } - - obs->RemoveObserver(this, kSmsReceivedObserverTopic); - obs->RemoveObserver(this, kSmsSendingObserverTopic); - obs->RemoveObserver(this, kSmsSentObserverTopic); - obs->RemoveObserver(this, kSmsFailedObserverTopic); - obs->RemoveObserver(this, kSmsDeliverySuccessObserverTopic); - obs->RemoveObserver(this, kSmsDeliveryErrorObserverTopic); -} - -NS_IMETHODIMP -SmsManager::GetSegmentInfoForText(const nsAString& aText, - nsIDOMMozSmsSegmentInfo** aResult) -{ - nsCOMPtr smsService = do_GetService(SMS_SERVICE_CONTRACTID); - NS_ENSURE_TRUE(smsService, NS_ERROR_FAILURE); - - return smsService->GetSegmentInfoForText(aText, aResult); -} - -nsresult -SmsManager::Send(JSContext* aCx, JS::Handle aGlobal, JS::Handle aNumber, - const nsAString& aMessage, JS::Value* aRequest) -{ - nsCOMPtr smsService = do_GetService(SMS_SERVICE_CONTRACTID); - NS_ENSURE_TRUE(smsService, NS_ERROR_FAILURE); - - nsDependentJSString number; - number.init(aCx, aNumber); - - nsRefPtr request = new DOMRequest(GetOwner()); - nsCOMPtr msgCallback = - new MobileMessageCallback(request); - - nsresult rv = smsService->Send(number, aMessage, msgCallback); - NS_ENSURE_SUCCESS(rv, rv); - - JS::Rooted global(aCx, aGlobal); - rv = nsContentUtils::WrapNative(aCx, global, - static_cast(request.get()), - aRequest); - if (NS_FAILED(rv)) { - NS_ERROR("Failed to create the js value!"); - return rv; - } - - return NS_OK; -} - -NS_IMETHODIMP -SmsManager::Send(const JS::Value& aNumber, const nsAString& aMessage, JS::Value* aReturn) -{ - nsresult rv; - nsIScriptContext* sc = GetContextForEventHandlers(&rv); - NS_ENSURE_STATE(sc); - AutoPushJSContext cx(sc->GetNativeContext()); - NS_ASSERTION(cx, "Failed to get a context!"); - - if (!aNumber.isString() && - !(aNumber.isObject() && JS_IsArrayObject(cx, &aNumber.toObject()))) { - return NS_ERROR_INVALID_ARG; - } - - JS::Rooted global(cx, sc->GetNativeGlobal()); - NS_ASSERTION(global, "Failed to get global object!"); - - JSAutoCompartment ac(cx, global); - - if (aNumber.isString()) { - JS::Rooted number(cx, aNumber.toString()); - return Send(cx, global, number, aMessage, aReturn); - } - - // Must be an object then. - if (!aNumber.isObject()) { - return NS_ERROR_FAILURE; - } - - JS::Rooted numbers(cx, &aNumber.toObject()); - uint32_t size; - if (!JS_GetArrayLength(cx, numbers, &size)) { - return NS_ERROR_FAILURE; - } - - JS::AutoValueVector requests(cx); - if (!requests.resize(size)) { - return NS_ERROR_FAILURE; - } - - JS::RootedString str(cx); - for (uint32_t i = 0; i < size; ++i) { - JS::Rooted number(cx); - if (!JS_GetElement(cx, numbers, i, number.address())) { - return NS_ERROR_INVALID_ARG; - } - - str = JS_ValueToString(cx, number); - if (!str) { - return NS_ERROR_FAILURE; - } - - nsresult rv = Send(cx, global, str, aMessage, &requests[i]); - NS_ENSURE_SUCCESS(rv, rv); - } - - JSObject* obj = JS_NewArrayObject(cx, requests.length(), requests.begin()); - if (!obj) { - return NS_ERROR_FAILURE; - } - - aReturn->setObject(*obj); - return NS_OK; -} - -NS_IMETHODIMP -SmsManager::GetMessageMoz(int32_t aId, nsIDOMDOMRequest** aRequest) -{ - nsCOMPtr dbService = - do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID); - NS_ENSURE_TRUE(dbService, NS_ERROR_FAILURE); - - nsRefPtr request = new DOMRequest(GetOwner()); - nsCOMPtr msgCallback = - new MobileMessageCallback(request); - - nsresult rv = dbService->GetMessageMoz(aId, msgCallback); - NS_ENSURE_SUCCESS(rv, rv); - - request.forget(aRequest); - return NS_OK; -} - -nsresult -SmsManager::GetSmsMessageId(AutoPushJSContext &aCx, - const JS::Value &aSmsMessage, int32_t &aId) -{ - nsCOMPtr message = - do_QueryInterface(nsContentUtils::XPConnect()->GetNativeOfWrapper(aCx, &aSmsMessage.toObject())); - NS_ENSURE_TRUE(message, NS_ERROR_INVALID_ARG); - - return message->GetId(&aId); -} - -NS_IMETHODIMP -SmsManager::Delete(const JS::Value& aParam, nsIDOMDOMRequest** aRequest) -{ - // We expect Int32, SmsMessage, Int32[], SmsMessage[] - if (!aParam.isObject() && !aParam.isInt32()) { - return NS_ERROR_INVALID_ARG; - } - - nsresult rv; - nsIScriptContext* sc = GetContextForEventHandlers(&rv); - AutoPushJSContext cx(sc->GetNativeContext()); - NS_ENSURE_STATE(sc); - - int32_t id, *idArray; - uint32_t size; - - if (aParam.isInt32()) { - // Single Integer Message ID - id = aParam.toInt32(); - - size = 1; - idArray = &id; - } else if (!JS_IsArrayObject(cx, &aParam.toObject())) { - // Single SmsMessage object - rv = GetSmsMessageId(cx, aParam, id); - NS_ENSURE_SUCCESS(rv, rv); - - size = 1; - idArray = &id; - } else { - // Int32[] or SmsMessage[] - JS::Rooted ids(cx, &aParam.toObject()); - - JS_ALWAYS_TRUE(JS_GetArrayLength(cx, ids, &size)); - nsAutoArrayPtr idAutoArray(new int32_t[size]); - - JS::Rooted idJsValue(cx); - for (uint32_t i = 0; i < size; i++) { - if (!JS_GetElement(cx, ids, i, idJsValue.address())) { - return NS_ERROR_INVALID_ARG; - } - - if (idJsValue.get().isInt32()) { - idAutoArray[i] = idJsValue.get().toInt32(); - } else if (idJsValue.get().isObject()) { - rv = GetSmsMessageId(cx, idJsValue, id); - NS_ENSURE_SUCCESS(rv, rv); - - idAutoArray[i] = id; - } - } - - idArray = idAutoArray.forget(); - } - - nsCOMPtr dbService = - do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID); - NS_ENSURE_TRUE(dbService, NS_ERROR_FAILURE); - - nsRefPtr request = new DOMRequest(GetOwner()); - nsCOMPtr msgCallback = - new MobileMessageCallback(request); - - rv = dbService->DeleteMessage(idArray, size, msgCallback); - NS_ENSURE_SUCCESS(rv, rv); - - request.forget(aRequest); - return NS_OK; -} - -NS_IMETHODIMP -SmsManager::GetMessages(nsIDOMMozSmsFilter* aFilter, - bool aReverse, - nsIDOMDOMCursor** aCursor) -{ - nsCOMPtr dbService = - do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID); - NS_ENSURE_TRUE(dbService, NS_ERROR_FAILURE); - - nsCOMPtr filter = aFilter; - if (!filter) { - filter = new SmsFilter(); - } - - nsRefPtr cursorCallback = - new MobileMessageCursorCallback(); - - nsCOMPtr continueCallback; - nsresult rv = dbService->CreateMessageCursor(filter, aReverse, cursorCallback, - getter_AddRefs(continueCallback)); - NS_ENSURE_SUCCESS(rv, rv); - - cursorCallback->mDOMCursor = new DOMCursor(GetOwner(), continueCallback); - NS_ADDREF(*aCursor = cursorCallback->mDOMCursor); - - return NS_OK; -} - -NS_IMETHODIMP -SmsManager::MarkMessageRead(int32_t aId, bool aValue, - nsIDOMDOMRequest** aRequest) -{ - nsCOMPtr dbService = - do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID); - NS_ENSURE_TRUE(dbService, NS_ERROR_FAILURE); - - nsRefPtr request = new DOMRequest(GetOwner()); - nsCOMPtr msgCallback = - new MobileMessageCallback(request); - - nsresult rv = dbService->MarkMessageRead(aId, aValue, msgCallback); - NS_ENSURE_SUCCESS(rv, rv); - - request.forget(aRequest); - return NS_OK; -} - -NS_IMETHODIMP -SmsManager::GetThreads(nsIDOMDOMCursor** aCursor) -{ - nsCOMPtr dbService = - do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID); - NS_ENSURE_TRUE(dbService, NS_ERROR_FAILURE); - - nsRefPtr cursorCallback = - new MobileMessageCursorCallback(); - - nsCOMPtr continueCallback; - nsresult rv = dbService->CreateThreadCursor(cursorCallback, - getter_AddRefs(continueCallback)); - NS_ENSURE_SUCCESS(rv, rv); - - cursorCallback->mDOMCursor = new DOMCursor(GetOwner(), continueCallback); - NS_ADDREF(*aCursor = cursorCallback->mDOMCursor); - - return NS_OK; -} - -nsresult -SmsManager::DispatchTrustedSmsEventToSelf(const nsAString& aEventName, nsIDOMMozSmsMessage* aMessage) -{ - nsCOMPtr event; - NS_NewDOMMozSmsEvent(getter_AddRefs(event), this, nullptr, nullptr); - NS_ASSERTION(event, "This should never fail!"); - - nsCOMPtr se = do_QueryInterface(event); - MOZ_ASSERT(se); - nsresult rv = se->InitMozSmsEvent(aEventName, false, false, aMessage); - NS_ENSURE_SUCCESS(rv, rv); - - return DispatchTrustedEvent(event); -} - -NS_IMETHODIMP -SmsManager::Observe(nsISupports* aSubject, const char* aTopic, - const PRUnichar* aData) -{ - if (!strcmp(aTopic, kSmsReceivedObserverTopic)) { - nsCOMPtr message = do_QueryInterface(aSubject); - if (!message) { - NS_ERROR("Got a 'sms-received' topic without a valid message!"); - return NS_OK; - } - - DispatchTrustedSmsEventToSelf(RECEIVED_EVENT_NAME, message); - return NS_OK; - } - - if (!strcmp(aTopic, kSmsSendingObserverTopic)) { - nsCOMPtr message = do_QueryInterface(aSubject); - if (!message) { - NS_ERROR("Got a 'sms-sending' topic without a valid message!"); - return NS_OK; - } - - DispatchTrustedSmsEventToSelf(SENDING_EVENT_NAME, message); - return NS_OK; - } - - if (!strcmp(aTopic, kSmsSentObserverTopic)) { - nsCOMPtr message = do_QueryInterface(aSubject); - if (!message) { - NS_ERROR("Got a 'sms-sent' topic without a valid message!"); - return NS_OK; - } - - DispatchTrustedSmsEventToSelf(SENT_EVENT_NAME, message); - return NS_OK; - } - - if (!strcmp(aTopic, kSmsFailedObserverTopic)) { - nsCOMPtr message = do_QueryInterface(aSubject); - if (!message) { - NS_ERROR("Got a 'sms-failed' topic without a valid message!"); - return NS_OK; - } - - DispatchTrustedSmsEventToSelf(FAILED_EVENT_NAME, message); - return NS_OK; - } - - if (!strcmp(aTopic, kSmsDeliverySuccessObserverTopic)) { - nsCOMPtr message = do_QueryInterface(aSubject); - if (!message) { - NS_ERROR("Got a 'sms-delivery-success' topic without a valid message!"); - return NS_OK; - } - - DispatchTrustedSmsEventToSelf(DELIVERY_SUCCESS_EVENT_NAME, message); - return NS_OK; - } - - if (!strcmp(aTopic, kSmsDeliveryErrorObserverTopic)) { - nsCOMPtr message = do_QueryInterface(aSubject); - if (!message) { - NS_ERROR("Got a 'sms-delivery-error' topic without a valid message!"); - return NS_OK; - } - - DispatchTrustedSmsEventToSelf(DELIVERY_ERROR_EVENT_NAME, message); - return NS_OK; - } - - return NS_OK; -} - -} // namespace dom -} // namespace mozilla diff --git a/dom/mobilemessage/src/SmsManager.h b/dom/mobilemessage/src/SmsManager.h deleted file mode 100644 index 622092527130..000000000000 --- a/dom/mobilemessage/src/SmsManager.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_dom_mobilemessage_SmsManager_h -#define mozilla_dom_mobilemessage_SmsManager_h - -#include "nsIDOMSmsManager.h" -#include "nsIObserver.h" -#include "nsDOMEventTargetHelper.h" - -class nsIDOMMozSmsMessage; - -namespace mozilla { -namespace dom { - -class SmsManager : public nsDOMEventTargetHelper - , public nsIDOMMozSmsManager - , public nsIObserver -{ -public: - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIOBSERVER - NS_DECL_NSIDOMMOZSMSMANAGER - - NS_REALLY_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper) - - static already_AddRefed - CreateInstance(nsPIDOMWindow *aWindow); - - static bool - CreationIsAllowed(nsPIDOMWindow *aWindow); - - void Init(nsPIDOMWindow *aWindow); - void Shutdown(); - -private: - /** - * Internal Send() method used to send one message. - */ - nsresult Send(JSContext* aCx, JS::Handle aGlobal, JS::Handle aNumber, - const nsAString& aMessage, JS::Value* aRequest); - - nsresult DispatchTrustedSmsEventToSelf(const nsAString& aEventName, - nsIDOMMozSmsMessage* aMessage); - - /** - * Helper to get message ID from SMS Message object - */ - nsresult GetSmsMessageId(AutoPushJSContext &aCx, const JS::Value &aSmsMessage, - int32_t &aId); -}; - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_mobilemessage_SmsManager_h diff --git a/dom/mobilemessage/src/moz.build b/dom/mobilemessage/src/moz.build index 687de5810eb2..222b2f4e3c6f 100644 --- a/dom/mobilemessage/src/moz.build +++ b/dom/mobilemessage/src/moz.build @@ -42,7 +42,6 @@ EXPORTS.mozilla.dom += [ 'MmsMessage.h', 'MobileMessageManager.h', 'SmsFilter.h', - 'SmsManager.h', 'SmsMessage.h', 'SmsSegmentInfo.h', ] @@ -58,7 +57,6 @@ CPP_SOURCES += [ 'SmsChild.cpp', 'SmsFilter.cpp', 'SmsIPCService.cpp', - 'SmsManager.cpp', 'SmsMessage.cpp', 'SmsParent.cpp', 'SmsSegmentInfo.cpp', diff --git a/dom/mobilemessage/tests/marionette/test_between_emulators.py b/dom/mobilemessage/tests/marionette/test_between_emulators.py index f28314057ed9..74197c4687c7 100644 --- a/dom/mobilemessage/tests/marionette/test_between_emulators.py +++ b/dom/mobilemessage/tests/marionette/test_between_emulators.py @@ -17,17 +17,17 @@ class SMSTest(MarionetteTestCase): # Setup the event listsener on the receiver, which should store # a global variable when an SMS is received. message = 'hello world!' - self.assertTrue(receiver.execute_script("return window.navigator.mozSms != null;")) + self.assertTrue(receiver.execute_script("return window.navigator.mozMobileMessage != null;")) receiver.execute_script(""" global.smsreceived = null; -window.navigator.mozSms.addEventListener("received", function(e) { +window.navigator.mozMobileMessage.addEventListener("received", function(e) { global.smsreceived = e.message.body; }); """, new_sandbox=False) # Send the SMS from the sender. sender.execute_script(""" -window.navigator.mozSms.send("%d", "%s"); +window.navigator.mozMobileMessage.send("%d", "%s"); """ % (receiver.emulator.port, message)) # On the receiver, wait up to 10s for an SMS to be received, by diff --git a/dom/mobilemessage/tests/marionette/test_bug814761.js b/dom/mobilemessage/tests/marionette/test_bug814761.js index e46b34762295..9600a9150691 100644 --- a/dom/mobilemessage/tests/marionette/test_bug814761.js +++ b/dom/mobilemessage/tests/marionette/test_bug814761.js @@ -6,12 +6,14 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.setBoolPref("dom.sms.enabled", true); SpecialPowers.addPermission("sms", true, document); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Note: 378 chars and below is fine, but 379 and above will cause the issue. // Sending first message works, but second one we get emulator callback but // the actual SMS is never received, so script will timeout waiting for the -// sms.onreceived event. Also note that a single larger message (i.e. 1600 +// onreceived event. Also note that a single larger message (i.e. 1600 // characters) works; so it is not a compounded send limit. let fromNumber = "5551110000"; let msgLength = 379; @@ -41,9 +43,9 @@ function simulateIncomingSms(nextFunction) { log("Simulating incoming multipart SMS (" + msgText.length + " chars total)."); - sms.onreceived = function onreceived(event) { - log("Received 'onreceived' smsmanager event."); - sms.onreceived = null; + manager.onreceived = function onreceived(event) { + log("Received 'onreceived' event."); + manager.onreceived = null; let incomingSms = event.message; ok(incomingSms, "incoming sms"); diff --git a/dom/mobilemessage/tests/marionette/test_emulator_loopback.js b/dom/mobilemessage/tests/marionette/test_emulator_loopback.js index 08b14261d5ab..15f1e084da02 100644 --- a/dom/mobilemessage/tests/marionette/test_emulator_loopback.js +++ b/dom/mobilemessage/tests/marionette/test_emulator_loopback.js @@ -14,8 +14,9 @@ function cleanUp() { finish(); } -let sms = window.navigator.mozSms; -ok(sms instanceof MozSmsManager); +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); function randomString16() { return Math.random().toString(36).substr(2, 16); @@ -33,7 +34,7 @@ function repeat(func, array, oncomplete) { } function doTest(body, callback) { - sms.addEventListener("received", function onReceived(event) { + manager.addEventListener("received", function onReceived(event) { event.target.removeEventListener(event.type, arguments.callee); let message = event.message; @@ -42,7 +43,7 @@ function doTest(body, callback) { window.setTimeout(callback, 0); }); - let request = sms.send(SELF, body); + let request = manager.send(SELF, body); request.onerror = function onerror() { ok(false, "failed to send message '" + body + "' to '" + SELF + "'"); }; diff --git a/dom/mobilemessage/tests/marionette/test_filter_date.js b/dom/mobilemessage/tests/marionette/test_filter_date.js index 8996d59f4afc..ace1532e66c3 100644 --- a/dom/mobilemessage/tests/marionette/test_filter_date.js +++ b/dom/mobilemessage/tests/marionette/test_filter_date.js @@ -6,13 +6,14 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let numberMsgs = 10; let smsList = new Array(); function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Ensure test is starting clean with no existing sms messages deleteAllMsgs(simulateIncomingSms); } @@ -21,7 +22,7 @@ function deleteAllMsgs(nextFunction) { let msgList = new Array(); let filter = new MozSmsFilter; - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -46,7 +47,7 @@ function deleteAllMsgs(nextFunction) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -56,7 +57,7 @@ function deleteMsgs(msgList, nextFunction) { let smsId = msgList.shift(); log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -72,7 +73,7 @@ function deleteMsgs(msgList, nextFunction) { } } else { log("SMS delete failed."); - ok(false,"sms.delete request returned false"); + ok(false,"manager.delete request returned false"); cleanUp(); } }; @@ -80,7 +81,7 @@ function deleteMsgs(msgList, nextFunction) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -102,7 +103,7 @@ function simulateIncomingSms() { } // Callback for incoming sms -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { log("Received 'onreceived' sms event."); let incomingSms = event.message; log("Received SMS (id: " + incomingSms.id + ")."); @@ -136,7 +137,7 @@ function getMsgs() { log("Getting SMS messages with dates between " + yesterday + " and " + tomorrow +"."); - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -159,7 +160,7 @@ function getMsgs() { } else { log("SMS getMessages returned " + foundSmsList.length + " messages, but expected " + smsList.length + "."); - ok(false, "Incorrect number of messages returned by sms.getMessages"); + ok(false, "Incorrect number of messages returned by manager.getMessages"); deleteAllMsgs(cleanUp); } } @@ -168,7 +169,7 @@ function getMsgs() { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -184,7 +185,7 @@ function verifyFoundMsgs(foundSmsList) { } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_filter_date_notfound.js b/dom/mobilemessage/tests/marionette/test_filter_date_notfound.js index dbc0ed634ef7..f9360d4265ca 100644 --- a/dom/mobilemessage/tests/marionette/test_filter_date_notfound.js +++ b/dom/mobilemessage/tests/marionette/test_filter_date_notfound.js @@ -6,13 +6,14 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let numberMsgs = 10; let smsList = new Array(); function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Ensure test is starting clean with no existing sms messages deleteAllMsgs(simulateIncomingSms); } @@ -21,7 +22,7 @@ function deleteAllMsgs(nextFunction) { let msgList = new Array(); let filter = new MozSmsFilter; - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -46,7 +47,7 @@ function deleteAllMsgs(nextFunction) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -56,7 +57,7 @@ function deleteMsgs(msgList, nextFunction) { let smsId = msgList.shift(); log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -72,7 +73,7 @@ function deleteMsgs(msgList, nextFunction) { } } else { log("SMS delete failed."); - ok(false,"sms.delete request returned false"); + ok(false,"manager.delete request returned false"); cleanUp(); } }; @@ -80,7 +81,7 @@ function deleteMsgs(msgList, nextFunction) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -102,7 +103,7 @@ function simulateIncomingSms() { } // Callback for incoming sms -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { log("Received 'onreceived' sms event."); let incomingSms = event.message; log("Received SMS (id: " + incomingSms.id + ")."); @@ -136,7 +137,7 @@ function getMsgs() { log("Getting SMS messages with dates between " + twoDaysAgo + " and " + yesterday +"."); - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -158,14 +159,14 @@ function getMsgs() { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_filter_mixed.js b/dom/mobilemessage/tests/marionette/test_filter_mixed.js index 1a457d996c12..3bc4c6a65210 100644 --- a/dom/mobilemessage/tests/marionette/test_filter_mixed.js +++ b/dom/mobilemessage/tests/marionette/test_filter_mixed.js @@ -9,8 +9,9 @@ const NUM_THREADS = 10; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; -ok(sms instanceof MozSmsManager); +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); let pendingEmulatorCmdCount = 0; function sendSmsToEmulator(from, text) { @@ -62,7 +63,7 @@ function getAllMessages(callback, filter, reverse) { filter = new MozSmsFilter; } let messages = []; - let request = sms.getMessages(filter, reverse || false); + let request = manager.getMessages(filter, reverse || false); request.onsuccess = function(event) { if (request.result) { messages.push(request.result); @@ -83,7 +84,7 @@ function deleteAllMessages(next) { return; } - let request = sms.delete(message.id); + let request = manager.delete(message.id); request.onsuccess = deleteAll.bind(null, messages); request.onerror = function (event) { ok(false, "failed to delete all messages"); @@ -124,9 +125,9 @@ tasks.push(function populateMessages() { let count = 0; function sendMessage(iter) { - let request = sms.send("+1555531555" + iter, "Nice to meet you"); + let request = manager.send("+1555531555" + iter, "Nice to meet you"); request.onsuccess = function onRequestSuccess(event) { - sms.addEventListener("received", onReceived); + manager.addEventListener("received", onReceived); threadIds.push(request.result.threadId); @@ -138,7 +139,7 @@ tasks.push(function populateMessages() { } function onReceived(event) { - sms.removeEventListener("received", onReceived); + manager.removeEventListener("received", onReceived); if (event.message.threadId != threadIds[threadIds.length - 1]) { ok(false, "Thread IDs of sent and received message mismatch."); @@ -148,7 +149,7 @@ tasks.push(function populateMessages() { ++count; if (count % 2) { - let request = sms.markMessageRead(event.message.id, true); + let request = manager.markMessageRead(event.message.id, true); request.onsuccess = function onRequestSuccess(event) { if (count < NUM_THREADS) { sendMessage(count); diff --git a/dom/mobilemessage/tests/marionette/test_filter_number_multiple.js b/dom/mobilemessage/tests/marionette/test_filter_number_multiple.js index dde66cea756d..60dd9ef117d7 100644 --- a/dom/mobilemessage/tests/marionette/test_filter_number_multiple.js +++ b/dom/mobilemessage/tests/marionette/test_filter_number_multiple.js @@ -6,14 +6,15 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let numberMsgs = 10; let smsList = new Array(); let defaultRemoteNumber = "+15552227777"; function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Ensure test is starting clean with no existing sms messages deleteAllMsgs(sendSms); } @@ -23,7 +24,7 @@ function deleteAllMsgs(nextFunction) { let msgList = new Array(); let filter = new MozSmsFilter; - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -48,7 +49,7 @@ function deleteAllMsgs(nextFunction) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -59,7 +60,7 @@ function deleteMsgs(msgList, nextFunction) { let smsId = msgList.shift(); log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -75,7 +76,7 @@ function deleteMsgs(msgList, nextFunction) { } } else { log("SMS delete failed."); - ok(false,"sms.delete request returned false"); + ok(false,"manager.delete request returned false"); cleanUp(); } }; @@ -83,7 +84,7 @@ function deleteMsgs(msgList, nextFunction) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -98,8 +99,8 @@ function sendSms() { log("Sending an SMS."); - sms.onsent = function(event) { - log("Received 'onsent' smsmanager event."); + manager.onsent = function(event) { + log("Received 'onsent' event."); gotSmsSent = true; log("Sent SMS (id: " + event.message.id + ")."); if (gotSmsSent && gotRequestSuccess) { @@ -107,7 +108,7 @@ function sendSms() { } }; - let request = sms.send(remoteNumber, text); + let request = manager.send(remoteNumber, text); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -119,7 +120,7 @@ function sendSms() { simulateIncomingSms(); } } else { - log("smsrequest returned false for sms.send"); + log("smsrequest returned false for manager.send"); ok(false,"SMS send failed"); cleanUp(); } @@ -128,7 +129,7 @@ function sendSms() { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.send request returned unexpected error: " + ok(false, "manager.send request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -151,7 +152,7 @@ function simulateIncomingSms(remoteNumber) { }); } -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { // Callback for incoming SMS log("Received 'onreceived' sms event."); let incomingSms = event.message; @@ -190,7 +191,7 @@ function getMsgs(secondNumber) { log("Getting the SMS messages with numbers " + defaultRemoteNumber + " and " + secondNumber + "."); - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -213,7 +214,7 @@ function getMsgs(secondNumber) { } else { log("SMS getMessages returned " + foundSmsList.length + " messages, but expected " + smsList.length + "."); - ok(false, "Incorrect number of messages returned by sms.getMessages"); + ok(false, "Incorrect number of messages returned by manager.getMessages"); deleteAllMsgs(cleanUp); } } @@ -222,7 +223,7 @@ function getMsgs(secondNumber) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -238,7 +239,7 @@ function verifyFoundMsgs(foundSmsList) { } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_filter_number_single.js b/dom/mobilemessage/tests/marionette/test_filter_number_single.js index db579e8b95fb..382abb184c50 100644 --- a/dom/mobilemessage/tests/marionette/test_filter_number_single.js +++ b/dom/mobilemessage/tests/marionette/test_filter_number_single.js @@ -6,14 +6,15 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let numberMsgs = 10; let smsList = new Array(); let defaultRemoteNumber = "+15552227777"; function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Ensure test is starting clean with no existing sms messages deleteAllMsgs(simulateIncomingSms); } @@ -23,7 +24,7 @@ function deleteAllMsgs(nextFunction) { let msgList = new Array(); let filter = new MozSmsFilter; - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -48,7 +49,7 @@ function deleteAllMsgs(nextFunction) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -59,7 +60,7 @@ function deleteMsgs(msgList, nextFunction) { let smsId = msgList.shift(); log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -75,7 +76,7 @@ function deleteMsgs(msgList, nextFunction) { } } else { log("SMS delete failed."); - ok(false,"sms.delete request returned false"); + ok(false,"manager.delete request returned false"); cleanUp(); } }; @@ -83,7 +84,7 @@ function deleteMsgs(msgList, nextFunction) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -106,7 +107,7 @@ function simulateIncomingSms(remoteNumber) { }); } -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { // Callback for incoming SMS log("Received 'onreceived' sms event."); let incomingSms = event.message; @@ -148,7 +149,7 @@ function getMsgs() { filter.numbers = new Array(defaultRemoteNumber); log("Getting the SMS messages from sender " + defaultRemoteNumber + "."); - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -171,7 +172,7 @@ function getMsgs() { } else { log("SMS getMessages returned " + foundSmsList.length + " messages, but expected " + smsList.length + "."); - ok(false, "Incorrect number of messages returned by sms.getMessages"); + ok(false, "Incorrect number of messages returned by manager.getMessages"); deleteAllMsgs(cleanUp); } } @@ -180,7 +181,7 @@ function getMsgs() { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -196,7 +197,7 @@ function verifyFoundMsgs(foundSmsList) { } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_filter_read.js b/dom/mobilemessage/tests/marionette/test_filter_read.js index 8e390173338d..5ffb0d5aa71c 100644 --- a/dom/mobilemessage/tests/marionette/test_filter_read.js +++ b/dom/mobilemessage/tests/marionette/test_filter_read.js @@ -6,13 +6,14 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let numberMsgs = 10; let smsList = new Array(); function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Ensure test is starting clean with no existing sms messages deleteAllMsgs(simulateIncomingSms); } @@ -21,7 +22,7 @@ function deleteAllMsgs(nextFunction) { let msgList = new Array(); let filter = new MozSmsFilter; - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -46,7 +47,7 @@ function deleteAllMsgs(nextFunction) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -56,7 +57,7 @@ function deleteMsgs(msgList, nextFunction) { let smsId = msgList.shift(); log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -72,7 +73,7 @@ function deleteMsgs(msgList, nextFunction) { } } else { log("SMS delete failed."); - ok(false,"sms.delete request returned false"); + ok(false,"manager.delete request returned false"); cleanUp(); } }; @@ -80,7 +81,7 @@ function deleteMsgs(msgList, nextFunction) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -102,7 +103,7 @@ function simulateIncomingSms() { } // Callback for incoming sms -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { log("Received 'onreceived' sms event."); let incomingSms = event.message; log("Received SMS (id: " + incomingSms.id + ")."); @@ -130,7 +131,7 @@ function nextRep() { function markMsgRead(smsMsgs) { nextSms = smsMsgs.shift(); log("Marking SMS (id: " + nextSms.id + ") as read."); - let request = sms.markMessageRead(nextSms.id, true); + let request = manager.markMessageRead(nextSms.id, true); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -146,7 +147,7 @@ function markMsgRead(smsMsgs) { } } else { log("SMS markMessageRead failed."); - ok(false,"sms.markMessageRead request returned false"); + ok(false,"manager.markMessageRead request returned false"); cleanUp(); } }; @@ -154,7 +155,7 @@ function markMsgRead(smsMsgs) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.markMessageRead request returned unexpected error: " + ok(false, "manager.markMessageRead request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -168,7 +169,7 @@ function getMsgs() { filter.read = true; log("Getting the read SMS messages."); - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -191,7 +192,7 @@ function getMsgs() { } else { log("SMS getMessages returned " + foundSmsList.length + " messages, but expected " + smsList.length + "."); - ok(false, "Incorrect number of messages returned by sms.getMessages"); + ok(false, "Incorrect number of messages returned by manager.getMessages"); deleteAllMsgs(cleanUp); } } @@ -200,7 +201,7 @@ function getMsgs() { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -215,7 +216,7 @@ function verifyFoundMsgs(foundSmsList) { } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_filter_received.js b/dom/mobilemessage/tests/marionette/test_filter_received.js index da6032f2eb05..f935ed5ed27f 100644 --- a/dom/mobilemessage/tests/marionette/test_filter_received.js +++ b/dom/mobilemessage/tests/marionette/test_filter_received.js @@ -6,13 +6,14 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let numberMsgs = 10; let smsList = new Array(); function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Ensure test is starting clean with no existing sms messages deleteAllMsgs(simulateIncomingSms); } @@ -21,7 +22,7 @@ function deleteAllMsgs(nextFunction) { let msgList = new Array(); let filter = new MozSmsFilter; - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -46,7 +47,7 @@ function deleteAllMsgs(nextFunction) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -56,7 +57,7 @@ function deleteMsgs(msgList, nextFunction) { let smsId = msgList.shift(); log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -72,7 +73,7 @@ function deleteMsgs(msgList, nextFunction) { } } else { log("SMS delete failed."); - ok(false,"sms.delete request returned false"); + ok(false,"manager.delete request returned false"); cleanUp(); } }; @@ -80,7 +81,7 @@ function deleteMsgs(msgList, nextFunction) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -102,7 +103,7 @@ function simulateIncomingSms() { } // Callback for incoming sms -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { log("Received 'onreceived' sms event."); let incomingSms = event.message; log("Received SMS (id: " + incomingSms.id + ")."); @@ -132,8 +133,8 @@ function sendSms() { log("Sending an SMS."); - sms.onsent = function(event) { - log("Received 'onsent' smsmanager event."); + manager.onsent = function(event) { + log("Received 'onsent' event."); gotSmsSent = true; let sentSms = event.message; log("Sent SMS (id: " + sentSms.id + ")."); @@ -144,7 +145,7 @@ function sendSms() { } }; - let request = sms.send(remoteNumber, text); + let request = manager.send(remoteNumber, text); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -157,7 +158,7 @@ function sendSms() { getMsgs(); } } else { - log("smsrequest returned false for sms.send"); + log("smsrequest returned false for manager.send"); ok(false,"SMS send failed"); cleanUp(); } @@ -166,7 +167,7 @@ function sendSms() { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.send request returned unexpected error: " + ok(false, "manager.send request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -180,7 +181,7 @@ function getMsgs() { filter.delivery = "received"; log("Getting the received SMS messages."); - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -203,7 +204,7 @@ function getMsgs() { } else { log("SMS getMessages returned " + foundSmsList.length + " messages, but expected " + smsList.length + "."); - ok(false, "Incorrect number of messages returned by sms.getMessages"); + ok(false, "Incorrect number of messages returned by manager.getMessages"); deleteAllMsgs(cleanUp); } } @@ -212,7 +213,7 @@ function getMsgs() { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -227,7 +228,7 @@ function verifyFoundMsgs(foundSmsList) { } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_filter_sent.js b/dom/mobilemessage/tests/marionette/test_filter_sent.js index 21c0b19f6486..cd9655fe39b5 100644 --- a/dom/mobilemessage/tests/marionette/test_filter_sent.js +++ b/dom/mobilemessage/tests/marionette/test_filter_sent.js @@ -6,13 +6,14 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let numberMsgs = 10; let smsList = new Array(); function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Ensure test is starting clean with no existing sms messages deleteAllMsgs(sendSms); } @@ -21,7 +22,7 @@ function deleteAllMsgs(nextFunction) { let msgList = new Array(); let filter = new MozSmsFilter; - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -46,7 +47,7 @@ function deleteAllMsgs(nextFunction) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -56,7 +57,7 @@ function deleteMsgs(msgList, nextFunction) { let smsId = msgList.shift(); log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -72,7 +73,7 @@ function deleteMsgs(msgList, nextFunction) { } } else { log("SMS delete failed."); - ok(false,"sms.delete request returned false"); + ok(false,"manager.delete request returned false"); cleanUp(); } }; @@ -80,7 +81,7 @@ function deleteMsgs(msgList, nextFunction) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -95,8 +96,8 @@ function sendSms() { log("Sending SMS " + (smsList.length + 1) + " of " + (numberMsgs - 1) + "."); - sms.onsent = function(event) { - log("Received 'onsent' smsmanager event."); + manager.onsent = function(event) { + log("Received 'onsent' event."); gotSmsSent = true; let sentSms = event.message; log("Sent SMS (id: " + sentSms.id + ")."); @@ -107,7 +108,7 @@ function sendSms() { } }; - let request = sms.send(remoteNumber, text); + let request = manager.send(remoteNumber, text); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -119,7 +120,7 @@ function sendSms() { nextRep(); } } else { - log("smsrequest returned false for sms.send"); + log("smsrequest returned false for manager.send"); ok(false,"SMS send failed"); cleanUp(); } @@ -128,7 +129,7 @@ function sendSms() { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.send request returned unexpected error: " + ok(false, "manager.send request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -158,7 +159,7 @@ function simulateIncomingSms() { } // Callback for incoming sms -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { log("Received 'onreceived' sms event."); let incomingSms = event.message; log("Received SMS (id: " + incomingSms.id + ")."); @@ -177,7 +178,7 @@ function getMsgs() { filter.delivery = "sent"; log("Getting the sent SMS messages."); - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -200,7 +201,7 @@ function getMsgs() { } else { log("SMS getMessages returned " + foundSmsList.length + " messages, but expected " + smsList.length + "."); - ok(false, "Incorrect number of messages returned by sms.getMessages"); + ok(false, "Incorrect number of messages returned by manager.getMessages"); deleteAllMsgs(cleanUp); } } @@ -209,7 +210,7 @@ function getMsgs() { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -224,7 +225,7 @@ function verifyFoundMsgs(foundSmsList) { } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_filter_unread.js b/dom/mobilemessage/tests/marionette/test_filter_unread.js index c65c0dbf6a2e..6d1b041cc626 100644 --- a/dom/mobilemessage/tests/marionette/test_filter_unread.js +++ b/dom/mobilemessage/tests/marionette/test_filter_unread.js @@ -6,13 +6,14 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let numberMsgs = 10; let smsList = new Array(); function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Ensure test is starting clean with no existing sms messages deleteAllMsgs(simulateIncomingSms); } @@ -21,7 +22,7 @@ function deleteAllMsgs(nextFunction) { let msgList = new Array(); let filter = new MozSmsFilter; - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -46,7 +47,7 @@ function deleteAllMsgs(nextFunction) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -56,7 +57,7 @@ function deleteMsgs(msgList, nextFunction) { let smsId = msgList.shift(); log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -72,7 +73,7 @@ function deleteMsgs(msgList, nextFunction) { } } else { log("SMS delete failed."); - ok(false,"sms.delete request returned false"); + ok(false,"manager.delete request returned false"); cleanUp(); } }; @@ -80,7 +81,7 @@ function deleteMsgs(msgList, nextFunction) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -102,7 +103,7 @@ function simulateIncomingSms() { } // Callback for incoming sms -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { log("Received 'onreceived' sms event."); let incomingSms = event.message; log("Received SMS (id: " + incomingSms.id + ")."); @@ -127,7 +128,7 @@ function nextRep() { function markMsgRead() { // Mark first message read so not all will be found by filter log("Marking SMS (id: " + smsList[0].id + ") as read."); - let request = sms.markMessageRead(smsList[0].id, true); + let request = manager.markMessageRead(smsList[0].id, true); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -140,7 +141,7 @@ function markMsgRead() { getMsgs(); } else { log("SMS markMessageRead failed."); - ok(false,"sms.markMessageRead request returned false"); + ok(false,"manager.markMessageRead request returned false"); cleanUp(); } }; @@ -148,7 +149,7 @@ function markMsgRead() { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.markMessageRead request returned unexpected error: " + ok(false, "manager.markMessageRead request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -162,7 +163,7 @@ function getMsgs() { filter.read = false; log("Getting the unread SMS messages."); - let cursor = sms.getMessages(filter, false); + let cursor = manager.getMessages(filter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -185,7 +186,7 @@ function getMsgs() { } else { log("SMS getMessages returned " + foundSmsList.length + " messages, but expected " + smsList.length + "."); - ok(false, "Incorrect number of messages returned by sms.getMessages"); + ok(false, "Incorrect number of messages returned by manager.getMessages"); deleteAllMsgs(cleanUp); } } @@ -194,7 +195,7 @@ function getMsgs() { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -209,7 +210,7 @@ function verifyFoundMsgs(foundSmsList) { } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_getmessage.js b/dom/mobilemessage/tests/marionette/test_getmessage.js index 697b098979d5..a3ed8d7acd23 100644 --- a/dom/mobilemessage/tests/marionette/test_getmessage.js +++ b/dom/mobilemessage/tests/marionette/test_getmessage.js @@ -10,7 +10,7 @@ SpecialPowers.addPermission("sms", true, document); const REMOTE = "5559997777"; // the remote number const EMULATOR = "15555215554"; // the emulator's number -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let inText = "Incoming SMS message. Mozilla Firefox OS!"; let outText = "Outgoing SMS message. Mozilla Firefox OS!"; let gotSmsOnsent = false; @@ -24,15 +24,16 @@ let outSmsTimeStamp; function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); simulateIncomingSms(); } function simulateIncomingSms() { log("Simulating incoming SMS."); - sms.onreceived = function onreceived(event) { - log("Received 'onreceived' smsmanager event."); + manager.onreceived = function onreceived(event) { + log("Received 'onreceived' event."); let incomingSms = event.message; ok(incomingSms, "incoming sms"); ok(incomingSms.id, "sms id"); @@ -59,8 +60,8 @@ function simulateIncomingSms() { function sendSms() { log("Sending an SMS."); - sms.onsent = function(event) { - log("Received 'onsent' smsmanager event."); + manager.onsent = function(event) { + log("Received 'onsent' event."); gotSmsOnsent = true; let sentSms = event.message; ok(sentSms, "outgoing sms"); @@ -82,7 +83,7 @@ function sendSms() { if (gotSmsOnsent && gotReqOnsuccess) { getReceivedSms(); } }; - let requestRet = sms.send(REMOTE, outText); + let requestRet = manager.send(REMOTE, outText); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -91,7 +92,7 @@ function sendSms() { if(event.target.result){ if (gotSmsOnsent && gotReqOnsuccess) { getReceivedSms(); } } else { - log("smsrequest returned false for sms.send"); + log("smsrequest returned false for manager.send"); ok(false,"SMS send failed"); cleanUp(); } @@ -100,7 +101,7 @@ function sendSms() { requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.send request returned unexpected error: " + ok(false, "manager.send request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -109,7 +110,7 @@ function sendSms() { function getReceivedSms() { log("Getting the received SMS message (id: " + inSmsId + ")."); - let requestRet = sms.getMessage(inSmsId); + let requestRet = manager.getMessage(inSmsId); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -143,7 +144,7 @@ function getReceivedSms() { function getSentSms() { log("Getting the sent SMS message (id: " + outSmsId + ")."); - let requestRet = sms.getMessage(outSmsId); + let requestRet = manager.getMessage(outSmsId); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -177,14 +178,14 @@ function getSentSms() { function deleteMsgs() { log("Deleting SMS (id: " + inSmsId + ")."); - let requestRet = sms.delete(inSmsId); + let requestRet = manager.delete(inSmsId); ok(requestRet,"smsrequest obj returned"); requestRet.onsuccess = function(event) { log("Received 'onsuccess' smsrequest event."); if(event.target.result){ log("Deleting SMS (id: " + outSmsId + ")."); - let nextReqRet = sms.delete(outSmsId); + let nextReqRet = manager.delete(outSmsId); ok(nextReqRet,"smsrequest obj returned"); nextReqRet.onsuccess = function(event) { @@ -192,12 +193,12 @@ function deleteMsgs() { if(event.target.result) { cleanUp(); } else { - log("smsrequest returned false for sms.delete"); + log("smsrequest returned false for manager.delete"); ok(false,"SMS delete failed"); } }; } else { - log("smsrequest returned false for sms.delete"); + log("smsrequest returned false for manager.delete"); ok(false,"SMS delete failed"); } }; @@ -205,14 +206,14 @@ function deleteMsgs() { requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); SpecialPowers.clearUserPref("dom.sms.requestStatusReport"); diff --git a/dom/mobilemessage/tests/marionette/test_getmessage_notfound.js b/dom/mobilemessage/tests/marionette/test_getmessage_notfound.js index 1d5822d723d7..2143ca02e955 100644 --- a/dom/mobilemessage/tests/marionette/test_getmessage_notfound.js +++ b/dom/mobilemessage/tests/marionette/test_getmessage_notfound.js @@ -6,7 +6,7 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.setBoolPref("dom.sms.enabled", true); SpecialPowers.addPermission("sms", true, document); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let myNumber = "15555215554"; let inText = "Incoming SMS message. Mozilla Firefox OS!"; let remoteNumber = "5559997777"; @@ -14,15 +14,16 @@ let inSmsId = 0; function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); simulateIncomingSms(); } function simulateIncomingSms() { log("Simulating incoming SMS."); - sms.onreceived = function onreceived(event) { - log("Received 'onreceived' smsmanager event."); + manager.onreceived = function onreceived(event) { + log("Received 'onreceived' event."); let incomingSms = event.message; ok(incomingSms, "incoming sms"); ok(incomingSms.id, "sms id"); @@ -41,7 +42,7 @@ function simulateIncomingSms() { function getNonExistentMsg() { let msgIdNoExist = inSmsId + 1; log("Attempting to get non-existent message (id: " + msgIdNoExist + ")."); - let requestRet = sms.getMessage(msgIdNoExist); + let requestRet = manager.getMessage(msgIdNoExist); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -65,7 +66,7 @@ function getNonExistentMsg() { function getMsgInvalidId() { invalidId = -1; log("Attempting to get sms with invalid id (id: " + invalidId + ")."); - let requestRet = sms.getMessage(invalidId); + let requestRet = manager.getMessage(invalidId); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -89,7 +90,7 @@ function getMsgInvalidId() { function deleteMsg() { log("Deleting SMS (id: " + inSmsId + ")."); - let requestRet = sms.delete(inSmsId); + let requestRet = manager.delete(inSmsId); ok(requestRet,"smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -102,14 +103,14 @@ function deleteMsg() { requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.setBoolPref("dom.sms.enabled", false); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_getmessages.js b/dom/mobilemessage/tests/marionette/test_getmessages.js index 370848c7172c..59f8c4c10012 100644 --- a/dom/mobilemessage/tests/marionette/test_getmessages.js +++ b/dom/mobilemessage/tests/marionette/test_getmessages.js @@ -6,13 +6,14 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let numberMsgs = 10; let smsList = new Array(); function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Ensure test is starting clean with no existing sms messages deleteAllMsgs(simulateIncomingSms); } @@ -25,7 +26,7 @@ function deleteAllMsgs(nextFunction) { let msgList = new Array(); let smsFilter = new MozSmsFilter; - let cursor = sms.getMessages(smsFilter, false); + let cursor = manager.getMessages(smsFilter, false); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -50,7 +51,7 @@ function deleteAllMsgs(nextFunction) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -60,7 +61,7 @@ function deleteMsgs(msgList, nextFunction) { let smsId = msgList.shift(); log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -76,7 +77,7 @@ function deleteMsgs(msgList, nextFunction) { } } else { log("SMS delete failed."); - ok(false,"sms.delete request returned false"); + ok(false,"manager.delete request returned false"); cleanUp(); } }; @@ -84,7 +85,7 @@ function deleteMsgs(msgList, nextFunction) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -106,7 +107,7 @@ function simulateIncomingSms() { } // Callback for incoming sms -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { log("Received 'onreceived' sms event."); let incomingSms = event.message; log("Received SMS (id: " + incomingSms.id + ")."); @@ -142,7 +143,7 @@ function getMsgs(reverse) { // Note: This test is intended for getMessages, so just a basic test with // no filter (default); separate tests will be written for sms filtering - let cursor = sms.getMessages(smsFilter, reverse); + let cursor = manager.getMessages(smsFilter, reverse); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); @@ -165,7 +166,7 @@ function getMsgs(reverse) { } else { log("SMS getMessages returned " + foundSmsCount + " messages, but expected " + numberMsgs + "."); - ok(false, "Incorrect number of messages returned by sms.getMessages"); + ok(false, "Incorrect number of messages returned by manager.getMessages"); } verifyFoundMsgs(foundSmsList, reverse); } @@ -174,7 +175,7 @@ function getMsgs(reverse) { cursor.onerror = function(event) { log("Received 'onerror' event."); ok(event.target.error, "domerror obj"); - log("sms.getMessages error: " + event.target.error.name); + log("manager.getMessages error: " + event.target.error.name); ok(false,"Could not get SMS messages"); cleanUp(); }; @@ -216,7 +217,7 @@ function verifyFoundMsgs(foundSmsList, reverse) { } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_getsegmentinfofortext.js b/dom/mobilemessage/tests/marionette/test_getsegmentinfofortext.js index 68fbcf1fccaf..9c7169a8a2a4 100644 --- a/dom/mobilemessage/tests/marionette/test_getsegmentinfofortext.js +++ b/dom/mobilemessage/tests/marionette/test_getsegmentinfofortext.js @@ -9,8 +9,9 @@ const PDU_MAX_USER_DATA_7BIT = 160; SpecialPowers.setBoolPref("dom.sms.enabled", true); SpecialPowers.addPermission("sms", true, document); -let sms = window.navigator.mozSms; -ok(sms instanceof MozSmsManager, "mozSmsManager"); +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); let tasks = { // List of test fuctions. Each of them should call |tasks.next()| when @@ -48,7 +49,7 @@ let tasks = { function addTest(text, segments, charsPerSegment, charsAvailableInLastSegment) { tasks.push(function () { log("Testing '" + text + "' ..."); - let info = sms.getSegmentInfoForText(text); + let info = manager.getSegmentInfoForText(text); is(info.segments, segments, "info.segments"); is(info.charsPerSegment, charsPerSegment, "info.charsPerSegment"); is(info.charsAvailableInLastSegment, charsAvailableInLastSegment, @@ -62,7 +63,7 @@ function addTestThrows(text) { tasks.push(function () { log("Testing '" + text + "' ..."); try { - let info = sms.getSegmentInfoForText(text); + let info = manager.getSegmentInfoForText(text); ok(false, "Not thrown"); tasks.finish(); diff --git a/dom/mobilemessage/tests/marionette/test_getthreads.js b/dom/mobilemessage/tests/marionette/test_getthreads.js index d57a85a96eb4..82c28a1409f5 100644 --- a/dom/mobilemessage/tests/marionette/test_getthreads.js +++ b/dom/mobilemessage/tests/marionette/test_getthreads.js @@ -6,8 +6,9 @@ MARIONETTE_TIMEOUT = 40000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; -ok(sms instanceof MozSmsManager); +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); let pendingEmulatorCmdCount = 0; function sendSmsToEmulator(from, text, callback) { @@ -59,7 +60,7 @@ function getAllMessages(callback, filter, reverse) { filter = new MozSmsFilter; } let messages = []; - let request = sms.getMessages(filter, reverse || false); + let request = manager.getMessages(filter, reverse || false); request.onsuccess = function(event) { if (!request.done) { messages.push(request.result); @@ -80,7 +81,7 @@ function deleteAllMessages() { return; } - let request = sms.delete(message.id); + let request = manager.delete(message.id); request.onsuccess = deleteAll.bind(null, messages); request.onerror = function (event) { ok(false, "failed to delete all messages"); @@ -90,17 +91,17 @@ function deleteAllMessages() { } function sendMessage(to, body) { - sms.onsent = function () { - sms.onsent = null; + manager.onsent = function () { + manager.onsent = null; tasks.next(); }; - let request = sms.send(to, body); + let request = manager.send(to, body); request.onerror = tasks.finish.bind(tasks); } function receiveMessage(from, body) { - sms.onreceived = function () { - sms.onreceived = null; + manager.onreceived = function () { + manager.onreceived = null; tasks.next(); }; sendSmsToEmulator(from, body, function (success) { @@ -113,7 +114,7 @@ function receiveMessage(from, body) { function getAllThreads(callback) { let threads = []; - let cursor = sms.getThreads(); + let cursor = manager.getThreads(); ok(cursor instanceof DOMCursor, "cursor is instanceof " + cursor.constructor); diff --git a/dom/mobilemessage/tests/marionette/test_incoming.js b/dom/mobilemessage/tests/marionette/test_incoming.js index 8e66b5cab805..64f2bfd60bb6 100644 --- a/dom/mobilemessage/tests/marionette/test_incoming.js +++ b/dom/mobilemessage/tests/marionette/test_incoming.js @@ -9,7 +9,10 @@ SpecialPowers.addPermission("sms", true, document); const SENDER = "5555552368"; // the remote number const RECEIVER = "15555215554"; // the emulator's number -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); + let body = "Hello SMS world!"; let completed = false; @@ -19,7 +22,7 @@ runEmulatorCmd("sms send " + SENDER + " " + body, function(result) { completed = true; }); -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { log("Received an SMS!"); let message = event.message; diff --git a/dom/mobilemessage/tests/marionette/test_incoming_delete.js b/dom/mobilemessage/tests/marionette/test_incoming_delete.js index 91ceb7b39a1e..77b4a4235e5b 100644 --- a/dom/mobilemessage/tests/marionette/test_incoming_delete.js +++ b/dom/mobilemessage/tests/marionette/test_incoming_delete.js @@ -9,20 +9,21 @@ SpecialPowers.addPermission("sms", true, document); const SENDER = "5555552368"; // the remote number const RECEIVER = "15555215554"; // the emulator's number -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let msgText = "Mozilla Firefox OS!"; function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); simulateIncomingSms(); } function simulateIncomingSms() { log("Simulating incoming SMS."); - sms.onreceived = function onreceived(event) { - log("Received 'onreceived' smsmanager event."); + manager.onreceived = function onreceived(event) { + log("Received 'onreceived' event."); let incomingSms = event.message; ok(incomingSms, "incoming sms"); ok(incomingSms.id, "sms id"); @@ -46,7 +47,7 @@ function simulateIncomingSms() { function verifySmsExists(incomingSms) { log("Getting SMS (id: " + incomingSms.id + ")."); - let requestRet = sms.getMessage(incomingSms.id); + let requestRet = manager.getMessage(incomingSms.id); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -78,7 +79,7 @@ function verifySmsExists(incomingSms) { function deleteSms(smsMsgObj){ log("Deleting SMS (id: " + smsMsgObj.id + ") using smsmsg obj parameter."); - let requestRet = sms.delete(smsMsgObj); + let requestRet = manager.delete(smsMsgObj); ok(requestRet,"smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -86,7 +87,7 @@ function deleteSms(smsMsgObj){ if(event.target.result){ verifySmsDeleted(smsMsgObj.id); } else { - log("smsrequest returned false for sms.delete"); + log("smsrequest returned false for manager.delete"); ok(false,"SMS delete failed"); cleanUp(); } @@ -95,7 +96,7 @@ function deleteSms(smsMsgObj){ requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -103,7 +104,7 @@ function deleteSms(smsMsgObj){ function verifySmsDeleted(smsId) { log("Getting SMS (id: " + smsId + ")."); - let requestRet = sms.getMessage(smsId); + let requestRet = manager.getMessage(smsId); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -127,7 +128,7 @@ function verifySmsDeleted(smsId) { } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.setBoolPref("dom.sms.enabled", false); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_incoming_max_segments.js b/dom/mobilemessage/tests/marionette/test_incoming_max_segments.js index 2ab51dc8a8e4..1c4b425f1669 100644 --- a/dom/mobilemessage/tests/marionette/test_incoming_max_segments.js +++ b/dom/mobilemessage/tests/marionette/test_incoming_max_segments.js @@ -6,7 +6,7 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.setBoolPref("dom.sms.enabled", true); SpecialPowers.addPermission("sms", true, document); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; // https://developer.mozilla.org/en-US/docs/DOM/SmsManager let maxCharsPerSms = 160; let maxSegments = 10; // 10 message segments concatenated into 1 multipart SMS @@ -16,7 +16,8 @@ const EMULATOR = "15555215554"; // the emulator's number function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); simulateIncomingSms(); } @@ -28,9 +29,9 @@ function simulateIncomingSms() { log("Simulating incoming multipart SMS (" + msgText.length + " chars total)."); - sms.onreceived = function onreceived(event) { - sms.onreceived = null; - log("Received 'onreceived' smsmanager event."); + manager.onreceived = function onreceived(event) { + manager.onreceived = null; + log("Received 'onreceived' event."); let incomingSms = event.message; ok(incomingSms, "incoming sms"); @@ -54,7 +55,7 @@ function simulateIncomingSms() { function verifySmsExists(incomingSms) { log("Getting SMS (id: " + incomingSms.id + ")."); - let requestRet = sms.getMessage(incomingSms.id); + let requestRet = manager.getMessage(incomingSms.id); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -80,7 +81,7 @@ function verifySmsExists(incomingSms) { function deleteSms(smsMsgObj){ log("Deleting SMS (id: " + smsMsgObj.id + ") using smsmsg obj parameter."); - let requestRet = sms.delete(smsMsgObj); + let requestRet = manager.delete(smsMsgObj); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -88,7 +89,7 @@ function deleteSms(smsMsgObj){ if (event.target.result) { cleanUp(); } else { - log("smsrequest returned false for sms.delete"); + log("smsrequest returned false for manager.delete"); ok(false, "SMS delete failed"); cleanUp(); } @@ -97,7 +98,7 @@ function deleteSms(smsMsgObj){ requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name); cleanUp(); }; diff --git a/dom/mobilemessage/tests/marionette/test_incoming_multipart.js b/dom/mobilemessage/tests/marionette/test_incoming_multipart.js index 6eefef2c650d..0a72d1f876ad 100644 --- a/dom/mobilemessage/tests/marionette/test_incoming_multipart.js +++ b/dom/mobilemessage/tests/marionette/test_incoming_multipart.js @@ -9,11 +9,12 @@ SpecialPowers.addPermission("sms", true, document); const SENDER = "5555552368"; // the remote number const RECEIVER = "15555215554"; // the emulator's number -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); simulateIncomingSms(); } @@ -27,8 +28,8 @@ function simulateIncomingSms() { msgText += 'FirefoxOS '; } - sms.onreceived = function onreceived(event) { - log("Received 'onreceived' smsmanager event."); + manager.onreceived = function onreceived(event) { + log("Received 'onreceived' event."); let incomingSms = event.message; ok(incomingSms, "incoming sms"); ok(incomingSms.id, "sms id"); @@ -50,7 +51,7 @@ function simulateIncomingSms() { function verifySmsExists(incomingSms) { log("Getting SMS (id: " + incomingSms.id + ")."); - let requestRet = sms.getMessage(incomingSms.id); + let requestRet = manager.getMessage(incomingSms.id); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -80,7 +81,7 @@ function verifySmsExists(incomingSms) { function deleteSms(smsMsgObj){ log("Deleting SMS (id: " + smsMsgObj.id + ") using smsmsg obj parameter."); - let requestRet = sms.delete(smsMsgObj); + let requestRet = manager.delete(smsMsgObj); ok(requestRet,"smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -88,7 +89,7 @@ function deleteSms(smsMsgObj){ if(event.target.result){ cleanUp(); } else { - log("smsrequest returned false for sms.delete"); + log("smsrequest returned false for manager.delete"); ok(false,"SMS delete failed"); cleanUp(); } @@ -97,14 +98,14 @@ function deleteSms(smsMsgObj){ requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_invalid_address.js b/dom/mobilemessage/tests/marionette/test_invalid_address.js index 4c43f68168f7..fed47acd35e5 100644 --- a/dom/mobilemessage/tests/marionette/test_invalid_address.js +++ b/dom/mobilemessage/tests/marionette/test_invalid_address.js @@ -41,14 +41,14 @@ let tasks = { } }; -let mozMobileMessage; +let manager; function getAllMessages(callback, filter, reverse) { if (!filter) { filter = new MozSmsFilter; } let messages = []; - let request = mozMobileMessage.getMessages(filter, reverse || false); + let request = manager.getMessages(filter, reverse || false); request.onsuccess = function(event) { if (request.result) { messages.push(request.result); @@ -69,7 +69,7 @@ function deleteAllMessages() { return; } - let request = mozMobileMessage.delete(message.id); + let request = manager.delete(message.id); request.onsuccess = deleteAll.bind(null, messages); request.onerror = function (event) { ok(false, "failed to delete all messages"); @@ -79,10 +79,10 @@ function deleteAllMessages() { } function testInvalidAddressForSMS(aInvalidAddr) { - log("mozMobileMessage.send(...) should get 'InvalidAddressError' error " + + log("manager.send(...) should get 'InvalidAddressError' error " + "when attempting to send SMS to: " + aInvalidAddr); - let request = mozMobileMessage.send(aInvalidAddr, "Test"); + let request = manager.send(aInvalidAddr, "Test"); request.onerror = function(event) { log("Received 'onerror' DOMRequest event."); @@ -94,10 +94,10 @@ function testInvalidAddressForSMS(aInvalidAddr) { } function testInvalidAddressForMMS(aInvalidAddrs) { - log("mozMobileMessage.sendMMS(...) should get 'InvalidAddressError' error " + + log("manager.sendMMS(...) should get 'InvalidAddressError' error " + "when attempting to send MMS to: " + aInvalidAddrs); - let request = mozMobileMessage.sendMMS({ + let request = manager.sendMMS({ subject: "Test", receivers: aInvalidAddrs, attachments: [], @@ -115,8 +115,9 @@ function testInvalidAddressForMMS(aInvalidAddrs) { tasks.push(function () { log("Verifying initial state."); - mozMobileMessage = window.navigator.mozMobileMessage; - ok(mozMobileMessage instanceof MozMobileMessageManager); + manager = window.navigator.mozMobileMessage; + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); tasks.next(); }); diff --git a/dom/mobilemessage/tests/marionette/test_mark_msg_read.js b/dom/mobilemessage/tests/marionette/test_mark_msg_read.js index 0829307b7e72..ae41373c80dd 100644 --- a/dom/mobilemessage/tests/marionette/test_mark_msg_read.js +++ b/dom/mobilemessage/tests/marionette/test_mark_msg_read.js @@ -6,12 +6,13 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let smsList = new Array(); function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); simulateIncomingSms(); } @@ -30,7 +31,7 @@ function simulateIncomingSms() { } // Callback for incoming SMS -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { log("Received 'onreceived' sms event."); let incomingSms = event.message; log("Received SMS (id: " + incomingSms.id + ")."); @@ -54,8 +55,8 @@ function sendSms() { log("Sending an SMS."); - sms.onsent = function(event) { - log("Received 'onsent' smsmanager event."); + manager.onsent = function(event) { + log("Received 'onsent' event."); gotSmsSent = true; let sentSms = event.message; log("Sent SMS (id: " + sentSms.id + ")."); @@ -70,7 +71,7 @@ function sendSms() { } }; - let request = sms.send(remoteNumber, text); + let request = manager.send(remoteNumber, text); request.onsuccess = function(event) { log("Received 'onsuccess' smsrequest event."); @@ -80,7 +81,7 @@ function sendSms() { test1(); } } else { - log("smsrequest returned false for sms.send"); + log("smsrequest returned false for manager.send"); ok(false, "SMS send failed"); deleteMsgs(); } @@ -89,14 +90,14 @@ function sendSms() { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.send request returned unexpected error: " + ok(false, "manager.send request returned unexpected error: " + event.target.error.name ); deleteMsgs(); }; } function markMessageAndVerify(smsId, readBool, nextFunction) { - let request = sms.markMessageRead(smsId, readBool); + let request = manager.markMessageRead(smsId, readBool); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -108,7 +109,7 @@ function markMessageAndVerify(smsId, readBool, nextFunction) { // Message marked read/unread, now verify log("Getting SMS message (id: " + smsId + ")."); - let requestRet = sms.getMessage(smsId); + let requestRet = manager.getMessage(smsId); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -141,7 +142,7 @@ function markMessageAndVerify(smsId, readBool, nextFunction) { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.markMessageRead request returned unexpected error: " + ok(false, "manager.markMessageRead request returned unexpected error: " + event.target.error.name ); nextFunction(); }; @@ -187,7 +188,7 @@ function deleteMsgs() { let smsId = smsList.shift(); log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -202,7 +203,7 @@ function deleteMsgs() { } } else { log("SMS delete failed."); - ok(false, "sms.delete request returned false"); + ok(false, "manager.delete request returned false"); cleanUp(); } }; @@ -210,14 +211,14 @@ function deleteMsgs() { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_mark_msg_read_error.js b/dom/mobilemessage/tests/marionette/test_mark_msg_read_error.js index c532594d966e..5d6bbe85e9e4 100644 --- a/dom/mobilemessage/tests/marionette/test_mark_msg_read_error.js +++ b/dom/mobilemessage/tests/marionette/test_mark_msg_read_error.js @@ -6,12 +6,13 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let smsId; function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); simulateIncomingSms(); } @@ -30,7 +31,7 @@ function simulateIncomingSms() { } // Callback for incoming SMS -sms.onreceived = function onreceived(event) { +manager.onreceived = function onreceived(event) { log("Received 'onreceived' sms event."); let incomingSms = event.message; log("Received SMS (id: " + incomingSms.id + ")."); @@ -44,7 +45,7 @@ sms.onreceived = function onreceived(event) { }; function markMsgError(invalidId, readBool, nextFunction) { - let requestRet = sms.markMessageRead(invalidId, readBool); + let requestRet = manager.markMessageRead(invalidId, readBool); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -79,7 +80,7 @@ function test2() { function deleteMsg() { log("Deleting SMS (id: " + smsId + ")."); - let request = sms.delete(smsId); + let request = manager.delete(smsId); ok(request instanceof DOMRequest, "request is instanceof " + request.constructor); @@ -90,7 +91,7 @@ function deleteMsg() { cleanUp(); } else { log("SMS delete failed."); - ok(false,"sms.delete request returned false"); + ok(false,"manager.delete request returned false"); cleanUp(); } }; @@ -98,14 +99,14 @@ function deleteMsg() { request.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; } function cleanUp() { - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); finish(); diff --git a/dom/mobilemessage/tests/marionette/test_massive_incoming_delete.js b/dom/mobilemessage/tests/marionette/test_massive_incoming_delete.js index 70757c5445bb..d6d6081447c9 100644 --- a/dom/mobilemessage/tests/marionette/test_massive_incoming_delete.js +++ b/dom/mobilemessage/tests/marionette/test_massive_incoming_delete.js @@ -9,7 +9,7 @@ SpecialPowers.addPermission("sms", true, document); const SENDER = "5555552368"; // the remote number const RECEIVER = "15555215554"; // the emulator's number -let sms = window.navigator.mozMobileMessage; +let manager = window.navigator.mozMobileMessage; let MSG_TEXT = "Mozilla Firefox OS!"; let SMS_NUMBER = 100; @@ -68,7 +68,7 @@ function taskNextWrapper() { function verifySmsExists(incomingSms) { log("Getting SMS (id: " + incomingSms.id + ")."); - let requestRet = sms.getMessage(incomingSms.id); + let requestRet = manager.getMessage(incomingSms.id); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -102,7 +102,7 @@ function verifySmsExists(incomingSms) { let verifDeletedCount = 0; function verifySmsDeleted(smsId) { log("Getting SMS (id: " + smsId + ")."); - let requestRet = sms.getMessage(smsId); + let requestRet = manager.getMessage(smsId); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -127,11 +127,12 @@ function verifySmsDeleted(smsId) { tasks.push(function init() { log("Initialize test object."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); // Callback for incoming sms - sms.onreceived = function onreceived(event) { - log("Received 'onreceived' smsmanager event."); + manager.onreceived = function onreceived(event) { + log("Received 'onreceived' event."); let incomingSms = event.message; ok(incomingSms, "incoming sms"); ok(incomingSms.id, "sms id"); @@ -168,7 +169,7 @@ tasks.push(function deleteAllSms() { let deleteStart = Date.now(); log("deleteStart: " + deleteStart); log("SmsList: " + JSON.stringify(SmsList)); - let requestRet = sms.delete(SmsList); + let requestRet = manager.delete(SmsList); ok(requestRet,"smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -180,7 +181,7 @@ tasks.push(function deleteAllSms() { verifySmsDeleted(SmsList[i].id); } } else { - log("smsrequest returned false for sms.delete"); + log("smsrequest returned false for manager.delete"); ok(false, "SMS delete failed"); } }; @@ -188,7 +189,7 @@ tasks.push(function deleteAllSms() { requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name); tasks.finish(); }; @@ -205,7 +206,7 @@ tasks.push(function cleanUp() { return; } - sms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.setBoolPref("dom.sms.enabled", false); log("Finish!!!"); diff --git a/dom/mobilemessage/tests/marionette/test_message_classes.js b/dom/mobilemessage/tests/marionette/test_message_classes.js index b1663b688d68..cf0366b7d05b 100644 --- a/dom/mobilemessage/tests/marionette/test_message_classes.js +++ b/dom/mobilemessage/tests/marionette/test_message_classes.js @@ -15,8 +15,9 @@ const PDU_UD = "41"; SpecialPowers.addPermission("sms", true, document); -let sms = window.navigator.mozSms; -ok(sms instanceof MozSmsManager); +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); let pendingEmulatorCmdCount = 0; function sendSmsPduToEmulator(pdu) { @@ -61,8 +62,8 @@ function test_message_class_0() { ]; function do_test(dcsIndex) { - sms.addEventListener("received", function onReceived(event) { - sms.removeEventListener("received", onReceived); + manager.addEventListener("received", function onReceived(event) { + manager.removeEventListener("received", onReceived); let message = event.message; checkMessage(message, -1, 0, "class-0"); @@ -72,7 +73,7 @@ function test_message_class_0() { "Message's timestamp should be lesser than the timestamp of now"); // Make sure the message is not stored. - let cursor = sms.getMessages(null, false); + let cursor = manager.getMessages(null, false); cursor.onsuccess = function onsuccess() { if (cursor.result) { // Here we check whether there is any message of the same sender. @@ -109,8 +110,8 @@ function test_message_class_0() { function doTestMessageClassGeneric(allDCSs, messageClass, next) { function do_test(dcsIndex) { - sms.addEventListener("received", function onReceived(event) { - sms.removeEventListener("received", onReceived); + manager.addEventListener("received", function onReceived(event) { + manager.removeEventListener("received", onReceived); // Make sure we can correctly receive the message checkMessage(event.message, null, null, messageClass); @@ -187,7 +188,7 @@ function test_message_class_2() { } function next() { - sms.removeEventListener("received", onReceived); + manager.removeEventListener("received", onReceived); ++pidIndex; if (pidIndex >= allPIDs.length) { @@ -202,7 +203,7 @@ function test_message_class_2() { } } - sms.addEventListener("received", onReceived); + manager.addEventListener("received", onReceived); if (pidIndex != 0) { // Wait for three seconds to ensure we don't receive the message. diff --git a/dom/mobilemessage/tests/marionette/test_mmsmessage_attachments.js b/dom/mobilemessage/tests/marionette/test_mmsmessage_attachments.js index 3a9a8f878f34..3fc87a0502a5 100644 --- a/dom/mobilemessage/tests/marionette/test_mmsmessage_attachments.js +++ b/dom/mobilemessage/tests/marionette/test_mmsmessage_attachments.js @@ -41,14 +41,14 @@ let tasks = { } }; -let mozMobileMessage; +let manager; function getAllMessages(callback, filter, reverse) { if (!filter) { filter = new MozSmsFilter; } let messages = []; - let request = mozMobileMessage.getMessages(filter, reverse || false); + let request = manager.getMessages(filter, reverse || false); request.onsuccess = function(event) { if (request.result) { messages.push(request.result); @@ -69,7 +69,7 @@ function deleteAllMessages() { return; } - let request = mozMobileMessage.delete(message.id); + let request = manager.delete(message.id); request.onsuccess = deleteAll.bind(null, messages); request.onerror = function (event) { ok(false, "failed to delete all messages"); @@ -81,8 +81,9 @@ function deleteAllMessages() { tasks.push(function () { log("Verifying initial state."); - mozMobileMessage = window.navigator.mozMobileMessage; - ok(mozMobileMessage instanceof MozMobileMessageManager); + manager = window.navigator.mozMobileMessage; + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); tasks.next(); }); @@ -90,8 +91,8 @@ tasks.push(function () { tasks.push(function () { log("MmsMessage.attachments should be an empty array."); - mozMobileMessage.onfailed = function (event) { - mozMobileMessage.onfailed = null; + manager.onfailed = function (event) { + manager.onfailed = null; let message = event.message; ok(Array.isArray(message.attachments) && message.attachments.length === 0, @@ -102,7 +103,7 @@ tasks.push(function () { // Have a long long subject causes the send fails, so we don't need // networking here. - mozMobileMessage.sendMMS({ + manager.sendMMS({ subject: new Array(MMS_MAX_LENGTH_SUBJECT + 2).join("a"), receivers: ["1", "2"], attachments: [], diff --git a/dom/mobilemessage/tests/marionette/test_outgoing.js b/dom/mobilemessage/tests/marionette/test_outgoing.js index bee9d1de4b86..5f15747956d1 100644 --- a/dom/mobilemessage/tests/marionette/test_outgoing.js +++ b/dom/mobilemessage/tests/marionette/test_outgoing.js @@ -10,7 +10,10 @@ SpecialPowers.addPermission("sms", true, document); const SENDER = "15555215554"; // the emulator's number -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); + const SHORT_BODY = "Hello SMS world!"; const LONG_BODY = "Let me not to the marriage of true minds\n" + "Admit impediments. Love is not love\n" @@ -59,8 +62,8 @@ function doSendMessageAndCheckSuccess(receivers, body, callback) { } } - sms.removeEventListener("sending", onSmsSending); - sms.removeEventListener("sent", onSmsSent); + manager.removeEventListener("sending", onSmsSending); + manager.removeEventListener("sent", onSmsSent); log("Done!"); window.setTimeout(callback, 0); @@ -104,7 +107,7 @@ function doSendMessageAndCheckSuccess(receivers, body, callback) { } function onSmsSending(event) { - log("SmsManager.onsending event received."); + log("onsending event received."); // Bug 838542: following check throws an exception and fails this case. // ok(event instanceof MozSmsEvent, @@ -135,7 +138,7 @@ function doSendMessageAndCheckSuccess(receivers, body, callback) { } function onSmsSent(event) { - log("SmsManager.onsent event received."); + log("onsent event received."); // Bug 838542: following check throws an exception and fails this case. // ok(event instanceof MozSmsEvent, @@ -145,10 +148,10 @@ function doSendMessageAndCheckSuccess(receivers, body, callback) { checkSentMessage(event.message, "onSentCalled"); } - sms.addEventListener("sending", onSmsSending); - sms.addEventListener("sent", onSmsSent); + manager.addEventListener("sending", onSmsSending); + manager.addEventListener("sent", onSmsSent); - let result = sms.send(receivers, body); + let result = manager.send(receivers, body); is(Array.isArray(result), Array.isArray(receivers), "send() returns an array of requests if receivers is an array"); if (Array.isArray(receivers)) { @@ -178,7 +181,7 @@ function testSendMultipartMessage() { function testSendMessageToMultipleRecipients() { log("Testing sending message to multiple receivers:"); - // TODO: bug 788928 - add test cases for nsIDOMSmsManager.ondelivered event + // TODO: bug 788928 - add test cases for ondelivered event. doSendMessageAndCheckSuccess(["1", "2"], SHORT_BODY, cleanUp); } diff --git a/dom/mobilemessage/tests/marionette/test_outgoing_delete.js b/dom/mobilemessage/tests/marionette/test_outgoing_delete.js index 884ba345fded..200e4a9aad49 100644 --- a/dom/mobilemessage/tests/marionette/test_outgoing_delete.js +++ b/dom/mobilemessage/tests/marionette/test_outgoing_delete.js @@ -10,14 +10,15 @@ SpecialPowers.addPermission("sms", true, document); const SENDER = "15555215554"; // the emulator's number const RECEIVER = "5551117777"; // the destination number -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; let msgText = "Mozilla Firefox OS!"; let gotSmsOnsent = false; let gotReqOnsuccess = false; function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); sendSms(); } @@ -25,8 +26,8 @@ function sendSms() { let smsId = 0; log("Sending an SMS."); - sms.onsent = function(event) { - log("Received 'onsent' smsmanager event."); + manager.onsent = function(event) { + log("Received 'onsent' event."); gotSmsOnsent = true; let sentSms = event.message; ok(sentSms, "outgoing sms"); @@ -46,7 +47,7 @@ function sendSms() { if (gotSmsOnsent && gotReqOnsuccess) { verifySmsExists(smsId); } }; - let requestRet = sms.send(RECEIVER, msgText); + let requestRet = manager.send(RECEIVER, msgText); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -55,7 +56,7 @@ function sendSms() { if(event.target.result){ if (gotSmsOnsent && gotReqOnsuccess) { verifySmsExists(smsId); } } else { - log("smsrequest returned false for sms.send"); + log("smsrequest returned false for manager.send"); ok(false,"SMS send failed"); cleanUp(); } @@ -64,7 +65,7 @@ function sendSms() { requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.send request returned unexpected error: " + ok(false, "manager.send request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -72,7 +73,7 @@ function sendSms() { function verifySmsExists(smsId) { log("Getting SMS (id: " + smsId + ")."); - let requestRet = sms.getMessage(smsId); + let requestRet = manager.getMessage(smsId); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -102,7 +103,7 @@ function verifySmsExists(smsId) { function deleteSms(smsId){ log("Deleting SMS (id: " + smsId + ") using sms id parameter."); - let requestRet = sms.delete(smsId); + let requestRet = manager.delete(smsId); ok(requestRet,"smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -110,7 +111,7 @@ function deleteSms(smsId){ if(event.target.result){ verifySmsDeleted(smsId); } else { - log("smsrequest returned false for sms.delete"); + log("smsrequest returned false for manager.delete"); ok(false,"SMS delete failed"); cleanUp(); } @@ -119,7 +120,7 @@ function deleteSms(smsId){ requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name ); cleanUp(); }; @@ -127,7 +128,7 @@ function deleteSms(smsId){ function verifySmsDeleted(smsId) { log("Getting SMS (id: " + smsId + ")."); - let requestRet = sms.getMessage(smsId); + let requestRet = manager.getMessage(smsId); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -151,7 +152,7 @@ function verifySmsDeleted(smsId) { } function cleanUp() { - sms.onsent = null; + manager.onsent = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); SpecialPowers.clearUserPref("dom.sms.requestStatusReport"); diff --git a/dom/mobilemessage/tests/marionette/test_outgoing_max_segments.js b/dom/mobilemessage/tests/marionette/test_outgoing_max_segments.js index abe5bea70940..5ea9219a5f27 100644 --- a/dom/mobilemessage/tests/marionette/test_outgoing_max_segments.js +++ b/dom/mobilemessage/tests/marionette/test_outgoing_max_segments.js @@ -6,14 +6,15 @@ MARIONETTE_TIMEOUT = 60000; SpecialPowers.setBoolPref("dom.sms.enabled", true); SpecialPowers.addPermission("sms", true, document); -let sms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; // https://developer.mozilla.org/en-US/docs/DOM/SmsManager let maxCharsPerSms = 160; let maxSegments = 10; // 10 message segments concatenated into 1 multipart SMS function verifyInitialState() { log("Verifying initial state."); - ok(sms, "mozSms"); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); sendSms(); } @@ -28,9 +29,9 @@ function sendSms() { msgText = new Array((maxCharsPerSms * maxSegments) + 1).join('a'); log("Sending multipart SMS (" + msgText.length + " chars total)."); - sms.onsent = function(event) { - sms.onsent = null; - log("Received 'onsent' smsmanager event."); + manager.onsent = function(event) { + manager.onsent = null; + log("Received 'onsent' event."); gotSmsOnSent = true; sentSms = event.message; @@ -45,7 +46,7 @@ function sendSms() { if (gotReqOnSuccess) { verifySmsExists(sentSms); } }; - let requestRet = sms.send(destNumber, msgText); + let requestRet = manager.send(destNumber, msgText); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -54,7 +55,7 @@ function sendSms() { if (event.target.result) { if (gotSmsOnSent) { verifySmsExists(sentSms); } } else { - log("smsrequest returned false for sms.send"); + log("smsrequest returned false for manager.send"); ok(false, "SMS send failed"); cleanUp(); } @@ -63,7 +64,7 @@ function sendSms() { requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.send request returned unexpected error: " + + ok(false, "manager.send request returned unexpected error: " + event.target.error.name); cleanUp(); }; @@ -71,7 +72,7 @@ function sendSms() { function verifySmsExists(sentSms) { log("Getting SMS (id: " + sentSms.id + ")."); - let requestRet = sms.getMessage(sentSms.id); + let requestRet = manager.getMessage(sentSms.id); ok(requestRet, "smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -98,7 +99,7 @@ function verifySmsExists(sentSms) { function deleteSms(smsMsgObj) { log("Deleting SMS (id: " + smsMsgObj.id + ") using smsmsg obj parameter."); - let requestRet = sms.delete(smsMsgObj); + let requestRet = manager.delete(smsMsgObj); ok(requestRet,"smsrequest obj returned"); requestRet.onsuccess = function(event) { @@ -106,7 +107,7 @@ function deleteSms(smsMsgObj) { if (event.target.result) { cleanUp(); } else { - log("smsrequest returned false for sms.delete"); + log("smsrequest returned false for manager.delete"); ok(false, "SMS delete failed"); cleanUp(); } @@ -115,7 +116,7 @@ function deleteSms(smsMsgObj) { requestRet.onerror = function(event) { log("Received 'onerror' smsrequest event."); ok(event.target.error, "domerror obj"); - ok(false, "sms.delete request returned unexpected error: " + + ok(false, "manager.delete request returned unexpected error: " + event.target.error.name); cleanUp(); }; diff --git a/dom/mobilemessage/tests/marionette/test_phone_number_normalization.js b/dom/mobilemessage/tests/marionette/test_phone_number_normalization.js index 546a9319c764..9c43a9930c63 100644 --- a/dom/mobilemessage/tests/marionette/test_phone_number_normalization.js +++ b/dom/mobilemessage/tests/marionette/test_phone_number_normalization.js @@ -56,7 +56,7 @@ function getAllMessages(callback, filter, reverse) { filter = new MozSmsFilter; } let messages = []; - let request = mozSms.getMessages(filter, reverse || false); + let request = manager.getMessages(filter, reverse || false); request.onsuccess = function(event) { if (request.result) { messages.push(request.result); @@ -77,7 +77,7 @@ function deleteAllMessages() { return; } - let request = mozSms.delete(message.id); + let request = manager.delete(message.id); request.onsuccess = deleteAll.bind(null, messages); request.onerror = function (event) { ok(false, "failed to delete all messages"); @@ -89,11 +89,11 @@ function deleteAllMessages() { function validate(number, normalizedNumber) { log("Checking ('" + number + "', '" + normalizedNumber + "')"); - let sendRequest = mozSms.send(number, "ping"); + let sendRequest = manager.send(number, "ping"); sendRequest.onsuccess = function onSendSuccess(event) { let sentMessage = event.target.result; - mozSms.onreceived = function onreceived(event) { + manager.onreceived = function onreceived(event) { let receivedMessage = event.message; is(sentMessage.threadId, receivedMessage.threadId, "message threadIds are supposed to be matched"); @@ -108,10 +108,11 @@ function validate(number, normalizedNumber) { }; } -let mozSms = window.navigator.mozSms; +let manager = window.navigator.mozMobileMessage; tasks.push(function () { - log("Checking mozSms."); - ok(mozSms instanceof MozSmsManager); + log("Verifying initial state."); + ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); tasks.next(); }); diff --git a/dom/mobilemessage/tests/marionette/test_segment_info.js b/dom/mobilemessage/tests/marionette/test_segment_info.js index 309863303e70..9ebeb512fd7c 100644 --- a/dom/mobilemessage/tests/marionette/test_segment_info.js +++ b/dom/mobilemessage/tests/marionette/test_segment_info.js @@ -15,8 +15,9 @@ let currentStrict7BitEncoding = false; SpecialPowers.setBoolPref("dom.sms.strict7BitEncoding", currentStrict7BitEncoding); SpecialPowers.addPermission("sms", true, document); -let sms = window.navigator.mozSms; -ok(sms instanceof MozSmsManager); +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); function times(str, n) { return (new Array(n + 1)).join(str); @@ -28,7 +29,7 @@ function doTest(text, strict7BitEncoding, expected) { SpecialPowers.setBoolPref("dom.sms.strict7BitEncoding", currentStrict7BitEncoding); } - let result = sms.getSegmentInfoForText(text); + let result = manager.getSegmentInfoForText(text); ok(result, "result of GetSegmentInfoForText is valid"); is(result.segments, expected[0], "segments"); is(result.charsPerSegment, expected[1], "charsPerSegment"); diff --git a/dom/mobilemessage/tests/marionette/test_strict_7bit_encoding.js b/dom/mobilemessage/tests/marionette/test_strict_7bit_encoding.js index f4e230aa1380..42f184cd0abf 100644 --- a/dom/mobilemessage/tests/marionette/test_strict_7bit_encoding.js +++ b/dom/mobilemessage/tests/marionette/test_strict_7bit_encoding.js @@ -127,8 +127,9 @@ const SELF = "5554"; SpecialPowers.setBoolPref("dom.sms.enabled", true); SpecialPowers.addPermission("sms", true, document); -let sms = window.navigator.mozSms; -ok(sms instanceof MozSmsManager); +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); let tasks = { // List of test fuctions. Each of them should call |tasks.next()| when @@ -178,7 +179,7 @@ function testStrict7BitEncodingHelper(sent, received) { } } - sms.addEventListener("received", function onReceived(event) { + manager.addEventListener("received", function onReceived(event) { event.target.removeEventListener("received", onReceived); let message = event.message; @@ -187,7 +188,7 @@ function testStrict7BitEncodingHelper(sent, received) { done(1); }); - let request = sms.send(SELF, sent); + let request = manager.send(SELF, sent); request.addEventListener("success", function onRequestSuccess(event) { let message = event.target.result; is(message.body, sent, "sent message.body"); diff --git a/dom/mobilemessage/tests/marionette/test_update_thread_record_in_delete.js b/dom/mobilemessage/tests/marionette/test_update_thread_record_in_delete.js index 5f2dd5f41e1b..071c9cea19f7 100644 --- a/dom/mobilemessage/tests/marionette/test_update_thread_record_in_delete.js +++ b/dom/mobilemessage/tests/marionette/test_update_thread_record_in_delete.js @@ -10,8 +10,9 @@ const MSGS = 3; SpecialPowers.addPermission("sms", true, document); SpecialPowers.setBoolPref("dom.sms.enabled", true); -let mozSms = window.navigator.mozSms; -ok(mozSms instanceof MozSmsManager); +let manager = window.navigator.mozMobileMessage; +ok(manager instanceof MozMobileMessageManager, + "manager is instance of " + manager.constructor); let pendingEmulatorCmdCount = 0; function sendSmsToEmulator(from, text) { @@ -63,7 +64,7 @@ function getAllMessages(callback, filter, reverse) { filter = new MozSmsFilter; } let messages = []; - let cursor = mozSms.getMessages(filter, reverse || false); + let cursor = manager.getMessages(filter, reverse || false); cursor.onsuccess = function(event) { if (!this.done) { messages.push(this.result); @@ -77,7 +78,7 @@ function getAllMessages(callback, filter, reverse) { function getAllThreads(callback) { let threads = []; - let cursor = mozSms.getThreads(); + let cursor = manager.getThreads(); cursor.onsuccess = function(event) { if (!this.done) { threads.push(this.result); @@ -98,7 +99,7 @@ function deleteAllMessages() { return; } - let request = mozSms.delete(message.id); + let request = manager.delete(message.id); request.onsuccess = deleteAll.bind(null, messages); request.onerror = function (event) { ok(false, "failed to delete all messages"); @@ -125,7 +126,7 @@ tasks.push(getAllThreads.bind(null, function (threads) { let gotMessagesCount = 0; tasks.push(function () { - mozSms.onreceived = function () { + manager.onreceived = function () { ++gotMessagesCount; }; tasks.next(); @@ -169,7 +170,7 @@ tasks.push(getAllThreads.bind(null, function (threads) { })); tasks.push(function DeleteFirstMessage() { - let request = mozSms.delete(allMessages[0].id); + let request = manager.delete(allMessages[0].id); request.onsuccess = function () { getAllThreads(function (threads) { is(threads.length, 1, "Should have only one thread"); @@ -189,7 +190,7 @@ tasks.push(function DeleteFirstMessage() { }); tasks.push(function DeleteLastMessage() { - let request = mozSms.delete(allMessages[allMessages.length - 1].id); + let request = manager.delete(allMessages[allMessages.length - 1].id); request.onsuccess = function () { getAllThreads(function (threads) { is(threads.length, 1, "Should have only one thread"); @@ -222,7 +223,7 @@ tasks.push(function cleanUp() { return; } - mozSms.onreceived = null; + manager.onreceived = null; SpecialPowers.removePermission("sms", document); SpecialPowers.clearUserPref("dom.sms.enabled"); diff --git a/dom/mobilemessage/tests/test_sms_basics.html b/dom/mobilemessage/tests/test_sms_basics.html index 7a3dd3d46ac1..c50d53fca00a 100644 --- a/dom/mobilemessage/tests/test_sms_basics.html +++ b/dom/mobilemessage/tests/test_sms_basics.html @@ -16,9 +16,9 @@ /** Test for WebSMS **/ function checkSmsDisabled() { - ok(!('mozSms' in frames[0].navigator), "navigator.mozSms should not exist"); - ok(frames[0].navigator.mozSms === undefined, - "navigator.mozSms should return undefined"); + ok(!('mozMobileMessage' in frames[0].navigator), "navigator.mozMobileMessage should not exist"); + ok(frames[0].navigator.mozMobileMessage === undefined, + "navigator.mozMobileMessage should return undefined"); } function checkSmsEnabled() { @@ -28,9 +28,10 @@ function checkSmsEnabled() { return; } - ok('mozSms' in frames[0].navigator, "navigator.mozSms should exist"); - ok(frames[0].navigator.mozSms, "navigator.mozSms returns an object"); - ok(frames[0].navigator.mozSms instanceof MozSmsManager, "navigator.mozSms is an SmsManager object"); + ok('mozMobileMessage' in frames[0].navigator, "navigator.mozMobileMessage should exist"); + ok(frames[0].navigator.mozMobileMessage, "navigator.mozMobileMessage returns an object"); + ok(frames[0].navigator.mozMobileMessage instanceof MozMobileMessageManager, + "navigator.mozMobileMessage is an MobileMessageManager object"); } function checkInterface(aInterface) { @@ -41,7 +42,6 @@ function checkInterface(aInterface) { function test() { var gSmsEnabled = SpecialPowers.getBoolPref("dom.sms.enabled"); - checkInterface("SmsManager"); checkInterface("SmsMessage"); checkInterface("SmsEvent"); checkInterface("SmsFilter"); diff --git a/dom/permission/tests/test_sms.html b/dom/permission/tests/test_sms.html index 98a24f9539fd..5a5e11966f0b 100644 --- a/dom/permission/tests/test_sms.html +++ b/dom/permission/tests/test_sms.html @@ -20,8 +20,8 @@ var gData = [ { perm: ["sms"], needParentPerm: true, - obj: "mozSms", - idl: "nsIDOMMozSmsManager", + obj: "mozMobileMessage", + idl: "nsIDOMMozMobileMessageManager", settings: [["dom.sms.enabled", true]], }, ] diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index a3112c9ce1ac..318e887ec37d 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -270,7 +270,6 @@ var interfaceNamesInGlobalScope = "MozSettingsEvent", "MozSmsEvent", "MozSmsFilter", - "MozSmsManager", "MozSmsMessage", "MozSmsSegmentInfo", "MozTimeManager", diff --git a/dom/webidl/Navigator.webidl b/dom/webidl/Navigator.webidl index c7182f2ba0a9..e91376080db5 100644 --- a/dom/webidl/Navigator.webidl +++ b/dom/webidl/Navigator.webidl @@ -225,13 +225,6 @@ partial interface Navigator { boolean mozIsLocallyAvailable(DOMString uri, boolean whenOffline); }; -// nsIDOMMozNavigatorSms -interface MozSmsManager; -partial interface Navigator { - [Func="Navigator::HasSmsSupport"] - readonly attribute MozSmsManager? mozSms; -}; - // nsIDOMMozNavigatorMobileMessage interface MozMobileMessageManager; partial interface Navigator { From f3da9696e2a1214da2876637d2669ccf667e61a7 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Fri, 26 Jul 2013 04:00:26 -0700 Subject: [PATCH 63/92] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/afa2c9330944 Author: Cristian Rodriguez Desc: Merge pull request #11181 from crdlc/bug-hide-status-from-import-cenceled Bug 898287 - [Cancel Import] Don't show the status UI component after canceling ======== https://hg.mozilla.org/integration/gaia-central/rev/775394e3119e Author: crdlc Desc: Bug 898287 - [Cancel Import] Do not show the status UI component after canceling --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 37faa08815ee..43a55b142fa9 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "2bcf223e3a7fdb14a956ac450a1e347b2c48d8e1", + "revision": "afa2c9330944379a1dcace3858e3d31e540c3cb8", "repo_path": "/integration/gaia-central" } From 748da3298131a80f65ffe3c76f1812d702b8798f Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Fri, 26 Jul 2013 05:40:26 -0700 Subject: [PATCH 64/92] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/256e9b41093c Author: Cristian Rodriguez Desc: Merge pull request #11163 from crdlc/bug-897418 Bug 897418 ======== https://hg.mozilla.org/integration/gaia-central/rev/4fa35c669c9f Author: crdlc Desc: Bug 897418 - Merge Contacts: Implement UI for active merge when adding contact --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 43a55b142fa9..e560ed351e26 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "afa2c9330944379a1dcace3858e3d31e540c3cb8", + "revision": "256e9b41093c42c77e418e3032ec1d956f63ab1d", "repo_path": "/integration/gaia-central" } From 6035d1e15bd542b9f0dd71a96adc5f9c0c14fbe3 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Fri, 26 Jul 2013 07:21:24 -0700 Subject: [PATCH 65/92] Bumping gaia.json for 1 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/c76f17cc655c Author: Anthony Ricaud Desc: Revert "Bug 889717 - [Settings] Do not work when you are scrolling and select a menu" This reverts commit 6990d381055cafaa28995c221bb69cf4023c64b9. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index e560ed351e26..18f75c9431df 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "256e9b41093c42c77e418e3032ec1d956f63ab1d", + "revision": "c76f17cc655c7cc2bb648711f0453b4a81124bcd", "repo_path": "/integration/gaia-central" } From b64e29c81be45c08376b2acd8d65c2f0b0bcd965 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Tue, 23 Jul 2013 11:54:32 +0800 Subject: [PATCH 66/92] Bug 896353 - Set principal for mDOMStream in MediaStreamAudioDestinationNode. r=roc. --- content/media/webaudio/MediaStreamAudioDestinationNode.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/content/media/webaudio/MediaStreamAudioDestinationNode.cpp b/content/media/webaudio/MediaStreamAudioDestinationNode.cpp index 0c99d7002079..c2e2b983200f 100644 --- a/content/media/webaudio/MediaStreamAudioDestinationNode.cpp +++ b/content/media/webaudio/MediaStreamAudioDestinationNode.cpp @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "MediaStreamAudioDestinationNode.h" +#include "nsIDocument.h" #include "mozilla/dom/AudioStreamTrack.h" #include "mozilla/dom/MediaStreamAudioDestinationNodeBinding.h" #include "AudioNodeEngine.h" @@ -73,6 +74,11 @@ MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* a MediaStreamDestinationEngine* engine = new MediaStreamDestinationEngine(this, tus); mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM); mPort = tus->AllocateInputPort(mStream, 0); + + nsIDocument* doc = aContext->GetParentObject()->GetExtantDoc(); + if (doc) { + mDOMStream->CombineWithPrincipal(doc->NodePrincipal()); + } } void From dfc33dc92b16cc0c3fea601e204c24f5cc76fab7 Mon Sep 17 00:00:00 2001 From: Randy Lin Date: Fri, 26 Jul 2013 20:29:41 +0800 Subject: [PATCH 67/92] Bug 896353 - Media Recording - Can't record the mediaStream created by AudioContext. r=roc --- content/media/MediaRecorder.cpp | 6 ++++-- content/media/MediaRecorder.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/content/media/MediaRecorder.cpp b/content/media/MediaRecorder.cpp index f4a31b217a54..aad4f297824d 100644 --- a/content/media/MediaRecorder.cpp +++ b/content/media/MediaRecorder.cpp @@ -115,6 +115,9 @@ private: MediaRecorder::~MediaRecorder() { + if (mStreamPort) { + mStreamPort->Destroy(); + } if (mTrackUnionStream) { mTrackUnionStream->Destroy(); } @@ -192,8 +195,7 @@ MediaRecorder::Start(const Optional& aTimeSlice, ErrorResult& aResult) MOZ_ASSERT(mEncoder, "CreateEncoder failed"); mTrackUnionStream->SetAutofinish(true); - nsRefPtr port = - mTrackUnionStream->AllocateInputPort(mStream->GetStream(), MediaInputPort::FLAG_BLOCK_OUTPUT); + mStreamPort = mTrackUnionStream->AllocateInputPort(mStream->GetStream(), MediaInputPort::FLAG_BLOCK_OUTPUT); if (mEncoder) { mTrackUnionStream->AddListener(mEncoder); diff --git a/content/media/MediaRecorder.h b/content/media/MediaRecorder.h index 85350ae33f76..0a5e14217d86 100644 --- a/content/media/MediaRecorder.h +++ b/content/media/MediaRecorder.h @@ -110,6 +110,8 @@ protected: nsRefPtr mStream; // This media stream is used for notifying raw data to encoder and can be blocked. nsRefPtr mTrackUnionStream; + // This is used for destroing the inputport when destroy the mediaRecorder + nsRefPtr mStreamPort; // This object creates on start() and destroys in ~MediaRecorder. nsAutoPtr mEncodedBufferCache; // It specifies the container format as well as the audio and video capture formats. From 27d25f6c75333ba8ca7610729a9d20a0cf44d147 Mon Sep 17 00:00:00 2001 From: Randy Lin Date: Fri, 26 Jul 2013 10:47:56 +0800 Subject: [PATCH 68/92] Bug 896353 - Media Recording - Test case for record the MediaStream from audioContext. r=jsmith --- content/media/test/Makefile.in | 1 + ...est_mediarecorder_record_audiocontext.html | 65 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 content/media/test/test_mediarecorder_record_audiocontext.html diff --git a/content/media/test/Makefile.in b/content/media/test/Makefile.in index 9d31f65bd7f2..188115a3c9c1 100644 --- a/content/media/test/Makefile.in +++ b/content/media/test/Makefile.in @@ -116,6 +116,7 @@ MOCHITEST_FILES = \ test_video_to_canvas.html \ test_audiowrite.html \ test_mediarecorder_creation.html \ + test_mediarecorder_record_audiocontext.html \ test_mozHasAudio.html \ test_source_media.html \ test_autoplay_contentEditable.html \ diff --git a/content/media/test/test_mediarecorder_record_audiocontext.html b/content/media/test/test_mediarecorder_record_audiocontext.html new file mode 100644 index 000000000000..80ca190d5071 --- /dev/null +++ b/content/media/test/test_mediarecorder_record_audiocontext.html @@ -0,0 +1,65 @@ + + + + Test MediaRecorder Record AudioContext + + + + + + + +
+ + From d60bbc50581be60ff9998a509102cb066da5510c Mon Sep 17 00:00:00 2001 From: Martijn Wargers Date: Thu, 25 Jul 2013 22:32:17 +0200 Subject: [PATCH 69/92] Bug 896582 - Implement a workaround to bug 838726 to get a bunch of content/media mochitests running on B2G. r=jgriffin --- content/media/test/file_access_controls.html | 2 - content/media/test/manifest.js | 26 ++++---- testing/mochitest/b2g.json | 66 +++++++++++++++++++- 3 files changed, 78 insertions(+), 16 deletions(-) diff --git a/content/media/test/file_access_controls.html b/content/media/test/file_access_controls.html index 2b2979830bd6..880fc1b7b010 100644 --- a/content/media/test/file_access_controls.html +++ b/content/media/test/file_access_controls.html @@ -149,8 +149,6 @@ function nextTest() { } function done() { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - mediaTestCleanup(); opener.done(); } diff --git a/content/media/test/manifest.js b/content/media/test/manifest.js index f2fdfa4613e6..1940cb36841d 100644 --- a/content/media/test/manifest.js +++ b/content/media/test/manifest.js @@ -216,7 +216,7 @@ var gInvalidTests = [ // we've specified. function fileUriToSrc(path, mustExist) { // android mochitest doesn't support file:// - if (navigator.appVersion.indexOf("Android") != -1) + if (navigator.appVersion.indexOf("Android") != -1 || SpecialPowers.Services.appinfo.name == "B2G") return path; const Ci = SpecialPowers.Ci; @@ -691,25 +691,25 @@ function mediaTestCleanup() { var oldGStreamer = undefined; var oldOpus = undefined; - try { oldGStreamer = branch.getBoolPref("gstreamer.enabled"); } catch(ex) { } - try { oldDefault = branch.getIntPref("preload.default"); } catch(ex) { } - try { oldAuto = branch.getIntPref("preload.auto"); } catch(ex) { } - try { oldOpus = branch.getBoolPref("opus.enabled"); } catch(ex) { } + try { oldGStreamer = SpecialPowers.getBoolPref("media.gstreamer.enabled"); } catch(ex) { } + try { oldDefault = SpecialPowers.getIntPref("media.preload.default"); } catch(ex) { } + try { oldAuto = SpecialPowers.getIntPref("media.preload.auto"); } catch(ex) { } + try { oldOpus = SpecialPowers.getBoolPref("media.opus.enabled"); } catch(ex) { } - branch.setIntPref("preload.default", 2); // preload_metadata - branch.setIntPref("preload.auto", 3); // preload_enough + SpecialPowers.setIntPref("media.preload.default", 2); // preload_metadata + SpecialPowers.setIntPref("media.preload.auto", 3); // preload_enough // test opus playback iff the pref exists if (oldOpus !== undefined) - branch.setBoolPref("opus.enabled", true); + SpecialPowers.setBoolPref("media.opus.enabled", true); if (oldGStreamer !== undefined) - branch.setBoolPref("gstreamer.enabled", true); + SpecialPowers.setBoolPref("media.gstreamer.enabled", true); window.addEventListener("unload", function() { if (oldGStreamer !== undefined) - branch.setBoolPref("gstreamer.enabled", oldGStreamer); - branch.setIntPref("preload.default", oldDefault); - branch.setIntPref("preload.auto", oldAuto); + SpecialPowers.setBoolPref("media.gstreamer.enabled", oldGStreamer); + SpecialPowers.setIntPref("media.preload.default", oldDefault); + SpecialPowers.setIntPref("media.preload.auto", oldAuto); if (oldOpus !== undefined) - branch.setBoolPref("opus.enabled", oldOpus); + SpecialPowers.setBoolPref("media.opus.enabled", oldOpus); }, false); })(); diff --git a/testing/mochitest/b2g.json b/testing/mochitest/b2g.json index 1ae13a353c05..899e1c78e83b 100644 --- a/testing/mochitest/b2g.json +++ b/testing/mochitest/b2g.json @@ -9,7 +9,71 @@ "excludetests": { "content/xbl/":"", "content/xul":"", - "content/media/":"", + + "content/media/test/test_bug448534.html": "", + "content/media/test/test_bug495300.html":"", + "content/media/test/test_bug495300.html":"", + "content/media/test/test_bug463162.xhtml":"", + "content/media/test/test_bug495145.html": "timed out", + "content/media/test/test_bug686942.html": "timed out", + "content/media/test/test_bug686137.html": "TIMED_OUT", + "content/media/test/test_can_play_type.html":"timed out", + "content/media/test/test_chaining.html": "timed out", + "content/media/test/test_contentDuration1.html": "TIMED_OUT", + "content/media/test/test_contentDuration2.html": "TIMED_OUT", + "content/media/test/test_contentDuration3.html": "TIMED_OUT", + "content/media/test/test_contentDuration4.html": "TIMED_OUT", + "content/media/test/test_contentDuration5.html": "TIMED_OUT", + "content/media/test/test_contentDuration6.html": "TIMED_OUT", + "content/media/test/test_contentDuration7.html": "timed out", + "content/media/test/test_decoder_disable.html":"timed out", + "content/media/test/test_error_on_404.html": "timed out", + "content/media/test/test_fragment_noplay.html": "timed out", + "content/media/test/test_fragment_play.html": "", + "content/media/test/test_load.html": "Timed out after gizmo.mp4", + "content/media/test/test_load_candidates.html": "timed out", + "content/media/test/test_load_same_resource.html": "", + "content/media/test/test_media_selection.html": "", + "content/media/test/test_metadata.html": "", + "content/media/test/test_mozHasAudio.html": "", + "content/media/test/test_playback_rate_playpause.html": "", + "content/media/test/test_reactivate.html": "timed out in small-shot.mp3", + "content/media/test/test_referer.html":"", + "content/media/test/test_replay_metadata.html": "", + "content/media/test/test_seekable1.html": "", + "content/media/test/test_seek_out_of_range.html": "", + "content/media/test/test_seekLies.html": "", + "content/media/test/test_wave_data_s16.html": "", + "content/media/test/test_source.html": "", + "content/media/test/test_source_media.html": "", + "content/media/test/test_wave_data_u8.html": "", + + "content/media/mediasource/test/test_MediaSource.html": " ReferenceError: MediaSource is not defined", + "content/media/test/test_bug654550.html": "timed out", + "content/media/test/test_delay_load.html": "6 failures", + "content/media/test/test_info_leak.html": "2 failures", + "content/media/test/test_play_events.html": "Last event should be canplaythrough for gizmo.mp4 - got playing, expected canplaythrough", + "content/media/test/test_play_events_2.html": "Last event should be canplaythrough for gizmo.mp4 - got playing, expected canplaythrough", + "content/media/test/test_playback.html": "Test timed out", + "content/media/test/test_play_events.html": "Last event should be canplaythrough for gizmo.mp4 - got playing, expected canplaythrough", + "content/media/test/test_play_events_2.html": "Last event should be canplaythrough for gizmo.mp4 - got playing, expected canplaythrough", + "content/media/test/test_playback.html": "Test timed out", + "content/media/test/test_streams_gc.html": "Value being assigned to HTMLMediaElement.currentTime is not a finite floating-point value", + "content/media/webaudio/test/test_audioBufferSourceNodeNeutered.html": "Test timed out", + "content/media/webaudio/test/test_audioBufferSourceNodeNeutered.html": " Test timed out", + "content/media/webspeech/recognition/test/test_nested_eventloop.html": "NS_ERROR_NOT_AVAILABLE: [nsIDOMWindow.showModalDialog]", + "content/media/webspeech/synth/ipc/test/test_ipc.html": "comp.classes['@mozilla.org/special-powers-observer;1'] is undefined", + "content/media/webspeech/synth/test/test_speech_queue.html": "Test timed out", + "content/media/webspeech/synth/test/test_speech_simple.html": "Test timed out", + "content/media/test/test_framebuffer.html": "timed out", + "content/media/test/test_seekable2.html": "timed out", + "content/media/test/test_seekable3.html": "timed out", + "content/media/webspeech/recognition/test/test_recognition_service_error.html": "timed out", + "content/media/test/test_can_play_type_mpeg.html":"7 failures out of 27", + "content/media/test/test_unseekable.html":"", + "content/media/webaudio/test/test_audioBufferSourceNodeOffset.html":"", + "content/media/test/test_can_play_type_ogg.html":"", + "content/media/test/test_can_play_type_no_dash.html":"", "dom/imptests/editing/selecttest/test_addRange.html": "oom?, bug 775227", "dom/imptests/webapps/DOMCore/tests/approved/test_Range-insertNode.html":"oom?, bug 775227", From 0f836c538bd3d8ec1a9859163c08b0c3295360a0 Mon Sep 17 00:00:00 2001 From: Mihai Cirlanaru Date: Fri, 26 Jul 2013 11:20:17 -0400 Subject: [PATCH 70/92] Bug 873511 - Correctly parse 'tel:' links that contain whitespaces. r=fabrice --- b2g/components/TelURIParser.jsm | 4 ++-- b2g/components/test/unit/test_bug793310.js | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/b2g/components/TelURIParser.jsm b/b2g/components/TelURIParser.jsm index 167cd24721a4..46b0bb8fd32a 100644 --- a/b2g/components/TelURIParser.jsm +++ b/b2g/components/TelURIParser.jsm @@ -12,7 +12,7 @@ this.EXPORTED_SYMBOLS = ["TelURIParser"]; this.TelURIParser = { parseURI: function(scheme, uri) { // https://www.ietf.org/rfc/rfc2806.txt - let subscriber = uri.slice((scheme + ':').length); + let subscriber = decodeURIComponent(uri.slice((scheme + ':').length)); if (!subscriber.length) { return null; @@ -23,7 +23,7 @@ this.TelURIParser = { let len = subscriber.length; // visual-separator - let visualSeparator = [ '-', '.', '(', ')' ]; + let visualSeparator = [ ' ', '-', '.', '(', ')' ]; let digits = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' ]; let dtmfDigits = [ '*', '#', 'A', 'B', 'C', 'D' ]; let pauseCharacter = [ 'p', 'w' ]; diff --git a/b2g/components/test/unit/test_bug793310.js b/b2g/components/test/unit/test_bug793310.js index e57a80b5fe5c..2bdb8252e2da 100644 --- a/b2g/components/test/unit/test_bug793310.js +++ b/b2g/components/test/unit/test_bug793310.js @@ -5,7 +5,10 @@ function run_test() { Components.utils.import("resource:///modules/TelURIParser.jsm") // global-phone-number - do_check_eq(TelURIParser.parseURI('tel', 'tel:+1234'), '+1234'); + do_check_eq(TelURIParser.parseURI('tel', 'tel:+1234'), '+1234'); + + // global-phone-number => white space separator + do_check_eq(TelURIParser.parseURI('tel', 'tel:+123 456 789'), '+123 456 789'); // global-phone-number => ignored chars do_check_eq(TelURIParser.parseURI('tel', 'tel:+1234_123'), '+1234'); From 8f03f7324ca9eb6fff1187b95b9d6e160cf27474 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Fri, 26 Jul 2013 08:30:23 -0700 Subject: [PATCH 71/92] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/231c4ee54e5f Author: Myk Melez Desc: Merge pull request #11170 from mykmelez/master-fx-version bug 898130 - label desktop-helper as fx-compatible and set recommended maxVersion; r=vingtetun, NPOTB ======== https://hg.mozilla.org/integration/gaia-central/rev/de468c9f71d0 Author: Myk Melez Desc: label desktop-helper as fx-compatible and set recommended maxVersion --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 18f75c9431df..52eee105239b 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "c76f17cc655c7cc2bb648711f0453b4a81124bcd", + "revision": "231c4ee54e5f4f8b4596360a71ff9b0dbc13b42d", "repo_path": "/integration/gaia-central" } From f9e9397eeee0f236edaf2051908a79cf18fa7d0b Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Fri, 26 Jul 2013 09:05:25 -0700 Subject: [PATCH 72/92] Bumping gaia.json for 3 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/f930b8591991 Author: Eitan Isaacson Desc: Merge pull request #11171 from eeejay/homescreen-wheel-event Change pages with wheel event. ======== https://hg.mozilla.org/integration/gaia-central/rev/9e456d7cf9ee Author: Eitan Isaacson Desc: Bug 898155 - Change pages with wheel event. r=crdlc ======== https://hg.mozilla.org/integration/gaia-central/rev/1e5cddf78944 Author: Corey Frang Desc: Bug 897494 - [SMS] should not detect a number starting the next word for part of the phone number - r=schung * Use word boundary meta char instead of ensuring next character is not a digit - this detects this situation properly --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 52eee105239b..bcd88d4beb0c 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "231c4ee54e5f4f8b4596360a71ff9b0dbc13b42d", + "revision": "f930b859199176d0620515c828dd4629ab823344", "repo_path": "/integration/gaia-central" } From d71bec4bb0a5dd1f180b423e28457affbed89219 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Fri, 26 Jul 2013 10:20:22 -0700 Subject: [PATCH 73/92] Bumping gaia.json for 2 gaia-central revision(s) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/d337ff34f778 Author: Fernando Jiménez Moreno Desc: Merge pull request #11193 from ferjm/calllog10percent Bug 897036 - Dialer app remains at 10% loading when test_call_log_all_ca... ======== https://hg.mozilla.org/integration/gaia-central/rev/84b2f61891f7 Author: Fernando Jiménez Desc: Bug 897036 - Dialer app remains at 10% loading when test_call_log_all_calls is run. r=francisco --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index bcd88d4beb0c..c20cd25da1da 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "f930b859199176d0620515c828dd4629ab823344", + "revision": "d337ff34f77863c015f6485dff99ff6f0369473a", "repo_path": "/integration/gaia-central" } From a5e003cc23b46d2b1bb5af7b1ed467719c969bf2 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Fri, 26 Jul 2013 11:29:48 -0600 Subject: [PATCH 74/92] Bug 898021 - Mark values written to integer typed arrays as truncated, r=jandem. --- js/src/ion/MIR.h | 8 ++++++++ js/src/ion/RangeAnalysis.cpp | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/js/src/ion/MIR.h b/js/src/ion/MIR.h index 464e7b2496cc..58896a8d1dd2 100644 --- a/js/src/ion/MIR.h +++ b/js/src/ion/MIR.h @@ -5233,6 +5233,7 @@ class MStoreTypedArrayElement void setRacy() { racy_ = true; } + bool isOperandTruncated(size_t index) const; }; class MStoreTypedArrayElementHole @@ -5295,6 +5296,7 @@ class MStoreTypedArrayElementHole AliasSet getAliasSet() const { return AliasSet::Store(AliasSet::TypedArrayElement); } + bool isOperandTruncated(size_t index) const; }; // Store a value infallibly to a statically known typed array. @@ -5322,6 +5324,11 @@ class MStoreTypedArrayElementStatic : } ArrayBufferView::ViewType viewType() const { return JS_GetArrayBufferViewType(typedArray_); } + bool isFloatArray() const { + return (viewType() == TypedArrayObject::TYPE_FLOAT32 || + viewType() == TypedArrayObject::TYPE_FLOAT64); + } + void *base() const; size_t length() const; @@ -5330,6 +5337,7 @@ class MStoreTypedArrayElementStatic : AliasSet getAliasSet() const { return AliasSet::Store(AliasSet::TypedArrayElement); } + bool isOperandTruncated(size_t index) const; }; // Compute an "effective address", i.e., a compound computation of the form: diff --git a/js/src/ion/RangeAnalysis.cpp b/js/src/ion/RangeAnalysis.cpp index 0489857cbfe0..ed5bad388666 100644 --- a/js/src/ion/RangeAnalysis.cpp +++ b/js/src/ion/RangeAnalysis.cpp @@ -1824,6 +1824,24 @@ MToDouble::isOperandTruncated(size_t index) const return type() == MIRType_Int32; } +bool +MStoreTypedArrayElement::isOperandTruncated(size_t index) const +{ + return index == 2 && !isFloatArray(); +} + +bool +MStoreTypedArrayElementHole::isOperandTruncated(size_t index) const +{ + return index == 3 && !isFloatArray(); +} + +bool +MStoreTypedArrayElementStatic::isOperandTruncated(size_t index) const +{ + return index == 1 && !isFloatArray(); +} + // Ensure that all observables uses can work with a truncated // version of the |candidate|'s result. static bool From 471c3597d63ce1fb4835e904bd7decb0fabe425d Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Fri, 26 Jul 2013 10:35:22 -0700 Subject: [PATCH 75/92] Bumping gaia.json for 1 gaia-central revision(s) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/f2454e95b24f Author: Fabrice Desré Desc: Bug 895826 - followup, r=me --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index c20cd25da1da..f5cd91f550a8 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "d337ff34f77863c015f6485dff99ff6f0369473a", + "revision": "f2454e95b24f028b6ebc1b1edb880c12f80454de", "repo_path": "/integration/gaia-central" } From a62ef0e5392986e28663581807b765cfa62dbe96 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 26 Jul 2013 13:35:33 -0400 Subject: [PATCH 76/92] Bug 873083 - Skip crashtests/813372-1.html due to frequent timeouts. --- layout/base/crashtests/crashtests.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index f28627b6d5ee..7f7fee5a65b3 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -403,7 +403,7 @@ load 788360.html load 793848.html load 795646.html load 802902.html -skip-if(!gtk2Widget) load 813372-1.html # bug 873083 +skip-if(1) load 813372-1.html # bug 873083 asserts-if(gtk2Widget,0-1) load 822865.html # bug 540078 load 833604-1.html load 835056.html From 0b406f275b42e84988c09b8a6730375361545e18 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 26 Jul 2013 13:35:33 -0400 Subject: [PATCH 77/92] Bug 874073 - Skip crashtests/852293.html due to frequent timeouts. --- layout/base/crashtests/crashtests.list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index 7f7fee5a65b3..a8edff90b034 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -408,7 +408,7 @@ asserts-if(gtk2Widget,0-1) load 822865.html # bug 540078 load 833604-1.html load 835056.html load 836990-1.html -load 852293.html +skip-if(1) load 852293.html # bug 874073 load 860579-1.html pref(layers.force-active,true) load 859526-1.html pref(layers.force-active,true) load 859630-1.html From 779898a832fa94fa8e0df064b91671092dc71949 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 26 Jul 2013 13:35:33 -0400 Subject: [PATCH 78/92] Bug 895303 - Annotate test_bug893537.html for sporadic asserts. r=bz --- content/html/content/test/test_bug893537.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/html/content/test/test_bug893537.html b/content/html/content/test/test_bug893537.html index 9ca4f9780be7..5935529d8773 100644 --- a/content/html/content/test/test_bug893537.html +++ b/content/html/content/test/test_bug893537.html @@ -15,6 +15,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=893537
 
-  
-  
-
-
-
-
-
- - diff --git a/content/media/webaudio/MediaStreamAudioDestinationNode.cpp b/content/media/webaudio/MediaStreamAudioDestinationNode.cpp index c2e2b983200f..0c99d7002079 100644 --- a/content/media/webaudio/MediaStreamAudioDestinationNode.cpp +++ b/content/media/webaudio/MediaStreamAudioDestinationNode.cpp @@ -5,7 +5,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "MediaStreamAudioDestinationNode.h" -#include "nsIDocument.h" #include "mozilla/dom/AudioStreamTrack.h" #include "mozilla/dom/MediaStreamAudioDestinationNodeBinding.h" #include "AudioNodeEngine.h" @@ -74,11 +73,6 @@ MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* a MediaStreamDestinationEngine* engine = new MediaStreamDestinationEngine(this, tus); mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM); mPort = tus->AllocateInputPort(mStream, 0); - - nsIDocument* doc = aContext->GetParentObject()->GetExtantDoc(); - if (doc) { - mDOMStream->CombineWithPrincipal(doc->NodePrincipal()); - } } void From d170a8f396cbfd3afe986b044bf5a97f67022676 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Fri, 26 Jul 2013 11:25:54 -0700 Subject: [PATCH 83/92] Bug 865998: Implement WebIDL union return values r=bz --- browser/devtools/webconsole/test/Makefile.in | 2 - ...ebconsole_bug_595934_message_categories.js | 13 +- .../test/test-bug-595934-canvas.html | 15 -- .../webconsole/test/test-bug-595934-canvas.js | 11 - content/canvas/src/CanvasGradient.h | 4 - content/canvas/src/CanvasPattern.h | 3 - .../canvas/src/CanvasRenderingContext2D.cpp | 130 ++--------- content/canvas/src/CanvasRenderingContext2D.h | 62 +++--- .../html/content/src/HTMLCanvasElement.cpp | 1 + dom/bindings/Bindings.conf | 3 +- dom/bindings/Codegen.py | 204 ++++++++++++++++-- dom/bindings/parser/WebIDL.py | 2 +- dom/bindings/test/TestBindingHeader.h | 10 + dom/bindings/test/TestCodeGen.webidl | 8 + dom/bindings/test/TestExampleGen.webidl | 8 + dom/bindings/test/TestJSImplGen.webidl | 8 + dom/src/events/Makefile.in | 1 + dom/webidl/CanvasRenderingContext2D.webidl | 6 +- 18 files changed, 284 insertions(+), 207 deletions(-) delete mode 100644 browser/devtools/webconsole/test/test-bug-595934-canvas.html delete mode 100644 browser/devtools/webconsole/test/test-bug-595934-canvas.js diff --git a/browser/devtools/webconsole/test/Makefile.in b/browser/devtools/webconsole/test/Makefile.in index 2e105b0f79f6..759674abd9c5 100644 --- a/browser/devtools/webconsole/test/Makefile.in +++ b/browser/devtools/webconsole/test/Makefile.in @@ -186,8 +186,6 @@ MOCHITEST_BROWSER_FILES += \ test-bug-595934-svg.xhtml \ test-bug-595934-workers.html \ test-bug-595934-workers.js \ - test-bug-595934-canvas.html \ - test-bug-595934-canvas.js \ test-bug-595934-css-parser.html \ test-bug-595934-css-parser.css \ test-bug-595934-canvas-css.html \ diff --git a/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js b/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js index 8e00c27edeca..4b575c687caf 100644 --- a/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_595934_message_categories.js @@ -46,31 +46,26 @@ const TESTS = [ matchString: "fooBarSVG", }, { // #6 - file: "test-bug-595934-canvas.html", - category: "Canvas", - matchString: "strokeStyle", - }, - { // #7 file: "test-bug-595934-css-parser.html", category: "CSS Parser", matchString: "foobarCssParser", }, - { // #8 + { // #7 file: "test-bug-595934-malformedxml-external.html", category: "malformed-xml", matchString: "", }, - { // #9 + { // #8 file: "test-bug-595934-empty-getelementbyid.html", category: "DOM", matchString: "getElementById", }, - { // #10 + { // #9 file: "test-bug-595934-canvas-css.html", category: "CSS Parser", matchString: "foobarCanvasCssParser", }, - { // #11 + { // #10 file: "test-bug-595934-image.html", category: "Image", matchString: "corrupt", diff --git a/browser/devtools/webconsole/test/test-bug-595934-canvas.html b/browser/devtools/webconsole/test/test-bug-595934-canvas.html deleted file mode 100644 index 399b62098df6..000000000000 --- a/browser/devtools/webconsole/test/test-bug-595934-canvas.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Web Console test for bug 595934 - category: Canvas - - - - -

Web Console test for bug 595934 - category "Canvas".

-

Canvas support is required!

- - diff --git a/browser/devtools/webconsole/test/test-bug-595934-canvas.js b/browser/devtools/webconsole/test/test-bug-595934-canvas.js deleted file mode 100644 index 7d77d76962da..000000000000 --- a/browser/devtools/webconsole/test/test-bug-595934-canvas.js +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -window.addEventListener("DOMContentLoaded", function() { - var canvas = document.querySelector("canvas"); - var context = canvas.getContext("2d"); - context.strokeStyle = document; -}, false); - diff --git a/content/canvas/src/CanvasGradient.h b/content/canvas/src/CanvasGradient.h index 95721b78d538..bcc5c019170d 100644 --- a/content/canvas/src/CanvasGradient.h +++ b/content/canvas/src/CanvasGradient.h @@ -13,9 +13,6 @@ #include "mozilla/gfx/2D.h" #include "nsWrapperCache.h" -#define NS_CANVASGRADIENTAZURE_PRIVATE_IID \ - {0x28425a6a, 0x90e0, 0x4d42, {0x9c, 0x75, 0xff, 0x60, 0x09, 0xb3, 0x10, 0xa8}} - namespace mozilla { namespace dom { @@ -23,7 +20,6 @@ class CanvasGradient : public nsISupports, public nsWrapperCache { public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_CANVASGRADIENTAZURE_PRIVATE_IID) NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CanvasGradient) diff --git a/content/canvas/src/CanvasPattern.h b/content/canvas/src/CanvasPattern.h index eae5614df15d..d9d422d94eb3 100644 --- a/content/canvas/src/CanvasPattern.h +++ b/content/canvas/src/CanvasPattern.h @@ -12,8 +12,6 @@ #include "nsISupports.h" #include "nsWrapperCache.h" -#define NS_CANVASPATTERNAZURE_PRIVATE_IID \ - {0xc9bacc25, 0x28da, 0x421e, {0x9a, 0x4b, 0xbb, 0xd6, 0x93, 0x05, 0x12, 0xbc}} class nsIPrincipal; namespace mozilla { @@ -27,7 +25,6 @@ class CanvasPattern MOZ_FINAL : public nsISupports, public nsWrapperCache { public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_CANVASPATTERNAZURE_PRIVATE_IID) NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CanvasPattern) diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index 48ee4aa48f53..54ebdfd7035f 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -92,10 +92,11 @@ #include "nsJSUtils.h" #include "XPCQuickStubs.h" #include "mozilla/dom/BindingUtils.h" +#include "mozilla/dom/CanvasRenderingContext2DBinding.h" #include "mozilla/dom/HTMLImageElement.h" #include "mozilla/dom/HTMLVideoElement.h" -#include "mozilla/dom/CanvasRenderingContext2DBinding.h" #include "mozilla/dom/TextMetrics.h" +#include "mozilla/dom/UnionTypes.h" #ifdef USE_SKIA_GPU #undef free // apparently defined by some windows header, clashing with a free() @@ -400,8 +401,6 @@ CanvasGradient::AddColorStop(float offset, const nsAString& colorstr, ErrorResul mRawStops.AppendElement(newStop); } -NS_DEFINE_STATIC_IID_ACCESSOR(CanvasGradient, NS_CANVASGRADIENTAZURE_PRIVATE_IID) - NS_IMPL_CYCLE_COLLECTING_ADDREF(CanvasGradient) NS_IMPL_CYCLE_COLLECTING_RELEASE(CanvasGradient) @@ -409,12 +408,9 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(CanvasGradient, mContext) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CanvasGradient) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(mozilla::dom::CanvasGradient) NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END -NS_DEFINE_STATIC_IID_ACCESSOR(CanvasPattern, NS_CANVASPATTERNAZURE_PRIVATE_IID) - NS_IMPL_CYCLE_COLLECTING_ADDREF(CanvasPattern) NS_IMPL_CYCLE_COLLECTING_RELEASE(CanvasPattern) @@ -422,7 +418,6 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(CanvasPattern, mContext) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CanvasPattern) NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(mozilla::dom::CanvasPattern) NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END @@ -648,17 +643,6 @@ CanvasRenderingContext2D::Reset() return NS_OK; } -static void -WarnAboutUnexpectedStyle(HTMLCanvasElement* canvasElement) -{ - nsContentUtils::ReportToConsole( - nsIScriptError::warningFlag, - "Canvas", - canvasElement ? canvasElement->OwnerDoc() : nullptr, - nsContentUtils::eDOM_PROPERTIES, - "UnexpectedCanvasVariantStyle"); -} - void CanvasRenderingContext2D::SetStyleFromString(const nsAString& str, Style whichStyle) @@ -673,27 +657,18 @@ CanvasRenderingContext2D::SetStyleFromString(const nsAString& str, CurrentState().SetColorStyle(whichStyle, color); } -nsISupports* -CanvasRenderingContext2D::GetStyleAsStringOrInterface(nsAString& aStr, - CanvasMultiGetterType& aType, - Style aWhichStyle) +void +CanvasRenderingContext2D::GetStyleAsUnion(StringOrCanvasGradientOrCanvasPatternReturnValue& aValue, + Style aWhichStyle) { const ContextState &state = CurrentState(); - nsISupports* supports; if (state.patternStyles[aWhichStyle]) { - aStr.SetIsVoid(true); - supports = state.patternStyles[aWhichStyle]; - aType = CMG_STYLE_PATTERN; + aValue.SetAsCanvasPattern() = state.patternStyles[aWhichStyle]; } else if (state.gradientStyles[aWhichStyle]) { - aStr.SetIsVoid(true); - supports = state.gradientStyles[aWhichStyle]; - aType = CMG_STYLE_GRADIENT; + aValue.SetAsCanvasGradient() = state.gradientStyles[aWhichStyle]; } else { - StyleColorToString(state.colorStyles[aWhichStyle], aStr); - supports = nullptr; - aType = CMG_STYLE_STRING; + StyleColorToString(state.colorStyles[aWhichStyle], aValue.SetAsString()); } - return supports; } // static @@ -1349,92 +1324,25 @@ CanvasRenderingContext2D::GetMozCurrentTransformInverse(JSContext* cx, // void -CanvasRenderingContext2D::SetStyleFromJSValue(JSContext* cx, - JS::Handle value, - Style whichStyle) +CanvasRenderingContext2D::SetStyleFromUnion(const StringOrCanvasGradientOrCanvasPattern& value, + Style whichStyle) { - if (value.isString()) { - nsDependentJSString strokeStyle; - if (strokeStyle.init(cx, value.toString())) { - SetStyleFromString(strokeStyle, whichStyle); - } + if (value.IsString()) { + SetStyleFromString(value.GetAsString(), whichStyle); return; } - if (value.isObject()) { - nsCOMPtr holder; - - CanvasGradient* gradient; - JS::Rooted rootedVal(cx, value); - nsresult rv = xpc_qsUnwrapArg(cx, value, &gradient, - static_cast(getter_AddRefs(holder)), - rootedVal.address()); - if (NS_SUCCEEDED(rv)) { - SetStyleFromGradient(gradient, whichStyle); - return; - } - - CanvasPattern* pattern; - rv = xpc_qsUnwrapArg(cx, value, &pattern, - static_cast(getter_AddRefs(holder)), - rootedVal.address()); - if (NS_SUCCEEDED(rv)) { - SetStyleFromPattern(pattern, whichStyle); - return; - } + if (value.IsCanvasGradient()) { + SetStyleFromGradient(value.GetAsCanvasGradient(), whichStyle); + return; } - WarnAboutUnexpectedStyle(mCanvasElement); -} - -static JS::Value -WrapStyle(JSContext* cx, JSObject* objArg, - CanvasRenderingContext2D::CanvasMultiGetterType type, - nsAString& str, nsISupports* supports, ErrorResult& error) -{ - JS::Rooted v(cx); - bool ok; - switch (type) { - case CanvasRenderingContext2D::CMG_STYLE_STRING: - { - ok = xpc::StringToJsval(cx, str, v.address()); - break; - } - case CanvasRenderingContext2D::CMG_STYLE_PATTERN: - case CanvasRenderingContext2D::CMG_STYLE_GRADIENT: - { - JS::Rooted obj(cx, objArg); - ok = dom::WrapObject(cx, obj, supports, &v); - break; - } - default: - MOZ_CRASH("unexpected CanvasMultiGetterType"); + if (value.IsCanvasPattern()) { + SetStyleFromPattern(value.GetAsCanvasPattern(), whichStyle); + return; } - if (!ok) { - error.Throw(NS_ERROR_FAILURE); - } - return v; -} - -JS::Value -CanvasRenderingContext2D::GetStrokeStyle(JSContext* cx, - ErrorResult& error) -{ - nsString str; - CanvasMultiGetterType t; - nsISupports* supports = GetStyleAsStringOrInterface(str, t, STYLE_STROKE); - return WrapStyle(cx, GetWrapper(), t, str, supports, error); -} - -JS::Value -CanvasRenderingContext2D::GetFillStyle(JSContext* cx, - ErrorResult& error) -{ - nsString str; - CanvasMultiGetterType t; - nsISupports* supports = GetStyleAsStringOrInterface(str, t, STYLE_FILL); - return WrapStyle(cx, GetWrapper(), t, str, supports, error); + MOZ_ASSUME_UNREACHABLE("Invalid union value"); } void diff --git a/content/canvas/src/CanvasRenderingContext2D.h b/content/canvas/src/CanvasRenderingContext2D.h index b56777c6b0be..80148f66b331 100644 --- a/content/canvas/src/CanvasRenderingContext2D.h +++ b/content/canvas/src/CanvasRenderingContext2D.h @@ -17,7 +17,6 @@ #include "gfxFont.h" #include "mozilla/ErrorResult.h" #include "mozilla/dom/ImageData.h" -#include "mozilla/dom/UnionTypes.h" #include "mozilla/dom/CanvasGradient.h" #include "mozilla/dom/CanvasRenderingContext2DBinding.h" #include "mozilla/dom/CanvasPattern.h" @@ -31,6 +30,9 @@ class SourceSurface; } namespace dom { +class HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement; +class StringOrCanvasGradientOrCanvasPattern; +class StringOrCanvasGradientOrCanvasPatternReturnValue; class TextMetrics; extern const mozilla::gfx::Float SIGMA_MAX; @@ -47,7 +49,7 @@ class CanvasRenderingContext2D : public nsICanvasRenderingContextInternal, public nsWrapperCache { -typedef mozilla::dom::HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement +typedef HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement HTMLImageOrCanvasOrVideoElement; public: @@ -91,18 +93,25 @@ public: void GetGlobalCompositeOperation(nsAString& op, mozilla::ErrorResult& error); void SetGlobalCompositeOperation(const nsAString& op, mozilla::ErrorResult& error); - JS::Value GetStrokeStyle(JSContext* cx, mozilla::ErrorResult& error); - void SetStrokeStyle(JSContext* cx, JS::Handle value) + void GetStrokeStyle(StringOrCanvasGradientOrCanvasPatternReturnValue& value) { - SetStyleFromJSValue(cx, value, STYLE_STROKE); + GetStyleAsUnion(value, STYLE_STROKE); } - JS::Value GetFillStyle(JSContext* cx, mozilla::ErrorResult& error); - - void SetFillStyle(JSContext* cx, JS::Handle value) + void SetStrokeStyle(const StringOrCanvasGradientOrCanvasPattern& value) { - SetStyleFromJSValue(cx, value, STYLE_FILL); + SetStyleFromUnion(value, STYLE_STROKE); + } + + void GetFillStyle(StringOrCanvasGradientOrCanvasPatternReturnValue& value) + { + GetStyleAsUnion(value, STYLE_FILL); + } + + void SetFillStyle(const StringOrCanvasGradientOrCanvasPattern& value) + { + SetStyleFromUnion(value, STYLE_FILL); } already_AddRefed @@ -162,10 +171,10 @@ public: bool IsPointInPath(double x, double y, const CanvasWindingRule& winding); bool IsPointInStroke(double x, double y); void FillText(const nsAString& text, double x, double y, - const mozilla::dom::Optional& maxWidth, + const Optional& maxWidth, mozilla::ErrorResult& error); void StrokeText(const nsAString& text, double x, double y, - const mozilla::dom::Optional& maxWidth, + const Optional& maxWidth, mozilla::ErrorResult& error); TextMetrics* MeasureText(const nsAString& rawText, mozilla::ErrorResult& error); @@ -190,18 +199,18 @@ public: DrawImage(image, sx, sy, sw, sh, dx, dy, dw, dh, 6, error); } - already_AddRefed + already_AddRefed CreateImageData(JSContext* cx, double sw, double sh, mozilla::ErrorResult& error); - already_AddRefed - CreateImageData(JSContext* cx, mozilla::dom::ImageData& imagedata, + already_AddRefed + CreateImageData(JSContext* cx, ImageData& imagedata, mozilla::ErrorResult& error); - already_AddRefed + already_AddRefed GetImageData(JSContext* cx, double sx, double sy, double sw, double sh, mozilla::ErrorResult& error); - void PutImageData(mozilla::dom::ImageData& imageData, + void PutImageData(ImageData& imageData, double dx, double dy, mozilla::ErrorResult& error); - void PutImageData(mozilla::dom::ImageData& imageData, + void PutImageData(ImageData& imageData, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight, mozilla::ErrorResult& error); @@ -271,7 +280,7 @@ public: void LineTo(double x, double y) { EnsureWritablePath(); - + LineTo(mozilla::gfx::Point(ToFloat(x), ToFloat(y))); } @@ -474,21 +483,22 @@ protected: static mozilla::gfx::DrawTarget* sErrorTarget; // Some helpers. Doesn't modify a color on failure. - void SetStyleFromJSValue(JSContext* cx, JS::Handle value, - Style whichStyle); + void SetStyleFromUnion(const StringOrCanvasGradientOrCanvasPattern& value, + Style whichStyle); void SetStyleFromString(const nsAString& str, Style whichStyle); - void SetStyleFromGradient(CanvasGradient *gradient, Style whichStyle) + void SetStyleFromGradient(CanvasGradient& gradient, Style whichStyle) { - CurrentState().SetGradientStyle(whichStyle, gradient); + CurrentState().SetGradientStyle(whichStyle, &gradient); } - void SetStyleFromPattern(CanvasPattern *pattern, Style whichStyle) + void SetStyleFromPattern(CanvasPattern& pattern, Style whichStyle) { - CurrentState().SetPatternStyle(whichStyle, pattern); + CurrentState().SetPatternStyle(whichStyle, &pattern); } - nsISupports* GetStyleAsStringOrInterface(nsAString& aStr, CanvasMultiGetterType& aType, Style aWhichStyle); + void GetStyleAsUnion(StringOrCanvasGradientOrCanvasPatternReturnValue& aValue, + Style aWhichStyle); // Returns whether a color was successfully parsed. bool ParseColor(const nsAString& aString, nscolor* aColor); @@ -716,7 +726,7 @@ protected: nsresult DrawOrMeasureText(const nsAString& text, float x, float y, - const mozilla::dom::Optional& maxWidth, + const Optional& maxWidth, TextDrawOperation op, float* aWidth); diff --git a/content/html/content/src/HTMLCanvasElement.cpp b/content/html/content/src/HTMLCanvasElement.cpp index dc8267b4e36a..28a4d30994b2 100644 --- a/content/html/content/src/HTMLCanvasElement.cpp +++ b/content/html/content/src/HTMLCanvasElement.cpp @@ -13,6 +13,7 @@ #include "mozilla/CheckedInt.h" #include "mozilla/dom/CanvasRenderingContext2D.h" #include "mozilla/dom/HTMLCanvasElementBinding.h" +#include "mozilla/dom/UnionTypes.h" #include "mozilla/gfx/Rect.h" #include "mozilla/Preferences.h" #include "mozilla/Telemetry.h" diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 4fa9bff6e094..90fc003ed2f6 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -159,8 +159,7 @@ DOMInterfaces = { 'CanvasRenderingContext2D': { 'implicitJSContext': [ - 'createImageData', 'getImageData', 'strokeStyle', - 'fillStyle', 'mozDash' + 'createImageData', 'getImageData', 'mozDash' ], 'resultNotAddRefed': [ 'canvas', 'measureText' ], 'binaryNames': { diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 13e3ba1789cd..3933108f36a1 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -9,6 +9,7 @@ import os import re import string import math +import itertools from WebIDL import BuiltinTypes, IDLBuiltinType, IDLNullValue, IDLSequenceType, IDLType from Configuration import NoSuchDescriptorError, getTypesFromDescriptor, getTypesFromDictionary, getTypesFromCallback, Descriptor @@ -735,6 +736,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, config): implheaders = set(["UnionTypes.h"]) declarations = set() unionStructs = dict() + unionReturnValues = dict() def addInfoForType(t, descriptor=None, dictionary=None): """ @@ -751,6 +753,10 @@ def UnionTypes(descriptors, dictionaries, callbacks, config): config) # FIXME: Unions are broken in workers. See bug 809899. unionStructs[name] = CGUnionStruct(t, providers[0]) + # Unions cannot contain JSObject*. + if not any(member.isObject() or member.isSpiderMonkeyInterface() for member in t.flatMemberTypes): + unionReturnValues[name] = CGUnionReturnValueStruct(t, providers[0]) + for f in t.flatMemberTypes: f = f.unroll() if f.isInterface(): @@ -772,7 +778,8 @@ def UnionTypes(descriptors, dictionaries, callbacks, config): callForEachType(descriptors, dictionaries, callbacks, addInfoForType) return (headers, implheaders, declarations, - CGList(SortedDictValues(unionStructs), "\n")) + CGList(itertools.chain(SortedDictValues(unionStructs), + SortedDictValues(unionReturnValues)), "\n")) def UnionConversions(descriptors, dictionaries, callbacks, config): """ @@ -2069,7 +2076,7 @@ def InitUnforgeablePropertiesOnObject(descriptor, obj, properties, failureReturn if len(failureReturnValue) > 0: failureReturn += " " + failureReturnValue failureReturn += ";" - + defineUnforgeables = ("if (!DefineUnforgeableAttributes(aCx, " + obj + ", %s)) {\n" " " + failureReturn + "\n" "}") @@ -2488,6 +2495,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, lenientFloatCode=None, allowTreatNonCallableAsNull=False, isCallbackReturnValue=False, + isInUnionReturnValue=False, sourceDescription="value"): """ Get a template for converting a JS value to a native object based on the @@ -3036,13 +3044,16 @@ for (uint32_t i = 0; i < length; ++i) { isCallbackReturnValue) # Sequences and non-worker callbacks have to hold a strong ref to the - # thing being passed down. Also, callback return values always end up + # thing being passed down. Union return values must hold a strong ref + # because they may be returning an addrefed pointer. + # Also, callback return values always end up # addrefing anyway, so there is no point trying to avoid it here and it # makes other things simpler since we can assume the return value is a # strong ref. forceOwningType = ((descriptor.interface.isCallback() and not descriptor.workers) or isMember or + isInUnionReturnValue or isCallbackReturnValue) typeName = descriptor.nativeType @@ -3259,6 +3270,8 @@ for (uint32_t i = 0; i < length; ++i) { if isOptional: declType = "Optional" + elif isInUnionReturnValue: + declType = "nsString" else: declType = "NonNull" @@ -4100,15 +4113,7 @@ if (!returnArray) { # NB: setValue(..., True) calls JS_WrapValue(), so is fallible return (setValue(toValue % result, wrapType), False) - if type.isUnion(): - if type.nullable(): - prefix = "%s->" - else: - prefix = "%s." - return (wrapAndSetPtr((prefix % result) + - "ToJSVal(cx, ${obj}, ${jsvalHandle})"), False) - - if not (type.isPrimitive() or type.isDictionary() or type.isDate()): + if not (type.isUnion() or type.isPrimitive() or type.isDictionary() or type.isDate()): raise TypeError("Need to learn to wrap %s" % type) if type.nullable(): @@ -4119,6 +4124,10 @@ if (!returnArray) { CGIndenter(CGGeneric(setValue("JSVAL_NULL"))).define() + "\n" + "}\n" + recTemplate, recInfal) + if type.isUnion(): + return (wrapAndSetPtr("%s.ToJSVal(cx, ${obj}, ${jsvalHandle})" % result), + False) + if type.isDictionary(): return (wrapAndSetPtr("%s.ToObject(cx, ${obj}, ${jsvalHandle})" % result), False) @@ -4322,7 +4331,10 @@ def getRetvalDeclarationForType(returnType, descriptorProvider, resultArgs = None return result, True, None, resultArgs if returnType.isUnion(): - raise TypeError("Need to sort out ownership model for union retvals"); + result = CGGeneric(returnType.unroll().name + "ReturnValue") + if returnType.nullable(): + result = CGTemplatedType("Nullable", result) + return result, True, None, None if returnType.isDate(): result = CGGeneric("Date") if returnType.nullable(): @@ -4430,7 +4442,7 @@ class CGCallGenerator(CGThing): if isFallible: self.cgRoot.prepend(CGGeneric("ErrorResult rv;")) - self.cgRoot.append(CGGeneric("rv.WouldReportJSException();")); + self.cgRoot.append(CGGeneric("rv.WouldReportJSException();")) self.cgRoot.append(CGGeneric("if (rv.Failed()) {")) self.cgRoot.append(CGIndenter(errorReport)) self.cgRoot.append(CGGeneric("}")) @@ -5839,7 +5851,7 @@ def getUnionAccessorSignatureType(type, descriptorProvider): typeName = CGTemplatedType("Nullable", typeName, isReference=True) return typeName -def getUnionTypeTemplateVars(unionType, type, descriptorProvider): +def getUnionTypeTemplateVars(unionType, type, descriptorProvider, isReturnValue=False): # For dictionaries and sequences we need to pass None as the failureCode # for getJSToNativeConversionInfo. # Also, for dictionaries we would need to handle conversion of @@ -5864,7 +5876,7 @@ return true;""" }""" % name) + tryNextCode conversionInfo = getJSToNativeConversionInfo( type, descriptorProvider, failureCode=tryNextCode, - isDefinitelyObject=True, + isDefinitelyObject=True, isInUnionReturnValue=isReturnValue, sourceDescription="member of %s" % unionType) # This is ugly, but UnionMember needs to call a constructor with no @@ -5958,7 +5970,7 @@ class CGUnionStruct(CGThing): }""" methods.extend(mapTemplate(methodTemplate, templateVars)) # Now have to be careful: we do not want the SetAsObject() method! - setterTemplate = """ ${structType}& SetAs${name}() + setterTemplate = """ ${structType}& SetAs${name}() { mType = e${name}; return mValue.m${name}.SetValue(); @@ -6020,7 +6032,7 @@ ${destructors} if self.type.hasNullableType: conversionsToJS.append(" case eNull:\n" " {\n" - " rval.set(JS::NullValue());\n" + " rval.setNull();\n" " return true;\n" " }") conversionsToJS.extend( @@ -6062,7 +6074,161 @@ ${doConversionsToJS} "jsvalHandle": "rval", "obj": "scopeObj", "result": val, - "objectCanBeNonNull": True + }) + return CGIndenter(CGList([CGGeneric("case e%(name)s:" % templateVars), + CGWrapper(CGIndenter(CGGeneric(wrapCode)), + pre="{\n", + post="\n}")], + "\n"), + 4).define() + +class CGUnionReturnValueStruct(CGThing): + def __init__(self, type, descriptorProvider): + CGThing.__init__(self) + self.type = type.unroll() + self.descriptorProvider = descriptorProvider + self.templateVars = map( + lambda t: getUnionTypeTemplateVars(self.type, t, + self.descriptorProvider, + isReturnValue=True), + self.type.flatMemberTypes) + + def declare(self): + templateVars = self.templateVars + + enumValues = [] + methods = [] + if self.type.hasNullableType: + enumValues.append("eNull") + methods.append(""" bool IsNull() const + { + return mType == eNull; + } + + bool SetNull() + { + mType = eNull; + return true; + }""") + + enumValues.extend(mapTemplate("e${name}", templateVars)) + methodTemplate = " ${structType}& SetAs${name}();" + methods.extend(mapTemplate(methodTemplate, templateVars)) + values = mapTemplate("UnionMember<${structType} > m${name};", templateVars) + return string.Template(""" +class ${structName}ReturnValue { +public: + ${structName}ReturnValue() : mType(eUninitialized) + { + } + ~${structName}ReturnValue(); + +${methods} + + bool ToJSVal(JSContext* cx, JS::Handle scopeObj, + JS::MutableHandle rval) const; + +private: + enum Type { + eUninitialized, + ${enumValues} + }; + union Value { + ${values} + }; + + Type mType; + Value mValue; +}; + +""").substitute( + { + "structName": self.type.__str__(), + "methods": "\n\n".join(methods), + "enumValues": ",\n ".join(enumValues), + "values": "\n ".join(values) + }) + + def define(self): + templateVars = self.templateVars + conversionsToJS = [] + if self.type.hasNullableType: + conversionsToJS.append(" case eNull:\n" + " {\n" + " rval.setNull();\n" + " return true;\n" + " }") + conversionsToJS.extend( + map(self.getConversionToJS, + zip(templateVars, self.type.flatMemberTypes))) + + toJSVal = string.Template(""" + +bool +${structName}ReturnValue::ToJSVal(JSContext* cx, JS::Handle scopeObj, JS::MutableHandle rval) const +{ + switch (mType) { +${doConversionsToJS} + + case eUninitialized: + { + break; + } + } + return false; +} +""").substitute({ + "structName": str(self.type), + "doConversionsToJS": "\n\n".join(conversionsToJS) + }) + templateVars = self.templateVars + + methods = [] + methodTemplate = """${structType}& +%sReturnValue::SetAs${name}() +{ + mType = e${name}; + return mValue.m${name}.SetValue(); +}""" % str(self.type) + methods.extend(mapTemplate(methodTemplate, templateVars)) + + callDestructors = [] + if self.type.hasNullableType: + callDestructors.append(" case eNull:\n" + " break;") + callDestructors.extend(mapTemplate(" case e${name}:\n" + " mValue.m${name}.Destroy();\n" + " mType = eUninitialized;\n" + " break;", templateVars)) + destructor = string.Template(""" +${structName}ReturnValue::~${structName}ReturnValue() +{ + switch (mType) { +${callDestructors} + case eUninitialized: + break; + } +} + +""").substitute( + { + "structName": self.type.__str__(), + "callDestructors": "\n".join(callDestructors), + }) + + return destructor + "\n\n".join(methods) + toJSVal + + def getConversionToJS(self, arg): + (templateVars, type) = arg + assert not type.nullable() # flatMemberTypes never has nullable types + val = "mValue.m%(name)s.Value()" % templateVars + wrapCode = wrapForType( + type, self.descriptorProvider, + { + "jsvalRef": "rval", + "jsvalHandle": "rval", + "obj": "scopeObj", + "result": val, }) return CGIndenter(CGList([CGGeneric("case e%(name)s:" % templateVars), CGWrapper(CGIndenter(CGGeneric(wrapCode)), diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index 41d836e757b6..6d0fbd8a5005 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -2504,7 +2504,7 @@ class IDLAttribute(IDLInterfaceMember): raise WebIDLError("An attribute cannot be of a sequence type", [self.location]) if self.type.isUnion(): - for f in self.type.flatMemberTypes: + for f in self.type.unroll().flatMemberTypes: if f.isDictionary(): raise WebIDLError("An attribute cannot be of a union " "type if one of its member types (or " diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h index 8973bf41bb0c..0a247de67b13 100644 --- a/dom/bindings/test/TestBindingHeader.h +++ b/dom/bindings/test/TestBindingHeader.h @@ -507,6 +507,16 @@ public: //void PassUnionWithCallback(JSContext*, const TestCallbackOrLong&); void PassUnionWithObject(JSContext*, const ObjectOrLong&); + void ReceiveUnion(const CanvasPatternOrCanvasGradientReturnValue&); + void ReceiveUnionContainingNull(const CanvasPatternOrNullOrCanvasGradientReturnValue&); + void ReceiveNullableUnion(const Nullable&); + void GetWritableUnion(const CanvasPatternOrCanvasGradientReturnValue&); + void SetWritableUnion(const CanvasPatternOrCanvasGradient&); + void GetWritableUnionContainingNull(const CanvasPatternOrNullOrCanvasGradientReturnValue&); + void SetWritableUnionContainingNull(const CanvasPatternOrNullOrCanvasGradient&); + void GetWritableNullableUnion(const Nullable&); + void SetWritableNullableUnion(const Nullable&); + // Date types void PassDate(Date); void PassNullableDate(const Nullable&); diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index 1ca795176b2d..193aaf085fe8 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -452,6 +452,14 @@ interface TestInterface { void passUnionWithObject((object or long) arg); //void passUnionWithDict((Dict or long) arg); + (CanvasPattern or CanvasGradient) receiveUnion(); + (CanvasPattern? or CanvasGradient) receiveUnionContainingNull(); + (CanvasPattern or CanvasGradient)? receiveNullableUnion(); + + attribute (CanvasPattern or CanvasGradient) writableUnion; + attribute (CanvasPattern? or CanvasGradient) writableUnionContainingNull; + attribute (CanvasPattern or CanvasGradient)? writableNullableUnion; + // Date types void passDate(Date arg); void passNullableDate(Date? arg); diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl index 4a476914e420..ee75b70e48d3 100644 --- a/dom/bindings/test/TestExampleGen.webidl +++ b/dom/bindings/test/TestExampleGen.webidl @@ -348,6 +348,14 @@ interface TestExampleInterface { void passUnionWithObject((object or long) arg); //void passUnionWithDict((Dict or long) arg); + //(CanvasPattern or CanvasGradient) receiveUnion(); + //(CanvasPattern? or CanvasGradient) receiveUnionContainingNull(); + //(CanvasPattern or CanvasGradient)? receiveNullableUnion(); + + //attribute (CanvasPattern or CanvasGradient) writableUnion; + //attribute (CanvasPattern? or CanvasGradient) writableUnionContainingNull; + //attribute (CanvasPattern or CanvasGradient)? writableNullableUnion; + // Date types void passDate(Date arg); void passNullableDate(Date? arg); diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl index 0578aa4d4952..99b755492a97 100644 --- a/dom/bindings/test/TestJSImplGen.webidl +++ b/dom/bindings/test/TestJSImplGen.webidl @@ -372,6 +372,14 @@ interface TestJSImplInterface { void passUnionWithObject((object or long) arg); //void passUnionWithDict((Dict or long) arg); + //(CanvasPattern or CanvasGradient) receiveUnion(); + //(CanvasPattern? or CanvasGradient) receiveUnionContainingNull(); + //(CanvasPattern or CanvasGradient)? receiveNullableUnion(); + + //attribute (CanvasPattern or CanvasGradient) writableUnion; + //attribute (CanvasPattern? or CanvasGradient) writableUnionContainingNull; + //attribute (CanvasPattern or CanvasGradient)? writableNullableUnion; + // Date types void passDate(Date arg); void passNullableDate(Date? arg); diff --git a/dom/src/events/Makefile.in b/dom/src/events/Makefile.in index fd9745eac083..de36ee863ec2 100644 --- a/dom/src/events/Makefile.in +++ b/dom/src/events/Makefile.in @@ -17,4 +17,5 @@ LIBXUL_LIBRARY = 1 include $(topsrcdir)/config/rules.mk INCLUDES += -I$(topsrcdir)/dom/base +INCLUDES += -I$(topsrcdir)/content/base/src diff --git a/dom/webidl/CanvasRenderingContext2D.webidl b/dom/webidl/CanvasRenderingContext2D.webidl index 418d60f991b0..34f8f1f30e96 100644 --- a/dom/webidl/CanvasRenderingContext2D.webidl +++ b/dom/webidl/CanvasRenderingContext2D.webidl @@ -46,10 +46,8 @@ interface CanvasRenderingContext2D { attribute DOMString globalCompositeOperation; // (default source-over) // colors and styles (see also the CanvasDrawingStyles interface) - [GetterThrows] - attribute any strokeStyle; // (default black) - [GetterThrows] - attribute any fillStyle; // (default black) + attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black) + attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black) [Creator] CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1); [Creator, Throws] From 97389b3a03dd8b9de7af1d63f45c24b950bf5375 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Fri, 26 Jul 2013 11:25:56 -0700 Subject: [PATCH 84/92] Bug 856472: CanvasPattern and CanvasGradient don't need to inherit nsISupports r=bz --- content/canvas/src/CanvasGradient.h | 7 +++---- content/canvas/src/CanvasPattern.h | 7 +++---- .../canvas/src/CanvasRenderingContext2D.cpp | 18 ++++-------------- dom/bindings/Bindings.conf | 8 ++++++++ 4 files changed, 18 insertions(+), 22 deletions(-) diff --git a/content/canvas/src/CanvasGradient.h b/content/canvas/src/CanvasGradient.h index bcc5c019170d..43a2dc23e05e 100644 --- a/content/canvas/src/CanvasGradient.h +++ b/content/canvas/src/CanvasGradient.h @@ -16,12 +16,11 @@ namespace mozilla { namespace dom { -class CanvasGradient : public nsISupports, - public nsWrapperCache +class CanvasGradient : public nsWrapperCache { public: - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CanvasGradient) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasGradient) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasGradient) enum Type { diff --git a/content/canvas/src/CanvasPattern.h b/content/canvas/src/CanvasPattern.h index d9d422d94eb3..9b6d630e792d 100644 --- a/content/canvas/src/CanvasPattern.h +++ b/content/canvas/src/CanvasPattern.h @@ -21,12 +21,11 @@ class SourceSurface; namespace dom { -class CanvasPattern MOZ_FINAL : public nsISupports, - public nsWrapperCache +class CanvasPattern MOZ_FINAL : public nsWrapperCache { public: - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CanvasPattern) + NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern) enum RepeatMode { diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index 54ebdfd7035f..4973288efc87 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -401,26 +401,16 @@ CanvasGradient::AddColorStop(float offset, const nsAString& colorstr, ErrorResul mRawStops.AppendElement(newStop); } -NS_IMPL_CYCLE_COLLECTING_ADDREF(CanvasGradient) -NS_IMPL_CYCLE_COLLECTING_RELEASE(CanvasGradient) +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CanvasGradient, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CanvasGradient, Release) NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(CanvasGradient, mContext) -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CanvasGradient) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END - -NS_IMPL_CYCLE_COLLECTING_ADDREF(CanvasPattern) -NS_IMPL_CYCLE_COLLECTING_RELEASE(CanvasPattern) +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(CanvasPattern, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(CanvasPattern, Release) NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(CanvasPattern, mContext) -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CanvasPattern) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) -NS_INTERFACE_MAP_END - class CanvasRenderingContext2DUserData : public LayerUserData { public: CanvasRenderingContext2DUserData(CanvasRenderingContext2D *aContext) diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 90fc003ed2f6..535cc2b51baa 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -157,6 +157,14 @@ DOMInterfaces = { 'headerFile': 'DOMCameraManager.h' }, +'CanvasGradient' : { + 'nativeOwnership': 'refcounted' +}, + +'CanvasPattern' : { + 'nativeOwnership': 'refcounted' +}, + 'CanvasRenderingContext2D': { 'implicitJSContext': [ 'createImageData', 'getImageData', 'mozDash' From 490a8fe79fb75297e2d84bd0b4dce61a1a397090 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 26 Jul 2013 11:39:33 -0700 Subject: [PATCH 85/92] Bug 898371 - Enumerate binary structs. r=nsm --- js/src/builtin/BinaryData.cpp | 91 ++++++++++++++------ js/src/builtin/BinaryData.h | 5 ++ js/src/tests/ecma_6/BinaryData/structtype.js | 5 ++ 3 files changed, 75 insertions(+), 26 deletions(-) diff --git a/js/src/builtin/BinaryData.cpp b/js/src/builtin/BinaryData.cpp index 96b72f387d95..f2547ed6734d 100644 --- a/js/src/builtin/BinaryData.cpp +++ b/js/src/builtin/BinaryData.cpp @@ -1346,7 +1346,7 @@ BinaryArray::obj_getGenericAttributes(JSContext *cx, HandleObject obj, return true; } - return false; + return false; } JSBool @@ -1455,36 +1455,36 @@ Class BinaryStruct::class_ = { BinaryStruct::obj_trace, JS_NULL_CLASS_EXT, { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + NULL, /* lookupGeneric */ + NULL, /* lookupProperty */ + NULL, /* lookupElement */ + NULL, /* lookupSpecial */ + NULL, /* defineGeneric */ + NULL, /* defineProperty */ + NULL, /* defineElement */ + NULL, /* defineSpecial */ BinaryStruct::obj_getGeneric, BinaryStruct::obj_getProperty, - NULL, - NULL, + NULL, /* getElement */ + NULL, /* getElementIfPresent */ BinaryStruct::obj_getSpecial, BinaryStruct::obj_setGeneric, BinaryStruct::obj_setProperty, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + NULL, /* setElement */ + NULL, /* setSpecial */ + NULL, /* getGenericAttributes */ + NULL, /* getPropertyAttributes */ + NULL, /* getElementAttributes */ + NULL, /* getSpecialAttributes */ + NULL, /* setGenericAttributes */ + NULL, /* setPropertyAttributes */ + NULL, /* setElementAttributes */ + NULL, /* setSpecialAttributes */ + NULL, /* deleteProperty */ + NULL, /* deleteElement */ + NULL, /* deleteSpecial */ + BinaryStruct::obj_enumerate, + NULL, /* thisObject */ } }; @@ -1817,6 +1817,45 @@ BinaryStruct::obj_trace(JSTracer *tracer, JSObject *obj) MarkObject(tracer, &type, "binarystruct.type"); } +JSBool +BinaryStruct::obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op, + MutableHandleValue statep, MutableHandleId idp) +{ + JS_ASSERT(IsBinaryStruct(obj)); + + RootedObject type(cx, GetType(obj)); + + FieldList *fieldList = static_cast(type->getPrivate()); + JS_ASSERT(fieldList); + + uint32_t index; + switch (enum_op) { + case JSENUMERATE_INIT_ALL: + case JSENUMERATE_INIT: + statep.setInt32(0); + idp.set(INT_TO_JSID(fieldList->size())); + break; + + case JSENUMERATE_NEXT: + index = static_cast(statep.toInt32()); + + if (index < fieldList->size()) { + idp.set(fieldList->at(index).name); + statep.setInt32(index + 1); + } else { + statep.setNull(); + } + + break; + + case JSENUMERATE_DESTROY: + statep.setNull(); + break; + } + + return true; +} + JSBool BinaryStruct::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, diff --git a/js/src/builtin/BinaryData.h b/js/src/builtin/BinaryData.h index cf18c3b4615a..ef8954a428ea 100644 --- a/js/src/builtin/BinaryData.h +++ b/js/src/builtin/BinaryData.h @@ -295,6 +295,11 @@ class BinaryStruct : public JSObject static void finalize(js::FreeOp *op, JSObject *obj); static void obj_trace(JSTracer *tracer, JSObject *obj); + static JSBool obj_enumerate(JSContext *cx, HandleObject obj, + JSIterateOp enum_op, + MutableHandleValue statep, + MutableHandleId idp); + static JSBool obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, MutableHandleValue vp); diff --git a/js/src/tests/ecma_6/BinaryData/structtype.js b/js/src/tests/ecma_6/BinaryData/structtype.js index 70e744efa13e..aa00f249add5 100644 --- a/js/src/tests/ecma_6/BinaryData/structtype.js +++ b/js/src/tests/ecma_6/BinaryData/structtype.js @@ -51,6 +51,11 @@ function runTests() { assertEq(civic.color.g, 255); assertEq(civic.color.b, 255); + var keys = Object.keys(civic).sort(); + assertEq(keys.length, 2); + assertEq(keys.indexOf("color"), 0); + assertEq(keys.indexOf("weight"), 1); + civic.color = {r: 255, g: 0, b: 0}; assertEq(civic.color.r, 255); assertEq(civic.color.g, 0); From af6e9daaaad785e933255596e0d55538d0435b0b Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Fri, 26 Jul 2013 14:40:04 -0400 Subject: [PATCH 86/92] Bug 865349 - Refactor B2G mochitests off automation.py and onto mozbase, r=jgriffin,ted --- testing/mochitest/Makefile.in | 3 + testing/mochitest/b2g_start_script.js | 54 ++ testing/mochitest/mochitest_options.py | 663 ++++++++++++++++++ testing/mochitest/runtests.py | 918 ++++++++----------------- testing/mochitest/runtestsb2g.py | 601 ++++------------ testing/mochitest/runtestsremote.py | 9 +- 6 files changed, 1130 insertions(+), 1118 deletions(-) create mode 100644 testing/mochitest/b2g_start_script.js create mode 100644 testing/mochitest/mochitest_options.py diff --git a/testing/mochitest/Makefile.in b/testing/mochitest/Makefile.in index 3cdfc89fc81b..bcdd31da577c 100644 --- a/testing/mochitest/Makefile.in +++ b/testing/mochitest/Makefile.in @@ -36,6 +36,7 @@ _SERV_FILES = \ runtestsb2g.py \ runtestsremote.py \ runtestsvmware.py \ + mochitest_options.py \ manifest.webapp \ $(topsrcdir)/testing/mozbase/mozdevice/mozdevice/devicemanager.py \ $(topsrcdir)/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py \ @@ -62,6 +63,7 @@ _SERV_FILES = \ android.json \ androidx86.json \ b2g.json \ + b2g_start_script.js \ root-ev-tester.crl \ intermediate-ev-tester.crl \ $(NULL) @@ -202,6 +204,7 @@ $(_DEST_DIR): stage-package: $(NSINSTALL) -D $(PKG_STAGE)/mochitest && $(NSINSTALL) -D $(PKG_STAGE)/bin/plugins && $(NSINSTALL) -D $(DIST)/plugins (cd $(DEPTH)/_tests/testing/mochitest/ && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/mochitest && tar -xf -) + @cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/mochitest @(cd $(DIST_BIN) && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_BINS)) | (cd $(PKG_STAGE)/bin && tar -xf -) @(cd $(DIST_BIN)/components && tar $(TAR_CREATE_FLAGS) - $(TEST_HARNESS_COMPONENTS)) | (cd $(PKG_STAGE)/bin/components && tar -xf -) (cd $(topsrcdir)/build/pgo/certs && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/certs && tar -xf -) diff --git a/testing/mochitest/b2g_start_script.js b/testing/mochitest/b2g_start_script.js new file mode 100644 index 000000000000..785f1ad19c65 --- /dev/null +++ b/testing/mochitest/b2g_start_script.js @@ -0,0 +1,54 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +let outOfProcess = __marionetteParams[0] +let mochitestUrl = __marionetteParams[1] + +const CHILD_SCRIPT = "chrome://specialpowers/content/specialpowers.js"; +const CHILD_SCRIPT_API = "chrome://specialpowers/content/specialpowersAPI.js"; +const CHILD_LOGGER_SCRIPT = "chrome://specialpowers/content/MozillaLogger.js"; + +let homescreen = document.getElementById('homescreen'); +let container = homescreen.contentWindow.document.getElementById('test-container'); + +function openWindow(aEvent) { + var popupIframe = aEvent.detail.frameElement; + popupIframe.setAttribute('style', 'position: absolute; left: 0; top: 300px; background: white; '); + + popupIframe.addEventListener('mozbrowserclose', function(e) { + container.parentNode.removeChild(popupIframe); + container.focus(); + }); + + // yes, the popup can call window.open too! + popupIframe.addEventListener('mozbrowseropenwindow', openWindow); + + popupIframe.addEventListener('mozbrowserloadstart', function(e) { + popupIframe.focus(); + }); + + container.parentNode.appendChild(popupIframe); +} +container.addEventListener('mozbrowseropenwindow', openWindow); + +let specialpowers = {}; +let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader); +loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.js", specialpowers); +let specialPowersObserver = new specialpowers.SpecialPowersObserver(); +specialPowersObserver.init(); + +let mm = container.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager; +mm.addMessageListener("SPPrefService", specialPowersObserver); +mm.addMessageListener("SPProcessCrashService", specialPowersObserver); +mm.addMessageListener("SPPingService", specialPowersObserver); +mm.addMessageListener("SpecialPowers.Quit", specialPowersObserver); +mm.addMessageListener("SpecialPowers.Focus", specialPowersObserver); +mm.addMessageListener("SPPermissionManager", specialPowersObserver); + +mm.loadFrameScript(CHILD_LOGGER_SCRIPT, true); +mm.loadFrameScript(CHILD_SCRIPT_API, true); +mm.loadFrameScript(CHILD_SCRIPT, true); +specialPowersObserver._isFrameScriptLoaded = true; + +container.src = mochitestUrl; diff --git a/testing/mochitest/mochitest_options.py b/testing/mochitest/mochitest_options.py new file mode 100644 index 000000000000..31fba245db74 --- /dev/null +++ b/testing/mochitest/mochitest_options.py @@ -0,0 +1,663 @@ +import optparse +import os +import sys +import tempfile + +from automation import Automation +from automationutils import addCommonOptions, isURL +from mozprofile import DEFAULT_PORTS +import moznetwork + +try: + from mozbuild.base import MozbuildObject + build_obj = MozbuildObject.from_environment() +except ImportError: + build_obj = None + +here = os.path.abspath(os.path.dirname(sys.argv[0])) + +__all__ = ["MochitestOptions", "B2GOptions"] + +VMWARE_RECORDING_HELPER_BASENAME = "vmwarerecordinghelper" + +class MochitestOptions(optparse.OptionParser): + """Usage instructions for runtests.py. + All arguments are optional. + If --chrome is specified, chrome tests will be run instead of web content tests. + If --browser-chrome is specified, browser-chrome tests will be run instead of web content tests. + See for details on the logging levels. + """ + + LOG_LEVELS = ("DEBUG", "INFO", "WARNING", "ERROR", "FATAL") + LEVEL_STRING = ", ".join(LOG_LEVELS) + mochitest_options = [ + [["--close-when-done"], + { "action": "store_true", + "dest": "closeWhenDone", + "default": False, + "help": "close the application when tests are done running", + }], + [["--appname"], + { "action": "store", + "type": "string", + "dest": "app", + "default": build_obj.get_binary_path() if build_obj is not None else None, + "help": "absolute path to application, overriding default", + }], + [["--utility-path"], + { "action": "store", + "type": "string", + "dest": "utilityPath", + "default": build_obj.bindir if build_obj is not None else None, + "help": "absolute path to directory containing utility programs (xpcshell, ssltunnel, certutil)", + }], + [["--certificate-path"], + { "action": "store", + "type": "string", + "dest": "certPath", + "help": "absolute path to directory containing certificate store to use testing profile", + "default": os.path.join(build_obj.topsrcdir, 'build', 'pgo', 'certs') if build_obj is not None else None, + }], + [["--log-file"], + { "action": "store", + "type": "string", + "dest": "logFile", + "metavar": "FILE", + "help": "file to which logging occurs", + "default": "", + }], + [["--autorun"], + { "action": "store_true", + "dest": "autorun", + "help": "start running tests when the application starts", + "default": False, + }], + [["--timeout"], + { "type": "int", + "dest": "timeout", + "help": "per-test timeout in seconds", + "default": None, + }], + [["--total-chunks"], + { "type": "int", + "dest": "totalChunks", + "help": "how many chunks to split the tests up into", + "default": None, + }], + [["--this-chunk"], + { "type": "int", + "dest": "thisChunk", + "help": "which chunk to run", + "default": None, + }], + [["--chunk-by-dir"], + { "type": "int", + "dest": "chunkByDir", + "help": "group tests together in the same chunk that are in the same top chunkByDir directories", + "default": 0, + }], + [["--shuffle"], + { "dest": "shuffle", + "action": "store_true", + "help": "randomize test order", + "default": False, + }], + [["--console-level"], + { "action": "store", + "type": "choice", + "dest": "consoleLevel", + "choices": LOG_LEVELS, + "metavar": "LEVEL", + "help": "one of %s to determine the level of console " + "logging" % LEVEL_STRING, + "default": None, + }], + [["--file-level"], + { "action": "store", + "type": "choice", + "dest": "fileLevel", + "choices": LOG_LEVELS, + "metavar": "LEVEL", + "help": "one of %s to determine the level of file " + "logging if a file has been specified, defaulting " + "to INFO" % LEVEL_STRING, + "default": "INFO", + }], + [["--chrome"], + { "action": "store_true", + "dest": "chrome", + "help": "run chrome Mochitests", + "default": False, + }], + [["--ipcplugins"], + { "action": "store_true", + "dest": "ipcplugins", + "help": "run ipcplugins Mochitests", + "default": False, + }], + [["--test-path"], + { "action": "store", + "type": "string", + "dest": "testPath", + "help": "start in the given directory's tests", + "default": "", + }], + [["--browser-chrome"], + { "action": "store_true", + "dest": "browserChrome", + "help": "run browser chrome Mochitests", + "default": False, + }], + [["--webapprt-content"], + { "action": "store_true", + "dest": "webapprtContent", + "help": "run WebappRT content tests", + "default": False, + }], + [["--webapprt-chrome"], + { "action": "store_true", + "dest": "webapprtChrome", + "help": "run WebappRT chrome tests", + "default": False, + }], + [["--a11y"], + { "action": "store_true", + "dest": "a11y", + "help": "run accessibility Mochitests", + "default": False, + }], + [["--setenv"], + { "action": "append", + "type": "string", + "dest": "environment", + "metavar": "NAME=VALUE", + "help": "sets the given variable in the application's " + "environment", + "default": [], + }], + [["--exclude-extension"], + { "action": "append", + "type": "string", + "dest": "extensionsToExclude", + "help": "excludes the given extension from being installed " + "in the test profile", + "default": [], + }], + [["--browser-arg"], + { "action": "append", + "type": "string", + "dest": "browserArgs", + "metavar": "ARG", + "help": "provides an argument to the test application", + "default": [], + }], + [["--leak-threshold"], + { "action": "store", + "type": "int", + "dest": "leakThreshold", + "metavar": "THRESHOLD", + "help": "fail if the number of bytes leaked through " + "refcounted objects (or bytes in classes with " + "MOZ_COUNT_CTOR and MOZ_COUNT_DTOR) is greater " + "than the given number", + "default": 0, + }], + [["--fatal-assertions"], + { "action": "store_true", + "dest": "fatalAssertions", + "help": "abort testing whenever an assertion is hit " + "(requires a debug build to be effective)", + "default": False, + }], + [["--extra-profile-file"], + { "action": "append", + "dest": "extraProfileFiles", + "help": "copy specified files/dirs to testing profile", + "default": [], + }], + [["--install-extension"], + { "action": "append", + "dest": "extensionsToInstall", + "help": "install the specified extension in the testing profile." + "The extension file's name should be .xpi where is" + "the extension's id as indicated in its install.rdf." + "An optional path can be specified too.", + "default": [], + }], + [["--profile-path"], + { "action": "store", + "type": "string", + "dest": "profilePath", + "help": "Directory where the profile will be stored." + "This directory will be deleted after the tests are finished", + "default": tempfile.mkdtemp(), + }], + [["--testing-modules-dir"], + { "action": "store", + "type": "string", + "dest": "testingModulesDir", + "help": "Directory where testing-only JS modules are located.", + "default": None, + }], + [["--use-vmware-recording"], + { "action": "store_true", + "dest": "vmwareRecording", + "help": "enables recording while the application is running " + "inside a VMware Workstation 7.0 or later VM", + "default": False, + }], + [["--repeat"], + { "action": "store", + "type": "int", + "dest": "repeat", + "metavar": "REPEAT", + "help": "repeats the test or set of tests the given number of times, ie: repeat: 1 will run the test twice.", + "default": 0, + }], + [["--run-until-failure"], + { "action": "store_true", + "dest": "runUntilFailure", + "help": "Run a test repeatedly and stops on the first time the test fails. " + "Only available when running a single test. Default cap is 30 runs, " + "which can be overwritten with the --repeat parameter.", + "default": False, + }], + [["--run-only-tests"], + { "action": "store", + "type": "string", + "dest": "runOnlyTests", + "help": "JSON list of tests that we only want to run, cannot be specified with --exclude-tests. [DEPRECATED- please use --test-manifest]", + "default": None, + }], + [["--exclude-tests"], + { "action": "store", + "type": "string", + "dest": "excludeTests", + "help": "JSON list of tests that we want to not run, cannot be specified with --run-only-tests. [DEPRECATED- please use --test-manifest]", + "default": None, + }], + [["--test-manifest"], + { "action": "store", + "type": "string", + "dest": "testManifest", + "help": "JSON list of tests to specify 'runtests' and 'excludetests'.", + "default": None, + }], + [["--failure-file"], + { "action": "store", + "type": "string", + "dest": "failureFile", + "help": "Filename of the output file where we can store a .json list of failures to be run in the future with --run-only-tests.", + "default": None, + }], + [["--run-slower"], + { "action": "store_true", + "dest": "runSlower", + "help": "Delay execution between test files.", + "default": False, + }], + [["--metro-immersive"], + { "action": "store_true", + "dest": "immersiveMode", + "help": "launches tests in immersive browser", + "default": False, + }], + [["--httpd-path"], + { "action": "store", + "type": "string", + "dest": "httpdPath", + "default": None, + "help": "path to the httpd.js file", + }], + [["--setpref"], + { "action": "append", + "type": "string", + "default": [], + "dest": "extraPrefs", + "metavar": "PREF=VALUE", + "help": "defines an extra user preference", + }], + ] + + def __init__(self, automation=None, **kwargs): + self._automation = automation or Automation() + optparse.OptionParser.__init__(self, **kwargs) + defaults = {} + + # we want to pass down everything from self._automation.__all__ + addCommonOptions(self, defaults=dict(zip(self._automation.__all__, + [getattr(self._automation, x) for x in self._automation.__all__]))) + + for option in self.mochitest_options: + self.add_option(*option[0], **option[1]) + + self.set_defaults(**defaults) + self.set_usage(self.__doc__) + + def verifyOptions(self, options, mochitest): + """ verify correct options and cleanup paths """ + + if options.totalChunks is not None and options.thisChunk is None: + self.error("thisChunk must be specified when totalChunks is specified") + + if options.totalChunks: + if not 1 <= options.thisChunk <= options.totalChunks: + self.error("thisChunk must be between 1 and totalChunks") + + if options.xrePath is None: + # default xrePath to the app path if not provided + # but only if an app path was explicitly provided + if options.app != self.defaults['app']: + options.xrePath = os.path.dirname(options.app) + elif build_obj is not None: + # otherwise default to dist/bin + options.xrePath = build_obj.bindir + else: + self.error("could not find xre directory, --xre-path must be specified") + + # allow relative paths + options.xrePath = mochitest.getFullPath(options.xrePath) + options.profilePath = mochitest.getFullPath(options.profilePath) + options.app = mochitest.getFullPath(options.app) + + if not os.path.exists(options.app): + msg = """\ + Error: Path %(app)s doesn't exist. + Are you executing $objdir/_tests/testing/mochitest/runtests.py?""" + self.error(msg % {"app": options.app}) + return None + + if options.utilityPath: + options.utilityPath = mochitest.getFullPath(options.utilityPath) + + if options.certPath: + options.certPath = mochitest.getFullPath(options.certPath) + + if options.symbolsPath and not isURL(options.symbolsPath): + options.symbolsPath = mochitest.getFullPath(options.symbolsPath) + + options.webServer = self._automation.DEFAULT_WEB_SERVER + options.httpPort = self._automation.DEFAULT_HTTP_PORT + options.sslPort = self._automation.DEFAULT_SSL_PORT + options.webSocketPort = self._automation.DEFAULT_WEBSOCKET_PORT + + if options.vmwareRecording: + if not self._automation.IS_WIN32: + self.error("use-vmware-recording is only supported on Windows.") + mochitest.vmwareHelperPath = os.path.join( + options.utilityPath, VMWARE_RECORDING_HELPER_BASENAME + ".dll") + if not os.path.exists(mochitest.vmwareHelperPath): + self.error("%s not found, cannot automate VMware recording." % + mochitest.vmwareHelperPath) + + if options.runOnlyTests != None and options.excludeTests != None: + self.error("We can only support --run-only-tests OR --exclude-tests, not both. Please consider using --test-manifest instead.") + + if options.testManifest != None and (options.runOnlyTests != None or options.excludeTests != None): + self.error("Please use --test-manifest only and not --run-only-tests or --exclude-tests.") + + if options.runOnlyTests: + if not os.path.exists(os.path.abspath(options.runOnlyTests)): + self.error("unable to find --run-only-tests file '%s'" % options.runOnlyTests); + options.testManifest = options.runOnlyTests + options.runOnly = True + + if options.excludeTests: + if not os.path.exists(os.path.abspath(options.excludeTests)): + self.error("unable to find --exclude-tests file '%s'" % options.excludeTests); + options.testManifest = options.excludeTests + options.runOnly = False + + if options.webapprtContent and options.webapprtChrome: + self.error("Only one of --webapprt-content and --webapprt-chrome may be given.") + + # Try to guess the testing modules directory. + # This somewhat grotesque hack allows the buildbot machines to find the + # modules directory without having to configure the buildbot hosts. This + # code should never be executed in local runs because the build system + # should always set the flag that populates this variable. If buildbot ever + # passes this argument, this code can be deleted. + if options.testingModulesDir is None: + possible = os.path.join(os.getcwd(), os.path.pardir, 'modules') + + if os.path.isdir(possible): + options.testingModulesDir = possible + + # Even if buildbot is updated, we still want this, as the path we pass in + # to the app must be absolute and have proper slashes. + if options.testingModulesDir is not None: + options.testingModulesDir = os.path.normpath(options.testingModulesDir) + + if not os.path.isabs(options.testingModulesDir): + options.testingModulesDir = os.path.abspath(options.testingModulesDir) + + if not os.path.isdir(options.testingModulesDir): + self.error('--testing-modules-dir not a directory: %s' % + options.testingModulesDir) + + options.testingModulesDir = options.testingModulesDir.replace('\\', '/') + if options.testingModulesDir[-1] != '/': + options.testingModulesDir += '/' + + if options.immersiveMode: + if not self._automation.IS_WIN32: + self.error("immersive is only supported on Windows 8 and up.") + mochitest.immersiveHelperPath = os.path.join( + options.utilityPath, "metrotestharness.exe") + if not os.path.exists(mochitest.immersiveHelperPath): + self.error("%s not found, cannot launch immersive tests." % + mochitest.immersiveHelperPath) + + if options.runUntilFailure: + if not os.path.isfile(os.path.join(mochitest.oldcwd, os.path.dirname(__file__), mochitest.getTestRoot(options), options.testPath)): + self.error("--run-until-failure can only be used together with --test-path specifying a single test.") + if not options.repeat: + options.repeat = 29 + return options + + +class B2GOptions(MochitestOptions): + b2g_options = [ + [["--b2gpath"], + { "action": "store", + "type": "string", + "dest": "b2gPath", + "help": "path to B2G repo or qemu dir", + "default": None, + }], + [["--desktop"], + { "action": "store_true", + "dest": "desktop", + "help": "Run the tests on a B2G desktop build", + "default": False, + }], + [["--marionette"], + { "action": "store", + "type": "string", + "dest": "marionette", + "help": "host:port to use when connecting to Marionette", + "default": None, + }], + [["--emulator"], + { "action": "store", + "type": "string", + "dest": "emulator", + "help": "Architecture of emulator to use: x86 or arm", + "default": None, + }], + [["--sdcard"], + { "action": "store", + "type": "string", + "dest": "sdcard", + "help": "Define size of sdcard: 1MB, 50MB...etc", + "default": "10MB", + }], + [["--no-window"], + { "action": "store_true", + "dest": "noWindow", + "help": "Pass --no-window to the emulator", + "default": False, + }], + [["--adbpath"], + { "action": "store", + "type": "string", + "dest": "adbPath", + "help": "path to adb", + "default": "adb", + }], + [["--deviceIP"], + { "action": "store", + "type": "string", + "dest": "deviceIP", + "help": "ip address of remote device to test", + "default": None, + }], + [["--devicePort"], + { "action": "store", + "type": "string", + "dest": "devicePort", + "help": "port of remote device to test", + "default": 20701, + }], + [["--remote-logfile"], + { "action": "store", + "type": "string", + "dest": "remoteLogFile", + "help": "Name of log file on the device relative to the device root. \ + PLEASE ONLY USE A FILENAME.", + "default" : None, + }], + [["--remote-webserver"], + { "action": "store", + "type": "string", + "dest": "remoteWebServer", + "help": "ip address where the remote web server is hosted at", + "default": None, + }], + [["--http-port"], + { "action": "store", + "type": "string", + "dest": "httpPort", + "help": "ip address where the remote web server is hosted at", + "default": None, + }], + [["--ssl-port"], + { "action": "store", + "type": "string", + "dest": "sslPort", + "help": "ip address where the remote web server is hosted at", + "default": None, + }], + [["--pidfile"], + { "action": "store", + "type": "string", + "dest": "pidFile", + "help": "name of the pidfile to generate", + "default": "", + }], + [["--gecko-path"], + { "action": "store", + "type": "string", + "dest": "geckoPath", + "help": "the path to a gecko distribution that should \ + be installed on the emulator prior to test", + "default": None, + }], + [["--profile"], + { "action": "store", + "type": "string", + "dest": "profile", + "help": "for desktop testing, the path to the \ + gaia profile to use", + "default": None, + }], + [["--logcat-dir"], + { "action": "store", + "type": "string", + "dest": "logcat_dir", + "help": "directory to store logcat dump files", + "default": None, + }], + [['--busybox'], + { "action": 'store', + "type": 'string', + "dest": 'busybox', + "help": "Path to busybox binary to install on device", + "default": None, + }], + [['--profile-data-dir'], + { "action": 'store', + "type": 'string', + "dest": 'profile_data_dir', + "help": "Path to a directory containing preference and other \ + data to be installed into the profile", + "default": os.path.join(here, 'profile_data'), + }], + ] + + def __init__(self): + MochitestOptions.__init__(self) + + for option in self.b2g_options: + self.add_option(*option[0], **option[1]) + + defaults = {} + defaults["httpPort"] = DEFAULT_PORTS['http'] + defaults["sslPort"] = DEFAULT_PORTS['https'] + defaults["remoteTestRoot"] = "/data/local/tests" + defaults["logFile"] = "mochitest.log" + defaults["autorun"] = True + defaults["closeWhenDone"] = True + defaults["testPath"] = "" + defaults["extensionsToExclude"] = ["specialpowers"] + self.set_defaults(**defaults) + + def verifyRemoteOptions(self, options): + if options.remoteWebServer == None: + if os.name != "nt": + options.remoteWebServer = moznetwork.get_ip() + else: + self.error("You must specify a --remote-webserver=") + options.webServer = options.remoteWebServer + + if options.geckoPath and not options.emulator: + self.error("You must specify --emulator if you specify --gecko-path") + + if options.logcat_dir and not options.emulator: + self.error("You must specify --emulator if you specify --logcat-dir") + + if not os.path.isdir(options.xrePath): + self.error("--xre-path '%s' is not a directory" % options.xrePath) + xpcshell = os.path.join(options.xrePath, 'xpcshell') + if not os.access(xpcshell, os.F_OK): + self.error('xpcshell not found at %s' % xpcshell) + if self.elf_arm(xpcshell): + self.error('--xre-path points to an ARM version of xpcshell; it ' + 'should instead point to a version that can run on ' + 'your desktop') + + if options.pidFile != "": + f = open(options.pidFile, 'w') + f.write("%s" % os.getpid()) + f.close() + + return options + + def verifyOptions(self, options, mochitest): + # since we are reusing verifyOptions, it will exit if App is not found + temp = options.app + options.app = sys.argv[0] + tempPort = options.httpPort + tempSSL = options.sslPort + tempIP = options.webServer + options = MochitestOptions.verifyOptions(self, options, mochitest) + options.webServer = tempIP + options.app = temp + options.sslPort = tempSSL + options.httpPort = tempPort + + return options + + def elf_arm(self, filename): + data = open(filename, 'rb').read(20) + return data[:4] == "\x7fELF" and ord(data[18]) == 40 # EM_ARM diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index a26c3ade513c..b1660cc62257 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -8,394 +8,27 @@ Runs the Mochitest test harness. """ from __future__ import with_statement -from datetime import datetime import optparse import os import os.path import sys import time +import traceback -SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0]))) +SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) sys.path.insert(0, SCRIPT_DIR); import shutil from urllib import quote_plus as encodeURIComponent import urllib2 -import commands from automation import Automation -from automationutils import * -import tempfile +from automationutils import getDebuggerInfo, isURL, processLeakLog +from mochitest_options import MochitestOptions -VMWARE_RECORDING_HELPER_BASENAME = "vmwarerecordinghelper" +import mozinfo +import mozlog -####################### -# COMMANDLINE OPTIONS # -####################### - -class MochitestOptions(optparse.OptionParser): - """Parses Mochitest commandline options.""" - def __init__(self, automation, scriptdir, **kwargs): - self._automation = automation - optparse.OptionParser.__init__(self, **kwargs) - defaults = {} - - # we want to pass down everything from self._automation.__all__ - addCommonOptions(self, defaults=dict(zip(self._automation.__all__, - [getattr(self._automation, x) for x in self._automation.__all__]))) - self._automation.addCommonOptions(self) - - self.add_option("--close-when-done", - action = "store_true", dest = "closeWhenDone", - help = "close the application when tests are done running") - defaults["closeWhenDone"] = False - - self.add_option("--appname", - action = "store", type = "string", dest = "app", - help = "absolute path to application, overriding default") - defaults["app"] = os.path.join(scriptdir, self._automation.DEFAULT_APP) - - self.add_option("--utility-path", - action = "store", type = "string", dest = "utilityPath", - help = "absolute path to directory containing utility programs (xpcshell, ssltunnel, certutil)") - defaults["utilityPath"] = self._automation.DIST_BIN - - self.add_option("--certificate-path", - action = "store", type = "string", dest = "certPath", - help = "absolute path to directory containing certificate store to use testing profile") - defaults["certPath"] = self._automation.CERTS_SRC_DIR - - self.add_option("--log-file", - action = "store", type = "string", - dest = "logFile", metavar = "FILE", - help = "file to which logging occurs") - defaults["logFile"] = "" - - self.add_option("--autorun", - action = "store_true", dest = "autorun", - help = "start running tests when the application starts") - defaults["autorun"] = False - - self.add_option("--timeout", - type = "int", dest = "timeout", - help = "per-test timeout in seconds") - defaults["timeout"] = None - - self.add_option("--total-chunks", - type = "int", dest = "totalChunks", - help = "how many chunks to split the tests up into") - defaults["totalChunks"] = None - - self.add_option("--this-chunk", - type = "int", dest = "thisChunk", - help = "which chunk to run") - defaults["thisChunk"] = None - - self.add_option("--chunk-by-dir", - type = "int", dest = "chunkByDir", - help = "group tests together in the same chunk that are in the same top chunkByDir directories") - defaults["chunkByDir"] = 0 - - self.add_option("--shuffle", - dest = "shuffle", - action = "store_true", - help = "randomize test order") - defaults["shuffle"] = False - - LOG_LEVELS = ("DEBUG", "INFO", "WARNING", "ERROR", "FATAL") - LEVEL_STRING = ", ".join(LOG_LEVELS) - - self.add_option("--console-level", - action = "store", type = "choice", dest = "consoleLevel", - choices = LOG_LEVELS, metavar = "LEVEL", - help = "one of %s to determine the level of console " - "logging" % LEVEL_STRING) - defaults["consoleLevel"] = None - - self.add_option("--file-level", - action = "store", type = "choice", dest = "fileLevel", - choices = LOG_LEVELS, metavar = "LEVEL", - help = "one of %s to determine the level of file " - "logging if a file has been specified, defaulting " - "to INFO" % LEVEL_STRING) - defaults["fileLevel"] = "INFO" - - self.add_option("--chrome", - action = "store_true", dest = "chrome", - help = "run chrome Mochitests") - defaults["chrome"] = False - - self.add_option("--ipcplugins", - action = "store_true", dest = "ipcplugins", - help = "run ipcplugins Mochitests") - defaults["ipcplugins"] = False - - self.add_option("--test-path", - action = "store", type = "string", dest = "testPath", - help = "start in the given directory's tests") - defaults["testPath"] = "" - - self.add_option("--browser-chrome", - action = "store_true", dest = "browserChrome", - help = "run browser chrome Mochitests") - defaults["browserChrome"] = False - - self.add_option("--webapprt-content", - action = "store_true", dest = "webapprtContent", - help = "run WebappRT content tests") - defaults["webapprtContent"] = False - - self.add_option("--webapprt-chrome", - action = "store_true", dest = "webapprtChrome", - help = "run WebappRT chrome tests") - defaults["webapprtChrome"] = False - - self.add_option("--a11y", - action = "store_true", dest = "a11y", - help = "run accessibility Mochitests"); - defaults["a11y"] = False - - self.add_option("--setenv", - action = "append", type = "string", - dest = "environment", metavar = "NAME=VALUE", - help = "sets the given variable in the application's " - "environment") - defaults["environment"] = [] - - self.add_option("--exclude-extension", - action = "append", type = "string", - dest = "extensionsToExclude", - help = "excludes the given extension from being installed " - "in the test profile") - defaults["extensionsToExclude"] = [] - - self.add_option("--browser-arg", - action = "append", type = "string", - dest = "browserArgs", metavar = "ARG", - help = "provides an argument to the test application") - defaults["browserArgs"] = [] - - self.add_option("--leak-threshold", - action = "store", type = "int", - dest = "leakThreshold", metavar = "THRESHOLD", - help = "fail if the number of bytes leaked through " - "refcounted objects (or bytes in classes with " - "MOZ_COUNT_CTOR and MOZ_COUNT_DTOR) is greater " - "than the given number") - defaults["leakThreshold"] = 0 - - self.add_option("--fatal-assertions", - action = "store_true", dest = "fatalAssertions", - help = "abort testing whenever an assertion is hit " - "(requires a debug build to be effective)") - defaults["fatalAssertions"] = False - - self.add_option("--extra-profile-file", - action = "append", dest = "extraProfileFiles", - help = "copy specified files/dirs to testing profile") - defaults["extraProfileFiles"] = [] - - self.add_option("--install-extension", - action = "append", dest = "extensionsToInstall", - help = "install the specified extension in the testing profile." - "The extension file's name should be .xpi where is" - "the extension's id as indicated in its install.rdf." - "An optional path can be specified too.") - defaults["extensionsToInstall"] = [] - - self.add_option("--profile-path", action = "store", - type = "string", dest = "profilePath", - help = "Directory where the profile will be stored." - "This directory will be deleted after the tests are finished") - defaults["profilePath"] = tempfile.mkdtemp() - - self.add_option("--testing-modules-dir", action = "store", - type = "string", dest = "testingModulesDir", - help = "Directory where testing-only JS modules are " - "located.") - defaults["testingModulesDir"] = None - - self.add_option("--use-vmware-recording", - action = "store_true", dest = "vmwareRecording", - help = "enables recording while the application is running " - "inside a VMware Workstation 7.0 or later VM") - defaults["vmwareRecording"] = False - - self.add_option("--repeat", - action = "store", type = "int", - dest = "repeat", metavar = "REPEAT", - help = "repeats the test or set of tests the given number of times, ie: repeat=1 will run the test twice.") - defaults["repeat"] = 0 - - self.add_option("--run-until-failure", - action = "store_true", dest="runUntilFailure", - help = "Run a test repeatedly and stops on the first time the test fails. " - "Only available when running a single test. Default cap is 30 runs, " - "which can be overwritten with the --repeat parameter.") - defaults["runUntilFailure"] = False - - self.add_option("--run-only-tests", - action = "store", type="string", dest = "runOnlyTests", - help = "JSON list of tests that we only want to run, cannot be specified with --exclude-tests. [DEPRECATED- please use --test-manifest]") - defaults["runOnlyTests"] = None - - self.add_option("--exclude-tests", - action = "store", type="string", dest = "excludeTests", - help = "JSON list of tests that we want to not run, cannot be specified with --run-only-tests. [DEPRECATED- please use --test-manifest]") - defaults["excludeTests"] = None - - self.add_option("--test-manifest", - action = "store", type="string", dest = "testManifest", - help = "JSON list of tests to specify 'runtests' and 'excludetests'.") - defaults["testManifest"] = None - - self.add_option("--failure-file", - action = "store", type="string", dest = "failureFile", - help = "Filename of the output file where we can store a .json list of failures to be run in the future with --run-only-tests.") - defaults["failureFile"] = None - - self.add_option("--run-slower", - action = "store_true", dest = "runSlower", - help = "Delay execution between test files.") - defaults["runSlower"] = False - - self.add_option("--metro-immersive", - action = "store_true", dest = "immersiveMode", - help = "launches tests in immersive browser") - defaults["immersiveMode"] = False - - self.add_option("--httpd-path", action = "store", - type = "string", dest = "httpdPath", - help = "path to the httpd.js file") - defaults["httpdPath"] = None - - # -h, --help are automatically handled by OptionParser - - self.set_defaults(**defaults) - - usage = """\ -Usage instructions for runtests.py. -All arguments are optional. -If --chrome is specified, chrome tests will be run instead of web content tests. -If --browser-chrome is specified, browser-chrome tests will be run instead of web content tests. -See for details on the logging levels.""" - self.set_usage(usage) - - def verifyOptions(self, options, mochitest): - """ verify correct options and cleanup paths """ - - if options.totalChunks is not None and options.thisChunk is None: - self.error("thisChunk must be specified when totalChunks is specified") - - if options.totalChunks: - if not 1 <= options.thisChunk <= options.totalChunks: - self.error("thisChunk must be between 1 and totalChunks") - - if options.xrePath is None: - # default xrePath to the app path if not provided - # but only if an app path was explicitly provided - if options.app != self.defaults['app']: - options.xrePath = os.path.dirname(options.app) - else: - # otherwise default to dist/bin - options.xrePath = self._automation.DIST_BIN - - # allow relative paths - options.xrePath = mochitest.getFullPath(options.xrePath) - - options.profilePath = mochitest.getFullPath(options.profilePath) - - options.app = mochitest.getFullPath(options.app) - if not os.path.exists(options.app): - msg = """\ - Error: Path %(app)s doesn't exist. - Are you executing $objdir/_tests/testing/mochitest/runtests.py?""" - print msg % {"app": options.app} - return None - - options.utilityPath = mochitest.getFullPath(options.utilityPath) - options.certPath = mochitest.getFullPath(options.certPath) - if options.symbolsPath and not isURL(options.symbolsPath): - options.symbolsPath = mochitest.getFullPath(options.symbolsPath) - - options.webServer = self._automation.DEFAULT_WEB_SERVER - options.httpPort = self._automation.DEFAULT_HTTP_PORT - options.sslPort = self._automation.DEFAULT_SSL_PORT - options.webSocketPort = self._automation.DEFAULT_WEBSOCKET_PORT - - if options.vmwareRecording: - if not self._automation.IS_WIN32: - self.error("use-vmware-recording is only supported on Windows.") - mochitest.vmwareHelperPath = os.path.join( - options.utilityPath, VMWARE_RECORDING_HELPER_BASENAME + ".dll") - if not os.path.exists(mochitest.vmwareHelperPath): - self.error("%s not found, cannot automate VMware recording." % - mochitest.vmwareHelperPath) - - if options.runOnlyTests != None and options.excludeTests != None: - self.error("We can only support --run-only-tests OR --exclude-tests, not both. Please consider using --test-manifest instead.") - - if options.testManifest != None and (options.runOnlyTests != None or options.excludeTests != None): - self.error("Please use --test-manifest only and not --run-only-tests or --exclude-tests.") - - if options.runOnlyTests: - if not os.path.exists(os.path.abspath(options.runOnlyTests)): - self.error("unable to find --run-only-tests file '%s'" % options.runOnlyTests); - options.testManifest = options.runOnlyTests - options.runOnly = True - - if options.excludeTests: - if not os.path.exists(os.path.abspath(options.excludeTests)): - self.error("unable to find --exclude-tests file '%s'" % options.excludeTests); - options.testManifest = options.excludeTests - options.runOnly = False - - if options.webapprtContent and options.webapprtChrome: - self.error("Only one of --webapprt-content and --webapprt-chrome may be given.") - - # Try to guess the testing modules directory. - # This somewhat grotesque hack allows the buildbot machines to find the - # modules directory without having to configure the buildbot hosts. This - # code should never be executed in local runs because the build system - # should always set the flag that populates this variable. If buildbot ever - # passes this argument, this code can be deleted. - if options.testingModulesDir is None: - possible = os.path.join(os.getcwd(), os.path.pardir, 'modules') - - if os.path.isdir(possible): - options.testingModulesDir = possible - - # Even if buildbot is updated, we still want this, as the path we pass in - # to the app must be absolute and have proper slashes. - if options.testingModulesDir is not None: - options.testingModulesDir = os.path.normpath(options.testingModulesDir) - - if not os.path.isabs(options.testingModulesDir): - options.testingModulesDir = os.path.abspath(options.testingModulesDir) - - if not os.path.isdir(options.testingModulesDir): - self.error('--testing-modules-dir not a directory: %s' % - options.testingModulesDir) - - options.testingModulesDir = options.testingModulesDir.replace('\\', '/') - if options.testingModulesDir[-1] != '/': - options.testingModulesDir += '/' - - if options.immersiveMode: - if not self._automation.IS_WIN32: - self.error("immersive is only supported on Windows 8 and up.") - mochitest.immersiveHelperPath = os.path.join( - options.utilityPath, "metrotestharness.exe") - if not os.path.exists(mochitest.immersiveHelperPath): - self.error("%s not found, cannot launch immersive tests." % - mochitest.immersiveHelperPath) - - if options.runUntilFailure: - if not os.path.isfile(os.path.join(mochitest.oldcwd, os.path.dirname(__file__), mochitest.getTestRoot(options), options.testPath)): - self.error("--run-until-failure can only be used together with --test-path specifying a single test.") - if not options.repeat: - options.repeat = 29 - - return options +log = mozlog.getLogger('Mochitest') ####################### @@ -406,24 +39,27 @@ class MochitestServer: "Web server used to serve Mochitests, for closer fidelity to the real web." def __init__(self, automation, options): - self._automation = automation - self._closeWhenDone = options.closeWhenDone - self._utilityPath = options.utilityPath - self._xrePath = options.xrePath - self._profileDir = options.profilePath - self.webServer = options.webServer - self.httpPort = options.httpPort + if isinstance(options, optparse.Values): + options = vars(options) + self._automation = automation or Automation() + self._closeWhenDone = options['closeWhenDone'] + self._utilityPath = options['utilityPath'] + self._xrePath = options['xrePath'] + self._profileDir = options['profilePath'] + self.webServer = options['webServer'] + self.httpPort = options['httpPort'] self.shutdownURL = "http://%(server)s:%(port)s/server/shutdown" % { "server" : self.webServer, "port" : self.httpPort } - self.testPrefix = "'webapprt_'" if options.webapprtContent else "undefined" - if options.httpdPath: - self._httpdPath = options.httpdPath + self.testPrefix = "'webapprt_'" if options.get('webapprtContent') else "undefined" + + if options.get('httpdPath'): + self._httpdPath = options['httpdPath'] else: self._httpdPath = '.' self._httpdPath = os.path.abspath(self._httpdPath) def start(self): "Run the Mochitest server, returning the process ID of the server." - + env = self._automation.environment(xrePath = self._xrePath) env["XPCOM_DEBUG_BREAK"] = "warn" @@ -433,7 +69,7 @@ class MochitestServer: # features. env["ASAN_OPTIONS"] = "quarantine_size=1:redzone=32" - if self._automation.IS_WIN32: + if mozinfo.isWin: env["PATH"] = env["PATH"] + ";" + self._xrePath args = ["-g", self._xrePath, @@ -446,13 +82,13 @@ class MochitestServer: "-f", "./" + "server.js"] xpcshell = os.path.join(self._utilityPath, - "xpcshell" + self._automation.BIN_SUFFIX) + "xpcshell" + mozinfo.info['bin_suffix']) self._process = self._automation.Process([xpcshell] + args, env = env) pid = self._process.pid if pid < 0: - print "Error starting server." + log.error("Error starting server.") sys.exit(2) - self._automation.log.info("INFO | runtests.py | Server pid: %d", pid) + log.info("runtests.py | Server pid: %d", pid) def ensureReady(self, timeout): assert timeout >= 0 @@ -465,7 +101,7 @@ class MochitestServer: time.sleep(1) i += 1 else: - print "Timed out while waiting for server startup." + log.error("Timed out while waiting for server startup.") self.stop() sys.exit(1) @@ -511,137 +147,48 @@ class WebSocketServer(object): self._process = self._automation.Process(cmd) pid = self._process.pid if pid < 0: - print "Error starting websocket server." + log.error("Error starting websocket server.") sys.exit(2) - self._automation.log.info("INFO | runtests.py | Websocket server pid: %d", pid) + log.info("runtests.py | Websocket server pid: %d", pid) def stop(self): self._process.kill() -class Mochitest(object): +class MochitestUtilsMixin(object): + """ + Class containing some utility functions common to both local and remote + mochitest runners + """ + + # TODO Utility classes are a code smell. This class is temporary + # and should be removed when desktop mochitests are refactored + # on top of mozbase. Each of the functions in here should + # probably live somewhere in mozbase + + oldcwd = os.getcwd() + jarDir = 'mochijar' + # Path to the test script on the server TEST_PATH = "tests" CHROME_PATH = "redirect.html" urlOpts = [] - runSSLTunnel = True - vmwareHelper = None - oldcwd = os.getcwd() - - def __init__(self, automation): - self.automation = automation - - # Max time in seconds to wait for server startup before tests will fail -- if - # this seems big, it's mostly for debug machines where cold startup - # (particularly after a build) takes forever. - if self.automation.IS_DEBUG_BUILD: - self.SERVER_STARTUP_TIMEOUT = 180 - else: - self.SERVER_STARTUP_TIMEOUT = 90 - - self.SCRIPT_DIRECTORY = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) - os.chdir(self.SCRIPT_DIRECTORY) + def __init__(self): + os.chdir(SCRIPT_DIR) + mozinfo.find_and_update_from_json(SCRIPT_DIR) def getFullPath(self, path): " Get an absolute path relative to self.oldcwd." return os.path.normpath(os.path.join(self.oldcwd, os.path.expanduser(path))) - def buildTestPath(self, options): - """ Build the url path to the specific test harness and test file or directory """ - testHost = "http://mochi.test:8888" - testURL = ("/").join([testHost, self.TEST_PATH, options.testPath]) - if os.path.isfile(os.path.join(self.oldcwd, os.path.dirname(__file__), self.TEST_PATH, options.testPath)) and options.repeat > 0: - testURL = ("/").join([testHost, self.TEST_PATH, os.path.dirname(options.testPath)]) - if options.chrome or options.a11y: - testURL = ("/").join([testHost, self.CHROME_PATH]) - elif options.browserChrome: - testURL = "about:blank" - elif options.ipcplugins: - testURL = ("/").join([testHost, self.TEST_PATH, "dom/plugins/test"]) - return testURL - - def startWebSocketServer(self, options, debuggerInfo): - """ Launch the websocket server """ - if options.webServer != '127.0.0.1': - return - - self.wsserver = WebSocketServer(self.automation, options, - self.SCRIPT_DIRECTORY, debuggerInfo) - self.wsserver.start() - - def stopWebSocketServer(self, options): - if options.webServer != '127.0.0.1': - return - - self.wsserver.stop() - - def startWebServer(self, options): - if options.webServer != '127.0.0.1': - return - - """ Create the webserver and start it up """ - self.server = MochitestServer(self.automation, options) - self.server.start() - - # If we're lucky, the server has fully started by now, and all paths are - # ready, etc. However, xpcshell cold start times suck, at least for debug - # builds. We'll try to connect to the server for awhile, and if we fail, - # we'll try to kill the server and exit with an error. - self.server.ensureReady(self.SERVER_STARTUP_TIMEOUT) - - def stopWebServer(self, options): - """ Server's no longer needed, and perhaps more importantly, anything it might - spew to console shouldn't disrupt the leak information table we print next. - """ - if options.webServer != '127.0.0.1': - return - - self.server.stop() - def getLogFilePath(self, logFile): - """ return the log file path relative to the device we are testing on, in most cases + """ return the log file path relative to the device we are testing on, in most cases it will be the full path on the local system """ return self.getFullPath(logFile) - def buildProfile(self, options): - """ create the profile and add optional chrome bits and files if requested """ - if options.browserChrome and options.timeout: - options.extraPrefs.append("testing.browserTestHarness.timeout=%d" % options.timeout) - self.automation.initializeProfile(options.profilePath, - options.extraPrefs, - useServerLocations=True, - prefsPath=os.path.join(self.SCRIPT_DIRECTORY, - 'profile_data', 'prefs_general.js')) - manifest = self.addChromeToProfile(options) - self.copyExtraFilesToProfile(options) - self.installExtensionsToProfile(options) - return manifest - - def buildBrowserEnv(self, options): - """ build the environment variables for the specific test and operating system """ - browserEnv = self.automation.environment(xrePath = options.xrePath) - - # These variables are necessary for correct application startup; change - # via the commandline at your own risk. - browserEnv["XPCOM_DEBUG_BREAK"] = "stack" - - for v in options.environment: - ix = v.find("=") - if ix <= 0: - print "Error: syntax error in --setenv=" + v - return None - browserEnv[v[:ix]] = v[ix + 1:] - - browserEnv["XPCOM_MEM_BLOAT_LOG"] = self.leak_report_file - - if options.fatalAssertions: - browserEnv["XPCOM_DEBUG_BREAK"] = "stack-and-abort" - - return browserEnv - def buildURLOptions(self, options, env): - """ Add test control options from the command line to the url + """ Add test control options from the command line to the url URL parameters to test URL: @@ -654,7 +201,7 @@ class Mochitest(object): timeout -- per-test timeout in seconds repeat -- How many times to repeat the test, ie: repeat=1 will run the test twice. """ - + # allow relative paths for logFile if options.logFile: options.logFile = self.getLogFilePath(options.logFile) @@ -698,6 +245,224 @@ class Mochitest(object): if options.runSlower: self.urlOpts.append("runSlower=true") + def buildTestPath(self, options): + """ Build the url path to the specific test harness and test file or directory """ + testHost = "http://mochi.test:8888" + testURL = ("/").join([testHost, self.TEST_PATH, options.testPath]) + if os.path.isfile(os.path.join(self.oldcwd, os.path.dirname(__file__), self.TEST_PATH, options.testPath)) and options.repeat > 0: + testURL = ("/").join([testHost, self.PLAIN_LOOP_PATH]) + if options.chrome or options.a11y: + testURL = ("/").join([testHost, self.CHROME_PATH]) + elif options.browserChrome: + testURL = "about:blank" + elif options.ipcplugins: + testURL = ("/").join([testHost, self.TEST_PATH, "dom/plugins/test"]) + return testURL + + def startWebSocketServer(self, options, debuggerInfo): + """ Launch the websocket server """ + if options.webServer != '127.0.0.1': + return + + self.wsserver = WebSocketServer(self.automation, options, + SCRIPT_DIR, debuggerInfo) + self.wsserver.start() + + def stopWebSocketServer(self, options): + if options.webServer != '127.0.0.1': + return + + self.wsserver.stop() + + def startWebServer(self, options): + if options.webServer != '127.0.0.1': + return + + """ Create the webserver and start it up """ + self.server = MochitestServer(self.automation, options) + self.server.start() + + # If we're lucky, the server has fully started by now, and all paths are + # ready, etc. However, xpcshell cold start times suck, at least for debug + # builds. We'll try to connect to the server for awhile, and if we fail, + # we'll try to kill the server and exit with an error. + self.server.ensureReady(self.SERVER_STARTUP_TIMEOUT) + + def stopWebServer(self, options): + """ Server's no longer needed, and perhaps more importantly, anything it might + spew to console shouldn't disrupt the leak information table we print next. + """ + if options.webServer != '127.0.0.1': + return + + self.server.stop() + + + def copyExtraFilesToProfile(self, options): + "Copy extra files or dirs specified on the command line to the testing profile." + for f in options.extraProfileFiles: + abspath = self.getFullPath(f) + if os.path.isfile(abspath): + shutil.copy2(abspath, options.profilePath) + elif os.path.isdir(abspath): + dest = os.path.join(options.profilePath, os.path.basename(abspath)) + shutil.copytree(abspath, dest) + else: + log.warning("runtests.py | Failed to copy %s to profile", abspath) + continue + + def copyTestsJarToProfile(self, options): + """ copy tests.jar to the profile directory so we can auto register it in the .xul harness """ + testsJarFile = os.path.join(SCRIPT_DIR, "tests.jar") + if not os.path.isfile(testsJarFile): + return False + + shutil.copy2(testsJarFile, options.profilePath) + return True + + def installChromeJar(self, chrome, options): + """ + copy mochijar directory to profile as an extension so we have chrome://mochikit for all harness code + """ + # Write chrome.manifest. + with open(os.path.join(options.profilePath, "extensions", "staged", "mochikit@mozilla.org", "chrome.manifest"), "a") as mfile: + mfile.write(chrome) + + def addChromeToProfile(self, options): + "Adds MochiKit chrome tests to the profile." + + # Create (empty) chrome directory. + chromedir = os.path.join(options.profilePath, "chrome") + os.mkdir(chromedir) + + # Write userChrome.css. + chrome = """ +@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */ +toolbar, +toolbarpalette { + background-color: rgb(235, 235, 235) !important; +} +toolbar#nav-bar { + background-image: none !important; +} +""" + with open(os.path.join(options.profilePath, "userChrome.css"), "a") as chromeFile: + chromeFile.write(chrome) + + # Call copyTestsJarToProfile(), Write tests.manifest. + manifest = os.path.join(options.profilePath, "tests.manifest") + with open(manifest, "w") as manifestFile: + if self.copyTestsJarToProfile(options): + # Register tests.jar. + manifestFile.write("content mochitests jar:tests.jar!/content/\n"); + else: + # Register chrome directory. + chrometestDir = os.path.abspath(".") + "/" + if self.automation.IS_WIN32: + chrometestDir = "file:///" + chrometestDir.replace("\\", "/") + manifestFile.write("content mochitests %s contentaccessible=yes\n" % chrometestDir) + + if options.testingModulesDir is not None: + manifestFile.write("resource testing-common file:///%s\n" % + options.testingModulesDir) + + # Call installChromeJar(). + if not os.path.isdir(os.path.join(SCRIPT_DIR, self.jarDir)): + log.testFail("invalid setup: missing mochikit extension") + return None + + # Support Firefox (browser), B2G (shell), SeaMonkey (navigator), and Webapp + # Runtime (webapp). + chrome = "" + if options.browserChrome or options.chrome or options.a11y or options.webapprtChrome: + chrome += """ +overlay chrome://browser/content/browser.xul chrome://mochikit/content/browser-test-overlay.xul +overlay chrome://browser/content/shell.xul chrome://mochikit/content/browser-test-overlay.xul +overlay chrome://navigator/content/navigator.xul chrome://mochikit/content/browser-test-overlay.xul +overlay chrome://webapprt/content/webapp.xul chrome://mochikit/content/browser-test-overlay.xul +""" + + self.installChromeJar(chrome, options) + return manifest + + + def getExtensionsToInstall(self, options): + "Return a list of extensions to install in the profile" + extensions = options.extensionsToInstall or [] + appDir = options.app[:options.app.rfind(os.sep)] if options.app else options.utilityPath + + extensionDirs = [ + # Extensions distributed with the test harness. + os.path.normpath(os.path.join(SCRIPT_DIR, "extensions")), + ] + if appDir: + # Extensions distributed with the application. + extensionDirs.append(os.path.join(appDir, "distribution", "extensions")) + + for extensionDir in extensionDirs: + if os.path.isdir(extensionDir): + for dirEntry in os.listdir(extensionDir): + if dirEntry not in options.extensionsToExclude: + path = os.path.join(extensionDir, dirEntry) + if os.path.isdir(path) or (os.path.isfile(path) and path.endswith(".xpi")): + extensions.append(path) + + # append mochikit + extensions.append(os.path.join(SCRIPT_DIR, self.jarDir)) + return extensions + + +class Mochitest(MochitestUtilsMixin): + runSSLTunnel = True + vmwareHelper = None + + def __init__(self, automation=None): + super(Mochitest, self).__init__() + self.automation = automation or Automation() + + # Max time in seconds to wait for server startup before tests will fail -- if + # this seems big, it's mostly for debug machines where cold startup + # (particularly after a build) takes forever. + if self.automation.IS_DEBUG_BUILD: + self.SERVER_STARTUP_TIMEOUT = 180 + else: + self.SERVER_STARTUP_TIMEOUT = 90 + + def buildProfile(self, options): + """ create the profile and add optional chrome bits and files if requested """ + if options.browserChrome and options.timeout: + options.extraPrefs.append("testing.browserTestHarness.timeout=%d" % options.timeout) + self.automation.initializeProfile(options.profilePath, + options.extraPrefs, + useServerLocations=True, + prefsPath=os.path.join(SCRIPT_DIR, + 'profile_data', 'prefs_general.js')) + self.copyExtraFilesToProfile(options) + self.installExtensionsToProfile(options) + return self.addChromeToProfile(options) + + def buildBrowserEnv(self, options): + """ build the environment variables for the specific test and operating system """ + browserEnv = self.automation.environment(xrePath = options.xrePath) + + # These variables are necessary for correct application startup; change + # via the commandline at your own risk. + browserEnv["XPCOM_DEBUG_BREAK"] = "stack" + + for v in options.environment: + ix = v.find("=") + if ix <= 0: + log.error("Error: syntax error in --setenv=" + v) + return None + browserEnv[v[:ix]] = v[ix + 1:] + + browserEnv["XPCOM_MEM_BLOAT_LOG"] = self.leak_report_file + + if options.fatalAssertions: + browserEnv["XPCOM_DEBUG_BREAK"] = "stack-and-abort" + + return browserEnv + def cleanup(self, manifest, options): """ remove temporary files and profile """ os.remove(manifest) @@ -709,28 +474,28 @@ class Mochitest(object): from ctypes import cdll self.vmwareHelper = cdll.LoadLibrary(self.vmwareHelperPath) if self.vmwareHelper is None: - self.automation.log.warning("WARNING | runtests.py | Failed to load " - "VMware recording helper") + log.warning("runtests.py | Failed to load " + "VMware recording helper") return - self.automation.log.info("INFO | runtests.py | Starting VMware recording.") + log.info("runtests.py | Starting VMware recording.") try: self.vmwareHelper.StartRecording() except Exception, e: - self.automation.log.warning("WARNING | runtests.py | Failed to start " - "VMware recording: (%s)" % str(e)) + log.warning("runtests.py | Failed to start " + "VMware recording: (%s)" % str(e)) self.vmwareHelper = None def stopVMwareRecording(self): """ stops recording inside VMware VM using the recording helper dll """ assert(self.automation.IS_WIN32) if self.vmwareHelper is not None: - self.automation.log.info("INFO | runtests.py | Stopping VMware " - "recording.") + log.info("runtests.py | Stopping VMware " + "recording.") try: self.vmwareHelper.StopRecording() except Exception, e: - self.automation.log.warning("WARNING | runtests.py | Failed to stop " - "VMware recording: (%s)" % str(e)) + log.warning("runtests.py | Failed to stop " + "VMware recording: (%s)" % str(e)) self.vmwareHelper = None def runTests(self, options, onLaunch=None): @@ -780,7 +545,7 @@ class Mochitest(object): if options.vmwareRecording: self.startVMwareRecording(options); - self.automation.log.info("INFO | runtests.py | Running tests: start.\n") + log.info("runtests.py | Running tests: start.\n") try: status = self.automation.runApp(testURL, browserEnv, options.app, options.profilePath, options.browserArgs, @@ -793,10 +558,11 @@ class Mochitest(object): timeout=timeout, onLaunch=onLaunch) except KeyboardInterrupt: - self.automation.log.info("INFO | runtests.py | Received keyboard interrupt.\n"); + log.info("runtests.py | Received keyboard interrupt.\n"); status = -1 except: - self.automation.log.exception("INFO | runtests.py | Received unexpected exception while running application\n") + traceback.print_exc() + log.error("runtests.py | Received unexpected exception while running application\n") status = 1 if options.vmwareRecording: @@ -806,7 +572,7 @@ class Mochitest(object): self.stopWebSocketServer(options) processLeakLog(self.leak_report_file, options.leakThreshold) - self.automation.log.info("\nINFO | runtests.py | Running tests: end.") + log.info("runtests.py | Running tests: end.") if manifest is not None: self.cleanup(manifest, options) @@ -849,7 +615,7 @@ class Mochitest(object): #TODO: when we upgrade to python 2.6, just use json.dumps(options.__dict__) content = "{" - content += '"testRoot": "%s", ' % (testRoot) + content += '"testRoot": "%s", ' % (testRoot) first = True for opt in options.__dict__.keys(): val = options.__dict__[opt] @@ -878,121 +644,11 @@ class Mochitest(object): return 'chrome' return self.TEST_PATH - def addChromeToProfile(self, options): - "Adds MochiKit chrome tests to the profile." - - # Create (empty) chrome directory. - chromedir = os.path.join(options.profilePath, "chrome") - os.mkdir(chromedir) - - # Write userChrome.css. - chrome = """ -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */ -toolbar, -toolbarpalette { - background-color: rgb(235, 235, 235) !important; -} -toolbar#nav-bar { - background-image: none !important; -} -""" - with open(os.path.join(options.profilePath, "userChrome.css"), "a") as chromeFile: - chromeFile.write(chrome) - - # Call copyTestsJarToProfile(), Write tests.manifest. - manifest = os.path.join(options.profilePath, "tests.manifest") - with open(manifest, "w") as manifestFile: - if self.copyTestsJarToProfile(options): - # Register tests.jar. - manifestFile.write("content mochitests jar:tests.jar!/content/\n"); - else: - # Register chrome directory. - chrometestDir = os.path.abspath(".") + "/" - if self.automation.IS_WIN32: - chrometestDir = "file:///" + chrometestDir.replace("\\", "/") - manifestFile.write("content mochitests %s contentaccessible=yes\n" % chrometestDir) - - if options.testingModulesDir is not None: - manifestFile.write("resource testing-common file:///%s\n" % - options.testingModulesDir) - - # Call installChromeJar(). - jarDir = "mochijar" - if not os.path.isdir(os.path.join(self.SCRIPT_DIRECTORY, jarDir)): - self.automation.log.warning("TEST-UNEXPECTED-FAIL | invalid setup: missing mochikit extension") - return None - - # Support Firefox (browser), B2G (shell), SeaMonkey (navigator), and Webapp - # Runtime (webapp). - chrome = "" - if options.browserChrome or options.chrome or options.a11y or options.webapprtChrome: - chrome += """ -overlay chrome://browser/content/browser.xul chrome://mochikit/content/browser-test-overlay.xul -overlay chrome://browser/content/shell.xul chrome://mochikit/content/browser-test-overlay.xul -overlay chrome://navigator/content/navigator.xul chrome://mochikit/content/browser-test-overlay.xul -overlay chrome://webapprt/content/webapp.xul chrome://mochikit/content/browser-test-overlay.xul -""" - - self.installChromeJar(jarDir, chrome, options) - return manifest - - def installChromeJar(self, jarDirName, chrome, options): - """ - copy mochijar directory to profile as an extension so we have chrome://mochikit for all harness code - """ - self.automation.installExtension(os.path.join(self.SCRIPT_DIRECTORY, jarDirName), \ - options.profilePath, "mochikit@mozilla.org") - - # Write chrome.manifest. - with open(os.path.join(options.profilePath, "extensions", "staged", "mochikit@mozilla.org", "chrome.manifest"), "a") as mfile: - mfile.write(chrome) - - def copyTestsJarToProfile(self, options): - """ copy tests.jar to the profile directory so we can auto register it in the .xul harness """ - testsJarFile = os.path.join(self.SCRIPT_DIRECTORY, "tests.jar") - if not os.path.isfile(testsJarFile): - return False - - shutil.copy2(testsJarFile, options.profilePath) - return True - - def copyExtraFilesToProfile(self, options): - "Copy extra files or dirs specified on the command line to the testing profile." - for f in options.extraProfileFiles: - abspath = self.getFullPath(f) - if os.path.isfile(abspath): - shutil.copy2(abspath, options.profilePath) - elif os.path.isdir(abspath): - dest = os.path.join(options.profilePath, os.path.basename(abspath)) - shutil.copytree(abspath, dest) - else: - self.automation.log.warning("WARNING | runtests.py | Failed to copy %s to profile", abspath) - continue - - def getExtensionsToInstall(self, options): - "Return a list of extensions to install in the profile" - extensions = options.extensionsToInstall or [] - extensionDirs = [ - # Extensions distributed with the test harness. - os.path.normpath(os.path.join(self.SCRIPT_DIRECTORY, "extensions")), - # Extensions distributed with the application. - os.path.join(options.app[ : options.app.rfind(os.sep)], "distribution", "extensions") - ] - - for extensionDir in extensionDirs: - if os.path.isdir(extensionDir): - for dirEntry in os.listdir(extensionDir): - if dirEntry not in options.extensionsToExclude: - path = os.path.join(extensionDir, dirEntry) - if os.path.isdir(path) or (os.path.isfile(path) and path.endswith(".xpi")): - extensions.append(path) - return extensions - def installExtensionFromPath(self, options, path, extensionID = None): extensionPath = self.getFullPath(path) - self.automation.log.info("INFO | runtests.py | Installing extension at %s to %s." % - (extensionPath, options.profilePath)) + log.info("runtests.py | Installing extension at %s to %s." % + (extensionPath, options.profilePath)) self.automation.installExtension(extensionPath, options.profilePath, extensionID) @@ -1004,7 +660,7 @@ overlay chrome://webapprt/content/webapp.xul chrome://mochikit/content/browser-t def main(): automation = Automation() mochitest = Mochitest(automation) - parser = MochitestOptions(automation, mochitest.SCRIPT_DIRECTORY) + parser = MochitestOptions(automation) options, args = parser.parse_args() options = parser.verifyOptions(options, mochitest) @@ -1016,9 +672,9 @@ def main(): if options.symbolsPath and not isURL(options.symbolsPath): options.symbolsPath = mochitest.getFullPath(options.symbolsPath) - automation.setServerInfo(options.webServer, - options.httpPort, - options.sslPort, + automation.setServerInfo(options.webServer, + options.httpPort, + options.sslPort, options.webSocketPort) sys.exit(mochitest.runTests(options)) diff --git a/testing/mochitest/runtestsb2g.py b/testing/mochitest/runtestsb2g.py index 22ff02357996..6a06c73b3a75 100644 --- a/testing/mochitest/runtestsb2g.py +++ b/testing/mochitest/runtestsb2g.py @@ -2,8 +2,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. -import ConfigParser import os +import posixpath import shutil import sys import tempfile @@ -18,25 +18,36 @@ except ImportError: here = os.path.abspath(os.path.dirname(sys.argv[0])) sys.path.insert(0, here) -from automation import Automation -from b2gautomation import B2GRemoteAutomation, B2GDesktopAutomation -from runtests import Mochitest +from runtests import MochitestUtilsMixin from runtests import MochitestOptions from runtests import MochitestServer +from mochitest_options import B2GOptions, MochitestOptions from marionette import Marionette -from mozdevice import DeviceManagerADB, DMError -from mozprofile import Profile, Preferences +from mozdevice import DeviceManagerADB +from mozprofile import Profile, Preferences, DEFAULT_PORTS +from mozrunner import B2GRunner +import mozlog +import mozinfo +import moznetwork -class B2GMochitest(Mochitest): - def __init__(self, automation, OOP=True, profile_data_dir=None, - locations=os.path.join(here, 'server-locations.txt')): - Mochitest.__init__(self, automation) - self.OOP = OOP +log = mozlog.getLogger('Mochitest') + +class B2GMochitest(MochitestUtilsMixin): + def __init__(self, marionette, + out_of_process=True, + profile_data_dir=None, + locations=os.path.join(here, 'server-locations.txt')): + super(B2GMochitest, self).__init__() + self.marionette = marionette + self.out_of_process = out_of_process self.locations = locations self.preferences = [] self.webapps = None + self.test_script = os.path.join(here, 'b2g_start_script.js') + self.test_script_args = [self.out_of_process] + self.product = 'b2g' if profile_data_dir: self.preferences = [os.path.join(profile_data_dir, f) @@ -44,73 +55,19 @@ class B2GMochitest(Mochitest): self.webapps = [os.path.join(profile_data_dir, f) for f in os.listdir(profile_data_dir) if f.startswith('webapp')] - def setupCommonOptions(self, options): - # set the testURL - testURL = self.buildTestPath(options) - if len(self.urlOpts) > 0: - testURL += "?" + "&".join(self.urlOpts) - self.automation.testURL = testURL - - if self.OOP: - OOP_script = """ -let specialpowers = {}; -let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader); -loader.loadSubScript("chrome://specialpowers/content/SpecialPowersObserver.js", specialpowers); -let specialPowersObserver = new specialpowers.SpecialPowersObserver(); -specialPowersObserver.init(); - -let mm = container.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader.messageManager; -mm.addMessageListener("SPPrefService", specialPowersObserver); -mm.addMessageListener("SPProcessCrashService", specialPowersObserver); -mm.addMessageListener("SPPingService", specialPowersObserver); -mm.addMessageListener("SpecialPowers.Quit", specialPowersObserver); -mm.addMessageListener("SpecialPowers.Focus", specialPowersObserver); -mm.addMessageListener("SPPermissionManager", specialPowersObserver); - -mm.loadFrameScript(CHILD_LOGGER_SCRIPT, true); -mm.loadFrameScript(CHILD_SCRIPT_API, true); -mm.loadFrameScript(CHILD_SCRIPT, true); -specialPowersObserver._isFrameScriptLoaded = true; -""" + # mozinfo is populated by the parent class + if mozinfo.info['debug']: + self.SERVER_STARTUP_TIMEOUT = 180 else: - OOP_script = "" + self.SERVER_STARTUP_TIMEOUT = 90 - # Execute this script on start up: loads special powers and sets - # the test-container apps's iframe to the mochitest URL. - self.automation.test_script = """ -const CHILD_SCRIPT = "chrome://specialpowers/content/specialpowers.js"; -const CHILD_SCRIPT_API = "chrome://specialpowers/content/specialpowersAPI.js"; -const CHILD_LOGGER_SCRIPT = "chrome://specialpowers/content/MozillaLogger.js"; + def setup_common_options(self, options): + test_url = self.buildTestPath(options) + if len(self.urlOpts) > 0: + test_url += "?" + "&".join(self.urlOpts) + self.test_script_args.append(test_url) -let homescreen = document.getElementById('homescreen'); -let container = homescreen.contentWindow.document.getElementById('test-container'); - -function openWindow(aEvent) { - var popupIframe = aEvent.detail.frameElement; - popupIframe.setAttribute('style', 'position: absolute; left: 0; top: 300px; background: white; '); - - popupIframe.addEventListener('mozbrowserclose', function(e) { - container.parentNode.removeChild(popupIframe); - container.focus(); - }); - - // yes, the popup can call window.open too! - popupIframe.addEventListener('mozbrowseropenwindow', openWindow); - - popupIframe.addEventListener('mozbrowserloadstart', function(e) { - popupIframe.focus(); - }); - - container.parentNode.appendChild(popupIframe); -} - -container.addEventListener('mozbrowseropenwindow', openWindow); -%s - -container.src = '%s'; -""" % (OOP_script, testURL) - - def buildProfile(self, options): + def build_profile(self, options): # preferences prefs = {} for path in self.preferences: @@ -125,7 +82,7 @@ container.src = '%s'; # interpolate the preferences interpolation = { "server": "%s:%s" % (options.webServer, options.httpPort), - "OOP": "true" if self.OOP else "false" } + "OOP": "true" if self.out_of_process else "false" } prefs = json.loads(json.dumps(prefs) % interpolation) for pref in prefs: prefs[pref] = Preferences.cast(prefs[pref]) @@ -149,274 +106,74 @@ container.src = '%s'; self.copyExtraFilesToProfile(options) return manifest + def run_tests(self, options): + """ Prepare, configure, run tests and cleanup """ -class B2GOptions(MochitestOptions): + self.leak_report_file = os.path.join(options.profilePath, "runtests_leaks.log") + manifest = self.build_profile(options) - def __init__(self, automation, scriptdir, **kwargs): - defaults = {} - MochitestOptions.__init__(self, automation, scriptdir) + self.startWebServer(options) + self.startWebSocketServer(options, None) + self.buildURLOptions(options, {'MOZ_HIDE_RESULTS_TABLE': '1'}) - self.add_option("--b2gpath", action="store", - type="string", dest="b2gPath", - help="path to B2G repo or qemu dir") - defaults["b2gPath"] = None + if options.timeout: + timeout = options.timeout + 30 + elif options.debugger or not options.autorun: + timeout = None + else: + timeout = 330.0 # default JS harness timeout is 300 seconds - self.add_option("--desktop", action="store_true", - dest="desktop", - help="Run the tests on a B2G desktop build") - defaults["desktop"] = False + log.info("runtestsb2g.py | Running tests: start.") + status = 0 + try: + runner_args = { 'profile': self.profile, + 'devicemanager': self._dm, + 'marionette': self.marionette, + 'remote_test_root': self.remote_test_root, + 'test_script': self.test_script, + 'test_script_args': self.test_script_args } + self.runner = B2GRunner(**runner_args) + self.runner.start(outputTimeout=timeout) + self.runner.wait() + except KeyboardInterrupt: + log.info("runtests.py | Received keyboard interrupt.\n"); + status = -1 + except: + traceback.print_exc() + log.error("runtests.py | Received unexpected exception while running application\n") + status = 1 - self.add_option("--marionette", action="store", - type="string", dest="marionette", - help="host:port to use when connecting to Marionette") - defaults["marionette"] = None + self.stopWebServer(options) + self.stopWebSocketServer(options) - self.add_option("--emulator", action="store", - type="string", dest="emulator", - help="Architecture of emulator to use: x86 or arm") - defaults["emulator"] = None + log.info("runtestsb2g.py | Running tests: end.") - self.add_option("--sdcard", action="store", - type="string", dest="sdcard", - help="Define size of sdcard: 1MB, 50MB...etc") - defaults["sdcard"] = "10MB" - - self.add_option("--no-window", action="store_true", - dest="noWindow", - help="Pass --no-window to the emulator") - defaults["noWindow"] = False - - self.add_option("--adbpath", action="store", - type="string", dest="adbPath", - help="path to adb") - defaults["adbPath"] = "adb" - - self.add_option("--deviceIP", action="store", - type="string", dest="deviceIP", - help="ip address of remote device to test") - defaults["deviceIP"] = None - - self.add_option("--devicePort", action="store", - type="string", dest="devicePort", - help="port of remote device to test") - defaults["devicePort"] = 20701 - - self.add_option("--remote-logfile", action="store", - type="string", dest="remoteLogFile", - help="Name of log file on the device relative to the device root. PLEASE ONLY USE A FILENAME.") - defaults["remoteLogFile"] = None - - self.add_option("--remote-webserver", action="store", - type="string", dest="remoteWebServer", - help="ip address where the remote web server is hosted at") - defaults["remoteWebServer"] = None - - self.add_option("--http-port", action="store", - type="string", dest="httpPort", - help="ip address where the remote web server is hosted at") - defaults["httpPort"] = automation.DEFAULT_HTTP_PORT - - self.add_option("--ssl-port", action="store", - type="string", dest="sslPort", - help="ip address where the remote web server is hosted at") - defaults["sslPort"] = automation.DEFAULT_SSL_PORT - - self.add_option("--pidfile", action="store", - type="string", dest="pidFile", - help="name of the pidfile to generate") - defaults["pidFile"] = "" - - self.add_option("--gecko-path", action="store", - type="string", dest="geckoPath", - help="the path to a gecko distribution that should " - "be installed on the emulator prior to test") - defaults["geckoPath"] = None - - self.add_option("--profile", action="store", - type="string", dest="profile", - help="for desktop testing, the path to the " - "gaia profile to use") - defaults["profile"] = None - - self.add_option("--logcat-dir", action="store", - type="string", dest="logcat_dir", - help="directory to store logcat dump files") - defaults["logcat_dir"] = None - - self.add_option('--busybox', action='store', - type='string', dest='busybox', - help="Path to busybox binary to install on device") - defaults['busybox'] = None - self.add_option('--profile-data-dir', action='store', - type='string', dest='profile_data_dir', - help="Path to a directory containing preference and other " - "data to be installed into the profile") - defaults['profile_data_dir'] = os.path.join(here, 'profile_data') - - defaults["remoteTestRoot"] = "/data/local/tests" - defaults["logFile"] = "mochitest.log" - defaults["autorun"] = True - defaults["closeWhenDone"] = True - defaults["testPath"] = "" - defaults["extensionsToExclude"] = ["specialpowers"] - - self.set_defaults(**defaults) - - def verifyRemoteOptions(self, options, automation): - if not options.remoteTestRoot: - options.remoteTestRoot = automation._devicemanager.getDeviceRoot() - productRoot = options.remoteTestRoot + "/" + automation._product - - if options.utilityPath == self._automation.DIST_BIN: - options.utilityPath = productRoot + "/bin" - - if options.remoteWebServer == None: - if os.name != "nt": - options.remoteWebServer = automation.getLanIp() - else: - self.error("You must specify a --remote-webserver=") - options.webServer = options.remoteWebServer - - if options.geckoPath and not options.emulator: - self.error("You must specify --emulator if you specify --gecko-path") - - if options.logcat_dir and not options.emulator: - self.error("You must specify --emulator if you specify --logcat-dir") - - #if not options.emulator and not options.deviceIP: - # print "ERROR: you must provide a device IP" - # return None - - if options.remoteLogFile == None: - options.remoteLogFile = options.remoteTestRoot + '/logs/mochitest.log' - - if options.remoteLogFile.count('/') < 1: - options.remoteLogFile = options.remoteTestRoot + '/' + options.remoteLogFile - - # Only reset the xrePath if it wasn't provided - if options.xrePath == None: - options.xrePath = options.utilityPath - - if not os.path.isdir(options.xrePath): - self.error("--xre-path '%s' is not a directory" % options.xrePath) - xpcshell = os.path.join(options.xrePath, 'xpcshell') - if not os.access(xpcshell, os.F_OK): - self.error('xpcshell not found at %s' % xpcshell) - if automation.elf_arm(xpcshell): - self.error('--xre-path points to an ARM version of xpcshell; it ' - 'should instead point to a version that can run on ' - 'your desktop') - - if options.pidFile != "": - f = open(options.pidFile, 'w') - f.write("%s" % os.getpid()) - f.close() - - return options - - def verifyOptions(self, options, mochitest): - # since we are reusing verifyOptions, it will exit if App is not found - temp = options.app - options.app = sys.argv[0] - tempPort = options.httpPort - tempSSL = options.sslPort - tempIP = options.webServer - options = MochitestOptions.verifyOptions(self, options, mochitest) - options.webServer = tempIP - options.app = temp - options.sslPort = tempSSL - options.httpPort = tempPort - - return options - - -class ProfileConfigParser(ConfigParser.RawConfigParser): - """Subclass of RawConfigParser that outputs .ini files in the exact - format expected for profiles.ini, which is slightly different - than the default format. - """ - - def optionxform(self, optionstr): - return optionstr - - def write(self, fp): - if self._defaults: - fp.write("[%s]\n" % ConfigParser.DEFAULTSECT) - for (key, value) in self._defaults.items(): - fp.write("%s=%s\n" % (key, str(value).replace('\n', '\n\t'))) - fp.write("\n") - for section in self._sections: - fp.write("[%s]\n" % section) - for (key, value) in self._sections[section].items(): - if key == "__name__": - continue - if (value is not None) or (self._optcre == self.OPTCRE): - key = "=".join((key, str(value).replace('\n', '\n\t'))) - fp.write("%s\n" % (key)) - fp.write("\n") + if manifest is not None: + self.cleanup(manifest, options) + return status class B2GDeviceMochitest(B2GMochitest): - _automation = None _dm = None - def __init__(self, automation, devmgr, options): - self._automation = automation - B2GMochitest.__init__(self, automation, OOP=True, profile_data_dir=options.profile_data_dir) - self._dm = devmgr - self.runSSLTunnel = False - self.remoteProfile = options.remoteTestRoot + '/profile' - self._automation.setRemoteProfile(self.remoteProfile) - self.remoteLog = options.remoteLogFile - self.localLog = None - self.userJS = '/data/local/user.js' - self.remoteMozillaPath = '/data/b2g/mozilla' - self.bundlesDir = '/system/b2g/distribution/bundles' - self.remoteProfilesIniPath = os.path.join(self.remoteMozillaPath, 'profiles.ini') - self.originalProfilesIni = None + def __init__(self, marionette, devicemanager, profile_data_dir, + local_binary_dir, remote_test_root=None, remote_log_file=None): + B2GMochitest.__init__(self, marionette, out_of_process=True, profile_data_dir=profile_data_dir) + self._dm = devicemanager + self.remote_test_root = remote_test_root or self._dm.getDeviceRoot() + self.remote_profile = posixpath.join(self.remote_test_root, 'profile') + self.remote_log = remote_log_file or posixpath.join(self.remote_test_root, 'log', 'mochitest.log') + self.local_log = None + self.local_binary_dir = local_binary_dir - def copyRemoteFile(self, src, dest): - self._dm._checkCmdAs(['shell', 'dd', 'if=%s' % src, 'of=%s' % dest]) - - def origUserJSExists(self): - return self._dm.fileExists('/data/local/user.js.orig') + if not self._dm.dirExists(posixpath.dirname(self.remote_log)): + self._dm.mkDirs(self.remote_log) def cleanup(self, manifest, options): - if self.localLog: - self._dm.getFile(self.remoteLog, self.localLog) - self._dm.removeFile(self.remoteLog) - - # Delete any bundled extensions - extensionDir = os.path.join(options.profilePath, 'extensions', 'staged') - if os.access(extensionDir, os.F_OK): - for filename in os.listdir(extensionDir): - try: - self._dm._checkCmdAs(['shell', 'rm', '-rf', - os.path.join(self.bundlesDir, filename)]) - except DMError: - pass - - if not options.emulator: - # Remove the test profile - self._dm._checkCmdAs(['shell', 'rm', '-r', self.remoteProfile]) - - if self.origUserJSExists(): - # Restore the original user.js - self._dm.removeFile(self.userJS) - self.copyRemoteFile('%s.orig' % self.userJS, self.userJS) - self._dm.removeFile("%s.orig" % self.userJS) - - if self._dm.fileExists('%s.orig' % self.remoteProfilesIniPath): - # Restore the original profiles.ini - self._dm.removeFile(self.remoteProfilesIniPath) - self.copyRemoteFile('%s.orig' % self.remoteProfilesIniPath, - self.remoteProfilesIniPath) - self._dm.removeFile("%s.orig" % self.remoteProfilesIniPath) - - # We've restored the original profile, so reboot the device so that - # it gets picked up. - self._automation.rebootDevice() + if self.local_log: + self._dm.getFile(self.remote_log, self.local_log) + self._dm.removeFile(self.remote_log) if options.pidFile != "": try: @@ -425,149 +182,49 @@ class B2GDeviceMochitest(B2GMochitest): except: print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % options.pidFile - def findPath(self, paths, filename=None): - for path in paths: - p = path - if filename: - p = os.path.join(p, filename) - if os.path.exists(self.getFullPath(p)): - return path - return None + # stop and clean up the runner + if getattr(self, 'runner', False): + self.runner.cleanup() + self.runner = None def startWebServer(self, options): """ Create the webserver on the host and start it up """ - remoteXrePath = options.xrePath - remoteProfilePath = options.profilePath - remoteUtilityPath = options.utilityPath - localAutomation = Automation() - localAutomation.IS_WIN32 = False - localAutomation.IS_LINUX = False - localAutomation.IS_MAC = False - localAutomation.UNIXISH = False - hostos = sys.platform - if hostos in ['mac', 'darwin']: - localAutomation.IS_MAC = True - elif hostos in ['linux', 'linux2']: - localAutomation.IS_LINUX = True - localAutomation.UNIXISH = True - elif hostos in ['win32', 'win64']: - localAutomation.BIN_SUFFIX = ".exe" - localAutomation.IS_WIN32 = True - - paths = [options.xrePath, - localAutomation.DIST_BIN, - self._automation._product, - os.path.join('..', self._automation._product)] - options.xrePath = self.findPath(paths) - if options.xrePath == None: - print "ERROR: unable to find xulrunner path for %s, please specify with --xre-path" % (os.name) - sys.exit(1) - paths.append("bin") - paths.append(os.path.join("..", "bin")) - - xpcshell = "xpcshell" - if (os.name == "nt"): - xpcshell += ".exe" - - if (options.utilityPath): - paths.insert(0, options.utilityPath) - options.utilityPath = self.findPath(paths, xpcshell) - if options.utilityPath == None: - print "ERROR: unable to find utility path for %s, please specify with --utility-path" % (os.name) - sys.exit(1) - # httpd-path is specified by standard makefile targets and may be specified - # on the command line to select a particular version of httpd.js. If not - # specified, try to select the one from xre.zip, as required in bug 882932. - if not options.httpdPath: - options.httpdPath = os.path.join(options.utilityPath, "components") - - options.profilePath = tempfile.mkdtemp() - self.server = MochitestServer(localAutomation, options) + d = vars(options).copy() + d['xrePath'] = self.local_binary_dir + d['utilityPath'] = self.local_binary_dir + d['profilePath'] = tempfile.mkdtemp() + if d.get('httpdPath') is None: + d['httpdPath'] = os.path.abspath(os.path.join(self.local_binary_dir, 'components')) + self.server = MochitestServer(None, d) self.server.start() if (options.pidFile != ""): f = open(options.pidFile + ".xpcshell.pid", 'w') f.write("%s" % self.server._process.pid) f.close() - self.server.ensureReady(self.SERVER_STARTUP_TIMEOUT) - - options.xrePath = remoteXrePath - options.utilityPath = remoteUtilityPath - options.profilePath = remoteProfilePath + self.server.ensureReady(90) def stopWebServer(self, options): if hasattr(self, 'server'): self.server.stop() - def updateProfilesIni(self, profilePath): - # update profiles.ini on the device to point to the test profile - self.originalProfilesIni = tempfile.mktemp() - self._dm.getFile(self.remoteProfilesIniPath, self.originalProfilesIni) - - config = ProfileConfigParser() - config.read(self.originalProfilesIni) - for section in config.sections(): - if 'Profile' in section: - config.set(section, 'IsRelative', 0) - config.set(section, 'Path', profilePath) - - newProfilesIni = tempfile.mktemp() - with open(newProfilesIni, 'wb') as configfile: - config.write(configfile) - - self._dm.pushFile(newProfilesIni, self.remoteProfilesIniPath) - self._dm.pushFile(self.originalProfilesIni, '%s.orig' % self.remoteProfilesIniPath) - - try: - os.remove(newProfilesIni) - os.remove(self.originalProfilesIni) - except: - pass - def buildURLOptions(self, options, env): - self.localLog = options.logFile - options.logFile = self.remoteLog + self.local_log = options.logFile + options.logFile = self.remote_log options.profilePath = self.profile.profile - retVal = Mochitest.buildURLOptions(self, options, env) + retVal = super(B2GDeviceMochitest, self).buildURLOptions(options, env) - self.setupCommonOptions(options) + self.setup_common_options(options) - # Copy the profile to the device. - self._dm._checkCmdAs(['shell', 'rm', '-r', self.remoteProfile]) - try: - self._dm.pushDir(options.profilePath, self.remoteProfile) - except DMError: - print "Automation Error: Unable to copy profile to device." - raise - - # Copy the extensions to the B2G bundles dir. - extensionDir = os.path.join(options.profilePath, 'extensions', 'staged') - # need to write to read-only dir - self._dm._checkCmdAs(['remount']) - for filename in os.listdir(extensionDir): - self._dm._checkCmdAs(['shell', 'rm', '-rf', - os.path.join(self.bundlesDir, filename)]) - try: - self._dm.pushDir(extensionDir, self.bundlesDir) - except DMError: - print "Automation Error: Unable to copy extensions to device." - raise - - # In B2G, user.js is always read from /data/local, not the profile - # directory. Backup the original user.js first so we can restore it. - if not self._dm.fileExists('%s.orig' % self.userJS): - self.copyRemoteFile(self.userJS, '%s.orig' % self.userJS) - self._dm.pushFile(os.path.join(options.profilePath, "user.js"), self.userJS) - self.updateProfilesIni(self.remoteProfile) - options.profilePath = self.remoteProfile - options.logFile = self.localLog + options.profilePath = self.remote_profile + options.logFile = self.local_log return retVal class B2GDesktopMochitest(B2GMochitest): - def __init__(self, automation, options): - B2GMochitest.__init__(self, automation, OOP=False, profile_data_dir=options.profile_data_dir) + def __init__(self, marionette, profile_data_dir): + B2GMochitest.__init__(self, out_of_process=False, profile_data_dir=profile_data_dir) def runMarionetteScript(self, marionette, test_script): assert(marionette.wait_for_port()) @@ -580,14 +237,14 @@ class B2GDesktopMochitest(B2GMochitest): # stdout buffer gets filled (which gets drained only after this # function returns, by waitForFinish), which causes the app to hang. thread = threading.Thread(target=self.runMarionetteScript, - args=(self.automation.marionette, - self.automation.test_script)) + args=(self.marionette, + self.test_script)) thread.start() def buildURLOptions(self, options, env): - retVal = Mochitest.buildURLOptions(self, options, env) + retVal = super(B2GDesktopMochitest, self).buildURLOptions(options, env) - self.setupCommonOptions(options) + self.setup_common_options(options) # Copy the extensions to the B2G bundles dir. extensionDir = os.path.join(options.profilePath, 'extensions', 'staged') @@ -602,12 +259,11 @@ class B2GDesktopMochitest(B2GMochitest): return retVal -def run_remote_mochitests(automation, parser, options): +def run_remote_mochitests(parser, options): # create our Marionette instance kwargs = {} if options.emulator: kwargs['emulator'] = options.emulator - automation.setEmulator(True) if options.noWindow: kwargs['noWindow'] = True if options.geckoPath: @@ -630,8 +286,6 @@ def run_remote_mochitests(automation, parser, options): marionette = Marionette.getMarionetteOrExit(**kwargs) - automation.marionette = marionette - # create the DeviceManager kwargs = {'adbPath': options.adbPath, 'deviceRoot': options.remoteTestRoot} @@ -639,28 +293,23 @@ def run_remote_mochitests(automation, parser, options): kwargs.update({'host': options.deviceIP, 'port': options.devicePort}) dm = DeviceManagerADB(**kwargs) - automation.setDeviceManager(dm) - options = parser.verifyRemoteOptions(options, automation) + options = parser.verifyRemoteOptions(options) if (options == None): print "ERROR: Invalid options specified, use --help for a list of valid options" sys.exit(1) - automation.setProduct("b2g") - - mochitest = B2GDeviceMochitest(automation, dm, options) + mochitest = B2GDeviceMochitest(marionette, dm, options.profile_data_dir, options.xrePath, + remote_test_root=options.remoteTestRoot, + remote_log_file=options.remoteLogFile) options = parser.verifyOptions(options, mochitest) if (options == None): sys.exit(1) - logParent = os.path.dirname(options.remoteLogFile) - dm.mkDir(logParent) - automation.setRemoteLog(options.remoteLogFile) - automation.setServerInfo(options.webServer, options.httpPort, options.sslPort) retVal = 1 try: mochitest.cleanup(None, options) - retVal = mochitest.runTests(options) + retVal = mochitest.run_tests(options) except: print "Automation Error: Exception caught while running tests" traceback.print_exc() @@ -674,10 +323,7 @@ def run_remote_mochitests(automation, parser, options): sys.exit(retVal) - def run_desktop_mochitests(parser, options): - automation = B2GDesktopAutomation() - # create our Marionette instance kwargs = {} if options.marionette: @@ -685,9 +331,8 @@ def run_desktop_mochitests(parser, options): kwargs['host'] = host kwargs['port'] = int(port) marionette = Marionette.getMarionetteOrExit(**kwargs) - automation.marionette = marionette - mochitest = B2GDesktopMochitest(automation, options) + mochitest = B2GDesktopMochitest(marionette, options.profile_data_dir) # b2g desktop builds don't always have a b2g-bin file if options.app[-4:] == '-bin': @@ -700,24 +345,16 @@ def run_desktop_mochitests(parser, options): if options.desktop and not options.profile: raise Exception("must specify --profile when specifying --desktop") - automation.setServerInfo(options.webServer, - options.httpPort, - options.sslPort, - options.webSocketPort) - sys.exit(mochitest.runTests(options, - onLaunch=mochitest.startTests)) - + sys.exit(mochitest.runTests(options, onLaunch=mochitest.startTests)) def main(): - scriptdir = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) - automation = B2GRemoteAutomation(None, "fennec") - parser = B2GOptions(automation, scriptdir) + parser = B2GOptions() options, args = parser.parse_args() if options.desktop: run_desktop_mochitests(parser, options) else: - run_remote_mochitests(automation, parser, options) + run_remote_mochitests(parser, options) if __name__ == "__main__": main() diff --git a/testing/mochitest/runtestsremote.py b/testing/mochitest/runtestsremote.py index db98bb57e54b..c05051a65689 100644 --- a/testing/mochitest/runtestsremote.py +++ b/testing/mochitest/runtestsremote.py @@ -17,8 +17,8 @@ sys.path.insert(0, os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0]) from automation import Automation from remoteautomation import RemoteAutomation, fennecLogcatFilters from runtests import Mochitest -from runtests import MochitestOptions from runtests import MochitestServer +from mochitest_options import MochitestOptions import devicemanager import droid @@ -26,9 +26,9 @@ import manifestparser class RemoteOptions(MochitestOptions): - def __init__(self, automation, scriptdir, **kwargs): + def __init__(self, automation, **kwargs): defaults = {} - MochitestOptions.__init__(self, automation, scriptdir) + MochitestOptions.__init__(self, automation) self.add_option("--remote-app-path", action="store", type = "string", dest = "remoteAppPath", @@ -519,9 +519,8 @@ class MochiRemote(Mochitest): def main(): - scriptdir = os.path.abspath(os.path.realpath(os.path.dirname(__file__))) auto = RemoteAutomation(None, "fennec") - parser = RemoteOptions(auto, scriptdir) + parser = RemoteOptions(auto) options, args = parser.parse_args() if (options.dm_trans == "adb"): From 1b946f85666304e5fcac0e70703badcd27b94e4c Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Fri, 26 Jul 2013 14:57:41 -0400 Subject: [PATCH 87/92] Bug 887466 - Rearrange SyncDecode so that we never try to finish a size decode with the decode lock held. r=seth --- image/src/RasterImage.cpp | 36 ++++++++++++++++++------------------ image/src/RasterImage.h | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 09a568c90a11..dc623792f624 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -2325,26 +2325,8 @@ RasterImage::RequestDecodeCore(RequestDecodeType aDecodeType) nsresult RasterImage::SyncDecode() { - MutexAutoLock imgLock(mDecodingMutex); - - if (mDecodeRequest) { - // If the image is waiting for decode work to be notified, go ahead and do that. - if (mDecodeRequest->mRequestStatus == DecodeRequest::REQUEST_WORK_DONE) { - nsresult rv = FinishedSomeDecoding(); - CONTAINER_ENSURE_SUCCESS(rv); - } - } - - nsresult rv; - PROFILER_LABEL_PRINTF("RasterImage", "SyncDecode", "%s", GetURIString().get());; - // We really have no good way of forcing a synchronous decode if we're being - // called in a re-entrant manner (ie, from an event listener fired by a - // decoder), because the decoding machinery is already tied up. We thus explicitly - // disallow this type of call in the API, and check for it in API methods. - NS_ABORT_IF_FALSE(!mInDecoder, "Yikes, forcing sync in reentrant call!"); - // If we have a size decoder open, make sure we get the size if (mDecoder && mDecoder->IsSizeDecode()) { nsresult rv = DecodePool::Singleton()->DecodeUntilSizeAvailable(this); @@ -2358,6 +2340,24 @@ RasterImage::SyncDecode() } } + MutexAutoLock imgLock(mDecodingMutex); + + // We really have no good way of forcing a synchronous decode if we're being + // called in a re-entrant manner (ie, from an event listener fired by a + // decoder), because the decoding machinery is already tied up. We thus explicitly + // disallow this type of call in the API, and check for it in API methods. + NS_ABORT_IF_FALSE(!mInDecoder, "Yikes, forcing sync in reentrant call!"); + + if (mDecodeRequest) { + // If the image is waiting for decode work to be notified, go ahead and do that. + if (mDecodeRequest->mRequestStatus == DecodeRequest::REQUEST_WORK_DONE) { + nsresult rv = FinishedSomeDecoding(); + CONTAINER_ENSURE_SUCCESS(rv); + } + } + + nsresult rv; + // If we're decoded already, or decoding until the size was available // finished us as a side-effect, no worries if (mDecoded) diff --git a/image/src/RasterImage.h b/image/src/RasterImage.h index d70f43f7e1fa..bc43fec8a01d 100644 --- a/image/src/RasterImage.h +++ b/image/src/RasterImage.h @@ -642,9 +642,9 @@ private: // data nsRefPtr mDecoder; nsRefPtr mDecodeRequest; uint32_t mBytesDecoded; - // END LOCKED MEMBER VARIABLES bool mInDecoder; + // END LOCKED MEMBER VARIABLES // Boolean flags (clustered together to conserve space): bool mHasSize:1; // Has SetSize() been called? From 268ee517df68c99358c7df0b2f015bc4cc6749f5 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 26 Jul 2013 15:17:34 -0400 Subject: [PATCH 88/92] Bug 894941 - Increase fuzz tolerance for the small-shot.ogg mediaDecoding test to resolve a CLOSED TREE. --- content/media/webaudio/test/test_mediaDecoding.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/media/webaudio/test/test_mediaDecoding.html b/content/media/webaudio/test/test_mediaDecoding.html index 28f5c3ed506d..7765220eb6d8 100644 --- a/content/media/webaudio/test/test_mediaDecoding.html +++ b/content/media/webaudio/test/test_mediaDecoding.html @@ -157,7 +157,7 @@ var tests = [ numberOfChannels: 2, duration: 0.2760, length: 13248, - fuzzTolerance: 72, + fuzzTolerance: 76, fuzzToleranceMobile: 14844 }, // A wave file From 74cb7450ea03344753e944ea8bfa76834a9423ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Gon=C3=83=C2=A7alves?= Date: Fri, 26 Jul 2013 16:12:12 -0400 Subject: [PATCH 89/92] Bug 884921 - navigator.geolocation should never be null. r=dougt --- dom/base/Navigator.cpp | 4 --- dom/tests/mochitest/geolocation/Makefile.in | 1 + ...ocation_is_undefined_when_pref_is_off.html | 35 +++++++++++++++++++ dom/webidl/Navigator.webidl | 8 ++--- 4 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 64ac55d6170d..00af5dc5a47f 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -961,10 +961,6 @@ Navigator::GetDeviceStorages(const nsAString& aType, Geolocation* Navigator::GetGeolocation(ErrorResult& aRv) { - if (!Preferences::GetBool("geo.enabled", true)) { - return nullptr; - } - if (mGeolocation) { return mGeolocation; } diff --git a/dom/tests/mochitest/geolocation/Makefile.in b/dom/tests/mochitest/geolocation/Makefile.in index 06df1a057943..eec49e8dd702 100644 --- a/dom/tests/mochitest/geolocation/Makefile.in +++ b/dom/tests/mochitest/geolocation/Makefile.in @@ -18,6 +18,7 @@ MOCHITEST_FILES = \ test_cancelWatch.html \ test_clearWatch.html \ test_clearWatch_invalid.html \ + test_geolocation_is_undefined_when_pref_is_off.html \ test_manyCurrentConcurrent.html \ test_manyCurrentSerial.html \ test_manyWatchConcurrent.html \ diff --git a/dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html b/dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html new file mode 100644 index 000000000000..882dacec38e2 --- /dev/null +++ b/dom/tests/mochitest/geolocation/test_geolocation_is_undefined_when_pref_is_off.html @@ -0,0 +1,35 @@ + + + + + Test for getCurrentPosition + + + + + + +Mozilla Bug 884921 +

+ +
+
+
+ + + diff --git a/dom/webidl/Navigator.webidl b/dom/webidl/Navigator.webidl index e91376080db5..c9f224ef1e9d 100644 --- a/dom/webidl/Navigator.webidl +++ b/dom/webidl/Navigator.webidl @@ -94,12 +94,8 @@ partial interface Navigator { // http://www.w3.org/TR/geolocation-API/#geolocation_interface [NoInterfaceObject] interface NavigatorGeolocation { - // XXXbz This should perhaps be controleld by the "geo.enabled" pref, instead - // of checking it in the C++. Let's not for now to reduce risk. - // Also, we violate the spec as a result, since we can return null. See bug - // 884921. - [Throws] - readonly attribute Geolocation? geolocation; + [Throws, Pref="geo.enabled"] + readonly attribute Geolocation geolocation; }; Navigator implements NavigatorGeolocation; From 7e231db6276b7f91e55ccad06eb9447765ac3254 Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Fri, 26 Jul 2013 12:19:55 -0500 Subject: [PATCH 90/92] Bug 898370 - Disable crash reporting when running in metrodesktop mode. r=bbondy --- browser/app/nsBrowserApp.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp index 9de3fead80d9..001f99be8767 100644 --- a/browser/app/nsBrowserApp.cpp +++ b/browser/app/nsBrowserApp.cpp @@ -241,6 +241,9 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory) for (int idx = 1; idx < argc; idx++) { if (IsArg(argv[idx], "metrodesktop")) { metroOnDesktop = true; + // Disable crash reporting when running in metrodesktop mode. + char crashSwitch[] = "MOZ_CRASHREPORTER_DISABLE=1"; + putenv(crashSwitch); break; } } From d9f8bf5f9b2c40d98f3ab4d339c9d39f2a39bbb0 Mon Sep 17 00:00:00 2001 From: Mihnea Dobrescu-Balaur Date: Thu, 25 Jul 2013 15:20:34 -0700 Subject: [PATCH 91/92] Bug 898142 - xpcshell make target should pass in pluginsPath. r=gps --- testing/testsuite-targets.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/testsuite-targets.mk b/testing/testsuite-targets.mk index cafc02e25b08..e8610546d45e 100644 --- a/testing/testsuite-targets.mk +++ b/testing/testsuite-targets.mk @@ -285,6 +285,7 @@ xpcshell-tests: --manifest=$(DEPTH)/_tests/xpcshell/xpcshell.ini \ --build-info-json=$(DEPTH)/mozinfo.json \ --no-logfiles \ + --test-plugin-path="$(DIST)/plugins" \ --tests-root-dir=$(call core_abspath,_tests/xpcshell) \ --testing-modules-dir=$(call core_abspath,_tests/modules) \ --xunit-file=$(call core_abspath,_tests/xpcshell/results.xml) \ From d76ef26a9aff0118ade75edf9cfaf454740f68a0 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Fri, 26 Jul 2013 14:15:37 -0600 Subject: [PATCH 92/92] Bug 893890 - Don't attach new object metadata to objects created while parsing/emitting scripts, r=luke. --- js/src/jsobjinlines.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index 077704625b2e..4179152bacce 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -1193,11 +1193,12 @@ static JS_ALWAYS_INLINE bool NewObjectMetadata(ExclusiveContext *cxArg, JSObject **pmetadata) { // The metadata callback is invoked before each created object, except when - // analysis is active as the callback may reenter JS. + // analysis/compilation/parsing is active as the callback may reenter JS. JS_ASSERT(!*pmetadata); if (JSContext *cx = cxArg->maybeJSContext()) { if (JS_UNLIKELY((size_t)cx->compartment()->objectMetadataCallback) && - !cx->compartment()->activeAnalysis) + !cx->compartment()->activeAnalysis && + !cx->runtime()->mainThread.activeCompilations) { gc::AutoSuppressGC suppress(cx); return cx->compartment()->objectMetadataCallback(cx, pmetadata);