Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: testing/resources/javascript/globals.in

Issue 971013002: Merge to XFA: Return error information from pdfium to JS. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {{header}} 1 {{header}}
2 {{object 1 0}} << 2 {{object 1 0}} <<
3 /Type /Catalog 3 /Type /Catalog
4 /Pages 2 0 R 4 /Pages 2 0 R
5 /OpenAction 10 0 R 5 /OpenAction 10 0 R
6 >> 6 >>
7 endobj 7 endobj
8 {{object 2 0}} << 8 {{object 2 0}} <<
9 /Type /Pages 9 /Type /Pages
10 /Count 1 10 /Count 1
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 { "name": "object_var", "value": some_object }, 56 { "name": "object_var", "value": some_object },
57 57
58 // Test null and undefined. 58 // Test null and undefined.
59 { "name": "null_var", "value": null }, 59 { "name": "null_var", "value": null },
60 { "name": "undefined_var", "value": undefined } 60 { "name": "undefined_var", "value": undefined }
61 ]; 61 ];
62 62
63 function setup_global() { 63 function setup_global() {
64 for (var i = 0; i < props_to_test.length; ++i) { 64 for (var i = 0; i < props_to_test.length; ++i) {
65 var prop = props_to_test[i]; 65 var prop = props_to_test[i];
66 global[prop.name] = prop.value; 66 try {
67 global[prop.name] = prop.value;
68 } catch (e) {
69 app.alert("For " + prop.name + ": Setup: ERROR: " + e.toString());
70 }
67 } 71 }
68 } 72 }
69 73
70 function delete_global() { 74 function delete_global() {
71 for (var i = 0; i < props_to_test.length; ++i) { 75 for (var i = 0; i < props_to_test.length; ++i) {
72 var prop = props_to_test[i]; 76 var prop = props_to_test[i];
73 delete global[prop.name]; 77 try {
78 delete global[prop.name];
79 } catch (e) {
80 app.alert("For " + prop.name + ": Delete: ERROR: " + e.toString());
81 }
74 } 82 }
75 } 83 }
76 84
77 function persist_global(should_persist) { 85 function persist_global(should_persist) {
78 for (var i = 0; i < props_to_test.length; ++i) { 86 for (var i = 0; i < props_to_test.length; ++i) {
79 var prop = props_to_test[i]; 87 var prop = props_to_test[i];
80 global.setPersistent(prop.name, should_persist); 88 try {
89 global.setPersistent(prop.name, should_persist);
90 } catch (e) {
91 app.alert("For " + prop.name +
92 ": Set Persistent: ERROR: " + e.toString());
93 }
81 } 94 }
82 } 95 }
83 96
84 function dump_global(msg) { 97 function dump_global(msg) {
85 app.alert("************ " + msg + " ************"); 98 app.alert("************ " + msg + " ************");
86 app.alert("Enumerable Globals:"); 99 app.alert("Enumerable Globals:");
87 for (var name in global) { 100 for (var name in global) {
88 app.alert(" " + name + " = " + global[name] + 101 try {
89 ", own property = " + global.hasOwnProperty(name)); 102 app.alert(" " + name + " = " + global[name] +
103 ", own property = " + global.hasOwnProperty(name));
104 } catch (e) {
105 app.alert("For " + name + ": Dump: ERROR: " + e.toString());
106 }
90 } 107 }
91 app.alert("Expected Globals:"); 108 app.alert("Expected Globals:");
92 for (var i = 0; i < props_to_test.length; ++i) { 109 for (var i = 0; i < props_to_test.length; ++i) {
93 var prop = props_to_test[i]; 110 var prop = props_to_test[i];
94 var actual = global[prop.name]; 111 try {
95 app.alert(" " + prop.name + " = " + actual); 112 var actual = global[prop.name];
96 if (actual != null && typeof actual == "object") { 113 app.alert(" " + prop.name + " = " + actual);
97 app.alert(" " + actual.colors[0]); 114 if (actual != null && typeof actual == "object") {
98 app.alert(" " + actual.colors[1]); 115 app.alert(" " + actual.colors[0]);
99 app.alert(" " + actual.colors[2]); 116 app.alert(" " + actual.colors[1]);
117 app.alert(" " + actual.colors[2]);
118 }
119 } catch (e) {
120 app.alert("For " + prop.name +
121 ": Dump Expected: ERROR: " + e.toString());
100 } 122 }
101 } 123 }
102 } 124 }
103 125
104 dump_global("Initial State"); 126 dump_global("Initial State");
105 127
106 // Check that they all exist. 128 // Check that they all exist.
107 setup_global(); 129 setup_global();
108 dump_global("After Setup"); 130 dump_global("After Setup");
109 131
(...skipping 18 matching lines...) Expand all
128 dump_global("After Setup and Persist true"); 150 dump_global("After Setup and Persist true");
129 151
130 endstream 152 endstream
131 endobj 153 endobj
132 {{xref}} 154 {{xref}}
133 trailer << 155 trailer <<
134 /Root 1 0 R 156 /Root 1 0 R
135 >> 157 >>
136 {{startxref}} 158 {{startxref}}
137 %%EOF 159 %%EOF
OLDNEW
« no previous file with comments | « testing/resources/javascript/document_props_expected.txt ('k') | testing/resources/javascript/globals_expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698