1 | // Copyright (C) 2021 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QV8DOMERRORS_P_H |
5 | #define QV8DOMERRORS_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtCore/private/qglobal_p.h> |
19 | |
20 | QT_BEGIN_NAMESPACE |
21 | // From DOM-Level-3-Core spec |
22 | // http://www.w3.org/TR/DOM-Level-3-Core/core.html |
23 | #define DOMEXCEPTION_INDEX_SIZE_ERR 1 |
24 | #define DOMEXCEPTION_DOMSTRING_SIZE_ERR 2 |
25 | #define DOMEXCEPTION_HIERARCHY_REQUEST_ERR 3 |
26 | #define DOMEXCEPTION_WRONG_DOCUMENT_ERR 4 |
27 | #define DOMEXCEPTION_INVALID_CHARACTER_ERR 5 |
28 | #define DOMEXCEPTION_NO_DATA_ALLOWED_ERR 6 |
29 | #define DOMEXCEPTION_NO_MODIFICATION_ALLOWED_ERR 7 |
30 | #define DOMEXCEPTION_NOT_FOUND_ERR 8 |
31 | #define DOMEXCEPTION_NOT_SUPPORTED_ERR 9 |
32 | #define DOMEXCEPTION_INUSE_ATTRIBUTE_ERR 10 |
33 | #define DOMEXCEPTION_INVALID_STATE_ERR 11 |
34 | #define DOMEXCEPTION_SYNTAX_ERR 12 |
35 | #define DOMEXCEPTION_INVALID_MODIFICATION_ERR 13 |
36 | #define DOMEXCEPTION_NAMESPACE_ERR 14 |
37 | #define DOMEXCEPTION_INVALID_ACCESS_ERR 15 |
38 | #define DOMEXCEPTION_VALIDATION_ERR 16 |
39 | #define DOMEXCEPTION_TYPE_MISMATCH_ERR 17 |
40 | |
41 | #define THROW_DOM(error, string) { \ |
42 | QV4::ScopedValue v(scope, scope.engine->newString(QStringLiteral(string))); \ |
43 | QV4::ScopedObject ex(scope, scope.engine->newErrorObject(v)); \ |
44 | ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))), QV4::ScopedValue(scope, QV4::Value::fromInt32(error))); \ |
45 | return scope.engine->throwError(ex); \ |
46 | } |
47 | |
48 | namespace QV4 { |
49 | struct ExecutionEngine; |
50 | } |
51 | |
52 | |
53 | void qt_add_domexceptions(QV4::ExecutionEngine *e); |
54 | |
55 | QT_END_NAMESPACE |
56 | |
57 | #endif // QV8DOMERRORS_P_H |
58 | |