Bug 1271119 - Add SpecialPowers.doCommand() and .setCommandNode(); r=mrbkap
authorAryeh Gregor <ayg@aryeh.name>
Tue, 30 Aug 2016 18:00:07 +0300
changeset 347277 9ceb151e3e5130f6e5a49b81ebefc273dfb633a1
parent 347276 f474e1e8bec7edd04ecd267e11b050f1ddde4e72
child 347278 26187d6585ae2f40ec06c153e58539f5fffb37d6
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1271119
milestone52.0a1
Bug 1271119 - Add SpecialPowers.doCommand() and .setCommandNode(); r=mrbkap This is needed to port various editor tests from chrome to plain mochitests. MozReview-Commit-ID: BXNe0EiqVgV
testing/specialpowers/content/specialpowersAPI.js
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -2078,13 +2078,23 @@ SpecialPowersAPI.prototype = {
       },
     };
   },
 
   observeMutationEvents: function(mo, node, nativeAnonymousChildList, subtree) {
     unwrapIfWrapped(mo).observe(unwrapIfWrapped(node),
                                 {nativeAnonymousChildList, subtree});
   },
+
+  doCommand(window, cmd) {
+    return this._getDocShell(window).doCommand(cmd);
+  },
+
+  setCommandNode(window, node) {
+    return this._getDocShell(window).contentViewer
+               .QueryInterface(Ci.nsIContentViewerEdit)
+               .setCommandNode(node);
+  },
 };
 
 this.SpecialPowersAPI = SpecialPowersAPI;
 this.bindDOMWindowUtils = bindDOMWindowUtils;
 this.getRawComponents = getRawComponents;