Bug 1166840 - Remove unused document argument in uses of nsIClipboardHelper.copyString. r=ehsan

This commit is contained in:
Birunthan Mohanathas 2015-05-21 21:49:30 +01:00
parent be14835d3a
commit c325827ed4
30 changed files with 47 additions and 49 deletions

View File

@ -1433,13 +1433,13 @@ nsContextMenu.prototype = {
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboard.copyString(addresses, document);
clipboard.copyString(addresses);
},
copyLink: function() {
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboard.copyString(this.linkURL, document);
clipboard.copyString(this.linkURL);
},
///////////////
@ -1691,7 +1691,7 @@ nsContextMenu.prototype = {
copyMediaLocation : function () {
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboard.copyString(this.mediaURL, document);
clipboard.copyString(this.mediaURL);
},
drmLearnMore: function(aEvent) {

View File

@ -1253,7 +1253,7 @@ function doCopy()
elem.removeAttribute("copybuffer");
}
}
gClipboardHelper.copyString(text.join("\n"), document);
gClipboardHelper.copyString(text.join("\n"));
}
}

View File

@ -32,7 +32,7 @@ function test() {
// Put a multi-line string in the clipboard.
// Setting the clipboard value is an async OS operation, so we need to poll
// the clipboard for valid data before going on.
waitForClipboard(kTestString, function() { cbHelper.copyString(kTestString, document); },
waitForClipboard(kTestString, function() { cbHelper.copyString(kTestString); },
next_test, finish);
}

View File

@ -14,7 +14,7 @@ add_task(function* () {
SimpleTest.waitForClipboard(url, () => {
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper)
.copyString(url, document);
.copyString(url);
}, resolve, () => {
ok(false, "Clipboard copy failed");
reject();

View File

@ -596,7 +596,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper)
.copyString(val, document);
.copyString(val);
},
supportsCommand: function(aCommand) {
switch (aCommand) {
@ -969,7 +969,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper)
.copyStringToClipboard(val, Ci.nsIClipboard.kSelectionClipboard, document);
.copyStringToClipboard(val, Ci.nsIClipboard.kSelectionClipboard);
]]></handler>
</handlers>

View File

@ -1208,7 +1208,7 @@ DownloadsPlacesView.prototype = {
Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper)
.copyString(urls.join("\n"), document);
.copyString(urls.join("\n"));
},
_getURLFromClipboardData() {

View File

@ -1262,7 +1262,7 @@ DownloadsViewItemController.prototype = {
downloadsCmd_copyLocation() {
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
clipboard.copyString(this.download.source.url, document);
clipboard.copyString(this.download.source.url);
},
downloadsCmd_doDefault() {

View File

@ -910,7 +910,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
if (!selected) {
return;
}
clipboardHelper.copyString(selected.source.url, document);
clipboardHelper.copyString(selected.source.url);
},
/**

View File

@ -2214,7 +2214,7 @@ MarkupElementContainer.prototype = Heritage.extend(MarkupContainer.prototype, {
// the tooltip, because we want the full-size image
this.node.getImageData().then(data => {
data.data.string().then(str => {
clipboardHelper.copyString(str, this.markup.doc);
clipboardHelper.copyString(str);
});
});
},

View File

@ -563,7 +563,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
*/
copyUrl: function() {
let selected = this.selectedItem.attachment;
clipboardHelper.copyString(selected.url, document);
clipboardHelper.copyString(selected.url);
},
/**
@ -573,7 +573,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
let selected = this.selectedItem.attachment;
let params = nsIURL(selected.url).query.split("&");
let string = params.join(Services.appinfo.OS === "WINNT" ? "\r\n" : "\n");
clipboardHelper.copyString(string, document);
clipboardHelper.copyString(string);
},
/**
@ -650,7 +650,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
}
}
clipboardHelper.copyString(string, document);
clipboardHelper.copyString(string);
}),
/**
@ -681,7 +681,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
data.postDataText = yield gNetwork.getString(postData);
}
clipboardHelper.copyString(Curl.generateCommand(data), document);
clipboardHelper.copyString(Curl.generateCommand(data));
});
},
@ -694,7 +694,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
if (Services.appinfo.OS !== "WINNT") {
rawHeaders = rawHeaders.replace(/\r/g, "");
}
clipboardHelper.copyString(rawHeaders, document);
clipboardHelper.copyString(rawHeaders);
},
/**
@ -706,7 +706,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
if (Services.appinfo.OS !== "WINNT") {
rawHeaders = rawHeaders.replace(/\r/g, "");
}
clipboardHelper.copyString(rawHeaders, document);
clipboardHelper.copyString(rawHeaders);
},
/**
@ -718,7 +718,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
gNetwork.getString(text).then(aString => {
let data = "data:" + mimeType + ";" + encoding + "," + aString;
clipboardHelper.copyString(data, document);
clipboardHelper.copyString(data);
});
},
@ -730,7 +730,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
let text = selected.responseContent.content.text;
gNetwork.getString(text).then(aString => {
clipboardHelper.copyString(aString, document);
clipboardHelper.copyString(aString);
});
},

View File

@ -816,7 +816,7 @@ CssHtmlTree.prototype = {
},
_onCopyColor: function() {
clipboardHelper.copyString(this._colorToCopy, this.styleDocument);
clipboardHelper.copyString(this._colorToCopy);
},
/**
@ -854,7 +854,7 @@ CssHtmlTree.prototype = {
result = textArray[0];
}
clipboardHelper.copyString(result, this.styleDocument);
clipboardHelper.copyString(result);
if (event) {
event.preventDefault();

View File

@ -1511,7 +1511,7 @@ CssRuleView.prototype = {
text = text.replace(rx, "");
}
clipboardHelper.copyString(text, this.doc);
clipboardHelper.copyString(text);
event.preventDefault();
} catch(e) {
console.error(e);
@ -1522,7 +1522,7 @@ CssRuleView.prototype = {
* Copy the most recently selected color value to clipboard.
*/
_onCopyColor: function() {
clipboardHelper.copyString(this._colorToCopy, this.styleDocument);
clipboardHelper.copyString(this._colorToCopy);
},
/**

View File

@ -39,7 +39,7 @@ function consoleOpened(HUD) {
waitForClipboard(
stringToCopy,
function() {
clipboardHelper.copyString(stringToCopy, document);
clipboardHelper.copyString(stringToCopy);
},
onClipboardCopy,
finishTest);

View File

@ -2874,7 +2874,7 @@ WebConsoleFrame.prototype = {
}
}
clipboardHelper.copyString(strings.join("\n"), this.document);
clipboardHelper.copyString(strings.join("\n"));
},
/**

View File

@ -47,8 +47,7 @@ function selectArea()
var clipboardHelper = SpecialPowers.Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(SpecialPowers.Ci.nsIClipboardHelper);
clipboardHelper.copyStringToClipboard("COPY TEXT",
SpecialPowers.Ci.nsIClipboard.kSelectionClipboard,
document);
SpecialPowers.Ci.nsIClipboard.kSelectionClipboard);
}
setTimeout(checkSelectionClipboardText, 50, 0);

View File

@ -40,7 +40,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=830600
function() {
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper)
.copyString(str, document);
.copyString(str);
},
function() {
synthesizeKey("V", {accelKey: true});

View File

@ -329,7 +329,7 @@ var ActionBarHandler = {
let selectedText = ActionBarHandler._getSelectedText();
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboard.copyString(selectedText, win.document);
clipboard.copyString(selectedText);
let msg = Strings.browser.GetStringFromName("selectionHelper.textCopied");
NativeWindow.toast.show(msg, "short");
@ -364,7 +364,7 @@ var ActionBarHandler = {
let selectedText = ActionBarHandler._getSelectedText();
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboard.copyString(selectedText, win.document);
clipboard.copyString(selectedText);
let msg = Strings.browser.GetStringFromName("selectionHelper.textCopied");
NativeWindow.toast.show(msg, "short");

View File

@ -1098,7 +1098,7 @@ var SelectionHandler = {
let selectedText = this._getSelectedText();
if (selectedText.length) {
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
clipboard.copyString(selectedText, this._contentWindow.document);
clipboard.copyString(selectedText);
NativeWindow.toast.show(Strings.browser.GetStringFromName("selectionHelper.textCopied"), "short");
}
this._closeSelection();

View File

@ -361,7 +361,7 @@ function testAttachCaretFail() {
function testPaste() {
let sh = getSelectionHandler();
let clipboard = getClipboard();
clipboard.copyString(PASTE_TEXT, document);
clipboard.copyString(PASTE_TEXT);
// Add a contentEditable element to the document.
let div = document.createElement("div");

View File

@ -1570,7 +1570,7 @@ SpecialPowersAPI.prototype = {
copyString: function(str, doc) {
Components.classes["@mozilla.org/widget/clipboardhelper;1"].
getService(Components.interfaces.nsIClipboardHelper).
copyString(str, doc);
copyString(str);
},
openDialog: function(win, args) {
@ -1654,7 +1654,7 @@ SpecialPowersAPI.prototype = {
clipboardCopyString: function(preExpectedVal, doc) {
var cbHelperSvc = Components.classes["@mozilla.org/widget/clipboardhelper;1"].
getService(Components.interfaces.nsIClipboardHelper);
cbHelperSvc.copyString(preExpectedVal, doc);
cbHelperSvc.copyString(preExpectedVal);
},
supportsSelectionClipboard: function() {

View File

@ -295,7 +295,7 @@
const clipI = Components.interfaces.nsIClipboardHelper;
var clipboard = Components.classes[clipURI].getService(clipI);
clipboard.copyString(this.mSelectedItem.toString(), document);
clipboard.copyString(this.mSelectedItem.toString());
} catch (ex) {
// Unable to copy anything, die quietly
}

View File

@ -363,7 +363,7 @@ function CopyPassword() {
getService(Components.interfaces.nsIClipboardHelper);
var row = document.getElementById("signonsTree").currentIndex;
var password = signonsTreeView.getCellText(row, {id : "passwordCol" });
clipboard.copyString(password, document);
clipboard.copyString(password);
Services.telemetry.getHistogramById("PWMGR_MANAGE_COPIED_PASSWORD").add(1);
}

View File

@ -535,17 +535,17 @@ function updateContextMenu()
function copyPref()
{
var pref = gPrefView[view.selection.currentIndex];
gClipboardHelper.copyString(pref.prefCol + ';' + pref.valueCol, document);
gClipboardHelper.copyString(pref.prefCol + ';' + pref.valueCol);
}
function copyName()
{
gClipboardHelper.copyString(gPrefView[view.selection.currentIndex].prefCol, document);
gClipboardHelper.copyString(gPrefView[view.selection.currentIndex].prefCol);
}
function copyValue()
{
gClipboardHelper.copyString(gPrefView[view.selection.currentIndex].valueCol, document);
gClipboardHelper.copyString(gPrefView[view.selection.currentIndex].valueCol);
}
function ModifySelected()

View File

@ -498,7 +498,7 @@ let ViewSourceChrome = {
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
.getService(Ci.nsIClipboardHelper);
clipboard.copyString(this.contextMenuData.href, document);
clipboard.copyString(this.contextMenuData.href);
},
/**

View File

@ -110,7 +110,7 @@ function runTest() {
gACTimer = Date.now();
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper)
.copyStringToClipboard(SEARCH_STRING, Components.interfaces.nsIClipboard.kGlobalClipboard, document);
.copyStringToClipboard(SEARCH_STRING, Components.interfaces.nsIClipboard.kGlobalClipboard);
}, cbCallback, cbCallback);
}
]]>

View File

@ -69,7 +69,7 @@ var expectedResults = {
SimpleTest.waitForClipboard(testString, function() {
var clip = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
.getService(Components.interfaces.nsIClipboardHelper);
clip.copyString(testString, document);
clip.copyString(testString);
}, function() {
for (let [item, expected] in Iterator(expectedResults)) {
testPaste(item, $(item), expected);

View File

@ -103,8 +103,7 @@ Finder.prototype = {
return;
ClipboardHelper.copyStringToClipboard(aSearchString,
Ci.nsIClipboard.kFindClipboard,
this._getWindow().document);
Ci.nsIClipboard.kFindClipboard);
},
set caseSensitive(aSensitive) {

View File

@ -321,7 +321,7 @@ function copySourceLocation(aDownload)
if (gPerformAllCallback === null) {
let uris = [];
gPerformAllCallback = function(aURI) aURI ? uris.push(aURI) :
clipboard.copyString(uris.join("\n"), document);
clipboard.copyString(uris.join("\n"));
}
// We have a callback to use, so use it to add a uri
@ -329,7 +329,7 @@ function copySourceLocation(aDownload)
gPerformAllCallback(uri);
else {
// It's a plain copy source, so copy it
clipboard.copyString(uri, document);
clipboard.copyString(uri);
}
}

View File

@ -570,7 +570,7 @@ DownloadItem.prototype = {
case "cmd_copyLocation":
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
clipboard.copyString(this.uri, document);
clipboard.copyString(this.uri);
break;
}
},

View File

@ -65,7 +65,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=948065
const data = "random number: " + Math.random();
let helper = Cc['@mozilla.org/widget/clipboardhelper;1']
.getService(Ci.nsIClipboardHelper);
helper.copyString(data, document);
helper.copyString(data);
is(paste(clipboard), data, 'Data was successfully copied.');
// Test emptyClipboard, disabled for OSX because bug 666254