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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<!--
Copyright 2013 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
<META HTTP-EQUIV="Expires" CONTENT="-1" />
<script type="text/javascript" src="nacltest.js"> </script>
<script type="text/javascript" src="ppapi_bad.js"> </script>
<title> PPAPI bad manifest/nexe URLs </title>
<style type="text/css">
.naclModule { background-color: gray; margin: 2px 2px; }
</style>
</head>
<body id="body">
<script type="text/javascript">
//<![CDATA[
var prefix = 'NaCl module load failed: ';
// PNaCl may have slightly different error messages (pexe instead of nexe).
function couldNotAccessNexe(is_pnacl) {
if (!is_pnacl) {
return prefix + 'access to nexe url was denied.';
} else {
return prefix + 'PnaclCoordinator: pexe load failed (no access).';
}
}
// PNaCl may have slightly different error messages (pexe instead of nexe).
function couldNotLoadNexe(is_pnacl) {
if (!is_pnacl) {
return prefix + 'could not load nexe url.';
} else {
/* PP_ERROR_FAILED */
return prefix + 'PnaclCoordinator: pexe load failed (pp_error=-2).';
}
}
function declareTests(tester) {
var is_pnacl = getTestArguments()['pnacl'] !== undefined;
var mime_type = "application/x-nacl";
if (is_pnacl) {
mime_type = "application/x-pnacl";
}
// 'bad_magic' loads a manifest, then loads a nexe that tests as invalid.
badLoadTest(
tester,
'bad_magic',
'ppapi_bad_magic.nmf',
mime_type,
is_pnacl
? 'NaCl module load failed: PnaclCoordinator: PNaCl Translator Error: Invalid PNaCl bitcode header'
: 'NaCl module load failed: Bad ELF header magic number');
// 'nonexistent_nexe' loads a manifest, then tries to load a nonexistent nexe.
badLoadTest(
tester,
'nonexistent_nexe',
'ppapi_bad_doesnotexist.nmf',
mime_type,
couldNotLoadNexe(is_pnacl));
// 'nonexistent_manifest' tries to load a nonexistent manifest.
badLoadTest(
tester,
'nonexistent_manifest',
'doesnotexist.manifest',
mime_type,
'NaCl module load failed: could not load manifest url.');
// 'bad_manifest' loads an invalid manifest.
badLoadTest(
tester,
'bad_manifest',
'ppapi_bad.html',
mime_type,
'NaCl module load failed: manifest JSON parsing failed: * Line 1, Column 1\n Syntax error: value, object or array expected.\n');
// 'bad_manifest_uses_nexes' loads a manifest with an obsolete 'nexes' section.
badLoadTest(
tester,
'bad_manifest_uses_nexes',
'ppapi_bad_manifest_uses_nexes.nmf',
mime_type,
'NaCl module load failed: manifest: missing \'program\' section.');
// 'bad_manifest_bad_files' loads a manifest with a bad 'files' section.
badLoadTest(
tester,
'bad_manifest_bad_files',
'ppapi_bad_manifest_bad_files.nmf',
mime_type,
// Manifest loader expects either 'url' or 'pnacl-translate' key present.
// If neither is found, it complains about the last one.
'NaCl module load failed: manifest: file.txt property \'unknown_arch\' does not have required key: \'url\'.');
// 'bad_manifest_nexe_arch' loads a manifest with no program entry for the
// user's architecture
badLoadTest(
tester,
'bad_manifest_nexe_arch',
'ppapi_bad_manifest_nexe_arch.nmf',
mime_type,
is_pnacl
? 'NaCl module load failed: manifest: no version of program given for portable.'
: 'NaCl module load failed: manifest: no version of program given for current arch and no portable version found.');
//////////////////////////////////////
// Initialization errors begin here //
//////////////////////////////////////
// 'bad_ppp_initialize' loads a manifest, then loads a nexe that fails to
// initialize PPAPI module
badLoadTest(
tester,
'bad_ppp_initialize',
'ppapi_bad_ppp_initialize.nmf',
mime_type,
'NaCl module load failed: could not initialize module.');
// 'bad_ppp_initialize_crash' loads a manifest, then loads a nexe that crashes
// before initializing PPAPI module
badLoadTest(
tester,
'bad_ppp_initialize_crash',
'ppapi_bad_ppp_initialize_crash.nmf',
mime_type,
'NaCl module load failed: could not initialize module.');
// 'bad_no_ppp_instance' loads a manifest, then loads a nexe that fails to
// get the required PPP_Instance interface
badLoadTest(
tester,
'bad_no_ppp_instance',
'ppapi_bad_no_ppp_instance.nmf',
mime_type,
'NaCl module load failed: could not initialize module.');
// 'bad_get_ppp_instance_crash' loads a manifest, then loads a nexe that
// crashes when getting the required PPP_Instance interface
badLoadTest(
tester,
'bad_get_ppp_instance_crash',
'ppapi_bad_get_ppp_instance_crash.nmf',
mime_type,
'NaCl module load failed: could not initialize module.');
// 'bad_ppp_instance_didcreate' loads a manifest, then loads a nexe that fails
// to create the instance
badLoadTest(
tester,
'bad_ppp_instance_didcreate',
'ppapi_bad_ppp_instance_didcreate.nmf',
mime_type,
'NaCl module load failed: could not create instance.');
// 'bad_ppp_instance_didcreate_crash' loads a manifest, then loads a nexe that
// crashes before creating the instance.
badLoadTest(
tester,
'bad_ppp_instance_didcreate_crash',
'ppapi_bad_ppp_instance_didcreate_crash.nmf',
mime_type,
'NaCl module load failed: could not create instance.');
/* TODO(bbudge) Re-enable this test when the IPC proxy can report these errors.
http://crbug.com/160076
// 'bad_event_replay_crash' loads a manifest, then loads a nexe and replays
// the events that occured during loading causing the nexe to crash before
// proxy start-up was completed.
badLoadTest(
tester,
'bad_event_replay_crash',
'ppapi_bad_event_replay_crash.nmf',
mime_type,
'NaCl module load failed: instance crashed after creation.');
*/
}
// The driver invoked when the body has finished loading.
function runTests() {
var tester = new Tester($('body'));
tester.loadErrorsAreOK();
declareTests(tester);
tester.run();
}
//]]>
</script>
<!-- The tests will create and remove embeds from this div. -->
<div id="embeds"></div>
<script type="text/javascript">
//<![CDATA[
runTests();
//]]>
</script>
</body>
</html>
|