diff --git a/layout/reftests/css-visited/border-1-ref.html b/layout/reftests/css-visited/border-1-ref.html
new file mode 100644
index 000000000000..cbd7450ebb03
--- /dev/null
+++ b/layout/reftests/css-visited/border-1-ref.html
@@ -0,0 +1,11 @@
+
+
Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/border-1.html b/layout/reftests/css-visited/border-1.html
new file mode 100644
index 000000000000..1d97017e4e8a
--- /dev/null
+++ b/layout/reftests/css-visited/border-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/border-2-ref.html b/layout/reftests/css-visited/border-2-ref.html
new file mode 100644
index 000000000000..3730a300c92b
--- /dev/null
+++ b/layout/reftests/css-visited/border-2-ref.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777): default color for 'border'
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/border-2a.html b/layout/reftests/css-visited/border-2a.html
new file mode 100644
index 000000000000..de756dba15f6
--- /dev/null
+++ b/layout/reftests/css-visited/border-2a.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777): implicit default color for 'border'
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/border-2b.html b/layout/reftests/css-visited/border-2b.html
new file mode 100644
index 000000000000..9a97afcc5e63
--- /dev/null
+++ b/layout/reftests/css-visited/border-2b.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777): explicit default color for 'border'
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/border-collapse-1-ref.html b/layout/reftests/css-visited/border-collapse-1-ref.html
new file mode 100644
index 000000000000..fea8ae14d1ef
--- /dev/null
+++ b/layout/reftests/css-visited/border-collapse-1-ref.html
@@ -0,0 +1,32 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/border-collapse-1.html b/layout/reftests/css-visited/border-collapse-1.html
new file mode 100644
index 000000000000..00dc62577c6a
--- /dev/null
+++ b/layout/reftests/css-visited/border-collapse-1.html
@@ -0,0 +1,32 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/color-choice-1-ref.html b/layout/reftests/css-visited/color-choice-1-ref.html
new file mode 100644
index 000000000000..2a58c8e286d1
--- /dev/null
+++ b/layout/reftests/css-visited/color-choice-1-ref.html
@@ -0,0 +1,10 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/color-choice-1.html b/layout/reftests/css-visited/color-choice-1.html
new file mode 100644
index 000000000000..05f3b2fef24c
--- /dev/null
+++ b/layout/reftests/css-visited/color-choice-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/color-on-bullets-1-ref.html b/layout/reftests/css-visited/color-on-bullets-1-ref.html
new file mode 100644
index 000000000000..0d91630dc2d4
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-bullets-1-ref.html
@@ -0,0 +1,18 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+- unvisited
+- visited
+
+
diff --git a/layout/reftests/css-visited/color-on-bullets-1.html b/layout/reftests/css-visited/color-on-bullets-1.html
new file mode 100644
index 000000000000..6f04678b512a
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-bullets-1.html
@@ -0,0 +1,18 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+unvisited
+visited
+
+
diff --git a/layout/reftests/css-visited/color-on-link-1-ref.html b/layout/reftests/css-visited/color-on-link-1-ref.html
new file mode 100644
index 000000000000..859cfb6dd73b
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-link-1-ref.html
@@ -0,0 +1,6 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+link
diff --git a/layout/reftests/css-visited/color-on-link-1.html b/layout/reftests/css-visited/color-on-link-1.html
new file mode 100644
index 000000000000..425523f1f552
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-link-1.html
@@ -0,0 +1,8 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+link
diff --git a/layout/reftests/css-visited/color-on-link-before-1.html b/layout/reftests/css-visited/color-on-link-before-1.html
new file mode 100644
index 000000000000..72e965f1c8e1
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-link-before-1.html
@@ -0,0 +1,8 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/color-on-text-decoration-1-ref.html b/layout/reftests/css-visited/color-on-text-decoration-1-ref.html
new file mode 100644
index 000000000000..9bdc6fa8d8cb
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-text-decoration-1-ref.html
@@ -0,0 +1,18 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/color-on-text-decoration-1.html b/layout/reftests/css-visited/color-on-text-decoration-1.html
new file mode 100644
index 000000000000..029823d0e48d
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-text-decoration-1.html
@@ -0,0 +1,18 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/color-on-visited-1-ref.html b/layout/reftests/css-visited/color-on-visited-1-ref.html
new file mode 100644
index 000000000000..75fda1f75988
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-visited-1-ref.html
@@ -0,0 +1,6 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+link
diff --git a/layout/reftests/css-visited/color-on-visited-1.html b/layout/reftests/css-visited/color-on-visited-1.html
new file mode 100644
index 000000000000..1b7bc4b41ee9
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-visited-1.html
@@ -0,0 +1,8 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+link
diff --git a/layout/reftests/css-visited/color-on-visited-before-1.html b/layout/reftests/css-visited/color-on-visited-before-1.html
new file mode 100644
index 000000000000..4dc80d82a199
--- /dev/null
+++ b/layout/reftests/css-visited/color-on-visited-before-1.html
@@ -0,0 +1,8 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/content-before-1-ref.html b/layout/reftests/css-visited/content-before-1-ref.html
new file mode 100644
index 000000000000..233407fbb552
--- /dev/null
+++ b/layout/reftests/css-visited/content-before-1-ref.html
@@ -0,0 +1,6 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/content-color-on-link-before-1-ref.html b/layout/reftests/css-visited/content-color-on-link-before-1-ref.html
new file mode 100644
index 000000000000..a46017fdee53
--- /dev/null
+++ b/layout/reftests/css-visited/content-color-on-link-before-1-ref.html
@@ -0,0 +1,6 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/content-color-on-link-before-1.html b/layout/reftests/css-visited/content-color-on-link-before-1.html
new file mode 100644
index 000000000000..bea15972fa4b
--- /dev/null
+++ b/layout/reftests/css-visited/content-color-on-link-before-1.html
@@ -0,0 +1,8 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/content-color-on-visited-before-1-ref.html b/layout/reftests/css-visited/content-color-on-visited-before-1-ref.html
new file mode 100644
index 000000000000..66df0e1b9f51
--- /dev/null
+++ b/layout/reftests/css-visited/content-color-on-visited-before-1-ref.html
@@ -0,0 +1,6 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/content-color-on-visited-before-1.html b/layout/reftests/css-visited/content-color-on-visited-before-1.html
new file mode 100644
index 000000000000..72664e022789
--- /dev/null
+++ b/layout/reftests/css-visited/content-color-on-visited-before-1.html
@@ -0,0 +1,8 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/content-on-link-before-1.html b/layout/reftests/css-visited/content-on-link-before-1.html
new file mode 100644
index 000000000000..f75b2a46adc3
--- /dev/null
+++ b/layout/reftests/css-visited/content-on-link-before-1.html
@@ -0,0 +1,8 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/content-on-visited-before-1.html b/layout/reftests/css-visited/content-on-visited-before-1.html
new file mode 100644
index 000000000000..bca087be1068
--- /dev/null
+++ b/layout/reftests/css-visited/content-on-visited-before-1.html
@@ -0,0 +1,8 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
diff --git a/layout/reftests/css-visited/first-line-1-ref.html b/layout/reftests/css-visited/first-line-1-ref.html
new file mode 100644
index 000000000000..7969685666da
--- /dev/null
+++ b/layout/reftests/css-visited/first-line-1-ref.html
@@ -0,0 +1,12 @@
+
+
+
+ :visited and ::first-line (reference)
+
+
+
+unvisited
link
+visited
link
+
+
+
diff --git a/layout/reftests/css-visited/first-line-1.html b/layout/reftests/css-visited/first-line-1.html
new file mode 100644
index 000000000000..37aec8edc17c
--- /dev/null
+++ b/layout/reftests/css-visited/first-line-1.html
@@ -0,0 +1,22 @@
+
+
+
+ :visited and ::first-line
+
+
+
+
+unvisited
link
+visited
link
+
+
+
diff --git a/layout/reftests/css-visited/inherit-keyword-1-ref.html b/layout/reftests/css-visited/inherit-keyword-1-ref.html
new file mode 100644
index 000000000000..0b3d4ea4bad5
--- /dev/null
+++ b/layout/reftests/css-visited/inherit-keyword-1-ref.html
@@ -0,0 +1,15 @@
+
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited / unvisited
+unvisited / visited
+visited / unvisited
+visited / visited
diff --git a/layout/reftests/css-visited/inherit-keyword-1.xhtml b/layout/reftests/css-visited/inherit-keyword-1.xhtml
new file mode 100644
index 000000000000..abc08c51dd42
--- /dev/null
+++ b/layout/reftests/css-visited/inherit-keyword-1.xhtml
@@ -0,0 +1,20 @@
+
+
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+unvisited / unvisited
+unvisited / visited
+visited / unvisited
+visited / visited
+
+
diff --git a/layout/reftests/css-visited/outline-1-ref.html b/layout/reftests/css-visited/outline-1-ref.html
new file mode 100644
index 000000000000..996a4c350e6e
--- /dev/null
+++ b/layout/reftests/css-visited/outline-1-ref.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/outline-1.html b/layout/reftests/css-visited/outline-1.html
new file mode 100644
index 000000000000..634198a47184
--- /dev/null
+++ b/layout/reftests/css-visited/outline-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/reftest.list b/layout/reftests/css-visited/reftest.list
new file mode 100644
index 000000000000..62cfba757451
--- /dev/null
+++ b/layout/reftests/css-visited/reftest.list
@@ -0,0 +1,4 @@
+# Because coloring of visited links is asynchronous and does not block
+# or fire any events, the tests in this directory are not run through
+# the reftest harness. Instead, they are run through
+# layout/style/tests/test_visited_reftests.html .
diff --git a/layout/reftests/css-visited/selector-adj-sibling-1-ref.html b/layout/reftests/css-visited/selector-adj-sibling-1-ref.html
new file mode 100644
index 000000000000..ba6ecca09582
--- /dev/null
+++ b/layout/reftests/css-visited/selector-adj-sibling-1-ref.html
@@ -0,0 +1,7 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/selector-adj-sibling-1.html b/layout/reftests/css-visited/selector-adj-sibling-1.html
new file mode 100644
index 000000000000..b5bb0d413e07
--- /dev/null
+++ b/layout/reftests/css-visited/selector-adj-sibling-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/selector-adj-sibling-2-ref.html b/layout/reftests/css-visited/selector-adj-sibling-2-ref.html
new file mode 100644
index 000000000000..a9f97dc9c529
--- /dev/null
+++ b/layout/reftests/css-visited/selector-adj-sibling-2-ref.html
@@ -0,0 +1,6 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+unvisited + unvisited
+unvisited + visited
+visited + unvisited
+visited + visited
diff --git a/layout/reftests/css-visited/selector-adj-sibling-2.html b/layout/reftests/css-visited/selector-adj-sibling-2.html
new file mode 100644
index 000000000000..0eee73c51765
--- /dev/null
+++ b/layout/reftests/css-visited/selector-adj-sibling-2.html
@@ -0,0 +1,15 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited + unvisited
+unvisited + visited
+visited + unvisited
+visited + visited
diff --git a/layout/reftests/css-visited/selector-any-sibling-1-ref.html b/layout/reftests/css-visited/selector-any-sibling-1-ref.html
new file mode 100644
index 000000000000..de502b684f26
--- /dev/null
+++ b/layout/reftests/css-visited/selector-any-sibling-1-ref.html
@@ -0,0 +1,7 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/selector-any-sibling-1.html b/layout/reftests/css-visited/selector-any-sibling-1.html
new file mode 100644
index 000000000000..25f00c654eb4
--- /dev/null
+++ b/layout/reftests/css-visited/selector-any-sibling-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
diff --git a/layout/reftests/css-visited/selector-any-sibling-2-ref.html b/layout/reftests/css-visited/selector-any-sibling-2-ref.html
new file mode 100644
index 000000000000..e64a48729cc2
--- /dev/null
+++ b/layout/reftests/css-visited/selector-any-sibling-2-ref.html
@@ -0,0 +1,6 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+unvisited + unvisited
+unvisited + visited
+visited + unvisited
+visited + visited
diff --git a/layout/reftests/css-visited/selector-any-sibling-2.html b/layout/reftests/css-visited/selector-any-sibling-2.html
new file mode 100644
index 000000000000..31ec00f4ccea
--- /dev/null
+++ b/layout/reftests/css-visited/selector-any-sibling-2.html
@@ -0,0 +1,15 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+
+
diff --git a/layout/reftests/css-visited/selector-child-1-ref.html b/layout/reftests/css-visited/selector-child-1-ref.html
new file mode 100644
index 000000000000..2ed3bd25a8e4
--- /dev/null
+++ b/layout/reftests/css-visited/selector-child-1-ref.html
@@ -0,0 +1,4 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+unvisited
+visited
diff --git a/layout/reftests/css-visited/selector-child-1.html b/layout/reftests/css-visited/selector-child-1.html
new file mode 100644
index 000000000000..bd56273e49c4
--- /dev/null
+++ b/layout/reftests/css-visited/selector-child-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/selector-child-2-ref.xhtml b/layout/reftests/css-visited/selector-child-2-ref.xhtml
new file mode 100644
index 000000000000..e56caa1ab441
--- /dev/null
+++ b/layout/reftests/css-visited/selector-child-2-ref.xhtml
@@ -0,0 +1,12 @@
+
+
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+unvisited / unvisited
+unvisited / visited
+visited / unvisited
+visited / visited
+
+
diff --git a/layout/reftests/css-visited/selector-child-2.xhtml b/layout/reftests/css-visited/selector-child-2.xhtml
new file mode 100644
index 000000000000..35ebfb7b2419
--- /dev/null
+++ b/layout/reftests/css-visited/selector-child-2.xhtml
@@ -0,0 +1,21 @@
+
+
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+unvisited / unvisited
+unvisited / visited
+visited / unvisited
+visited / visited
+
+
diff --git a/layout/reftests/css-visited/selector-descendant-1-ref.html b/layout/reftests/css-visited/selector-descendant-1-ref.html
new file mode 100644
index 000000000000..2ed3bd25a8e4
--- /dev/null
+++ b/layout/reftests/css-visited/selector-descendant-1-ref.html
@@ -0,0 +1,4 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+unvisited
+visited
diff --git a/layout/reftests/css-visited/selector-descendant-1.html b/layout/reftests/css-visited/selector-descendant-1.html
new file mode 100644
index 000000000000..e7cedde31a4d
--- /dev/null
+++ b/layout/reftests/css-visited/selector-descendant-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/selector-descendant-2-ref.xhtml b/layout/reftests/css-visited/selector-descendant-2-ref.xhtml
new file mode 100644
index 000000000000..a970ea512e16
--- /dev/null
+++ b/layout/reftests/css-visited/selector-descendant-2-ref.xhtml
@@ -0,0 +1,36 @@
+
+
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+
+
diff --git a/layout/reftests/css-visited/selector-descendant-2.xhtml b/layout/reftests/css-visited/selector-descendant-2.xhtml
new file mode 100644
index 000000000000..1c5bfa4f5005
--- /dev/null
+++ b/layout/reftests/css-visited/selector-descendant-2.xhtml
@@ -0,0 +1,36 @@
+
+
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+
+
diff --git a/layout/reftests/css-visited/subject-of-selector-1-ref.html b/layout/reftests/css-visited/subject-of-selector-1-ref.html
new file mode 100644
index 000000000000..2ed3bd25a8e4
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-1-ref.html
@@ -0,0 +1,4 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+unvisited
+visited
diff --git a/layout/reftests/css-visited/subject-of-selector-adj-sibling-1.html b/layout/reftests/css-visited/subject-of-selector-adj-sibling-1.html
new file mode 100644
index 000000000000..b0279d975668
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-adj-sibling-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/subject-of-selector-any-sibling-1.html b/layout/reftests/css-visited/subject-of-selector-any-sibling-1.html
new file mode 100644
index 000000000000..806f7057837d
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-any-sibling-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/subject-of-selector-child-1.html b/layout/reftests/css-visited/subject-of-selector-child-1.html
new file mode 100644
index 000000000000..e9bdd998876f
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-child-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/subject-of-selector-descendant-1.html b/layout/reftests/css-visited/subject-of-selector-descendant-1.html
new file mode 100644
index 000000000000..c31caeb0f81a
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-descendant-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/subject-of-selector-descendant-2-ref.xhtml b/layout/reftests/css-visited/subject-of-selector-descendant-2-ref.xhtml
new file mode 100644
index 000000000000..21a8a829c4d7
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-descendant-2-ref.xhtml
@@ -0,0 +1,33 @@
+
+
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+
+
diff --git a/layout/reftests/css-visited/subject-of-selector-descendant-2.xhtml b/layout/reftests/css-visited/subject-of-selector-descendant-2.xhtml
new file mode 100644
index 000000000000..b7e07ecadd15
--- /dev/null
+++ b/layout/reftests/css-visited/subject-of-selector-descendant-2.xhtml
@@ -0,0 +1,33 @@
+
+
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+unvisited (unvisited)
+unvisited (visited)
+visited (unvisited)
+visited (visited)
+
+
+
diff --git a/layout/reftests/css-visited/visited-page.html b/layout/reftests/css-visited/visited-page.html
new file mode 100644
index 000000000000..45f19843aba6
--- /dev/null
+++ b/layout/reftests/css-visited/visited-page.html
@@ -0,0 +1,2 @@
+
+Visited page for tests for privacy restrictions on :visited (Bug 147777)
diff --git a/layout/reftests/css-visited/width-1-ref.html b/layout/reftests/css-visited/width-1-ref.html
new file mode 100644
index 000000000000..b7b388b8cede
--- /dev/null
+++ b/layout/reftests/css-visited/width-1-ref.html
@@ -0,0 +1,12 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+
+ |
+
+ text in next cell
+ |
+
+
diff --git a/layout/reftests/css-visited/width-on-link-1.html b/layout/reftests/css-visited/width-on-link-1.html
new file mode 100644
index 000000000000..d05350dc17d7
--- /dev/null
+++ b/layout/reftests/css-visited/width-on-link-1.html
@@ -0,0 +1,17 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+
+
+ |
+
+ text in next cell
+ |
+
+
diff --git a/layout/reftests/css-visited/width-on-visited-1.html b/layout/reftests/css-visited/width-on-visited-1.html
new file mode 100644
index 000000000000..b9b653f4ad91
--- /dev/null
+++ b/layout/reftests/css-visited/width-on-visited-1.html
@@ -0,0 +1,17 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+
+
+ |
+
+ text in next cell
+ |
+
+
diff --git a/layout/reftests/reftest.list b/layout/reftests/reftest.list
index add00b1e49a2..621ca0047e55 100644
--- a/layout/reftests/reftest.list
+++ b/layout/reftests/reftest.list
@@ -62,6 +62,10 @@ include css-transitions/reftest.list
# css values and units
include css-valuesandunits/reftest.list
+# Reftests in css-visited are run using
+# layout/style/test/test_visited_reftests instead of using the reftest
+# harness.
+
# columns/
include columns/reftest.list
diff --git a/layout/style/test/Makefile.in b/layout/style/test/Makefile.in
index 30c73eedf44a..03ed2858c179 100644
--- a/layout/style/test/Makefile.in
+++ b/layout/style/test/Makefile.in
@@ -177,6 +177,7 @@ _TEST_FILES = test_acid3_test46.html \
test_value_computation.html \
test_value_storage.html \
test_visited_pref.html \
+ test_visited_reftests.html \
css_properties.js \
property_database.js \
descriptor_database.js \
@@ -203,6 +204,10 @@ _TEST_FILES = test_acid3_test46.html \
visited-pref-iframe.html \
$(NULL)
+_VISITED_REFTEST_FILES = \
+ $(shell find $(topsrcdir)/layout/reftests/css-visited/ -name '*.html' -o -name '*.xhtml') \
+ $(NULL)
+
_BROWSER_FILES = \
browser_bug453896.js \
bug453896_iframe.html \
@@ -212,5 +217,8 @@ _BROWSER_FILES = \
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+libs:: $(_VISITED_REFTEST_FILES)
+ $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)/css-visited/
+
libs:: $(_BROWSER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
diff --git a/layout/style/test/test_visited_reftests.html b/layout/style/test/test_visited_reftests.html
new file mode 100644
index 000000000000..2950e797d295
--- /dev/null
+++ b/layout/style/test/test_visited_reftests.html
@@ -0,0 +1,181 @@
+
+
+
+
+ Test for Bug 147777
+
+
+
+
+
+
+Mozilla Bug 147777
+
+
+
+
+