Bug 1498812 - Part 6: Allow promiseBrowserEvent to listen in system group. r=mikedeboer
authorJan Henning <jh+bugzilla@buttercookie.de>
Fri, 11 Jan 2019 19:49:34 +0000
changeset 453550 4eccacfc8801a8401d72458210dac451515b5bda
parent 453549 710922bc053aa9fbf9c54af538c8c005770c9a14
child 453551 c4fbfcb5239ba0b34d5845512cbb7f810fd64798
push id35360
push usernbeleuzu@mozilla.com
push dateSat, 12 Jan 2019 09:39:47 +0000
treeherdermozilla-central@cb35977ae7a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1498812
milestone66.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 1498812 - Part 6: Allow promiseBrowserEvent to listen in system group. r=mikedeboer Likewise the only way to catch our internal visual viewport events. Differential Revision: https://phabricator.services.mozilla.com/D15687
mobile/android/tests/browser/chrome/head.js
--- a/mobile/android/tests/browser/chrome/head.js
+++ b/mobile/android/tests/browser/chrome/head.js
@@ -1,30 +1,34 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-function promiseBrowserEvent(browserOrFrame, eventType, options) {
+function promiseBrowserEvent(browserOrFrame, eventType, options = {}) {
+  let listenerOptions = { capture: true };
+  if (options.mozSystemGroup) {
+    listenerOptions.mozSystemGroup = true;
+  }
   return new Promise((resolve) => {
     function handle(event) {
       // Since we'll be redirecting, don't make assumptions about the given URL and the loaded URL
       if (event.target != (browserOrFrame.contentDocument || browserOrFrame.document) ||
                           event.target.location.href == "about:blank") {
         info("Skipping spurious '" + eventType + "' event" + " for " + event.target.location.href);
         return;
       }
       info("Received event " + eventType + " from browser");
-      browserOrFrame.removeEventListener(eventType, handle, true);
-      if (options && options.resolveAtNextTick) {
+      browserOrFrame.removeEventListener(eventType, handle, listenerOptions);
+      if (options.resolveAtNextTick) {
         Services.tm.dispatchToMainThread(() => resolve(event));
       } else {
         resolve(event);
       }
     }
 
-    browserOrFrame.addEventListener(eventType, handle, true);
+    browserOrFrame.addEventListener(eventType, handle, listenerOptions);
     info("Now waiting for " + eventType + " event from browser");
   });
 }
 
 function promiseTabEvent(container, eventType) {
   return new Promise((resolve) => {
     function handle(event) {
       info("Received event " + eventType + " from container");