Back out 024e6835e6ea:bece94ce2310 (bug 326743) for frequent 10.6 debug failures in browser_bug537013.js

This commit is contained in:
Phil Ringnalda 2014-02-14 23:58:49 -08:00
Родитель 7558753d7b
Коммит 2ff6e6f32a
19 изменённых файлов: 44 добавлений и 303 удалений

Просмотреть файл

@ -50,9 +50,6 @@
<command id="cmd_findPrevious"
oncommand="gFindBar.onFindAgainCommand(true);"
observes="isImage"/>
#ifdef XP_MACOSX
<command id="cmd_findSelection" oncommand="gFindBar.onFindSelectionCommand();"/>
#endif
<!-- work-around bug 392512 -->
<command id="Browser:AddBookmarkAs"
oncommand="PlacesCommandHook.bookmarkCurrentPage(true, PlacesUtils.bookmarksMenuFolderId);"/>
@ -353,9 +350,6 @@
<key id="key_find" key="&findOnCmd.commandkey;" command="cmd_find" modifiers="accel"/>
<key id="key_findAgain" key="&findAgainCmd.commandkey;" command="cmd_findAgain" modifiers="accel"/>
<key id="key_findPrevious" key="&findAgainCmd.commandkey;" command="cmd_findPrevious" modifiers="accel,shift"/>
#ifdef XP_MACOSX
<key id="key_findSelection" key="&findSelectionCmd.commandkey;" command="cmd_findSelection" modifiers="accel"/>
#endif
<key keycode="&findAgainCmd.commandkey2;" command="cmd_findAgain"/>
<key keycode="&findAgainCmd.commandkey2;" command="cmd_findPrevious" modifiers="shift"/>

Просмотреть файл

@ -11,9 +11,6 @@ let texts = [
"To err is human; to forgive is not company policy."
];
let Clipboard = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
let HasFindClipboard = Clipboard.supportsFindClipboard();
function addTabWithText(aText, aCallback) {
let newTab = gBrowser.addTab("data:text/html,<h1 id='h1'>" + aText + "</h1>");
tabs.push(newTab);
@ -64,9 +61,7 @@ function continueTests1() {
// Confirm the first tab is still correct, ensure re-hiding works as expected
gBrowser.selectedTab = tabs[0];
ok(!gFindBar.hidden, "First tab shows find bar!");
// When the Find Clipboard is supported, this test not relevant.
if (!HasFindClipboard)
is(gFindBar._findField.value, texts[0], "First tab persists find value!");
is(gFindBar._findField.value, texts[0], "First tab persists find value!");
ok(gFindBar.getElement("highlight").checked,
"Highlight button state persists!");
@ -99,8 +94,7 @@ function continueTests2() {
ok(gFindBar.hidden, "Fourth tab doesn't show find bar!");
is(gFindBar, gBrowser.getFindBar(), "Find bar is right one!");
gFindBar.open();
let toTest = HasFindClipboard ? texts[2] : texts[1];
is(gFindBar._findField.value, toTest,
is(gFindBar._findField.value, texts[1],
"Fourth tab has second tab's find value!");
newWindow = gBrowser.replaceTabWithWindow(tabs.pop());
@ -110,8 +104,7 @@ function continueTests2() {
// Test that findbar gets restored when a tab is moved to a new window.
function checkNewWindow() {
ok(!newWindow.gFindBar.hidden, "New window shows find bar!");
let toTest = HasFindClipboard ? texts[2] : texts[1];
is(newWindow.gFindBar._findField.value, toTest,
is(newWindow.gFindBar._findField.value, texts[1],
"New window find bar has correct find value!");
ok(!newWindow.gFindBar.getElement("find-next").disabled,
"New window findbar has enabled buttons!");

Просмотреть файл

@ -2,10 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const {Ci: interfaces, Cc: classes} = Components;
let Clipboard = Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard);
let HasFindClipboard = Clipboard.supportsFindClipboard();
let Ci = Components.interfaces;
function test() {
waitForExplicitFinish();
@ -40,10 +37,7 @@ function onFocus(win) {
let findBar = win.gFindBar;
selectText(win.content);
findBar.onFindCommand();
// When the OS supports the Find Clipboard (OSX), the find field value is
// persisted across Fx sessions, thus not useful to test.
if (!HasFindClipboard)
is(findBar._findField.value, "Select Me", "Findbar is initialized with selection");
is(findBar._findField.value, "Select Me", "Findbar is initialized with selection");
findBar.close();
win.close();
finish();

Просмотреть файл

@ -614,7 +614,6 @@ you can use these alternative items. Otherwise, their values should be empty. -
<!ENTITY findAgainCmd.accesskey "g">
<!ENTITY findAgainCmd.commandkey "g">
<!ENTITY findAgainCmd.commandkey2 "VK_F3">
<!ENTITY findSelectionCmd.commandkey "e">
<!ENTITY spellAddDictionaries.label "Add Dictionaries…">
<!ENTITY spellAddDictionaries.accesskey "A">

Просмотреть файл

@ -51,10 +51,6 @@
oncommand="document.getElementById('FindToolbar').onFindAgainCommand(false);"/>
<command id="cmd_findPrevious"
oncommand="document.getElementById('FindToolbar').onFindAgainCommand(true);"/>
#ifdef XP_MACOSX
<command id="cmd_findSelection"
oncommand="document.getElementById('FindToolbar').onFindSelectionCommand();"/>
#endif
<command id="cmd_reload" oncommand="ViewSourceReload();"/>
<command id="cmd_goToLine" oncommand="ViewSourceGoToLine();" disabled="true"/>
<command id="cmd_highlightSyntax" oncommand="highlightSyntax();"/>
@ -90,9 +86,6 @@
<key id="key_find" key="&findOnCmd.commandkey;" command="cmd_find" modifiers="accel"/>
<key id="key_findAgain" key="&findAgainCmd.commandkey;" command="cmd_findAgain" modifiers="accel"/>
<key id="key_findPrevious" key="&findAgainCmd.commandkey;" command="cmd_findPrevious" modifiers="accel,shift"/>
#ifdef XP_MACOSX
<key id="key_findSelection" key="&findSelectionCmd.commandkey;" command="cmd_findSelection" modifiers="accel"/>
#endif
<key keycode="&findAgainCmd.commandkey2;" command="cmd_findAgain"/>
<key keycode="&findAgainCmd.commandkey2;" command="cmd_findPrevious" modifiers="shift"/>

Просмотреть файл

@ -58,7 +58,6 @@
// Simulate typical input
textbox.focus();
gFindBar.clear();
sendChar("m");
ok(gFindBar.canClear, "canClear property true after input");
let preSelection = gBrowser.contentWindow.getSelection();

Просмотреть файл

@ -30,9 +30,6 @@
var gFindBar = null;
var gBrowser;
var gClipboard = Cc["@mozilla.org/widget/clipboard;1"].getService("nsIClipboard");
var gHasFindClipboard = gClipboard.supportsFindClipboard();
var gStatusText;
var gXULBrowserWindow = {
QueryInterface: function(aIID) {
@ -97,8 +94,7 @@
testFindbarSelection();
testDrop();
testQuickFindLink();
if (gHasFindClipboard)
testStatusText();
testStatusText();
testQuickFindClose();
}
@ -108,12 +104,8 @@
ok(!gFindBar.hidden, "testFindbarSelection: failed to open findbar: " + aTestName);
ok(document.commandDispatcher.focusedElement == gFindBar._findField.inputField,
"testFindbarSelection: find field is not focused: " + aTestName);
if (gHasFindClipboard) {
ok(gFindBar._findField.value == aExpSelection,
"Incorrect selection in testFindbarSelection: " + aTestName +
". Selection: " + gFindBar._findField.value);
}
testClipboardSearchString(aExpSelection);
ok(gFindBar._findField.value == aExpSelection,
"Incorrect selection in testFindbarSelection: " + aTestName + ". Selection: " + gFindBar._findField.value);
// Clear the value, close the findbar
gFindBar._findField.value = "";
@ -193,14 +185,12 @@
enterStringIntoFindField(searchStr);
ok(gBrowser.contentWindow.getSelection().toString().toLowerCase() == searchStr,
"testNormalFind: failed to find '" + searchStr + "'");
testClipboardSearchString(gBrowser.contentWindow.getSelection().toString());
if (!matchCaseCheckbox.hidden) {
matchCaseCheckbox.click();
enterStringIntoFindField("t");
ok(gBrowser.contentWindow.getSelection() != searchStr,
"testNormalFind: Case-sensitivy is broken '" + searchStr + "'");
testClipboardSearchString(gBrowser.contentWindow.getSelection().toString());
matchCaseCheckbox.click();
}
}
@ -238,7 +228,6 @@
ok(gBrowser.contentWindow.getSelection().toString().toLowerCase() != searchStr,
"testNormalFindWithComposition: text shouldn't be found during composition");
testClipboardSearchString(gBrowser.contentWindow.getSelection().toString());
synthesizeText(
{ "composition":
@ -254,7 +243,6 @@
ok(gBrowser.contentWindow.getSelection().toString().toLowerCase() == searchStr,
"testNormalFindWithComposition: text should be found after committing composition");
testClipboardSearchString(gBrowser.contentWindow.getSelection().toString());
if (clicked) {
matchCaseCheckbox.click();
@ -314,7 +302,6 @@
enterStringIntoFindField(searchStr);
ok(gBrowser.contentWindow.getSelection() == searchStr,
"testQuickFindLink: failed to find sample link");
testClipboardSearchString(searchStr);
}
function testQuickFindText() {
@ -332,18 +319,6 @@
enterStringIntoFindField(SEARCH_TEXT);
ok(gBrowser.contentWindow.getSelection() == SEARCH_TEXT,
"testQuickFindText: failed to find '" + SEARCH_TEXT + "'");
testClipboardSearchString(SEARCH_TEXT);
}
function testClipboardSearchString(aExpected) {
if (!gHasFindClipboard)
return;
if (!aExpected)
aExpected = "";
var searchStr = gFindBar.browser.finder.clipboardSearchString;
ok(searchStr == aExpected, "testClipboardSearchString: search string not " +
"set to '" + aExpected + "', instead found '" + searchStr + "'");
}
]]></script>

Просмотреть файл

@ -110,13 +110,6 @@
findbar.browser.finder.enableSelection();
]]></handler>
#ifdef XP_MACOSX
<handler event="focus"><![CDATA[
let findbar = this.findbar;
findbar._onFindFieldFocus();
]]></handler>
#endif
<handler event="compositionstart"><![CDATA[
// Don't close the find toolbar while IME is composing.
let findbar = this.findbar;
@ -1052,17 +1045,8 @@
userWantsPrefill =
prefsvc.getBoolPref("accessibility.typeaheadfind.prefillwithselection");
let initialString = null;
if (this.prefillWithSelection && userWantsPrefill)
initialString = this._getInitialSelection();
#ifdef XP_MACOSX
if (!initialString) {
let clipboardSearchString = this.browser.finder.clipboardSearchString;
if (clipboardSearchString)
initialString = clipboardSearchString;
}
#endif
let initialString = (this.prefillWithSelection && userWantsPrefill) ?
this._getInitialSelection() : null;
if (initialString)
this._findField.value = initialString;
@ -1118,32 +1102,6 @@
]]></body>
</method>
#ifdef XP_MACOSX
<!--
- Fetches the currently selected text and sets that as the text to search
- next. This is a MacOS specific feature.
-->
<method name="onFindSelectionCommand">
<body><![CDATA[
let searchString = this.browser.finder.setSearchStringToSelection();
if (searchString)
this._findField.value = searchString;
]]></body>
</method>
<method name="_onFindFieldFocus">
<body><![CDATA[
let clipboardSearchString = this._browser.finder.clipboardSearchString;
if (clipboardSearchString && this._findField.value != clipboardSearchString) {
this._findField.value = clipboardSearchString;
// Changing the search string makes the previous status invalid, so
// we better clear it here.
this._updateStatusUI();
}
]]></body>
</method>
#endif
<!--
- This handles all the result changes for both
- type-ahead-find and highlighting.
@ -1161,8 +1119,6 @@
<method name="onFindResult">
<parameter name="aData"/>
<body><![CDATA[
if (this._findField.value != this.browser.finder.searchString)
this._findField.value = this.browser.finder.searchString;
this._updateStatusUI(aData.result, aData.findBackwards);
this._updateStatusUIBar(aData.linkURL);

Просмотреть файл

@ -71,7 +71,6 @@ you can use these alternative items. Otherwise, their values should be empty. -
<!ENTITY findAgainCmd.accesskey "g">
<!ENTITY findAgainCmd.commandkey "g">
<!ENTITY findAgainCmd.commandkey2 "VK_F3">
<!ENTITY findSelectionCmd.commandkey "e">
<!ENTITY backCmd.label "Back">
<!ENTITY backCmd.accesskey "B">

Просмотреть файл

@ -12,16 +12,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Geometry.jsm");
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "TextToSubURIService",
"@mozilla.org/intl/texttosuburi;1",
"nsITextToSubURI");
XPCOMUtils.defineLazyServiceGetter(this, "Clipboard",
"@mozilla.org/widget/clipboard;1",
"nsIClipboard");
XPCOMUtils.defineLazyServiceGetter(this, "ClipboardHelper",
"@mozilla.org/widget/clipboardhelper;1",
"nsIClipboardHelper");
function Finder(docShell) {
this._fastFind = Cc["@mozilla.org/typeaheadfind;1"].createInstance(Ci.nsITypeAheadFind);
this._fastFind.init(docShell);
@ -48,7 +38,6 @@ Finder.prototype = {
_notify: function (aSearchString, aResult, aFindBackwards, aDrawOutline) {
this._searchString = aSearchString;
this.clipboardSearchString = aSearchString
this._outlineLink(aDrawOutline);
let foundLink = this._fastFind.foundLink;
@ -59,7 +48,12 @@ Finder.prototype = {
if (ownerDoc)
docCharset = ownerDoc.characterSet;
linkURL = TextToSubURIService.unEscapeURIForUI(docCharset, foundLink.href);
if (!this._textToSubURIService) {
this._textToSubURIService = Cc["@mozilla.org/intl/texttosuburi;1"]
.getService(Ci.nsITextToSubURI);
}
linkURL = this._textToSubURIService.unEscapeURIForUI(docCharset, foundLink.href);
}
let data = {
@ -76,48 +70,9 @@ Finder.prototype = {
},
get searchString() {
if (!this._searchString && this._fastFind.searchString)
this._searchString = this._fastFind.searchString;
return this._searchString;
},
get clipboardSearchString() {
let searchString = "";
if (!Clipboard.supportsFindClipboard())
return searchString;
try {
let trans = Cc["@mozilla.org/widget/transferable;1"]
.createInstance(Ci.nsITransferable);
trans.init(this._getWindow()
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsILoadContext));
trans.addDataFlavor("text/unicode");
Clipboard.getData(trans, Ci.nsIClipboard.kFindClipboard);
let data = {};
let dataLen = {};
trans.getTransferData("text/unicode", data, dataLen);
if (data.value) {
data = data.value.QueryInterface(Ci.nsISupportsString);
searchString = data.toString();
}
} catch (ex) {}
return searchString;
},
set clipboardSearchString(aSearchString) {
if (!aSearchString || !Clipboard.supportsFindClipboard())
return;
ClipboardHelper.copyStringToClipboard(aSearchString,
Ci.nsIClipboard.kFindClipboard,
this._getWindow().document);
},
set caseSensitive(aSensitive) {
this._fastFind.caseSensitive = aSensitive;
},
@ -150,25 +105,6 @@ Finder.prototype = {
this._notify(searchString, result, aFindBackwards, aDrawOutline);
},
/**
* Forcibly set the search string of the find clipboard to the currently
* selected text in the window, on supported platforms (i.e. OSX).
*/
setSearchStringToSelection: function() {
// Find the selected text.
let selection = this._getWindow().getSelection();
// Don't go for empty selections.
if (!selection.rangeCount)
return null;
let searchString = (selection.toString() || "").trim();
// Empty strings are rather useless to search for.
if (!searchString.length)
return null;
this.clipboardSearchString = searchString;
return searchString;
},
highlight: function (aHighlight, aWord) {
let found = this._highlight(aHighlight, aWord, null);
if (aHighlight) {

Просмотреть файл

@ -109,9 +109,3 @@ nsClipboard::SupportsSelectionClipboard(bool *aIsSupported)
return NS_OK;
}
NS_IMETHODIMP
nsClipboard::SupportsFindClipboard(bool* _retval)
{
*_retval = false;
return NS_OK;
}

Просмотреть файл

@ -23,7 +23,6 @@ public:
// nsIClipboard
NS_IMETHOD HasDataMatchingFlavors(const char** aFlavorList, uint32_t aLength,
int32_t aWhichClipboard, bool *_retval);
NS_IMETHOD SupportsFindClipboard(bool *_retval);
// Helper methods, used also by nsDragService
static NSDictionary* PasteboardDictFromTransferable(nsITransferable *aTransferable);
@ -38,12 +37,7 @@ protected:
NS_IMETHOD GetNativeClipboardData(nsITransferable * aTransferable, int32_t aWhichClipboard);
private:
// This is always set to the native change count after any modification of the
// general clipboard.
int mChangeCountGeneral;
// This is always set to the native change count after any modification of the
// find clipboard.
int mChangeCountFind;
int mChangeCount; // this is always set to the native change count after any clipboard modifications
};

Просмотреть файл

@ -35,8 +35,7 @@ extern void EnsureLogInitialized();
nsClipboard::nsClipboard() : nsBaseClipboard()
{
mChangeCountGeneral = 0;
mChangeCountFind = 0;
mChangeCount = 0;
EnsureLogInitialized();
}
@ -66,7 +65,7 @@ nsClipboard::SetNativeClipboardData(int32_t aWhichClipboard)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
if ((aWhichClipboard != kGlobalClipboard && aWhichClipboard != kFindClipboard) || !mTransferable)
if ((aWhichClipboard != kGlobalClipboard) || !mTransferable)
return NS_ERROR_FAILURE;
mIgnoreEmptyNotification = true;
@ -75,44 +74,28 @@ nsClipboard::SetNativeClipboardData(int32_t aWhichClipboard)
if (!pasteboardOutputDict)
return NS_ERROR_FAILURE;
// write everything out to the general pasteboard
unsigned int outputCount = [pasteboardOutputDict count];
NSArray* outputKeys = [pasteboardOutputDict allKeys];
NSPasteboard* cocoaPasteboard;
if (aWhichClipboard == kFindClipboard) {
cocoaPasteboard = [NSPasteboard pasteboardWithName:NSFindPboard];
[cocoaPasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
} else {
// Write everything else out to the general pasteboard.
cocoaPasteboard = [NSPasteboard generalPasteboard];
[cocoaPasteboard declareTypes:outputKeys owner:nil];
}
NSPasteboard* generalPBoard = [NSPasteboard generalPasteboard];
[generalPBoard declareTypes:outputKeys owner:nil];
for (unsigned int i = 0; i < outputCount; i++) {
NSString* currentKey = [outputKeys objectAtIndex:i];
id currentValue = [pasteboardOutputDict valueForKey:currentKey];
if (aWhichClipboard == kFindClipboard) {
if (currentKey == NSStringPboardType)
[cocoaPasteboard setString:currentValue forType:currentKey];
if (currentKey == NSStringPboardType ||
currentKey == kCorePboardType_url ||
currentKey == kCorePboardType_urld ||
currentKey == kCorePboardType_urln) {
[generalPBoard setString:currentValue forType:currentKey];
} else if (currentKey == NSHTMLPboardType) {
[generalPBoard setString:(nsClipboard::WrapHtmlForSystemPasteboard(currentValue))
forType:currentKey];
} else {
if (currentKey == NSStringPboardType ||
currentKey == kCorePboardType_url ||
currentKey == kCorePboardType_urld ||
currentKey == kCorePboardType_urln) {
[cocoaPasteboard setString:currentValue forType:currentKey];
} else if (currentKey == NSHTMLPboardType) {
[cocoaPasteboard setString:(nsClipboard::WrapHtmlForSystemPasteboard(currentValue))
forType:currentKey];
} else {
[cocoaPasteboard setData:currentValue forType:currentKey];
}
[generalPBoard setData:currentValue forType:currentKey];
}
}
if (aWhichClipboard == kFindClipboard) {
mChangeCountFind = [cocoaPasteboard changeCount];
} else {
mChangeCountGeneral = [cocoaPasteboard changeCount];
}
mChangeCount = [generalPBoard changeCount];
mIgnoreEmptyNotification = false;
@ -255,15 +238,10 @@ nsClipboard::GetNativeClipboardData(nsITransferable* aTransferable, int32_t aWhi
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
if ((aWhichClipboard != kGlobalClipboard && aWhichClipboard != kFindClipboard) || !aTransferable)
if ((aWhichClipboard != kGlobalClipboard) || !aTransferable)
return NS_ERROR_FAILURE;
NSPasteboard* cocoaPasteboard;
if (aWhichClipboard == kFindClipboard) {
cocoaPasteboard = [NSPasteboard pasteboardWithName:NSFindPboard];
} else {
cocoaPasteboard = [NSPasteboard generalPasteboard];
}
NSPasteboard* cocoaPasteboard = [NSPasteboard generalPasteboard];
if (!cocoaPasteboard)
return NS_ERROR_FAILURE;
@ -276,10 +254,9 @@ nsClipboard::GetNativeClipboardData(nsITransferable* aTransferable, int32_t aWhi
uint32_t flavorCount;
flavorList->Count(&flavorCount);
int changeCount = (aWhichClipboard == kFindClipboard) ? mChangeCountFind : mChangeCountGeneral;
// If we were the last ones to put something on the pasteboard, then just use the cached
// transferable. Otherwise clear it because it isn't relevant any more.
if (changeCount == [cocoaPasteboard changeCount]) {
if (mChangeCount == [cocoaPasteboard changeCount]) {
if (mTransferable) {
for (uint32_t i = 0; i < flavorCount; i++) {
nsCOMPtr<nsISupports> genericFlavor;
@ -300,8 +277,9 @@ nsClipboard::GetNativeClipboardData(nsITransferable* aTransferable, int32_t aWhi
}
}
}
} else {
nsBaseClipboard::EmptyClipboard(aWhichClipboard);
}
else {
nsBaseClipboard::EmptyClipboard(kGlobalClipboard);
}
// at this point we can't satisfy the request from cache data so let's look
@ -380,14 +358,6 @@ nsClipboard::HasDataMatchingFlavors(const char** aFlavorList, uint32_t aLength,
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NS_IMETHODIMP
nsClipboard::SupportsFindClipboard(bool *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = true;
return NS_OK;
}
// This function converts anything that other applications might understand into the system format
// and puts it into a dictionary which it returns.
// static

Просмотреть файл

@ -448,13 +448,6 @@ nsClipboard::SupportsSelectionClipboard(bool *_retval)
return NS_OK;
}
NS_IMETHODIMP
nsClipboard::SupportsFindClipboard(bool* _retval)
{
*_retval = false;
return NS_OK;
}
/* static */
GdkAtom
nsClipboard::GetSelectionAtom(int32_t aWhichClipboard)

Просмотреть файл

@ -11,12 +11,11 @@
interface nsIArray;
[scriptable, uuid(ceaa0047-647f-4b8e-ad1c-aff9fa62aa51)]
[scriptable, uuid(38984945-8674-4d04-b786-5c0ca9434457)]
interface nsIClipboard : nsISupports
{
const long kSelectionClipboard = 0;
const long kGlobalClipboard = 1;
const long kFindClipboard = 2;
/**
* Given a transferable, set the data on the native clipboard
@ -74,14 +73,6 @@ interface nsIClipboard : nsISupports
* @result NS_OK if successful.
*/
boolean supportsSelectionClipboard ( ) ;
/**
* Allows clients to determine if the implementation supports the concept of a
* separate clipboard for find search strings.
*
* @result NS_OK if successful.
*/
boolean supportsFindClipboard ( ) ;
};

Просмотреть файл

@ -556,12 +556,3 @@ nsClipboard::SupportsSelectionClipboard(bool *_retval)
return NS_OK;
}
NS_IMETHODIMP
nsClipboard::SupportsFindClipboard(bool* _retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = false;
return NS_OK;
}

Просмотреть файл

@ -22,7 +22,6 @@ nsBaseClipboard::~nsBaseClipboard()
{
EmptyClipboard(kSelectionClipboard);
EmptyClipboard(kGlobalClipboard);
EmptyClipboard(kFindClipboard);
}
NS_IMPL_ISUPPORTS1(nsBaseClipboard, nsIClipboard)
@ -40,9 +39,7 @@ NS_IMETHODIMP nsBaseClipboard::SetData(nsITransferable * aTransferable, nsIClipb
return NS_OK;
bool selectClipPresent;
SupportsSelectionClipboard(&selectClipPresent);
bool findClipPresent;
SupportsFindClipboard(&findClipPresent);
if ( !selectClipPresent && !findClipPresent && aWhichClipboard != kGlobalClipboard )
if ( !selectClipPresent && aWhichClipboard != kGlobalClipboard )
return NS_ERROR_FAILURE;
mEmptyingForSetData = true;
@ -78,12 +75,10 @@ NS_IMETHODIMP nsBaseClipboard::SetData(nsITransferable * aTransferable, nsIClipb
NS_IMETHODIMP nsBaseClipboard::GetData(nsITransferable * aTransferable, int32_t aWhichClipboard)
{
NS_ASSERTION ( aTransferable, "clipboard given a null transferable" );
bool selectClipPresent;
SupportsSelectionClipboard(&selectClipPresent);
bool findClipPresent;
SupportsFindClipboard(&findClipPresent);
if ( !selectClipPresent && !findClipPresent && aWhichClipboard != kGlobalClipboard )
if ( !selectClipPresent && aWhichClipboard != kGlobalClipboard )
return NS_ERROR_FAILURE;
if ( aTransferable )
@ -96,9 +91,7 @@ NS_IMETHODIMP nsBaseClipboard::EmptyClipboard(int32_t aWhichClipboard)
{
bool selectClipPresent;
SupportsSelectionClipboard(&selectClipPresent);
bool findClipPresent;
SupportsFindClipboard(&findClipPresent);
if ( !selectClipPresent && !findClipPresent && aWhichClipboard != kGlobalClipboard )
if ( !selectClipPresent && aWhichClipboard != kGlobalClipboard )
return NS_ERROR_FAILURE;
if (mIgnoreEmptyNotification)
@ -130,10 +123,3 @@ nsBaseClipboard::SupportsSelectionClipboard(bool* _retval)
*_retval = false; // we don't support the selection clipboard by default.
return NS_OK;
}
NS_IMETHODIMP
nsBaseClipboard::SupportsFindClipboard(bool* _retval)
{
*_retval = false; // we don't support the find clipboard by default.
return NS_OK;
}

Просмотреть файл

@ -51,25 +51,16 @@ nsClipboardHelper::CopyStringToClipboard(const nsAString& aString,
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(clipboard, NS_ERROR_FAILURE);
bool clipboardSupported;
// don't go any further if they're asking for the selection
// clipboard on a platform which doesn't support it (i.e., unix)
if (nsIClipboard::kSelectionClipboard == aClipboardID) {
bool clipboardSupported;
rv = clipboard->SupportsSelectionClipboard(&clipboardSupported);
NS_ENSURE_SUCCESS(rv, rv);
if (!clipboardSupported)
return NS_ERROR_FAILURE;
}
// don't go any further if they're asking for the find clipboard on a platform
// which doesn't support it (i.e., non-osx)
if (nsIClipboard::kFindClipboard == aClipboardID) {
rv = clipboard->SupportsFindClipboard(&clipboardSupported);
NS_ENSURE_SUCCESS(rv, rv);
if (!clipboardSupported)
return NS_ERROR_FAILURE;
}
// create a transferable for putting data on the clipboard
nsCOMPtr<nsITransferable>
trans(do_CreateInstance("@mozilla.org/widget/transferable;1", &rv));

Просмотреть файл

@ -91,10 +91,3 @@ nsClipboardProxy::SupportsSelectionClipboard(bool *aIsSupported)
return NS_OK;
}
NS_IMETHODIMP
nsClipboardProxy::SupportsFindClipboard(bool *aIsSupported)
{
*aIsSupported = false;
return NS_OK;
}