| <p> |
| This page tests what happens when a getter / setter on the window object conflicts |
| with another property or declared variable. |
| </p> |
| |
| <pre id="console"></pre> |
| |
| <script> |
| function log(s) |
| { |
| document.getElementById("console").appendChild(document.createTextNode(s + "\n")); |
| } |
| |
| if (window.layoutTestController) |
| layoutTestController.dumpAsText(); |
| |
| var x = 1; |
| |
| try { |
| window.__defineGetter__("x", function() { return "window.x __getter__"; }); |
| } catch(e) { log(e); } |
| log("window.x is: " + window.x); |
| log("typeof window.__lookupGetter__(\"x\") is: " + typeof window.__lookupGetter__("x")); |
| |
| try { |
| window.__defineSetter__("x", function() { log("window.x __setter__ called"); }); |
| } catch(e) { log(e); } |
| x = 2; |
| log("window.x is: " + window.x); |
| log("typeof window.__lookupSetter__(\"x\") is: " + typeof window.__lookupGetter__("x")); |
| |
| y = 1; |
| |
| try { |
| window.__defineGetter__("y", function() { return "window.y __getter__"; }); |
| } catch(e) { log(e); } |
| log("window.y is: " + window.y); |
| log("typeof window.__lookupGetter__(\"y\") is: " + typeof window.__lookupGetter__("y")); |
| |
| try { |
| window.__defineSetter__("y", function() { log("window.y __setter__ called"); }); |
| } catch(e) { log(e); } |
| y = 2; |
| log("window.y is: " + window.y); |
| log("typeof window.__lookupSetter__(\"y\") is: " + typeof window.__lookupGetter__("y")); |
| |
| try { |
| window.__defineSetter__("z", function() { log("window.z __setter__ called"); }); |
| } catch(e) { log(e); } |
| window.z = 1; |
| log("typeof window.__lookupSetter__(\"z\") is: " + typeof window.__lookupGetter__("z")); |
| </script> |