Home | History | Annotate | Download | only in javascript
      1 {{header}}
      2 {{object 1 0}} <<
      3   /Type /Catalog
      4   /Pages 2 0 R
      5   /OpenAction 10 0 R
      6 >>
      7 endobj
      8 {{object 2 0}} <<
      9   /Type /Pages
     10   /Count 1
     11   /Kids [
     12     3 0 R
     13   ]
     14 >>
     15 endobj
     16 % Page number 0.
     17 {{object 3 0}} <<
     18   /Type /Page
     19   /Parent 2 0 R
     20   /Resources <<
     21     /Font <</F1 15 0 R>>
     22   >>
     23   /Contents [21 0 R]
     24   /MediaBox [0 0 612 792]
     25 >>
     26 % OpenAction action
     27 {{object 10 0}} <<
     28   /Type /Action
     29   /S /JavaScript
     30   /JS 11 0 R
     31 >>
     32 endobj
     33 % JS program to exexute
     34 {{object 11 0}} <<
     35 >>
     36 stream
     37 app.alert('Applying to util itself - should succeed');
     38 try {
     39   app.alert(util.byteToChar.apply(util, [65]));
     40 }
     41 catch (e) {
     42   app.alert('Caught: ' + e);
     43 }
     44 
     45 app.alert('Applying to array - should throw');
     46 try {
     47   app.alert(util.byteToChar.apply([], [65]));
     48 }
     49 catch (e) {
     50   app.alert('Caught: ' + e);
     51 }
     52 
     53 app.alert('Applying to number - should throw');
     54 try {
     55   app.alert(util.byteToChar.apply(7, [65]));
     56 }
     57 catch (e) {
     58   app.alert('Caught: ' + e);
     59 }
     60 
     61 app.alert('Applying to wrong native obj - should throw');
     62 try {
     63   app.alert(util.byteToChar.apply(app, [65]));
     64 }
     65 catch (e) {
     66   app.alert('Caught: ' + e);
     67 }
     68 endstream
     69 endobj
     70 {{xref}}
     71 trailer <<
     72   /Root 1 0 R
     73 >>
     74 {{startxref}}
     75 %%EOF
     76