diff --git a/content/html/content/public/HTMLCanvasElement.h b/content/html/content/public/HTMLCanvasElement.h
index c6968002ee41..b5d387541240 100644
--- a/content/html/content/public/HTMLCanvasElement.h
+++ b/content/html/content/public/HTMLCanvasElement.h
@@ -83,18 +83,15 @@ public:
JS::Handle aContextOptions,
ErrorResult& aRv);
void ToDataURL(JSContext* aCx, const nsAString& aType,
- const Optional >& aParams,
+ JS::Handle aParams,
nsAString& aDataURL, ErrorResult& aRv)
{
- JS::Handle params = aParams.WasPassed()
- ? aParams.Value()
- : JS::UndefinedHandleValue;
- aRv = ToDataURL(aType, params, aCx, aDataURL);
+ aRv = ToDataURL(aType, aParams, aCx, aDataURL);
}
void ToBlob(JSContext* aCx,
FileCallback& aCallback,
const nsAString& aType,
- const Optional >& aParams,
+ JS::Handle aParams,
ErrorResult& aRv);
bool MozOpaque() const
diff --git a/content/html/content/src/HTMLCanvasElement.cpp b/content/html/content/src/HTMLCanvasElement.cpp
index 0ef8b142e904..7bdc4f57a259 100644
--- a/content/html/content/src/HTMLCanvasElement.cpp
+++ b/content/html/content/src/HTMLCanvasElement.cpp
@@ -487,7 +487,7 @@ void
HTMLCanvasElement::ToBlob(JSContext* aCx,
FileCallback& aCallback,
const nsAString& aType,
- const Optional >& aParams,
+ JS::Handle aParams,
ErrorResult& aRv)
{
// do a trust check if this is a write-only canvas
@@ -502,13 +502,9 @@ HTMLCanvasElement::ToBlob(JSContext* aCx,
return;
}
- JS::Value encoderOptions = aParams.WasPassed()
- ? aParams.Value()
- : JS::UndefinedValue();
-
nsAutoString params;
bool usingCustomParseOptions;
- aRv = ParseParams(aCx, type, encoderOptions, params, &usingCustomParseOptions);
+ aRv = ParseParams(aCx, type, aParams, params, &usingCustomParseOptions);
if (aRv.Failed()) {
return;
}
diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp
index 471c5bc5e95e..af75f5f2cb0b 100644
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -8807,18 +8807,14 @@ nsGlobalWindow::ShowModalDialog(const nsAString& aUrl, nsIVariant* aArgument,
JS::Value
nsGlobalWindow::ShowModalDialog(JSContext* aCx, const nsAString& aUrl,
- const Optional >& aArgument,
+ JS::Handle aArgument,
const nsAString& aOptions,
ErrorResult& aError)
{
nsCOMPtr args;
- if (aArgument.WasPassed()) {
- aError = nsContentUtils::XPConnect()->JSToVariant(aCx,
- aArgument.Value(),
- getter_AddRefs(args));
- } else {
- args = CreateVoidVariant();
- }
+ aError = nsContentUtils::XPConnect()->JSToVariant(aCx,
+ aArgument,
+ getter_AddRefs(args));
nsCOMPtr retVal = ShowModalDialog(aUrl, args, aOptions, aError);
if (aError.Failed()) {
diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h
index 62536d82985a..bc52f49b959c 100644
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -824,7 +824,7 @@ public:
void Prompt(const nsAString& aMessage, const nsAString& aInitial,
nsAString& aReturn, mozilla::ErrorResult& aError);
void Print(mozilla::ErrorResult& aError);
- JS::Value ShowModalDialog(JSContext* aCx, const nsAString& aUrl, const mozilla::dom::Optional >& aArgument, const nsAString& aOptions, mozilla::ErrorResult& aError);
+ JS::Value ShowModalDialog(JSContext* aCx, const nsAString& aUrl, JS::Handle aArgument, const nsAString& aOptions, mozilla::ErrorResult& aError);
void PostMessageMoz(JSContext* aCx, JS::Handle aMessage,
const nsAString& aTargetOrigin,
const mozilla::dom::Optional >& aTransfer,
diff --git a/dom/bindings/BindingDeclarations.h b/dom/bindings/BindingDeclarations.h
index af017319c7ca..91ed3ba97e6a 100644
--- a/dom/bindings/BindingDeclarations.h
+++ b/dom/bindings/BindingDeclarations.h
@@ -241,32 +241,14 @@ public:
}
};
-// A specialization of Optional for JS::Value to make sure that when someone
-// calls Construct() on it we will pre-initialized the JS::Value to
-// JS::UndefinedValue() so it can be traced safely.
+// A specialization of Optional for JS::Value to make sure no one ever uses it.
template<>
-class Optional : public Optional_base
+class Optional
{
-public:
- Optional() :
- Optional_base()
- {}
+private:
+ Optional() MOZ_DELETE;
- explicit Optional(JS::Value aValue) :
- Optional_base(aValue)
- {}
-
- // Don't allow us to have an uninitialized JS::Value
- void Construct()
- {
- Optional_base::Construct(JS::UndefinedValue());
- }
-
- template
- void Construct(const T1& t1)
- {
- Optional_base::Construct(t1);
- }
+ explicit Optional(JS::Value aValue) MOZ_DELETE;
};
// A specialization of Optional for NonNull that lets us get a T& from Value()
diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py
index b3616efc6743..897afd446b4f 100644
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -11,7 +11,7 @@ import string
import math
import itertools
-from WebIDL import BuiltinTypes, IDLBuiltinType, IDLNullValue, IDLSequenceType, IDLType, IDLAttribute
+from WebIDL import BuiltinTypes, IDLBuiltinType, IDLNullValue, IDLSequenceType, IDLType, IDLAttribute, IDLUndefinedValue
from Configuration import NoSuchDescriptorError, getTypesFromDescriptor, getTypesFromDictionary, getTypesFromCallback, Descriptor
AUTOGENERATED_WARNING_COMMENT = \
@@ -3844,21 +3844,22 @@ for (uint32_t i = 0; i < length; ++i) {
declType = "JS::Value"
else:
assert not isMember
- if isOptional:
- # We have a specialization of Optional that will use a
- # Rooted for the storage here.
- declType = "JS::Handle"
- else:
- declType = "JS::Rooted"
+ declType = "JS::Rooted"
declArgs = "cx"
+ assert not isOptional
templateBody = "${declName} = ${val};"
- nullHandling = "${declName} = JS::NullValue()"
-
- templateBody = handleDefaultNull(templateBody, nullHandling)
+ # We may not have a default value if we're being converted for
+ # a setter, say.
+ if defaultValue:
+ if isinstance(defaultValue, IDLNullValue):
+ defaultHandling = "${declName} = JS::NullValue()"
+ else:
+ assert isinstance(defaultValue, IDLUndefinedValue)
+ defaultHandling = "${declName} = JS::UndefinedValue()"
+ templateBody = handleDefault(templateBody, defaultHandling)
return JSToNativeConversionInfo(templateBody,
declType=CGGeneric(declType),
- dealWithOptional=isOptional,
declArgs=declArgs)
if type.isObject():
@@ -4142,6 +4143,8 @@ def instantiateJSToNativeConversion(info, replacements, checkForValue=False):
def convertConstIDLValueToJSVal(value):
if isinstance(value, IDLNullValue):
return "JS::NullValue()"
+ if isinstance(value, IDLUndefinedValue):
+ return "JS::UndefinedValue()"
tag = value.type.tag()
if tag in [IDLType.Tags.int8, IDLType.Tags.uint8, IDLType.Tags.int16,
IDLType.Tags.uint16, IDLType.Tags.int32]:
diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py
index ef2b8e99a3d6..165eff9e0c5a 100644
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -2531,7 +2531,24 @@ class IDLNullValue(IDLObject):
def _getDependentObjects(self):
return set()
-
+
+class IDLUndefinedValue(IDLObject):
+ def __init__(self, location):
+ IDLObject.__init__(self, location)
+ self.type = None
+ self.value = None
+
+ def coerceToType(self, type, location):
+ if not type.isAny():
+ raise WebIDLError("Cannot coerce undefined value to type %s." % type,
+ [location])
+
+ undefinedValue = IDLUndefinedValue(self.location)
+ undefinedValue.type = type
+ return undefinedValue
+
+ def _getDependentObjects(self):
+ return set()
class IDLInterfaceMember(IDLObjectWithIdentifier):
@@ -2909,6 +2926,22 @@ class IDLArgument(IDLObjectWithIdentifier):
# Default optional dictionaries to null, for simplicity,
# so the codegen doesn't have to special-case this.
self.defaultValue = IDLNullValue(self.location)
+ elif self.type.isAny():
+ assert (self.defaultValue is None or
+ isinstance(self.defaultValue, IDLNullValue))
+ if (self.optional and not self.variadic and
+ not self.dictionaryMember and not self.defaultValue):
+ raise WebIDLError("Arguments of type 'any' are always optional "
+ "and shouldn't have the 'optional' keyword "
+ "unless they're being given a default value "
+ "of 'null'",
+ [self.location])
+ # 'any' values are always optional.
+ self.optional = True
+ if not self.defaultValue and not self.variadic:
+ # Set the default value to undefined, for simplicity, so the
+ # codegen doesn't have to special-case this.
+ self.defaultValue = IDLUndefinedValue(self.location)
# Now do the coercing thing; this needs to happen after the
# above creation of a default value.
@@ -4288,6 +4321,10 @@ class Parser(Tokenizer):
raise WebIDLError("Mandatory arguments can't have a default value.",
[self.getLocation(p, 6)])
+ # We can't test t.isAny() here and force optional to true, since at this
+ # point t is not a fully resolved type yet (e.g. it might be a typedef).
+ # We'll handle the 'any' case in IDLArgument.complete.
+
if variadic:
if optional:
raise WebIDLError("Variadic arguments should not be marked optional.",
diff --git a/dom/bindings/parser/tests/test_method.py b/dom/bindings/parser/tests/test_method.py
index 43fa2828b664..5f80b52d60dc 100644
--- a/dom/bindings/parser/tests/test_method.py
+++ b/dom/bindings/parser/tests/test_method.py
@@ -112,7 +112,7 @@ def WebIDLTest(parser, harness):
checkMethod(methods[11], "::TestMethods::setAny",
"setAny",
[("Void",
- [("::TestMethods::setAny::arg1", "arg1", "Any", False, False)])])
+ [("::TestMethods::setAny::arg1", "arg1", "Any", True, False)])])
checkMethod(methods[12], "::TestMethods::doFloats",
"doFloats",
[("Float",
diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h
index 40c99e89be2d..a666b8c63545 100644
--- a/dom/bindings/test/TestBindingHeader.h
+++ b/dom/bindings/test/TestBindingHeader.h
@@ -146,11 +146,11 @@ public:
already_AddRefed Test2(const GlobalObject&,
JSContext*,
const DictForConstructor&,
- JS::Value,
+ JS::Handle,
JS::Handle,
JS::Handle,
const Sequence&,
- const Optional >&,
+ JS::Handle,
const Optional >&,
const Optional >&,
ErrorResult&);
@@ -466,7 +466,6 @@ public:
// Any types
void PassAny(JSContext*, JS::Handle);
void PassVariadicAny(JSContext*, const Sequence&);
- void PassOptionalAny(JSContext*, const Optional >&);
void PassAnyDefaultNull(JSContext*, JS::Handle);
void PassSequenceOfAny(JSContext*, const Sequence&);
void PassNullableSequenceOfAny(JSContext*, const Nullable >&);
diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl
index caa6bb4fa95e..eff63176110d 100644
--- a/dom/bindings/test/TestCodeGen.webidl
+++ b/dom/bindings/test/TestCodeGen.webidl
@@ -110,7 +110,8 @@ interface OnlyForUseInConstructor {
NamedConstructor=Test,
NamedConstructor=Test(DOMString str),
NamedConstructor=Test2(DictForConstructor dict, any any1, object obj1,
- object? obj2, sequence seq, optional any any2,
+ object? obj2, sequence seq,
+ optional any any2 = null,
optional object obj3, optional object? obj4)
]
interface TestInterface {
@@ -428,7 +429,6 @@ interface TestInterface {
// Any types
void passAny(any arg);
void passVariadicAny(any... arg);
- void passOptionalAny(optional any arg);
void passAnyDefaultNull(optional any arg = null);
void passSequenceOfAny(sequence arg);
void passNullableSequenceOfAny(sequence? arg);
diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl
index e49670215b2a..2b80d165d8eb 100644
--- a/dom/bindings/test/TestExampleGen.webidl
+++ b/dom/bindings/test/TestExampleGen.webidl
@@ -12,7 +12,8 @@
NamedConstructor=Example,
NamedConstructor=Example(DOMString str),
NamedConstructor=Example2(DictForConstructor dict, any any1, object obj1,
- object? obj2, sequence seq, optional any any2,
+ object? obj2, sequence seq,
+ optional any any2 = null,
optional object obj3, optional object? obj4)
]
interface TestExampleInterface {
@@ -321,7 +322,6 @@ interface TestExampleInterface {
// Any types
void passAny(any arg);
void passVariadicAny(any... arg);
- void passOptionalAny(optional any arg);
void passAnyDefaultNull(optional any arg = null);
void passSequenceOfAny(sequence arg);
void passNullableSequenceOfAny(sequence? arg);
diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl
index ed65db50cfa6..e59dd88163ac 100644
--- a/dom/bindings/test/TestJSImplGen.webidl
+++ b/dom/bindings/test/TestJSImplGen.webidl
@@ -23,7 +23,7 @@ enum MyTestEnum {
TestInterface? iface, long arg1,
DictForConstructor dict, any any1,
object obj1,
- object? obj2, sequence seq, optional any any2,
+ object? obj2, sequence seq, optional any any2 = null,
optional object obj3,
optional object? obj4),
JSImplementation="@mozilla.org/test-js-impl-interface;1"]
@@ -344,7 +344,6 @@ interface TestJSImplInterface {
// Any types
void passAny(any arg);
void passVariadicAny(any... arg);
- void passOptionalAny(optional any arg);
void passAnyDefaultNull(optional any arg = null);
void passSequenceOfAny(sequence arg);
void passNullableSequenceOfAny(sequence? arg);
diff --git a/dom/events/nsDOMMessageEvent.cpp b/dom/events/nsDOMMessageEvent.cpp
index cde017ea5359..76eac5fc5340 100644
--- a/dom/events/nsDOMMessageEvent.cpp
+++ b/dom/events/nsDOMMessageEvent.cpp
@@ -130,9 +130,7 @@ nsDOMMessageEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
bool trusted = event->Init(t);
event->SetTrusted(trusted);
- if (aParam.mData.WasPassed()) {
- event->mData = aParam.mData.Value();
- }
+ event->mData = aParam.mData;
mozilla::HoldJSObjects(event.get());
diff --git a/dom/imptests/html/dom/test_interfaces.html b/dom/imptests/html/dom/test_interfaces.html
index 2bc96ed11b83..576ade3025c9 100644
--- a/dom/imptests/html/dom/test_interfaces.html
+++ b/dom/imptests/html/dom/test_interfaces.html
@@ -79,7 +79,7 @@ dictionary EventInit {
interface CustomEvent : Event {
readonly attribute any detail;
- void initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, any details);
+ void initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, optional any details);
};
dictionary CustomEventInit : EventInit {
diff --git a/dom/indexedDB/IDBCursor.cpp b/dom/indexedDB/IDBCursor.cpp
index 31bfb32680ec..28dce0668398 100644
--- a/dom/indexedDB/IDBCursor.cpp
+++ b/dom/indexedDB/IDBCursor.cpp
@@ -697,16 +697,14 @@ IDBCursor::GetValue(JSContext* aCx, ErrorResult& aRv)
void
IDBCursor::Continue(JSContext* aCx,
- const Optional >& aKey,
+ JS::Handle aKey,
ErrorResult &aRv)
{
MOZ_ASSERT(NS_IsMainThread());
Key key;
- if (aKey.WasPassed()) {
- aRv = key.SetFromJSVal(aCx, aKey.Value());
- ENSURE_SUCCESS_VOID(aRv);
- }
+ aRv = key.SetFromJSVal(aCx, aKey);
+ ENSURE_SUCCESS_VOID(aRv);
if (!key.IsUnset()) {
switch (mDirection) {
@@ -809,9 +807,7 @@ IDBCursor::Update(JSContext* aCx, JS::Handle aValue,
return nullptr;
}
- JS::Rooted value(aCx, aValue);
- Optional > keyValue(aCx);
- request = mObjectStore->Put(aCx, value, keyValue, aRv);
+ request = mObjectStore->Put(aCx, aValue, JS::UndefinedHandleValue, aRv);
if (aRv.Failed()) {
return nullptr;
}
@@ -821,9 +817,7 @@ IDBCursor::Update(JSContext* aCx, JS::Handle aValue,
aRv = objectKey.ToJSVal(aCx, &keyVal);
ENSURE_SUCCESS(aRv, nullptr);
- JS::Rooted value(aCx, aValue);
- Optional > keyValue(aCx, keyVal);
- request = mObjectStore->Put(aCx, value, keyValue, aRv);
+ request = mObjectStore->Put(aCx, aValue, keyVal, aRv);
if (aRv.Failed()) {
return nullptr;
}
diff --git a/dom/indexedDB/IDBCursor.h b/dom/indexedDB/IDBCursor.h
index b23417db883e..1f17d27de107 100644
--- a/dom/indexedDB/IDBCursor.h
+++ b/dom/indexedDB/IDBCursor.h
@@ -197,8 +197,7 @@ public:
Advance(uint32_t aCount, ErrorResult& aRv);
void
- Continue(JSContext* aCx, const Optional >& aKey,
- ErrorResult& aRv);
+ Continue(JSContext* aCx, JS::Handle aKey, ErrorResult& aRv);
already_AddRefed
Delete(JSContext* aCx, ErrorResult& aRv);
diff --git a/dom/indexedDB/IDBIndex.cpp b/dom/indexedDB/IDBIndex.cpp
index 0101a4edd9e5..1b610e524881 100644
--- a/dom/indexedDB/IDBIndex.cpp
+++ b/dom/indexedDB/IDBIndex.cpp
@@ -896,7 +896,7 @@ IDBIndex::GetKey(JSContext* aCx, JS::Handle aKey, ErrorResult& aRv)
}
already_AddRefed
-IDBIndex::GetAll(JSContext* aCx, const Optional >& aKey,
+IDBIndex::GetAll(JSContext* aCx, JS::Handle aKey,
const Optional& aLimit, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@@ -908,10 +908,8 @@ IDBIndex::GetAll(JSContext* aCx, const Optional >& aKey,
}
nsRefPtr keyRange;
- if (aKey.WasPassed()) {
- aRv = IDBKeyRange::FromJSVal(aCx, aKey.Value(), getter_AddRefs(keyRange));
- ENSURE_SUCCESS(aRv, nullptr);
- }
+ aRv = IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange));
+ ENSURE_SUCCESS(aRv, nullptr);
uint32_t limit = UINT32_MAX;
if (aLimit.WasPassed() && aLimit.Value() > 0) {
@@ -923,7 +921,7 @@ IDBIndex::GetAll(JSContext* aCx, const Optional >& aKey,
already_AddRefed
IDBIndex::GetAllKeys(JSContext* aCx,
- const Optional >& aKey,
+ JS::Handle aKey,
const Optional& aLimit, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@@ -935,10 +933,8 @@ IDBIndex::GetAllKeys(JSContext* aCx,
}
nsRefPtr keyRange;
- if (aKey.WasPassed()) {
- aRv = IDBKeyRange::FromJSVal(aCx, aKey.Value(), getter_AddRefs(keyRange));
- ENSURE_SUCCESS(aRv, nullptr);
- }
+ aRv = IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange));
+ ENSURE_SUCCESS(aRv, nullptr);
uint32_t limit = UINT32_MAX;
if (aLimit.WasPassed() && aLimit.Value() > 0) {
@@ -950,7 +946,7 @@ IDBIndex::GetAllKeys(JSContext* aCx,
already_AddRefed
IDBIndex::OpenCursor(JSContext* aCx,
- const Optional >& aRange,
+ JS::Handle aRange,
IDBCursorDirection aDirection, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@@ -962,10 +958,8 @@ IDBIndex::OpenCursor(JSContext* aCx,
}
nsRefPtr keyRange;
- if (aRange.WasPassed()) {
- aRv = IDBKeyRange::FromJSVal(aCx, aRange.Value(), getter_AddRefs(keyRange));
- ENSURE_SUCCESS(aRv, nullptr);
- }
+ aRv = IDBKeyRange::FromJSVal(aCx, aRange, getter_AddRefs(keyRange));
+ ENSURE_SUCCESS(aRv, nullptr);
IDBCursor::Direction direction = IDBCursor::ConvertDirection(aDirection);
@@ -991,7 +985,7 @@ IDBIndex::OpenCursor(JSContext* aCx,
already_AddRefed
IDBIndex::OpenKeyCursor(JSContext* aCx,
- const Optional >& aRange,
+ JS::Handle aRange,
IDBCursorDirection aDirection, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@@ -1003,10 +997,8 @@ IDBIndex::OpenKeyCursor(JSContext* aCx,
}
nsRefPtr keyRange;
- if (aRange.WasPassed()) {
- aRv = IDBKeyRange::FromJSVal(aCx, aRange.Value(), getter_AddRefs(keyRange));
- ENSURE_SUCCESS(aRv, nullptr);
- }
+ aRv = IDBKeyRange::FromJSVal(aCx, aRange, getter_AddRefs(keyRange));
+ ENSURE_SUCCESS(aRv, nullptr);
IDBCursor::Direction direction = IDBCursor::ConvertDirection(aDirection);
@@ -1014,7 +1006,7 @@ IDBIndex::OpenKeyCursor(JSContext* aCx,
}
already_AddRefed
-IDBIndex::Count(JSContext* aCx, const Optional >& aKey,
+IDBIndex::Count(JSContext* aCx, JS::Handle aKey,
ErrorResult& aRv)
{
IDBTransaction* transaction = mObjectStore->Transaction();
@@ -1024,10 +1016,8 @@ IDBIndex::Count(JSContext* aCx, const Optional >& aKey,
}
nsRefPtr keyRange;
- if (aKey.WasPassed()) {
- aRv = IDBKeyRange::FromJSVal(aCx, aKey.Value(), getter_AddRefs(keyRange));
- ENSURE_SUCCESS(aRv, nullptr);
- }
+ aRv = IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange));
+ ENSURE_SUCCESS(aRv, nullptr);
return CountInternal(keyRange, aRv);
}
diff --git a/dom/indexedDB/IDBIndex.h b/dom/indexedDB/IDBIndex.h
index 7cd28c66b2e1..6ab82147d8b4 100644
--- a/dom/indexedDB/IDBIndex.h
+++ b/dom/indexedDB/IDBIndex.h
@@ -194,11 +194,11 @@ public:
}
already_AddRefed
- OpenCursor(JSContext* aCx, const Optional >& aRange,
+ OpenCursor(JSContext* aCx, JS::Handle aRange,
IDBCursorDirection aDirection, ErrorResult& aRv);
already_AddRefed
- OpenKeyCursor(JSContext* aCx, const Optional >& aRange,
+ OpenKeyCursor(JSContext* aCx, JS::Handle aRange,
IDBCursorDirection aDirection, ErrorResult& aRv);
already_AddRefed
@@ -208,7 +208,7 @@ public:
GetKey(JSContext* aCx, JS::Handle aKey, ErrorResult& aRv);
already_AddRefed
- Count(JSContext* aCx, const Optional >& aKey,
+ Count(JSContext* aCx, JS::Handle aKey,
ErrorResult& aRv);
void
@@ -219,11 +219,11 @@ public:
}
already_AddRefed
- GetAll(JSContext* aCx, const Optional >& aKey,
+ GetAll(JSContext* aCx, JS::Handle aKey,
const Optional& aLimit, ErrorResult& aRv);
already_AddRefed
- GetAllKeys(JSContext* aCx, const Optional >& aKey,
+ GetAllKeys(JSContext* aCx, JS::Handle aKey,
const Optional& aLimit, ErrorResult& aRv);
private:
diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp
index a88252c2b0d2..0c55426ecc4a 100644
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -1907,7 +1907,7 @@ IDBObjectStore::GetAddInfo(JSContext* aCx,
already_AddRefed
IDBObjectStore::AddOrPut(JSContext* aCx, JS::Handle aValue,
- const Optional >& aKey,
+ JS::Handle aKey,
bool aOverwrite, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@@ -1922,15 +1922,12 @@ IDBObjectStore::AddOrPut(JSContext* aCx, JS::Handle aValue,
return nullptr;
}
- JS::Rooted keyval(aCx, aKey.WasPassed() ? aKey.Value()
- : JSVAL_VOID);
-
StructuredCloneWriteInfo cloneWriteInfo;
Key key;
nsTArray updateInfo;
JS::Rooted value(aCx, aValue);
- aRv = GetAddInfo(aCx, value, keyval, cloneWriteInfo, key, updateInfo);
+ aRv = GetAddInfo(aCx, value, aKey, cloneWriteInfo, key, updateInfo);
if (aRv.Failed()) {
return nullptr;
}
@@ -2700,7 +2697,7 @@ IDBObjectStore::Get(JSContext* aCx, JS::Handle aKey,
already_AddRefed
IDBObjectStore::GetAll(JSContext* aCx,
- const Optional >& aKey,
+ JS::Handle aKey,
const Optional& aLimit, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@@ -2711,10 +2708,8 @@ IDBObjectStore::GetAll(JSContext* aCx,
}
nsRefPtr keyRange;
- if (aKey.WasPassed()) {
- aRv = IDBKeyRange::FromJSVal(aCx, aKey.Value(), getter_AddRefs(keyRange));
- ENSURE_SUCCESS(aRv, nullptr);
- }
+ aRv = IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange));
+ ENSURE_SUCCESS(aRv, nullptr);
uint32_t limit = UINT32_MAX;
if (aLimit.WasPassed() && aLimit.Value() != 0) {
@@ -2755,7 +2750,7 @@ IDBObjectStore::Delete(JSContext* aCx, JS::Handle aKey,
already_AddRefed
IDBObjectStore::OpenCursor(JSContext* aCx,
- const Optional >& aRange,
+ JS::Handle aRange,
IDBCursorDirection aDirection, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@@ -2766,10 +2761,8 @@ IDBObjectStore::OpenCursor(JSContext* aCx,
}
nsRefPtr keyRange;
- if (aRange.WasPassed()) {
- aRv = IDBKeyRange::FromJSVal(aCx, aRange.Value(), getter_AddRefs(keyRange));
- ENSURE_SUCCESS(aRv, nullptr);
- }
+ aRv = IDBKeyRange::FromJSVal(aCx, aRange, getter_AddRefs(keyRange));
+ ENSURE_SUCCESS(aRv, nullptr);
IDBCursor::Direction direction = IDBCursor::ConvertDirection(aDirection);
size_t argDirection = static_cast(direction);
@@ -2941,7 +2934,7 @@ IDBObjectStore::DeleteIndex(const nsAString& aName, ErrorResult& aRv)
already_AddRefed
IDBObjectStore::Count(JSContext* aCx,
- const Optional >& aKey,
+ JS::Handle aKey,
ErrorResult& aRv)
{
if (!mTransaction->IsOpen()) {
@@ -2950,17 +2943,15 @@ IDBObjectStore::Count(JSContext* aCx,
}
nsRefPtr keyRange;
- if (aKey.WasPassed()) {
- aRv = IDBKeyRange::FromJSVal(aCx, aKey.Value(), getter_AddRefs(keyRange));
- ENSURE_SUCCESS(aRv, nullptr);
- }
+ aRv = IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange));
+ ENSURE_SUCCESS(aRv, nullptr);
return CountInternal(keyRange, aRv);
}
already_AddRefed
IDBObjectStore::GetAllKeys(JSContext* aCx,
- const Optional>& aKey,
+ JS::Handle aKey,
const Optional& aLimit, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
@@ -2971,10 +2962,8 @@ IDBObjectStore::GetAllKeys(JSContext* aCx,
}
nsRefPtr keyRange;
- if (aKey.WasPassed()) {
- aRv = IDBKeyRange::FromJSVal(aCx, aKey.Value(), getter_AddRefs(keyRange));
- ENSURE_SUCCESS(aRv, nullptr);
- }
+ aRv = IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange));
+ ENSURE_SUCCESS(aRv, nullptr);
uint32_t limit = UINT32_MAX;
if (aLimit.WasPassed() && aLimit.Value() != 0) {
@@ -2986,7 +2975,7 @@ IDBObjectStore::GetAllKeys(JSContext* aCx,
already_AddRefed
IDBObjectStore::OpenKeyCursor(JSContext* aCx,
- const Optional>& aRange,
+ JS::Handle aRange,
IDBCursorDirection aDirection, ErrorResult& aRv)
{
MOZ_ASSERT(NS_IsMainThread());
@@ -2997,10 +2986,8 @@ IDBObjectStore::OpenKeyCursor(JSContext* aCx,
}
nsRefPtr keyRange;
- if (aRange.WasPassed()) {
- aRv = IDBKeyRange::FromJSVal(aCx, aRange.Value(), getter_AddRefs(keyRange));
- ENSURE_SUCCESS(aRv, nullptr);
- }
+ aRv = IDBKeyRange::FromJSVal(aCx, aRange, getter_AddRefs(keyRange));
+ ENSURE_SUCCESS(aRv, nullptr);
IDBCursor::Direction direction = IDBCursor::ConvertDirection(aDirection);
diff --git a/dom/indexedDB/IDBObjectStore.h b/dom/indexedDB/IDBObjectStore.h
index 6936f44b9bbb..f0973a7d8809 100644
--- a/dom/indexedDB/IDBObjectStore.h
+++ b/dom/indexedDB/IDBObjectStore.h
@@ -304,7 +304,7 @@ public:
already_AddRefed
Put(JSContext* aCx, JS::Handle aValue,
- const Optional >& aKey, ErrorResult& aRv)
+ JS::Handle aKey, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
return AddOrPut(aCx, aValue, aKey, true, aRv);
@@ -312,7 +312,7 @@ public:
already_AddRefed
Add(JSContext* aCx, JS::Handle aValue,
- const Optional >& aKey, ErrorResult& aRv)
+ JS::Handle aKey, ErrorResult& aRv)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
return AddOrPut(aCx, aValue, aKey, false, aRv);
@@ -328,7 +328,7 @@ public:
Clear(ErrorResult& aRv);
already_AddRefed
- OpenCursor(JSContext* aCx, const Optional >& aRange,
+ OpenCursor(JSContext* aCx, JS::Handle aRange,
IDBCursorDirection aDirection, ErrorResult& aRv);
already_AddRefed
@@ -347,19 +347,19 @@ public:
DeleteIndex(const nsAString& aIndexName, ErrorResult& aRv);
already_AddRefed
- Count(JSContext* aCx, const Optional >& aKey,
+ Count(JSContext* aCx, JS::Handle aKey,
ErrorResult& aRv);
already_AddRefed
- GetAll(JSContext* aCx, const Optional >& aKey,
+ GetAll(JSContext* aCx, JS::Handle aKey,
const Optional& aLimit, ErrorResult& aRv);
already_AddRefed
- GetAllKeys(JSContext* aCx, const Optional>& aKey,
+ GetAllKeys(JSContext* aCx, JS::Handle aKey,
const Optional& aLimit, ErrorResult& aRv);
already_AddRefed
- OpenKeyCursor(JSContext* aCx, const Optional>& aRange,
+ OpenKeyCursor(JSContext* aCx, JS::Handle aRange,
IDBCursorDirection aDirection, ErrorResult& aRv);
protected:
@@ -375,7 +375,7 @@ protected:
already_AddRefed
AddOrPut(JSContext* aCx, JS::Handle aValue,
- const Optional >& aKey, bool aOverwrite,
+ JS::Handle aKey, bool aOverwrite,
ErrorResult& aRv);
already_AddRefed
diff --git a/dom/promise/Promise.cpp b/dom/promise/Promise.cpp
index 056b4d3667a8..b49998831f59 100644
--- a/dom/promise/Promise.cpp
+++ b/dom/promise/Promise.cpp
@@ -500,13 +500,11 @@ Promise::Constructor(const GlobalObject& aGlobal,
/* static */ already_AddRefed
Promise::Resolve(const GlobalObject& aGlobal, JSContext* aCx,
- const Optional>& aValue, ErrorResult& aRv)
+ JS::Handle aValue, ErrorResult& aRv)
{
// If a Promise was passed, just return it.
- JS::Rooted value(aCx, aValue.WasPassed() ? aValue.Value() :
- JS::UndefinedValue());
- if (value.isObject()) {
- JS::Rooted valueObj(aCx, &value.toObject());
+ if (aValue.isObject()) {
+ JS::Rooted valueObj(aCx, &aValue.toObject());
Promise* nextPromise;
nsresult rv = UNWRAP_OBJECT(Promise, valueObj, nextPromise);
@@ -525,7 +523,7 @@ Promise::Resolve(const GlobalObject& aGlobal, JSContext* aCx,
}
}
- return Resolve(window, aCx, value, aRv);
+ return Resolve(window, aCx, aValue, aRv);
}
/* static */ already_AddRefed
@@ -541,7 +539,7 @@ Promise::Resolve(nsPIDOMWindow* aWindow, JSContext* aCx,
/* static */ already_AddRefed
Promise::Reject(const GlobalObject& aGlobal, JSContext* aCx,
- const Optional>& aValue, ErrorResult& aRv)
+ JS::Handle aValue, ErrorResult& aRv)
{
nsCOMPtr window;
if (MOZ_LIKELY(NS_IsMainThread())) {
@@ -552,9 +550,7 @@ Promise::Reject(const GlobalObject& aGlobal, JSContext* aCx,
}
}
- return Reject(window, aCx,
- aValue.WasPassed() ? aValue.Value() : JS::UndefinedHandleValue,
- aRv);
+ return Reject(window, aCx, aValue, aRv);
}
/* static */ already_AddRefed
@@ -736,8 +732,8 @@ Promise::All(const GlobalObject& aGlobal, JSContext* aCx,
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;
}
- Optional> optValue(aCx, JS::ObjectValue(*empty));
- return Promise::Resolve(aGlobal, aCx, optValue, aRv);
+ JS::Rooted value(aCx, JS::ObjectValue(*empty));
+ return Promise::Resolve(aGlobal, aCx, value, aRv);
}
nsRefPtr promise = new Promise(window);
@@ -747,8 +743,8 @@ Promise::All(const GlobalObject& aGlobal, JSContext* aCx,
nsRefPtr rejectCb = new RejectPromiseCallback(promise);
for (uint32_t i = 0; i < aIterable.Length(); ++i) {
- Optional> optValue(aCx, aIterable.ElementAt(i));
- nsRefPtr nextPromise = Promise::Resolve(aGlobal, aCx, optValue, aRv);
+ JS::Rooted value(aCx, aIterable.ElementAt(i));
+ nsRefPtr nextPromise = Promise::Resolve(aGlobal, aCx, value, aRv);
MOZ_ASSERT(!aRv.Failed());
@@ -783,8 +779,8 @@ Promise::Race(const GlobalObject& aGlobal, JSContext* aCx,
nsRefPtr rejectCb = new RejectPromiseCallback(promise);
for (uint32_t i = 0; i < aIterable.Length(); ++i) {
- Optional> optValue(aCx, aIterable.ElementAt(i));
- nsRefPtr nextPromise = Promise::Resolve(aGlobal, aCx, optValue, aRv);
+ JS::Rooted value(aCx, aIterable.ElementAt(i));
+ nsRefPtr nextPromise = Promise::Resolve(aGlobal, aCx, value, aRv);
// According to spec, Resolve can throw, but our implementation never does.
// Well it does when window isn't passed on the main thread, but that is an
// implementation detail which should never be reached since we are checking
diff --git a/dom/promise/Promise.h b/dom/promise/Promise.h
index 28959dc5ca00..9da9872554c5 100644
--- a/dom/promise/Promise.h
+++ b/dom/promise/Promise.h
@@ -66,7 +66,7 @@ public:
static already_AddRefed
Resolve(const GlobalObject& aGlobal, JSContext* aCx,
- const Optional>& aValue, ErrorResult& aRv);
+ JS::Handle aValue, ErrorResult& aRv);
static already_AddRefed
Resolve(nsPIDOMWindow* aWindow, JSContext* aCx,
@@ -74,7 +74,7 @@ public:
static already_AddRefed
Reject(const GlobalObject& aGlobal, JSContext* aCx,
- const Optional>& aValue, ErrorResult& aRv);
+ JS::Handle aValue, ErrorResult& aRv);
static already_AddRefed
Reject(nsPIDOMWindow* aWindow, JSContext* aCx,
diff --git a/dom/webidl/HTMLCanvasElement.webidl b/dom/webidl/HTMLCanvasElement.webidl
index 408fd6e34437..95b2245b96bf 100644
--- a/dom/webidl/HTMLCanvasElement.webidl
+++ b/dom/webidl/HTMLCanvasElement.webidl
@@ -26,11 +26,11 @@ interface HTMLCanvasElement : HTMLElement {
[Throws]
DOMString toDataURL(optional DOMString type = "",
- optional any encoderOptions);
+ any encoderOptions);
[Throws]
void toBlob(FileCallback _callback,
optional DOMString type = "",
- optional any encoderOptions);
+ any encoderOptions);
};
// Mozilla specific bits
diff --git a/dom/webidl/IDBCursor.webidl b/dom/webidl/IDBCursor.webidl
index 6279953393e4..883402df7123 100644
--- a/dom/webidl/IDBCursor.webidl
+++ b/dom/webidl/IDBCursor.webidl
@@ -32,7 +32,7 @@ interface IDBCursor {
void advance ([EnforceRange] unsigned long count);
[Throws]
- void continue (optional any key);
+ void continue (any key);
[Throws]
IDBRequest delete ();
diff --git a/dom/webidl/IDBIndex.webidl b/dom/webidl/IDBIndex.webidl
index 334cc2e66fd3..e828bc217846 100644
--- a/dom/webidl/IDBIndex.webidl
+++ b/dom/webidl/IDBIndex.webidl
@@ -23,10 +23,10 @@ interface IDBIndex {
readonly attribute boolean unique;
[Throws]
- IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next");
+ IDBRequest openCursor (any range, optional IDBCursorDirection direction = "next");
[Throws]
- IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next");
+ IDBRequest openKeyCursor (any range, optional IDBCursorDirection direction = "next");
[Throws]
IDBRequest get (any key);
@@ -35,15 +35,15 @@ interface IDBIndex {
IDBRequest getKey (any key);
[Throws]
- IDBRequest count (optional any key);
+ IDBRequest count (any key);
};
partial interface IDBIndex {
readonly attribute DOMString storeName;
[Throws]
- IDBRequest mozGetAll (optional any key, optional unsigned long limit);
+ IDBRequest mozGetAll (any key, optional unsigned long limit);
[Throws]
- IDBRequest mozGetAllKeys (optional any key, optional unsigned long limit);
+ IDBRequest mozGetAllKeys (any key, optional unsigned long limit);
};
diff --git a/dom/webidl/IDBObjectStore.webidl b/dom/webidl/IDBObjectStore.webidl
index d364ea340bc4..8b3a6cbd12b9 100644
--- a/dom/webidl/IDBObjectStore.webidl
+++ b/dom/webidl/IDBObjectStore.webidl
@@ -25,10 +25,10 @@ interface IDBObjectStore {
readonly attribute boolean autoIncrement;
[Throws]
- IDBRequest put (any value, optional any key);
+ IDBRequest put (any value, any key);
[Throws]
- IDBRequest add (any value, optional any key);
+ IDBRequest add (any value, any key);
[Throws]
IDBRequest delete (any key);
@@ -40,7 +40,7 @@ interface IDBObjectStore {
IDBRequest clear ();
[Throws]
- IDBRequest openCursor (optional any range, optional IDBCursorDirection direction = "next");
+ IDBRequest openCursor (any range, optional IDBCursorDirection direction = "next");
// Bug 899972
// IDBIndex createIndex (DOMString name, (DOMString or sequence) keyPath, optional IDBIndexParameters optionalParameters);
@@ -58,20 +58,20 @@ interface IDBObjectStore {
void deleteIndex (DOMString indexName);
[Throws]
- IDBRequest count (optional any key);
+ IDBRequest count (any key);
};
partial interface IDBObjectStore {
// Success fires IDBTransactionEvent, result == array of values for given keys
[Throws]
- IDBRequest mozGetAll (optional any key, optional unsigned long limit);
+ IDBRequest mozGetAll (any key, optional unsigned long limit);
[Pref="dom.indexedDB.experimental", Throws]
- IDBRequest getAll (optional any key, optional unsigned long limit);
+ IDBRequest getAll (any key, optional unsigned long limit);
[Pref="dom.indexedDB.experimental", Throws]
- IDBRequest getAllKeys (optional any key, optional unsigned long limit);
+ IDBRequest getAllKeys (any key, optional unsigned long limit);
[Pref="dom.indexedDB.experimental", Throws]
- IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next");
+ IDBRequest openKeyCursor (any range, optional IDBCursorDirection direction = "next");
};
diff --git a/dom/webidl/Promise.webidl b/dom/webidl/Promise.webidl
index f106b6eda3fb..21e00ae3b415 100644
--- a/dom/webidl/Promise.webidl
+++ b/dom/webidl/Promise.webidl
@@ -26,9 +26,9 @@ interface Promise {
// Promise object in this scope without having resolved the interface object
// first.
[NewObject, Throws]
- static Promise resolve(optional any value);
+ static Promise resolve(any value);
[NewObject, Throws]
- static Promise reject(optional any value);
+ static Promise reject(any value);
// The [TreatNonCallableAsNull] annotation is required since then() should do
// nothing instead of throwing errors when non-callable arguments are passed.
diff --git a/dom/webidl/RTCStatsReport.webidl b/dom/webidl/RTCStatsReport.webidl
index 053dde32e01e..a0479684ce03 100644
--- a/dom/webidl/RTCStatsReport.webidl
+++ b/dom/webidl/RTCStatsReport.webidl
@@ -146,7 +146,7 @@ dictionary RTCStatsReportInternal {
interface RTCStatsReport {
[ChromeOnly]
readonly attribute DOMString mozPcid;
- void forEach(RTCStatsReportCallback callbackFn, optional any thisArg);
+ void forEach(RTCStatsReportCallback callbackFn, any thisArg);
object get(DOMString key);
boolean has(DOMString key);
};
diff --git a/dom/webidl/TestInterfaceJS.webidl b/dom/webidl/TestInterfaceJS.webidl
index e9e5e2cb9e59..ff5049c22d5a 100644
--- a/dom/webidl/TestInterfaceJS.webidl
+++ b/dom/webidl/TestInterfaceJS.webidl
@@ -6,7 +6,7 @@
[JSImplementation="@mozilla.org/dom/test-interface-js;1",
Pref="dom.expose_test_interfaces",
- Constructor(optional any anyArg, optional object objectArg)]
+ Constructor(any anyArg, optional object objectArg)]
interface TestInterfaceJS {
readonly attribute any anyArg;
readonly attribute object objectArg;
diff --git a/dom/webidl/Window.webidl b/dom/webidl/Window.webidl
index 41904d0e4b30..f061bc2fd50c 100644
--- a/dom/webidl/Window.webidl
+++ b/dom/webidl/Window.webidl
@@ -74,7 +74,7 @@ typedef any Transferable;
[Throws] DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
[Throws] void print();
//[Throws] any showModalDialog(DOMString url, optional any argument);
- [Throws] any showModalDialog(DOMString url, optional any argument, optional DOMString options = "");
+ [Throws] any showModalDialog(DOMString url, any argument, optional DOMString options = "");
[Throws, CrossOriginCallable] void postMessage(any message, DOMString targetOrigin, optional sequence transfer);
diff --git a/dom/webidl/WorkerConsole.webidl b/dom/webidl/WorkerConsole.webidl
index 0b517cb197ed..0234d0df9ecf 100644
--- a/dom/webidl/WorkerConsole.webidl
+++ b/dom/webidl/WorkerConsole.webidl
@@ -12,12 +12,12 @@ interface WorkerConsole {
void _exception(any... data);
void debug(any... data);
void trace();
- void dir(optional any data);
+ void dir(any data);
void group(any... data);
void groupCollapsed(any... data);
void groupEnd(any... data);
- void time(optional any time);
- void timeEnd(optional any time);
+ void time(any time);
+ void timeEnd(any time);
void profile(any... data);
void profileEnd(any... data);
void assert(boolean condition, any... data);
diff --git a/dom/workers/Console.cpp b/dom/workers/Console.cpp
index 014c8dc5c397..2412e19a88d5 100644
--- a/dom/workers/Console.cpp
+++ b/dom/workers/Console.cpp
@@ -492,14 +492,13 @@ WorkerConsole::Trace(JSContext* aCx)
}
void
-WorkerConsole::Dir(JSContext* aCx,
- const Optional>& aValue)
+WorkerConsole::Dir(JSContext* aCx, JS::Handle aValue)
{
Sequence data;
SequenceRooter rooter(aCx, &data);
- if (aValue.WasPassed()) {
- data.AppendElement(aValue.Value());
+ if (!aValue.isUndefined()) {
+ data.AppendElement(aValue);
}
Method(aCx, "dir", data, 1);
@@ -510,14 +509,13 @@ METHOD(GroupCollapsed, "groupCollapsed")
METHOD(GroupEnd, "groupEnd")
void
-WorkerConsole::Time(JSContext* aCx,
- const Optional>& aTimer)
+WorkerConsole::Time(JSContext* aCx, JS::Handle aTimer)
{
Sequence data;
SequenceRooter rooter(aCx, &data);
- if (aTimer.WasPassed()) {
- data.AppendElement(aTimer.Value());
+ if (!aTimer.isUndefined()) {
+ data.AppendElement(aTimer);
}
Method(aCx, "time", data, 1);
@@ -525,13 +523,13 @@ WorkerConsole::Time(JSContext* aCx,
void
WorkerConsole::TimeEnd(JSContext* aCx,
- const Optional>& aTimer)
+ JS::Handle aTimer)
{
Sequence data;
SequenceRooter rooter(aCx, &data);
- if (aTimer.WasPassed()) {
- data.AppendElement(aTimer.Value());
+ if (!aTimer.isUndefined()) {
+ data.AppendElement(aTimer);
}
Method(aCx, "timeEnd", data, 1);
diff --git a/dom/workers/Console.h b/dom/workers/Console.h
index ade635caeaa8..cd4c75372fce 100644
--- a/dom/workers/Console.h
+++ b/dom/workers/Console.h
@@ -70,7 +70,7 @@ public:
Trace(JSContext* aCx);
void
- Dir(JSContext* aCx, const Optional>& aValue);
+ Dir(JSContext* aCx, JS::Handle aValue);
void
Group(JSContext* aCx, const Sequence& aData);
@@ -82,10 +82,10 @@ public:
GroupEnd(JSContext* aCx, const Sequence& aData);
void
- Time(JSContext* aCx, const Optional>& aTimer);
+ Time(JSContext* aCx, JS::Handle aTimer);
void
- TimeEnd(JSContext* aCx, const Optional>& aTimer);
+ TimeEnd(JSContext* aCx, JS::Handle aTimer);
void
Profile(JSContext* aCx, const Sequence& aData);