Bug 1271119 - Add SpecialPowers.doCommand() and .setCommandNode(); r?mrbkap draft
authorAryeh Gregor <ayg@aryeh.name>
Tue, 30 Aug 2016 18:00:07 +0300
changeset 429802 3a32dae52b8d5b3de7bc060e00b4d7f3b801d505
parent 429179 c6ccd71126ff514bfc44b53e2217562e29a0cc38
child 429803 ef64972529d13a93beb4e5dd2f5b99a87ced5a51
child 430254 210e7dcb484a9ebbb68144964c893c05efa985b7
push id33662
push userayg@aryeh.name
push dateWed, 26 Oct 2016 14:40:00 +0000
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;