content/base/test/test_bug694754.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug694754.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,70 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html xmlns="http://www.w3.org/1999/xhtml"
     1.6 +      xmlns:test="http://example.com/test">
     1.7 +<!--
     1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=694754
     1.9 +-->
    1.10 +<head>
    1.11 +  <title>Test for Bug 694754</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=694754">Mozilla Bug 694754</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none">
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script type="application/javascript">
    1.22 +
    1.23 +/** Test for Bug 694754 **/
    1.24 +/*
    1.25 +The following code tests if calling the DOM methods Document::lookupNamespaceURI
    1.26 +and Document::lookupPrefix directly (with quickstubs) and through XPCOM leads
    1.27 +to the same result.
    1.28 +
    1.29 +This test makes use of the bug/feature that deleting a method from the 
    1.30 +prototype forces the engine to go through XPCOM.
    1.31 +*/
    1.32 +
    1.33 +// Document::lookupPrefix called directly (quickstubs)
    1.34 +var prefixDirect = document.lookupPrefix("http://example.com/test");
    1.35 +is(prefixDirect, "test", 
    1.36 +   "calling Document::lookupPrefix through quickstubs works");
    1.37 +
    1.38 +// Document::lookupPrefix called via XPCOM
    1.39 +var proto = Object.getPrototypeOf(document);
    1.40 +delete(proto.lookupPrefix);
    1.41 +var prefixThroughXPCOM = document.lookupPrefix("http://example.com/test");
    1.42 +is(prefixThroughXPCOM, "test", 
    1.43 +   "calling Document::lookupPrefix through XPCOM works");
    1.44 +
    1.45 +
    1.46 +
    1.47 +// Document::lookupNamespaceURI called directly (quickstubs)
    1.48 +var namespaceDirect = document.lookupNamespaceURI(null);
    1.49 +is(namespaceDirect, "http://www.w3.org/1999/xhtml", 
    1.50 +   "calling Document::lookupNamespaceURI through quickstubs works");
    1.51 +
    1.52 +// Document::lookupNamespaceURI called via XPCOM
    1.53 +delete(proto.lookupNamespaceURI);
    1.54 +var namespaceThroughXPCOM = document.lookupNamespaceURI(null);
    1.55 +is(namespaceThroughXPCOM, "http://www.w3.org/1999/xhtml", 
    1.56 +   "calling Document::lookupNamespaceURI through XPCOM works");
    1.57 +   
    1.58 +// Document::isDefaultNamespace called directly (quickstubs)
    1.59 +var isDefaultNamespaceDirect = document.isDefaultNamespace("http://www.w3.org/1999/xhtml");
    1.60 +is(isDefaultNamespaceDirect, true,
    1.61 +   "Default namespace correctly detected through quickstubs");
    1.62 +   
    1.63 +// Document::isDefaultNamespace called via XPCOM
    1.64 +delete(proto.isDefaultNamespace);
    1.65 +var isDefaultNamespaceXPCOM = document.isDefaultNamespace("http://www.w3.org/1999/xhtml");
    1.66 +is(isDefaultNamespaceXPCOM, true,
    1.67 +   "Default namespace correctly detected through XPCOM");
    1.68 +
    1.69 +
    1.70 +</script>
    1.71 +</pre>
    1.72 +</body>
    1.73 +</html>

mercurial