DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
  <title>Test for preference not to use document colors</title>
  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <style type="text/css">

  #one, #three { background: blue; color: yellow; border: thin solid red; }
  #two { background: transparent; border: thin solid; }
  #five, #six {border: thick solid red; -moz-border-start-color:green; -moz-border-end-color:blue}

  /* XXX also test rgba() */

  </style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=58048">Mozilla Bug 58048</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=255411">Mozilla Bug 255411</a>
<div id="display">

<div id="one">Hello</div>
<div id="two">Hello</div>
<input id="three" type="button" value="Hello">
<input id="four" type="button" value="Hello">
<div id="five" dir="ltr">Hello</div>
<div id="six" dir="rtl">Hello</div>

</div>
<pre id="test">
<script class="testbody" type="text/javascript">

SimpleTest.waitForExplicitFinish();

netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefService = Components.classes["@mozilla.org/preferences-service;1"].
                    getService(Components.interfaces.nsIPrefService);
var dispBranch = prefService.getBranch("browser.display.");

function get_pref()
{
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    return dispBranch.getBoolPref("use_document_colors");
}

function set_pref(val)
{
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    dispBranch.setBoolPref("use_document_colors", val);
}

var cs1 = getComputedStyle(document.getElementById("one"), "");
var cs2 = getComputedStyle(document.getElementById("two"), "");
var cs3 = getComputedStyle(document.getElementById("three"), "");
var cs4 = getComputedStyle(document.getElementById("four"), "");
var cs5 = getComputedStyle(document.getElementById("five"), "");
var cs6 = getComputedStyle(document.getElementById("six"), "");


var oldVal = get_pref();
set_pref(true);
setTimeout(part1, 0);

var transparentBackgroundColor;
var inputBackgroundColor, inputColor, inputBorderTopColor;
var inputBorderRightColor, inputBorderLeftColor, inputBorderBottomColor;

function part1()
{

    isnot(cs1.backgroundColor, cs2.backgroundColor, "background-color applies");
    isnot(cs1.color, cs2.color, "color applies");
    isnot(cs1.borderTopColor, cs2.borderTopColor, "border-top-color applies");
    isnot(cs1.borderRightColor, cs2.borderRightColor,
          "border-right-color applies");
    isnot(cs1.borderLeftColor, cs2.borderLeftColor,
          "border-left-color applies");
    isnot(cs1.borderBottomColor, cs2.borderBottomColor,
          "border-top-color applies");
    is(cs1.borderTopColor, cs3.borderTopColor, "border-top-color applies");
    is(cs1.borderRightColor, cs3.borderRightColor,
       "border-right-color applies");
    is(cs1.borderLeftColor, cs3.borderLeftColor,
       "border-left-color applies");
    is(cs1.borderBottomColor, cs3.borderBottomColor, 
       "border-top-color applies");
    isnot(cs5.borderRightColor, cs2.borderRightColor,
          "-moz-border-end-color applies");
    isnot(cs5.borderLeftColor, cs2.borderLeftColor,
          "-moz-border-start-color applies");    
    isnot(cs6.borderRightColor, cs2.borderRightColor,
          "-moz-border-start-color applies");
    isnot(cs6.borderLeftColor, cs2.borderLeftColor,
          "-moz-border-end-color applies");
    is(cs1.color, cs3.color, "color applies");
    is(cs1.backgroundColor, cs3.backgroundColor, "background-color applies");
    isnot(cs3.backgroundColor, cs4.backgroundColor, "background-color applies");
    isnot(cs3.color, cs4.color, "color applies");
    isnot(cs3.borderTopColor, cs4.borderTopColor, "border-top-color applies");
    isnot(cs3.borderRightColor, cs4.borderRightColor,
          "border-right-color applies");
    isnot(cs3.borderLeftColor, cs4.borderLeftColor,
          "border-left-color applies");
    isnot(cs3.borderBottomColor, cs4.borderBottomColor,
          "border-bottom-color applies");
    transparentBackgroundColor = cs2.backgroundColor;
    inputBackgroundColor = cs4.backgroundColor;
    inputColor = cs4.color;
    inputBorderTopColor = cs4.borderTopColor;
    inputBorderRightColor = cs4.borderRightColor;
    inputBorderLeftColor = cs4.borderLeftColor;
    inputBorderBottomColor = cs4.borderBottomColor;
    set_pref(false);
    setTimeout(part2, 0);
}

function part2()
{
    isnot(cs1.backgroundColor, cs2.backgroundColor, "background-color transparency preserved (opaque)");
    is(cs2.backgroundColor, transparentBackgroundColor, "background-color transparency is preserved (transparent)");
    is(cs1.color, cs2.color, "color is blocked");
    is(cs1.borderTopColor, cs2.borderTopColor, "border-top-color is blocked");
    is(cs1.borderRightColor, cs2.borderRightColor,
       "border-right-color is blocked");
    is(cs1.borderLeftColor, cs2.borderLeftColor,
       "border-left-color is blocked");
    is(cs5.borderRightColor, cs2.borderRightColor,
       "-moz-border-end-color is blocked");
    is(cs5.borderLeftColor, cs2.borderLeftColor,
       "-moz-border-start-color is blocked");
    is(cs6.borderRightColor, cs2.borderRightColor,
       "-moz-border-start-color is blocked");
    is(cs6.borderLeftColor, cs2.borderLeftColor,
       "-moz-border-end-color is blocked");
    is(cs1.borderBottomColor, cs2.borderBottomColor,
       "border-bottom-color is blocked");
    is(cs3.backgroundColor, cs1.backgroundColor, "background-color transparency preserved (opaque)");
    is(cs3.color, cs4.color, "color is blocked");
    is(cs3.borderTopColor, cs4.borderTopColor, "border-top-color is blocked");
    is(cs3.borderRightColor, cs4.borderRightColor,
       "border-right-color is blocked");
    is(cs3.borderLeftColor, cs4.borderLeftColor,
       "border-left-color is blocked");
    is(cs3.borderBottomColor, cs4.borderBottomColor,
       "border-bottom-color is blocked");
    is(cs4.backgroundColor, inputBackgroundColor, "background-color not broken on inputs");
    is(cs4.color, inputColor, "color not broken on inputs");
    is(cs4.borderTopColor, inputBorderTopColor, "border-top-color not broken on inputs");
    is(cs4.borderRightColor, inputBorderRightColor,
       "border-right-color not broken on inputs");
    is(cs4.borderLeftColor, inputBorderLeftColor,
       "border-left-color not broken on inputs");
    is(cs4.borderBottomColor, inputBorderBottomColor,
       "border-bottom-color not broken on inputs");

    set_pref(oldVal);
    SimpleTest.finish();
}

</script>
</pre>
</body>
</html>