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