зеркало из https://github.com/mozilla/gecko-dev.git
Bug 868312 finale: finish rooting dom/ code. r=smaug
This commit is contained in:
Родитель
6b527597e0
Коммит
43f774459d
|
@ -5076,8 +5076,7 @@ nsDocument::Register(const nsAString& aName, const JS::Value& aOptions,
|
|||
JSContext* aCx, uint8_t aOptionalArgc,
|
||||
jsval* aConstructor /* out param */)
|
||||
{
|
||||
ElementRegistrationOptions options;
|
||||
DictionaryRooter<ElementRegistrationOptions> optionsRooter(aCx, &options);
|
||||
RootedDictionary<ElementRegistrationOptions> options(aCx);
|
||||
if (aOptionalArgc > 0) {
|
||||
JSAutoCompartment ac(aCx, GetWrapper());
|
||||
JS::Rooted<JS::Value> opts(aCx, aOptions);
|
||||
|
|
|
@ -55,7 +55,7 @@ DOMCursor::FireDone()
|
|||
{
|
||||
Reset();
|
||||
mFinished = true;
|
||||
FireSuccess(JSVAL_VOID);
|
||||
FireSuccess(JS::UndefinedHandleValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -115,7 +115,7 @@ DOMRequest::GetError(nsIDOMDOMError** aError)
|
|||
}
|
||||
|
||||
void
|
||||
DOMRequest::FireSuccess(JS::Value aResult)
|
||||
DOMRequest::FireSuccess(JS::Handle<JS::Value> aResult)
|
||||
{
|
||||
NS_ASSERTION(!mDone, "mDone shouldn't have been set to true already!");
|
||||
NS_ASSERTION(!mError, "mError shouldn't have been set!");
|
||||
|
@ -222,7 +222,8 @@ DOMRequestService::FireSuccess(nsIDOMDOMRequest* aRequest,
|
|||
const JS::Value& aResult)
|
||||
{
|
||||
NS_ENSURE_STATE(aRequest);
|
||||
static_cast<DOMRequest*>(aRequest)->FireSuccess(aResult);
|
||||
static_cast<DOMRequest*>(aRequest)->
|
||||
FireSuccess(JS::Handle<JS::Value>::fromMarkedLocation(&aResult));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -289,7 +290,7 @@ public:
|
|||
NS_IMETHODIMP
|
||||
Run()
|
||||
{
|
||||
mReq->FireSuccess(mResult);
|
||||
mReq->FireSuccess(JS::Handle<JS::Value>::fromMarkedLocation(&mResult));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
IMPL_EVENT_HANDLER(error)
|
||||
|
||||
|
||||
void FireSuccess(JS::Value aResult);
|
||||
void FireSuccess(JS::Handle<JS::Value> aResult);
|
||||
void FireError(const nsAString& aError);
|
||||
void FireError(nsresult aError);
|
||||
|
||||
|
|
|
@ -1759,48 +1759,39 @@ public:
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
class MOZ_STACK_CLASS DictionaryRooter : JS::CustomAutoRooter
|
||||
class MOZ_STACK_CLASS RootedDictionary : public T,
|
||||
private JS::CustomAutoRooter
|
||||
{
|
||||
public:
|
||||
DictionaryRooter(JSContext *aCx, T* aDictionary
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: JS::CustomAutoRooter(aCx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
|
||||
mDictionary(aDictionary),
|
||||
mDictionaryType(eDictionary)
|
||||
RootedDictionary(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
|
||||
T(),
|
||||
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
|
||||
{
|
||||
}
|
||||
|
||||
DictionaryRooter(JSContext *aCx, Nullable<T>* aDictionary
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: JS::CustomAutoRooter(aCx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
|
||||
mNullableDictionary(aDictionary),
|
||||
mDictionaryType(eNullableDictionary)
|
||||
virtual void trace(JSTracer *trc) MOZ_OVERRIDE
|
||||
{
|
||||
this->TraceDictionary(trc);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class MOZ_STACK_CLASS NullableRootedDictionary : public Nullable<T>,
|
||||
private JS::CustomAutoRooter
|
||||
{
|
||||
public:
|
||||
NullableRootedDictionary(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
|
||||
Nullable<T>(),
|
||||
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
enum DictionaryType {
|
||||
eDictionary,
|
||||
eNullableDictionary
|
||||
};
|
||||
|
||||
virtual void trace(JSTracer *trc) MOZ_OVERRIDE {
|
||||
if (mDictionaryType == eDictionary) {
|
||||
mDictionary->TraceDictionary(trc);
|
||||
} else {
|
||||
MOZ_ASSERT(mDictionaryType == eNullableDictionary);
|
||||
if (!mNullableDictionary->IsNull()) {
|
||||
mNullableDictionary->Value().TraceDictionary(trc);
|
||||
virtual void trace(JSTracer *trc) MOZ_OVERRIDE
|
||||
{
|
||||
if (!this->IsNull()) {
|
||||
this->Value().TraceDictionary(trc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
union {
|
||||
T* mDictionary;
|
||||
Nullable<T>* mNullableDictionary;
|
||||
};
|
||||
|
||||
DictionaryType mDictionaryType;
|
||||
};
|
||||
|
||||
inline bool
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
explicit CallbackFunction(JSObject* aCallable)
|
||||
: CallbackObject(aCallable)
|
||||
{
|
||||
MOZ_ASSERT(JS_ObjectIsCallable(nullptr, aCallable));
|
||||
MOZ_ASSERT(JS_ObjectIsCallable(nullptr, mCallback));
|
||||
}
|
||||
|
||||
JS::Handle<JSObject*> Callable() const
|
||||
|
|
|
@ -2964,6 +2964,11 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
descriptor = descriptorProvider.getDescriptor(
|
||||
type.unroll().inner.identifier.name)
|
||||
|
||||
if descriptor.nativeType == 'JSObject':
|
||||
# XXXbz Workers code does this sometimes
|
||||
assert descriptor.workers
|
||||
return handleJSObjectType(type, isMember, failureCode)
|
||||
|
||||
if (descriptor.interface.isCallback() and
|
||||
descriptor.interface.identifier.name != "EventListener"):
|
||||
if descriptor.workers:
|
||||
|
@ -3288,11 +3293,9 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
raise NoSuchDescriptorError("Can't handle member callbacks in "
|
||||
"workers; need to sort out rooting"
|
||||
"issues")
|
||||
if type.nullable():
|
||||
declType = CGGeneric("JSObject*")
|
||||
else:
|
||||
declType = CGGeneric("NonNull<JSObject>")
|
||||
conversion = " ${declName} = &${val}.toObject();\n"
|
||||
declType = CGGeneric("JS::Rooted<JSObject*>")
|
||||
conversion = " ${declName} = &${valHandle}.toObject();\n"
|
||||
declArgs = "cx"
|
||||
else:
|
||||
name = type.unroll().identifier.name
|
||||
if type.nullable():
|
||||
|
@ -3301,6 +3304,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
declType = CGGeneric("OwningNonNull<%s>" % name)
|
||||
conversion = (
|
||||
" ${declName} = new %s(&${val}.toObject());\n" % name)
|
||||
declArgs = None
|
||||
|
||||
if allowTreatNonCallableAsNull and type.treatNonCallableAsNull():
|
||||
haveCallable = "JS_ObjectIsCallable(cx, &${val}.toObject())"
|
||||
|
@ -3326,7 +3330,8 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
"${declName} = nullptr",
|
||||
failureCode)
|
||||
return JSToNativeConversionInfo(template, declType=declType,
|
||||
dealWithOptional=isOptional)
|
||||
dealWithOptional=isOptional,
|
||||
declArgs=declArgs)
|
||||
|
||||
if type.isAny():
|
||||
assert not isEnforceRange and not isClamp
|
||||
|
@ -3405,15 +3410,13 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
# Dictionary arguments that might contain traceable things need to get
|
||||
# traced
|
||||
if not isMember and typeNeedsCx(type, descriptorProvider):
|
||||
holderType = CGTemplatedType("DictionaryRooter", declType);
|
||||
holderArgs = "cx, &${declName}"
|
||||
declType = CGTemplatedType("RootedDictionary", declType);
|
||||
declArgs = "cx"
|
||||
else:
|
||||
holderType = None
|
||||
holderArgs = None
|
||||
declArgs = None
|
||||
|
||||
return JSToNativeConversionInfo(template, declType=declType,
|
||||
holderType=holderType,
|
||||
holderArgs=holderArgs)
|
||||
declArgs=declArgs)
|
||||
|
||||
if type.isVoid():
|
||||
assert not isOptional
|
||||
|
@ -4113,7 +4116,7 @@ def getRetvalDeclarationForType(returnType, descriptorProvider,
|
|||
resultAlreadyAddRefed,
|
||||
isMember=False):
|
||||
"""
|
||||
Returns a tuple containing three things:
|
||||
Returns a tuple containing four things:
|
||||
|
||||
1) A CGThing for the type of the return value, or None if there is no need
|
||||
for a return value.
|
||||
|
@ -4123,24 +4126,27 @@ def getRetvalDeclarationForType(returnType, descriptorProvider,
|
|||
|
||||
3) A CGThing for a tracer for the return value, or None if no tracing is
|
||||
needed.
|
||||
|
||||
4) An argument string to pass to the retval declaration
|
||||
constructor or None if there are no arguments.
|
||||
"""
|
||||
if returnType is None or returnType.isVoid():
|
||||
# Nothing to declare
|
||||
return None, False, None
|
||||
return None, False, None, None
|
||||
if returnType.isPrimitive() and returnType.tag() in builtinNames:
|
||||
result = CGGeneric(builtinNames[returnType.tag()])
|
||||
if returnType.nullable():
|
||||
result = CGTemplatedType("Nullable", result)
|
||||
return result, False, None
|
||||
return result, False, None, None
|
||||
if returnType.isString():
|
||||
if isMember:
|
||||
return CGGeneric("nsString"), True, None
|
||||
return CGGeneric("DOMString"), True, None
|
||||
return CGGeneric("nsString"), True, None, None
|
||||
return CGGeneric("DOMString"), True, None, None
|
||||
if returnType.isEnum():
|
||||
result = CGGeneric(returnType.unroll().inner.identifier.name)
|
||||
if returnType.nullable():
|
||||
result = CGTemplatedType("Nullable", result)
|
||||
return result, False, None
|
||||
return result, False, None, None
|
||||
if returnType.isGeckoInterface():
|
||||
result = CGGeneric(descriptorProvider.getDescriptor(
|
||||
returnType.unroll().inner.identifier.name).nativeType)
|
||||
|
@ -4151,23 +4157,23 @@ def getRetvalDeclarationForType(returnType, descriptorProvider,
|
|||
result = CGTemplatedType("nsAutoPtr", result)
|
||||
else:
|
||||
result = CGWrapper(result, post="*")
|
||||
return result, False, None
|
||||
return result, False, None, None
|
||||
if returnType.isCallback():
|
||||
name = returnType.unroll().identifier.name
|
||||
if descriptorProvider.workers:
|
||||
return CGGeneric("JSObject*"), False, None
|
||||
return CGGeneric("nsRefPtr<%s>" % name), False, None
|
||||
return CGGeneric("JSObject*"), False, None, None
|
||||
return CGGeneric("nsRefPtr<%s>" % name), False, None, None
|
||||
if returnType.isAny():
|
||||
return CGGeneric("JS::Value"), False, None
|
||||
return CGGeneric("JS::Value"), False, None, None
|
||||
if returnType.isObject() or returnType.isSpiderMonkeyInterface():
|
||||
return CGGeneric("JSObject*"), False, None
|
||||
return CGGeneric("JSObject*"), False, None, None
|
||||
if returnType.isSequence():
|
||||
nullable = returnType.nullable()
|
||||
if nullable:
|
||||
returnType = returnType.inner
|
||||
# If our result is already addrefed, use the right type in the
|
||||
# sequence argument here.
|
||||
(result, _, _) = getRetvalDeclarationForType(returnType.inner,
|
||||
(result, _, _, _) = getRetvalDeclarationForType(returnType.inner,
|
||||
descriptorProvider,
|
||||
resultAlreadyAddRefed,
|
||||
isMember="Sequence")
|
||||
|
@ -4180,7 +4186,7 @@ def getRetvalDeclarationForType(returnType, descriptorProvider,
|
|||
result = CGTemplatedType("nsTArray", result)
|
||||
if nullable:
|
||||
result = CGTemplatedType("Nullable", result)
|
||||
return result, True, rooter
|
||||
return result, True, rooter, None
|
||||
if returnType.isDictionary():
|
||||
nullable = returnType.nullable()
|
||||
dictName = (CGDictionary.makeDictionaryName(returnType.unroll().inner,
|
||||
|
@ -4188,20 +4194,22 @@ def getRetvalDeclarationForType(returnType, descriptorProvider,
|
|||
"Initializer")
|
||||
result = CGGeneric(dictName)
|
||||
if not isMember and typeNeedsCx(returnType, descriptorProvider):
|
||||
rooter = CGGeneric("DictionaryRooter<%s> resultRooter(cx, &result);\n" %
|
||||
dictName)
|
||||
else:
|
||||
rooter = None
|
||||
if nullable:
|
||||
result = CGTemplatedType("NullableRootedDictionary", result)
|
||||
else:
|
||||
result = CGTemplatedType("RootedDictionary", result)
|
||||
resultArgs = "cx"
|
||||
elif nullable:
|
||||
result = CGTemplatedType("Nullable", result)
|
||||
return result, True, rooter
|
||||
resultArgs = None
|
||||
return result, True, None, resultArgs
|
||||
if returnType.isUnion():
|
||||
raise TypeError("Need to sort out ownership model for union retvals");
|
||||
if returnType.isDate():
|
||||
result = CGGeneric("Date")
|
||||
if returnType.nullable():
|
||||
result = CGTemplatedType("Nullable", result)
|
||||
return result, False, None
|
||||
return result, False, None, None
|
||||
raise TypeError("Don't know how to declare return value for %s" %
|
||||
returnType)
|
||||
|
||||
|
@ -4235,7 +4243,8 @@ class CGCallGenerator(CGThing):
|
|||
|
||||
resultAlreadyAddRefed = isResultAlreadyAddRefed(descriptorProvider,
|
||||
extendedAttributes)
|
||||
(result, resultOutParam, resultRooter) = getRetvalDeclarationForType(
|
||||
(result, resultOutParam,
|
||||
resultRooter, resultArgs) = getRetvalDeclarationForType(
|
||||
returnType, descriptorProvider, resultAlreadyAddRefed)
|
||||
|
||||
args = CGList([CGGeneric(arg) for arg in argsPre], ", ")
|
||||
|
@ -4284,7 +4293,11 @@ class CGCallGenerator(CGThing):
|
|||
if result is not None:
|
||||
if resultRooter is not None:
|
||||
self.cgRoot.prepend(resultRooter)
|
||||
result = CGWrapper(result, post=" result;")
|
||||
if resultArgs is not None:
|
||||
resultArgs = "(%s)" % resultArgs
|
||||
else:
|
||||
resultArgs = ""
|
||||
result = CGWrapper(result, post=(" result%s;" % resultArgs))
|
||||
self.cgRoot.prepend(result)
|
||||
if not resultOutParam:
|
||||
call = CGWrapper(call, pre="result = ")
|
||||
|
@ -5206,7 +5219,7 @@ class CGSpecializedGetter(CGAbstractStaticMethod):
|
|||
name = attr.identifier.name
|
||||
nativeName = MakeNativeName(descriptor.binaryNames.get(name, name))
|
||||
# resultOutParam does not depend on whether resultAlreadyAddRefed is set
|
||||
(_, resultOutParam, _) = getRetvalDeclarationForType(attr.type,
|
||||
(_, resultOutParam, _, _) = getRetvalDeclarationForType(attr.type,
|
||||
descriptor,
|
||||
False)
|
||||
infallible = ('infallible' in
|
||||
|
@ -7996,7 +8009,7 @@ class CGForwardDeclarations(CGWrapper):
|
|||
Code generate the forward declarations for a header file.
|
||||
"""
|
||||
def __init__(self, config, descriptors, mainCallbacks, workerCallbacks,
|
||||
callbackInterfaces):
|
||||
mainDictionaries, workerDictionaries, callbackInterfaces):
|
||||
builder = ForwardDeclarationBuilder()
|
||||
|
||||
def forwardDeclareForType(t, workerness='both'):
|
||||
|
@ -8047,10 +8060,13 @@ class CGForwardDeclarations(CGWrapper):
|
|||
for t in getTypesFromDescriptor(d):
|
||||
forwardDeclareForType(t)
|
||||
|
||||
# Dictionaries add a header for each type they contain, so no
|
||||
# need for forward declarations. However, they may refer to
|
||||
# declarations made later in this file, which is why we
|
||||
# forward declare everything that is declared in this file.
|
||||
for d in mainDictionaries:
|
||||
for t in getTypesFromDictionary(d):
|
||||
forwardDeclareForType(t, workerness='mainthreadonly')
|
||||
|
||||
for d in workerDictionaries:
|
||||
for t in getTypesFromDictionary(d):
|
||||
forwardDeclareForType(t, workerness='workeronly')
|
||||
|
||||
CGWrapper.__init__(self, builder.build())
|
||||
|
||||
|
@ -8162,6 +8178,7 @@ class CGBindingRoot(CGThing):
|
|||
|
||||
curr = CGList([CGForwardDeclarations(config, descriptors,
|
||||
mainCallbacks, workerCallbacks,
|
||||
mainDictionaries, workerDictionaries,
|
||||
callbackDescriptors + jsImplemented),
|
||||
CGWrapper(CGGeneric("using namespace mozilla::dom;"),
|
||||
defineOnly=True),
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
#include "DOMCameraCapabilities.h"
|
||||
#include "DOMCameraControl.h"
|
||||
#include "CameraCommon.h"
|
||||
#include "mozilla/dom/CameraManagerBinding.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace dom;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
DOMCI_DATA(CameraControl, nsICameraControl)
|
||||
|
||||
|
@ -350,14 +352,16 @@ nsDOMCameraControl::TakePicture(const JS::Value& aOptions, nsICameraTakePictureC
|
|||
{
|
||||
NS_ENSURE_TRUE(onSuccess, NS_ERROR_INVALID_ARG);
|
||||
|
||||
mozilla::idl::CameraPictureOptions options;
|
||||
RootedDictionary<CameraPictureOptions> options(cx);
|
||||
mozilla::idl::CameraSize size;
|
||||
mozilla::idl::CameraPosition pos;
|
||||
|
||||
nsresult rv = options.Init(cx, &aOptions);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
JS::Rooted<JS::Value> optionVal(cx, aOptions);
|
||||
if (!options.Init(cx, optionVal)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
rv = size.Init(cx, &options.pictureSize);
|
||||
nsresult rv = size.Init(cx, &options.mPictureSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
/**
|
||||
|
@ -368,10 +372,10 @@ nsDOMCameraControl::TakePicture(const JS::Value& aOptions, nsICameraTakePictureC
|
|||
pos.longitude = NAN;
|
||||
pos.altitude = NAN;
|
||||
pos.timestamp = NAN;
|
||||
rv = pos.Init(cx, &options.position);
|
||||
rv = pos.Init(cx, &options.mPosition);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return mCameraControl->TakePicture(size, options.rotation, options.fileFormat, pos, options.dateTime, onSuccess, onError);
|
||||
return mCameraControl->TakePicture(size, options.mRotation, options.mFileFormat, pos, options.mDateTime, onSuccess, onError);
|
||||
}
|
||||
|
||||
/* [implicit_jscontext] void GetPreviewStreamVideoMode (in jsval aOptions, in nsICameraPreviewStreamCallback onSuccess, [optional] in nsICameraErrorCallback onError); */
|
||||
|
|
|
@ -115,47 +115,6 @@ interface nsICameraCapabilities : nsISupports
|
|||
readonly attribute jsval recorderProfiles;
|
||||
};
|
||||
|
||||
/* These properties only affect the captured image;
|
||||
invalid property settings are ignored. */
|
||||
dictionary CameraPictureOptions
|
||||
{
|
||||
/* an object with a combination of 'height' and 'width' properties
|
||||
chosen from nsICameraCapabilities.pictureSizes */
|
||||
jsval pictureSize;
|
||||
|
||||
/* one of the file formats chosen from
|
||||
nsICameraCapabilities.fileFormats */
|
||||
DOMString fileFormat;
|
||||
|
||||
/* the rotation of the image in degrees, from 0 to 270 in
|
||||
steps of 90; this doesn't affect the image, only the
|
||||
rotation recorded in the image header.*/
|
||||
long rotation;
|
||||
|
||||
/* an object containing any or all of 'latitude', 'longitude',
|
||||
'altitude', and 'timestamp', used to record when and where
|
||||
the image was taken. e.g.
|
||||
{
|
||||
latitude: 43.647118,
|
||||
longitude: -79.3943,
|
||||
altitude: 500
|
||||
// timestamp not specified, in this case, and
|
||||
// won't be included in the image header
|
||||
}
|
||||
|
||||
can be null in the case where position information isn't
|
||||
available/desired.
|
||||
|
||||
'altitude' is in metres; 'timestamp' is UTC, in seconds from
|
||||
January 1, 1970.
|
||||
*/
|
||||
jsval position;
|
||||
|
||||
/* the number of seconds from January 1, 1970 UTC. This can be
|
||||
different from the positional timestamp (above). */
|
||||
long long dateTime;
|
||||
};
|
||||
|
||||
/* These properties affect the video recording preview, e.g.
|
||||
{
|
||||
profile: "1080p",
|
||||
|
|
|
@ -53,7 +53,9 @@ DeviceStorageRequestChild::Recv__delete__(const DeviceStorageResponseValue& aVal
|
|||
{
|
||||
nsString compositePath;
|
||||
mFile->GetCompositePath(compositePath);
|
||||
JS::Value result = StringToJsval(mRequest->GetOwner(), compositePath);
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(cx,
|
||||
StringToJsval(mRequest->GetOwner(), compositePath));
|
||||
mRequest->FireSuccess(result);
|
||||
break;
|
||||
}
|
||||
|
@ -65,8 +67,9 @@ DeviceStorageRequestChild::Recv__delete__(const DeviceStorageResponseValue& aVal
|
|||
nsCOMPtr<nsIDOMBlob> blob = actor->GetBlob();
|
||||
|
||||
nsCOMPtr<nsIDOMFile> file = do_QueryInterface(blob);
|
||||
JS::Value result = InterfaceToJsval(mRequest->GetOwner(), file,
|
||||
&NS_GET_IID(nsIDOMFile));
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(cx,
|
||||
InterfaceToJsval(mRequest->GetOwner(), file, &NS_GET_IID(nsIDOMFile)));
|
||||
mRequest->FireSuccess(result);
|
||||
break;
|
||||
}
|
||||
|
@ -74,7 +77,8 @@ DeviceStorageRequestChild::Recv__delete__(const DeviceStorageResponseValue& aVal
|
|||
case DeviceStorageResponseValue::TFreeSpaceStorageResponse:
|
||||
{
|
||||
FreeSpaceStorageResponse r = aValue;
|
||||
JS::Value result = JS_NumberValue(double(r.freeBytes()));
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(cx, JS_NumberValue(double(r.freeBytes())));
|
||||
mRequest->FireSuccess(result);
|
||||
break;
|
||||
}
|
||||
|
@ -82,7 +86,8 @@ DeviceStorageRequestChild::Recv__delete__(const DeviceStorageResponseValue& aVal
|
|||
case DeviceStorageResponseValue::TUsedSpaceStorageResponse:
|
||||
{
|
||||
UsedSpaceStorageResponse r = aValue;
|
||||
JS::Value result = JS_NumberValue(double(r.usedBytes()));
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(cx, JS_NumberValue(double(r.usedBytes())));
|
||||
mRequest->FireSuccess(result);
|
||||
break;
|
||||
}
|
||||
|
@ -90,7 +95,9 @@ DeviceStorageRequestChild::Recv__delete__(const DeviceStorageResponseValue& aVal
|
|||
case DeviceStorageResponseValue::TAvailableStorageResponse:
|
||||
{
|
||||
AvailableStorageResponse r = aValue;
|
||||
JS::Value result = StringToJsval(mRequest->GetOwner(), r.mountState());
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(
|
||||
cx, StringToJsval(mRequest->GetOwner(), r.mountState()));
|
||||
mRequest->FireSuccess(result);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "mozilla/dom/DeviceStorageBinding.h"
|
||||
|
||||
// Microsoft's API Name hackery sucks
|
||||
#undef CreateEvent
|
||||
|
||||
|
@ -1586,7 +1588,9 @@ ContinueCursorEvent::Run()
|
|||
nsRefPtr<DeviceStorageFile> file = GetNextFile();
|
||||
|
||||
nsDOMDeviceStorageCursor* cursor = static_cast<nsDOMDeviceStorageCursor*>(mRequest.get());
|
||||
JS::Value val = nsIFileToJsval(cursor->GetOwner(), file);
|
||||
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> val(cx, nsIFileToJsval(cursor->GetOwner(), file));
|
||||
|
||||
if (file) {
|
||||
cursor->mOkToCallContinue = true;
|
||||
|
@ -1803,7 +1807,8 @@ public:
|
|||
mFile->GetStatus(state);
|
||||
}
|
||||
|
||||
JS::Value result = StringToJsval(mRequest->GetOwner(), state);
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(cx, StringToJsval(mRequest->GetOwner(), state));
|
||||
mRequest->FireSuccess(result);
|
||||
mRequest = nullptr;
|
||||
return NS_OK;
|
||||
|
@ -1841,7 +1846,8 @@ public:
|
|||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
JS::Value result = JSVAL_NULL;
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> result(cx, JSVAL_NULL);
|
||||
nsPIDOMWindow* window = mRequest->GetOwner();
|
||||
|
||||
if (mFile) {
|
||||
|
@ -3040,21 +3046,20 @@ nsDOMDeviceStorage::EnumerateEditable(const JS::Value & aName,
|
|||
}
|
||||
|
||||
|
||||
static PRTime
|
||||
ExtractDateFromOptions(JSContext* aCx, const JS::Value& aOptions)
|
||||
static bool
|
||||
ExtractDateFromOptions(JSContext* aCx, const JS::Value& aOptions, PRTime* aTime)
|
||||
{
|
||||
PRTime result = 0;
|
||||
mozilla::idl::DeviceStorageEnumerationParameters params;
|
||||
if (!JSVAL_IS_VOID(aOptions) && !aOptions.isNull()) {
|
||||
nsresult rv = params.Init(aCx, &aOptions);
|
||||
if (NS_SUCCEEDED(rv) && !JSVAL_IS_VOID(params.since) && !params.since.isNull() && params.since.isObject()) {
|
||||
JS::Rooted<JSObject*> obj(aCx, JSVAL_TO_OBJECT(params.since));
|
||||
if (JS_ObjectIsDate(aCx, obj) && js_DateIsValid(obj)) {
|
||||
result = js_DateGetMsecSinceEpoch(obj);
|
||||
JS::Rooted<JS::Value> options(aCx, aOptions);
|
||||
RootedDictionary<DeviceStorageEnumerationParameters> params(aCx);
|
||||
if (!params.Init(aCx, options)) {
|
||||
return false;
|
||||
}
|
||||
if (params.mSince.WasPassed() && !params.mSince.Value().IsUndefined()) {
|
||||
*aTime = params.mSince.Value().TimeStamp();
|
||||
} else {
|
||||
*aTime = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -3082,7 +3087,9 @@ nsDOMDeviceStorage::EnumerateInternal(const JS::Value & aName,
|
|||
path.Assign(jspath);
|
||||
} else if (!JSVAL_IS_PRIMITIVE(aName)) {
|
||||
// it also might be an options object
|
||||
since = ExtractDateFromOptions(aCx, aName);
|
||||
if (!ExtractDateFromOptions(aCx, aName, &since)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
} else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -3090,7 +3097,9 @@ nsDOMDeviceStorage::EnumerateInternal(const JS::Value & aName,
|
|||
if (aArgc == 2 && (JSVAL_IS_VOID(aOptions) || aOptions.isNull() || !aOptions.isObject())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
since = ExtractDateFromOptions(aCx, aOptions);
|
||||
if (!ExtractDateFromOptions(aCx, aOptions, &since)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
nsRefPtr<DeviceStorageFile> dsf = new DeviceStorageFile(mStorageType,
|
||||
|
|
|
@ -48,7 +48,7 @@ ok(throws, "enumerate two string parameter");
|
|||
|
||||
throws = false;
|
||||
try {
|
||||
var cursor = storage.enumerate("string", {"since": 1});
|
||||
var cursor = storage.enumerate("string", {"since": new Date(1)});
|
||||
} catch(e) {throws = true}
|
||||
ok(!throws, "enumerate a string and object parameter");
|
||||
|
||||
|
@ -66,7 +66,7 @@ ok(throws, "enumerate object then a string");
|
|||
|
||||
throws = false;
|
||||
try {
|
||||
var cursor = storage.enumerate({"path": "a", "since": 0});
|
||||
var cursor = storage.enumerate({"path": "a", "since": new Date(0) });
|
||||
} catch(e) {throws = true}
|
||||
ok(!throws, "enumerate object parameter with path");
|
||||
|
||||
|
|
|
@ -36,10 +36,13 @@
|
|||
#include "ipc/IndexedDBChild.h"
|
||||
#include "ipc/IndexedDBParent.h"
|
||||
|
||||
#include "mozilla/dom/IDBDatabaseBinding.h"
|
||||
|
||||
USING_INDEXEDDB_NAMESPACE
|
||||
using mozilla::dom::ContentParent;
|
||||
using mozilla::dom::quota::Client;
|
||||
using mozilla::dom::quota::QuotaManager;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -528,36 +531,22 @@ IDBDatabase::CreateObjectStore(const nsAString& aName,
|
|||
|
||||
DatabaseInfo* databaseInfo = transaction->DBInfo();
|
||||
|
||||
mozilla::idl::IDBObjectStoreParameters params;
|
||||
KeyPath keyPath(0);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (!JSVAL_IS_VOID(aOptions) && !JSVAL_IS_NULL(aOptions)) {
|
||||
rv = params.Init(aCx, &aOptions);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// We need a default value here, which the XPIDL dictionary stuff doesn't
|
||||
// support. WebIDL shall save us all!
|
||||
JSBool hasProp = false;
|
||||
JSObject* obj = JSVAL_TO_OBJECT(aOptions);
|
||||
if (!JS_HasProperty(aCx, obj, "keyPath", &hasProp)) {
|
||||
RootedDictionary<IDBObjectStoreParameters> params(aCx);
|
||||
JS::Rooted<JS::Value> options(aCx, aOptions);
|
||||
if (!params.Init(aCx, options)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
if (NS_FAILED(KeyPath::Parse(aCx, hasProp ? params.keyPath : JSVAL_NULL,
|
||||
&keyPath))) {
|
||||
KeyPath keyPath(0);
|
||||
if (NS_FAILED(KeyPath::Parse(aCx, params.mKeyPath, &keyPath))) {
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
if (databaseInfo->ContainsStoreName(aName)) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_CONSTRAINT_ERR;
|
||||
}
|
||||
|
||||
if (!keyPath.IsAllowedForObjectStore(params.autoIncrement)) {
|
||||
if (!keyPath.IsAllowedForObjectStore(params.mAutoIncrement)) {
|
||||
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
}
|
||||
|
||||
|
@ -566,10 +555,10 @@ IDBDatabase::CreateObjectStore(const nsAString& aName,
|
|||
guts.name = aName;
|
||||
guts.id = databaseInfo->nextObjectStoreId++;
|
||||
guts.keyPath = keyPath;
|
||||
guts.autoIncrement = params.autoIncrement;
|
||||
guts.autoIncrement = params.mAutoIncrement;
|
||||
|
||||
nsRefPtr<IDBObjectStore> objectStore;
|
||||
rv = CreateObjectStoreInternal(transaction, guts,
|
||||
nsresult rv = CreateObjectStoreInternal(transaction, guts,
|
||||
getter_AddRefs(objectStore));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
|
@ -12,12 +12,6 @@ interface nsIIDBTransaction;
|
|||
interface nsIDOMDOMStringList;
|
||||
interface nsIDOMEventListener;
|
||||
|
||||
dictionary IDBObjectStoreParameters
|
||||
{
|
||||
jsval keyPath;
|
||||
boolean autoIncrement;
|
||||
};
|
||||
|
||||
/**
|
||||
* IDBDatabase interface. See
|
||||
* http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBDatabase
|
||||
|
|
|
@ -11,11 +11,6 @@ interface nsIDOMDeviceStorageChangeEvent;
|
|||
interface nsIDOMEventListener;
|
||||
interface nsIFile;
|
||||
|
||||
dictionary DeviceStorageEnumerationParameters
|
||||
{
|
||||
jsval since;
|
||||
};
|
||||
|
||||
[scriptable, uuid(be690a9b-f0b4-4cde-a505-0b442abe2109), builtinclass]
|
||||
interface nsIDOMDeviceStorage : nsIDOMEventTarget
|
||||
{
|
||||
|
|
|
@ -11,14 +11,6 @@ interface nsIDOMDOMCursor;
|
|||
interface nsIDOMDOMRequest;
|
||||
interface nsIDOMBlob;
|
||||
|
||||
dictionary MmsParameters
|
||||
{
|
||||
jsval receivers; // DOMString[]
|
||||
DOMString? subject;
|
||||
DOMString? smil;
|
||||
jsval attachments; // MmsAttachment[]
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(a7984cb3-27c8-4e3d-82a4-01553e93c078)]
|
||||
interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
interface nsIDOMBlob;
|
||||
|
||||
// If this is changed, change the WebIDL dictionary as well.
|
||||
dictionary MmsAttachment
|
||||
{
|
||||
DOMString? id;
|
||||
|
|
|
@ -38,7 +38,7 @@ MobileMessageCallback::~MobileMessageCallback()
|
|||
|
||||
|
||||
nsresult
|
||||
MobileMessageCallback::NotifySuccess(const JS::Value& aResult)
|
||||
MobileMessageCallback::NotifySuccess(JS::Handle<JS::Value> aResult)
|
||||
{
|
||||
mDOMRequest->FireSuccess(aResult);
|
||||
return NS_OK;
|
||||
|
@ -121,7 +121,9 @@ NS_IMETHODIMP
|
|||
MobileMessageCallback::NotifyMessageDeleted(bool *aDeleted, uint32_t aSize)
|
||||
{
|
||||
if (aSize == 1) {
|
||||
return NotifySuccess(aDeleted[0] ? JSVAL_TRUE : JSVAL_FALSE);
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> val(cx, aDeleted[0] ? JSVAL_TRUE : JSVAL_FALSE);
|
||||
return NotifySuccess(val);
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
@ -140,7 +142,8 @@ MobileMessageCallback::NotifyMessageDeleted(bool *aDeleted, uint32_t aSize)
|
|||
aDeleted[i] ? &jsValTrue : &jsValFalse);
|
||||
}
|
||||
|
||||
return NotifySuccess(OBJECT_TO_JSVAL(deleteArrayObj));
|
||||
JS::Rooted<JS::Value> deleteArrayVal(cx, JS::ObjectValue(*deleteArrayObj));
|
||||
return NotifySuccess(deleteArrayVal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -152,7 +155,9 @@ MobileMessageCallback::NotifyDeleteMessageFailed(int32_t aError)
|
|||
NS_IMETHODIMP
|
||||
MobileMessageCallback::NotifyMessageMarkedRead(bool aRead)
|
||||
{
|
||||
return NotifySuccess(aRead ? JSVAL_TRUE : JSVAL_FALSE);
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> val(cx, aRead ? JSVAL_TRUE : JSVAL_FALSE);
|
||||
return NotifySuccess(val);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -29,7 +29,7 @@ private:
|
|||
|
||||
nsRefPtr<DOMRequest> mDOMRequest;
|
||||
|
||||
nsresult NotifySuccess(const JS::Value& aResult);
|
||||
nsresult NotifySuccess(JS::Handle<JS::Value> aResult);
|
||||
nsresult NotifySuccess(nsISupports *aMessage);
|
||||
nsresult NotifyError(int32_t aError);
|
||||
};
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
#include "DictionaryHelpers.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/dom/MobileMessageManagerBinding.h"
|
||||
#include "mozilla/dom/MozMmsMessageBinding.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::mobilemessage;
|
||||
|
@ -174,75 +177,39 @@ GetSendMmsMessageRequestFromParams(const JS::Value& aParam,
|
|||
}
|
||||
|
||||
mozilla::AutoJSContext cx;
|
||||
mozilla::idl::MmsParameters params;
|
||||
nsresult rv = params.Init(cx, &aParam);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
uint32_t len;
|
||||
JS::Rooted<JS::Value> param(cx, aParam);
|
||||
RootedDictionary<MmsParameters> params(cx);
|
||||
if (!params.Init(cx, param)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// SendMobileMessageRequest.receivers
|
||||
if (!params.receivers.isObject()) {
|
||||
if (!params.mReceivers.WasPassed()) {
|
||||
return false;
|
||||
}
|
||||
JS::Rooted<JSObject*> receiversObj(cx, ¶ms.receivers.toObject());
|
||||
if (!JS_GetArrayLength(cx, receiversObj, &len)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
request.receivers().SetCapacity(len);
|
||||
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_GetElement(cx, receiversObj, i, val.address())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!val.isString()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsDependentJSString str;
|
||||
if (!str.init(cx, val.toString())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
request.receivers().AppendElement(str);
|
||||
}
|
||||
request.receivers().AppendElements(params.mReceivers.Value());
|
||||
|
||||
// SendMobileMessageRequest.attachments
|
||||
mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton();
|
||||
|
||||
if (!params.attachments.isObject()) {
|
||||
return false;
|
||||
}
|
||||
JS::Rooted<JSObject*> attachmentsObj(cx, ¶ms.attachments.toObject());
|
||||
if (!JS_GetArrayLength(cx, attachmentsObj, &len)) {
|
||||
return false;
|
||||
}
|
||||
request.attachments().SetCapacity(len);
|
||||
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_GetElement(cx, attachmentsObj, i, val.address())) {
|
||||
if (!params.mAttachments.WasPassed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mozilla::idl::MmsAttachment attachment;
|
||||
rv = attachment.Init(cx, val.address());
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
for (uint32_t i = 0; i < params.mAttachments.Value().Length(); i++) {
|
||||
MmsAttachment& attachment = params.mAttachments.Value()[i];
|
||||
MmsAttachmentData mmsAttachment;
|
||||
mmsAttachment.id().Assign(attachment.id);
|
||||
mmsAttachment.location().Assign(attachment.location);
|
||||
mmsAttachment.contentChild() = cc->GetOrCreateActorForBlob(attachment.content);
|
||||
mmsAttachment.id().Assign(attachment.mId);
|
||||
mmsAttachment.location().Assign(attachment.mLocation);
|
||||
mmsAttachment.contentChild() = cc->GetOrCreateActorForBlob(attachment.mContent);
|
||||
if (!mmsAttachment.contentChild()) {
|
||||
return false;
|
||||
}
|
||||
request.attachments().AppendElement(mmsAttachment);
|
||||
}
|
||||
|
||||
request.smil() = params.smil;
|
||||
request.subject() = params.subject;
|
||||
request.smil() = params.mSmil;
|
||||
request.subject() = params.mSubject;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: IDL; 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/.
|
||||
*/
|
||||
|
||||
dictionary CameraPictureOptions {
|
||||
|
||||
/* an object with a combination of 'height' and 'width' properties
|
||||
chosen from nsICameraCapabilities.pictureSizes */
|
||||
// XXXbz this should be a CameraSize dictionary, but we don't have that yet.
|
||||
any pictureSize = null;
|
||||
|
||||
/* one of the file formats chosen from
|
||||
nsICameraCapabilities.fileFormats */
|
||||
DOMString fileFormat = "";
|
||||
|
||||
/* the rotation of the image in degrees, from 0 to 270 in
|
||||
steps of 90; this doesn't affect the image, only the
|
||||
rotation recorded in the image header.*/
|
||||
long rotation = 0;
|
||||
|
||||
/* an object containing any or all of 'latitude', 'longitude',
|
||||
'altitude', and 'timestamp', used to record when and where
|
||||
the image was taken. e.g.
|
||||
{
|
||||
latitude: 43.647118,
|
||||
longitude: -79.3943,
|
||||
altitude: 500
|
||||
// timestamp not specified, in this case, and
|
||||
// won't be included in the image header
|
||||
}
|
||||
|
||||
can be null in the case where position information isn't
|
||||
available/desired.
|
||||
|
||||
'altitude' is in metres; 'timestamp' is UTC, in seconds from
|
||||
January 1, 1970.
|
||||
*/
|
||||
any position = null;
|
||||
|
||||
/* the number of seconds from January 1, 1970 UTC. This can be
|
||||
different from the positional timestamp (above). */
|
||||
// XXXbz this should really accept a date too, no?
|
||||
long long dateTime = 0;
|
||||
};
|
||||
|
||||
// If we start using CameraPictureOptions here, remove it from DummyBinding.
|
|
@ -0,0 +1,12 @@
|
|||
/* -*- Mode: IDL; 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/.
|
||||
*/
|
||||
|
||||
dictionary DeviceStorageEnumerationParameters {
|
||||
Date since;
|
||||
};
|
||||
|
||||
// If we start using DeviceStorageEnumerationParameters here, remove
|
||||
// it from DummyBinding.
|
|
@ -19,6 +19,11 @@ interface DummyInterface {
|
|||
void funcWebSocketDict(optional WebSocketDict arg);
|
||||
void funcDNSCacheDict(optional DNSCacheDict arg);
|
||||
void frameRequestCallback(FrameRequestCallback arg);
|
||||
void idbObjectStoreParams(optional IDBObjectStoreParameters arg);
|
||||
void DeviceStorageEnumerationParameters(optional DeviceStorageEnumerationParameters arg);
|
||||
void CameraPictureOptions(optional CameraPictureOptions arg);
|
||||
void MmsParameters(optional MmsParameters arg);
|
||||
void MmsAttachment(optional MmsAttachment arg);
|
||||
};
|
||||
|
||||
interface DummyInterfaceWorkers {
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/* -*- Mode: IDL; 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/.
|
||||
*/
|
||||
|
||||
dictionary IDBObjectStoreParameters {
|
||||
// XXXbz this should be "(DOMString or sequence<DOMString>)?", but
|
||||
// we don't support unions in dictionaries yet. See bug 767926.
|
||||
any keyPath = null;
|
||||
boolean autoIncrement = false;
|
||||
};
|
||||
|
||||
// If we start using IDBObjectStoreParameters here, remove it from DummyBinding.
|
|
@ -0,0 +1,14 @@
|
|||
/* -*- Mode: IDL; 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/.
|
||||
*/
|
||||
|
||||
dictionary MmsParameters {
|
||||
sequence<DOMString> receivers;
|
||||
DOMString? subject = null;
|
||||
DOMString? smil = null;
|
||||
sequence<MmsAttachment> attachments;
|
||||
};
|
||||
|
||||
// If we start using MmsParameters here, remove it from DummyBinding.
|
|
@ -0,0 +1,14 @@
|
|||
/* -*- Mode: IDL; 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/.
|
||||
*/
|
||||
|
||||
// If this is changed, change the XPIDL dictionary as well.
|
||||
dictionary MmsAttachment {
|
||||
DOMString? id = null;
|
||||
DOMString? location = null;
|
||||
Blob? content = null;
|
||||
};
|
||||
|
||||
// If we start using MmsParameters here, remove it from DummyBinding.
|
|
@ -38,6 +38,7 @@ webidl_files = \
|
|||
ClientRect.webidl \
|
||||
ClientRectList.webidl \
|
||||
ClipboardEvent.webidl \
|
||||
CameraManager.webidl \
|
||||
CommandEvent.webidl \
|
||||
Comment.webidl \
|
||||
CompositionEvent.webidl \
|
||||
|
@ -52,6 +53,7 @@ webidl_files = \
|
|||
DelayNode.webidl \
|
||||
DesktopNotification.webidl \
|
||||
DeviceMotionEvent.webidl \
|
||||
DeviceStorage.webidl \
|
||||
Document.webidl \
|
||||
DocumentFragment.webidl \
|
||||
DocumentType.webidl \
|
||||
|
@ -151,6 +153,7 @@ webidl_files = \
|
|||
HTMLTitleElement.webidl \
|
||||
HTMLUListElement.webidl \
|
||||
HTMLVideoElement.webidl \
|
||||
IDBDatabase.webidl \
|
||||
IDBFactory.webidl \
|
||||
IDBVersionChangeEvent.webidl \
|
||||
ImageData.webidl \
|
||||
|
@ -165,9 +168,11 @@ webidl_files = \
|
|||
MediaStreamEvent.webidl \
|
||||
MediaStreamTrack.webidl \
|
||||
MessageEvent.webidl \
|
||||
MobileMessageManager.webidl \
|
||||
MouseEvent.webidl \
|
||||
MouseScrollEvent.webidl \
|
||||
MozActivity.webidl \
|
||||
MozMmsMessage.webidl \
|
||||
MozNamedAttrMap.webidl \
|
||||
MutationEvent.webidl \
|
||||
MutationObserver.webidl \
|
||||
|
|
|
@ -209,7 +209,7 @@ EventListenerManager::FinalizeInternal(JSFreeOp* aFop)
|
|||
|
||||
void
|
||||
EventListenerManager::Add(JSContext* aCx, const jsid& aType,
|
||||
JSObject* aListener, Phase aPhase,
|
||||
JS::Handle<JSObject*> aListener, Phase aPhase,
|
||||
bool aWantsUntrusted, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(aListener);
|
||||
|
@ -244,7 +244,7 @@ EventListenerManager::Add(JSContext* aCx, const jsid& aType,
|
|||
|
||||
void
|
||||
EventListenerManager::Remove(JSContext* aCx, const jsid& aType,
|
||||
JSObject* aListener, Phase aPhase,
|
||||
JS::Handle<JSObject*> aListener, Phase aPhase,
|
||||
bool aClearEmpty)
|
||||
{
|
||||
MOZ_ASSERT(aListener);
|
||||
|
|
|
@ -60,7 +60,8 @@ public:
|
|||
};
|
||||
|
||||
void
|
||||
AddEventListener(JSContext* aCx, const jsid& aType, JSObject* aListener,
|
||||
AddEventListener(JSContext* aCx, const jsid& aType,
|
||||
JS::Handle<JSObject*> aListener,
|
||||
bool aCapturing, bool aWantsUntrusted, ErrorResult& aRv)
|
||||
{
|
||||
Add(aCx, aType, aListener, aCapturing ? Capturing : Bubbling,
|
||||
|
@ -68,8 +69,8 @@ public:
|
|||
}
|
||||
|
||||
void
|
||||
RemoveEventListener(JSContext* aCx, const jsid& aType, JSObject* aListener,
|
||||
bool aCapturing)
|
||||
RemoveEventListener(JSContext* aCx, const jsid& aType,
|
||||
JS::Handle<JSObject*> aListener, bool aCapturing)
|
||||
{
|
||||
if (mCollections.isEmpty()) {
|
||||
return;
|
||||
|
@ -85,10 +86,11 @@ public:
|
|||
GetEventListener(const jsid& aType) const;
|
||||
|
||||
void
|
||||
SetEventListener(JSContext* aCx, const jsid& aType, JSObject* aListener,
|
||||
SetEventListener(JSContext* aCx, const jsid& aType,
|
||||
JS::Handle<JSObject*> aListener,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
JSObject* existing = GetEventListener(aType);
|
||||
JS::Rooted<JSObject*> existing(aCx, GetEventListener(aType));
|
||||
if (existing) {
|
||||
Remove(aCx, aType, existing, Onfoo, false);
|
||||
}
|
||||
|
@ -118,12 +120,12 @@ private:
|
|||
FinalizeInternal(JSFreeOp* aFop);
|
||||
|
||||
void
|
||||
Add(JSContext* aCx, const jsid& aType, JSObject* aListener, Phase aPhase,
|
||||
bool aWantsUntrusted, ErrorResult& aRv);
|
||||
Add(JSContext* aCx, const jsid& aType, JS::Handle<JSObject*> aListener,
|
||||
Phase aPhase, bool aWantsUntrusted, ErrorResult& aRv);
|
||||
|
||||
void
|
||||
Remove(JSContext* aCx, const jsid& aType, JSObject* aListener, Phase aPhase,
|
||||
bool aClearEmpty);
|
||||
Remove(JSContext* aCx, const jsid& aType, JS::Handle<JSObject*> aListener,
|
||||
Phase aPhase, bool aClearEmpty);
|
||||
|
||||
bool
|
||||
HasListenersForTypeInternal(JSContext* aCx, const jsid& aType) const;
|
||||
|
|
|
@ -39,11 +39,11 @@ EventTarget::GetEventListener(const nsAString& aType, ErrorResult& aRv) const
|
|||
}
|
||||
|
||||
void
|
||||
EventTarget::SetEventListener(const nsAString& aType, JSObject* aListener_,
|
||||
EventTarget::SetEventListener(const nsAString& aType,
|
||||
JS::Handle<JSObject*> aListener,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
JSContext* cx = GetJSContext();
|
||||
JS::Rooted<JSObject*> aListener(cx, aListener_);
|
||||
|
||||
JSString* type =
|
||||
JS_NewUCStringCopyN(cx, aType.BeginReading(), aType.Length());
|
||||
|
@ -57,16 +57,16 @@ EventTarget::SetEventListener(const nsAString& aType, JSObject* aListener_,
|
|||
}
|
||||
|
||||
void
|
||||
EventTarget::AddEventListener(const nsAString& aType, JSObject* aListener_,
|
||||
EventTarget::AddEventListener(const nsAString& aType,
|
||||
JS::Handle<JSObject*> aListener,
|
||||
bool aCapturing, Nullable<bool> aWantsUntrusted,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (!aListener_) {
|
||||
if (!aListener) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSContext* cx = GetJSContext();
|
||||
JS::Rooted<JSObject*> aListener(cx, aListener_);
|
||||
|
||||
JSString* type =
|
||||
JS_NewUCStringCopyN(cx, aType.BeginReading(), aType.Length());
|
||||
|
@ -82,15 +82,15 @@ EventTarget::AddEventListener(const nsAString& aType, JSObject* aListener_,
|
|||
}
|
||||
|
||||
void
|
||||
EventTarget::RemoveEventListener(const nsAString& aType, JSObject* aListener_,
|
||||
EventTarget::RemoveEventListener(const nsAString& aType,
|
||||
JS::Handle<JSObject*> aListener,
|
||||
bool aCapturing, ErrorResult& aRv)
|
||||
{
|
||||
if (!aListener_) {
|
||||
if (!aListener) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSContext* cx = GetJSContext();
|
||||
JS::Rooted<JSObject*> aListener(cx, aListener_);
|
||||
|
||||
JSString* type =
|
||||
JS_NewUCStringCopyN(cx, aType.BeginReading(), aType.Length());
|
||||
|
|
|
@ -37,12 +37,12 @@ public:
|
|||
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
|
||||
|
||||
void
|
||||
AddEventListener(const nsAString& aType, JSObject* aListener,
|
||||
AddEventListener(const nsAString& aType, JS::Handle<JSObject*> aListener,
|
||||
bool aCapture, Nullable<bool> aWantsUntrusted,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void
|
||||
RemoveEventListener(const nsAString& aType, JSObject* aListener,
|
||||
RemoveEventListener(const nsAString& aType, JS::Handle<JSObject*> aListener,
|
||||
bool aCapture, ErrorResult& aRv);
|
||||
|
||||
bool
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
GetEventListener(const nsAString& aType, ErrorResult& aRv) const;
|
||||
|
||||
void
|
||||
SetEventListener(const nsAString& aType, JSObject* aListener,
|
||||
SetEventListener(const nsAString& aType, JS::Handle<JSObject*> aListener,
|
||||
ErrorResult& aRv);
|
||||
|
||||
bool
|
||||
|
|
|
@ -186,8 +186,9 @@ private:
|
|||
}
|
||||
|
||||
ErrorResult rv;
|
||||
JS::Rooted<JSObject*> listenerObj(aCx, JSVAL_TO_OBJECT(aVp));
|
||||
scope->SetEventListener(NS_ConvertASCIItoUTF16(name + 2),
|
||||
JSVAL_TO_OBJECT(aVp), rv);
|
||||
listenerObj, rv);
|
||||
if (rv.Failed()) {
|
||||
JS_ReportError(aCx, "Failed to set event listener!");
|
||||
return false;
|
||||
|
@ -360,7 +361,7 @@ private:
|
|||
return false;
|
||||
}
|
||||
|
||||
JSObject* listener = JS_GetFunctionObject(adaptor);
|
||||
JS::Rooted<JSObject*> listener(aCx, JS_GetFunctionObject(adaptor));
|
||||
if (!listener) {
|
||||
return false;
|
||||
}
|
||||
|
@ -776,8 +777,9 @@ private:
|
|||
|
||||
ErrorResult rv;
|
||||
|
||||
JS::Rooted<JSObject*> listenerObj(aCx, JSVAL_TO_OBJECT(aVp));
|
||||
scope->SetEventListener(NS_ConvertASCIItoUTF16(name + 2),
|
||||
JSVAL_TO_OBJECT(aVp), rv);
|
||||
listenerObj, rv);
|
||||
|
||||
if (rv.Failed()) {
|
||||
JS_ReportError(aCx, "Failed to set event listener!");
|
||||
|
|
|
@ -665,6 +665,8 @@ public:
|
|||
}
|
||||
|
||||
XMLHttpRequest::StateData state;
|
||||
// XXXbz there is no AutoValueRooter anymore?
|
||||
JS::AutoArrayRooter rooter(aCx, 1, &state.mResponse);
|
||||
|
||||
state.mResponseTextResult = mResponseTextResult;
|
||||
state.mResponseText = mResponseText;
|
||||
|
|
|
@ -105,7 +105,8 @@ public:
|
|||
} \
|
||||
\
|
||||
void \
|
||||
SetOn##_type(JSContext* /* unused */, JSObject* aListener, ErrorResult& aRv) \
|
||||
SetOn##_type(JSContext* /* unused */, JS::Handle<JSObject*> aListener, \
|
||||
ErrorResult& aRv) \
|
||||
{ \
|
||||
SetEventListener(NS_LITERAL_STRING(#_type), aListener, aRv); \
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ public:
|
|||
} \
|
||||
\
|
||||
void \
|
||||
SetOn##_type(JSContext* /* unused */, JSObject* aListener, ErrorResult& aRv) \
|
||||
SetOn##_type(JSContext* /* unused */, JS::Handle<JSObject*> aListener, \
|
||||
ErrorResult& aRv) \
|
||||
{ \
|
||||
SetEventListener(NS_LITERAL_STRING(#_type), aListener, aRv); \
|
||||
}
|
||||
|
|
|
@ -9,20 +9,16 @@ dictionaries = [
|
|||
[ 'MouseEventInit', 'nsIDOMMouseEvent.idl' ],
|
||||
[ 'ClipboardEventInit', 'nsIDOMClipboardEvent.idl' ],
|
||||
[ 'WheelEventInit', 'nsIDOMWheelEvent.idl' ],
|
||||
[ 'IDBObjectStoreParameters', 'nsIIDBDatabase.idl' ],
|
||||
[ 'IDBIndexParameters', 'nsIIDBObjectStore.idl' ],
|
||||
[ 'GeoPositionOptions', 'nsIDOMGeoGeolocation.idl' ],
|
||||
[ 'DOMFileMetadataParameters', 'nsIDOMLockedFile.idl' ],
|
||||
[ 'DeviceStorageEnumerationParameters', 'nsIDOMDeviceStorage.idl' ],
|
||||
[ 'CameraSize', 'nsIDOMCameraManager.idl' ],
|
||||
[ 'CameraRegion', 'nsIDOMCameraManager.idl' ],
|
||||
[ 'CameraPosition', 'nsIDOMCameraManager.idl' ],
|
||||
[ 'CameraSelector', 'nsIDOMCameraManager.idl' ],
|
||||
[ 'CameraPictureOptions', 'nsIDOMCameraManager.idl' ],
|
||||
[ 'CameraRecordingOptions', 'nsIDOMCameraManager.idl' ],
|
||||
[ 'SmsThreadListItem', 'nsIMobileMessageCallback.idl' ],
|
||||
[ 'MmsAttachment', 'nsIDOMMozMmsMessage.idl' ],
|
||||
[ 'MmsParameters', 'nsIDOMMobileMessageManager.idl' ]
|
||||
[ 'MmsAttachment', 'nsIDOMMozMmsMessage.idl' ]
|
||||
]
|
||||
|
||||
# include file names
|
||||
|
|
Загрузка…
Ссылка в новой задаче