Skip to content

Commit

Permalink
merge mozilla-inbound to mozilla-central a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed Feb 3, 2017
2 parents 96feb72 + 3a2cb58 commit e95ecef
Show file tree
Hide file tree
Showing 371 changed files with 7,231 additions and 6,114 deletions.
10 changes: 10 additions & 0 deletions chrome/nsChromeRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,15 @@ nsChromeRegistry::MustLoadURLRemotely(nsIURI *aURI, bool *aResult)
bool
nsChromeRegistry::GetDirectionForLocale(const nsACString& aLocale)
{
#ifdef ENABLE_INTL_API
int pref = mozilla::Preferences::GetInt("intl.uidirection", -1);
if (pref >= 0) {
return (pref > 0);
}
nsAutoCString locale(aLocale);
SanitizeForBCP47(locale);
return uloc_isRightToLeft(locale.get());
#else
// first check the intl.uidirection.<locale> preference, and if that is not
// set, check the same preference but with just the first two characters of
// the locale. If that isn't set, default to left-to-right.
Expand All @@ -670,6 +679,7 @@ nsChromeRegistry::GetDirectionForLocale(const nsACString& aLocale)
}

return dir.EqualsLiteral("rtl");
#endif
}

NS_IMETHODIMP_(bool)
Expand Down
3 changes: 2 additions & 1 deletion chrome/nsIChromeRegistry.idl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ interface nsIXULChromeRegistry : nsIChromeRegistry
ACString getSelectedLocale(in ACString packageName,
[optional] in boolean asBCP47);

// Get the direction of the locale via the intl.uidirection.<locale> pref
// Get whether the default writing direction of the locale is RTL
// (or may be overridden by intl.uidirection pref)
boolean isLocaleRTL(in ACString package);

/* Should be called when skins change. Reloads only stylesheets. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ add_task(function* () {
hostWindow.resizeTo(640, 300);

info("Testing transitions ltr");
yield pushPref("intl.uidirection.en-US", "ltr");
yield pushPref("intl.uidirection", 0);
yield testBreadcrumbTransitions(hostWindow, inspector);

info("Testing transitions rtl");
yield pushPref("intl.uidirection.en-US", "rtl");
yield pushPref("intl.uidirection", 1);
yield testBreadcrumbTransitions(hostWindow, inspector);

hostWindow.resizeTo(originalWidth, originalHeight);
Expand Down
21 changes: 14 additions & 7 deletions dom/base/nsJSEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
#include "nsIXULRuntime.h"
#include "nsTextFormatter.h"
#include "ScriptSettings.h"

#ifdef XP_WIN
#include <process.h>
#define getpid _getpid
#else
#include <unistd.h> // for getpid()
#endif
#include "xpcpublic.h"

#include "jsapi.h"
Expand Down Expand Up @@ -1621,11 +1626,11 @@ nsJSContext::EndCycleCollectionCallback(CycleCollectorResults &aResults)
}

NS_NAMED_MULTILINE_LITERAL_STRING(kFmt,
u"CC(T+%.1f)[%s] max pause: %lums, total time: %lums, slices: %lu, suspected: %lu, visited: %lu RCed and %lu%s GCed, collected: %lu RCed and %lu GCed (%lu|%lu|%lu waiting for GC)%s\n"
u"CC(T+%.1f)[%s-%i] max pause: %lums, total time: %lums, slices: %lu, suspected: %lu, visited: %lu RCed and %lu%s GCed, collected: %lu RCed and %lu GCed (%lu|%lu|%lu waiting for GC)%s\n"
u"ForgetSkippable %lu times before CC, min: %lu ms, max: %lu ms, avg: %lu ms, total: %lu ms, max sync: %lu ms, removed: %lu");
nsString msg;
msg.Adopt(nsTextFormatter::smprintf(kFmt.get(), double(delta) / PR_USEC_PER_SEC,
ProcessNameForCollectorLog(),
ProcessNameForCollectorLog(), getpid(),
gCCStats.mMaxSliceTime, gCCStats.mTotalSliceTime,
aResults.mNumSlices, gCCStats.mSuspected,
aResults.mVisitedRefCounted, aResults.mVisitedGCed, mergeMsg.get(),
Expand Down Expand Up @@ -2121,12 +2126,13 @@ DOMGCSliceCallback(JSContext* aCx, JS::GCProgress aProgress, const JS::GCDescrip
PRTime delta = GetCollectionTimeDelta();

if (sPostGCEventsToConsole) {
NS_NAMED_LITERAL_STRING(kFmt, "GC(T+%.1f)[%s] ");
NS_NAMED_LITERAL_STRING(kFmt, "GC(T+%.1f)[%s-%i] ");
nsString prefix, gcstats;
gcstats.Adopt(aDesc.formatSummaryMessage(aCx));
prefix.Adopt(nsTextFormatter::smprintf(kFmt.get(),
double(delta) / PR_USEC_PER_SEC,
ProcessNameForCollectorLog()));
ProcessNameForCollectorLog(),
getpid()));
nsString msg = prefix + gcstats;
nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (cs) {
Expand Down Expand Up @@ -2202,11 +2208,12 @@ DOMGCSliceCallback(JSContext* aCx, JS::GCProgress aProgress, const JS::GCDescrip
}

if (sPostGCEventsToConsole) {
NS_NAMED_LITERAL_STRING(kFmt, "[%s] ");
NS_NAMED_LITERAL_STRING(kFmt, "[%s-%i] ");
nsString prefix, gcstats;
gcstats.Adopt(aDesc.formatSliceMessage(aCx));
prefix.Adopt(nsTextFormatter::smprintf(kFmt.get(),
ProcessNameForCollectorLog()));
ProcessNameForCollectorLog(),
getpid()));
nsString msg = prefix + gcstats;
nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
if (cs) {
Expand Down
11 changes: 7 additions & 4 deletions dom/bindings/Bindings.conf
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ DOMInterfaces = {

'DedicatedWorkerGlobalScope': {
'headerFile': 'mozilla/dom/WorkerScope.h',
'implicitJSContext': [ 'close' ],
},

'DeviceAcceleration': {
Expand Down Expand Up @@ -826,11 +827,11 @@ DOMInterfaces = {
'SharedWorker': {
'nativeType': 'mozilla::dom::workers::SharedWorker',
'headerFile': 'mozilla/dom/workers/bindings/SharedWorker.h',
'implicitJSContext': [ 'constructor' ],
},

'SharedWorkerGlobalScope': {
'headerFile': 'mozilla/dom/WorkerScope.h',
'implicitJSContext': [ 'close' ],
},

'StyleSheet': {
Expand Down Expand Up @@ -1291,6 +1292,11 @@ DOMInterfaces = {
'headerFile': 'WebGLExtensions.h'
},

'MOZ_debug_get': {
'nativeType': 'mozilla::WebGLExtensionDebugGet',
'headerFile': 'WebGLExtensions.h'
},

'WebGLFramebuffer': {
'nativeType': 'mozilla::WebGLFramebuffer',
'headerFile': 'WebGLFramebuffer.h'
Expand Down Expand Up @@ -1404,9 +1410,6 @@ DOMInterfaces = {
'WorkerGlobalScope': {
'headerFile': 'mozilla/dom/WorkerScope.h',
'concrete': False,
'implicitJSContext': [
'close',
],
# Rename a few things so we don't have both classes and methods
# with the same name
'binaryNames': {
Expand Down
4 changes: 2 additions & 2 deletions dom/bindings/test/test_exception_messages.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
[ '(new TextDecoder).decode(new Uint8Array(), 5)',
"Argument 2 of TextDecoder.decode can't be converted to a dictionary.",
"primitive passed for a dictionary" ],
[ 'URL.createObjectURL(null, null)',
"Argument 1 is not valid for any of the 2-argument overloads of URL.createObjectURL.",
[ 'URL.createObjectURL(null)',
"Argument 1 is not valid for any of the 1-argument overloads of URL.createObjectURL.",
"overload resolution failure" ],
[ 'document.createElement("select").add({})',
"Argument 1 of HTMLSelectElement.add could not be converted to any of: HTMLOptionElement, HTMLOptGroupElement.",
Expand Down
8 changes: 8 additions & 0 deletions dom/canvas/WebGLContextExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -90,6 +91,8 @@ bool WebGLContext::IsExtensionSupported(dom::CallerType callerType,

if (allowPrivilegedExts) {
switch (ext) {
case WebGLExtensionID::MOZ_debug_get:
return true;
case WebGLExtensionID::WEBGL_debug_renderer_info:
return true;
case WebGLExtensionID::WEBGL_debug_shaders:
Expand Down Expand Up @@ -377,6 +380,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);
Expand Down
12 changes: 0 additions & 12 deletions dom/canvas/WebGLContextState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
14 changes: 14 additions & 0 deletions dom/canvas/WebGLContextUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,4 +911,18 @@ 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
2 changes: 2 additions & 0 deletions dom/canvas/WebGLContextUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
79 changes: 79 additions & 0 deletions dom/canvas/WebGLExtensionDebugGet.cpp
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions dom/canvas/WebGLExtensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "WebGLTypes.h"

namespace mozilla {
class ErrorResult;

namespace dom {
template<typename> struct Nullable;
Expand Down Expand Up @@ -403,6 +404,19 @@ class WebGLExtensionDisjointTimerQuery
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_
1 change: 1 addition & 0 deletions dom/canvas/WebGLTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions dom/canvas/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ UNIFIED_SOURCES += [
'WebGLExtensionCompressedTextureETC1.cpp',
'WebGLExtensionCompressedTexturePVRTC.cpp',
'WebGLExtensionCompressedTextureS3TC.cpp',
'WebGLExtensionDebugGet.cpp',
'WebGLExtensionDebugRendererInfo.cpp',
'WebGLExtensionDebugShaders.cpp',
'WebGLExtensionDepthTexture.cpp',
Expand Down
Loading

0 comments on commit e95ecef

Please sign in to comment.