mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Remove RethrowContentExceptions and related infrastructure.
We do not intend to implement the DOM in JS, so this code isn't necessary.
This commit is contained in:
parent
879af966b3
commit
8efcca986c
2 changed files with 13 additions and 35 deletions
|
@ -20,10 +20,6 @@ use std::ptr;
|
||||||
pub enum ExceptionHandling {
|
pub enum ExceptionHandling {
|
||||||
/// Report any exception and don't throw it to the caller code.
|
/// Report any exception and don't throw it to the caller code.
|
||||||
ReportExceptions,
|
ReportExceptions,
|
||||||
/// Throw an exception to the caller code if the thrown exception is a
|
|
||||||
/// binding object for a DOMError from the caller's scope, otherwise report
|
|
||||||
/// it.
|
|
||||||
RethrowContentExceptions,
|
|
||||||
/// Throw any exception to the caller code.
|
/// Throw any exception to the caller code.
|
||||||
RethrowExceptions
|
RethrowExceptions
|
||||||
}
|
}
|
||||||
|
|
|
@ -4837,12 +4837,11 @@ class FakeMember():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
class CallbackMember(CGNativeMember):
|
class CallbackMember(CGNativeMember):
|
||||||
def __init__(self, sig, name, descriptorProvider, needThisHandling, rethrowContentException=False):
|
def __init__(self, sig, name, descriptorProvider, needThisHandling):
|
||||||
"""
|
"""
|
||||||
needThisHandling is True if we need to be able to accept a specified
|
needThisHandling is True if we need to be able to accept a specified
|
||||||
thisObj, False otherwise.
|
thisObj, False otherwise.
|
||||||
"""
|
"""
|
||||||
assert not rethrowContentException or not needThisHandling
|
|
||||||
|
|
||||||
self.retvalType = sig[0]
|
self.retvalType = sig[0]
|
||||||
self.originalSig = sig
|
self.originalSig = sig
|
||||||
|
@ -4861,7 +4860,6 @@ class CallbackMember(CGNativeMember):
|
||||||
# If needThisHandling, we generate ourselves as private and the caller
|
# If needThisHandling, we generate ourselves as private and the caller
|
||||||
# will handle generating public versions that handle the "this" stuff.
|
# will handle generating public versions that handle the "this" stuff.
|
||||||
visibility = "priv" if needThisHandling else "pub"
|
visibility = "priv" if needThisHandling else "pub"
|
||||||
self.rethrowContentException = rethrowContentException
|
|
||||||
# We don't care, for callback codegen, whether our original member was
|
# We don't care, for callback codegen, whether our original member was
|
||||||
# a method or attribute or whatnot. Just always pass FakeMember()
|
# a method or attribute or whatnot. Just always pass FakeMember()
|
||||||
# here.
|
# here.
|
||||||
|
@ -4984,11 +4982,8 @@ class CallbackMember(CGNativeMember):
|
||||||
if not self.needThisHandling:
|
if not self.needThisHandling:
|
||||||
# Since we don't need this handling, we're the actual method that
|
# Since we don't need this handling, we're the actual method that
|
||||||
# will be called, so we need an aRethrowExceptions argument.
|
# will be called, so we need an aRethrowExceptions argument.
|
||||||
if self.rethrowContentException:
|
args.append(Argument("ExceptionHandling", "aExceptionHandling",
|
||||||
args.append(Argument("JSCompartment*", "aCompartment", "nullptr"))
|
"ReportExceptions"))
|
||||||
else:
|
|
||||||
args.append(Argument("ExceptionHandling", "aExceptionHandling",
|
|
||||||
"ReportExceptions"))
|
|
||||||
return args
|
return args
|
||||||
# We want to allow the caller to pass in a "this" object, as
|
# We want to allow the caller to pass in a "this" object, as
|
||||||
# well as a JSContext.
|
# well as a JSContext.
|
||||||
|
@ -4999,22 +4994,12 @@ class CallbackMember(CGNativeMember):
|
||||||
if self.needThisHandling:
|
if self.needThisHandling:
|
||||||
# It's been done for us already
|
# It's been done for us already
|
||||||
return ""
|
return ""
|
||||||
callSetup = "CallSetup s(CallbackPreserveColor(), aRv"
|
return (
|
||||||
if self.rethrowContentException:
|
"CallSetup s(CallbackPreserveColor(), aRv, aExceptionHandling);\n"
|
||||||
# getArgs doesn't add the aExceptionHandling argument but does add
|
|
||||||
# aCompartment for us.
|
|
||||||
callSetup += ", RethrowContentExceptions, aCompartment"
|
|
||||||
else:
|
|
||||||
callSetup += ", aExceptionHandling"
|
|
||||||
callSetup += ");"
|
|
||||||
return string.Template(
|
|
||||||
"${callSetup}\n"
|
|
||||||
"JSContext* cx = s.GetContext();\n"
|
"JSContext* cx = s.GetContext();\n"
|
||||||
"if (!cx) {\n"
|
"if (!cx) {\n"
|
||||||
" return Err(FailureUnknown);\n"
|
" return Err(FailureUnknown);\n"
|
||||||
"}\n").substitute({
|
"}\n")
|
||||||
"callSetup": callSetup,
|
|
||||||
})
|
|
||||||
|
|
||||||
def getArgcDecl(self):
|
def getArgcDecl(self):
|
||||||
return CGGeneric("let mut argc = %s as u32;" % self.argCountStr);
|
return CGGeneric("let mut argc = %s as u32;" % self.argCountStr);
|
||||||
|
@ -5035,9 +5020,9 @@ class CallbackMember(CGNativeMember):
|
||||||
idlObject.location))
|
idlObject.location))
|
||||||
|
|
||||||
class CallbackMethod(CallbackMember):
|
class CallbackMethod(CallbackMember):
|
||||||
def __init__(self, sig, name, descriptorProvider, needThisHandling, rethrowContentException=False):
|
def __init__(self, sig, name, descriptorProvider, needThisHandling):
|
||||||
CallbackMember.__init__(self, sig, name, descriptorProvider,
|
CallbackMember.__init__(self, sig, name, descriptorProvider,
|
||||||
needThisHandling, rethrowContentException)
|
needThisHandling)
|
||||||
def getRvalDecl(self):
|
def getRvalDecl(self):
|
||||||
return "let mut rval = UndefinedValue();\n"
|
return "let mut rval = UndefinedValue();\n"
|
||||||
|
|
||||||
|
@ -5076,10 +5061,10 @@ class CallbackOperationBase(CallbackMethod):
|
||||||
"""
|
"""
|
||||||
Common class for implementing various callback operations.
|
Common class for implementing various callback operations.
|
||||||
"""
|
"""
|
||||||
def __init__(self, signature, jsName, nativeName, descriptor, singleOperation, rethrowContentException=False):
|
def __init__(self, signature, jsName, nativeName, descriptor, singleOperation):
|
||||||
self.singleOperation = singleOperation
|
self.singleOperation = singleOperation
|
||||||
self.methodName = jsName
|
self.methodName = jsName
|
||||||
CallbackMethod.__init__(self, signature, nativeName, descriptor, singleOperation, rethrowContentException)
|
CallbackMethod.__init__(self, signature, nativeName, descriptor, singleOperation)
|
||||||
|
|
||||||
def getThisObj(self):
|
def getThisObj(self):
|
||||||
if not self.singleOperation:
|
if not self.singleOperation:
|
||||||
|
@ -5117,8 +5102,7 @@ class CallbackOperation(CallbackOperationBase):
|
||||||
jsName = method.identifier.name
|
jsName = method.identifier.name
|
||||||
CallbackOperationBase.__init__(self, signature,
|
CallbackOperationBase.__init__(self, signature,
|
||||||
jsName, MakeNativeName(jsName),
|
jsName, MakeNativeName(jsName),
|
||||||
descriptor, descriptor.interface.isSingleOperationInterface(),
|
descriptor, descriptor.interface.isSingleOperationInterface())
|
||||||
rethrowContentException=descriptor.interface.isJSImplemented())
|
|
||||||
|
|
||||||
class CallbackGetter(CallbackMember):
|
class CallbackGetter(CallbackMember):
|
||||||
def __init__(self, attr, descriptor):
|
def __init__(self, attr, descriptor):
|
||||||
|
@ -5128,8 +5112,7 @@ class CallbackGetter(CallbackMember):
|
||||||
(attr.type, []),
|
(attr.type, []),
|
||||||
callbackGetterName(attr),
|
callbackGetterName(attr),
|
||||||
descriptor,
|
descriptor,
|
||||||
needThisHandling=False,
|
needThisHandling=False)
|
||||||
rethrowContentException=descriptor.interface.isJSImplemented())
|
|
||||||
|
|
||||||
def getRvalDecl(self):
|
def getRvalDecl(self):
|
||||||
return "JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());\n"
|
return "JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());\n"
|
||||||
|
@ -5152,8 +5135,7 @@ class CallbackSetter(CallbackMember):
|
||||||
[FakeArgument(attr.type, attr)]),
|
[FakeArgument(attr.type, attr)]),
|
||||||
callbackSetterName(attr),
|
callbackSetterName(attr),
|
||||||
descriptor,
|
descriptor,
|
||||||
needThisHandling=False,
|
needThisHandling=False)
|
||||||
rethrowContentException=descriptor.interface.isJSImplemented())
|
|
||||||
|
|
||||||
def getRvalDecl(self):
|
def getRvalDecl(self):
|
||||||
# We don't need an rval
|
# We don't need an rval
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue