OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 function debug(str) { | 4 function debug(str) { |
5 var li = document.createElement('li'); | 5 var li = document.createElement('li'); |
6 li.appendChild(document.createTextNode(str)); | 6 li.appendChild(document.createTextNode(str)); |
7 document.getElementById('console').appendChild(li) | 7 document.getElementById('console').appendChild(li) |
8 } | 8 } |
9 | 9 |
10 function checkLocationObject(l) | 10 function checkLocationObject(l) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 try { | 50 try { |
51 var href = document.plugin.testGetProperty('top', 'location', 'href'); | 51 var href = document.plugin.testGetProperty('top', 'location', 'href'); |
52 } catch (e) {} | 52 } catch (e) {} |
53 if (href) { | 53 if (href) { |
54 debug("could access top.location.href") | 54 debug("could access top.location.href") |
55 numErrors++; | 55 numErrors++; |
56 } | 56 } |
57 | 57 |
58 // Try accessing top.document using NPN_EVALUATE | 58 // Try accessing top.document using NPN_EVALUATE |
59 var l = document.plugin.testEvaluate('top.document') | 59 try { |
60 if (l) { | 60 var documentViaTestEvaluate = document.plugin.testEvaluate('top.document
') |
| 61 } catch (e) {}; |
| 62 if (documentViaTestEvaluate) { |
61 debug('could access top.document'); | 63 debug('could access top.document'); |
62 numErrors++; | 64 numErrors++; |
63 } | 65 } |
64 | 66 |
65 // Try accessing top.document using NPN_GetProperty | 67 // Try accessing top.document using NPN_GetProperty |
66 var l = document.plugin.testGetProperty('top', 'document') | 68 try { |
67 if (l) { | 69 var documentViaTestGetProperty = document.plugin.testGetProperty('top',
'document') |
| 70 } catch (e) {}; |
| 71 if (documentViaTestGetProperty) { |
68 debug('could access top.document'); | 72 debug('could access top.document'); |
69 numErrors++; | 73 numErrors++; |
70 } | 74 } |
71 | 75 |
72 if (numErrors == 0) | 76 if (numErrors == 0) |
73 document.getElementById('result').innerHTML = 'SUCCESS'; | 77 document.getElementById('result').innerHTML = 'SUCCESS'; |
74 } | 78 } |
75 | 79 |
76 </script> | 80 </script> |
77 </head> | 81 </head> |
78 <body onload="runTest()"> | 82 <body onload="runTest()"> |
79 <embed name="plugin" type="application/x-webkit-test-netscape"></embed> | 83 <embed name="plugin" type="application/x-webkit-test-netscape"></embed> |
80 <div>This tests that plug-ins can access objects in other frames as allowed by t
he security model enforced in WebCore.</div> | 84 <div>This tests that plug-ins can access objects in other frames as allowed by t
he security model enforced in WebCore.</div> |
81 <ul id="console"> | 85 <ul id="console"> |
82 </ul> | 86 </ul> |
83 <div id="result">FAILURE</div> | 87 <div id="result">FAILURE</div> |
84 </body> | 88 </body> |
85 </html> | 89 </html> |
OLD | NEW |