diff options
Diffstat (limited to 'Source/JavaScriptCore/runtime/ExceptionHelpers.h')
-rw-r--r-- | Source/JavaScriptCore/runtime/ExceptionHelpers.h | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/Source/JavaScriptCore/runtime/ExceptionHelpers.h b/Source/JavaScriptCore/runtime/ExceptionHelpers.h index 0c3fcf2d5..0cfca9cbd 100644 --- a/Source/JavaScriptCore/runtime/ExceptionHelpers.h +++ b/Source/JavaScriptCore/runtime/ExceptionHelpers.h @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * 3. Neither the name of Apple Inc. ("Apple") nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -26,46 +26,44 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ExceptionHelpers_h -#define ExceptionHelpers_h +#pragma once +#include "CatchScope.h" +#include "ErrorInstance.h" #include "JSObject.h" +#include "ThrowScope.h" namespace JSC { -typedef JSObject* (*ErrorFactory)(ExecState*, const String&); +typedef JSObject* (*ErrorFactory)(ExecState*, const String&, ErrorInstance::SourceAppender); + +String defaultSourceAppender(const String&, const String&, RuntimeType, ErrorInstance::SourceTextWhereErrorOccurred); JSObject* createTerminatedExecutionException(VM*); -bool isTerminatedExecutionException(JSObject*); -JS_EXPORT_PRIVATE bool isTerminatedExecutionException(JSValue); -JS_EXPORT_PRIVATE JSObject* createError(ExecState*, ErrorFactory, JSValue, const String&); +JS_EXPORT_PRIVATE bool isTerminatedExecutionException(VM&, Exception*); +JS_EXPORT_PRIVATE JSObject* createError(ExecState*, JSValue, const String&, ErrorInstance::SourceAppender); JS_EXPORT_PRIVATE JSObject* createStackOverflowError(ExecState*); -JSObject* createStackOverflowError(JSGlobalObject*); -JSObject* createOutOfMemoryError(JSGlobalObject*); JSObject* createUndefinedVariableError(ExecState*, const Identifier&); +JSObject* createTDZError(ExecState*); JSObject* createNotAnObjectError(ExecState*, JSValue); -JSObject* createInvalidParameterError(ExecState*, const char* op, JSValue); +JSObject* createInvalidFunctionApplyParameterError(ExecState*, JSValue); +JSObject* createInvalidInParameterError(ExecState*, JSValue); +JSObject* createInvalidInstanceofParameterErrorNotFunction(ExecState*, JSValue); +JSObject* createInvalidInstanceofParameterErrorhasInstanceValueNotFunction(ExecState*, JSValue); JSObject* createNotAConstructorError(ExecState*, JSValue); JSObject* createNotAFunctionError(ExecState*, JSValue); JSObject* createErrorForInvalidGlobalAssignment(ExecState*, const String&); JSString* errorDescriptionForValue(ExecState*, JSValue); -JSObject* throwOutOfMemoryError(ExecState*); -JSObject* throwStackOverflowError(ExecState*); -JSObject* throwTerminatedExecutionException(ExecState*); +JS_EXPORT_PRIVATE JSObject* throwOutOfMemoryError(ExecState*, ThrowScope&); +JS_EXPORT_PRIVATE JSObject* throwStackOverflowError(ExecState*, ThrowScope&); +JS_EXPORT_PRIVATE JSObject* throwTerminatedExecutionException(ExecState*, ThrowScope&); -class TerminatedExecutionError : public JSNonFinalObject { -private: - TerminatedExecutionError(VM& vm) - : JSNonFinalObject(vm, vm.terminatedExecutionErrorStructure.get()) - { - } - - static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); - +class TerminatedExecutionError final : public JSNonFinalObject { public: typedef JSNonFinalObject Base; + static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal; static TerminatedExecutionError* create(VM& vm) { @@ -80,8 +78,15 @@ public: } DECLARE_EXPORT_INFO; + +private: + explicit TerminatedExecutionError(VM& vm) + : JSNonFinalObject(vm, vm.terminatedExecutionErrorStructure.get()) + { + } + + static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); + }; } // namespace JSC - -#endif // ExceptionHelpers_h |