toolkit/components/microformats/tests/test_framerecursion.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 <!-- Demonstrates that we are always counting MF's in a <frame> tag, and NEVER
michael@0 2 counting MF's in an <iframe> regardless of what the "frame recursion" bit
michael@0 3 is set to. -->
michael@0 4 <html>
michael@0 5 <head>
michael@0 6 <title>Testing Mixed Up Microformat APIs</title>
michael@0 7 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 8 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"></link>
michael@0 10 </head>
michael@0 11 <body id="contentbody">
michael@0 12 <pre id="test">
michael@0 13 <script class="testbody" type="text/javascript">
michael@0 14
michael@0 15 // Start the test once the iFrame loads
michael@0 16 function onLoad() {
michael@0 17 test_MicroformatsAPI();
michael@0 18 }
michael@0 19
michael@0 20 function test_MicroformatsAPI() {
michael@0 21 var Microformats = SpecialPowers.Cu.import("resource://gre/modules/Microformats.js").Microformats;
michael@0 22
michael@0 23 count = Microformats.count("geo",
michael@0 24 document.getElementById("contentbody"),
michael@0 25 {recurseExternalFrames: false},
michael@0 26 0);
michael@0 27 is(count, 1, "Only one geo - we don't count external frames");
michael@0 28
michael@0 29 count = Microformats.count("geo",
michael@0 30 document.getElementById("contentbody"),
michael@0 31 {recurseExternalFrames: true});
michael@0 32 is(count, 2, "Two Geo's - one in frame and one in iframe");
michael@0 33 }
michael@0 34 </script>
michael@0 35 </pre>
michael@0 36
michael@0 37 <frameset>
michael@0 38 <frame id="frame1">
michael@0 39 <div>
michael@0 40 <span class="notAMicroformat" id="notme">
michael@0 41 <abbr class="foo">I am not a microformat</abbr>
michael@0 42 <abbr class="title">Foolish title, not a format</abbr>
michael@0 43 </span>
michael@0 44 </div>
michael@0 45 </frame>
michael@0 46 <frame id="frame3">
michael@0 47 <span class="geo" id="02-geo-abbr-latlong" >
michael@0 48 <abbr class="latitude" title="75.77">Far Northern</abbr>
michael@0 49 <abbr class="longitude" title="-122.41">Canada</abbr>
michael@0 50 </span>
michael@0 51 </frame>
michael@0 52 <frame id="frame2">
michael@0 53 <div class="stuff">
michael@0 54 <span>Testing is Fun!</span>
michael@0 55 </div>
michael@0 56 </frame>
michael@0 57 </frameset>
michael@0 58
michael@0 59 <!-- Geo -->
michael@0 60 <iframe id="iframe" src="geo.html" onload="onLoad();">
michael@0 61 </iframe>
michael@0 62 </body>
michael@0 63 </html>

mercurial