Bug 860123 - Use the right window's selection in some tests; r=ehsan

This commit is contained in:
Blake Kaplan 2013-09-03 15:01:00 -04:00
parent c0d9c60eca
commit 9225fd4fbb
2 changed files with 3 additions and 1 deletions

View File

@ -35,11 +35,12 @@ function runTest() {
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

View File

@ -77,6 +77,7 @@ function testCollapsed(id, vPercent, startAt, expected) {
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);