blob: 5df1460cbcdb4d7f1d2cbf1aade24d07d1b0e271 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "fxjs/js_resources.h"
WideString JSGetStringFromID(JSMessage msg) {
switch (msg) {
case JSMessage::kAlert:
return L"Alert";
case JSMessage::kParamError:
return L"Incorrect number of parameters passed to function.";
case JSMessage::kInvalidInputError:
return L"The input value is invalid.";
case JSMessage::kParamTooLongError:
return L"The input value is too long.";
case JSMessage::kParseDateError:
return L"The input value can't be parsed as a valid date/time (%ls).";
case JSMessage::kRangeBetweenError:
return L"The input value must be greater than or equal to %ls"
L" and less than or equal to %ls.";
case JSMessage::kRangeGreaterError:
return L"The input value must be greater than or equal to %ls.";
case JSMessage::kRangeLessError:
return L"The input value must be less than or equal to %ls.";
case JSMessage::kNotSupportedError:
return L"Operation not supported.";
case JSMessage::kBusyError:
return L"System is busy.";
case JSMessage::kDuplicateEventError:
return L"Duplicate formfield event found.";
case JSMessage::kRunSuccess:
return L"Script ran successfully.";
case JSMessage::kSecondParamNotDateError:
return L"The second parameter can't be converted to a Date.";
case JSMessage::kSecondParamInvalidDateError:
return L"The second parameter is an invalid Date!";
case JSMessage::kGlobalNotFoundError:
return L"Global value not found.";
case JSMessage::kReadOnlyError:
return L"Cannot assign to readonly property.";
case JSMessage::kTypeError:
return L"Incorrect parameter type.";
case JSMessage::kValueError:
return L"Incorrect parameter value.";
case JSMessage::kPermissionError:
return L"Permission denied.";
case JSMessage::kBadObjectError:
return L"Object no longer exists.";
case JSMessage::kObjectTypeError:
return L"Object is of the wrong type.";
case JSMessage::kTooManyOccurances:
return L"Too many occurances.";
case JSMessage::kUnknownProperty:
return L"Unknown property.";
case JSMessage::kUnknownMethod:
return L"Unknown method.";
}
NOTREACHED();
return L"";
}
WideString JSFormatErrorString(const char* class_name,
const char* property_name,
const WideString& details) {
WideString result = WideString::FromLocal(class_name);
if (property_name) {
result += L".";
result += WideString::FromLocal(property_name);
}
result += L": ";
result += details;
return result;
}
|