| OLD | NEW |
| (Empty) |
| 1 <head> | |
| 2 | |
| 3 <script> | |
| 4 if (window.testRunner) { | |
| 5 testRunner.dumpAsText(); | |
| 6 testRunner.waitUntilDone(); | |
| 7 } | |
| 8 | |
| 9 function runTest() { | |
| 10 if (!window.testRunner) { | |
| 11 log("This test can only be run under WebKit's testRunner environment"); | |
| 12 return; | |
| 13 } | |
| 14 | |
| 15 testRunner.evaluateScriptInIsolatedWorld(1, " \ | |
| 16 function test(msg, expected) \ | |
| 17 { \ | |
| 18 var console = document.getElementById('console'); \ | |
| 19 var span = document.createElement('span'); \ | |
| 20 if (msg == undefined) \ | |
| 21 msg = 'undefined'; \ | |
| 22 else \ | |
| 23 msg = msg.toString(); \ | |
| 24 span.innerHTML = msg == expected ? 'PASS<br>' : 'FAIL - <br>(' + msg
+ ') but expected <br>(' + expected + ')<br>'; \ | |
| 25 console.appendChild(span); \ | |
| 26 } \ | |
| 27 \ | |
| 28 pluginEmbed = document.getElementById('plugin-embed'); \ | |
| 29 \ | |
| 30 test('madeUpProperty' in pluginEmbed, 'true'); \ | |
| 31 test(typeof pluginEmbed.madeUpProperty, 'string'); \ | |
| 32 test(pluginEmbed.madeUpProperty, 'My name is madeUpProperty'); \ | |
| 33 test('getAttribute' in pluginEmbed, 'true'); \ | |
| 34 test(typeof pluginEmbed.getAttribute, 'function'); \ | |
| 35 test(pluginEmbed.getAttribute, 'function getAttribute() {\\n [native
code]\\n}'); \ | |
| 36 \ | |
| 37 test(Object.getOwnPropertyDescriptor(pluginEmbed, 'madeUpProperty'), '[o
bject Object]'); \ | |
| 38 test(Object.getOwnPropertyDescriptor(pluginEmbed, 'getAttribute'), 'unde
fined'); \ | |
| 39 \ | |
| 40 pluginObject = document.getElementById('plugin-object'); \ | |
| 41 \ | |
| 42 test('madeUpProperty' in pluginObject, 'true'); \ | |
| 43 test(typeof pluginObject.madeUpProperty, 'string'); \ | |
| 44 test(pluginObject.madeUpProperty, 'My name is madeUpProperty'); \ | |
| 45 test('getAttribute' in pluginObject, 'true'); \ | |
| 46 test(typeof pluginObject.getAttribute, 'function'); \ | |
| 47 test(pluginObject.getAttribute, 'function getAttribute() {\\n [native
code]\\n}'); \ | |
| 48 \ | |
| 49 test(Object.getOwnPropertyDescriptor(pluginObject, 'madeUpProperty'), '[
object Object]'); \ | |
| 50 test(Object.getOwnPropertyDescriptor(pluginObject, 'getAttribute'), 'und
efined'); \ | |
| 51 "); | |
| 52 | |
| 53 if (window.testRunner) | |
| 54 testRunner.notifyDone(); | |
| 55 } | |
| 56 </script> | |
| 57 </head> | |
| 58 | |
| 59 <body onLoad="runTest()"> | |
| 60 <embed id="plugin-embed" type="application/x-webkit-test-netscape" test="plugin-
scriptable-object-overrides-all-properties"></embed><br> | |
| 61 <object id="plugin-object" type="application/x-webkit-test-netscape" test="plugi
n-scriptable-object-overrides-all-properties"></object><br> | |
| 62 Test that the plugin script object - in a non-standard world - can override any
property on its owning node *except* for the properties that are built in to the
node or its constructor/prototype chain.<br> | |
| 63 For example, it can override "madeUpProperty" but cannot override "getAttribute"
or "className".<br> | |
| 64 <div id="console"></div> | |
| 65 </body> | |
| OLD | NEW |