2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
3 - License, v. 2.0. If a copy of the MPL was not distributed with this
4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
8 https://bugzilla.mozilla.org/show_bug.cgi?id=499115
11 <title>Test for Bug
499115</title>
12 <script type=
"application/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
13 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
15 <body onload=
"onLoad();">
16 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=499115">Mozilla Bug
499115</a>
18 <div id=
"content" style=
"display: none">
21 <script type=
"application/javascript">
23 /** Test for Bug
499115 **/
24 SimpleTest.waitForExplicitFinish();
26 const
SEARCH_TEXT=
"minefield";
28 function getMatches() {
31 var searchRange = document.createRange();
32 searchRange.selectNodeContents(document.body);
34 var startPoint = searchRange.cloneRange();
35 startPoint.collapse(true);
37 var endPoint = searchRange.cloneRange();
38 endPoint.collapse(false);
41 var finder = SpecialPowers.Cc[
"@mozilla.org/embedcomp/rangefind;1"]
42 .createInstance(SpecialPowers.Ci.nsIFind);
44 finder.caseSensitive = false;
46 while ((retRange = finder.Find(SEARCH_TEXT, searchRange,
47 startPoint, endPoint))) {
50 // Start next search from end of current match
51 startPoint = retRange.cloneRange();
52 startPoint.collapse(false);
59 var matches = getMatches();
60 is(matches,
2,
"found second match in anonymous content");
65 <input type=
"text" value=
"minefield minefield"></body>