Sat, 03 Jan 2015 20:18:00 +0100
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 | <html xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 2 | <head> |
michael@0 | 3 | <title>Test for SMIL values</title> |
michael@0 | 4 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 5 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 6 | </head> |
michael@0 | 7 | <body> |
michael@0 | 8 | <a target="_blank" |
michael@0 | 9 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=557885">Mozilla Bug |
michael@0 | 10 | 474742</a> |
michael@0 | 11 | <p id="display"></p> |
michael@0 | 12 | <div id="content" style="display: none"> |
michael@0 | 13 | <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"> |
michael@0 | 14 | <circle cx="-100" cy="20" r="15" fill="blue" id="circle"/> |
michael@0 | 15 | </svg> |
michael@0 | 16 | </div> |
michael@0 | 17 | <pre id="test"> |
michael@0 | 18 | <script class="testbody" type="text/javascript"> |
michael@0 | 19 | <![CDATA[ |
michael@0 | 20 | /** Test for SMIL values **/ |
michael@0 | 21 | |
michael@0 | 22 | var gSvg = document.getElementById("svg"); |
michael@0 | 23 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 24 | |
michael@0 | 25 | function main() |
michael@0 | 26 | { |
michael@0 | 27 | gSvg.pauseAnimations(); |
michael@0 | 28 | |
michael@0 | 29 | var testCases = Array(); |
michael@0 | 30 | |
michael@0 | 31 | // Single value |
michael@0 | 32 | testCases.push({ |
michael@0 | 33 | 'attr' : { 'values': 'a' }, |
michael@0 | 34 | 'times': [ [ 0, 'a' ] ] |
michael@0 | 35 | }); |
michael@0 | 36 | |
michael@0 | 37 | // The parsing below is based on the following discussion: |
michael@0 | 38 | // |
michael@0 | 39 | // http://lists.w3.org/Archives/Public/www-svg/2011Nov/0136.html |
michael@0 | 40 | // |
michael@0 | 41 | // In summary: |
michael@0 | 42 | // * Values lists are semi-colon delimited and semi-colon terminated. |
michael@0 | 43 | // * However, if there are extra non-whitespace characters after the final |
michael@0 | 44 | // semi-colon then there's an implied semi-colon at the end. |
michael@0 | 45 | // |
michael@0 | 46 | // This differs to what is specified in SVG 1.1 but is consistent with the |
michael@0 | 47 | // majority of browsers and with existing content (particularly that generated |
michael@0 | 48 | // by Ikivo Animator). |
michael@0 | 49 | |
michael@0 | 50 | // Trailing semi-colon |
michael@0 | 51 | testCases.push({ |
michael@0 | 52 | 'attr' : { 'values': 'a;' }, |
michael@0 | 53 | 'times': [ [ 0, 'a' ], [ 10, 'a' ] ] |
michael@0 | 54 | }); |
michael@0 | 55 | |
michael@0 | 56 | // Trailing semi-colon + whitespace |
michael@0 | 57 | testCases.push({ |
michael@0 | 58 | 'attr' : { 'values': 'a; ' }, |
michael@0 | 59 | 'times': [ [ 0, 'a' ], [ 10, 'a' ] ] |
michael@0 | 60 | }); |
michael@0 | 61 | |
michael@0 | 62 | // Whitespace + trailing semi-colon |
michael@0 | 63 | testCases.push({ |
michael@0 | 64 | 'attr' : { 'values': 'a ;' }, |
michael@0 | 65 | 'times': [ [ 0, 'a' ], [ 10, 'a' ] ] |
michael@0 | 66 | }); |
michael@0 | 67 | |
michael@0 | 68 | // Empty at end |
michael@0 | 69 | testCases.push({ |
michael@0 | 70 | 'attr' : { 'values': 'a;;' }, |
michael@0 | 71 | 'times': [ [ 0, 'a' ], [ 5, '' ], [ 10, '' ] ] |
michael@0 | 72 | }); |
michael@0 | 73 | |
michael@0 | 74 | // Empty at end + whitespace |
michael@0 | 75 | testCases.push({ |
michael@0 | 76 | 'attr' : { 'values': 'a;; ' }, |
michael@0 | 77 | 'times': [ [ 0, 'a' ], [ 4, 'a' ], [ 5, '' ], [ 10, '' ] ] |
michael@0 | 78 | }); |
michael@0 | 79 | |
michael@0 | 80 | // Empty in middle |
michael@0 | 81 | testCases.push({ |
michael@0 | 82 | 'attr' : { 'values': 'a;;b' }, |
michael@0 | 83 | 'times': [ [ 0, 'a' ], [ 5, '' ], [ 10, 'b' ] ] |
michael@0 | 84 | }); |
michael@0 | 85 | |
michael@0 | 86 | // Empty in middle + trailing semi-colon |
michael@0 | 87 | testCases.push({ |
michael@0 | 88 | 'attr' : { 'values': 'a;;b;' }, |
michael@0 | 89 | 'times': [ [ 0, 'a' ], [ 5, '' ], [ 10, 'b' ] ] |
michael@0 | 90 | }); |
michael@0 | 91 | |
michael@0 | 92 | // Whitespace in middle |
michael@0 | 93 | testCases.push({ |
michael@0 | 94 | 'attr' : { 'values': 'a; ;b' }, |
michael@0 | 95 | 'times': [ [ 0, 'a' ], [ 5, '' ], [ 10, 'b' ] ] |
michael@0 | 96 | }); |
michael@0 | 97 | |
michael@0 | 98 | // Empty at start |
michael@0 | 99 | testCases.push({ |
michael@0 | 100 | 'attr' : { 'values': ';a' }, |
michael@0 | 101 | 'times': [ [ 0, '' ], [ 5, 'a' ], [ 10, 'a' ] ] |
michael@0 | 102 | }); |
michael@0 | 103 | |
michael@0 | 104 | // Whitespace at start |
michael@0 | 105 | testCases.push({ |
michael@0 | 106 | 'attr' : { 'values': ' ;a' }, |
michael@0 | 107 | 'times': [ [ 0, '' ], [ 5, 'a' ], [ 10, 'a' ] ] |
michael@0 | 108 | }); |
michael@0 | 109 | |
michael@0 | 110 | // Embedded whitespace |
michael@0 | 111 | testCases.push({ |
michael@0 | 112 | 'attr' : { 'values': ' a b ; c d ' }, |
michael@0 | 113 | 'times': [ [ 0, 'a b' ], [ 5, 'c d' ], [ 10, 'c d' ] ] |
michael@0 | 114 | }); |
michael@0 | 115 | |
michael@0 | 116 | // Whitespace only |
michael@0 | 117 | testCases.push({ |
michael@0 | 118 | 'attr' : { 'values': ' ' }, |
michael@0 | 119 | 'times': [ [ 0, '' ], [ 10, '' ] ] |
michael@0 | 120 | }); |
michael@0 | 121 | |
michael@0 | 122 | for (var i = 0; i < testCases.length; i++) { |
michael@0 | 123 | gSvg.setCurrentTime(0); |
michael@0 | 124 | var test = testCases[i]; |
michael@0 | 125 | |
michael@0 | 126 | // Create animation elements |
michael@0 | 127 | var anim = createAnim(test.attr); |
michael@0 | 128 | |
michael@0 | 129 | // Run samples |
michael@0 | 130 | for (var j = 0; j < test.times.length; j++) { |
michael@0 | 131 | var curSample = test.times[j]; |
michael@0 | 132 | gSvg.setCurrentTime(curSample[0]); |
michael@0 | 133 | checkSample(anim, curSample[1], curSample[0], i); |
michael@0 | 134 | } |
michael@0 | 135 | |
michael@0 | 136 | anim.parentNode.removeChild(anim); |
michael@0 | 137 | } |
michael@0 | 138 | |
michael@0 | 139 | SimpleTest.finish(); |
michael@0 | 140 | } |
michael@0 | 141 | |
michael@0 | 142 | function createAnim(attr) |
michael@0 | 143 | { |
michael@0 | 144 | const svgns = "http://www.w3.org/2000/svg"; |
michael@0 | 145 | var anim = document.createElementNS(svgns, 'animate'); |
michael@0 | 146 | anim.setAttribute('attributeName','class'); |
michael@0 | 147 | anim.setAttribute('dur','10s'); |
michael@0 | 148 | anim.setAttribute('begin','0s'); |
michael@0 | 149 | anim.setAttribute('fill','freeze'); |
michael@0 | 150 | for (name in attr) { |
michael@0 | 151 | anim.setAttribute(name, attr[name]); |
michael@0 | 152 | } |
michael@0 | 153 | return document.getElementById('circle').appendChild(anim); |
michael@0 | 154 | } |
michael@0 | 155 | |
michael@0 | 156 | function checkSample(anim, expectedValue, sampleTime, caseNum) |
michael@0 | 157 | { |
michael@0 | 158 | var msg = "Test case " + caseNum + |
michael@0 | 159 | " (values: '" + anim.getAttribute('values') + "')," + |
michael@0 | 160 | "t=" + sampleTime + |
michael@0 | 161 | ": Unexpected sample value:"; |
michael@0 | 162 | is(anim.targetElement.className.animVal, expectedValue, msg); |
michael@0 | 163 | } |
michael@0 | 164 | |
michael@0 | 165 | window.addEventListener("load", main, false); |
michael@0 | 166 | ]]> |
michael@0 | 167 | </script> |
michael@0 | 168 | </pre> |
michael@0 | 169 | </body> |
michael@0 | 170 | </html> |