summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
Diffstat (limited to 'dom')
-rw-r--r--dom/bindings/Bindings.conf5
-rw-r--r--dom/canvas/WebGLContextExtensions.cpp8
-rw-r--r--dom/canvas/WebGLContextState.cpp12
-rw-r--r--dom/canvas/WebGLContextUtils.cpp12
-rw-r--r--dom/canvas/WebGLContextUtils.h2
-rw-r--r--dom/canvas/WebGLExtensionDebugGet.cpp79
-rw-r--r--dom/canvas/WebGLExtensions.h14
-rw-r--r--dom/canvas/WebGLTypes.h1
-rw-r--r--dom/canvas/moz.build1
-rw-r--r--dom/locales/en-US/chrome/security/security.properties1
-rw-r--r--dom/media/fmp4/MP4Demuxer.cpp9
-rw-r--r--dom/webidl/WebGLRenderingContext.webidl9
12 files changed, 139 insertions, 14 deletions
diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
index aa7f26ad6..6f9733c5f 100644
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1222,6 +1222,11 @@ DOMInterfaces = {
'headerFile': 'WebGLExtensions.h'
},
+'MOZ_debug_get': {
+ 'nativeType': 'mozilla::WebGLExtensionDebugGet',
+ 'headerFile': 'WebGLExtensions.h'
+},
+
'WebGLFramebuffer': {
'nativeType': 'mozilla::WebGLFramebuffer',
'headerFile': 'WebGLFramebuffer.h'
diff --git a/dom/canvas/WebGLContextExtensions.cpp b/dom/canvas/WebGLContextExtensions.cpp
index 4a5a23274..7f338b4e9 100644
--- a/dom/canvas/WebGLContextExtensions.cpp
+++ b/dom/canvas/WebGLContextExtensions.cpp
@@ -40,6 +40,7 @@ WebGLContext::GetExtensionString(WebGLExtensionID ext)
WEBGL_EXTENSION_IDENTIFIER(EXT_sRGB)
WEBGL_EXTENSION_IDENTIFIER(EXT_texture_filter_anisotropic)
WEBGL_EXTENSION_IDENTIFIER(EXT_disjoint_timer_query)
+ WEBGL_EXTENSION_IDENTIFIER(MOZ_debug_get)
WEBGL_EXTENSION_IDENTIFIER(OES_element_index_uint)
WEBGL_EXTENSION_IDENTIFIER(OES_standard_derivatives)
WEBGL_EXTENSION_IDENTIFIER(OES_texture_float)
@@ -91,6 +92,8 @@ bool WebGLContext::IsExtensionSupported(dom::CallerType callerType,
switch (ext) {
case WebGLExtensionID::EXT_disjoint_timer_query:
return WebGLExtensionDisjointTimerQuery::IsSupported(this);
+ case WebGLExtensionID::MOZ_debug_get:
+ return true;
case WebGLExtensionID::WEBGL_debug_renderer_info:
return true;
case WebGLExtensionID::WEBGL_debug_shaders:
@@ -372,6 +375,11 @@ WebGLContext::EnableExtension(WebGLExtensionID ext)
obj = new WebGLExtensionTextureFilterAnisotropic(this);
break;
+ // MOZ_
+ case WebGLExtensionID::MOZ_debug_get:
+ obj = new WebGLExtensionDebugGet(this);
+ break;
+
// OES_
case WebGLExtensionID::OES_element_index_uint:
obj = new WebGLExtensionElementIndexUint(this);
diff --git a/dom/canvas/WebGLContextState.cpp b/dom/canvas/WebGLContextState.cpp
index e0234f5c6..c2f4c1a75 100644
--- a/dom/canvas/WebGLContextState.cpp
+++ b/dom/canvas/WebGLContextState.cpp
@@ -61,18 +61,6 @@ WebGLContext::Enable(GLenum cap)
gl->fEnable(cap);
}
-static JS::Value
-StringValue(JSContext* cx, const nsAString& str, ErrorResult& rv)
-{
- JSString* jsStr = JS_NewUCStringCopyN(cx, str.BeginReading(), str.Length());
- if (!jsStr) {
- rv.Throw(NS_ERROR_OUT_OF_MEMORY);
- return JS::NullValue();
- }
-
- return JS::StringValue(jsStr);
-}
-
bool
WebGLContext::GetStencilBits(GLint* const out_stencilBits)
{
diff --git a/dom/canvas/WebGLContextUtils.cpp b/dom/canvas/WebGLContextUtils.cpp
index 9c0d34939..3fd32eb30 100644
--- a/dom/canvas/WebGLContextUtils.cpp
+++ b/dom/canvas/WebGLContextUtils.cpp
@@ -874,4 +874,16 @@ InfoFrom(WebGLTexImageFunc func, WebGLTexDimensions dims)
}
}
+JS::Value
+StringValue(JSContext* cx, const nsAString& str, ErrorResult& er)
+{
+ JSString* jsStr = JS_NewUCStringCopyN(cx, str.BeginReading(), str.Length());
+ if (!jsStr) {
+ er.Throw(NS_ERROR_OUT_OF_MEMORY);
+ return JS::NullValue();
+ }
+
+ return JS::StringValue(jsStr);
+}
+
} // namespace mozilla
diff --git a/dom/canvas/WebGLContextUtils.h b/dom/canvas/WebGLContextUtils.h
index 5401fc878..1d06659b1 100644
--- a/dom/canvas/WebGLContextUtils.h
+++ b/dom/canvas/WebGLContextUtils.h
@@ -94,6 +94,8 @@ WebGLContext::WebGLObjectAsJSObject(JSContext* cx,
*/
const char* InfoFrom(WebGLTexImageFunc func, WebGLTexDimensions dims);
+JS::Value StringValue(JSContext* cx, const nsAString& str, ErrorResult& er);
+
} // namespace mozilla
#endif // WEBGL_CONTEXT_UTILS_H_
diff --git a/dom/canvas/WebGLExtensionDebugGet.cpp b/dom/canvas/WebGLExtensionDebugGet.cpp
new file mode 100644
index 000000000..39bb3c57a
--- /dev/null
+++ b/dom/canvas/WebGLExtensionDebugGet.cpp
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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 "WebGLExtensions.h"
+
+#include "mozilla/dom/WebGLRenderingContextBinding.h"
+#include "WebGLContext.h"
+#include "WebGLContextUtils.h"
+
+namespace mozilla {
+
+WebGLExtensionDebugGet::WebGLExtensionDebugGet(WebGLContext* webgl)
+ : WebGLExtensionBase(webgl)
+{
+}
+
+WebGLExtensionDebugGet::~WebGLExtensionDebugGet()
+{
+}
+
+void
+WebGLExtensionDebugGet::GetParameter(JSContext* cx, GLenum pname,
+ JS::MutableHandle<JS::Value> retval,
+ ErrorResult& er) const
+{
+ const auto& gl = mContext->gl;
+ gl->MakeCurrent();
+
+ switch (pname) {
+ case LOCAL_GL_EXTENSIONS:
+ {
+ nsString ret;
+ if (!gl->IsCoreProfile()) {
+ const auto rawExts = (const char*)gl->fGetString(LOCAL_GL_EXTENSIONS);
+ ret = NS_ConvertUTF8toUTF16(rawExts);
+ } else {
+ const auto& numExts = gl->GetIntAs<GLuint>(LOCAL_GL_NUM_EXTENSIONS);
+ for (GLuint i = 0; i < numExts; i++) {
+ const auto rawExt = (const char*)gl->fGetStringi(LOCAL_GL_EXTENSIONS,
+ i);
+ if (i > 0) {
+ ret.AppendLiteral(" ");
+ }
+ ret.Append(NS_ConvertUTF8toUTF16(rawExt));
+ }
+ }
+ retval.set(StringValue(cx, ret, er));
+ return;
+ }
+
+ case LOCAL_GL_RENDERER:
+ case LOCAL_GL_VENDOR:
+ case LOCAL_GL_VERSION:
+ {
+ const auto raw = (const char*)gl->fGetString(pname);
+ retval.set(StringValue(cx, NS_ConvertUTF8toUTF16(raw), er));
+ return;
+ }
+
+ case 0x10000: // "WSI_INFO"
+ {
+ nsCString info;
+ gl->GetWSIInfo(&info);
+ retval.set(StringValue(cx, NS_ConvertUTF8toUTF16(info), er));
+ return;
+ }
+
+ default:
+ mContext->ErrorInvalidEnumArg("MOZ_debug_get.getParameter", "pname", pname);
+ retval.set(JS::NullValue());
+ return;
+ }
+}
+
+IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionDebugGet, MOZ_debug_get)
+
+} // namespace mozilla
diff --git a/dom/canvas/WebGLExtensions.h b/dom/canvas/WebGLExtensions.h
index 741f6997f..7b6b6b54b 100644
--- a/dom/canvas/WebGLExtensions.h
+++ b/dom/canvas/WebGLExtensions.h
@@ -12,6 +12,7 @@
#include "WebGLTypes.h"
namespace mozilla {
+class ErrorResult;
namespace dom {
template<typename T>
@@ -385,6 +386,19 @@ public:
DECL_WEBGL_EXTENSION_GOOP
};
+class WebGLExtensionDebugGet final
+ : public WebGLExtensionBase
+{
+public:
+ explicit WebGLExtensionDebugGet(WebGLContext* webgl);
+ virtual ~WebGLExtensionDebugGet();
+
+ void GetParameter(JSContext* cx, GLenum pname,
+ JS::MutableHandle<JS::Value> retval, ErrorResult& er) const;
+
+ DECL_WEBGL_EXTENSION_GOOP
+};
+
} // namespace mozilla
#endif // WEBGL_EXTENSIONS_H_
diff --git a/dom/canvas/WebGLTypes.h b/dom/canvas/WebGLTypes.h
index 42b8701f3..2f4a4368a 100644
--- a/dom/canvas/WebGLTypes.h
+++ b/dom/canvas/WebGLTypes.h
@@ -149,6 +149,7 @@ enum class WebGLExtensionID : uint8_t {
EXT_shader_texture_lod,
EXT_texture_filter_anisotropic,
EXT_disjoint_timer_query,
+ MOZ_debug_get,
OES_element_index_uint,
OES_standard_derivatives,
OES_texture_float,
diff --git a/dom/canvas/moz.build b/dom/canvas/moz.build
index f7555b33d..6d5e2756f 100644
--- a/dom/canvas/moz.build
+++ b/dom/canvas/moz.build
@@ -105,6 +105,7 @@ UNIFIED_SOURCES += [
'WebGLExtensionCompressedTextureETC1.cpp',
'WebGLExtensionCompressedTexturePVRTC.cpp',
'WebGLExtensionCompressedTextureS3TC.cpp',
+ 'WebGLExtensionDebugGet.cpp',
'WebGLExtensionDebugRendererInfo.cpp',
'WebGLExtensionDebugShaders.cpp',
'WebGLExtensionDepthTexture.cpp',
diff --git a/dom/locales/en-US/chrome/security/security.properties b/dom/locales/en-US/chrome/security/security.properties
index c0b80996c..8efdb0a6d 100644
--- a/dom/locales/en-US/chrome/security/security.properties
+++ b/dom/locales/en-US/chrome/security/security.properties
@@ -8,6 +8,7 @@ BlockMixedActiveContent = Blocked loading mixed active content “%1$S”
CORSDisabled=Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at %1$S. (Reason: CORS disabled).
CORSRequestNotHttp=Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at %1$S. (Reason: CORS request not http).
CORSMissingAllowOrigin=Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at %1$S. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
+CORSMultipleAllowOriginNotAllowed=Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at %1$S. (Reason: Multiple CORS headers ‘Access-Control-Allow-Origin’ not allowed).
CORSAllowOriginNotMatchingOrigin=Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at %1$S. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘%2$S’).
CORSNotSupportingCredentials=Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at ‘%1$S’. (Reason: Credential is not supported if the CORS header ‘Access-Control-Allow-Origin’ is ‘*’).
CORSMethodNotFound=Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at %1$S. (Reason: Did not find method in CORS header ‘Access-Control-Allow-Methods’).
diff --git a/dom/media/fmp4/MP4Demuxer.cpp b/dom/media/fmp4/MP4Demuxer.cpp
index 70b176699..646897468 100644
--- a/dom/media/fmp4/MP4Demuxer.cpp
+++ b/dom/media/fmp4/MP4Demuxer.cpp
@@ -349,8 +349,13 @@ MP4TrackDemuxer::GetNextSample()
if (sample->mCrypto.mValid) {
nsAutoPtr<MediaRawDataWriter> writer(sample->CreateWriter());
writer->mCrypto.mMode = mInfo->mCrypto.mMode;
- writer->mCrypto.mIVSize = mInfo->mCrypto.mIVSize;
- writer->mCrypto.mKeyId.AppendElements(mInfo->mCrypto.mKeyId);
+
+ // Only use the default key parsed from the moov if we haven't already got
+ // one from the sample group description.
+ if (writer->mCrypto.mKeyId.Length() == 0) {
+ writer->mCrypto.mIVSize = mInfo->mCrypto.mIVSize;
+ writer->mCrypto.mKeyId.AppendElements(mInfo->mCrypto.mKeyId);
+ }
}
return sample.forget();
}
diff --git a/dom/webidl/WebGLRenderingContext.webidl b/dom/webidl/WebGLRenderingContext.webidl
index dd0e6ff69..323d23421 100644
--- a/dom/webidl/WebGLRenderingContext.webidl
+++ b/dom/webidl/WebGLRenderingContext.webidl
@@ -1046,3 +1046,12 @@ interface EXT_disjoint_timer_query {
any getQueryEXT(GLenum target, GLenum pname);
any getQueryObjectEXT(WebGLQuery query, GLenum pname);
};
+
+[NoInterfaceObject]
+interface MOZ_debug_get {
+ const GLenum EXTENSIONS = 0x1F03;
+ const GLenum WSI_INFO = 0x10000;
+
+ [Throws]
+ any getParameter(GLenum pname);
+};