зеркало из https://github.com/mozilla/pjs.git
Backout bug 279022 to fix browser-chrome test failures
This commit is contained in:
Родитель
48c643ac5e
Коммит
e7649602af
|
@ -4099,6 +4099,12 @@ var XULBrowserWindow = {
|
|||
gFindBar.close();
|
||||
}
|
||||
|
||||
// XXXmano new-findbar, do something useful once it lands.
|
||||
// Of course, this is especially wrong with bfcache on...
|
||||
|
||||
// fix bug 253793 - turn off highlight when page changes
|
||||
gFindBar.getElement("highlight").checked = false;
|
||||
|
||||
// See bug 358202, when tabs are switched during a drag operation,
|
||||
// timers don't fire on windows (bug 203573)
|
||||
if (aRequest)
|
||||
|
|
|
@ -1861,9 +1861,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
// If we have hooked it up to a filter, don't forget to remove it
|
||||
// (but don't fail if it wasn't)
|
||||
if (!this.mTabbedMode && this.mTabFilters[0])
|
||||
if (!this.mTabbedMode)
|
||||
// Don't forget to remove it from the filter we hooked it up to
|
||||
this.mTabFilters[0].removeProgressListener(aListener);
|
||||
]]>
|
||||
</body>
|
||||
|
|
|
@ -69,7 +69,6 @@ _TEST_FILES = test_feed_discovery.html \
|
|||
# 480169)
|
||||
|
||||
_BROWSER_FILES = browser_sanitize-timespans.js \
|
||||
browser_bug279022.js \
|
||||
browser_bug405137.js \
|
||||
browser_bug409481.js \
|
||||
browser_bug413915.js \
|
||||
|
|
|
@ -1,107 +0,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 Test Code for bug 279022.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Graeme McCutcheon <graememcc_firefox@graeme-online.co.uk>.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 testPage1 = 'data:text/html,<p>Mozilla</p>';
|
||||
let testPage2 = 'data:text/html,<p>Firefox</p>';
|
||||
let testPage3 = 'data:text/html,<p>Seamonkey</p><input type="text" value="Gecko"></input>';
|
||||
let hButton = gFindBar.getElement("highlight");
|
||||
|
||||
var testTab1, testTab2, testTab3;
|
||||
var testBrowser1, testBrowser2, testBrowser3;
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
testTab1 = gBrowser.addTab();
|
||||
testTab2 = gBrowser.addTab();
|
||||
testTab3 = gBrowser.addTab();
|
||||
testBrowser1 = gBrowser.getBrowserForTab(testTab1);
|
||||
testBrowser2 = gBrowser.getBrowserForTab(testTab2);
|
||||
testBrowser3 = gBrowser.getBrowserForTab(testTab3);
|
||||
|
||||
// Load the test documents into the relevant browsers
|
||||
testBrowser3.loadURI(testPage3);
|
||||
testBrowser2.loadURI(testPage2);
|
||||
testBrowser1.addEventListener("load", testTabs, true);
|
||||
testBrowser1.loadURI(testPage1);
|
||||
}
|
||||
|
||||
function testTabs() {
|
||||
testBrowser1.removeEventListener("load", testTabs, true);
|
||||
|
||||
// Select the tab and create some highlighting
|
||||
gBrowser.selectedTab = testTab1;
|
||||
gFindBar.getElement("find-case-sensitive").checked = false;
|
||||
gFindBar._highlightDoc(true, "Mozilla");
|
||||
|
||||
// Test 1: switch tab and check highlight button deselected
|
||||
gBrowser.selectedTab = testTab2;
|
||||
ok(!hButton.checked, "highlight button deselected after changing tab");
|
||||
gFindBar._findField.value = "";
|
||||
|
||||
// Test 2: switch back to tab with highlighting
|
||||
gBrowser.selectedTab = testTab1;
|
||||
ok(hButton.checked, "highlight button re-enabled on tab with highlighting");
|
||||
var searchTermOK = gFindBar._findField.value == "Mozilla";
|
||||
ok(searchTermOK, "detected correct search term");
|
||||
|
||||
// Create highlighting where match is in an editable element
|
||||
gBrowser.selectedTab = testTab3;
|
||||
gFindBar._highlightDoc(true, "Gecko");
|
||||
|
||||
// Test 4: Switch to tab without highlighting again
|
||||
gBrowser.selectedTab = testTab2;
|
||||
ok(!hButton.checked, "highlight button deselected again");
|
||||
gFindBar._findField.value = "";
|
||||
|
||||
// Test 5: Switch to tab with highlighting in editable element
|
||||
gBrowser.selectedTab = testTab3;
|
||||
ok(hButton.checked, "highlighting detected in editable element");
|
||||
searchTermOK = gFindBar._findField.value == "Gecko";
|
||||
ok(searchTermOK, "detected correct search term");
|
||||
|
||||
// Test 6: Switch between two tabs with highlighting - search term changed?
|
||||
gBrowser.selectedTab = testTab1;
|
||||
searchTermOK = gFindBar._findField.value == "Mozilla";
|
||||
ok(searchTermOK, "correctly changed search term");
|
||||
|
||||
gBrowser.removeTab(testTab3);
|
||||
gBrowser.removeTab(testTab2);
|
||||
gBrowser.removeTab(testTab1);
|
||||
finish();
|
||||
}
|
||||
|
|
@ -280,7 +280,7 @@
|
|||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMEventListener, nsIEditActionListener, nsIWebProgressListener">
|
||||
<implementation implements="nsIDOMEventListener, nsIEditActionListener">
|
||||
<field name="FIND_NORMAL">0</field>
|
||||
<field name="FIND_TYPEAHEAD">1</field>
|
||||
<field name="FIND_LINKS">2</field>
|
||||
|
@ -327,11 +327,6 @@
|
|||
if (this._browser) {
|
||||
this._browser.removeEventListener("keypress", this, false);
|
||||
this._browser.removeEventListener("mouseup", this, false);
|
||||
try {
|
||||
// don't fail when the browser has been supplied through the
|
||||
// browserid attribute and we've not yet hooked up the listener
|
||||
this._browser.removeProgressListener(this);
|
||||
} catch (e) {}
|
||||
this._foundLink = null;
|
||||
this._foundEditable = null;
|
||||
this._currentWindow = null;
|
||||
|
@ -341,8 +336,6 @@
|
|||
if (this._browser) {
|
||||
this._browser.addEventListener("keypress", this, false);
|
||||
this._browser.addEventListener("mouseup", this, false);
|
||||
this._browser.addProgressListener(this,
|
||||
Components.interfaces.nsIWebProgress.NOTIFY_LOCATION);
|
||||
this._findField.value = this._browser.fastFind.searchString;
|
||||
}
|
||||
return val;
|
||||
|
@ -897,124 +890,6 @@
|
|||
]]></body>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
- nsIWebProgressListener logic follows
|
||||
-
|
||||
- We implement this interface to allow us to update our status UI
|
||||
- when navigating to a new tab, or loading a page from the cache.
|
||||
- This then allows the user to adjust the highlighting on the newly
|
||||
- displayed page.
|
||||
-->
|
||||
|
||||
<!--
|
||||
- Detects whether highlighting is present in a given window,
|
||||
- by checking the window's content document, and recursively checking
|
||||
- any frames contained within this window.
|
||||
- @param aWindow
|
||||
- the window to check
|
||||
- @returns the highlighted string, if there is highlighting present,
|
||||
- null otherwise
|
||||
-->
|
||||
<method name="_getHighlightedString">
|
||||
<parameter name="aWindow"/>
|
||||
<body><![CDATA[
|
||||
var win = aWindow || this.browser.contentWindow;
|
||||
|
||||
// Obtain the selection controller for this window
|
||||
var controller = this._getSelectionController(win);
|
||||
|
||||
if (!controller)
|
||||
return null;
|
||||
|
||||
var selection = controller.getSelection(controller.SELECTION_FIND);
|
||||
if (selection && selection.rangeCount > 0)
|
||||
return selection.getRangeAt(0).toString();
|
||||
|
||||
var doc = win.document;
|
||||
// Bail now if document cannot contain highlighting
|
||||
if (!doc || !(doc instanceof HTMLDocument))
|
||||
return null;
|
||||
|
||||
// Check for highlighting in elements with independent
|
||||
// selection controllers
|
||||
if (this._editors) {
|
||||
for (var x = 0; x < this._editors.length; x++) {
|
||||
if (this._editors[x].document == doc) {
|
||||
var sel = this._editors[x].selectionController
|
||||
.getSelection(this._findSelection);
|
||||
return sel.getRangeAt(0).toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we still haven't found highlighting, recursively check any
|
||||
// frames in the current window
|
||||
var hasHighlight = null;
|
||||
var i = 0;
|
||||
while (!hasHighlight && win.frames && i < win.frames.length) {
|
||||
hasHighlight = this._getHighlightedString(win.frames[i]);
|
||||
i++;
|
||||
}
|
||||
return hasHighlight;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- Start of nsIWebProgressListener implementations -->
|
||||
|
||||
<!--
|
||||
- Updates the findbar UI on a page change, to allow removal of highlighting
|
||||
- where appropriate
|
||||
-->
|
||||
<method name="onLocationChange">
|
||||
<parameter name="aWebProgress"/>
|
||||
<parameter name="aRequest"/>
|
||||
<parameter name="aURI"/>
|
||||
<body><![CDATA[
|
||||
var highlightButton = this.getElement("highlight");
|
||||
|
||||
// Establish whether any highlighting exists on the new page
|
||||
var lastHighlightString = this._getHighlightedString();
|
||||
if (!lastHighlightString) {
|
||||
highlightButton.checked = false;
|
||||
if (!this._findField.value)
|
||||
highlightButton.disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the highlight button and display the
|
||||
// currently highlighted string
|
||||
highlightButton.checked = true;
|
||||
highlightButton.disabled = false;
|
||||
this._findField.value = lastHighlightString;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onProgressChange">
|
||||
<body><![CDATA[
|
||||
// Unimplemented
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onSecurityChange">
|
||||
<body><![CDATA[
|
||||
// Unimplemented
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onStateChange">
|
||||
<body><![CDATA[
|
||||
// Unimplemented
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="onStatusChange">
|
||||
<body><![CDATA[
|
||||
// Unimplemented
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!-- End of nsIWebProgressListener implementations -->
|
||||
|
||||
<!--
|
||||
- Turns highlight on or off.
|
||||
- @param aHighlight (boolean)
|
||||
|
|
Загрузка…
Ссылка в новой задаче