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 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | --> |
michael@0 | 5 | <head> |
michael@0 | 6 | <title>Test that property_database.js contains all supported CSS properties</title> |
michael@0 | 7 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 8 | <script type="text/javascript" src="css_properties.js"></script> |
michael@0 | 9 | <script type="text/javascript" src="property_database.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 | <p id="display"></p> |
michael@0 | 14 | <div id="content" style="display: none"> |
michael@0 | 15 | |
michael@0 | 16 | <div id="testnode"></div> |
michael@0 | 17 | |
michael@0 | 18 | </div> |
michael@0 | 19 | <pre id="test"> |
michael@0 | 20 | <script class="testbody" type="text/javascript"> |
michael@0 | 21 | |
michael@0 | 22 | /** Test that property_database.js contains all supported CSS properties **/ |
michael@0 | 23 | |
michael@0 | 24 | /* |
michael@0 | 25 | * Here we are testing the hand-written property_database.js against |
michael@0 | 26 | * the autogenerated css_properties.js to make sure that everything in |
michael@0 | 27 | * css_properties.js is in property_database.js. |
michael@0 | 28 | * |
michael@0 | 29 | * This prevents CSS properties from being added to the code without |
michael@0 | 30 | * also being put under the minimal test coverage provided by the tests |
michael@0 | 31 | * that use property_database.js. |
michael@0 | 32 | */ |
michael@0 | 33 | |
michael@0 | 34 | for (var idx in gLonghandProperties) { |
michael@0 | 35 | var prop = gLonghandProperties[idx]; |
michael@0 | 36 | if (prop.pref && !SpecialPowers.getBoolPref(prop.pref)) { |
michael@0 | 37 | continue; |
michael@0 | 38 | } |
michael@0 | 39 | var present = prop.name in gCSSProperties; |
michael@0 | 40 | ok(present, |
michael@0 | 41 | "'" + prop.name + "' listed in gCSSProperties"); |
michael@0 | 42 | if (present) { |
michael@0 | 43 | is(gCSSProperties[prop.name].type, CSS_TYPE_LONGHAND, |
michael@0 | 44 | "'" + prop.name + "' listed as CSS_TYPE_LONGHAND"); |
michael@0 | 45 | is(gCSSProperties[prop.name].domProp, prop.prop, |
michael@0 | 46 | "'" + prop.name + "' listed with correct DOM property name"); |
michael@0 | 47 | } |
michael@0 | 48 | } |
michael@0 | 49 | for (var idx in gShorthandProperties) { |
michael@0 | 50 | var prop = gShorthandProperties[idx]; |
michael@0 | 51 | if (prop.pref && !SpecialPowers.getBoolPref(prop.pref)) { |
michael@0 | 52 | continue; |
michael@0 | 53 | } |
michael@0 | 54 | if (prop.name == "all") { |
michael@0 | 55 | // "all" isn't listed in property_database.js. |
michael@0 | 56 | continue; |
michael@0 | 57 | } |
michael@0 | 58 | var present = prop.name in gCSSProperties; |
michael@0 | 59 | ok(present, |
michael@0 | 60 | "'" + prop.name + "' listed in gCSSProperties"); |
michael@0 | 61 | if (present) { |
michael@0 | 62 | ok(gCSSProperties[prop.name].type == CSS_TYPE_TRUE_SHORTHAND || |
michael@0 | 63 | gCSSProperties[prop.name].type == CSS_TYPE_SHORTHAND_AND_LONGHAND, |
michael@0 | 64 | "'" + prop.name + "' listed as CSS_TYPE_TRUE_SHORTHAND or CSS_TYPE_SHORTHAND_AND_LONGHAND"); |
michael@0 | 65 | ok(gCSSProperties[prop.name].domProp == prop.prop, |
michael@0 | 66 | "'" + prop.name + "' listed with correct DOM property name"); |
michael@0 | 67 | } |
michael@0 | 68 | } |
michael@0 | 69 | for (var idx in gShorthandPropertiesLikeLonghand) { |
michael@0 | 70 | var prop = gShorthandPropertiesLikeLonghand[idx]; |
michael@0 | 71 | if (prop.pref && !SpecialPowers.getBoolPref(prop.pref)) { |
michael@0 | 72 | continue; |
michael@0 | 73 | } |
michael@0 | 74 | var present = prop.name in gCSSProperties; |
michael@0 | 75 | ok(present, |
michael@0 | 76 | "'" + prop.name + "' listed in gCSSProperties"); |
michael@0 | 77 | if (present) { |
michael@0 | 78 | ok(gCSSProperties[prop.name].type == CSS_TYPE_SHORTHAND_AND_LONGHAND, |
michael@0 | 79 | "'" + prop.name + "' listed as CSS_TYPE_SHORTHAND_AND_LONGHAND"); |
michael@0 | 80 | ok(gCSSProperties[prop.name].domProp == prop.prop, |
michael@0 | 81 | "'" + prop.name + "' listed with correct DOM property name"); |
michael@0 | 82 | } |
michael@0 | 83 | } |
michael@0 | 84 | |
michael@0 | 85 | /* |
michael@0 | 86 | * Test that all shorthand properties have a subproperty list and all |
michael@0 | 87 | * longhand properties do not. |
michael@0 | 88 | */ |
michael@0 | 89 | for (var prop in gCSSProperties) { |
michael@0 | 90 | var info = gCSSProperties[prop]; |
michael@0 | 91 | if (info.pref && !SpecialPowers.getBoolPref(info.pref)) { |
michael@0 | 92 | continue; |
michael@0 | 93 | } |
michael@0 | 94 | if (info.type == CSS_TYPE_LONGHAND) { |
michael@0 | 95 | ok(!("subproperties" in info), |
michael@0 | 96 | "longhand property '" + prop + "' must not have subproperty list"); |
michael@0 | 97 | } else if (info.type == CSS_TYPE_TRUE_SHORTHAND) { |
michael@0 | 98 | ok("subproperties" in info, |
michael@0 | 99 | "shorthand property '" + prop + "' must have subproperty list"); |
michael@0 | 100 | } |
michael@0 | 101 | /* optional for CSS_TYPE_SHORTHAND_AND_LONGHAND */ |
michael@0 | 102 | |
michael@0 | 103 | if ("subproperties" in info) { |
michael@0 | 104 | var good = true; |
michael@0 | 105 | if (info.subproperties.length < 1) { |
michael@0 | 106 | info("subproperty list for '" + prop + "' is empty"); |
michael@0 | 107 | good = false; |
michael@0 | 108 | } |
michael@0 | 109 | for (var idx in info.subproperties) { |
michael@0 | 110 | var subprop = info.subproperties[idx]; |
michael@0 | 111 | if (!(subprop in gCSSProperties)) { |
michael@0 | 112 | info("subproperty list for '" + prop + "' lists nonexistent subproperty '" + subprop + "'"); |
michael@0 | 113 | good = false; |
michael@0 | 114 | } |
michael@0 | 115 | } |
michael@0 | 116 | ok(good, "property '" + prop + "' has a good subproperty list"); |
michael@0 | 117 | } |
michael@0 | 118 | |
michael@0 | 119 | ok("initial_values" in info && info.initial_values.length >= 1, |
michael@0 | 120 | "must have initial values for property '" + prop + "'"); |
michael@0 | 121 | ok("other_values" in info && info.other_values.length >= 1, |
michael@0 | 122 | "must have non-initial values for property '" + prop + "'"); |
michael@0 | 123 | } |
michael@0 | 124 | |
michael@0 | 125 | </script> |
michael@0 | 126 | </pre> |
michael@0 | 127 | </body> |
michael@0 | 128 | </html> |