test_bug694754.xhtml (2487B)
1 <!DOCTYPE HTML> 2 <html xmlns="http://www.w3.org/1999/xhtml" 3 xmlns:test="http://example.com/test"> 4 <!-- 5 https://bugzilla.mozilla.org/show_bug.cgi?id=694754 6 --> 7 <head> 8 <title>Test for Bug 694754</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=694754">Mozilla Bug 694754</a> 14 <p id="display"></p> 15 <div id="content" style="display: none"> 16 </div> 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug 694754 */ 21 /* 22 The following code tests if calling the DOM methods Document::lookupNamespaceURI 23 and Document::lookupPrefix directly (with quickstubs) and through XPCOM leads 24 to the same result. 25 26 This test makes use of the bug/feature that deleting a method from the 27 prototype forces the engine to go through XPCOM. 28 */ 29 30 // Document::lookupPrefix called directly (quickstubs) 31 var prefixDirect = document.lookupPrefix("http://example.com/test"); 32 is(prefixDirect, "test", 33 "calling Document::lookupPrefix through quickstubs works"); 34 35 // Document::lookupPrefix called via XPCOM 36 var proto = Object.getPrototypeOf(document); 37 delete(proto.lookupPrefix); 38 var prefixThroughXPCOM = document.lookupPrefix("http://example.com/test"); 39 is(prefixThroughXPCOM, "test", 40 "calling Document::lookupPrefix through XPCOM works"); 41 42 43 44 // Document::lookupNamespaceURI called directly (quickstubs) 45 var namespaceDirect = document.lookupNamespaceURI(null); 46 is(namespaceDirect, "http://www.w3.org/1999/xhtml", 47 "calling Document::lookupNamespaceURI through quickstubs works"); 48 49 // Document::lookupNamespaceURI called via XPCOM 50 delete(proto.lookupNamespaceURI); 51 var namespaceThroughXPCOM = document.lookupNamespaceURI(null); 52 is(namespaceThroughXPCOM, "http://www.w3.org/1999/xhtml", 53 "calling Document::lookupNamespaceURI through XPCOM works"); 54 55 // Document::isDefaultNamespace called directly (quickstubs) 56 var isDefaultNamespaceDirect = document.isDefaultNamespace("http://www.w3.org/1999/xhtml"); 57 is(isDefaultNamespaceDirect, true, 58 "Default namespace correctly detected through quickstubs"); 59 60 // Document::isDefaultNamespace called via XPCOM 61 delete(proto.isDefaultNamespace); 62 var isDefaultNamespaceXPCOM = document.isDefaultNamespace("http://www.w3.org/1999/xhtml"); 63 is(isDefaultNamespaceXPCOM, true, 64 "Default namespace correctly detected through XPCOM"); 65 66 67 </script> 68 </pre> 69 </body> 70 </html>