Backout bug 567306 (r=test bustage, a=blocking)

This commit is contained in:
Dietrich Ayala 2010-10-14 19:52:05 +07:00
parent 259b60de17
commit 28ebd1d00f
5 changed files with 52 additions and 66 deletions

View File

@ -115,6 +115,7 @@ var gFindBarInitialized = false;
XPCOMUtils.defineLazyGetter(window, "gFindBar", function() {
let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let findbar = document.createElementNS(XULNS, "findbar");
findbar.setAttribute("browserid", "content");
findbar.id = "FindToolbar";
let browserBottomBox = document.getElementById("browser-bottombox");
@ -122,7 +123,6 @@ XPCOMUtils.defineLazyGetter(window, "gFindBar", function() {
// Force a style flush to ensure that our binding is attached.
findbar.clientTop;
findbar.browser = gBrowser;
window.gFindBarInitialized = true;
return findbar;
});

View File

@ -94,7 +94,6 @@ endif
_BROWSER_FILES = \
browser_typeAheadFind.js \
browser_bug567306.js \
browser_keywordSearch.js \
browser_NetworkPrioritizer.js \
browser_allTabsPanel.js \

View File

@ -1,42 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
let testWindow = null;
function test() {
waitForExplicitFinish();
testWindow = OpenBrowserWindow();
testWindow.addEventListener("load", function() {
testWindow.removeEventListener("load", arguments.callee, true);
executeSoon(function() {
ok(true, "Load listener called");
testWindow.gBrowser.selectedBrowser.addEventListener("pageshow", function () {
ok(true, "Pageshow listener called");
testWindow.gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
waitForFocus(onFocus, testWindow.content);
}, true);
testWindow.content.location = "data:text/html,<h1 id='h1'>Select Me</h1>";
});
}, false);
}
function selectText() {
let elt = testWindow.content.document.getElementById("h1");
let selection = testWindow.content.getSelection();
let range = testWindow.content.document.createRange();
range.setStart(elt, 0);
range.setEnd(elt, 1);
selection.removeAllRanges();
selection.addRange(range);
}
function onFocus() {
ok(!testWindow.gFindBarInitialized, "find bar is not yet initialized");
selectText();
testWindow.gFindBar.onFindCommand();
ok(testWindow.gFindBar._findField.value == "Select Me", "Findbar is initialized with selection");
testWindow.gFindBar.close();
testWindow.close();
finish();
}

View File

@ -1,30 +1,60 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is typeaheadfind test code.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Gavin Sharp <gavin@gavinsharp.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
let testWindow = null;
function test() {
waitForExplicitFinish();
testWindow = OpenBrowserWindow();
testWindow.addEventListener("load", function() {
testWindow.removeEventListener("load", arguments.callee, true);
ok(!gFindBarInitialized, "find bar is not yet initialized");
let tab = gBrowser.addTab();
gBrowser.selectedTab = tab;
tab.linkedBrowser.addEventListener("load", function(aEvent) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
ok(true, "Load listener called");
executeSoon(function() {
ok(!testWindow.gFindBarInitialized, "find bar is not yet initialized");
testWindow.gBrowser.selectedBrowser.addEventListener("pageshow", function () {
ok(true, "Pageshow listener called");
testWindow.gBrowser.selectedBrowser.removeEventListener("pageshow", arguments.callee, false);
waitForFocus(onFocus, testWindow.content);
}, true);
testWindow.content.location = "data:text/html,<h1>A Page</h1>";
});
}, false);
waitForFocus(onFocus, content);
}, true);
content.location = "data:text/html,<h1>A Page</h1>";
}
function onFocus() {
EventUtils.synthesizeKey("/", {});
ok(testWindow.gFindBarInitialized, "find bar is now initialized");
testWindow.gFindBar.close();
testWindow.close();
ok(gFindBarInitialized, "find bar is now initialized");
gFindBar.close();
gBrowser.removeCurrentTab();
finish();
}

View File

@ -404,8 +404,7 @@
// Make sure the FAYT keypress listener is attached by initializing the
// browser property
if (this.getAttribute("browserid"))
setTimeout(function(aSelf) { aSelf.browser = aSelf.browser; }, 0, this);
setTimeout(function(aSelf) { aSelf.browser = aSelf.browser; }, 0, this);
]]></constructor>
<destructor><![CDATA[