Bug 1166840 - Remove unused document argument in uses of nsIClipboardHelper.copyString. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 21 May 2015 21:49:30 +0100
changeset 245220 b83845e4117ceffbfd3726b1cd46c1b5af96354b
parent 245219 8eedc5073619e21e6843c5d72e0a58e3b2a79d30
child 245221 ec14eee472e5a5c5ed4be338f6d32d8716b99557
push id28799
push userphilringnalda@gmail.com
push dateSat, 23 May 2015 20:31:44 +0000
treeherdermozilla-central@c3c0928c3cde [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1166840
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1166840 - Remove unused document argument in uses of nsIClipboardHelper.copyString. r=ehsan
browser/base/content/nsContextMenu.js
browser/base/content/pageinfo/pageInfo.js
browser/base/content/test/general/browser_bug321000.js
browser/base/content/test/general/browser_middleMouse_noJSPaste.js
browser/base/content/urlbarBindings.xml
browser/components/downloads/content/allDownloadsViewOverlay.js
browser/components/downloads/content/downloads.js
browser/devtools/debugger/views/sources-view.js
browser/devtools/markupview/markup-view.js
browser/devtools/netmonitor/netmonitor-view.js
browser/devtools/styleinspector/computed-view.js
browser/devtools/styleinspector/rule-view.js
browser/devtools/webconsole/test/browser_webconsole_autocomplete_and_selfxss.js
browser/devtools/webconsole/webconsole.js
dom/tests/mochitest/general/test_paste_selection.html
editor/libeditor/tests/test_bug830600.html
mobile/android/chrome/content/ActionBarHandler.js
mobile/android/chrome/content/SelectionHandler.js
mobile/android/tests/browser/robocop/roboextender/testSelectionHandler.html
testing/specialpowers/content/specialpowersAPI.js
toolkit/components/console/content/consoleBindings.xml
toolkit/components/passwordmgr/content/passwordManager.js
toolkit/components/viewconfig/content/config.js
toolkit/components/viewsource/content/viewSource.js
toolkit/content/tests/chrome/test_autocomplete_delayOnPaste.xul
toolkit/content/tests/chrome/test_bug253481.xul
toolkit/modules/Finder.jsm
toolkit/mozapps/downloads/content/downloads.js
webapprt/content/downloads/downloads.js
widget/tests/test_clipboard.xul
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -1428,23 +1428,23 @@ nsContextMenu.prototype = {
                                                 addresses);
     }
     catch(ex) {
       // Do nothing.
     }
 
     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);
   },
 
   ///////////////
   // Utilities //
   ///////////////
 
   // Show/hide one item (specified via name or the item element itself).
   showItem: function(aItemOrId, aShow) {
@@ -1686,17 +1686,17 @@ nsContextMenu.prototype = {
     mm.sendAsyncMessage("ContextMenu:MediaCommand",
                         {command: command, data: data},
                         {element: this.target});
   },
 
   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) {
     let drmInfoURL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
     let dest = whereToOpenLink(aEvent);
     // Don't ever want this to open in the same tab as it'll unload the
     // DRM'd video, which is going to be a bad idea in most cases.
     if (dest == "current") {
--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -1248,17 +1248,17 @@ function doCopy()
         view.performActionOnRow("copy", row);
 
         tmp = elem.getAttribute("copybuffer");
         if (tmp)
           text.push(tmp);
         elem.removeAttribute("copybuffer");
       }
     }
-    gClipboardHelper.copyString(text.join("\n"), document);
+    gClipboardHelper.copyString(text.join("\n"));
   }
 }
 
 function doSelectAllMedia()
 {
   var tree = document.getElementById("imagetree");
 
   if (tree)
--- a/browser/base/content/test/general/browser_bug321000.js
+++ b/browser/base/content/test/general/browser_bug321000.js
@@ -27,17 +27,17 @@ function test() {
   waitForExplicitFinish();
 
   let cbHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
                  getService(Ci.nsIClipboardHelper);
 
   // 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);
 }
 
 function next_test() {
   if (gTests.length)
     test_paste(gTests.shift());
   else
     finish();
--- a/browser/base/content/test/general/browser_middleMouse_noJSPaste.js
+++ b/browser/base/content/test/general/browser_middleMouse_noJSPaste.js
@@ -9,17 +9,17 @@ add_task(function* () {
 
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser);
 
   let url = "javascript:http://www.example.com/";
   yield new Promise((resolve, reject) => {
     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();
     });
   });
 
   let middlePagePromise = BrowserTestUtils.browserLoaded(tab.linkedBrowser);
 
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -591,17 +591,17 @@ file, You can obtain one at http://mozil
               event.initUIEvent("input", true, false, window, 0);
               urlbar.dispatchEvent(event);
 
               SetPageProxyState("invalid");
             }
 
             Cc["@mozilla.org/widget/clipboardhelper;1"]
               .getService(Ci.nsIClipboardHelper)
-              .copyString(val, document);
+              .copyString(val);
           },
           supportsCommand: function(aCommand) {
             switch (aCommand) {
               case "cmd_copy":
               case "cmd_cut":
                 return true;
             }
             return false;
@@ -964,17 +964,17 @@ file, You can obtain one at http://mozil
           return;
 
         var val = this._getSelectedValueForClipboard();
         if (!val)
           return;
 
         Cc["@mozilla.org/widget/clipboardhelper;1"]
           .getService(Ci.nsIClipboardHelper)
-          .copyStringToClipboard(val, Ci.nsIClipboard.kSelectionClipboard, document);
+          .copyStringToClipboard(val, Ci.nsIClipboard.kSelectionClipboard);
       ]]></handler>
     </handlers>
 
   </binding>
 
   <!-- Note: this binding is applied to the autocomplete popup used in the Search bar and in web page content -->
   <binding id="browser-autocomplete-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-result-popup">
     <implementation>
--- a/browser/components/downloads/content/allDownloadsViewOverlay.js
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.js
@@ -1203,17 +1203,17 @@ DownloadsPlacesView.prototype = {
   },
 
   _copySelectedDownloadsToClipboard() {
     let urls = [for (element of this._richlistbox.selectedItems)
                 element._shell.download.source.url];
 
     Cc["@mozilla.org/widget/clipboardhelper;1"]
       .getService(Ci.nsIClipboardHelper)
-      .copyString(urls.join("\n"), document);
+      .copyString(urls.join("\n"));
   },
 
   _getURLFromClipboardData() {
     let trans = Cc["@mozilla.org/widget/transferable;1"].
                 createInstance(Ci.nsITransferable);
     trans.init(null);
 
     let flavors = ["text/x-moz-url", "text/unicode"];
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -1257,17 +1257,17 @@ DownloadsViewItemController.prototype = 
 
     downloadsCmd_openReferrer() {
       openURL(this.download.source.referrer);
     },
 
     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() {
       const nsIDM = Ci.nsIDownloadManager;
 
       // Determine the default command for the current item.
       let defaultCommand = function () {
         switch (DownloadsCommon.stateOfDownload(this.download)) {
--- a/browser/devtools/debugger/views/sources-view.js
+++ b/browser/devtools/debugger/views/sources-view.js
@@ -905,17 +905,17 @@ SourcesView.prototype = Heritage.extend(
   /**
    * Copy the source url from the currently selected item.
    */
   _onCopyUrlCommand: function() {
     let selected = this.selectedItem && this.selectedItem.attachment;
     if (!selected) {
       return;
     }
-    clipboardHelper.copyString(selected.source.url, document);
+    clipboardHelper.copyString(selected.source.url);
   },
 
   /**
    * Opens selected item source in a new tab.
    */
   _onNewTabCommand: function() {
     let win = Services.wm.getMostRecentWindow("navigator:browser");
     let selected = this.selectedItem.attachment;
--- a/browser/devtools/markupview/markup-view.js
+++ b/browser/devtools/markupview/markup-view.js
@@ -2209,17 +2209,17 @@ MarkupElementContainer.prototype = Herit
     });
   },
 
   copyImageDataUri: function() {
     // We need to send again a request to gettooltipData even if one was sent for
     // 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);
       });
     });
   },
 
   setSingleTextChild: function(singleTextChild) {
     this.singleTextChild = singleTextChild;
     this.editor.updateTextEditor();
   },
--- a/browser/devtools/netmonitor/netmonitor-view.js
+++ b/browser/devtools/netmonitor/netmonitor-view.js
@@ -558,27 +558,27 @@ RequestsMenuView.prototype = Heritage.ex
     win.openUILinkIn(selected.url, "tab", { relatedToCurrent: true });
   },
 
   /**
    * Copy the request url from the currently selected item.
    */
   copyUrl: function() {
     let selected = this.selectedItem.attachment;
-    clipboardHelper.copyString(selected.url, document);
+    clipboardHelper.copyString(selected.url);
   },
 
   /**
    * Copy the request url query string parameters from the currently selected item.
    */
   copyUrlParams: function() {
     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);
   },
 
   /**
    * Extracts any urlencoded form data sections (e.g. "?foo=bar&baz=42") from a
    * POST request.
    *
    * @param object aHeaders
    *        The "requestHeaders".
@@ -645,17 +645,17 @@ RequestsMenuView.prototype = Heritage.ex
     if (!string) {
       let postData = selected.requestPostData.postData.text;
       string = yield gNetwork.getString(postData);
       if (Services.appinfo.OS !== "WINNT") {
         string = string.replace(/\r/g, "");
       }
     }
 
-    clipboardHelper.copyString(string, document);
+    clipboardHelper.copyString(string);
   }),
 
   /**
    * Copy a cURL command from the currently selected item.
    */
   copyAsCurl: function() {
     let selected = this.selectedItem.attachment;
 
@@ -676,66 +676,66 @@ RequestsMenuView.prototype = Heritage.ex
       }
 
       // Fetch the request payload.
       if (selected.requestPostData) {
         let postData = selected.requestPostData.postData.text;
         data.postDataText = yield gNetwork.getString(postData);
       }
 
-      clipboardHelper.copyString(Curl.generateCommand(data), document);
+      clipboardHelper.copyString(Curl.generateCommand(data));
     });
   },
 
   /**
    * Copy the raw request headers from the currently selected item.
    */
   copyRequestHeaders: function() {
     let selected = this.selectedItem.attachment;
     let rawHeaders = selected.requestHeaders.rawHeaders.trim();
     if (Services.appinfo.OS !== "WINNT") {
       rawHeaders = rawHeaders.replace(/\r/g, "");
     }
-    clipboardHelper.copyString(rawHeaders, document);
+    clipboardHelper.copyString(rawHeaders);
   },
 
   /**
    * Copy the raw response headers from the currently selected item.
    */
   copyResponseHeaders: function() {
     let selected = this.selectedItem.attachment;
     let rawHeaders = selected.responseHeaders.rawHeaders.trim();
     if (Services.appinfo.OS !== "WINNT") {
       rawHeaders = rawHeaders.replace(/\r/g, "");
     }
-    clipboardHelper.copyString(rawHeaders, document);
+    clipboardHelper.copyString(rawHeaders);
   },
 
   /**
    * Copy image as data uri.
    */
   copyImageAsDataUri: function() {
     let selected = this.selectedItem.attachment;
     let { mimeType, text, encoding } = selected.responseContent.content;
 
     gNetwork.getString(text).then(aString => {
       let data = "data:" + mimeType + ";" + encoding + "," + aString;
-      clipboardHelper.copyString(data, document);
+      clipboardHelper.copyString(data);
     });
   },
 
   /**
    * Copy response data as a string.
    */
   copyResponse: function() {
     let selected = this.selectedItem.attachment;
     let text = selected.responseContent.content.text;
 
     gNetwork.getString(text).then(aString => {
-      clipboardHelper.copyString(aString, document);
+      clipboardHelper.copyString(aString);
     });
   },
 
   /**
    * Create a new custom request form populated with the data from
    * the currently selected request.
    */
   cloneSelectedRequest: function() {
--- a/browser/devtools/styleinspector/computed-view.js
+++ b/browser/devtools/styleinspector/computed-view.js
@@ -811,17 +811,17 @@ CssHtmlTree.prototype = {
       event.stopPropagation();
       event.preventDefault();
       let browserWin = this.inspector.target.tab.ownerDocument.defaultView;
       browserWin.openUILinkIn(target.href, "tab");
     }
   },
 
   _onCopyColor: function() {
-    clipboardHelper.copyString(this._colorToCopy, this.styleDocument);
+    clipboardHelper.copyString(this._colorToCopy);
   },
 
   /**
    * Copy selected text.
    *
    * @param event The event object
    */
   _onCopy: function(event)
@@ -849,17 +849,17 @@ CssHtmlTree.prototype = {
             }
           }
         }
       } else {
         // Short text fragment.
         result = textArray[0];
       }
 
-      clipboardHelper.copyString(result, this.styleDocument);
+      clipboardHelper.copyString(result);
 
       if (event) {
         event.preventDefault();
       }
     } catch(e) {
       console.error(e);
     }
   },
--- a/browser/devtools/styleinspector/rule-view.js
+++ b/browser/devtools/styleinspector/rule-view.js
@@ -1506,28 +1506,28 @@ CssRuleView.prototype = {
         text = text.replace(/(\r?\n)\r?\n/g, "$1");
 
         // Remove "inline"
         let inline = _strings.GetStringFromName("rule.sourceInline");
         let rx = new RegExp("^" + inline + "\\r?\\n?", "g");
         text = text.replace(rx, "");
       }
 
-      clipboardHelper.copyString(text, this.doc);
+      clipboardHelper.copyString(text);
       event.preventDefault();
     } catch(e) {
       console.error(e);
     }
   },
 
   /**
    * Copy the most recently selected color value to clipboard.
    */
   _onCopyColor: function() {
-    clipboardHelper.copyString(this._colorToCopy, this.styleDocument);
+    clipboardHelper.copyString(this._colorToCopy);
   },
 
   /**
    *  Toggle the original sources pref.
    */
   _onToggleOrigSources: function() {
     let isEnabled = Services.prefs.getBoolPref(PREF_ORIG_SOURCES);
     Services.prefs.setBoolPref(PREF_ORIG_SOURCES, !isEnabled);
--- a/browser/devtools/webconsole/test/browser_webconsole_autocomplete_and_selfxss.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_autocomplete_and_selfxss.js
@@ -34,17 +34,17 @@ function consoleOpened(HUD) {
   // wait for key "u"
   function onCompletionValue() {
     completionValue = jsterm.completeNode.value;
 
     // Arguments: expected, setup, success, failure.
     waitForClipboard(
       stringToCopy,
       function() {
-        clipboardHelper.copyString(stringToCopy, document);
+        clipboardHelper.copyString(stringToCopy);
       },
       onClipboardCopy,
       finishTest);
   }
 
   function onClipboardCopy() {
     testSelfXss();
 
--- a/browser/devtools/webconsole/webconsole.js
+++ b/browser/devtools/webconsole/webconsole.js
@@ -2869,17 +2869,17 @@ WebConsoleFrame.prototype = {
           strings.push(item.url);
         }
         else {
           strings.push(item.clipboardText);
         }
       }
     }
 
-    clipboardHelper.copyString(strings.join("\n"), this.document);
+    clipboardHelper.copyString(strings.join("\n"));
   },
 
   /**
    * Object properties provider. This function gives you the properties of the
    * remote object you want.
    *
    * @param string aActor
    *        The object actor ID from which you want the properties.
--- a/dom/tests/mochitest/general/test_paste_selection.html
+++ b/dom/tests/mochitest/general/test_paste_selection.html
@@ -42,18 +42,17 @@ function selectArea()
   copyArea.focus();
   copyArea.select();
   synthesizeKey("x", { accelKey: true });
 
   if (supportsSelectionClipboard) {
     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);
 }
 
 var selectionPasted = false;
 var globalPasted = false;
 
--- a/editor/libeditor/tests/test_bug830600.html
+++ b/editor/libeditor/tests/test_bug830600.html
@@ -35,17 +35,17 @@ https://bugzilla.mozilla.org/show_bug.cg
           t.value = "";
           t.editor.QueryInterface(Ci.nsIPlaintextEditor);
           var origNewlineHandling = t.editor.newlineHandling;
           t.editor.newlineHandling = Ci.nsIPlaintextEditor.eNewlinesStripSurroundingWhitespace
           SimpleTest.waitForClipboard(str,
             function() {
               Components.classes["@mozilla.org/widget/clipboardhelper;1"]
                         .getService(Components.interfaces.nsIClipboardHelper)
-                        .copyString(str, document);
+                        .copyString(str);
             },
             function() {
               synthesizeKey("V", {accelKey: true});
               is(t.value, expected, "New line handling works correctly");
               t.value = "";
               callback();
             },
             function() {
--- a/mobile/android/chrome/content/ActionBarHandler.js
+++ b/mobile/android/chrome/content/ActionBarHandler.js
@@ -324,17 +324,17 @@ var ActionBarHandler = {
         },
       },
 
       action: function(element, win) {
         // First copy the selection text to the clipboard.
         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");
 
         // Then cut the selection text.
         ActionBarHandler._getSelection(element, win).deleteFromDocument();
 
         ActionBarHandler._uninit();
@@ -359,17 +359,17 @@ var ActionBarHandler = {
           return (ActionBarHandler._getSelectedText().length > 0);
         },
       },
 
       action: function(element, win) {
         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");
 
         ActionBarHandler._uninit();
         UITelemetry.addEvent("action.1", "actionbar", null, "copy");
       },
     },
--- a/mobile/android/chrome/content/SelectionHandler.js
+++ b/mobile/android/chrome/content/SelectionHandler.js
@@ -1093,17 +1093,17 @@ var SelectionHandler = {
     this._domWinUtils.sendMouseEventToWindow("mousedown", aX, aY, 0, 0, 0, true);
     this._domWinUtils.sendMouseEventToWindow("mouseup", aX, aY, 0, 0, 0, true);
   },
 
   copySelection: function sh_copySelection() {
     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();
   },
 
   shareSelection: function sh_shareSelection() {
     let selectedText = this._getSelectedText();
     if (selectedText.length) {
--- a/mobile/android/tests/browser/robocop/roboextender/testSelectionHandler.html
+++ b/mobile/android/tests/browser/robocop/roboextender/testSelectionHandler.html
@@ -356,17 +356,17 @@ function testAttachCaretFail() {
 /* =================================================================================
  *
  * Tests to ensure we can paste text inside editable elements
  *
  */
 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");
   div.contentEditable = true;
   div.dataset.editable = true;
   document.body.appendChild(div);
 
   let elements = document.querySelectorAll("div, input, textarea");
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -1565,17 +1565,17 @@ SpecialPowersAPI.prototype = {
     Components.classes["@mozilla.org/categorymanager;1"].
       getService(Components.interfaces.nsICategoryManager).
       deleteCategoryEntry(category, entry, persists);
   },
 
   copyString: function(str, doc) {
     Components.classes["@mozilla.org/widget/clipboardhelper;1"].
       getService(Components.interfaces.nsIClipboardHelper).
-      copyString(str, doc);
+      copyString(str);
   },
 
   openDialog: function(win, args) {
     return win.openDialog.apply(win, args);
   },
 
   // :jdm gets credit for this.  ex: getPrivilegedProps(window, 'location.href');
   getPrivilegedProps: function(obj, props) {
@@ -1649,17 +1649,17 @@ SpecialPowersAPI.prototype = {
       return "";
 
     return data.QueryInterface(Components.interfaces.nsISupportsString).data;
   },
 
   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() {
     if (this._cb == null) {
       this._cb = Components.classes["@mozilla.org/widget/clipboard;1"].
                             getService(Components.interfaces.nsIClipboard);
     }
     return this._cb.supportsSelectionClipboard();
--- a/toolkit/components/console/content/consoleBindings.xml
+++ b/toolkit/components/console/content/consoleBindings.xml
@@ -290,17 +290,17 @@
 
       <method name="copySelectedItem">
         <body><![CDATA[
           if (this.mSelectedItem) try {
             const clipURI = "@mozilla.org/widget/clipboardhelper;1";
             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
           }
         ]]></body>
       </method>
 
       <method name="createConsoleRow">
         <body><![CDATA[
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -358,17 +358,17 @@ function CopyPassword() {
   // password hasn't been entered.
   if (!showingPasswords && !masterPasswordLogin())
     return;
   // Copy selected signon's password to clipboard
   var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"].
                   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);
 }
 
 function CopyUsername() {
   // Copy selected signon's username to clipboard
   var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"].
                   getService(Components.interfaces.nsIClipboardHelper);
   var row = document.getElementById("signonsTree").currentIndex;
--- a/toolkit/components/viewconfig/content/config.js
+++ b/toolkit/components/viewconfig/content/config.js
@@ -530,27 +530,27 @@ function updateContextMenu()
   var toggleSelected = document.getElementById("toggleSelected");
   toggleSelected.setAttribute("disabled", isLocked);
   toggleSelected.hidden = !canToggle;
 }
 
 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()
 {
   if (view.selection.currentIndex >= 0)
     ModifyPref(gPrefView[view.selection.currentIndex]);
 }
 
--- a/toolkit/components/viewsource/content/viewSource.js
+++ b/toolkit/components/viewsource/content/viewSource.js
@@ -493,17 +493,17 @@ let ViewSourceChrome = {
     // It doesn't make any sense to call this if the context menu
     // isn't open...
     if (!this.contextMenuData.isOpen) {
       return;
     }
 
     let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
                       .getService(Ci.nsIClipboardHelper);
-    clipboard.copyString(this.contextMenuData.href, document);
+    clipboard.copyString(this.contextMenuData.href);
   },
 
   /**
    * Called when the context menu closes, and invalidates any data
    * that the frame script might have sent up about what the context
    * menu was opened on.
    */
   onContextMenuHidden(event) {
--- a/toolkit/content/tests/chrome/test_autocomplete_delayOnPaste.xul
+++ b/toolkit/content/tests/chrome/test_autocomplete_delayOnPaste.xul
@@ -105,17 +105,17 @@ function runTest() {
     synthesizeKey("v", { accelKey: true });
     is(gAutoComplete.value, SEARCH_STRING, "Value should not be autocompleted immediately");
   }
 
   SimpleTest.waitForClipboard(SEARCH_STRING, function () {
     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);
 }
 ]]>
 </script>
 
 <body xmlns="http://www.w3.org/1999/xhtml">
 <p id="display">
 </p>
--- a/toolkit/content/tests/chrome/test_bug253481.xul
+++ b/toolkit/content/tests/chrome/test_bug253481.xul
@@ -64,17 +64,17 @@ var expectedResults = {
 // "stripsurroundingwhitespace" strips all newlines and whitespace around them
 "stripsurroundingwhitespace": testString.replace(/\s*\n\s*/g,'')
 };
 
 // Put a multi-line string in the clipboard
 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);
   }
 
   SimpleTest.finish();
 }, function() {
   ok(false, "Could not copy the string to clipboard, giving up");
--- a/toolkit/modules/Finder.jsm
+++ b/toolkit/modules/Finder.jsm
@@ -98,18 +98,17 @@ Finder.prototype = {
                                         .QueryInterface(Ci.nsILoadContext));
   },
 
   set clipboardSearchString(aSearchString) {
     if (!aSearchString || !Clipboard.supportsFindClipboard())
       return;
 
     ClipboardHelper.copyStringToClipboard(aSearchString,
-                                          Ci.nsIClipboard.kFindClipboard,
-                                          this._getWindow().document);
+                                          Ci.nsIClipboard.kFindClipboard);
   },
 
   set caseSensitive(aSensitive) {
     this._fastFind.caseSensitive = aSensitive;
   },
 
   _lastFindResult: null,
 
--- a/toolkit/mozapps/downloads/content/downloads.js
+++ b/toolkit/mozapps/downloads/content/downloads.js
@@ -316,25 +316,25 @@ function copySourceLocation(aDownload)
   var uri = aDownload.getAttribute("uri");
   var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
                   getService(Ci.nsIClipboardHelper);
 
   // Check if we should initialize a callback
   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
   if (typeof gPerformAllCallback == "function")
     gPerformAllCallback(uri);
   else {
     // It's a plain copy source, so copy it
-    clipboard.copyString(uri, document);
+    clipboard.copyString(uri);
   }
 }
 
 /**
  * Remove the currently shown downloads from the download list.
  */
 function clearDownloadList() {
   // Clear the whole list if there's no search
--- a/webapprt/content/downloads/downloads.js
+++ b/webapprt/content/downloads/downloads.js
@@ -565,17 +565,17 @@ DownloadItem.prototype = {
 
       case "cmd_retry":
         this.retry().catch(Cu.reportError);
         break;
 
       case "cmd_copyLocation":
         let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
                         getService(Ci.nsIClipboardHelper);
-        clipboard.copyString(this.uri, document);
+        clipboard.copyString(this.uri);
         break;
     }
   },
 };
 
 let gDownloadList = {
   downloadItemsMap: new Map(),
   idToDownloadItemMap: new Map(),
--- a/widget/tests/test_clipboard.xul
+++ b/widget/tests/test_clipboard.xul
@@ -60,17 +60,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   function initAndRunTests() {
     let clipboard = Cc['@mozilla.org/widget/clipboard;1']
                     .getService(Ci.nsIClipboard);
 
     // Test copy.
     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
     if (!kIsMac) {
       clipboard.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
       is(paste(clipboard), '', 'Data was successfully cleared.');
     }
   }