Backed out 3 changesets (bug 102663, bug 915962) for crashing constantly. a=me
authorKyle Huey <khuey@kylehuey.com>
Tue, 21 Apr 2015 09:19:01 -0700
changeset 240262 41cda3ce8c9809c54211a6dafb04810320446198
parent 240195 b8d59286a581795934ca38a566b07d00d6a5e180
child 240318 17aad8f832375f5ddc408f54cf70fc5c16517acd
push id12503
push userkwierso@gmail.com
push dateTue, 21 Apr 2015 22:39:56 +0000
treeherderfx-team@376a1624b727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs102663, 915962
milestone40.0a1
backs out984018eae04af10445d9e0a6ed7c480bd58d96a1
ec40bfefa08da0019bdae5aec5981ad3879645ea
79aeff6684f60f3871af00609596eebaf426c663
Backed out 3 changesets (bug 102663, bug 915962) for crashing constantly. a=me Backed out changeset 984018eae04a (bug 102663) Backed out changeset ec40bfefa08d (bug 915962) Backed out changeset 79aeff6684f6 (bug 915962)
dom/xbl/nsXBLPrototypeHandler.cpp
editor/libeditor/tests/file_bug915962.html
editor/libeditor/tests/mochitest.ini
editor/libeditor/tests/test_bug915962.html
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -19,17 +19,16 @@
 #include "nsIDocument.h"
 #include "nsIController.h"
 #include "nsIControllers.h"
 #include "nsIDOMXULElement.h"
 #include "nsIURI.h"
 #include "nsIDOMHTMLTextAreaElement.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsFocusManager.h"
-#include "nsIFormControl.h"
 #include "nsIDOMEventListener.h"
 #include "nsPIDOMWindow.h"
 #include "nsPIWindowRoot.h"
 #include "nsIDOMWindow.h"
 #include "nsIServiceManager.h"
 #include "nsIScriptError.h"
 #include "nsXPIDLString.h"
 #include "nsReadableUtils.h"
@@ -472,27 +471,44 @@ nsXBLPrototypeHandler::DispatchXBLComman
 
     nsCOMPtr<nsIContent> focusedContent;
     if (windowToCheck) {
       nsCOMPtr<nsPIDOMWindow> focusedWindow;
       focusedContent =
         nsFocusManager::GetFocusedDescendant(windowToCheck, true, getter_AddRefs(focusedWindow));
     }
 
-    // If the focus is in an editable region, don't scroll.
-    if (focusedContent->IsEditable()) {
-      return NS_OK;
-    }
+    bool isLink = false;
+    nsIContent *content = focusedContent;
+
+    // if the focused element is a link then we do want space to 
+    // scroll down. The focused element may be an element in a link,
+    // we need to check the parent node too. Only do this check if an
+    // element is focused and has a parent.
+    if (focusedContent && focusedContent->GetParent()) {
+      while (content) {
+        if (content->IsHTMLElement(nsGkAtoms::a)) {
+          isLink = true;
+          break;
+        }
 
-    // If the focus is in a form control, don't scroll.
-    for (nsIContent* c = focusedContent; c; c = c->GetParent()) {
-      nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(c);
-      if (formControl) {
+        if (content->HasAttr(kNameSpaceID_XLink, nsGkAtoms::type)) {
+          isLink = content->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
+                                        nsGkAtoms::simple, eCaseMatters);
+
+          if (isLink) {
+            break;
+          }
+        }
+
+        content = content->GetParent();
+      }
+
+      if (!isLink)
         return NS_OK;
-      }
     }
   }
 
   // We are the default action for this command.
   // Stop any other default action from executing.
   aEvent->PreventDefault();
   
   if (controller)
deleted file mode 100644
--- a/editor/libeditor/tests/file_bug915962.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <body>
-    <button>Button</button>
-    <img src="green.png" usemap="#map">
-    <map name="map">
-      <!-- This URL ensures that the link doesn't get clicked, since
-           mochitests cannot access the outside network. -->
-      <area shape="rect" coords="0,0,10,10" href="https://youtube.com/">
-    </map>
-    <div style="height: 20000px;" tabindex="-1"><hr></div>
-  </body>
-</html>
--- a/editor/libeditor/tests/mochitest.ini
+++ b/editor/libeditor/tests/mochitest.ini
@@ -4,17 +4,16 @@ support-files =
   data/cfhtml-chromium.txt
   data/cfhtml-firefox.txt
   data/cfhtml-ie.txt
   data/cfhtml-ooo.txt
   data/cfhtml-nocontext.txt
   file_bug549262.html
   file_bug586662.html
   file_bug674770-1.html
-  file_bug915962.html
   file_select_all_without_body.html
   green.png
   spellcheck.js
 
 [test_bug200416.html]
 [test_bug289384.html]
 skip-if = os != "mac"
 [test_bug290026.html]
@@ -133,18 +132,16 @@ skip-if = toolkit == 'android' || e10s
 [test_bug780035.html]
 [test_bug787432.html]
 [test_bug790475.html]
 [test_bug795785.html]
 [test_bug796839.html]
 [test_bug832025.html]
 [test_bug857487.html]
 [test_bug858918.html]
-[test_bug915962.html]
-skip-if = toolkit == 'android' || e10s
 [test_bug966155.html]
 skip-if = os != "win"
 [test_bug966552.html]
 skip-if = os != "win"
 [test_bug998188.html]
 [test_bug1026397.html]
 [test_bug1067255.html]
 [test_bug1094000.html]
deleted file mode 100644
--- a/editor/libeditor/tests/test_bug915962.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=915962
--->
-<head>
-  <title>Test for Bug 915962</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=915962">Mozilla Bug 915962</a>
-<p id="display"></p>
-<div id="content">
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-/** Test for Bug 915962 **/
-
-var smoothScrollPref = "general.smoothScroll";
-SimpleTest.waitForExplicitFinish();
-var win = window.open("file_bug915962.html", "_blank",
-                      "width=600,height=600,scrollbars=yes");
-
-// grab the timer right at the start
-var cwu = SpecialPowers.getDOMWindowUtils(win);
-function step() {
-  cwu.advanceTimeAndRefresh(100);
-}
-SimpleTest.waitForFocus(function() {
-  SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, startTest);
-}, win);
-function startTest() {
-  // Make sure that pressing Space when a tabindex=-1 element is focused
-  // will scroll the page.
-  var button = win.document.querySelector("button");
-  var sc = win.document.querySelector("div");
-  sc.focus();
-  is(win.scrollY, 0, "Sanity check");
-  synthesizeKey(" ", {}, win);
-
-  step();
-
-  isnot(win.scrollY, 0, "Page is scrolled down");
-  var oldY = win.scrollY;
-  synthesizeKey(" ", {shiftKey: true}, win);
-
-  step();
-
-  ok(win.scrollY < oldY, "Page is scrolled up");
-
-  // Make sure that pressing Space when a tabindex=-1 element is focused
-  // will not scroll the page, and will activate the element.
-  button.focus();
-  var clicked = false;
-  button.onclick = () => clicked = true;
-  oldY = win.scrollY;
-  synthesizeKey(" ", {}, win);
-
-  step();
-
-  ok(win.scrollY <= oldY, "Page is not scrolled down");
-  ok(clicked, "The button should be clicked");
-  synthesizeKey("VK_TAB", {}, win);
-
-  step();
-
-  oldY = win.scrollY;
-  synthesizeKey(" ", {}, win);
-
-  step()
-
-  ok(win.scrollY >= oldY, "Page is scrolled down");
-
-  win.close();
-  cwu.restoreNormalRefresh();
-
-  SimpleTest.finish();
-}
-</script>
-</pre>
-</body>
-</html>