1<!DOCTYPE HTML> 2<html xmlns="http://www.w3.org/1999/xhtml" 3 xmlns:test="http://example.com/test"> 4<!-- 5https://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/* 22The following code tests if calling the DOM methods Document::lookupNamespaceURI 23and Document::lookupPrefix directly (with quickstubs) and through XPCOM leads 24to the same result. 25 26This test makes use of the bug/feature that deleting a method from the 27prototype forces the engine to go through XPCOM. 28*/ 29 30// Document::lookupPrefix called directly (quickstubs) 31var prefixDirect = document.lookupPrefix("http://example.com/test"); 32is(prefixDirect, "test", 33 "calling Document::lookupPrefix through quickstubs works"); 34 35// Document::lookupPrefix called via XPCOM 36var proto = Object.getPrototypeOf(document); 37delete(proto.lookupPrefix); 38var prefixThroughXPCOM = document.lookupPrefix("http://example.com/test"); 39is(prefixThroughXPCOM, "test", 40 "calling Document::lookupPrefix through XPCOM works"); 41 42 43 44// Document::lookupNamespaceURI called directly (quickstubs) 45var namespaceDirect = document.lookupNamespaceURI(null); 46is(namespaceDirect, "http://www.w3.org/1999/xhtml", 47 "calling Document::lookupNamespaceURI through quickstubs works"); 48 49// Document::lookupNamespaceURI called via XPCOM 50delete(proto.lookupNamespaceURI); 51var namespaceThroughXPCOM = document.lookupNamespaceURI(null); 52is(namespaceThroughXPCOM, "http://www.w3.org/1999/xhtml", 53 "calling Document::lookupNamespaceURI through XPCOM works"); 54 55// Document::isDefaultNamespace called directly (quickstubs) 56var isDefaultNamespaceDirect = document.isDefaultNamespace("http://www.w3.org/1999/xhtml"); 57is(isDefaultNamespaceDirect, true, 58 "Default namespace correctly detected through quickstubs"); 59 60// Document::isDefaultNamespace called via XPCOM 61delete(proto.isDefaultNamespace); 62var isDefaultNamespaceXPCOM = document.isDefaultNamespace("http://www.w3.org/1999/xhtml"); 63is(isDefaultNamespaceXPCOM, true, 64 "Default namespace correctly detected through XPCOM"); 65 66 67</script> 68</pre> 69</body> 70</html> 71