diff --git a/.hgtags b/.hgtags index 15326cead1b..8248dcc837e 100644 --- a/.hgtags +++ b/.hgtags @@ -105,3 +105,4 @@ ba2cc1eda988a1614d8986ae145d28e1268409b9 FIREFOX_AURORA_29_BASE-m 0000000000000000000000000000000000000000 FIREFOX_AURORA_29_BASE-m ba2cc1eda988a1614d8986ae145d28e1268409b9 FIREFOX_AURORA_29_BASE 9f12a9fab080f2d363d7424e25b9ffe85ebc3414 FIREFOX_AURORA_28_BASE +83c9853e136451474dfa6d1aaa60a7fca7d2d83a FIREFOX_AURORA_30_BASE diff --git a/b2g/app/b2g.js b/b2g/app/b2g.js index ee8158c731c..1219b6f526b 100644 --- a/b2g/app/b2g.js +++ b/b2g/app/b2g.js @@ -676,6 +676,19 @@ pref("hal.processPriorityManager.gonk.BACKGROUND.Nice", 18); // Processes get this niceness when they have low CPU priority. pref("hal.processPriorityManager.gonk.LowCPUNice", 18); +// By default the compositor thread on gonk runs without real-time priority. RT +// priority can be enabled by setting this pref to a value between 1 and 99. +// Note that audio processing currently runs at RT priority 2 or 3 at most. +// +// If RT priority is disabled, then the compositor nice value is used. The +// code will default to ANDROID_PRIORITY_URGENT_DISPLAY which is -8. Per gfx +// request we are keeping the compositor at nice level 0 until we can complete +// the investigation in bug 982972. +// +// Do not change these values without gfx team review. +pref("hal.gonk.compositor.rt_priority", 0); +pref("hal.gonk.compositor.nice", 0); + // Fire a memory pressure event when the system has less than Xmb of memory // remaining. You should probably set this just above Y.KillUnderKB for // the highest priority class Y that you want to make an effort to keep alive. diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 6bcdda886b1..c86519f80ec 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 8513b56522c..c951d6a392d 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 164cada018c..28f03dcbfb3 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 6bcdda886b1..c86519f80ec 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 08d4a36fdbd..67323ae215e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "branch": "", "revision": "" }, - "revision": "fb54fbd4849b9adfdb4fc236c2cf8161545d736d", + "revision": "f5280df8a66c88c8bafc0062e19a4770ce18e08d", "repo_path": "/integration/gaia-central" } diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 110f0685762..d4081a726d6 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index b238055966d..6078aa017a2 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml index a534ca86cdd..d9f711fd01a 100644 --- a/b2g/config/inari/sources.xml +++ b/b2g/config/inari/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml index d9493245586..c8283e2eab0 100644 --- a/b2g/config/leo/sources.xml +++ b/b2g/config/leo/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml index 59234837cdb..069b1333a22 100644 --- a/b2g/config/mako/sources.xml +++ b/b2g/config/mako/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index a6935f45ef5..2016ecb4077 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/confvars.sh b/b2g/confvars.sh index 543f5f7f140..f9d909bac11 100644 --- a/b2g/confvars.sh +++ b/b2g/confvars.sh @@ -5,7 +5,7 @@ MOZ_APP_BASENAME=B2G MOZ_APP_VENDOR=Mozilla -MOZ_APP_VERSION=30.0a1 +MOZ_APP_VERSION=31.0a1 MOZ_APP_UA_NAME=Firefox MOZ_UA_OS_AGNOSTIC=1 diff --git a/browser/config/version.txt b/browser/config/version.txt index 507e3256cdd..19ea970e00a 100644 --- a/browser/config/version.txt +++ b/browser/config/version.txt @@ -1 +1 @@ -30.0a1 +31.0a1 diff --git a/build/Makefile.in b/build/Makefile.in index 6f07573ab26..5fe722621c7 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -44,8 +44,12 @@ endif # by GDB when we debug executables there. # NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir. GDBINIT_FILES := $(topsrcdir)/.gdbinit +GDBINIT_OBJDIR_FILES = $(topsrcdir)/.gdbinit GDBINIT_DEST = $(FINAL_TARGET) -INSTALL_TARGETS += GDBINIT + +# needs to be absolute to be distinct from $(topsrcdir)/.gdbinit +GDBINIT_OBJDIR_DEST = $(abspath $(DEPTH)) +INSTALL_TARGETS += GDBINIT GDBINIT_OBJDIR # Put a .lldbinit in the bin directory and the objdir, to be picked up # automatically by LLDB when we debug executables using either of those two diff --git a/config/milestone.txt b/config/milestone.txt index 6334341896b..5420350e072 100644 --- a/config/milestone.txt +++ b/config/milestone.txt @@ -10,4 +10,4 @@ # hardcoded milestones in the tree from these two files. #-------------------------------------------------------- -30.0a1 +31.0a1 diff --git a/configure.in b/configure.in index 1408b8beb30..b337e11de9b 100644 --- a/configure.in +++ b/configure.in @@ -7888,7 +7888,13 @@ dnl ======================================================== dnl Check for pixman and cairo dnl ======================================================== -MOZ_TREE_CAIRO=1 +if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then + # cairo-gtk3 can be build with system-cairo only + MOZ_TREE_CAIRO= +else + MOZ_TREE_CAIRO=1 +fi + MOZ_ARG_ENABLE_BOOL(system-cairo, [ --enable-system-cairo Use system cairo (located with pkgconfig)], MOZ_TREE_CAIRO=, @@ -7978,6 +7984,9 @@ if test "$MOZ_TREE_CAIRO"; then MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1) fi ;; + gtk3) + AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.]) + ;; esac if test "$USE_FC_FREETYPE"; then FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1" diff --git a/content/canvas/src/WebGLBuffer.cpp b/content/canvas/src/WebGLBuffer.cpp index 7703e1b0d1e..523675f0f98 100644 --- a/content/canvas/src/WebGLBuffer.cpp +++ b/content/canvas/src/WebGLBuffer.cpp @@ -4,9 +4,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "WebGLBuffer.h" -#include "WebGLContext.h" + #include "GLContext.h" #include "mozilla/dom/WebGLRenderingContextBinding.h" +#include "WebGLContext.h" +#include "WebGLElementArrayCache.h" using namespace mozilla; @@ -55,6 +57,22 @@ WebGLBuffer::ElementArrayCacheBufferSubData(size_t pos, const void* ptr, size_t mCache->BufferSubData(pos, ptr, update_size_in_bytes); } +size_t +WebGLBuffer::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const +{ + size_t sizeOfCache = mCache ? mCache->SizeOfIncludingThis(aMallocSizeOf) : 0; + return aMallocSizeOf(this) + sizeOfCache; +} + +bool +WebGLBuffer::Validate(GLenum type, uint32_t max_allowed, + size_t first, size_t count, + uint32_t* out_upperBound) +{ + return mCache->Validate(type, max_allowed, first, count, out_upperBound); +} + + JSObject* WebGLBuffer::WrapObject(JSContext *cx, JS::Handle scope) { return dom::WebGLBufferBinding::Wrap(cx, scope, this); diff --git a/content/canvas/src/WebGLBuffer.h b/content/canvas/src/WebGLBuffer.h index a653bd74839..f865ce8b725 100644 --- a/content/canvas/src/WebGLBuffer.h +++ b/content/canvas/src/WebGLBuffer.h @@ -6,14 +6,12 @@ #ifndef WEBGLBUFFER_H_ #define WEBGLBUFFER_H_ -#include "WebGLObjectModel.h" -#include "WebGLElementArrayCache.h" #include "GLDefs.h" - -#include "nsWrapperCache.h" - #include "mozilla/LinkedList.h" #include "mozilla/MemoryReporting.h" +#include "nsWrapperCache.h" +#include "WebGLObjectModel.h" +#include "WebGLTypes.h" namespace mozilla { @@ -32,10 +30,7 @@ public: void Delete(); - size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { - size_t sizeOfCache = mCache ? mCache->SizeOfIncludingThis(aMallocSizeOf) : 0; - return aMallocSizeOf(this) + sizeOfCache; - } + size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; bool HasEverBeenBound() { return mHasEverBeenBound; } void SetHasEverBeenBound(bool x) { mHasEverBeenBound = x; } @@ -51,9 +46,8 @@ public: void ElementArrayCacheBufferSubData(size_t pos, const void* ptr, size_t update_size_in_bytes); - bool Validate(GLenum type, uint32_t max_allowed, size_t first, size_t count) { - return mCache->Validate(type, max_allowed, first, count); - } + bool Validate(GLenum type, uint32_t max_allowed, size_t first, size_t count, + uint32_t* out_upperBound); WebGLContext *GetParentObject() const { return Context(); diff --git a/content/canvas/src/WebGLContext.h b/content/canvas/src/WebGLContext.h index 2c56966b44d..81e2ac6921d 100644 --- a/content/canvas/src/WebGLContext.h +++ b/content/canvas/src/WebGLContext.h @@ -787,7 +787,8 @@ private: bool DrawArrays_check(GLint first, GLsizei count, GLsizei primcount, const char* info); bool DrawElements_check(GLsizei count, GLenum type, WebGLintptr byteOffset, - GLsizei primcount, const char* info); + GLsizei primcount, const char* info, + GLuint* out_upperBound = nullptr); bool DrawInstanced_check(const char* info); void Draw_cleanup(); diff --git a/content/canvas/src/WebGLContextVertices.cpp b/content/canvas/src/WebGLContextVertices.cpp index 51737375174..e7786c0966f 100644 --- a/content/canvas/src/WebGLContextVertices.cpp +++ b/content/canvas/src/WebGLContextVertices.cpp @@ -4,16 +4,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "WebGLContext.h" -#include "WebGLBuffer.h" -#include "WebGLVertexAttribData.h" -#include "WebGLVertexArray.h" -#include "WebGLTexture.h" -#include "WebGLRenderbuffer.h" -#include "WebGLFramebuffer.h" -#include "WebGLUniformInfo.h" -#include "WebGLShader.h" -#include "WebGLProgram.h" + #include "GLContext.h" +#include "mozilla/CheckedInt.h" +#include "WebGLBuffer.h" +#include "WebGLFramebuffer.h" +#include "WebGLProgram.h" +#include "WebGLRenderbuffer.h" +#include "WebGLShader.h" +#include "WebGLTexture.h" +#include "WebGLUniformInfo.h" +#include "WebGLVertexArray.h" +#include "WebGLVertexAttribData.h" using namespace mozilla; using namespace dom; @@ -554,7 +556,9 @@ WebGLContext::DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsiz } bool -WebGLContext::DrawElements_check(GLsizei count, GLenum type, WebGLintptr byteOffset, GLsizei primcount, const char* info) +WebGLContext::DrawElements_check(GLsizei count, GLenum type, + WebGLintptr byteOffset, GLsizei primcount, + const char* info, GLuint* out_upperBound) { if (count < 0 || byteOffset < 0) { ErrorInvalidValue("%s: negative count or offset", info); @@ -620,7 +624,9 @@ WebGLContext::DrawElements_check(GLsizei count, GLenum type, WebGLintptr byteOff return false; } - if (!mBoundVertexArray->mBoundElementArrayBuffer->ByteLength()) { + WebGLBuffer& elemArrayBuffer = *mBoundVertexArray->mBoundElementArrayBuffer; + + if (!elemArrayBuffer.ByteLength()) { ErrorInvalidOperation("%s: bound element array buffer doesn't have any data", info); return false; } @@ -632,7 +638,7 @@ WebGLContext::DrawElements_check(GLsizei count, GLenum type, WebGLintptr byteOff return false; } - if (uint32_t(checked_neededByteCount.value()) > mBoundVertexArray->mBoundElementArrayBuffer->ByteLength()) { + if (uint32_t(checked_neededByteCount.value()) > elemArrayBuffer.ByteLength()) { ErrorInvalidOperation("%s: bound element array buffer is too small for given count and offset", info); return false; } @@ -641,7 +647,7 @@ WebGLContext::DrawElements_check(GLsizei count, GLenum type, WebGLintptr byteOff return false; if (!mMaxFetchedVertices || - !mBoundVertexArray->mBoundElementArrayBuffer->Validate(type, mMaxFetchedVertices - 1, first, count)) + !elemArrayBuffer.Validate(type, mMaxFetchedVertices - 1, first, count, out_upperBound)) { ErrorInvalidOperation( "%s: bound vertex attribute buffers do not have sufficient " @@ -673,7 +679,7 @@ WebGLContext::DrawElements_check(GLsizei count, GLenum type, WebGLintptr byteOff void WebGLContext::DrawElements(GLenum mode, GLsizei count, GLenum type, - WebGLintptr byteOffset) + WebGLintptr byteOffset) { if (IsContextLost()) return; @@ -681,18 +687,28 @@ WebGLContext::DrawElements(GLenum mode, GLsizei count, GLenum type, if (!ValidateDrawModeEnum(mode, "drawElements: mode")) return; - if (!DrawElements_check(count, type, byteOffset, 1, "drawElements")) + GLuint upperBound = UINT_MAX; + if (!DrawElements_check(count, type, byteOffset, 1, "drawElements", + &upperBound)) + { return; + } SetupContextLossTimer(); - gl->fDrawElements(mode, count, type, reinterpret_cast(byteOffset)); + + if (gl->IsSupported(gl::GLFeature::draw_range_elements)) { + gl->fDrawRangeElements(mode, 0, upperBound, + count, type, reinterpret_cast(byteOffset)); + } else { + gl->fDrawElements(mode, count, type, reinterpret_cast(byteOffset)); + } Draw_cleanup(); } void WebGLContext::DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, - WebGLintptr byteOffset, GLsizei primcount) + WebGLintptr byteOffset, GLsizei primcount) { if (IsContextLost()) return; diff --git a/content/canvas/src/WebGLElementArrayCache.cpp b/content/canvas/src/WebGLElementArrayCache.cpp index af03ec4567e..03b855b67e2 100644 --- a/content/canvas/src/WebGLElementArrayCache.cpp +++ b/content/canvas/src/WebGLElementArrayCache.cpp @@ -16,6 +16,24 @@ namespace mozilla { +static void +SetUpperBound(uint32_t* out_upperBound, uint32_t newBound) +{ + if (!out_upperBound) + return; + + *out_upperBound = newBound; +} + +static void +UpdateUpperBound(uint32_t* out_upperBound, uint32_t newBound) +{ + if (!out_upperBound) + return; + + *out_upperBound = std::max(*out_upperBound, newBound); +} + /* * WebGLElementArrayCacheTree contains most of the implementation of WebGLElementArrayCache, * which performs WebGL element array buffer validation for drawElements. @@ -227,7 +245,9 @@ public: return ((numElements - 1) | sElementsPerLeafMask) + 1; } - bool Validate(T maxAllowed, size_t firstLeaf, size_t lastLeaf) { + bool Validate(T maxAllowed, size_t firstLeaf, size_t lastLeaf, + uint32_t* out_upperBound) + { MOZ_ASSERT(!mInvalidated); size_t firstTreeIndex = TreeIndexForLeaf(firstLeaf); @@ -240,13 +260,17 @@ public: // final case where there is only 1 node to validate at the current tree level if (lastTreeIndex == firstTreeIndex) { - return mTreeData[firstTreeIndex] <= maxAllowed; + const T& curData = mTreeData[firstTreeIndex]; + UpdateUpperBound(out_upperBound, curData); + return curData <= maxAllowed; } // if the first node at current tree level is a right node, handle it individually // and replace it with its right neighbor, which is a left node if (IsRightNode(firstTreeIndex)) { - if (mTreeData[firstTreeIndex] > maxAllowed) + const T& curData = mTreeData[firstTreeIndex]; + UpdateUpperBound(out_upperBound, curData); + if (curData > maxAllowed) return false; firstTreeIndex = RightNeighborNode(firstTreeIndex); } @@ -254,7 +278,9 @@ public: // if the last node at current tree level is a left node, handle it individually // and replace it with its left neighbor, which is a right node if (IsLeftNode(lastTreeIndex)) { - if (mTreeData[lastTreeIndex] > maxAllowed) + const T& curData = mTreeData[lastTreeIndex]; + UpdateUpperBound(out_upperBound, curData); + if (curData > maxAllowed) return false; lastTreeIndex = LeftNeighborNode(lastTreeIndex); } @@ -490,10 +516,18 @@ void WebGLElementArrayCache::InvalidateTrees(size_t firstByte, size_t lastByte) } template -bool WebGLElementArrayCache::Validate(uint32_t maxAllowed, size_t firstElement, size_t countElements) { +bool +WebGLElementArrayCache::Validate(uint32_t maxAllowed, size_t firstElement, + size_t countElements, uint32_t* out_upperBound) +{ + SetUpperBound(out_upperBound, 0); + // if maxAllowed is >= the max T value, then there is no way that a T index could be invalid - if (maxAllowed >= std::numeric_limits::max()) + uint32_t maxTSize = std::numeric_limits::max(); + if (maxAllowed >= maxTSize) { + SetUpperBound(out_upperBound, maxTSize); return true; + } T maxAllowedT(maxAllowed); @@ -515,8 +549,10 @@ bool WebGLElementArrayCache::Validate(uint32_t maxAllowed, size_t firstElement, // fast exit path when the global maximum for the whole element array buffer // falls in the allowed range - if (tree->GlobalMaximum() <= maxAllowedT) + T globalMax = tree->GlobalMaximum(); + if (globalMax <= maxAllowedT) { + SetUpperBound(out_upperBound, globalMax); return true; } @@ -527,14 +563,18 @@ bool WebGLElementArrayCache::Validate(uint32_t maxAllowed, size_t firstElement, size_t firstElementAdjustmentEnd = std::min(lastElement, tree->LastElementUnderSameLeaf(firstElement)); while (firstElement <= firstElementAdjustmentEnd) { - if (elements[firstElement] > maxAllowedT) + const T& curData = elements[firstElement]; + UpdateUpperBound(out_upperBound, curData); + if (curData > maxAllowedT) return false; firstElement++; } size_t lastElementAdjustmentEnd = std::max(firstElement, tree->FirstElementUnderSameLeaf(lastElement)); while (lastElement >= lastElementAdjustmentEnd) { - if (elements[lastElement] > maxAllowedT) + const T& curData = elements[lastElement]; + UpdateUpperBound(out_upperBound, curData); + if (curData > maxAllowedT) return false; lastElement--; } @@ -546,20 +586,29 @@ bool WebGLElementArrayCache::Validate(uint32_t maxAllowed, size_t firstElement, // general case return tree->Validate(maxAllowedT, tree->LeafForElement(firstElement), - tree->LeafForElement(lastElement)); + tree->LeafForElement(lastElement), + out_upperBound); } -bool WebGLElementArrayCache::Validate(GLenum type, uint32_t maxAllowed, size_t firstElement, size_t countElements) { +bool +WebGLElementArrayCache::Validate(GLenum type, uint32_t maxAllowed, + size_t firstElement, size_t countElements, + uint32_t* out_upperBound) +{ if (type == LOCAL_GL_UNSIGNED_BYTE) - return Validate(maxAllowed, firstElement, countElements); + return Validate(maxAllowed, firstElement, countElements, out_upperBound); if (type == LOCAL_GL_UNSIGNED_SHORT) - return Validate(maxAllowed, firstElement, countElements); + return Validate(maxAllowed, firstElement, countElements, out_upperBound); if (type == LOCAL_GL_UNSIGNED_INT) - return Validate(maxAllowed, firstElement, countElements); + return Validate(maxAllowed, firstElement, countElements, out_upperBound); + + MOZ_ASSERT(false, "Invalid type."); return false; } -size_t WebGLElementArrayCache::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { +size_t +WebGLElementArrayCache::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const +{ size_t uint8TreeSize = mUint8Tree ? mUint8Tree->SizeOfIncludingThis(aMallocSizeOf) : 0; size_t uint16TreeSize = mUint16Tree ? mUint16Tree->SizeOfIncludingThis(aMallocSizeOf) : 0; size_t uint32TreeSize = mUint32Tree ? mUint32Tree->SizeOfIncludingThis(aMallocSizeOf) : 0; diff --git a/content/canvas/src/WebGLElementArrayCache.h b/content/canvas/src/WebGLElementArrayCache.h index e6ee10ea738..842a802e499 100644 --- a/content/canvas/src/WebGLElementArrayCache.h +++ b/content/canvas/src/WebGLElementArrayCache.h @@ -33,7 +33,8 @@ public: bool BufferData(const void* ptr, size_t byteSize); void BufferSubData(size_t pos, const void* ptr, size_t updateByteSize); - bool Validate(GLenum type, uint32_t maxAllowed, size_t first, size_t count); + bool Validate(GLenum type, uint32_t maxAllowed, size_t first, size_t count, + uint32_t* out_upperBound = nullptr); template T Element(size_t i) const { return Elements()[i]; } @@ -53,7 +54,8 @@ public: private: template - bool Validate(uint32_t maxAllowed, size_t first, size_t count); + bool Validate(uint32_t maxAllowed, size_t first, size_t count, + uint32_t* out_upperBound); size_t ByteSize() const { return mByteSize; diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index 240c3d4f7fe..a494b8522f8 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -1221,6 +1221,16 @@ MediaStreamGraphImpl::RunThread() } } + // The loop is woken up so soon that mCurrentTime barely advances and we + // end up having endBlockingDecisions == mStateComputedTime. + // Since stream blocking is computed in the interval of + // [mStateComputedTime, endBlockingDecisions), it won't be computed at all. + // We should ensure next iteration so that pending blocking changes will be + // computed in next loop. + if (endBlockingDecisions == mStateComputedTime) { + ensureNextIteration = true; + } + // Figure out which streams are blocked and when. GraphTime prevComputedTime = mStateComputedTime; RecomputeBlocking(endBlockingDecisions); diff --git a/content/media/TextTrackRegion.h b/content/media/TextTrackRegion.h index 775af6cf30a..fa4f1c63c98 100644 --- a/content/media/TextTrackRegion.h +++ b/content/media/TextTrackRegion.h @@ -13,6 +13,7 @@ #include "nsWrapperCache.h" #include "mozilla/ErrorResult.h" #include "mozilla/dom/TextTrack.h" +#include "mozilla/Preferences.h" namespace mozilla { namespace dom { @@ -28,6 +29,12 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(TextTrackRegion) + static bool RegionsEnabled(JSContext* cx, JSObject* obj) + { + return Preferences::GetBool("media.webvtt.enabled") && + Preferences::GetBool("media.webvtt.regions.enabled"); + } + virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; diff --git a/content/media/test/mochitest.ini b/content/media/test/mochitest.ini index df301b9434d..29e500fb8f4 100644 --- a/content/media/test/mochitest.ini +++ b/content/media/test/mochitest.ini @@ -380,7 +380,6 @@ skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(bug 90 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(timed out in small-shot.mp3) b2g-desktop(timed out in small-shot.mp3) [test_readyState.html] [test_referer.html] -skip-if = buildapp == 'b2g' [test_reset_events_async.html] [test_replay_metadata.html] skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) diff --git a/content/media/test/test_preload_actions.html b/content/media/test/test_preload_actions.html index b2797329202..015fe32a0b4 100644 --- a/content/media/test/test_preload_actions.html +++ b/content/media/test/test_preload_actions.html @@ -74,7 +74,7 @@ var tests = [ // is(v.networkState, v.NETWORK_IDLE, "(1) NetworkState must be NETWORK_IDLE"); maybeFinish(v, 1); }, - + setup: function(v) { v._gotLoadStart = false; @@ -86,6 +86,8 @@ var tests = [ v.src = test.name; document.body.appendChild(v); // Causes implicit load, which will be halted due to preload:none. }, + + name: "test1", }, { // 2. Add preload:metadata video with src to document. Should halt with NETWORK_IDLE, HAVE_CURRENT_DATA @@ -100,7 +102,7 @@ var tests = [ // is(v.networkState, v.NETWORK_IDLE, "(2) NetworkState must be NETWORK_IDLE"); maybeFinish(v, 2); }, - + setup: function(v) { v._gotLoadStart = false; @@ -113,6 +115,8 @@ var tests = [ document.body.appendChild(v); // Causes implicit load, which will be halted after // metadata due to preload:metadata. }, + + name: "test2", }, { // 3. Add preload:auto to document. Should receive canplaythrough eventually. @@ -123,7 +127,7 @@ var tests = [ is(v._gotLoadedMetaData, true, "(3) Must get loadedmetadata."); maybeFinish(v, 3); }, - + setup: function(v) { v._gotLoadStart = false; @@ -135,6 +139,8 @@ var tests = [ v.src = test.name; // Causes implicit load. document.body.appendChild(v); }, + + name: "test3", }, { // 4. Add preload:none video to document. Call play(), should load then play through. @@ -152,13 +158,13 @@ var tests = [ // is(v.networkState, v.NETWORK_IDLE, "(4) NetworkState must be NETWORK_IDLE"); v.play(); // Should load and play through. }, - + ended: function(e) { ok(true, "(4) Got playback ended"); maybeFinish(e.target, 4); }, - + setup: function(v) { v._gotLoadStart = false; @@ -172,6 +178,8 @@ var tests = [ v.src = test.name; document.body.appendChild(v); }, + + name: "test4", }, { // 5. preload:none video without resource, add to document, will implicitly start a @@ -186,7 +194,7 @@ var tests = [ // is(v.networkState, v.NETWORK_IDLE, "(5) NetworkState must be NETWORK_IDLE"); maybeFinish(v, 5); }, - + setup: function(v) { v._gotLoadStart = false; @@ -198,6 +206,8 @@ var tests = [ document.body.appendChild(v); // Causes implicit load, which will be halted due to no resource. v.src = test.name; // Load should start, and halt at preload:none. }, + + name: "test5", }, { // 6. preload:none video without resource, add to document, will implicitly start a @@ -212,7 +222,7 @@ var tests = [ // is(v.networkState, v.NETWORK_IDLE, "(6) NetworkState must be NETWORK_IDLE"); maybeFinish(v, 6); }, - + setup: function(v) { v._gotLoadStart = false; @@ -227,6 +237,8 @@ var tests = [ s.type = test.type; v.appendChild(s); // Load should start, and halt at preload:none. }, + + name: "test6", }, { // 7. create a preload:none document with multiple sources, the first of which is invalid. @@ -252,7 +264,7 @@ var tests = [ is(v._gotErrorEvent, true, "(7) Should get error event from first source load failure"); maybeFinish(v, 7); }, - + setup: function(v) { v._gotLoadStart = false; @@ -274,6 +286,8 @@ var tests = [ v.appendChild(s2); document.body.appendChild(v); // Causes implicit load, which will be halt at preload:none on the second resource. }, + + name: "test7", }, { // 8. Change preload value from none to metadata should cause metadata to be loaded. @@ -286,7 +300,7 @@ var tests = [ // is(v.networkState, v.NETWORK_IDLE, "(8) NetworkState must be NETWORK_IDLE when load is halted"); maybeFinish(v, 8); }, - + setup: function(v) { v._gotLoadedMetaData = false; @@ -297,6 +311,8 @@ var tests = [ v.src = test.name; // Causes implicit load. document.body.appendChild(v); }, + + name: "test8", }, /*{ // 9. Change preload value from metadata to auto should cause entire media to be loaded. @@ -309,7 +325,7 @@ var tests = [ is(v._gotLoadedMetaData, true, "(9) Must get loadedmetadata."); maybeFinish(v, 9); }, - + setup: function(v) { v._gotLoadStart = false; @@ -331,7 +347,7 @@ var tests = [ is(v._gotLoadedMetaData, true, "(10) Must get loadedmetadata."); maybeFinish(v, 10); }, - + setup: function(v) { v._gotLoadedMetaData = false; @@ -342,6 +358,8 @@ var tests = [ v.src = test.name; // Causes implicit load. document.body.appendChild(v); }, + + name: "test10", }, { // 11. Change preload value from none to metadata should cause metadata to load. @@ -365,10 +383,14 @@ var tests = [ v.src = test.name; // Causes implicit load. document.body.appendChild(v); }, + + name: "test11", }, - { + /*{ // 12. Change preload value from auto to metadata after load started, // should still do full load, should not halt after metadata only. + // disable this test since the spec is no longer found in the document + // http://dev.w3.org/html5/spec-preview/media-elements.html canplaythrough: function(e) { var v = e.target; @@ -389,7 +411,9 @@ var tests = [ document.body.appendChild(v); v.preload = "metadata"; }, - }, + + name: "test12", + },*/ { // 13. Change preload value from auto to none after specifying a src // should load according to preload none, no buffering should have taken place @@ -416,7 +440,9 @@ var tests = [ v.addEventListener("suspend", this.suspend, false); document.body.appendChild(v); // Causes implicit load, should load according to preload none var s = document.createElement("source"); - } + }, + + name: "test13", }, { // 14. Add preload:metadata video with src to document. Play(), should play through. @@ -430,7 +456,7 @@ var tests = [ // is(v.networkState, v.NETWORK_IDLE, "(14) NetworkState must be NETWORK_IDLE"); v.play(); }, - + ended: function(e) { ok(true, "(14) Got playback ended"); @@ -451,6 +477,8 @@ var tests = [ document.body.appendChild(v); // Causes implicit load, which will be halted after // metadata due to preload:metadata. }, + + name: "test14", }, { // 15. Autoplay should override preload:none. @@ -460,7 +488,7 @@ var tests = [ var v = e.target; maybeFinish(v, 15); }, - + setup: function(v) { v._gotLoadStart = false; @@ -473,6 +501,8 @@ var tests = [ v.src = test.name; // Causes implicit load. document.body.appendChild(v); }, + + name: "test15", }, { // 16. Autoplay should override preload:metadata. @@ -482,7 +512,7 @@ var tests = [ var v = e.target; maybeFinish(v, 16); }, - + setup: function(v) { v.preload = "metadata"; @@ -491,6 +521,8 @@ var tests = [ v.src = test.name; // Causes implicit load. document.body.appendChild(v); }, + + name: "test16", }, { // 17. On a preload:none video, adding autoplay should disable preload none, i.e. don't break autoplay! @@ -500,7 +532,7 @@ var tests = [ var v = e.target; maybeFinish(v, 17); }, - + setup: function(v) { v.addEventListener("ended", this.ended, false); @@ -508,7 +540,9 @@ var tests = [ document.body.appendChild(v); // Causes implicit load, which will be halted due to preload:none. v.autoplay = true; v.src = test.name; - }, + }, + + name: "test17", }, { // 18. On a preload='none' video, call play() before load algorithms's sync @@ -519,7 +553,7 @@ var tests = [ var v = e.target; maybeFinish(v, 18); }, - + setup: function(v) { v.addEventListener("ended", this.ended, false); @@ -527,7 +561,9 @@ var tests = [ v.src = test.name; // Schedules async section to continue load algorithm. document.body.appendChild(v); v.play(); // Should cause preload:none to be overridden. - }, + }, + + name: "test18", }, { // 19. Set preload='auto' on first video source then switching preload='none' and swapping the video source to another. @@ -555,7 +591,9 @@ var tests = [ // add a listener for when the video has loaded, so we know preload auto has worked v.addEventListener( "loadedmetadata", this.loadedmetadata, false); document.body.appendChild(v); - } + }, + + name: "test19", } ]; @@ -563,6 +601,7 @@ var iterationCount = 0; function startTest(test, token) { if (test == tests[0]) { ++iterationCount; + info("iterationCount=" + iterationCount); } if (iterationCount == 2) { // Do this series of tests on logically different resources diff --git a/content/media/test/test_referer.html b/content/media/test/test_referer.html index 0c24f80f3e0..93a98208824 100644 --- a/content/media/test/test_referer.html +++ b/content/media/test/test_referer.html @@ -28,12 +28,20 @@ function checkComplete() { SimpleTest.finish(); } - + +function removeNode(v) { + v.removeEventListener("error", loadError, false); + v.removeEventListener("loadedmetadata", loadedMetadata, false); + v.remove(); + v.src = ""; +} + function loadError(evt) { // If no referer is sent then the sjs returns an error ok(false, "check referer is sent with media request"); evt.target._complete = true; checkComplete(); + removeNode(evt.target); } function loadedMetadata(evt) { @@ -41,6 +49,7 @@ function loadedMetadata(evt) { ok(true, "check referer is sent with media request"); evt.target._complete = true; checkComplete(); + removeNode(evt.target); } // Create all media objects. @@ -56,6 +65,8 @@ for (var i=0; i