зеркало из https://github.com/mozilla/pjs.git
Bug 527099, use waitForFocus to wait for the frameset window
This commit is contained in:
Родитель
397561047a
Коммит
3384016566
|
@ -5,12 +5,10 @@
|
|||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script>
|
||||
dump("frameset script parsed\n");
|
||||
SimpleTest.waitForFocus(function () dump("focus on frameset occured\n"));
|
||||
SimpleTest.waitForFocus(function () opener.framesetWindowLoaded(window));
|
||||
</script>
|
||||
|
||||
<frameset rows="30%, 70%" onload="dump('frameset load ' + event.target.location + ' ' + window.location + '\n'); window.loaded = true; if (window.loaded === window.focused) opener.framesetWindowLoaded(window)"
|
||||
onfocus="dump('frameset focus: ' + event.target.location + ' ' + window.location + '\n'); window.focused = true; if (window.loaded === window.focused) opener.framesetWindowLoaded(window)">
|
||||
<frameset rows="30%, 70%">
|
||||
<frame src="data:text/html,<html id='f1' ><body id='framebody1'><input id='f2'><body></html>">
|
||||
<frameset cols="30%, 33%, 34%">
|
||||
<frame src="data:text/html,<html id='f3'><body id='framebody2'><input id='f4'><body></html>">
|
||||
|
|
|
@ -269,14 +269,6 @@ SimpleTest.waitForFocus = function (callback, targetWindow) {
|
|||
(fm.focusedWindow ? "(" + fm.focusedWindow + ") " + fm.focusedWindow.location : "<no window focused>") +
|
||||
" desired window: (" + targetWindow + ") " + targetWindow.location +
|
||||
" docshell visible: " + baseWindow.visibility);
|
||||
dump(prefix + " -- loaded: " + targetWindow.document.readyState +
|
||||
" active window: " +
|
||||
(fm.activeWindow ? "(" + fm.activeWindow + ") " + fm.activeWindow.location : "<no window active>") +
|
||||
" focused window: " +
|
||||
(fm.focusedWindow ? "(" + fm.focusedWindow + ") " + fm.focusedWindow.location : "<no window focused>") +
|
||||
" desired window: (" + targetWindow + ") " + targetWindow.location +
|
||||
" docshell visible: " + baseWindow.visibility);
|
||||
|
||||
}
|
||||
|
||||
debugFocusLog("before wait for focus");
|
||||
|
@ -296,14 +288,14 @@ SimpleTest.waitForFocus = function (callback, targetWindow) {
|
|||
SimpleTest["waitForFocus_" + event.type + "ed"] = true;
|
||||
targetWindow.removeEventListener(event.type, waitForEvent, false);
|
||||
if (event.type == "MozAfterPaint")
|
||||
dump("MozAfterPaint event received");
|
||||
SimpleTest.ok(true, "MozAfterPaint event received");
|
||||
maybeRunTests();
|
||||
}
|
||||
|
||||
// wait for the page to load if it hasn't already
|
||||
SimpleTest.waitForFocus_loaded = (targetWindow.document.readyState == "complete");
|
||||
if (!SimpleTest.waitForFocus_loaded) {
|
||||
dump("must wait for load");
|
||||
SimpleTest.ok(true, "must wait for load");
|
||||
targetWindow.addEventListener("load", waitForEvent, false);
|
||||
}
|
||||
|
||||
|
@ -315,12 +307,12 @@ SimpleTest.waitForFocus = function (callback, targetWindow) {
|
|||
// if this is a child frame, ensure that the frame is focused
|
||||
SimpleTest.waitForFocus_focused = (focusedWindow.value == targetWindow);
|
||||
if (SimpleTest.waitForFocus_focused) {
|
||||
dump("already focused");
|
||||
SimpleTest.ok(true, "already focused");
|
||||
// if the frame is already focused and loaded, call the callback directly
|
||||
maybeRunTests();
|
||||
}
|
||||
else {
|
||||
dump("must wait for focus");
|
||||
SimpleTest.ok(true, "must wait for focus");
|
||||
targetWindow.addEventListener("focus", waitForEvent, false);
|
||||
targetWindow.focus();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче