Bug 750051 - Disable window.find in Fennec because it breaks and/or crashes [r=jst]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 03 May 2012 09:15:38 -0700
changeset 92896 55888632fa91a28d1694739877c3891b29497b4f
parent 92895 b4d2343fff9d5bfef28dcb2a00c6358cc65a4d30
child 92897 625cac524c5719f3e110e4e44c90c880bd667e1a
push id22597
push usermbrubeck@mozilla.com
push dateThu, 03 May 2012 16:15:55 +0000
treeherdermozilla-central@55888632fa91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs750051
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 750051 - Disable window.find in Fennec because it breaks and/or crashes [r=jst]
dom/base/nsGlobalWindow.cpp
dom/tests/mochitest/bugs/Makefile.in
dom/tests/mochitest/bugs/test_bug750051.html
mobile/android/app/mobile.js
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -7058,16 +7058,19 @@ nsGlobalWindow::GetSelection(nsISelectio
 }
 
 NS_IMETHODIMP
 nsGlobalWindow::Find(const nsAString& aStr, bool aCaseSensitive,
                      bool aBackwards, bool aWrapAround, bool aWholeWord,
                      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);
 
   nsresult rv = NS_OK;
   *aDidFind = false;
 
   nsCOMPtr<nsIWebBrowserFind> finder(do_GetInterface(mDocShell));
--- a/dom/tests/mochitest/bugs/Makefile.in
+++ b/dom/tests/mochitest/bugs/Makefile.in
@@ -155,12 +155,13 @@ include $(topsrcdir)/config/rules.mk
 		iframe_bug38959-2.html \
 		test_onerror_message.html \
 		test_bug735237.html \
 		test_bug739038.html \
 		test_bug740811.html \
 		test_bug743615.html \
 		utils_bug743615.js \
 		worker_bug743615.js \
+		test_bug750051.html \
 		$(NULL)
 
 libs:: 	$(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug750051.html
@@ -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>
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -247,16 +247,17 @@ pref("extensions.blocklist.detailsURL", 
 /* block popups by default, and notify the user about blocked popups */
 pref("dom.disable_open_during_load", true);
 pref("privacy.popups.showBrowserMessage", true);
 
 /* disable opening windows with the dialog feature */
 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=");
 
 pref("accessibility.typeaheadfind", false);
 pref("accessibility.typeaheadfind.timeout", 5000);
 pref("accessibility.typeaheadfind.flashBar", 1);
 pref("accessibility.typeaheadfind.linksonly", false);