Bug 1166840 - Merge SpecialPowers.{copyString,clipboardCopyString}. r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 21 May 2015 21:50:04 +0100
changeset 245221 ec14eee472e5a5c5ed4be338f6d32d8716b99557
parent 245220 b83845e4117ceffbfd3726b1cd46c1b5af96354b
child 245222 9e89159cbe385d31bd3876515ffdcfff5544571b
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 - Merge SpecialPowers.{copyString,clipboardCopyString}. r=ehsan
editor/libeditor/tests/test_bug681229.html
testing/specialpowers/content/specialpowersAPI.js
--- a/editor/libeditor/tests/test_bug681229.html
+++ b/editor/libeditor/tests/test_bug681229.html
@@ -27,17 +27,17 @@ SimpleTest.waitForFocus(function() {
   t.focus();
 
   const kValue = "a\r\nb";
   const kExpectedValue = (navigator.platform.indexOf("Win") == 0) ?
     "a\nb" : kValue;
 
   SimpleTest.waitForClipboard(kExpectedValue,
     function() {
-      SpecialPowers.copyString(kValue, document);
+      SpecialPowers.clipboardCopyString(kValue);
     },
     function() {
       synthesizeKey("V", {accelKey: true});
       is(t.value, "a\nb", "The carriage return has been correctly sanitized");
       SimpleTest.finish();
     },
     function() {
       SimpleTest.finish();
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -1562,22 +1562,16 @@ SpecialPowersAPI.prototype = {
   },
 
   deleteCategoryEntry: function(category, entry, persists) {
     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);
-  },
-
   openDialog: function(win, args) {
     return win.openDialog.apply(win, args);
   },
 
   // :jdm gets credit for this.  ex: getPrivilegedProps(window, 'location.href');
   getPrivilegedProps: function(obj, props) {
     var parts = props.split('.');
 
@@ -1646,20 +1640,20 @@ SpecialPowersAPI.prototype = {
     } catch (e) {}
     data = data.value || null;
     if (data == null)
       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);
+  clipboardCopyString: function(str) {
+    Cc["@mozilla.org/widget/clipboardhelper;1"].
+      getService(Ci.nsIClipboardHelper).
+      copyString(str);
   },
 
   supportsSelectionClipboard: function() {
     if (this._cb == null) {
       this._cb = Components.classes["@mozilla.org/widget/clipboard;1"].
                             getService(Components.interfaces.nsIClipboard);
     }
     return this._cb.supportsSelectionClipboard();