Bug 769881 - copyStringToClipboard Optional parameters should go at the end, also this will make it backward compatible for version bumped extensions; r=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 01 Jul 2012 14:18:23 -0400
changeset 102905 108984fa0a891e621ffee7055af96bd47b850c94
parent 102904 61b94ce72be4196c74aad49d812243885f9cfcf6
child 102906 8824db9aa7094b683429378bc4234482c3f666ab
push id1316
push userakeybl@mozilla.com
push dateMon, 27 Aug 2012 22:37:00 +0000
treeherdermozilla-beta@db4b09302ee2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs769881
milestone16.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 769881 - copyStringToClipboard Optional parameters should go at the end, also this will make it backward compatible for version bumped extensions; r=roc
browser/base/content/urlbarBindings.xml
browser/devtools/sourceeditor/source-editor-orion.jsm
browser/devtools/sourceeditor/test/browser_bug695035_middle_click_paste.js
browser/devtools/sourceeditor/test/head.js
toolkit/content/tests/chrome/test_autocomplete_delayOnPaste.xul
widget/nsIClipboardHelper.idl
widget/xpwidgets/nsClipboardHelper.cpp
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -748,17 +748,17 @@
           return;
 
         var val = this._getSelectedValueForClipboard();
         if (!val)
           return;
 
         Cc["@mozilla.org/widget/clipboardhelper;1"]
           .getService(Ci.nsIClipboardHelper)
-          .copyStringToClipboard(val, document, Ci.nsIClipboard.kSelectionClipboard);
+          .copyStringToClipboard(val, Ci.nsIClipboard.kSelectionClipboard, document);
       ]]></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/devtools/sourceeditor/source-editor-orion.jsm
+++ b/browser/devtools/sourceeditor/source-editor-orion.jsm
@@ -758,18 +758,18 @@ SourceEditor.prototype = {
     this._primarySelectionTimeout = null;
 
     let text = this.getSelectedText();
     if (!text) {
       return;
     }
 
     clipboardHelper.copyStringToClipboard(text,
-                                          this.parentElement.ownerDocument,
-                                          Ci.nsIClipboard.kSelectionClipboard);
+                                          Ci.nsIClipboard.kSelectionClipboard,
+                                          this.parentElement.ownerDocument);
   },
 
   /**
    * Highlight the current line using the Orion annotation model.
    *
    * @private
    * @param object aEvent
    *        The Selection event object.
--- a/browser/devtools/sourceeditor/test/browser_bug695035_middle_click_paste.js
+++ b/browser/devtools/sourceeditor/test/browser_bug695035_middle_click_paste.js
@@ -49,18 +49,18 @@ function editorLoaded()
   editor.setText(initialText);
 
   let expectedString = "foobarBug695035-" + Date.now();
 
   let doCopy = function() {
     let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
                           getService(Ci.nsIClipboardHelper);
     clipboardHelper.copyStringToClipboard(expectedString,
-                                          testWin.document,
-                                          Ci.nsIClipboard.kSelectionClipboard);
+                                          Ci.nsIClipboard.kSelectionClipboard,
+                                          testWin.document);
   };
 
   let onCopy = function() {
     editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED, onPaste);
 
     EventUtils.synthesizeMouse(editor.editorElement, 10, 10, {}, testWin);
     EventUtils.synthesizeMouse(editor.editorElement, 11, 11, {button: 1}, testWin);
   };
--- a/browser/devtools/sourceeditor/test/head.js
+++ b/browser/devtools/sourceeditor/test/head.js
@@ -91,18 +91,18 @@ function waitForSelection(aExpectedStrin
 
     // First we wait for a known value different from the expected one.
     var preExpectedVal = waitForSelection._monotonicCounter +
                          "-waitForSelection-known-value";
 
     let clipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
                           getService(Ci.nsIClipboardHelper);
     clipboardHelper.copyStringToClipboard(preExpectedVal,
-                                          document,
-                                          Ci.nsIClipboard.kSelectionClipboard);
+                                          Ci.nsIClipboard.kSelectionClipboard,
+                                          document);
 
     wait(function(aData) aData == preExpectedVal,
          function() {
            // Call the original setup fn
            aSetupFn();
            wait(inputValidatorFn, aSuccessFn, aFailureFn, requestedFlavor);
          }, aFailureFn, "text/unicode");
 }
--- a/toolkit/content/tests/chrome/test_autocomplete_delayOnPaste.xul
+++ b/toolkit/content/tests/chrome/test_autocomplete_delayOnPaste.xul
@@ -104,17 +104,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, document, Components.interfaces.nsIClipboard.kGlobalClipboard);
+      .copyStringToClipboard(SEARCH_STRING, Components.interfaces.nsIClipboard.kGlobalClipboard, document);
   }, cbCallback, cbCallback);
 }
 ]]>
 </script>
 
 <body xmlns="http://www.w3.org/1999/xhtml">
 <p id="display">
 </p>
--- a/widget/nsIClipboardHelper.idl
+++ b/widget/nsIClipboardHelper.idl
@@ -12,29 +12,29 @@
 %}
 
 interface nsIDOMDocument;
 
 /**
  * helper service for common uses of nsIClipboard.
  */
 
-[scriptable, uuid(836316a9-6834-45e7-92af-5a4b9bd01a31)]
+[scriptable, uuid(c9d5a750-c3a8-11e1-9b21-0800200c9a66)]
 interface nsIClipboardHelper : nsISupports
 {
 
   /**
    * copy string to given clipboard
    *
    * @param aString, the string to copy to the clipboard
    * @param aDoc, the source document for the string, if available
    * @param aClipboardID, the ID of the clipboard to copy to
    *        (eg. kSelectionClipboard -- see nsIClipboard.idl)
    */
-  void copyStringToClipboard(in AString aString, [optional] in nsIDOMDocument aDoc, in long aClipboardID);
+  void copyStringToClipboard(in AString aString, in long aClipboardID, [optional] in nsIDOMDocument aDoc);
 
   /**
    * copy string to (default) clipboard
    *
    * @param aString, the string to copy to the clipboard
    * @param aDoc, the source document for the string, if available
    */
   void copyString(in AString aString, [optional] in nsIDOMDocument aDoc);
--- a/widget/xpwidgets/nsClipboardHelper.cpp
+++ b/widget/xpwidgets/nsClipboardHelper.cpp
@@ -34,18 +34,18 @@ nsClipboardHelper::~nsClipboardHelper()
 }
 
 /*****************************************************************************
  * nsIClipboardHelper methods
  *****************************************************************************/
 
 NS_IMETHODIMP
 nsClipboardHelper::CopyStringToClipboard(const nsAString& aString,
-                                         nsIDOMDocument* aDocument,
-                                         PRInt32 aClipboardID)
+                                         PRInt32 aClipboardID,
+                                         nsIDOMDocument* aDocument)
 {
   nsresult rv;
 
   // get the clipboard
   nsCOMPtr<nsIClipboard>
     clipboard(do_GetService("@mozilla.org/widget/clipboard;1", &rv));
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ENSURE_TRUE(clipboard, NS_ERROR_FAILURE);
@@ -103,24 +103,24 @@ nsClipboardHelper::CopyStringToClipboard
 }
 
 NS_IMETHODIMP
 nsClipboardHelper::CopyString(const nsAString& aString, nsIDOMDocument* aDocument)
 {
   nsresult rv;
 
   // copy to the global clipboard. it's bad if this fails in any way.
-  rv = CopyStringToClipboard(aString, aDocument, nsIClipboard::kGlobalClipboard);
+  rv = CopyStringToClipboard(aString, nsIClipboard::kGlobalClipboard, aDocument);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // unix also needs us to copy to the selection clipboard. this will
   // fail in CopyStringToClipboard if we're not on a platform that
   // supports the selection clipboard. (this could have been #ifdef
   // XP_UNIX, but using the SupportsSelectionClipboard call is the
   // more correct thing to do.
   //
   // if this fails in any way other than "not being unix", we'll get
   // the assertion we need in CopyStringToClipboard, and we needn't
   // assert again here.
-  CopyStringToClipboard(aString, aDocument, nsIClipboard::kSelectionClipboard);
+  CopyStringToClipboard(aString, nsIClipboard::kSelectionClipboard, aDocument);
 
   return NS_OK;
 }