Bug 860123 - Use the right window's selection in some tests. r=ehsan, a=bajaj
authorBlake Kaplan <mrbkap@gmail.com>
Tue, 03 Sep 2013 15:01:00 -0400
changeset 110284 54dde77e836c60cf478cb330c966b0f91272f55c
parent 110283 ac6b88bafd01879534db026037a12ecab6ccd943
child 110285 bc7ae386b6a70c1f3c2644ce77343e85994873d5
push id302
push userryanvm@gmail.com
push dateMon, 14 Oct 2013 21:10:50 +0000
reviewersehsan, bajaj
bugs860123
milestone17.0.9esrpre
Bug 860123 - Use the right window's selection in some tests. r=ehsan, a=bajaj
editor/libeditor/base/tests/test_bug646194.xul
layout/base/tests/test_scroll_selection_into_view.html
--- a/editor/libeditor/base/tests/test_bug646194.xul
+++ b/editor/libeditor/base/tests/test_bug646194.xul
@@ -28,21 +28,22 @@ function runTest() {
     var controller = top.document.commandDispatcher
                      .getControllerForCommand(aCmd);
     ok((controller && controller.isCommandEnabled(aCmd)), "command available");
     controller.doCommand(aCmd);
   }
 
   var i = document.getElementById("i");
   i.focus();
+  var win = i.contentWindow;
   var doc = i.contentDocument;
   var t = doc.getElementById("t");
   t.focus();
   // put the caret at the end
-  getSelection().collapse(t.firstChild, 11);
+  win.getSelection().collapse(t.firstChild, 11);
 
   // Simulate pression Option+Delete on Mac
   // We do things this way because not every platform can invoke this
   // command using the available key bindings.
   doCommand("cmd_wordPrevious");
   doCommand("cmd_wordPrevious");
   doCommand("cmd_deleteWordBackward");
   doCommand("cmd_deleteWordBackward");
--- a/layout/base/tests/test_scroll_selection_into_view.html
+++ b/layout/base/tests/test_scroll_selection_into_view.html
@@ -49,16 +49,17 @@ var FOCUS = 1;
 
 function testCollapsed(id, vPercent, startAt, expected) {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var selection = window.getSelection().QueryInterface(Components.interfaces.nsISelectionPrivate);
 
   var c = document.getElementById("c" + id);
   var target = document.getElementById("target" + id);
   if (target.contentDocument) {
+    selection = target.contentWindow.getSelection().QueryInterface(Components.interfaces.nsISelectionPrivate);
     target = target.contentDocument.getElementById("target" + id);
   }
   selection.collapse(target.parentNode, 0);
   c.scrollTop = startAt;
   selection.scrollIntoView(FOCUS, true, vPercent, 0);
   is(c.scrollTop, expected, "Scrolling " + target.id +
      " into view with vPercent " + vPercent + ", starting at " + startAt);
 }