mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 869073 - make WebIDL enums enum classes instead of plain enums; r=bz
This commit is contained in:
parent
1ba7849d22
commit
9fd3f3a56a
@ -2028,7 +2028,7 @@ public:
|
||||
}
|
||||
bool Hidden() const
|
||||
{
|
||||
return mVisibilityState != mozilla::dom::VisibilityStateValues::Visible;
|
||||
return mVisibilityState != mozilla::dom::VisibilityState::Visible;
|
||||
}
|
||||
bool MozHidden() // Not const because of WarnOnceAbout
|
||||
{
|
||||
|
@ -453,7 +453,7 @@ WebSocket::WebSocket()
|
||||
mCloseEventCode(nsIWebSocketChannel::CLOSE_ABNORMAL),
|
||||
mReadyState(WebSocket::CONNECTING),
|
||||
mOutgoingBufferedAmount(0),
|
||||
mBinaryType(BinaryTypeValues::Blob),
|
||||
mBinaryType(dom::BinaryType::Blob),
|
||||
mScriptLine(0),
|
||||
mInnerWindowID(0)
|
||||
{
|
||||
@ -888,10 +888,10 @@ WebSocket::CreateAndDispatchMessageEvent(const nsACString& aData,
|
||||
{
|
||||
JSAutoRequest ar(cx);
|
||||
if (isBinary) {
|
||||
if (mBinaryType == BinaryTypeValues::Blob) {
|
||||
if (mBinaryType == dom::BinaryType::Blob) {
|
||||
rv = nsContentUtils::CreateBlobBuffer(cx, aData, jsData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else if (mBinaryType == BinaryTypeValues::Arraybuffer) {
|
||||
} else if (mBinaryType == dom::BinaryType::Arraybuffer) {
|
||||
JSObject* arrayBuf;
|
||||
rv = nsContentUtils::CreateArrayBuffer(cx, aData, &arrayBuf);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -192,14 +192,14 @@ nsDOMMultipartFile::InitBlob(JSContext* aCx,
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
}
|
||||
mContentType = d.mType;
|
||||
nativeEOL = d.mEndings == EndingTypesValues::Native;
|
||||
nativeEOL = d.mEndings == EndingTypes::Native;
|
||||
} else {
|
||||
BlobPropertyBagWorkers d;
|
||||
if (!d.Init(aCx, JS::Handle<JS::Value>::fromMarkedLocation(&aArgv[1]))) {
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
}
|
||||
mContentType = d.mType;
|
||||
nativeEOL = d.mEndings == EndingTypesValues::Native;
|
||||
nativeEOL = d.mEndings == EndingTypes::Native;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,13 +41,19 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(nsDOMParser, mOwner)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMParser)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMParser)
|
||||
|
||||
static const char*
|
||||
StringFromSupportedType(SupportedType aType)
|
||||
{
|
||||
return SupportedTypeValues::strings[static_cast<int>(aType)].value;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDocument>
|
||||
nsDOMParser::ParseFromString(const nsAString& aStr, SupportedType aType,
|
||||
ErrorResult& rv)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
rv = ParseFromString(aStr,
|
||||
SupportedTypeValues::strings[aType].value,
|
||||
StringFromSupportedType(aType),
|
||||
getter_AddRefs(domDocument));
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
|
||||
return document.forget();
|
||||
@ -121,7 +127,7 @@ nsDOMParser::ParseFromBuffer(const Sequence<uint8_t>& aBuf, uint32_t aBufLen,
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
rv = nsDOMParser::ParseFromBuffer(aBuf.Elements(), aBufLen,
|
||||
SupportedTypeValues::strings[aType].value,
|
||||
StringFromSupportedType(aType),
|
||||
getter_AddRefs(domDocument));
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
|
||||
return document.forget();
|
||||
@ -137,7 +143,7 @@ nsDOMParser::ParseFromBuffer(const Uint8Array& aBuf, uint32_t aBufLen,
|
||||
}
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
rv = nsDOMParser::ParseFromBuffer(aBuf.Data(), aBufLen,
|
||||
SupportedTypeValues::strings[aType].value,
|
||||
StringFromSupportedType(aType),
|
||||
getter_AddRefs(domDocument));
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
|
||||
return document.forget();
|
||||
@ -175,7 +181,7 @@ nsDOMParser::ParseFromStream(nsIInputStream* aStream,
|
||||
rv = nsDOMParser::ParseFromStream(aStream,
|
||||
NS_ConvertUTF16toUTF8(aCharset).get(),
|
||||
aContentLength,
|
||||
SupportedTypeValues::strings[aType].value,
|
||||
StringFromSupportedType(aType),
|
||||
getter_AddRefs(domDocument));
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
|
||||
return document.forget();
|
||||
|
@ -1345,7 +1345,7 @@ nsIDocument::nsIDocument()
|
||||
mCharacterSet(NS_LITERAL_CSTRING("ISO-8859-1")),
|
||||
mNodeInfoManager(nullptr),
|
||||
mCompatMode(eCompatibility_FullStandards),
|
||||
mVisibilityState(VisibilityStateValues::Hidden),
|
||||
mVisibilityState(dom::VisibilityState::Hidden),
|
||||
mIsInitialDocumentInWindow(false),
|
||||
mMayStartLayout(true),
|
||||
mVisible(true),
|
||||
@ -10961,10 +10961,10 @@ nsDocument::GetVisibilityState() const
|
||||
// Otherwise, we're visible.
|
||||
if (!IsVisible() || !mWindow || !mWindow->GetOuterWindow() ||
|
||||
mWindow->GetOuterWindow()->IsBackground()) {
|
||||
return VisibilityStateValues::Hidden;
|
||||
return dom::VisibilityState::Hidden;
|
||||
}
|
||||
|
||||
return VisibilityStateValues::Visible;
|
||||
return dom::VisibilityState::Visible;
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
@ -10999,7 +10999,8 @@ nsDocument::GetMozVisibilityState(nsAString& aState)
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetVisibilityState(nsAString& aState)
|
||||
{
|
||||
const EnumEntry& entry = VisibilityStateValues::strings[mVisibilityState];
|
||||
const EnumEntry& entry =
|
||||
VisibilityStateValues::strings[static_cast<int>(mVisibilityState)];
|
||||
aState.AssignASCII(entry.value, entry.length);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -847,8 +847,8 @@ nsXMLHttpRequest::StaticAssertions()
|
||||
{
|
||||
#define ASSERT_ENUM_EQUAL(_lc, _uc) \
|
||||
MOZ_STATIC_ASSERT(\
|
||||
XMLHttpRequestResponseTypeValues::_lc \
|
||||
== XMLHttpRequestResponseType(XML_HTTP_RESPONSE_TYPE_ ## _uc), \
|
||||
static_cast<int>(XMLHttpRequestResponseType::_lc) \
|
||||
== XML_HTTP_RESPONSE_TYPE_ ## _uc, \
|
||||
#_uc " should match")
|
||||
|
||||
ASSERT_ENUM_EQUAL(_empty, DEFAULT);
|
||||
@ -899,7 +899,7 @@ void
|
||||
nsXMLHttpRequest::SetResponseType(XMLHttpRequestResponseType aType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
SetResponseType(ResponseTypeEnum(aType), aRv);
|
||||
SetResponseType(ResponseTypeEnum(static_cast<int>(aType)), aRv);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1872,7 +1872,7 @@ void
|
||||
CanvasRenderingContext2D::EnsureUserSpacePath(const CanvasWindingRule& winding)
|
||||
{
|
||||
FillRule fillRule = CurrentState().fillRule;
|
||||
if(winding == CanvasWindingRuleValues::Evenodd)
|
||||
if(winding == CanvasWindingRule::Evenodd)
|
||||
fillRule = FILL_EVEN_ODD;
|
||||
|
||||
if (!mPath && !mPathBuilder && !mDSPathBuilder) {
|
||||
|
@ -505,7 +505,7 @@ protected:
|
||||
void EnsureWritablePath();
|
||||
|
||||
// Ensures a path in UserSpace is available.
|
||||
void EnsureUserSpacePath(const CanvasWindingRule& winding = CanvasWindingRuleValues::Nonzero);
|
||||
void EnsureUserSpacePath(const CanvasWindingRule& winding = CanvasWindingRule::Nonzero);
|
||||
|
||||
/**
|
||||
* Needs to be called before updating the transform. This makes a call to
|
||||
|
@ -204,8 +204,8 @@ AudioNodeStream::SetChannelMixingParametersImpl(uint32_t aNumberOfChannels,
|
||||
MOZ_ASSERT(int(aChannelInterpretation) < INT16_MAX);
|
||||
|
||||
mNumberOfInputChannels = aNumberOfChannels;
|
||||
mMixingMode.mChannelCountMode = aChannelCountMode;
|
||||
mMixingMode.mChannelInterpretation = aChannelInterpretation;
|
||||
mChannelCountMode = aChannelCountMode;
|
||||
mChannelInterpretation = aChannelInterpretation;
|
||||
}
|
||||
|
||||
StreamBuffer::Track*
|
||||
@ -266,7 +266,7 @@ AudioNodeStream::ObtainInputBlock(AudioChunk& aTmpChunk, uint32_t aPortIndex)
|
||||
GetAudioChannelsSuperset(outputChannelCount, chunk->mChannelData.Length());
|
||||
}
|
||||
|
||||
switch (mMixingMode.mChannelCountMode) {
|
||||
switch (mChannelCountMode) {
|
||||
case ChannelCountMode::Explicit:
|
||||
// Disregard the output channel count that we've calculated, and just use
|
||||
// mNumberOfInputChannels.
|
||||
@ -303,7 +303,7 @@ AudioNodeStream::ObtainInputBlock(AudioChunk& aTmpChunk, uint32_t aPortIndex)
|
||||
nsAutoTArray<const void*,GUESS_AUDIO_CHANNELS> channels;
|
||||
channels.AppendElements(chunk->mChannelData);
|
||||
if (channels.Length() < outputChannelCount) {
|
||||
if (mMixingMode.mChannelInterpretation == ChannelInterpretation::Speakers) {
|
||||
if (mChannelInterpretation == ChannelInterpretation::Speakers) {
|
||||
AudioChannelsUpMix(&channels, outputChannelCount, nullptr);
|
||||
NS_ASSERTION(outputChannelCount == channels.Length(),
|
||||
"We called GetAudioChannelsSuperset to avoid this");
|
||||
@ -314,7 +314,7 @@ AudioNodeStream::ObtainInputBlock(AudioChunk& aTmpChunk, uint32_t aPortIndex)
|
||||
}
|
||||
}
|
||||
} else if (channels.Length() > outputChannelCount) {
|
||||
if (mMixingMode.mChannelInterpretation == ChannelInterpretation::Speakers) {
|
||||
if (mChannelInterpretation == ChannelInterpretation::Speakers) {
|
||||
nsAutoTArray<float*,GUESS_AUDIO_CHANNELS> outputChannels;
|
||||
outputChannels.SetLength(outputChannelCount);
|
||||
downmixBuffer.SetLength(outputChannelCount * WEBAUDIO_BLOCK_SIZE);
|
||||
|
@ -55,8 +55,8 @@ public:
|
||||
mMarkAsFinishedAfterThisBlock(false),
|
||||
mAudioParamStream(false)
|
||||
{
|
||||
mMixingMode.mChannelCountMode = dom::ChannelCountMode::Max;
|
||||
mMixingMode.mChannelInterpretation = dom::ChannelInterpretation::Speakers;
|
||||
mChannelCountMode = dom::ChannelCountMode::Max;
|
||||
mChannelInterpretation = dom::ChannelInterpretation::Speakers;
|
||||
// AudioNodes are always producing data
|
||||
mHasCurrentData = true;
|
||||
MOZ_COUNT_CTOR(AudioNodeStream);
|
||||
@ -122,10 +122,8 @@ protected:
|
||||
// The number of input channels that this stream requires. 0 means don't care.
|
||||
uint32_t mNumberOfInputChannels;
|
||||
// The mixing modes
|
||||
struct {
|
||||
dom::ChannelCountMode mChannelCountMode : 16;
|
||||
dom::ChannelInterpretation mChannelInterpretation : 16;
|
||||
} mMixingMode;
|
||||
dom::ChannelCountMode mChannelCountMode;
|
||||
dom::ChannelInterpretation mChannelInterpretation;
|
||||
// Whether the stream should be marked as finished as soon
|
||||
// as the current time range has been computed block by block.
|
||||
bool mMarkAsFinishedAfterThisBlock;
|
||||
|
@ -36,9 +36,9 @@ public:
|
||||
explicit PannerNodeEngine(AudioNode* aNode)
|
||||
: AudioNodeEngine(aNode)
|
||||
// Please keep these default values consistent with PannerNode::PannerNode below.
|
||||
, mPanningModel(PanningModelTypeValues::HRTF)
|
||||
, mPanningModel(PanningModelType::HRTF)
|
||||
, mPanningModelFunction(&PannerNodeEngine::HRTFPanningFunction)
|
||||
, mDistanceModel(DistanceModelTypeValues::Inverse)
|
||||
, mDistanceModel(DistanceModelType::Inverse)
|
||||
, mDistanceModelFunction(&PannerNodeEngine::InverseGainFunction)
|
||||
, mPosition()
|
||||
, mOrientation(1., 0., 0.)
|
||||
@ -62,10 +62,10 @@ public:
|
||||
case PannerNode::PANNING_MODEL:
|
||||
mPanningModel = PanningModelType(aParam);
|
||||
switch (mPanningModel) {
|
||||
case PanningModelTypeValues::Equalpower:
|
||||
case PanningModelType::Equalpower:
|
||||
mPanningModelFunction = &PannerNodeEngine::EqualPowerPanningFunction;
|
||||
break;
|
||||
case PanningModelTypeValues::HRTF:
|
||||
case PanningModelType::HRTF:
|
||||
mPanningModelFunction = &PannerNodeEngine::HRTFPanningFunction;
|
||||
break;
|
||||
}
|
||||
@ -73,13 +73,13 @@ public:
|
||||
case PannerNode::DISTANCE_MODEL:
|
||||
mDistanceModel = DistanceModelType(aParam);
|
||||
switch (mDistanceModel) {
|
||||
case DistanceModelTypeValues::Inverse:
|
||||
case DistanceModelType::Inverse:
|
||||
mDistanceModelFunction = &PannerNodeEngine::InverseGainFunction;
|
||||
break;
|
||||
case DistanceModelTypeValues::Linear:
|
||||
case DistanceModelType::Linear:
|
||||
mDistanceModelFunction = &PannerNodeEngine::LinearGainFunction;
|
||||
break;
|
||||
case DistanceModelTypeValues::Exponential:
|
||||
case DistanceModelType::Exponential:
|
||||
mDistanceModelFunction = &PannerNodeEngine::ExponentialGainFunction;
|
||||
break;
|
||||
}
|
||||
@ -175,8 +175,8 @@ PannerNode::PannerNode(AudioContext* aContext)
|
||||
ChannelCountMode::Clamped_max,
|
||||
ChannelInterpretation::Speakers)
|
||||
// Please keep these default values consistent with PannerNodeEngine::PannerNodeEngine above.
|
||||
, mPanningModel(PanningModelTypeValues::HRTF)
|
||||
, mDistanceModel(DistanceModelTypeValues::Inverse)
|
||||
, mPanningModel(PanningModelType::HRTF)
|
||||
, mDistanceModel(DistanceModelType::Inverse)
|
||||
, mPosition()
|
||||
, mOrientation(1., 0., 0.)
|
||||
, mVelocity()
|
||||
|
@ -87,10 +87,10 @@ DOMRequest::GetReadyState(nsAString& aReadyState)
|
||||
{
|
||||
DOMRequestReadyState readyState = ReadyState();
|
||||
switch (readyState) {
|
||||
case DOMRequestReadyStateValues::Pending:
|
||||
case DOMRequestReadyState::Pending:
|
||||
aReadyState.AssignLiteral("pending");
|
||||
break;
|
||||
case DOMRequestReadyStateValues::Done:
|
||||
case DOMRequestReadyState::Done:
|
||||
aReadyState.AssignLiteral("done");
|
||||
break;
|
||||
default:
|
||||
|
@ -47,8 +47,8 @@ public:
|
||||
// WebIDL Interface
|
||||
DOMRequestReadyState ReadyState() const
|
||||
{
|
||||
return mDone ? DOMRequestReadyStateValues::Done
|
||||
: DOMRequestReadyStateValues::Pending;
|
||||
return mDone ? DOMRequestReadyState::Done
|
||||
: DOMRequestReadyState::Pending;
|
||||
}
|
||||
|
||||
JS::Value Result(JSContext* = nullptr) const
|
||||
|
@ -22,6 +22,7 @@ CONSTRUCT_HOOK_NAME = '_constructor'
|
||||
LEGACYCALLER_HOOK_NAME = '_legacycaller'
|
||||
HASINSTANCE_HOOK_NAME = '_hasInstance'
|
||||
NEWRESOLVE_HOOK_NAME = '_newResolve'
|
||||
ENUM_ENTRY_VARIABLE_NAME = 'strings'
|
||||
|
||||
def replaceFileIfChanged(filename, newContents):
|
||||
"""
|
||||
@ -3172,7 +3173,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||
"%(handleInvalidEnumValueCode)s"
|
||||
" %(enumLoc)s = static_cast<%(enumtype)s>(index);\n"
|
||||
"}" % { "enumtype" : enumName,
|
||||
"values" : enumName + "Values::strings",
|
||||
"values" : enumName + "Values::" + ENUM_ENTRY_VARIABLE_NAME,
|
||||
"invalidEnumValueFatal" : toStringBool(invalidEnumValueFatal),
|
||||
"handleInvalidEnumValueCode" : handleInvalidEnumValueCode,
|
||||
"exceptionCode" : CGIndenter(exceptionCodeIndented).define(),
|
||||
@ -3193,7 +3194,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
||||
else:
|
||||
assert(defaultValue.type.tag() == IDLType.Tags.domstring)
|
||||
template = handleDefault(template,
|
||||
("%s = %sValues::%s" %
|
||||
("%s = %s::%s" %
|
||||
(enumLoc, enumName,
|
||||
getEnumValueName(defaultValue.value))))
|
||||
return (template, CGGeneric(declType), None, isOptional)
|
||||
@ -3803,7 +3804,7 @@ if (!returnArray) {
|
||||
%(exceptionCode)s
|
||||
}
|
||||
""" % { "result" : resultLoc,
|
||||
"strings" : type.unroll().inner.identifier.name + "Values::strings",
|
||||
"strings" : type.unroll().inner.identifier.name + "Values::" + ENUM_ENTRY_VARIABLE_NAME,
|
||||
"exceptionCode" : CGIndenter(exceptionCodeIndented).define() } +
|
||||
CGIndenter(CGGeneric(setValue("JS::StringValue(resultStr)"))).define() +
|
||||
"\n}")
|
||||
@ -5372,24 +5373,35 @@ class CGEnum(CGThing):
|
||||
CGThing.__init__(self)
|
||||
self.enum = enum
|
||||
|
||||
def declare(self):
|
||||
return """
|
||||
enum valuelist {
|
||||
%s
|
||||
};
|
||||
def stringsNamespace(self):
|
||||
return self.enum.identifier.name + "Values"
|
||||
|
||||
extern const EnumEntry strings[%d];
|
||||
""" % (",\n ".join(map(getEnumValueName, self.enum.values())),
|
||||
len(self.enum.values()) + 1)
|
||||
def nEnumStrings(self):
|
||||
return len(self.enum.values()) + 1
|
||||
|
||||
def declare(self):
|
||||
enumName = self.enum.identifier.name
|
||||
strings = CGNamespace(self.stringsNamespace(),
|
||||
CGGeneric(declare="extern const EnumEntry %s[%d];\n"
|
||||
% (ENUM_ENTRY_VARIABLE_NAME, self.nEnumStrings())))
|
||||
|
||||
return """
|
||||
MOZ_BEGIN_ENUM_CLASS(%s, uint32_t)
|
||||
%s
|
||||
MOZ_END_ENUM_CLASS(%s)
|
||||
|
||||
""" % (enumName, ",\n ".join(map(getEnumValueName, self.enum.values())),
|
||||
enumName) + strings.declare()
|
||||
|
||||
def define(self):
|
||||
return """
|
||||
const EnumEntry strings[%d] = {
|
||||
strings = """
|
||||
const EnumEntry %s[%d] = {
|
||||
%s,
|
||||
{ NULL, 0 }
|
||||
};
|
||||
""" % (len(self.enum.values()) + 1,
|
||||
""" % (ENUM_ENTRY_VARIABLE_NAME, self.nEnumStrings(),
|
||||
",\n ".join(['{"' + val + '", ' + str(len(val)) + '}' for val in self.enum.values()]))
|
||||
return CGNamespace(self.stringsNamespace(), CGGeneric(define=strings)).define()
|
||||
|
||||
def deps(self):
|
||||
return self.enum.getDeps()
|
||||
@ -7878,14 +7890,7 @@ class CGBindingRoot(CGThing):
|
||||
traitsClasses = None
|
||||
|
||||
# Do codegen for all the enums
|
||||
def makeEnum(e):
|
||||
return CGNamespace.build([e.identifier.name + "Values"],
|
||||
CGEnum(e))
|
||||
def makeEnumTypedef(e):
|
||||
return CGGeneric(declare=("typedef %sValues::valuelist %s;\n" %
|
||||
(e.identifier.name, e.identifier.name)))
|
||||
cgthings = [ fun(e) for e in config.getEnums(webIDLFile)
|
||||
for fun in [makeEnum, makeEnumTypedef] ]
|
||||
cgthings = [ CGEnum(e) for e in config.getEnums(webIDLFile) ]
|
||||
|
||||
# Do codegen for all the dictionaries. We have to be a bit careful
|
||||
# here, because we have to generate these in order from least derived
|
||||
|
@ -86,14 +86,14 @@ FileHandle::Open(const nsAString& aMode,
|
||||
FileMode mode;
|
||||
if (aOptionalArgCount) {
|
||||
if (aMode.EqualsLiteral("readwrite")) {
|
||||
mode = FileModeValues::Readwrite;
|
||||
mode = FileMode::Readwrite;
|
||||
} else if (aMode.EqualsLiteral("readonly")) {
|
||||
mode = FileModeValues::Readonly;
|
||||
mode = FileMode::Readonly;
|
||||
} else {
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
}
|
||||
} else {
|
||||
mode = FileModeValues::Readonly;
|
||||
mode = FileMode::Readonly;
|
||||
}
|
||||
|
||||
ErrorResult rv;
|
||||
@ -112,15 +112,15 @@ FileHandle::Open(FileMode aMode, ErrorResult& aError)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MOZ_STATIC_ASSERT(static_cast<uint32_t>(FileModeValues::Readonly) ==
|
||||
MOZ_STATIC_ASSERT(static_cast<uint32_t>(FileMode::Readonly) ==
|
||||
static_cast<uint32_t>(LockedFile::READ_ONLY),
|
||||
"Enum values should match.");
|
||||
MOZ_STATIC_ASSERT(static_cast<uint32_t>(FileModeValues::Readwrite) ==
|
||||
MOZ_STATIC_ASSERT(static_cast<uint32_t>(FileMode::Readwrite) ==
|
||||
static_cast<uint32_t>(LockedFile::READ_WRITE),
|
||||
"Enum values should match.");
|
||||
|
||||
nsRefPtr<LockedFile> lockedFile =
|
||||
LockedFile::Create(this, static_cast<LockedFile::Mode>(aMode));
|
||||
LockedFile::Create(this, LockedFile::Mode(static_cast<int>(aMode)));
|
||||
if (!lockedFile) {
|
||||
aError.Throw(NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
NotificationPermissionRequest(nsIPrincipal* aPrincipal, nsPIDOMWindow* aWindow,
|
||||
NotificationPermissionCallback* aCallback)
|
||||
: mPrincipal(aPrincipal), mWindow(aWindow),
|
||||
mPermission(NotificationPermissionValues::Default),
|
||||
mPermission(NotificationPermission::Default),
|
||||
mCallback(aCallback) {}
|
||||
|
||||
virtual ~NotificationPermissionRequest() {}
|
||||
@ -111,19 +111,19 @@ NotificationPermissionRequest::Run()
|
||||
bool isFile;
|
||||
uri->SchemeIs("file", &isFile);
|
||||
if (isFile) {
|
||||
mPermission = NotificationPermissionValues::Granted;
|
||||
mPermission = NotificationPermission::Granted;
|
||||
}
|
||||
|
||||
// Grant permission if pref'ed on.
|
||||
if (Preferences::GetBool("notification.prompt.testing", false)) {
|
||||
if (Preferences::GetBool("notification.prompt.testing.allow", true)) {
|
||||
mPermission = NotificationPermissionValues::Granted;
|
||||
mPermission = NotificationPermission::Granted;
|
||||
} else {
|
||||
mPermission = NotificationPermissionValues::Denied;
|
||||
mPermission = NotificationPermission::Denied;
|
||||
}
|
||||
}
|
||||
|
||||
if (mPermission != NotificationPermissionValues::Default) {
|
||||
if (mPermission != NotificationPermission::Default) {
|
||||
return DispatchCallback();
|
||||
}
|
||||
|
||||
@ -180,14 +180,14 @@ NotificationPermissionRequest::GetElement(nsIDOMElement** aElement)
|
||||
NS_IMETHODIMP
|
||||
NotificationPermissionRequest::Cancel()
|
||||
{
|
||||
mPermission = NotificationPermissionValues::Denied;
|
||||
mPermission = NotificationPermission::Denied;
|
||||
return DispatchCallback();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NotificationPermissionRequest::Allow()
|
||||
{
|
||||
mPermission = NotificationPermissionValues::Granted;
|
||||
mPermission = NotificationPermission::Granted;
|
||||
return DispatchCallback();
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ Notification::ShowInternal()
|
||||
|
||||
ErrorResult result;
|
||||
if (GetPermissionInternal(GetOwner(), result) !=
|
||||
NotificationPermissionValues::Granted || !alertService) {
|
||||
NotificationPermission::Granted || !alertService) {
|
||||
// We do not have permission to show a notification or alert service
|
||||
// is not available.
|
||||
return DispatchTrustedEvent(NS_LITERAL_STRING("error"));
|
||||
@ -396,7 +396,7 @@ Notification::GetPermissionInternal(nsISupports* aGlobal, ErrorResult& aRv)
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aGlobal);
|
||||
if (!sop) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return NotificationPermissionValues::Denied;
|
||||
return NotificationPermission::Denied;
|
||||
}
|
||||
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
|
||||
|
||||
@ -406,15 +406,15 @@ Notification::GetPermissionInternal(nsISupports* aGlobal, ErrorResult& aRv)
|
||||
bool isFile;
|
||||
uri->SchemeIs("file", &isFile);
|
||||
if (isFile) {
|
||||
return NotificationPermissionValues::Granted;
|
||||
return NotificationPermission::Granted;
|
||||
}
|
||||
|
||||
// We also allow notifications is they are pref'ed on.
|
||||
if (Preferences::GetBool("notification.prompt.testing", false)) {
|
||||
if (Preferences::GetBool("notification.prompt.testing.allow", true)) {
|
||||
return NotificationPermissionValues::Granted;
|
||||
return NotificationPermission::Granted;
|
||||
} else {
|
||||
return NotificationPermissionValues::Denied;
|
||||
return NotificationPermission::Denied;
|
||||
}
|
||||
}
|
||||
|
||||
@ -438,11 +438,11 @@ Notification::GetPermissionInternal(nsISupports* aGlobal, ErrorResult& aRv)
|
||||
// Convert the result to one of the enum types.
|
||||
switch (permission) {
|
||||
case nsIPermissionManager::ALLOW_ACTION:
|
||||
return NotificationPermissionValues::Granted;
|
||||
return NotificationPermission::Granted;
|
||||
case nsIPermissionManager::DENY_ACTION:
|
||||
return NotificationPermissionValues::Denied;
|
||||
return NotificationPermission::Denied;
|
||||
default:
|
||||
return NotificationPermissionValues::Default;
|
||||
return NotificationPermission::Default;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,9 @@ protected:
|
||||
static const nsString DirectionToString(NotificationDirection aDirection)
|
||||
{
|
||||
switch (aDirection) {
|
||||
case NotificationDirectionValues::Ltr:
|
||||
case NotificationDirection::Ltr:
|
||||
return NS_LITERAL_STRING("ltr");
|
||||
case NotificationDirectionValues::Rtl:
|
||||
case NotificationDirection::Rtl:
|
||||
return NS_LITERAL_STRING("rtl");
|
||||
default:
|
||||
return NS_LITERAL_STRING("auto");
|
||||
|
@ -263,7 +263,7 @@ ConvertStringToResponseType(const nsAString& aString)
|
||||
}
|
||||
|
||||
MOZ_NOT_REACHED("Don't know anything about this response type!");
|
||||
return _empty;
|
||||
return XMLHttpRequestResponseType::_empty;
|
||||
}
|
||||
|
||||
enum
|
||||
@ -1404,7 +1404,7 @@ Proxy::HandleEvent(nsIDOMEvent* aEvent)
|
||||
XMLHttpRequest::XMLHttpRequest(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
||||
: XMLHttpRequestEventTarget(aCx), mJSObject(NULL), mUpload(NULL),
|
||||
mWorkerPrivate(aWorkerPrivate),
|
||||
mResponseType(XMLHttpRequestResponseTypeValues::Text), mTimeout(0),
|
||||
mResponseType(XMLHttpRequestResponseType::Text), mTimeout(0),
|
||||
mJSObjectRooted(false), mBackgroundRequest(false),
|
||||
mWithCredentials(false), mCanceled(false), mMozAnon(false), mMozSystem(false)
|
||||
{
|
||||
@ -2109,7 +2109,7 @@ XMLHttpRequest::SetResponseType(XMLHttpRequestResponseType aResponseType,
|
||||
|
||||
// "document" is fine for the main thread but not for a worker. Short-circuit
|
||||
// that here.
|
||||
if (aResponseType == XMLHttpRequestResponseTypeValues::Document) {
|
||||
if (aResponseType == XMLHttpRequestResponseType::Document) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user