Bug 750051 - Disable window.find in Fennec because it breaks and/or crashes [r=jst]

This commit is contained in:
Matt Brubeck 2012-05-03 09:15:38 -07:00
parent 928443e854
commit 9f46038aeb
4 changed files with 43 additions and 0 deletions

View File

@ -7063,6 +7063,9 @@ nsGlobalWindow::Find(const nsAString& aStr, bool aCaseSensitive,
bool aSearchInFrames, bool aShowDialog,
bool *aDidFind)
{
if (Preferences::GetBool("dom.disable_window_find", false))
return NS_ERROR_NOT_AVAILABLE;
FORWARD_TO_OUTER(Find, (aStr, aCaseSensitive, aBackwards, aWrapAround,
aWholeWord, aSearchInFrames, aShowDialog, aDidFind),
NS_ERROR_NOT_INITIALIZED);

View File

@ -160,6 +160,7 @@ _TEST_FILES = \
test_bug743615.html \
utils_bug743615.js \
worker_bug743615.js \
test_bug750051.html \
$(NULL)
libs:: $(_TEST_FILES)

View File

@ -0,0 +1,38 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=750051
-->
<head>
<title>Test for Bug 750051</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=750051">Mozilla Bug 750051</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 750051 **/
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["dom.disable_window_find", true]]}, function() {
var caughtException = false;
try {
window.find();
} catch (e) {
caughtException = true;
}
ok(caughtException, "window.find should throw an exception");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>

View File

@ -252,6 +252,7 @@ pref("privacy.popups.showBrowserMessage", true);
pref("dom.disable_window_open_dialog_feature", true);
pref("dom.disable_window_showModalDialog", true);
pref("dom.disable_window_print", true);
pref("dom.disable_window_find", true);
pref("keyword.enabled", true);
pref("keyword.URL", "https://www.google.com/m?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=");