Bug 1594786 - Part 1 - Add withHandlingUserInput function to extension test suite. r=rpl
☠☠ backed out by b2cc8d30ec21 ☠ ☠
authorHarry Twyford <htwyford@mozilla.com>
Wed, 20 Nov 2019 19:26:54 +0000
changeset 503332 da5d5f59a7da9645dc99a684a4f4564c46dda24f
parent 503331 914860bfb51ae6adea42d1c52f5570aaf2af66e6
child 503333 6f9f1ab3675637dc26e84197b2c43938566eeca9
push id36833
push userbtara@mozilla.com
push dateFri, 22 Nov 2019 21:40:53 +0000
treeherdermozilla-central@2c912e46295e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrpl
bugs1594786
milestone72.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 1594786 - Part 1 - Add withHandlingUserInput function to extension test suite. r=rpl Differential Revision: https://phabricator.services.mozilla.com/D53981
toolkit/components/extensions/child/ext-test.js
toolkit/components/extensions/schemas/test.json
--- a/toolkit/components/extensions/child/ext-test.js
+++ b/toolkit/components/extensions/child/ext-test.js
@@ -106,16 +106,23 @@ this.test = class extends ExtensionAPI {
             assertTrue(false, `${e}\n${e.stack}`);
           }
         }, ...args);
       }
     }
 
     return {
       test: {
+        withHandlingUserInput(callback) {
+          ExtensionCommon.withHandlingUserInput(
+            context.contentWindow,
+            callback
+          );
+        },
+
         sendMessage(...args) {
           extension.emit("test-message", ...args);
         },
 
         notifyPass(msg) {
           extension.emit("test-done", true, msg, getStack());
         },
 
--- a/toolkit/components/extensions/schemas/test.json
+++ b/toolkit/components/extensions/schemas/test.json
@@ -5,16 +5,24 @@
 [
   {
     "namespace": "test",
     "allowedContexts": ["content", "devtools"],
     "defaultContexts": ["content", "devtools"],
     "description": "none",
     "functions": [
       {
+        "name": "withHandlingUserInput",
+        "type": "function",
+        "description": "Calls the callback function wrapped with user input set.  This is only used for internal unit testing.",
+        "parameters": [
+          {"type": "function", "name": "callback"}
+        ]
+      },
+      {
         "name": "notifyFail",
         "type": "function",
         "description": "Notifies the browser process that test code running in the extension failed.  This is only used for internal unit testing.",
         "parameters": [
           {"type": "string", "name": "message"}
         ]
       },
       {