mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge central and inbound
This commit is contained in:
commit
63458c5e5a
@ -411,7 +411,11 @@
|
||||
@BINPATH@/components/ProfileMigrator.js
|
||||
@BINPATH@/components/ChromeProfileMigrator.js
|
||||
@BINPATH@/components/FirefoxProfileMigrator.js
|
||||
#ifdef XP_WIN
|
||||
@BINPATH@/components/SafariProfileMigrator.js
|
||||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
@BINPATH@/components/SafariProfileMigrator.js
|
||||
@BINPATH@/components/libalerts.dylib
|
||||
#endif
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
|
@ -70,6 +70,8 @@
|
||||
#include "ForceDiscreteGPUHelperCGL.h"
|
||||
#endif
|
||||
|
||||
#include "angle/ShaderLang.h"
|
||||
|
||||
/*
|
||||
* Minimum value constants defined in 6.2 State Tables of OpenGL ES - 2.0.25
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=686732
|
||||
@ -1658,6 +1660,46 @@ struct WebGLMappedIdentifier {
|
||||
WebGLMappedIdentifier(const nsACString& o, const nsACString& m) : original(o), mapped(m) {}
|
||||
};
|
||||
|
||||
struct WebGLUniformInfo {
|
||||
PRUint32 arraySize;
|
||||
bool isArray;
|
||||
ShDataType type;
|
||||
|
||||
WebGLUniformInfo(PRUint32 s = 0, bool a = false, ShDataType t = SH_NONE)
|
||||
: arraySize(s), isArray(a), type(t) {}
|
||||
|
||||
int ElementSize() const {
|
||||
switch (type) {
|
||||
case SH_INT:
|
||||
case SH_FLOAT:
|
||||
case SH_BOOL:
|
||||
case SH_SAMPLER_2D:
|
||||
case SH_SAMPLER_CUBE:
|
||||
return 1;
|
||||
case SH_INT_VEC2:
|
||||
case SH_FLOAT_VEC2:
|
||||
case SH_BOOL_VEC2:
|
||||
return 2;
|
||||
case SH_INT_VEC3:
|
||||
case SH_FLOAT_VEC3:
|
||||
case SH_BOOL_VEC3:
|
||||
return 3;
|
||||
case SH_INT_VEC4:
|
||||
case SH_FLOAT_VEC4:
|
||||
case SH_BOOL_VEC4:
|
||||
case SH_FLOAT_MAT2:
|
||||
return 4;
|
||||
case SH_FLOAT_MAT3:
|
||||
return 9;
|
||||
case SH_FLOAT_MAT4:
|
||||
return 16;
|
||||
default:
|
||||
NS_ABORT(); // should never get here
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class WebGLShader MOZ_FINAL
|
||||
: public nsIWebGLShader
|
||||
, public WebGLRefCountedObject<WebGLShader>
|
||||
@ -1733,6 +1775,7 @@ protected:
|
||||
WebGLMonotonicHandle mMonotonicHandle;
|
||||
nsTArray<WebGLMappedIdentifier> mAttributes;
|
||||
nsTArray<WebGLMappedIdentifier> mUniforms;
|
||||
nsTArray<WebGLUniformInfo> mUniformInfos;
|
||||
int mAttribMaxNameLength;
|
||||
};
|
||||
|
||||
@ -1765,7 +1808,8 @@ static bool SplitLastSquareBracket(nsACString& string, nsCString& bracketPart)
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef nsDataHashtable<nsCStringHashKey, nsCString> CStringHash;
|
||||
typedef nsDataHashtable<nsCStringHashKey, nsCString> CStringMap;
|
||||
typedef nsDataHashtable<nsCStringHashKey, WebGLUniformInfo> CStringToUniformInfoMap;
|
||||
|
||||
class WebGLProgram MOZ_FINAL
|
||||
: public nsIWebGLProgram
|
||||
@ -1867,7 +1911,7 @@ public:
|
||||
void MapIdentifier(const nsACString& name, nsCString *mappedName) {
|
||||
if (!mIdentifierMap) {
|
||||
// if the identifier map doesn't exist yet, build it now
|
||||
mIdentifierMap = new CStringHash;
|
||||
mIdentifierMap = new CStringMap;
|
||||
mIdentifierMap->Init();
|
||||
for (size_t i = 0; i < mAttachedShaders.Length(); i++) {
|
||||
for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) {
|
||||
@ -1915,7 +1959,7 @@ public:
|
||||
void ReverseMapIdentifier(const nsACString& name, nsCString *reverseMappedName) {
|
||||
if (!mIdentifierReverseMap) {
|
||||
// if the identifier reverse map doesn't exist yet, build it now
|
||||
mIdentifierReverseMap = new CStringHash;
|
||||
mIdentifierReverseMap = new CStringMap;
|
||||
mIdentifierReverseMap->Init();
|
||||
for (size_t i = 0; i < mAttachedShaders.Length(); i++) {
|
||||
for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) {
|
||||
@ -1957,6 +2001,44 @@ public:
|
||||
reverseMappedName->Assign(name);
|
||||
}
|
||||
|
||||
/* Returns the uniform array size (or 1 if the uniform is not an array) of
|
||||
* the uniform with given mapped identifier.
|
||||
*
|
||||
* Note: the input string |name| is the mapped identifier, not the original identifier.
|
||||
*/
|
||||
WebGLUniformInfo GetUniformInfoForMappedIdentifier(const nsACString& name) {
|
||||
if (!mUniformInfoMap) {
|
||||
// if the identifier-to-array-size map doesn't exist yet, build it now
|
||||
mUniformInfoMap = new CStringToUniformInfoMap;
|
||||
mUniformInfoMap->Init();
|
||||
for (size_t i = 0; i < mAttachedShaders.Length(); i++) {
|
||||
for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) {
|
||||
const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j];
|
||||
const WebGLUniformInfo& info = mAttachedShaders[i]->mUniformInfos[j];
|
||||
mUniformInfoMap->Put(uniform.mapped, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsCString mutableName(name);
|
||||
nsCString bracketPart;
|
||||
bool hadBracketPart = SplitLastSquareBracket(mutableName, bracketPart);
|
||||
// if there is a bracket, we're either an array or an entry in an array.
|
||||
if (hadBracketPart)
|
||||
mutableName.AppendLiteral("[0]");
|
||||
|
||||
WebGLUniformInfo info;
|
||||
mUniformInfoMap->Get(mutableName, &info);
|
||||
// we don't check if that Get failed, as if it did, it left info with default values
|
||||
|
||||
// if there is a bracket and it's not [0], then we're not an array, we're just an entry in an array
|
||||
if (hadBracketPart && !bracketPart.EqualsLiteral("[0]")) {
|
||||
info.isArray = false;
|
||||
info.arraySize = 1;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBGLPROGRAM
|
||||
|
||||
@ -1971,7 +2053,8 @@ protected:
|
||||
// post-link data
|
||||
std::vector<bool> mAttribsInUse;
|
||||
WebGLMonotonicHandle mMonotonicHandle;
|
||||
nsAutoPtr<CStringHash> mIdentifierMap, mIdentifierReverseMap;
|
||||
nsAutoPtr<CStringMap> mIdentifierMap, mIdentifierReverseMap;
|
||||
nsAutoPtr<CStringToUniformInfoMap> mUniformInfoMap;
|
||||
int mAttribMaxNameLength;
|
||||
};
|
||||
|
||||
@ -2482,12 +2565,14 @@ class WebGLUniformLocation MOZ_FINAL
|
||||
, public WebGLRefCountedObject<WebGLUniformLocation>
|
||||
{
|
||||
public:
|
||||
WebGLUniformLocation(WebGLContext *context, WebGLProgram *program, GLint location)
|
||||
WebGLUniformLocation(WebGLContext *context, WebGLProgram *program, GLint location, const WebGLUniformInfo& info)
|
||||
: WebGLContextBoundObject(context)
|
||||
, mProgram(program)
|
||||
, mProgramGeneration(program->Generation())
|
||||
, mLocation(location)
|
||||
, mInfo(info)
|
||||
{
|
||||
mElementSize = info.ElementSize();
|
||||
mMonotonicHandle = mContext->mUniformLocations.AppendElement(this);
|
||||
}
|
||||
|
||||
@ -2500,9 +2585,12 @@ public:
|
||||
mContext->mUniformLocations.RemoveElement(mMonotonicHandle);
|
||||
}
|
||||
|
||||
const WebGLUniformInfo &Info() const { return mInfo; }
|
||||
|
||||
WebGLProgram *Program() const { return mProgram; }
|
||||
GLint Location() const { return mLocation; }
|
||||
PRUint32 ProgramGeneration() const { return mProgramGeneration; }
|
||||
int ElementSize() const { return mElementSize; }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBGLUNIFORMLOCATION
|
||||
@ -2513,6 +2601,8 @@ protected:
|
||||
|
||||
PRUint32 mProgramGeneration;
|
||||
GLint mLocation;
|
||||
WebGLUniformInfo mInfo;
|
||||
int mElementSize;
|
||||
WebGLMonotonicHandle mMonotonicHandle;
|
||||
friend class WebGLProgram;
|
||||
};
|
||||
|
@ -56,11 +56,6 @@
|
||||
|
||||
#include "jstypedarray.h"
|
||||
|
||||
#if defined(USE_ANGLE)
|
||||
// shader translator
|
||||
#include "angle/ShaderLang.h"
|
||||
#endif
|
||||
|
||||
#include "WebGLTexelConversions.h"
|
||||
#include "WebGLValidateStrings.h"
|
||||
|
||||
@ -3029,8 +3024,14 @@ WebGLContext::GetUniformLocation(nsIWebGLProgram *pobj, const nsAString& name, n
|
||||
GLint intlocation = gl->fGetUniformLocation(progname, mappedName.get());
|
||||
|
||||
WebGLUniformLocation *loc = nsnull;
|
||||
if (intlocation >= 0)
|
||||
NS_ADDREF(loc = new WebGLUniformLocation(this, prog, intlocation));
|
||||
if (intlocation >= 0) {
|
||||
WebGLUniformInfo info = prog->GetUniformInfoForMappedIdentifier(mappedName);
|
||||
loc = new WebGLUniformLocation(this,
|
||||
prog,
|
||||
intlocation,
|
||||
info);
|
||||
NS_ADDREF(loc);
|
||||
}
|
||||
*retval = loc;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -4139,14 +4140,39 @@ WebGLContext::name(nsIWebGLUniformLocation *aLocation, const JS::Value& aValue,
|
||||
if (JS_GetTypedArrayType(wa) != js::TypedArray::arrayType) { \
|
||||
return ErrorInvalidOperation(#name ": array must be " #arrayType); \
|
||||
} \
|
||||
if (JS_GetTypedArrayLength(wa) == 0 || \
|
||||
JS_GetTypedArrayLength(wa) % cnt != 0) { \
|
||||
return ErrorInvalidValue(#name ": array must be > 0 elements and have " \
|
||||
"a length multiple of %d", cnt); \
|
||||
int elementSize = location_object->ElementSize(); \
|
||||
if (cnt != elementSize) { \
|
||||
return ErrorInvalidOperation( \
|
||||
#name ": this function expected a uniform of element size %d," \
|
||||
" got a uniform of element size %d", \
|
||||
cnt, \
|
||||
elementSize); \
|
||||
} \
|
||||
PRUint32 arrayLength = JS_GetTypedArrayLength(wa); \
|
||||
const WebGLUniformInfo& info = location_object->Info(); \
|
||||
PRUint32 expectedArrayLength = cnt * info.arraySize; \
|
||||
if (arrayLength < expectedArrayLength || \
|
||||
(arrayLength % cnt)) \
|
||||
{ \
|
||||
return ErrorInvalidValue("%s: expected an array of length a multiple of" \
|
||||
" %d and at least %d, got an array of length %d", \
|
||||
#name, \
|
||||
cnt, \
|
||||
expectedArrayLength, \
|
||||
arrayLength); \
|
||||
} \
|
||||
if (!info.isArray && \
|
||||
arrayLength > expectedArrayLength) { \
|
||||
return ErrorInvalidOperation("%s: expected an array of length exactly %d" \
|
||||
" (since this uniform is not an array uniform)," \
|
||||
" got an array of length %d", \
|
||||
#name, \
|
||||
expectedArrayLength, \
|
||||
arrayLength); \
|
||||
} \
|
||||
\
|
||||
MakeContextCurrent(); \
|
||||
gl->f##name(location, JS_GetTypedArrayLength(wa) / cnt, \
|
||||
gl->f##name(location, info.arraySize, \
|
||||
static_cast<ptrType*>(JS_GetTypedArrayData(wa))); \
|
||||
return NS_OK; \
|
||||
}
|
||||
@ -4168,12 +4194,37 @@ WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose,
|
||||
nsIWebGLUniformLocation* ploc = aLocation; \
|
||||
OBTAIN_UNIFORM_LOCATION(#name ": location") \
|
||||
if (JS_GetTypedArrayType(wa) != js::TypedArray::TYPE_FLOAT32) { \
|
||||
return ErrorInvalidValue(#name ": array must be TYPE_FLOAT32"); \
|
||||
return ErrorInvalidValue(#name ": array must be of Float32 type"); \
|
||||
} \
|
||||
if (JS_GetTypedArrayLength(wa) == 0 || \
|
||||
JS_GetTypedArrayLength(wa) % (dim*dim) != 0) { \
|
||||
return ErrorInvalidValue(#name ": array length must be >0 and " \
|
||||
"multiple of %d", dim*dim); \
|
||||
int elementSize = location_object->ElementSize(); \
|
||||
if (dim*dim != elementSize) { \
|
||||
return ErrorInvalidOperation( \
|
||||
#name ": this function expected a uniform of element size %d," \
|
||||
" got a uniform of element size %d", \
|
||||
dim*dim, \
|
||||
elementSize); \
|
||||
} \
|
||||
PRUint32 arrayLength = JS_GetTypedArrayLength(wa); \
|
||||
const WebGLUniformInfo& info = location_object->Info(); \
|
||||
PRUint32 expectedArrayLength = dim * dim * info.arraySize; \
|
||||
if (arrayLength < expectedArrayLength || \
|
||||
(arrayLength % (dim*dim))) \
|
||||
{ \
|
||||
return ErrorInvalidValue("%s: expected an array of length a multiple of" \
|
||||
" %d and at least %d, got an array of length %d", \
|
||||
#name, \
|
||||
dim*dim, \
|
||||
expectedArrayLength, \
|
||||
arrayLength); \
|
||||
} \
|
||||
if (!info.isArray && \
|
||||
arrayLength > expectedArrayLength) { \
|
||||
return ErrorInvalidOperation("%s: expected an array of length exactly %d" \
|
||||
" (since this uniform is not an array uniform)," \
|
||||
" got an array of length %d", \
|
||||
#name, \
|
||||
expectedArrayLength, \
|
||||
arrayLength); \
|
||||
} \
|
||||
if (aTranspose) { \
|
||||
return ErrorInvalidValue(#name ": transpose must be FALSE as per the " \
|
||||
@ -4181,7 +4232,7 @@ WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose,
|
||||
} \
|
||||
\
|
||||
MakeContextCurrent(); \
|
||||
gl->f##name(location, JS_GetTypedArrayLength(wa) / (dim*dim), false, \
|
||||
gl->f##name(location, info.arraySize, false, \
|
||||
static_cast<WebGLfloat*>(JS_GetTypedArrayData(wa))); \
|
||||
return NS_OK; \
|
||||
}
|
||||
@ -4534,11 +4585,10 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
||||
targetShaderSourceLanguage,
|
||||
&resources);
|
||||
|
||||
int compileOptions = 0;
|
||||
int compileOptions = SH_ATTRIBUTES_UNIFORMS;
|
||||
if (useShaderSourceTranslation) {
|
||||
compileOptions |= SH_OBJECT_CODE
|
||||
| SH_MAP_LONG_VARIABLE_NAMES
|
||||
| SH_ATTRIBUTES_UNIFORMS;
|
||||
| SH_MAP_LONG_VARIABLE_NAMES;
|
||||
#ifdef XP_MACOSX
|
||||
// work around bug 665578
|
||||
if (gl->WorkAroundDriverBugs() &&
|
||||
@ -4581,11 +4631,37 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
||||
|
||||
shader->mAttributes.Clear();
|
||||
shader->mUniforms.Clear();
|
||||
shader->mUniformInfos.Clear();
|
||||
|
||||
nsAutoArrayPtr<char> attribute_name(new char[attrib_max_length+1]);
|
||||
nsAutoArrayPtr<char> uniform_name(new char[uniform_max_length+1]);
|
||||
nsAutoArrayPtr<char> mapped_name(new char[mapped_max_length+1]);
|
||||
|
||||
|
||||
for (int i = 0; i < num_uniforms; i++) {
|
||||
int length, size;
|
||||
ShDataType type;
|
||||
ShGetActiveUniform(compiler, i,
|
||||
&length, &size, &type,
|
||||
uniform_name,
|
||||
mapped_name);
|
||||
if (useShaderSourceTranslation) {
|
||||
shader->mUniforms.AppendElement(WebGLMappedIdentifier(
|
||||
nsDependentCString(uniform_name),
|
||||
nsDependentCString(mapped_name)));
|
||||
}
|
||||
|
||||
// we always query uniform info, regardless of useShaderSourceTranslation,
|
||||
// as we need it to validate uniform setter calls, and it doesn't rely on
|
||||
// shader translation.
|
||||
shader->mUniformInfos.AppendElement(WebGLUniformInfo(
|
||||
size,
|
||||
length > 1 && mapped_name[length - 1] == ']',
|
||||
type));
|
||||
}
|
||||
|
||||
if (useShaderSourceTranslation) {
|
||||
|
||||
for (int i = 0; i < num_attributes; i++) {
|
||||
int length, size;
|
||||
ShDataType type;
|
||||
@ -4598,18 +4674,6 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
||||
nsDependentCString(mapped_name)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_uniforms; i++) {
|
||||
int length, size;
|
||||
ShDataType type;
|
||||
ShGetActiveUniform(compiler, i,
|
||||
&length, &size, &type,
|
||||
uniform_name,
|
||||
mapped_name);
|
||||
shader->mUniforms.AppendElement(WebGLMappedIdentifier(
|
||||
nsDependentCString(uniform_name),
|
||||
nsDependentCString(mapped_name)));
|
||||
}
|
||||
|
||||
int len = 0;
|
||||
ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &len);
|
||||
|
||||
|
@ -61,6 +61,7 @@ WebGLProgram::UpdateInfo()
|
||||
{
|
||||
mIdentifierMap = nsnull;
|
||||
mIdentifierReverseMap = nsnull;
|
||||
mUniformInfoMap = nsnull;
|
||||
|
||||
mAttribMaxNameLength = 0;
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
conformance/more/functions/uniformfArrayLen1.html
|
@ -447,16 +447,6 @@ function start() {
|
||||
if (kIsWindows && !kIsWindowsVistaOrHigher)
|
||||
testsExpectedToFail.push('conformance/textures/texture-mips.html');
|
||||
|
||||
if (kIsMac && kDarwinVersion < 11.0) { // Darwin 11 == Mac OS 10.7
|
||||
testsExpectedToFail.push('conformance/more/functions/uniformfBadArgs.html');
|
||||
testsExpectedToFail.push('conformance/more/functions/uniformiBadArgs.html');
|
||||
}
|
||||
|
||||
if (kIsMac && kDarwinVersion >= 11.0) {
|
||||
testsExpectedToFail.push('conformance/textures/texture-mips.html');
|
||||
testsExpectedToFail.push('conformance/textures/texture-npot.html');
|
||||
}
|
||||
|
||||
var testsToIgnore = [];
|
||||
|
||||
runTestSuite();
|
||||
|
@ -53,7 +53,6 @@ XPIDLSRCS = \
|
||||
nsIDOMGeoPositionCallback.idl \
|
||||
nsIDOMGeoPositionError.idl \
|
||||
nsIDOMGeoPositionErrorCallback.idl \
|
||||
nsIDOMGeoPositionOptions.idl \
|
||||
nsIDOMNavigatorGeolocation.idl \
|
||||
$(NULL)
|
||||
|
||||
|
@ -41,16 +41,27 @@ interface nsIDOMGeoPositionOptions;
|
||||
interface nsIDOMGeoPositionCallback;
|
||||
interface nsIDOMGeoPositionErrorCallback;
|
||||
|
||||
[scriptable, uuid(37687DAF-B85F-4E4D-8881-85A0AD24CF78)]
|
||||
dictionary GeoPositionOptions
|
||||
{
|
||||
boolean enableHighAccuracy;
|
||||
long timeout;
|
||||
long maximumAge;
|
||||
};
|
||||
|
||||
[scriptable, uuid(b9a301f7-285b-4be9-b739-fb869019c77a)]
|
||||
interface nsIDOMGeoGeolocation : nsISupports
|
||||
{
|
||||
[implicit_jscontext]
|
||||
void getCurrentPosition(in nsIDOMGeoPositionCallback successCallback,
|
||||
[optional] in nsIDOMGeoPositionErrorCallback errorCallback,
|
||||
[optional] in nsIDOMGeoPositionOptions options);
|
||||
/* GeoPositionOptions */
|
||||
[optional] in jsval options);
|
||||
|
||||
[implicit_jscontext]
|
||||
long watchPosition(in nsIDOMGeoPositionCallback successCallback,
|
||||
[optional] in nsIDOMGeoPositionErrorCallback errorCallback,
|
||||
[optional] in nsIDOMGeoPositionOptions options);
|
||||
/* GeoPositionOptions */
|
||||
[optional] in jsval options);
|
||||
|
||||
void clearWatch(in long watchId);
|
||||
};
|
||||
|
@ -1,46 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Geolocation.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Doug Turner <dougt@meer.net> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, uuid(453B72DE-EA90-4F09-AE16-C2E7EE0DDDC4)]
|
||||
interface nsIDOMGeoPositionOptions : nsISupports
|
||||
{
|
||||
attribute boolean enableHighAccuracy;
|
||||
attribute long timeout;
|
||||
attribute long maximumAge;
|
||||
};
|
@ -1172,7 +1172,8 @@ ContentParent::RecvAddGeolocationListener()
|
||||
if (!geo) {
|
||||
return true;
|
||||
}
|
||||
geo->WatchPosition(this, nsnull, nsnull, &mGeolocationWatchID);
|
||||
jsval dummy = JSVAL_VOID;
|
||||
geo->WatchPosition(this, nsnull, dummy, nsnull, &mGeolocationWatchID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -242,14 +242,12 @@ nsDOMGeoPositionError::NotifyCallback(nsIDOMGeoPositionErrorCallback* aCallback)
|
||||
nsGeolocationRequest::nsGeolocationRequest(nsGeolocation* aLocator,
|
||||
nsIDOMGeoPositionCallback* aCallback,
|
||||
nsIDOMGeoPositionErrorCallback* aErrorCallback,
|
||||
nsIDOMGeoPositionOptions* aOptions,
|
||||
bool aWatchPositionRequest)
|
||||
: mAllowed(false),
|
||||
mCleared(false),
|
||||
mIsWatchPositionRequest(aWatchPositionRequest),
|
||||
mCallback(aCallback),
|
||||
mErrorCallback(aErrorCallback),
|
||||
mOptions(aOptions),
|
||||
mLocator(aLocator)
|
||||
{
|
||||
}
|
||||
@ -259,9 +257,13 @@ nsGeolocationRequest::~nsGeolocationRequest()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGeolocationRequest::Init()
|
||||
nsGeolocationRequest::Init(JSContext* aCx, const jsval& aOptions)
|
||||
{
|
||||
// This method is called before the user has given permission for this request.
|
||||
if (aCx && !JSVAL_IS_VOID(aOptions) && !JSVAL_IS_NULL(aOptions)) {
|
||||
mOptions = new mozilla::dom::GeoPositionOptions();
|
||||
nsresult rv = mOptions->Init(aCx, &aOptions);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -274,7 +276,7 @@ NS_INTERFACE_MAP_END
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGeolocationRequest)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsGeolocationRequest)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_4(nsGeolocationRequest, mCallback, mErrorCallback, mOptions, mLocator)
|
||||
NS_IMPL_CYCLE_COLLECTION_3(nsGeolocationRequest, mCallback, mErrorCallback, mLocator)
|
||||
|
||||
|
||||
void
|
||||
@ -378,16 +380,11 @@ nsGeolocationRequest::Allow()
|
||||
|
||||
PRUint32 maximumAge = 30 * PR_MSEC_PER_SEC;
|
||||
if (mOptions) {
|
||||
PRInt32 tempAge;
|
||||
nsresult rv = mOptions->GetMaximumAge(&tempAge);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (tempAge >= 0)
|
||||
maximumAge = tempAge;
|
||||
if (mOptions->maximumAge >= 0) {
|
||||
maximumAge = mOptions->maximumAge;
|
||||
}
|
||||
bool highAccuracy;
|
||||
rv = mOptions->GetEnableHighAccuracy(&highAccuracy);
|
||||
if (NS_SUCCEEDED(rv) && highAccuracy) {
|
||||
geoService->SetHigherAccuracy(true);
|
||||
if (mOptions->enableHighAccuracy) {
|
||||
geoService->SetHigherAccuracy(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,7 +414,7 @@ nsGeolocationRequest::SetTimeoutTimer()
|
||||
mTimeoutTimer = nsnull;
|
||||
}
|
||||
PRInt32 timeout;
|
||||
if (mOptions && NS_SUCCEEDED(mOptions->GetTimeout(&timeout)) && timeout != 0) {
|
||||
if (mOptions && (timeout = mOptions->timeout) != 0) {
|
||||
|
||||
if (timeout < 0)
|
||||
timeout = 0;
|
||||
@ -487,14 +484,11 @@ nsGeolocationRequest::Update(nsIDOMGeoPosition* aPosition)
|
||||
void
|
||||
nsGeolocationRequest::Shutdown()
|
||||
{
|
||||
if (mOptions) {
|
||||
bool highAccuracy;
|
||||
nsresult rv = mOptions->GetEnableHighAccuracy(&highAccuracy);
|
||||
if (NS_SUCCEEDED(rv) && highAccuracy) {
|
||||
nsRefPtr<nsGeolocationService> geoService = nsGeolocationService::GetInstance();
|
||||
if (geoService)
|
||||
geoService->SetHigherAccuracy(false);
|
||||
}
|
||||
if (mOptions && mOptions->enableHighAccuracy) {
|
||||
nsRefPtr<nsGeolocationService> geoService = nsGeolocationService::GetInstance();
|
||||
if (geoService) {
|
||||
geoService->SetHigherAccuracy(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (mTimeoutTimer) {
|
||||
@ -941,7 +935,8 @@ nsGeolocation::Update(nsIDOMGeoPosition *aSomewhere)
|
||||
NS_IMETHODIMP
|
||||
nsGeolocation::GetCurrentPosition(nsIDOMGeoPositionCallback *callback,
|
||||
nsIDOMGeoPositionErrorCallback *errorCallback,
|
||||
nsIDOMGeoPositionOptions *options)
|
||||
const jsval& options,
|
||||
JSContext* cx)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(callback);
|
||||
|
||||
@ -954,13 +949,12 @@ nsGeolocation::GetCurrentPosition(nsIDOMGeoPositionCallback *callback,
|
||||
nsRefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this,
|
||||
callback,
|
||||
errorCallback,
|
||||
options,
|
||||
false);
|
||||
if (!request)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(request->Init()))
|
||||
return NS_ERROR_FAILURE; // this as OKAY. not sure why we wouldn't throw. xxx dft
|
||||
nsresult rv = request->Init(cx, options);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mOwner) {
|
||||
if (!RegisterRequestWithPrompt(request))
|
||||
@ -984,7 +978,8 @@ nsGeolocation::GetCurrentPosition(nsIDOMGeoPositionCallback *callback,
|
||||
NS_IMETHODIMP
|
||||
nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *callback,
|
||||
nsIDOMGeoPositionErrorCallback *errorCallback,
|
||||
nsIDOMGeoPositionOptions *options,
|
||||
const jsval& options,
|
||||
JSContext* cx,
|
||||
PRInt32 *_retval NS_OUTPARAM)
|
||||
{
|
||||
|
||||
@ -999,13 +994,12 @@ nsGeolocation::WatchPosition(nsIDOMGeoPositionCallback *callback,
|
||||
nsRefPtr<nsGeolocationRequest> request = new nsGeolocationRequest(this,
|
||||
callback,
|
||||
errorCallback,
|
||||
options,
|
||||
true);
|
||||
if (!request)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if (NS_FAILED(request->Init()))
|
||||
return NS_ERROR_FAILURE; // this as OKAY. not sure why we wouldn't throw. xxx dft
|
||||
nsresult rv = request->Init(cx, options);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mOwner) {
|
||||
if (!RegisterRequestWithPrompt(request))
|
||||
|
@ -57,14 +57,13 @@
|
||||
#include "nsIDOMGeoPositionError.h"
|
||||
#include "nsIDOMGeoPositionCallback.h"
|
||||
#include "nsIDOMGeoPositionErrorCallback.h"
|
||||
#include "nsIDOMGeoPositionOptions.h"
|
||||
#include "nsIDOMNavigatorGeolocation.h"
|
||||
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#include "nsIGeolocationProvider.h"
|
||||
#include "nsIContentPermissionPrompt.h"
|
||||
|
||||
#include "DictionaryHelpers.h"
|
||||
#include "PCOMContentPermissionRequestChild.h"
|
||||
|
||||
class nsGeolocationService;
|
||||
@ -85,9 +84,8 @@ class nsGeolocationRequest
|
||||
nsGeolocationRequest(nsGeolocation* locator,
|
||||
nsIDOMGeoPositionCallback* callback,
|
||||
nsIDOMGeoPositionErrorCallback* errorCallback,
|
||||
nsIDOMGeoPositionOptions* options,
|
||||
bool watchPositionRequest = false);
|
||||
nsresult Init();
|
||||
nsresult Init(JSContext* aCx, const jsval& aOptions);
|
||||
void Shutdown();
|
||||
|
||||
// Called by the geolocation device to notify that a location has changed.
|
||||
@ -114,7 +112,7 @@ class nsGeolocationRequest
|
||||
nsCOMPtr<nsITimer> mTimeoutTimer;
|
||||
nsCOMPtr<nsIDOMGeoPositionCallback> mCallback;
|
||||
nsCOMPtr<nsIDOMGeoPositionErrorCallback> mErrorCallback;
|
||||
nsCOMPtr<nsIDOMGeoPositionOptions> mOptions;
|
||||
nsAutoPtr<mozilla::dom::GeoPositionOptions> mOptions;
|
||||
|
||||
nsRefPtr<nsGeolocation> mLocator;
|
||||
};
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include "nsIDOMGeoPositionError.h"
|
||||
#include "nsIDOMGeoPositionCallback.h"
|
||||
#include "nsIDOMGeoPositionErrorCallback.h"
|
||||
#include "nsIDOMGeoPositionOptions.h"
|
||||
#include "nsIDOMNavigatorGeolocation.h"
|
||||
#include "nsIDOMGeoPositionCoords.h"
|
||||
|
||||
|
@ -47,6 +47,7 @@ DOMWifiManager.prototype = {
|
||||
|
||||
// Maintain this state for synchronous APIs.
|
||||
this._currentNetwork = null;
|
||||
this._connectionStatus = "disconnected";
|
||||
this._enabled = true;
|
||||
this._lastConnectionInfo = null;
|
||||
|
||||
@ -65,10 +66,12 @@ DOMWifiManager.prototype = {
|
||||
this._currentNetwork = state.network;
|
||||
this._lastConnectionInfo = state.connectionInfo;
|
||||
this._enabled = state.enabled;
|
||||
this._connectionStatus = state.status;
|
||||
} else {
|
||||
this._currentNetwork = null;
|
||||
this._lastConnectionInfo = null;
|
||||
this._enabled = null;
|
||||
this._enabled = false;
|
||||
this._connectionStatus = "disconnected";
|
||||
}
|
||||
},
|
||||
|
||||
@ -137,22 +140,26 @@ DOMWifiManager.prototype = {
|
||||
|
||||
case "WifiManager:onconnecting":
|
||||
this._currentNetwork = msg.network;
|
||||
this._connectionStatus = "connecting";
|
||||
this._fireOnConnecting(msg.network);
|
||||
break;
|
||||
|
||||
case "WifiManager:onassociate":
|
||||
this._currentNetwork = msg.network;
|
||||
this._connectionStatus = "associated";
|
||||
this._fireOnAssociate(msg.network);
|
||||
break;
|
||||
|
||||
case "WifiManager:onconnect":
|
||||
this._currentNetwork = msg.network;
|
||||
this._connectionStatus = "connected";
|
||||
this._fireOnConnect(msg.network);
|
||||
break;
|
||||
|
||||
case "WifiManager:ondisconnect":
|
||||
this._fireOnDisconnect(this._currentNetwork);
|
||||
this._currentNetwork = null;
|
||||
this._connectionStatus = "disconnected";
|
||||
this._lastConnectionInfo = null;
|
||||
break;
|
||||
|
||||
@ -232,10 +239,10 @@ DOMWifiManager.prototype = {
|
||||
return this._enabled;
|
||||
},
|
||||
|
||||
get connectedNetwork() {
|
||||
get connection() {
|
||||
if (!this._hasPrivileges)
|
||||
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||
return this._currentNetwork;
|
||||
return { status: this._connectionStatus, network: this._currentNetwork };
|
||||
},
|
||||
|
||||
get connectionInfo() {
|
||||
|
@ -1026,6 +1026,7 @@ var WifiManager = (function() {
|
||||
manager.scan = scanCommand;
|
||||
manager.getRssiApprox = getRssiApproxCommand;
|
||||
manager.getLinkSpeed = getLinkSpeedCommand;
|
||||
manager.getDhcpInfo = function() { return dhcpInfo; }
|
||||
return manager;
|
||||
})();
|
||||
|
||||
@ -1374,6 +1375,27 @@ function WifiWorker() {
|
||||
debug("Wifi starting");
|
||||
}
|
||||
|
||||
function translateState(state) {
|
||||
switch (state) {
|
||||
case "INTERFACE_DISABLED":
|
||||
case "INACTIVE":
|
||||
case "SCANNING":
|
||||
case "DISCONNECTED":
|
||||
default:
|
||||
return "disconnected";
|
||||
|
||||
case "AUTHENTICATING":
|
||||
case "ASSOCIATING":
|
||||
case "ASSOCIATED":
|
||||
case "FOUR_WAY_HANDSHAKE":
|
||||
case "GROUP_HANDSHAKE":
|
||||
return "connecting";
|
||||
|
||||
case "COMPLETED":
|
||||
return WifiManager.getDhcpInfo() ? "connected" : "associated";
|
||||
}
|
||||
}
|
||||
|
||||
WifiWorker.prototype = {
|
||||
classID: WIFIWORKER_CID,
|
||||
classInfo: XPCOMUtils.generateCI({classID: WIFIWORKER_CID,
|
||||
@ -1583,7 +1605,8 @@ WifiWorker.prototype = {
|
||||
let net = this.currentNetwork ? netToDOM(this.currentNetwork) : null;
|
||||
return { network: net,
|
||||
connectionInfo: this._lastConnectionInfo,
|
||||
enabled: WifiManager.state !== "UNINITIALIZED", };
|
||||
enabled: WifiManager.state !== "UNINITIALIZED",
|
||||
status: translateState(WifiManager.state) };
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -99,9 +99,14 @@ interface nsIDOMWifiManager : nsISupports {
|
||||
readonly attribute boolean enabled;
|
||||
|
||||
/**
|
||||
* A network object describing the currently connected network.
|
||||
* An non-null object containing the following information:
|
||||
* - status ("disconnected", "connecting", "associated", "connected")
|
||||
* - network
|
||||
*
|
||||
* Note that the object returned is read only. Any changes required must
|
||||
* be done by calling other APIs.
|
||||
*/
|
||||
readonly attribute jsval connectedNetwork;
|
||||
readonly attribute jsval connection;
|
||||
|
||||
/**
|
||||
* A connectionInformation object with the same information found in an
|
||||
|
@ -72,6 +72,8 @@ typedef char realGLboolean;
|
||||
|
||||
#include "GLContextSymbols.h"
|
||||
|
||||
#include "mozilla/mozalloc.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
class LayerManagerOGL;
|
||||
@ -2028,6 +2030,16 @@ public:
|
||||
void fBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) {
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fBufferData(target, size, data, usage);
|
||||
|
||||
// bug 744888
|
||||
if (WorkAroundDriverBugs() &&
|
||||
!data &&
|
||||
Vendor() == VendorNVIDIA)
|
||||
{
|
||||
char c = 0;
|
||||
mSymbols.fBufferSubData(target, size-1, 1, &c);
|
||||
}
|
||||
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,8 @@ dictionaries = [
|
||||
[ 'StorageEventInit', 'nsIDOMStorageEvent.idl' ],
|
||||
[ 'BlobPropertyBag', 'nsIDOMFile.idl' ],
|
||||
[ 'MutationObserverInit', 'nsIDOMMutationObserver.idl' ],
|
||||
[ 'SettingsEventInit', 'nsIDOMSettingsManager.idl' ]
|
||||
[ 'SettingsEventInit', 'nsIDOMSettingsManager.idl' ],
|
||||
[ 'GeoPositionOptions', 'nsIDOMGeoGeolocation.idl']
|
||||
]
|
||||
|
||||
# include file names
|
||||
|
Loading…
Reference in New Issue
Block a user